ReactOS 0.4.15-dev-7953-g1f49173
rawinput.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <windows.h>
#include "wine/test.h"
Include dependency graph for rawinput.c:

Go to the source code of this file.

Macros

#define STRICT
 
#define WIN32_LEAN_AND_MEAN
 

Functions

static void test_RegisterRawInputDevices (void)
 
 START_TEST (rawinput)
 

Macro Definition Documentation

◆ STRICT

#define STRICT

Definition at line 23 of file rawinput.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 24 of file rawinput.c.

Function Documentation

◆ START_TEST()

START_TEST ( rawinput  )

Definition at line 98 of file rawinput.c.

99{
101}
static void test_RegisterRawInputDevices(void)
Definition: rawinput.c:29

◆ test_RegisterRawInputDevices()

static void test_RegisterRawInputDevices ( void  )
static

Definition at line 29 of file rawinput.c.

30{
31 HWND hwnd;
32 RAWINPUTDEVICE raw_devices[1];
33 BOOL res;
34
35 raw_devices[0].usUsagePage = 0x01;
36 raw_devices[0].usUsage = 0x05;
37
38 hwnd = CreateWindowExA(WS_EX_TOPMOST, "static", "dinput", WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
39 ok(hwnd != NULL, "CreateWindowExA failed\n");
40
41
43 ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
44
45
46 raw_devices[0].dwFlags = 0;
47 raw_devices[0].hwndTarget = 0;
48
49 SetLastError(0xdeadbeef);
50 res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), 0);
51 ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
52 ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
53
54 SetLastError(0xdeadbeef);
55 res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
56 ok(res == TRUE, "RegisterRawInputDevices failed\n");
57 ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
58
59
60 /* RIDEV_REMOVE requires hwndTarget == NULL */
61 raw_devices[0].dwFlags = RIDEV_REMOVE;
62 raw_devices[0].hwndTarget = hwnd;
63
64 SetLastError(0xdeadbeef);
65 res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
66 ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
67 ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
68
69 raw_devices[0].hwndTarget = 0;
70
71 SetLastError(0xdeadbeef);
72 res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
73 ok(res == TRUE, "RegisterRawInputDevices failed\n");
74 ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
75
76
77 /* RIDEV_INPUTSINK requires hwndTarget != NULL */
78 raw_devices[0].dwFlags = RIDEV_INPUTSINK;
79 raw_devices[0].hwndTarget = 0;
80
81 SetLastError(0xdeadbeef);
82 res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
84 ok(res == FALSE, "RegisterRawInputDevices failed\n");
86 ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
87
88 raw_devices[0].hwndTarget = hwnd;
89
90 SetLastError(0xdeadbeef);
91 res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
92 ok(res == TRUE, "RegisterRawInputDevices succeeded\n");
93 ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
94
96}
#define ok(value,...)
Definition: atltest.h:57
#define ARRAY_SIZE(A)
Definition: main.h:33
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint res
Definition: glext.h:9613
#define todo_wine
Definition: custom.c:79
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_EX_TOPMOST
Definition: pedump.c:647
BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(PCRAWINPUTDEVICE pRawInputDevices, UINT uiNumDevices, UINT cbSize)
Definition: stubs.c:364
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().