[PATCH 0/2] MR10313: user32: Add DelegateInput() stub.
For React Native. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10313
From: Zhiyi Zhang <zzhang@codeweavers.com> React Native expects the return value to be non-zero. --- dlls/user32/input.c | 11 +++++++++++ dlls/user32/tests/input.c | 18 ++++++++++++++++++ dlls/user32/user32.spec | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 6d26e4feb3b..fb773d1a9f7 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -848,3 +848,14 @@ HSYNTHETICPOINTERDEVICE WINAPI CreateSyntheticPointerDevice(POINTER_INPUT_TYPE t SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); return NULL; } + +/*********************************************************************** + * DelegateInput (USER32.@) + * + * Undocumented. Function prototype might be wrong. + */ +BOOL WINAPI DelegateInput(void *p1, void *p2, void *p3, void *p4, void *p5, void *p6) +{ + FIXME( "p1 %p p2 %p p3 %p p4 %p p5 %p p6 %p stub!\n", p1, p2, p3, p4, p5, p6 ); + return TRUE; +} diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index a81ea1d9ab5..43ccda38fb9 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -431,6 +431,7 @@ static UINT (WINAPI *pGetRawInputDeviceInfoA) (HANDLE, UINT, void *, UINT *); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); static HKL (WINAPI *pLoadKeyboardLayoutEx)(HKL, const WCHAR *, UINT); static INT (WINAPI *pScheduleDispatchNotification)(HWND); +static BOOL (WINAPI *pDelegateInput)(void *, void *, void *, void *, void *, void *); /**********************adapted from input.c **********************************/ @@ -446,6 +447,7 @@ static void init_function_pointers(void) if (!(p ## func = (void*)GetProcAddress(hdll, #func))) \ trace("GetProcAddress(%s) failed\n", #func) + GET_PROC(DelegateInput); GET_PROC(EnableMouseInPointer); GET_PROC(IsMouseInPointerEnabled); GET_PROC(GetCurrentInputMessageSource); @@ -6472,6 +6474,21 @@ static void test_ScheduleDispatchNotification(void) DestroyWindow(hwnd); } +static void test_DelegateInput(void) +{ + BOOL ret; + + if (!pDelegateInput) + { + win_skip("DelegateInput is unavailable.\n"); + return; + } + + ret = pDelegateInput(0, 0, 0, 0, 0, 0); + todo_wine + ok(ret == 0, "Got unexpected ret %d.\n", ret); +} + START_TEST(input) { char **argv; @@ -6517,6 +6534,7 @@ START_TEST(input) test_rawinput(argv[0]); test_DefRawInputProc(); test_ScheduleDispatchNotification(); + test_DelegateInput(); if(pGetMouseMovePointsEx) test_GetMouseMovePointsEx( argv ); diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 0645792a312..5c61bdd6546 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -14,7 +14,7 @@ 2010 stub -noname SlicerControl # NtUserSlicerControl -2503 stub DelegateInput # NtUserDelegateInput +2503 stdcall DelegateInput(ptr ptr ptr ptr ptr ptr) # NtUserDelegateInput 2504 stub UndelegateInput # NtUserUndelegateInput 2505 stub HandleDelegatedInput # NtUserHandleDelegatedInput 2506 stub @ -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10313
From: Zhiyi Zhang <zzhang@codeweavers.com> --- dlls/user32/input.c | 10 ++++++++++ dlls/user32/tests/input.c | 8 ++++++-- dlls/user32/user32.spec | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dlls/user32/input.c b/dlls/user32/input.c index fb773d1a9f7..a6837657c5a 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -859,3 +859,13 @@ BOOL WINAPI DelegateInput(void *p1, void *p2, void *p3, void *p4, void *p5, void FIXME( "p1 %p p2 %p p3 %p p4 %p p5 %p p6 %p stub!\n", p1, p2, p3, p4, p5, p6 ); return TRUE; } + +/*********************************************************************** + * UndelegateInput (USER32.@) + * + * Undocumented. Function prototype might be wrong. + */ +void WINAPI UndelegateInput(void *p1, void *p2) +{ + FIXME( "p1 %p p2 %p stub!\n", p1, p2 ); +} diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 43ccda38fb9..7e4e1506c69 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -432,6 +432,7 @@ static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); static HKL (WINAPI *pLoadKeyboardLayoutEx)(HKL, const WCHAR *, UINT); static INT (WINAPI *pScheduleDispatchNotification)(HWND); static BOOL (WINAPI *pDelegateInput)(void *, void *, void *, void *, void *, void *); +static void (WINAPI *pUndelegateInput)(void *, void *); /**********************adapted from input.c **********************************/ @@ -461,6 +462,7 @@ static void init_function_pointers(void) GET_PROC(GetRawInputDeviceInfoW); GET_PROC(GetRawInputDeviceInfoA); GET_PROC(LoadKeyboardLayoutEx); + GET_PROC(UndelegateInput); hdll = GetModuleHandleA("kernel32"); GET_PROC(IsWow64Process); @@ -6478,15 +6480,17 @@ static void test_DelegateInput(void) { BOOL ret; - if (!pDelegateInput) + if (!pDelegateInput || !pUndelegateInput) { - win_skip("DelegateInput is unavailable.\n"); + win_skip("DelegateInput or UndelegateInput is unavailable.\n"); return; } ret = pDelegateInput(0, 0, 0, 0, 0, 0); todo_wine ok(ret == 0, "Got unexpected ret %d.\n", ret); + + pUndelegateInput(0, 0); } START_TEST(input) diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 5c61bdd6546..b8939646668 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -15,7 +15,7 @@ 2010 stub -noname SlicerControl # NtUserSlicerControl 2503 stdcall DelegateInput(ptr ptr ptr ptr ptr ptr) # NtUserDelegateInput -2504 stub UndelegateInput # NtUserUndelegateInput +2504 stdcall UndelegateInput(ptr ptr) # NtUserUndelegateInput 2505 stub HandleDelegatedInput # NtUserHandleDelegatedInput 2506 stub @ 2507 stub -noname SetAutoRotation # NtUserSetAutoRotation -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10313
Rémi Bernon (@rbernon) commented about dlls/user32/user32.spec:
2010 stub -noname SlicerControl # NtUserSlicerControl
-2503 stub DelegateInput # NtUserDelegateInput +2503 stdcall DelegateInput(ptr ptr ptr ptr ptr ptr) # NtUserDelegateInput
Why not forward to NtUserDelegateInput? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10313#note_132733
On Thu Mar 19 08:29:02 2026 +0000, Rémi Bernon wrote:
Why not forward to NtUserDelegateInput (which is then the function that should be stubbed instead)? It's because its prototype is unknown. Suppose one of the parameters is a pointer to a struct. Then we might need to convert that struct from the 32-bit version to the 64-bit version in wow64_NtUserDelegateInput(). Without a correct prototype, I can only assume those parameters are all simple pointers in wow64_NtUserDelegateInput() or simply return TRUE in wow64_NtUserDelegateInput(). I can add such a wrapper. I just don't think it's useful. So I wanted to keep the changes minimal.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10313#note_132745
On Thu Mar 19 08:59:20 2026 +0000, Zhiyi Zhang wrote:
It's because its prototype is unknown. Suppose one of the parameters is a pointer to a struct. Then we might need to convert that struct from the 32-bit version to the 64-bit version in wow64_NtUserDelegateInput(). Without a correct prototype, I can only assume those parameters are all simple pointers in wow64_NtUserDelegateInput() or simply return TRUE in wow64_NtUserDelegateInput(). I can add such a wrapper. I just don't think it's useful. So I wanted to keep the changes minimal. Okay, are we confident that it returns a BOOL? Coupled with UndelegateInput it seems like it could return some kind of handle or token instead?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10313#note_132750
On Thu Mar 19 10:32:45 2026 +0000, Rémi Bernon wrote:
Okay, are we confident that it returns a BOOL? Coupled with UndelegateInput it seems like it could return some kind of handle or token instead? I mean, if it is also unknown, maybe a UINT_PTR / void * return type is also more appropriate.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10313#note_132752
On Thu Mar 19 10:38:00 2026 +0000, Rémi Bernon wrote:
I mean, if it is also unknown, maybe a UINT_PTR / void * return type is also more appropriate. Anything non-zero from DelegateInput() is good enough. And the return value is not passed to UndelegateInput(). I will change it to UINT_PTR.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10313#note_132765
participants (3)
-
Rémi Bernon -
Zhiyi Zhang -
Zhiyi Zhang (@zhiyi)