ReactOS 0.4.15-dev-7961-gdcf9eb0
GetClassInfo.c File Reference
#include "precomp.h"
Include dependency graph for GetClassInfo.c:

Go to the source code of this file.

Functions

static USHORT GetWinVersion (VOID)
 
VOID Test_Desktop (VOID)
 
VOID Test_Dialog (VOID)
 
VOID Test_Menu (VOID)
 
VOID Test_SwitchWnd (VOID)
 
VOID Test_Custom (VOID)
 
 START_TEST (GetClassInfo)
 

Function Documentation

◆ GetWinVersion()

static USHORT GetWinVersion ( VOID  )
static

Definition at line 10 of file GetClassInfo.c.

11{
12 return ((GetVersion() & 0xFF) << 8) |
13 ((GetVersion() >> 8) & 0xFF);
14}
DWORD WINAPI GetVersion()
Definition: redirtest.c:5

Referenced by Test_Desktop(), and Test_SwitchWnd().

◆ START_TEST()

START_TEST ( GetClassInfo  )

Definition at line 164 of file GetClassInfo.c.

165{
166 Test_Desktop();
167 Test_Dialog();
169 Test_Custom();
170}
VOID Test_Desktop(VOID)
Definition: GetClassInfo.c:16
VOID Test_Dialog(VOID)
Definition: GetClassInfo.c:43
VOID Test_Custom(VOID)
Definition: GetClassInfo.c:116
VOID Test_SwitchWnd(VOID)
Definition: GetClassInfo.c:92

◆ Test_Custom()

VOID Test_Custom ( VOID  )

Definition at line 116 of file GetClassInfo.c.

117{
118 WNDCLASSEXW wcex;
119 ATOM atom;
120 BOOL result;
121
122 memset(&wcex, 0, sizeof(wcex));
123
124 wcex.cbSize = sizeof(WNDCLASSEXW);
125 wcex.style = 0x1;
127 wcex.cbClsExtra = 1;
128 wcex.cbWndExtra = 5;
130 wcex.hIcon = NULL;
131 wcex.hCursor = NULL;
132 wcex.hbrBackground = NULL;
133 wcex.lpszMenuName = NULL;
134 wcex.lpszClassName = L"ProTestClass1";
135 wcex.hIconSm = 0;
136
137 atom = RegisterClassExW(&wcex);
138 ok(atom != 0, "Failed to register class!\n");
139 if (atom == 0)
140 {
141 skip("Failed to register class!");
142 return;
143 }
144
145 memset(&wcex, 0xab, sizeof(wcex));
146
148 ok_int(result, atom);
149
150 ok_hex(wcex.cbSize, 0xabababab);
151 ok_hex(wcex.style, 0x1);
153 ok_int(wcex.cbClsExtra, 1);
154 ok_int(wcex.cbWndExtra, 5);
156 ok_ptr(wcex.hIcon, NULL);
157 ok_ptr(wcex.hIcon, NULL);
159 ok_ptr(wcex.lpszMenuName, NULL);
161 ok_ptr(wcex.hIconSm, NULL);
162}
#define ok_hex(expression, result)
Definition: atltest.h:94
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define ok_int(expression, result)
Definition: atltest.h:134
#define ok_ptr(expression, result)
Definition: atltest.h:108
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint64EXT * result
Definition: glext.h:11304
#define L(x)
Definition: ntvdm.h:50
#define memset(x, y, z)
Definition: compat.h:39
LPCWSTR lpszClassName
Definition: winuser.h:3226
LPCWSTR lpszMenuName
Definition: winuser.h:3225
HBRUSH hbrBackground
Definition: winuser.h:3224
WNDPROC lpfnWndProc
Definition: winuser.h:3218
UINT cbSize
Definition: winuser.h:3216
int cbWndExtra
Definition: winuser.h:3220
HCURSOR hCursor
Definition: winuser.h:3223
HICON hIconSm
Definition: winuser.h:3227
HINSTANCE hInstance
Definition: winuser.h:3221
UINT style
Definition: winuser.h:3217
int cbClsExtra
Definition: winuser.h:3219
HICON hIcon
Definition: winuser.h:3222
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define GetModuleHandle
Definition: winbase.h:3827
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI GetClassInfoExW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSEXW)
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
struct _WNDCLASSEXW WNDCLASSEXW
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by START_TEST().

◆ Test_Desktop()

VOID Test_Desktop ( VOID  )

Definition at line 16 of file GetClassInfo.c.

17{
18 WNDCLASSEXW wcex;
20
21 memset(&wcex, 0xab, sizeof(wcex));
22
25
26 ok_hex(wcex.cbSize, 0xabababab);
27 ok_hex(wcex.style, 0x8);
28 ok(wcex.lpfnWndProc != NULL, "lpfnWndProc shound't be NULL\n");
29 ok_int(wcex.cbClsExtra, 0);
30 ok_int(wcex.cbWndExtra, GetWinVersion() <= 0x502 ? 8 : 0);
32 ok_ptr(wcex.hIcon, NULL);
33 ok(wcex.hCursor != NULL, "hCursor shound't be NULL\n");
34 if (GetWinVersion() > 0x502)
35 ok_ptr(wcex.hbrBackground, (HBRUSH)(ULONG_PTR)2);
36 else
37 ok(wcex.hbrBackground != NULL, "hbrBackground shound't be NULL\n");
40 ok_ptr(wcex.hIconSm, NULL);
41}
static USHORT GetWinVersion(VOID)
Definition: GetClassInfo.c:10
#define WC_DESKTOP
Definition: undocuser.h:10

Referenced by START_TEST().

◆ Test_Dialog()

VOID Test_Dialog ( VOID  )

Definition at line 43 of file GetClassInfo.c.

44{
45 WNDCLASSEXW wcex;
47
48 memset(&wcex, 0xab, sizeof(wcex));
49
52
53 ok_hex(wcex.cbSize, 0xabababab);
54 ok_hex(wcex.style, 0x808);
55 ok(wcex.lpfnWndProc != NULL, "lpfnWndProc shound't be NULL\n");
56 ok_int(wcex.cbClsExtra, 0);
57 ok_int(wcex.cbWndExtra, 30); // DLGWINDOWEXTRA
59 ok_ptr(wcex.hIcon, NULL);
60 ok(wcex.hCursor != NULL, "hCursor shound't be NULL\n");
64 ok_ptr(wcex.hIconSm, NULL);
65}
#define WC_DIALOG
Definition: undocuser.h:11

Referenced by START_TEST().

◆ Test_Menu()

VOID Test_Menu ( VOID  )

Definition at line 67 of file GetClassInfo.c.

68{
69 WNDCLASSEXW wcex;
71
72 memset(&wcex, 0xab, sizeof(wcex));
73
76
77 ok_hex(wcex.cbSize, 0xabababab);
78 ok_hex(wcex.style, 0x803);
79 ok_ptr(wcex.lpfnWndProc, NULL);
80 ok_int(wcex.cbClsExtra, 0);
81 ok_int(wcex.cbWndExtra, 16);
83 ok_ptr(wcex.hIcon, NULL);
84 ok(wcex.hCursor != NULL, "hCursor shound't be NULL\n");
88 ok_ptr(wcex.hIconSm, NULL);
89}
#define WC_MENU
Definition: undocuser.h:9

◆ Test_SwitchWnd()

VOID Test_SwitchWnd ( VOID  )

Definition at line 92 of file GetClassInfo.c.

93{
94 WNDCLASSEXW wcex;
96
97 memset(&wcex, 0xab, sizeof(wcex));
98
101
102 ok_hex(wcex.cbSize, 0xabababab);
103 ok_hex(wcex.style, 0x803);
104 ok_ptr(wcex.lpfnWndProc, NULL);
105 ok_int(wcex.cbClsExtra, 0);
106 ok_int(wcex.cbWndExtra, GetWinVersion() <= 0x502 ? sizeof(ULONG_PTR) : 16);
108 ok_ptr(wcex.hIcon, NULL);
109 ok(wcex.hCursor != NULL, "hCursor shound't be NULL\n");
111 ok_ptr(wcex.lpszMenuName, NULL);
113 ok_ptr(wcex.hIconSm, NULL);
114}
#define WC_SWITCH
Definition: undocuser.h:12

Referenced by START_TEST().