diff --git a/dlls/wineandroid.drv/device.c b/dlls/wineandroid.drv/device.c index b8f6f97eec7..140ae82fe26 100644 --- a/dlls/wineandroid.drv/device.c +++ b/dlls/wineandroid.drv/device.c @@ -1177,7 +1177,8 @@ void start_android_device(void) { void *ret_ptr; ULONG ret_len; - thread = ULongToHandle( KeUserModeCallback( client_start_device, NULL, 0, &ret_ptr, &ret_len )); + KeUserModeCallback( client_start_device, NULL, 0, &ret_ptr, &ret_len ); + if (ret_len == sizeof(thread)) thread = *(HANDLE *)ret_ptr; } diff --git a/dlls/wineandroid.drv/dllmain.c b/dlls/wineandroid.drv/dllmain.c index 1045a902ae9..ceda9c5dfb2 100644 --- a/dlls/wineandroid.drv/dllmain.c +++ b/dlls/wineandroid.drv/dllmain.c @@ -34,7 +34,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(android); extern NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event ); static HANDLE stop_event; -static HANDLE thread; static NTSTATUS WINAPI ioctl_callback( DEVICE_OBJECT *device, IRP *irp ) @@ -97,10 +96,10 @@ static NTSTATUS WINAPI android_start_device(void *param, ULONG size) HANDLE handles[2]; handles[0] = CreateEventW( NULL, TRUE, FALSE, NULL ); - handles[1] = thread = CreateThread( NULL, 0, device_thread, handles[0], 0, NULL ); + handles[1] = CreateThread( NULL, 0, device_thread, handles[0], 0, NULL ); WaitForMultipleObjects( 2, handles, FALSE, INFINITE ); CloseHandle( handles[0] ); - return HandleToULong( thread ); + return NtCallbackReturn( &handles[1], sizeof(handles[1]), STATUS_SUCCESS ); }