[PATCH 1/3] user32: Make RegisterPointerDeviceNotifications return TRUE to fake success

Fabian Maurer dark.shadow4 at web.de
Thu Jun 7 16:53:40 CDT 2018


Thanks for your feedback,

I updated my GetPointerDevices stub to return FALSE when the application tries to load 
devices - now we only success if it queries the number of devices - and then we return 0. 
This should be alright.

I made a small testcase to test if windows returns success for 
RegisterTouchHitTestingWindow when the system doesn't have a pointer device - it does. 
Since there is no touch device, it should be fine if we just never send the message - even if 
the window is "registered".

I'd add a testcase, but I'm not sure how to go about that - since it's not guaranteed that 
every machine the test runs one has 0 pointer devices. An idea how I could go about that?

Regards,
Fabian Maurer

####################################
#define _WIN32_WINNT _WIN32_WINNT_WIN8
#include <windows.h>
#include <stdio.h>

static LRESULT WINAPI WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM 
lParam)
{
    return DefWindowProcA(hwnd, message, wParam, lParam);
}

int main(void)
{
    BOOL success;
    UINT32 count;
	WNDCLASSA cls = {0};
	HANDLE hwnd;
	POINTER_DEVICE_INFO devices[1];

    cls.lpfnWndProc = WndProc;
    cls.hInstance = GetModuleHandleA(0);
    cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
    cls.hbrBackground = GetStockObject(WHITE_BRUSH);
    cls.lpszClassName = "testclass";
    RegisterClassA(&cls);

    hwnd = CreateWindowA("testclass", "Test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 10, 
10, 300, 300, NULL, NULL, NULL, 0);
    printf("Handle: %p\n", hwnd);

    success = GetPointerDevices(&count, NULL);
    printf("success: %d, count: %d\n", success, count);

    success = RegisterTouchHitTestingWindow(hwnd, TOUCH_HIT_TESTING_CLIENT);
    printf("success: %d\n", success);

    count = 1;
    success = GetPointerDevices(&count, devices);
    printf("success: %d, count: %d\n", success, count);

    return 0;
}

####################################
output from testbot:
Handle: 00070234
success: 1, count: 0
success: 1
success: 0, count: 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20180607/28e26a58/attachment.html>


More information about the wine-devel mailing list