From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/wineandroid.drv/Makefile.in | 7 +++---- dlls/wineandroid.drv/android.h | 2 ++ dlls/wineandroid.drv/device.c | 11 +++++++---- dlls/wineandroid.drv/dllmain.c | 10 +++++++++- dlls/wineandroid.drv/init.c | 12 +++++++++++- dlls/wineandroid.drv/keyboard.c | 4 ++++ dlls/wineandroid.drv/opengl.c | 4 ++++ dlls/wineandroid.drv/unixlib.h | 3 ++- dlls/wineandroid.drv/window.c | 15 ++++++++++----- 9 files changed, 52 insertions(+), 16 deletions(-)
diff --git a/dlls/wineandroid.drv/Makefile.in b/dlls/wineandroid.drv/Makefile.in index 4c4b63d2e78..a56ef3dc290 100644 --- a/dlls/wineandroid.drv/Makefile.in +++ b/dlls/wineandroid.drv/Makefile.in @@ -1,9 +1,8 @@ EXTRADEFS = -DWINE_NO_LONG_TYPES MODULE = wineandroid.drv -IMPORTS = user32 ntoskrnl win32u -EXTRALIBS = $(PTHREAD_LIBS) - -EXTRADLLFLAGS = -mcygwin +UNIXLIB = wineandroid.so +IMPORTS = ntoskrnl +EXTRALIBS = -lwin32u $(PTHREAD_LIBS)
C_SRCS = \ device.c \ diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index 22652f11d27..57f566b3cfd 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -120,6 +120,8 @@ extern NTSTATUS android_java_init( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS android_java_uninit( void *arg ) DECLSPEC_HIDDEN; extern NTSTATUS android_register_window( void *arg ) DECLSPEC_HIDDEN; extern PNTAPCFUNC register_window_callback; +extern NTSTATUS (WINAPI *pNtWaitForMultipleObjects)( ULONG,const HANDLE*,BOOLEAN, + BOOLEAN,const LARGE_INTEGER* ) DECLSPEC_HIDDEN;
extern unsigned int screen_width DECLSPEC_HIDDEN; extern unsigned int screen_height DECLSPEC_HIDDEN; diff --git a/dlls/wineandroid.drv/device.c b/dlls/wineandroid.drv/device.c index fa11e0d071e..62bcbae72f3 100644 --- a/dlls/wineandroid.drv/device.c +++ b/dlls/wineandroid.drv/device.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#if 0 +#pragma makedep unix +#endif + #include "config.h"
#include <assert.h> @@ -1174,10 +1178,9 @@ NTSTATUS android_java_uninit( void *arg )
void start_android_device(void) { - /* FIXME: use KeUserModeCallback instead */ - NTSTATUS (WINAPI *func)(void *, ULONG) = - ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[client_start_device]; - func( NULL, 0 ); + void *ret_ptr; + ULONG ret_len; + thread = ULongToHandle( KeUserModeCallback( client_start_device, NULL, 0, &ret_ptr, &ret_len )); }
diff --git a/dlls/wineandroid.drv/dllmain.c b/dlls/wineandroid.drv/dllmain.c index 79b3c2c62a4..81581591770 100644 --- a/dlls/wineandroid.drv/dllmain.c +++ b/dlls/wineandroid.drv/dllmain.c @@ -32,6 +32,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(android);
+static unixlib_handle_t unix_handle; +static NTSTATUS (CDECL *unix_call)( enum android_funcs code, void *params ); + extern NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event ); static HANDLE stop_event; static HANDLE thread; @@ -122,13 +125,18 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) if (reason == DLL_PROCESS_ATTACH) return TRUE;
DisableThreadLibraryCalls( inst ); + if (NtQueryVirtualMemory( GetCurrentProcess(), inst, MemoryWineUnixFuncs, + &unix_handle, sizeof(unix_handle), NULL )) + return FALSE;
params.register_window_callback = register_window_callback; - if (ANDROID_CALL( init, ¶ms )) return FALSE; + params.pNtWaitForMultipleObjects = NtWaitForMultipleObjects; + if (__wine_unix_call( unix_handle, unix_init, ¶ms )) return FALSE;
callback_table = NtCurrentTeb()->Peb->KernelCallbackTable; callback_table[client_start_device] = android_start_device;
+ unix_call = params.unix_call; return TRUE; }
diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index 527eda7a241..170ccb064a7 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#if 0 +#pragma makedep unix +#endif + #define NONAMELESSSTRUCT #define NONAMELESSUNION #include "config.h" @@ -558,6 +562,10 @@ JavaVM **p_java_vm = NULL; jobject *p_java_object = NULL; unsigned short *p_java_gdt_sel = NULL;
+static NTSTATUS CDECL unix_call( enum android_funcs code, void *params ); +NTSTATUS (WINAPI *pNtWaitForMultipleObjects)( ULONG,const HANDLE*,BOOLEAN, + BOOLEAN,const LARGE_INTEGER* ); + static HRESULT android_init( void *arg ) { struct init_params *params = arg; @@ -603,6 +611,8 @@ static HRESULT android_init( void *arg ) #endif } __wine_set_user_driver( &android_drv_funcs, WINE_GDI_DRIVER_VERSION ); + pNtWaitForMultipleObjects = params->pNtWaitForMultipleObjects; + params->unix_call = unix_call; return STATUS_SUCCESS; }
@@ -621,7 +631,7 @@ C_ASSERT( ARRAYSIZE(__wine_unix_call_funcs) == unix_funcs_count );
/* FIXME: Use __wine_unix_call instead */ -NTSTATUS unix_call( enum android_funcs code, void *params ) +static NTSTATUS CDECL unix_call( enum android_funcs code, void *params ) { return __wine_unix_call_funcs[code]( params ); } diff --git a/dlls/wineandroid.drv/keyboard.c b/dlls/wineandroid.drv/keyboard.c index e92079c0f59..82035cc14dd 100644 --- a/dlls/wineandroid.drv/keyboard.c +++ b/dlls/wineandroid.drv/keyboard.c @@ -26,6 +26,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#if 0 +#pragma makedep unix +#endif + #define NONAMELESSUNION #define NONAMELESSSTRUCT
diff --git a/dlls/wineandroid.drv/opengl.c b/dlls/wineandroid.drv/opengl.c index d7026be6599..911f6e3f3d1 100644 --- a/dlls/wineandroid.drv/opengl.c +++ b/dlls/wineandroid.drv/opengl.c @@ -24,6 +24,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#if 0 +#pragma makedep unix +#endif + #include "config.h"
#include <assert.h> diff --git a/dlls/wineandroid.drv/unixlib.h b/dlls/wineandroid.drv/unixlib.h index 8a94bb1253a..92d28176ee7 100644 --- a/dlls/wineandroid.drv/unixlib.h +++ b/dlls/wineandroid.drv/unixlib.h @@ -31,13 +31,14 @@ enum android_funcs };
/* FIXME: Use __wine_unix_call when the rest of the stack is ready */ -extern NTSTATUS unix_call( enum android_funcs func, void *arg ) DECLSPEC_HIDDEN; #define ANDROID_CALL(func, params) unix_call( unix_ ## func, params )
/* android_init params */ struct init_params { PNTAPCFUNC register_window_callback; + NTSTATUS (WINAPI *pNtWaitForMultipleObjects)( ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER* ); + NTSTATUS (CDECL *unix_call)( enum android_funcs code, void *params ); };
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 3860e0a2772..c580a36c828 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -20,6 +20,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#if 0 +#pragma makedep unix +#endif + #define NONAMELESSUNION #define NONAMELESSSTRUCT
@@ -1164,14 +1168,15 @@ static const struct static int get_cursor_system_id( const ICONINFOEXW *info ) { const struct system_cursors *cursors; + const WCHAR *module; unsigned int i; - HMODULE module;
if (info->szResName[0]) return 0; /* only integer resources are supported here */ - if (!(module = GetModuleHandleW( info->szModName ))) return 0;
+ if ((module = wcsrchr( info->szModName, '\' ))) module++; + else module = info->szModName; for (i = 0; i < ARRAY_SIZE( module_cursors ); i++) - if (GetModuleHandleW( module_cursors[i].name ) == module) break; + if (!wcsicmp( module, module_cursors[i].name )) break; if (i == ARRAY_SIZE( module_cursors )) return 0;
cursors = module_cursors[i].cursors; @@ -1207,8 +1212,8 @@ NTSTATUS ANDROID_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles if (current_event) mask = 0; if (process_events( mask )) return count - 1; } - return NtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL), - !!(flags & MWMO_ALERTABLE), timeout ); + return pNtWaitForMultipleObjects( count, handles, !(flags & MWMO_WAITALL), + !!(flags & MWMO_ALERTABLE), timeout ); }
/**********************************************************************