1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for NtUserCallOneParam
5 * PROGRAMMERS:
6 */
7
8 #include "../win32nt.h"
9
10
11
12 void
Test_OneParamRoutine_BeginDeferWindowPos(void)13 Test_OneParamRoutine_BeginDeferWindowPos(void) /* 0x1e */
14 {
15 HDWP hWinPosInfo;
16
17 hWinPosInfo = (HDWP)NtUserCallOneParam(5, 0x1e);
18 TEST(hWinPosInfo != 0);
19 TEST(EndDeferWindowPos(hWinPosInfo) != 0);
20
21 }
22
23 void
Test_OneParamRoutine_WindowFromDC(void)24 Test_OneParamRoutine_WindowFromDC(void) /* 0x1f */
25 {
26 HDC hDC = GetDC(NULL);
27 HWND hWnd;
28
29 hWnd = (HWND)NtUserCallOneParam((DWORD)hDC, 0x1f);
30 TEST(hWnd != 0);
31 TEST(IsWindow(hWnd));
32 TEST(hWnd == GetDesktopWindow());
33
34 }
35
36 void
Test_OneParamRoutine_CreateEmptyCurObject(void)37 Test_OneParamRoutine_CreateEmptyCurObject(void) /* XP/2k3 : 0x21, vista 0x25 */
38 {
39 HICON hIcon ;
40
41 /* Test 0 */
42 hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT);
43 TEST(hIcon != NULL);
44
45 TEST(NtUserDestroyCursor(hIcon, 0) == TRUE);
46
47 /* Test Garbage */
48 hIcon = (HICON) NtUserCallOneParam(0xdeadbeef, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT);
49 TEST(hIcon != NULL);
50
51 TEST(NtUserDestroyCursor(hIcon, 0xbaadf00d) == TRUE);
52
53 }
54
55 void
Test_OneParamRoutine_MapDesktopObject(void)56 Test_OneParamRoutine_MapDesktopObject(void) /* 0x30 */
57 {
58 DWORD pObject;
59 HWND hWnd;
60 HMENU hMenu;
61
62 hWnd = GetDesktopWindow();
63 pObject = NtUserCallOneParam((DWORD)hWnd, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT);
64 TEST(pObject > 0);
65 TEST(pObject < 0x80000000);
66
67 hMenu = CreateMenu();
68 pObject = NtUserCallOneParam((DWORD)hMenu, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT);
69 DestroyMenu(hMenu);
70 TEST(pObject > 0);
71 TEST(pObject < 0x80000000);
72
73 }
74
75 void
Test_OneParamRoutine_SwapMouseButtons(void)76 Test_OneParamRoutine_SwapMouseButtons(void) /* 0x42 */
77 {
78 BOOL bInverse;
79
80 NtUserCallOneParam(TRUE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON);
81 bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON);
82 TEST(bInverse == TRUE);
83 bInverse = (BOOL)NtUserCallOneParam(FALSE, _ONEPARAM_ROUTINE_SWAPMOUSEBUTTON);
84 TEST(bInverse == FALSE);
85
86 // TODO: test other values
87 }
88
START_TEST(NtUserCallOneParam)89 START_TEST(NtUserCallOneParam)
90 {
91 Test_OneParamRoutine_BeginDeferWindowPos(); /* 0x1e */
92 Test_OneParamRoutine_WindowFromDC(); /* 0x1f */
93 Test_OneParamRoutine_CreateEmptyCurObject(); /* XP/2k3 : 0x21, vista 0x25 */
94 Test_OneParamRoutine_MapDesktopObject(); /* 0x30 */
95 Test_OneParamRoutine_SwapMouseButtons(); /* 0x42 */
96 }
97