Skip to content
Snippets Groups Projects
Commit d7d7414d authored by Alexandros Frantzis's avatar Alexandros Frantzis
Browse files

winewayland.drv: Introduce infrastructure for driver kernel callbacks.


This mechanism allows the unixlib code of the driver to call back into
the PE code.

Signed-off-by: default avatarAlexandros Frantzis <alexandros.frantzis@collabora.com>
parent 5c7dbab7
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,13 @@
#include "waylanddrv_dll.h"
typedef NTSTATUS (WINAPI *kernel_callback)(void *params, ULONG size);
static const kernel_callback kernel_callbacks[] =
{
};
C_ASSERT(NtUserDriverCallbackFirst + ARRAYSIZE(kernel_callbacks) == waylanddrv_client_func_last);
static DWORD WINAPI wayland_read_events_thread(void *arg)
{
WAYLANDDRV_UNIX_CALL(read_events, NULL);
......@@ -32,12 +39,17 @@ static DWORD WINAPI wayland_read_events_thread(void *arg)
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved)
{
DWORD tid;
void **callback_table;
if (reason != DLL_PROCESS_ATTACH) return TRUE;
DisableThreadLibraryCalls(instance);
if (__wine_init_unix_call()) return FALSE;
callback_table = NtCurrentTeb()->Peb->KernelCallbackTable;
memcpy(callback_table + NtUserDriverCallbackFirst, kernel_callbacks,
sizeof(kernel_callbacks));
if (WAYLANDDRV_UNIX_CALL(init, NULL))
return FALSE;
......
......@@ -19,8 +19,8 @@
#ifndef __WINE_WAYLANDDRV_UNIXLIB_H
#define __WINE_WAYLANDDRV_UNIXLIB_H
#include <stdarg.h>
#include "winternl.h"
#include "windef.h"
#include "ntuser.h"
#include "wine/unixlib.h"
enum waylanddrv_unix_func
......@@ -30,4 +30,12 @@ enum waylanddrv_unix_func
waylanddrv_unix_func_count,
};
/* driver client callbacks exposed with KernelCallbackTable interface */
enum waylanddrv_client_func
{
waylanddrv_client_func_last = NtUserDriverCallbackFirst
};
C_ASSERT(waylanddrv_client_func_last <= NtUserDriverCallbackLast + 1);
#endif /* __WINE_WAYLANDDRV_UNIXLIB_H */
......@@ -48,6 +48,8 @@
#include "unixlib.h"
#include "wine/gdi_driver.h"
#define WAYLANDDRV_CLIENT_CALL(func, params, size) waylanddrv_client_call(waylanddrv_client_func_ ## func, params, size)
/**********************************************************************
* Globals
*/
......@@ -794,6 +796,13 @@ static inline HWND get_focus(void)
return NtUserGetGUIThreadInfo(GetCurrentThreadId(), &info) ? info.hwndFocus : 0;
}
/**********************************************************************
* PE/unixlib support
*/
NTSTATUS waylanddrv_client_call(enum waylanddrv_client_func func, const void *params,
ULONG size) DECLSPEC_HIDDEN;
/**********************************************************************
* USER driver functions
*/
......
......@@ -230,3 +230,14 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] =
C_ASSERT(ARRAYSIZE(__wine_unix_call_wow64_funcs) == waylanddrv_unix_func_count);
#endif /* _WIN64 */
/***********************************************************************
* waylanddrv_client_call
*/
NTSTATUS waylanddrv_client_call(enum waylanddrv_client_func func, const void *params,
ULONG size)
{
void *ret_ptr;
ULONG ret_len;
return KeUserModeCallback(func, params, size, &ret_ptr, &ret_len);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment