ReactOS 0.4.16-dev-2491-g3dc6630
class.c
Go to the documentation of this file.
1/* Unit test suite for window classes.
2 *
3 * Copyright 2002 Mike McCormack
4 * Copyright 2003 Alexandre Julliard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <stdlib.h>
22#include <stdarg.h>
23#include <stdio.h>
24
25#ifdef __REACTOS__
26#define WIN32_NO_STATUS
27#include <ntndk.h>
28#endif
29#include "wine/test.h"
30#include "windef.h"
31#include "winbase.h"
32#include "winnls.h"
33#include "winreg.h"
34#include "wingdi.h"
35#include "winuser.h"
36#ifndef __REACTOS__
37#include "winternl.h"
38#endif
39#include "commctrl.h"
40
41#define NUMCLASSWORDS 4
42
43#define IS_WNDPROC_HANDLE(x) (((ULONG_PTR)(x) >> 16) == (~0u >> 16))
44
45#ifdef __i386__
46#define ARCH "x86"
47#elif defined __aarch64__ || defined__arm64ec__
48#define ARCH "arm64"
49#elif defined __x86_64__
50#define ARCH "amd64"
51#elif defined __arm__
52#define ARCH "arm"
53#else
54#define ARCH "none"
55#endif
56
57static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
58
59static const char comctl32_manifest[] =
60"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
61"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"
62" <assemblyIdentity\n"
63" type=\"win32\"\n"
64" name=\"Wine.User32.Tests\"\n"
65" version=\"1.0.0.0\"\n"
66" processorArchitecture=\"" ARCH "\"\n"
67" />\n"
68"<description>Wine comctl32 test suite</description>\n"
69"<dependency>\n"
70" <dependentAssembly>\n"
71" <assemblyIdentity\n"
72" type=\"win32\"\n"
73" name=\"microsoft.windows.common-controls\"\n"
74" version=\"6.0.0.0\"\n"
75" processorArchitecture=\"" ARCH "\"\n"
76" publicKeyToken=\"6595b64144ccf1df\"\n"
77" language=\"*\"\n"
78" />\n"
79"</dependentAssembly>\n"
80"</dependency>\n"
81"</assembly>\n";
82
84{
85 if (msg == WM_NCCREATE) return 1;
87}
88
90{
91 if (msg == WM_NCCREATE) return 1;
93}
94
95/***********************************************************************
96 */
98{
99 WNDCLASSW cls, wc;
100 static const WCHAR className[] = {'T','e','s','t','C','l','a','s','s',0};
101 static const WCHAR winName[] = {'W','i','n','C','l','a','s','s','T','e','s','t',0};
103 ATOM test_atom;
104 HWND hTestWnd;
105 LONG i;
106 WCHAR str[20];
107 ATOM classatom;
108 HINSTANCE hInstance2;
109 BOOL ret;
110
113 cls.cbClsExtra = NUMCLASSWORDS*sizeof(DWORD);
114 cls.cbWndExtra = 12;
115 cls.hInstance = hInstance;
119 cls.lpszMenuName = 0;
120 cls.lpszClassName = className;
121
122 classatom=RegisterClassW(&cls);
123 if (!classatom && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
124 return;
125 ok(classatom, "failed to register class\n");
126
127 ok(GetClipboardFormatNameW(classatom, str, ARRAY_SIZE(str)) != 0, "atom not found\n");
128
129 ok(!RegisterClassW (&cls),
130 "RegisterClass of the same class should fail for the second time\n");
131
132 /* Setup windows */
133 hInstance2 = (HINSTANCE)(((ULONG_PTR)hInstance & ~0xffff) | 0xdead);
134
135 hTestWnd = CreateWindowW (className, winName,
138 0, hInstance2, 0);
139 ok(hTestWnd != 0, "Failed to create window for hInstance %p\n", hInstance2);
140
142 "Wrong GCL instance %p != %p\n",
144 ok((HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE) == hInstance2,
145 "Wrong GWL instance %p != %p\n",
146 (HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE), hInstance2);
147
148 DestroyWindow(hTestWnd);
149
150 ret = GetClassInfoW(hInstance2, className, &info);
151 ok(ret, "GetClassInfoW failed: %lu\n", GetLastError());
152
153 hTestWnd = CreateWindowW (className, winName,
156 0, hInstance, 0);
157
158 ok(hTestWnd!=0, "Failed to create window\n");
159
161 "Wrong GCL instance %p/%p\n",
164 "Wrong GWL instance %p/%p\n",
166
167
168 /* test initial values of valid classwords */
169 for(i=0; i<NUMCLASSWORDS; i++)
170 {
171 SetLastError(0);
172 ok(!GetClassLongW(hTestWnd,i*sizeof (DWORD)),
173 "GetClassLongW initial value nonzero!\n");
174 ok(!GetLastError(),
175 "GetClassLongW failed!\n");
176 }
177
178 if (0)
179 {
180 /*
181 * GetClassLongW(hTestWnd, NUMCLASSWORDS*sizeof(DWORD))
182 * does not fail on Win 98, though MSDN says it should
183 */
184 SetLastError(0);
185 GetClassLongW(hTestWnd, NUMCLASSWORDS*sizeof(DWORD));
187 "GetClassLongW() with invalid offset did not fail\n");
188 }
189
190 /* set values of valid class words */
191 for(i=0; i<NUMCLASSWORDS; i++)
192 {
193 SetLastError(0);
194 ok(!SetClassLongW(hTestWnd,i*sizeof(DWORD),i+1),
195 "GetClassLongW(%ld) initial value nonzero!\n",i);
196 ok(!GetLastError(),
197 "SetClassLongW(%ld) failed!\n",i);
198 }
199
200 /* test values of valid classwords that we set */
201 for(i=0; i<NUMCLASSWORDS; i++)
202 {
203 SetLastError(0);
204 ok( (i+1) == GetClassLongW(hTestWnd,i*sizeof (DWORD)),
205 "GetClassLongW value doesn't match what was set!\n");
206 ok(!GetLastError(),
207 "GetClassLongW failed!\n");
208 }
209
210 /* check GetClassName */
211 i = GetClassNameW(hTestWnd, str, ARRAY_SIZE(str));
212 ok(i == lstrlenW(className),
213 "GetClassName returned incorrect length\n");
214 ok(!lstrcmpW(className,str),
215 "GetClassName returned incorrect name for this window's class\n");
216
217 /* check GetClassInfo with our hInstance */
218 if((test_atom = GetClassInfoW(hInstance, str, &wc)))
219 {
220 ok(test_atom == classatom,
221 "class atom did not match\n");
222 ok(wc.cbClsExtra == cls.cbClsExtra,
223 "cbClsExtra did not match\n");
224 ok(wc.cbWndExtra == cls.cbWndExtra,
225 "cbWndExtra did not match\n");
227 "hbrBackground did not match\n");
228 ok(wc.hCursor== cls.hCursor,
229 "hCursor did not match\n");
230 ok(wc.hInstance== cls.hInstance,
231 "hInstance did not match\n");
232 }
233 else
234 ok(FALSE,"GetClassInfo (hinstance) failed!\n");
235
236 /* check GetClassInfo with zero hInstance */
237 if(global)
238 {
239 if((test_atom = GetClassInfoW(0, str, &wc)))
240 {
241 ok(test_atom == classatom,
242 "class atom did not match %x != %x\n", test_atom, classatom);
243 ok(wc.cbClsExtra == cls.cbClsExtra,
244 "cbClsExtra did not match %x!=%x\n",wc.cbClsExtra,cls.cbClsExtra);
245 ok(wc.cbWndExtra == cls.cbWndExtra,
246 "cbWndExtra did not match %x!=%x\n",wc.cbWndExtra,cls.cbWndExtra);
248 "hbrBackground did not match %p!=%p\n",wc.hbrBackground,cls.hbrBackground);
249 ok(wc.hCursor== cls.hCursor,
250 "hCursor did not match %p!=%p\n",wc.hCursor,cls.hCursor);
251 ok(!wc.hInstance,
252 "hInstance not zero for global class %p\n",wc.hInstance);
253 }
254 else
255 ok(FALSE,"GetClassInfo (0) failed for global class!\n");
256 }
257 else
258 {
259 ok(!GetClassInfoW(0, str, &wc),
260 "GetClassInfo (0) succeeded for local class!\n");
261 }
262
263 ok(!UnregisterClassW(className, hInstance),
264 "Unregister class succeeded with window existing\n");
265
266 ok(DestroyWindow(hTestWnd),
267 "DestroyWindow() failed!\n");
268
269 ok(UnregisterClassW(className, hInstance),
270 "UnregisterClass() failed\n");
271
272 ok(GetClipboardFormatNameW(classatom, str, ARRAY_SIZE(str)) == 0,
273 "atom still found\n");
274 return;
275}
276
277static void check_style( const char *name, int must_exist, UINT style, UINT ignore )
278{
279 WNDCLASSA wc;
280
281 if (GetClassInfoA( 0, name, &wc ))
282 {
283 ok( !(~wc.style & style & ~ignore), "System class %s is missing bits %x (%08x/%08x)\n",
284 name, ~wc.style & style, wc.style, style );
285 ok( !(wc.style & ~style), "System class %s has extra bits %x (%08x/%08x)\n",
286 name, wc.style & ~style, wc.style, style );
287 }
288 else
289 ok( !must_exist, "System class %s does not exist\n", name );
290}
291
292/* test styles of system classes */
293static void test_styles(void)
294{
295 /* check style bits */
296 check_style( "Button", 1, CS_PARENTDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, 0 );
297 check_style( "ComboBox", 1, CS_PARENTDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, 0 );
298 check_style( "Edit", 1, CS_PARENTDC | CS_DBLCLKS, 0 );
299 check_style( "ListBox", 1, CS_PARENTDC | CS_DBLCLKS, CS_PARENTDC /*FIXME*/ );
300 check_style( "MDIClient", 1, 0, 0 );
301 check_style( "ScrollBar", 1, CS_PARENTDC | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, 0 );
302 check_style( "Static", 1, CS_PARENTDC | CS_DBLCLKS, 0 );
303 check_style( "ComboLBox", 1, CS_SAVEBITS | CS_DBLCLKS, 0 );
304 check_style( "DDEMLEvent", 0, 0, 0 );
305 check_style( "Message", 0, 0, 0 );
306 check_style( "#32768", 1, CS_DROPSHADOW | CS_SAVEBITS | CS_DBLCLKS, CS_DROPSHADOW ); /* menu */
307 check_style( "#32769", 1, CS_DBLCLKS, 0 ); /* desktop */
308 check_style( "#32770", 1, CS_SAVEBITS | CS_DBLCLKS, 0 ); /* dialog */
309 todo_wine { check_style( "#32771", 1, CS_SAVEBITS | CS_HREDRAW | CS_VREDRAW, 0 ); } /* task switch */
310 check_style( "#32772", 1, 0, 0 ); /* icon title */
311}
312
313static void check_class_(int line, HINSTANCE inst, const char *name, const char *menu_name)
314{
315 WNDCLASSA wc;
316 UINT atom = GetClassInfoA(inst,name,&wc);
317 ok_(__FILE__,line)( atom, "Class %s %p not found\n", name, inst );
318 if (atom)
319 {
320 if (wc.lpszMenuName && menu_name)
321 ok_(__FILE__,line)( !strcmp( menu_name, wc.lpszMenuName ),
322 "Wrong name %s/%s for class %s %p\n",
323 wc.lpszMenuName, menu_name, name, inst );
324 else
325 ok_(__FILE__,line)( !menu_name == !wc.lpszMenuName, "Wrong name %p/%p for class %s %p\n",
326 wc.lpszMenuName, menu_name, name, inst );
327 }
328}
329#define check_class(inst,name,menu) check_class_(__LINE__,inst,name,menu)
330
331static void check_instance_( int line, const char *name, HINSTANCE inst,
332 HINSTANCE info_inst, HINSTANCE gcl_inst )
333{
334 WNDCLASSA wc;
335 HWND hwnd;
336
337 ok_(__FILE__,line)( GetClassInfoA( inst, name, &wc ), "Couldn't find class %s inst %p\n", name, inst );
338 ok_(__FILE__,line)( wc.hInstance == info_inst, "Wrong info instance %p/%p for class %s\n",
339 wc.hInstance, info_inst, name );
340 hwnd = CreateWindowExA( 0, name, "test_window", 0, 0, 0, 0, 0, 0, 0, inst, 0 );
341 ok_(__FILE__,line)( hwnd != NULL, "Couldn't create window for class %s inst %p\n", name, inst );
342 ok_(__FILE__,line)( (HINSTANCE)GetClassLongPtrA( hwnd, GCLP_HMODULE ) == gcl_inst,
343 "Wrong GCL instance %p/%p for class %s\n",
345 ok_(__FILE__,line)( (HINSTANCE)GetWindowLongPtrA( hwnd, GWLP_HINSTANCE ) == inst,
346 "Wrong GWL instance %p/%p for window %s\n",
348 ok_(__FILE__,line)(!UnregisterClassA(name, inst),
349 "UnregisterClassA should fail while exists a class window\n");
351 "GetLastError() should be set to ERROR_CLASS_HAS_WINDOWS not %ld\n", GetLastError());
353}
354#define check_instance(name,inst,info_inst,gcl_inst) check_instance_(__LINE__,name,inst,info_inst,gcl_inst)
355
357{
358 const char *name;
360};
361
363{
364 struct class_info *class_info = param;
365
367
368 return 0;
369}
370
372{
374 DWORD tid;
375 struct class_info class_info;
376
381
383 ok(hThread != NULL, "CreateThread failed, error %ld\n", GetLastError());
384 ok(WaitForSingleObject(hThread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
386}
387
388/* test various instance parameters */
389static void test_instances(void)
390{
391 WNDCLASSA cls, wc;
392 WNDCLASSEXA wcexA;
393 HWND hwnd, hwnd2;
394 const char *name = "__test__";
395 HINSTANCE kernel32 = GetModuleHandleA("kernel32");
396 HINSTANCE user32 = GetModuleHandleA("user32");
397 HINSTANCE main_module = GetModuleHandleA(NULL);
398 HINSTANCE zero_instance = 0;
399 DWORD r;
400 char buffer[0x10];
401
402 memset( &cls, 0, sizeof(cls) );
405 cls.cbClsExtra = 0;
406 cls.cbWndExtra = 0;
407 cls.lpszClassName = name;
408
409 cls.lpszMenuName = "main_module";
410 cls.hInstance = main_module;
411
412 ok( RegisterClassA( &cls ), "Failed to register local class for main module\n" );
413 check_class( main_module, name, "main_module" );
414 check_instance( name, main_module, main_module, main_module );
415 check_thread_instance( name, main_module, main_module, main_module );
416
417 cls.lpszMenuName = "kernel32";
418 cls.hInstance = kernel32;
419 ok( RegisterClassA( &cls ), "Failed to register local class for kernel32\n" );
420 check_class( kernel32, name, "kernel32" );
421 check_class( main_module, name, "main_module" );
422 check_instance( name, kernel32, kernel32, kernel32 );
423 check_thread_instance( name, kernel32, kernel32, kernel32 );
424 ok( UnregisterClassA( name, kernel32 ), "Unregister failed for kernel32\n" );
425
426 ZeroMemory(&wcexA, sizeof(wcexA));
428 wcexA.lpszClassName = "__classex_test__";
429 SetLastError(0xdeadbeef);
430 wcexA.cbSize = sizeof(wcexA) - 1;
431 ok( ((RegisterClassExA( &wcexA ) == 0) && (GetLastError() == ERROR_INVALID_PARAMETER)),
432 "Succeeded with invalid number of cbSize bytes\n");
433 SetLastError(0xdeadbeef);
434 wcexA.cbSize = sizeof(wcexA) + 1;
435 ok( ((RegisterClassExA( &wcexA ) == 0) && (GetLastError() == ERROR_INVALID_PARAMETER)),
436 "Succeeded with invalid number of cbSize bytes\n");
437 SetLastError(0xdeadbeef);
438 wcexA.cbSize = sizeof(wcexA);
439 ok( RegisterClassExA( &wcexA ), "Failed with valid number of cbSize bytes\n");
440 wcexA.cbSize = 0xdeadbeef;
441 ok( GetClassInfoExA(main_module, wcexA.lpszClassName, &wcexA), "GetClassInfoEx failed\n");
442 ok( wcexA.cbSize == 0xdeadbeef, "GetClassInfoEx returned wrong cbSize value %d\n", wcexA.cbSize);
443 UnregisterClassA(wcexA.lpszClassName, main_module);
444
445 /* Bug 2631 - Supplying an invalid number of bytes fails */
446 cls.cbClsExtra = 0;
447 cls.cbWndExtra = -1;
448 SetLastError(0xdeadbeef);
449 ok( ((RegisterClassA( &cls ) == 0) && (GetLastError() == ERROR_INVALID_PARAMETER)),
450 "Failed with invalid number of WndExtra bytes\n");
451
452 cls.cbClsExtra = -1;
453 cls.cbWndExtra = 0;
454 SetLastError(0xdeadbeef);
455 ok( ((RegisterClassA( &cls ) == 0) && (GetLastError() == ERROR_INVALID_PARAMETER)),
456 "Failed with invalid number of ClsExtra bytes\n");
457
458 cls.cbClsExtra = -1;
459 cls.cbWndExtra = -1;
460 SetLastError(0xdeadbeef);
461 ok( ((RegisterClassA( &cls ) == 0) && (GetLastError() == ERROR_INVALID_PARAMETER)),
462 "Failed with invalid number of ClsExtra and cbWndExtra bytes\n");
463
464 cls.cbClsExtra = 0;
465 cls.cbWndExtra = 0;
466 SetLastError(0xdeadbeef);
467
468 /* setting global flag doesn't change status of class */
469 hwnd = CreateWindowExA( 0, name, "test", 0, 0, 0, 0, 0, 0, 0, main_module, 0 );
470 ok( hwnd != 0, "CreateWindow failed error %lu\n", GetLastError());
472 cls.lpszMenuName = "kernel32";
473 cls.hInstance = kernel32;
474 ok( RegisterClassA( &cls ), "Failed to register local class for kernel32\n" );
475 check_class( kernel32, name, "kernel32" );
476 check_class( main_module, name, "main_module" );
477 check_instance( name, kernel32, kernel32, kernel32 );
478 check_instance( name, main_module, main_module, main_module );
479 check_thread_instance( name, kernel32, kernel32, kernel32 );
480 check_thread_instance( name, main_module, main_module, main_module );
481 ok( UnregisterClassA( name, kernel32 ), "Unregister failed for kernel32\n" );
482
483 /* changing the instance doesn't make it global */
485 ok( RegisterClassA( &cls ), "Failed to register local class for kernel32\n" );
486 check_class( kernel32, name, "kernel32" );
487 check_instance( name, kernel32, kernel32, kernel32 );
488 check_thread_instance( name, kernel32, kernel32, kernel32 );
489 ok( !GetClassInfoA( 0, name, &wc ), "Class found with null instance\n" );
490 ok( UnregisterClassA( name, kernel32 ), "Unregister failed for kernel32\n" );
491
492 /* GetClassInfo with instance 0 finds user32 instance */
494 ok( RegisterClassA( &cls ), "Failed to register local class for kernel32\n" );
495 if (!GetClassInfoA( 0, name, &wc )) zero_instance = user32; /* instance 0 not supported on wow64 */
496 else
497 {
498 check_instance( name, 0, 0, kernel32 );
499 check_thread_instance( name, 0, 0, kernel32 );
500 }
501 check_class( kernel32, name, "kernel32" );
502 check_class( user32, name, "main_module" );
503 check_class( zero_instance, name, "main_module" );
504 check_instance( name, kernel32, kernel32, kernel32 );
505 check_instance( name, user32, zero_instance, user32 );
506 check_thread_instance( name, kernel32, kernel32, kernel32 );
507 check_thread_instance( name, user32, zero_instance, user32 );
508 ok( UnregisterClassA( name, kernel32 ), "Unregister failed for kernel32\n" );
509
510 SetClassLongPtrA( hwnd, GCLP_HMODULE, 0x12345678 );
511 ok( RegisterClassA( &cls ), "Failed to register local class for kernel32\n" );
512 check_class( kernel32, name, "kernel32" );
513 check_class( (HINSTANCE)0x12345678, name, "main_module" );
514 check_instance( name, kernel32, kernel32, kernel32 );
515 check_instance( name, (HINSTANCE)0x12345678, (HINSTANCE)0x12345678, (HINSTANCE)0x12345678 );
516 check_thread_instance( name, kernel32, kernel32, kernel32 );
517 check_thread_instance( name, (HINSTANCE)0x12345678, (HINSTANCE)0x12345678, (HINSTANCE)0x12345678 );
518 ok( !GetClassInfoA( 0, name, &wc ), "Class found with null instance\n" );
519
520 /* creating a window with instance 0 uses the first class found */
521 cls.hInstance = (HINSTANCE)0xdeadbeef;
522 cls.lpszMenuName = "deadbeef";
523 cls.style = 3;
524 ok( RegisterClassA( &cls ), "Failed to register local class for deadbeef\n" );
525 hwnd2 = CreateWindowExA( 0, name, "test_window", 0, 0, 0, 0, 0, 0, 0, NULL, 0 );
526 ok( GetClassLongPtrA( hwnd2, GCLP_HMODULE ) == 0xdeadbeef,
527 "Didn't get deadbeef class for null instance\n" );
528 DestroyWindow( hwnd2 );
529 ok( UnregisterClassA( name, (HINSTANCE)0xdeadbeef ), "Unregister failed for deadbeef\n" );
530
531 hwnd2 = CreateWindowExA( 0, name, "test_window", 0, 0, 0, 0, 0, 0, 0, NULL, 0 );
532 ok( (HINSTANCE)GetClassLongPtrA( hwnd2, GCLP_HMODULE ) == kernel32,
533 "Didn't get kernel32 class for null instance\n" );
534 DestroyWindow( hwnd2 );
535
536 r = GetClassNameA( hwnd, buffer, 4 );
537 ok( r == 3, "expected 3, got %ld\n", r );
538 ok( !strcmp( buffer, "__t"), "name wrong: %s\n", buffer );
539
540 ok( UnregisterClassA( name, kernel32 ), "Unregister failed for kernel32\n" );
541
542 hwnd2 = CreateWindowExA( 0, name, "test_window", 0, 0, 0, 0, 0, 0, 0, NULL, 0 );
543 ok( GetClassLongPtrA( hwnd2, GCLP_HMODULE ) == 0x12345678,
544 "Didn't get 12345678 class for null instance\n" );
545 DestroyWindow( hwnd2 );
546
547 SetClassLongPtrA( hwnd, GCLP_HMODULE, (LONG_PTR)main_module );
549
550 /* null handle means the same thing as main module */
551 cls.lpszMenuName = "null";
552 cls.hInstance = 0;
553 ok( !RegisterClassA( &cls ), "Succeeded registering local class for null instance\n" );
554 ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
555 ok( UnregisterClassA( name, main_module ), "Unregister failed for main module\n" );
556
557 ok( RegisterClassA( &cls ), "Failed to register local class for null instance\n" );
558 /* must be found with main module handle */
559 check_class( main_module, name, "null" );
560 check_instance( name, main_module, main_module, main_module );
561 check_thread_instance( name, main_module, main_module, main_module );
562 ok( !GetClassInfoA( 0, name, &wc ), "Class found with null instance\n" );
563 ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %ld\n", GetLastError() );
564 ok( UnregisterClassA( name, 0 ), "Unregister failed for null instance\n" );
565
566 /* registering for user32 always fails */
567 cls.lpszMenuName = "user32";
568 cls.hInstance = user32;
569 ok( !RegisterClassA( &cls ), "Succeeded registering local class for user32\n" );
570 ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error code %ld\n", GetLastError() );
571 cls.style |= CS_GLOBALCLASS;
572 ok( !RegisterClassA( &cls ), "Succeeded registering global class for user32\n" );
573 ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error code %ld\n", GetLastError() );
574
575 /* unregister is OK though */
576 cls.hInstance = main_module;
577 ok( RegisterClassA( &cls ), "Failed to register global class for main module\n" );
578 ok( UnregisterClassA( name, user32 ), "Unregister failed for user32\n" );
579
580 /* instance doesn't matter for global class */
581 cls.style |= CS_GLOBALCLASS;
582 cls.lpszMenuName = "main_module";
583 cls.hInstance = main_module;
584 ok( RegisterClassA( &cls ), "Failed to register global class for main module\n" );
585 cls.lpszMenuName = "kernel32";
586 cls.hInstance = kernel32;
587 ok( !RegisterClassA( &cls ), "Succeeded registering local class for kernel32\n" );
588 ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
589 /* even if global flag is cleared */
590 hwnd = CreateWindowExA( 0, name, "test", 0, 0, 0, 0, 0, 0, 0, main_module, 0 );
592 ok( !RegisterClassA( &cls ), "Succeeded registering local class for kernel32\n" );
593 ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
594
595 check_class( main_module, name, "main_module" );
596 check_class( kernel32, name, "main_module" );
597 check_class( 0, name, "main_module" );
598 check_class( (HINSTANCE)0x12345678, name, "main_module" );
599 check_instance( name, main_module, main_module, main_module );
600 check_instance( name, (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef, main_module );
601 check_thread_instance( name, main_module, main_module, main_module );
602 check_thread_instance( name, (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef, main_module );
603
604 /* changing the instance for global class doesn't make much difference */
605 SetClassLongPtrA( hwnd, GCLP_HMODULE, 0xdeadbeef );
606 check_instance( name, main_module, main_module, (HINSTANCE)0xdeadbeef );
607 check_instance( name, (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef );
608 check_thread_instance( name, main_module, main_module, (HINSTANCE)0xdeadbeef );
609 check_thread_instance( name, (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef );
610
612 ok( UnregisterClassA( name, (HINSTANCE)0x87654321 ), "Unregister failed for main module global\n" );
613 ok( !UnregisterClassA( name, (HINSTANCE)0x87654321 ), "Unregister succeeded the second time\n" );
614 ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %ld\n", GetLastError() );
615
616 cls.hInstance = (HINSTANCE)0x12345678;
617 ok( RegisterClassA( &cls ), "Failed to register global class for dummy instance\n" );
618 check_instance( name, main_module, main_module, (HINSTANCE)0x12345678 );
619 check_instance( name, (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef, (HINSTANCE)0x12345678 );
620 check_thread_instance( name, main_module, main_module, (HINSTANCE)0x12345678 );
621 check_thread_instance( name, (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef, (HINSTANCE)0x12345678 );
622 ok( UnregisterClassA( name, (HINSTANCE)0x87654321 ), "Unregister failed for main module global\n" );
623
624 /* check system classes */
625
626 /* we cannot register a global class with the name of a system class */
627 cls.style |= CS_GLOBALCLASS;
628 cls.lpszMenuName = "button_main_module";
629 cls.lpszClassName = "BUTTON";
630 cls.hInstance = main_module;
631 ok( !RegisterClassA( &cls ), "Succeeded registering global button class for main module\n" );
632 ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
633 cls.hInstance = kernel32;
634 ok( !RegisterClassA( &cls ), "Succeeded registering global button class for kernel32\n" );
635 ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
636
637 /* local class is OK however */
638 cls.style &= ~CS_GLOBALCLASS;
639 cls.lpszMenuName = "button_main_module";
640 cls.hInstance = main_module;
641 ok( RegisterClassA( &cls ), "Failed to register local button class for main module\n" );
642 check_class( main_module, "BUTTON", "button_main_module" );
643 cls.lpszMenuName = "button_kernel32";
644 cls.hInstance = kernel32;
645 ok( RegisterClassA( &cls ), "Failed to register local button class for kernel32\n" );
646 check_class( kernel32, "BUTTON", "button_kernel32" );
647 check_class( main_module, "BUTTON", "button_main_module" );
648 ok( UnregisterClassA( "BUTTON", kernel32 ), "Unregister failed for kernel32 button\n" );
649 ok( UnregisterClassA( "BUTTON", main_module ), "Unregister failed for main module button\n" );
650 /* GetClassInfo sets instance to passed value for global classes */
651 check_instance( "BUTTON", 0, 0, user32 );
652 check_instance( "BUTTON", (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef, user32 );
653 check_instance( "BUTTON", user32, zero_instance, user32 );
654 check_thread_instance( "BUTTON", 0, 0, user32 );
655 check_thread_instance( "BUTTON", (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef, user32 );
656 check_thread_instance( "BUTTON", user32, zero_instance, user32 );
657
658 /* we can unregister system classes */
659 ok( GetClassInfoA( 0, "BUTTON", &wc ), "Button class not found with null instance\n" );
660 ok( GetClassInfoA( kernel32, "BUTTON", &wc ), "Button class not found with kernel32\n" );
661 ok( UnregisterClassA( "BUTTON", (HINSTANCE)0x12345678 ), "Failed to unregister button\n" );
662 ok( !UnregisterClassA( "BUTTON", (HINSTANCE)0x87654321 ), "Unregistered button a second time\n" );
663 ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %ld\n", GetLastError() );
664 ok( !GetClassInfoA( 0, "BUTTON", &wc ), "Button still exists\n" );
665 /* last error not set reliably */
666
667 /* we can change the instance of a system class */
668 check_instance( "EDIT", (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef, user32 );
669 check_thread_instance( "EDIT", (HINSTANCE)0xdeadbeef, (HINSTANCE)0xdeadbeef, user32 );
670 hwnd = CreateWindowExA( 0, "EDIT", "test", 0, 0, 0, 0, 0, 0, 0, main_module, 0 );
671 SetClassLongPtrA( hwnd, GCLP_HMODULE, 0xdeadbeef );
672 check_instance( "EDIT", (HINSTANCE)0x12345678, (HINSTANCE)0x12345678, (HINSTANCE)0xdeadbeef );
673 check_thread_instance( "EDIT", (HINSTANCE)0x12345678, (HINSTANCE)0x12345678, (HINSTANCE)0xdeadbeef );
675}
676
677static void test_builtinproc(void)
678{
679 /* Edit behaves differently */
680 static const CHAR NORMAL_CLASSES[][10] = {
681 "Button",
682 "Static",
683 "ComboBox",
684 "ComboLBox",
685 "ListBox",
686 "ScrollBar",
687 "#32770", /* dialog */
688 };
689 static const char classA[] = "deftest";
690 static const WCHAR classW[] = {'d','e','f','t','e','s','t',0};
691 WCHAR unistring[] = {0x142, 0x40e, 0x3b4, 0}; /* a string that would be destroyed by a W->A->W conversion */
692 WNDPROC pDefWindowProcA, pDefWindowProcW;
693 WNDPROC oldproc;
694 WNDCLASSEXA cls; /* the memory layout of WNDCLASSEXA and WNDCLASSEXW is the same */
695 WCHAR buf[128];
696 ATOM atom;
697 HWND hwnd;
698 unsigned int i;
699
700 pDefWindowProcA = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "DefWindowProcA");
701 pDefWindowProcW = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "DefWindowProcW");
702
703 /* built-in winproc - window A/W type automatically detected */
704 ZeroMemory(&cls, sizeof(cls));
705 cls.cbSize = sizeof(cls);
708 cls.lpszClassName = classA;
709 cls.lpfnWndProc = pDefWindowProcW;
710 atom = RegisterClassExA(&cls);
711
715 broken(!IsWindowUnicode(hwnd)) /* Windows 8 and 10 */,
716 "Windows should be Unicode\n");
719 ok(memcmp(buf, unistring, sizeof(unistring)) == 0, "WM_GETTEXT invalid return\n");
720 else
721 ok(memcmp(buf, unistring, sizeof(unistring)) != 0, "WM_GETTEXT invalid return\n");
722 SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)pDefWindowProcA);
723 ok(IsWindowUnicode(hwnd), "Windows should have remained Unicode\n");
724 if (GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcA)
725 {
726 /* DefWindowProc isn't magic on wow64 */
727 ok(IS_WNDPROC_HANDLE(GetWindowLongPtrA(hwnd, GWLP_WNDPROC)), "Ansi winproc is not a handle\n");
728 }
729 else
730 {
731 ok(GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcW, "Invalid Unicode winproc\n");
732 ok(GetWindowLongPtrA(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcA, "Invalid Ansi winproc\n");
733 }
735 ok(IsWindowUnicode(hwnd) == FALSE, "SetWindowLongPtrA should have switched window to ANSI\n");
736
739
740 /* custom winproc - the same function can be used as both A and W*/
741 ZeroMemory(&cls, sizeof(cls));
742 cls.cbSize = sizeof(cls);
745 cls.lpszClassName = classA;
747 atom = RegisterClassExA(&cls);
748
751 ok(IsWindowUnicode(hwnd) == FALSE, "Window should be ANSI\n");
753 ok(IsWindowUnicode(hwnd), "SetWindowLongPtrW should have changed window to Unicode\n");
755 ok(IsWindowUnicode(hwnd) == FALSE, "SetWindowLongPtrA should have changed window to ANSI\n");
756
759
760 /* For most of the builtin controls both GetWindowLongPtrA and W returns a pointer that is executed directly
761 * by CallWindowProcA/W */
762 for (i = 0; i < ARRAY_SIZE(NORMAL_CLASSES); i++)
763 {
764 WNDPROC procA, procW;
765 hwnd = CreateWindowExA(0, NORMAL_CLASSES[i], classA, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 680, 260,
766 NULL, NULL, NULL, 0);
767 ok(hwnd != NULL, "Couldn't create window of class %s\n", NORMAL_CLASSES[i]);
768 SetWindowTextA(hwnd, classA); /* ComboBox needs this */
771 ok(!IS_WNDPROC_HANDLE(procA), "procA should not be a handle for %s (%p)\n", NORMAL_CLASSES[i], procA);
772 ok(!IS_WNDPROC_HANDLE(procW), "procW should not be a handle for %s (%p)\n", NORMAL_CLASSES[i], procW);
773 CallWindowProcA(procA, hwnd, WM_GETTEXT, 120, (LPARAM)buf);
774 ok(memcmp(buf, classA, sizeof(classA)) == 0, "WM_GETTEXT A/A invalid return for class %s\n", NORMAL_CLASSES[i]);
775 CallWindowProcA(procW, hwnd, WM_GETTEXT, 120, (LPARAM)buf);
776 ok(memcmp(buf, classW, sizeof(classW)) == 0, "WM_GETTEXT A/W invalid return for class %s\n", NORMAL_CLASSES[i]);
777 CallWindowProcW(procA, hwnd, WM_GETTEXT, 120, (LPARAM)buf);
778 ok(memcmp(buf, classA, sizeof(classA)) == 0, "WM_GETTEXT W/A invalid return for class %s\n", NORMAL_CLASSES[i]);
779 CallWindowProcW(procW, hwnd, WM_GETTEXT, 120, (LPARAM)buf);
780 ok(memcmp(buf, classW, sizeof(classW)) == 0, "WM_GETTEXT W/W invalid return for class %s\n", NORMAL_CLASSES[i]);
781
783 ok(IS_WNDPROC_HANDLE(oldproc) == FALSE, "Class %s shouldn't return a handle\n", NORMAL_CLASSES[i]);
786 }
787
788 /* Edit controls are special - they return a wndproc handle when GetWindowLongPtr is called with a different A/W.
789 * On the other hand there is no W->A->W conversion so this control is treated specially. */
791 CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, NULL, 0);
792 /* GetClassLongPtr returns that both the Unicode and ANSI wndproc */
793 ok(IS_WNDPROC_HANDLE(GetClassLongPtrA(hwnd, GCLP_WNDPROC)) == FALSE, "Edit control class should have a Unicode wndproc\n");
794 ok(IS_WNDPROC_HANDLE(GetClassLongPtrW(hwnd, GCLP_WNDPROC)) == FALSE, "Edit control class should have a ANSI wndproc\n");
795 /* But GetWindowLongPtr returns only a handle for the ANSI one */
796 ok(IS_WNDPROC_HANDLE(GetWindowLongPtrA(hwnd, GWLP_WNDPROC)), "Edit control should return a wndproc handle\n");
797 ok(!IS_WNDPROC_HANDLE(GetWindowLongPtrW(hwnd, GWLP_WNDPROC)), "Edit control shouldn't return a W wndproc handle\n");
799 ok(memcmp(buf, unistring, sizeof(unistring)) == 0, "WM_GETTEXT invalid return\n");
801 ok(memcmp(buf, unistring, sizeof(unistring)) == 0, "WM_GETTEXT invalid return\n");
803 ok(memcmp(buf, unistring, sizeof(unistring)) == 0, "WM_GETTEXT invalid return\n");
804
807 ok(memcmp(buf, classA, sizeof(classA)) == 0, "WM_GETTEXT invalid return\n");
808
810 /* SetWindowLongPtr returns a wndproc handle - like GetWindowLongPtr */
811 ok(IS_WNDPROC_HANDLE(oldproc), "Edit control should return a wndproc handle\n");
812 ok(IsWindowUnicode(hwnd) == FALSE, "SetWindowLongPtrA should have changed window to ANSI\n");
813 SetWindowTextA(hwnd, classA); /* Windows resets the title to WideStringToMultiByte(unistring) */
814 memset(buf, 0, sizeof(buf));
816 ok(memcmp(buf, classA, sizeof(classA)) == 0, "WM_GETTEXT invalid return\n");
818 ok(memcmp(buf, classA, sizeof(classA)) == 0, "WM_GETTEXT invalid return\n");
820 ok(memcmp(buf, classA, sizeof(classA)) == 0, "WM_GETTEXT invalid return\n");
821
823 ok(memcmp(buf, classW, sizeof(classW)) == 0, "WM_GETTEXT invalid return\n");
824
826
828
830 CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, NULL, 0);
831
832 /* GetClassLongPtr returns that both the Unicode and ANSI wndproc */
833 ok(!IS_WNDPROC_HANDLE(GetClassLongPtrA(hwnd, GCLP_WNDPROC)), "Edit control class should have a Unicode wndproc\n");
834 ok(!IS_WNDPROC_HANDLE(GetClassLongPtrW(hwnd, GCLP_WNDPROC)), "Edit control class should have a ANSI wndproc\n");
835 /* But GetWindowLongPtr returns only a handle for the Unicode one */
836 ok(!IS_WNDPROC_HANDLE(GetWindowLongPtrA(hwnd, GWLP_WNDPROC)), "Edit control shouldn't return an A wndproc handle\n");
837 ok(IS_WNDPROC_HANDLE(GetWindowLongPtrW(hwnd, GWLP_WNDPROC)), "Edit control should return a wndproc handle\n");
839 ok(memcmp(buf, classA, sizeof(classA)) == 0, "WM_GETTEXT invalid return\n");
841 ok(memcmp(buf, classA, sizeof(classA)) == 0, "WM_GETTEXT invalid return\n");
843 ok(memcmp(buf, classA, sizeof(classA)) == 0, "WM_GETTEXT invalid return\n");
844
846 ok(memcmp(buf, classW, sizeof(classW)) == 0, "WM_GETTEXT invalid return\n");
847
849 SetWindowTextW(hwnd, unistring);
851 ok(memcmp(buf, unistring, sizeof(unistring)) == 0, "WM_GETTEXT invalid return\n");
853 ok(memcmp(buf, unistring, sizeof(unistring)) == 0, "WM_GETTEXT invalid return\n");
855 ok(memcmp(buf, unistring, sizeof(unistring)) == 0, "WM_GETTEXT invalid return\n");
856
859 ok(memcmp(buf, classA, sizeof(classA)) == 0, "WM_GETTEXT invalid return\n");
860
862
864}
865
866
867static void test_ntdll_wndprocs(void)
868{
869 static const char *classes[] =
870 {
871 "ScrollBar",
872 "Message",
873 "#32768", /* menu */
874 "#32769", /* desktop */
875 "DefWindowProc", /* not a real class */
876 "#32772", /* icon title */
877 "??", /* ?? */
878 "Button",
879 "ComboBox",
880 "ComboLBox",
881 "#32770", /* dialog */
882 "Edit",
883 "ListBox",
884 "MDIClient",
885 "Static",
886 "IME",
887 "Ghost",
888 };
889 unsigned int i;
890 void *procsA[ARRAY_SIZE(classes)] = { NULL };
891 void *procsW[ARRAY_SIZE(classes)] = { NULL };
892 const UINT64 *ptr_A, *ptr_W, *ptr_workers;
893 NTSTATUS (WINAPI *pRtlRetrieveNtUserPfn)(const UINT64**,const UINT64**,const UINT64 **);
894
895 pRtlRetrieveNtUserPfn = (void *)GetProcAddress( GetModuleHandleA("ntdll.dll"), "RtlRetrieveNtUserPfn" );
896 if (!pRtlRetrieveNtUserPfn || pRtlRetrieveNtUserPfn( &ptr_A, &ptr_W, &ptr_workers ))
897 {
898 win_skip( "RtlRetrieveNtUserPfn not supported\n" );
899 return;
900 }
901
902 for (i = 0; i < ARRAY_SIZE(classes); i++)
903 {
904 WNDCLASSA wcA;
905 WNDCLASSW wcW;
906 WCHAR buffer[20];
907
908 MultiByteToWideChar( CP_ACP, 0, classes[i], -1, buffer, ARRAY_SIZE(buffer) );
909 if (GetClassInfoA( 0, classes[i], &wcA )) procsA[i] = wcA.lpfnWndProc;
910 if (GetClassInfoW( 0, buffer, &wcW )) procsW[i] = wcW.lpfnWndProc;
911 }
912 procsA[4] = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "DefWindowProcA");
913 procsW[4] = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "DefWindowProcW");
914
915 if (!is_win64 && ptr_A[0] >> 32) /* some older versions use 32-bit pointers */
916 {
917 const void **ptr_A32 = (const void **)ptr_A, **ptr_W32 = (const void **)ptr_W;
918 for (i = 0; i < ARRAY_SIZE(procsA); i++)
919 {
920 ok( !procsA[i] || procsA[i] == ptr_A32[i],
921 "wrong ptr A %u %s: %p / %p\n", i, classes[i], procsA[i], ptr_A32[i] );
922 ok( !procsW[i] || procsW[i] == ptr_W32[i] ||
923 broken(i == 4), /* DefWindowProcW can be different on wow64 */
924 "wrong ptr W %u %s: %p / %p\n", i, classes[i], procsW[i], ptr_W32[i] );
925 }
926 }
927 else
928 {
929 for (i = 0; i < ARRAY_SIZE(procsA); i++)
930 {
931 ok( !procsA[i] || (ULONG_PTR)procsA[i] == ptr_A[i],
932 "wrong ptr A %u %s: %p / %I64x\n", i, classes[i], procsA[i], ptr_A[i] );
933 ok( !procsW[i] || (ULONG_PTR)procsW[i] == ptr_W[i] ||
934 broken( !is_win64 && i == 4 ), /* DefWindowProcW can be different on wow64 */
935 "wrong ptr W %u %s: %p / %I64x\n", i, classes[i], procsW[i], ptr_W[i] );
936 }
937 }
938}
939
940static void test_wndproc_forwards(void)
941{
943 HMODULE user32 = GetModuleHandleA( "user32.dll" );
944 HANDLE map, file;
945 char *base;
946 ULONG i, size, *names, *functions;
947 WORD *ordinals;
949
950 /* file on disk contains forwards */
951
954 ok( file != INVALID_HANDLE_VALUE, "cannot open %s err %lu\n", debugstr_w(path), GetLastError() );
956 ok( map != NULL, "failed to create mapping %lu\n", GetLastError() );
957 base = MapViewOfFile( map, FILE_MAP_READ, 0, 0, 0 );
958 ok( base != NULL, "failed to map file %lu\n", GetLastError() );
960 ok( exp != NULL, "no exports\n" );
961 functions = (ULONG *)(base + exp->AddressOfFunctions);
962 names = (ULONG *)(base + exp->AddressOfNames);
963 ordinals = (WORD *)(base + exp->AddressOfNameOrdinals);
964 for (i = 0; i < exp->NumberOfNames; i++)
965 {
966 const char *name = base + names[i];
967 const char *forward = base + functions[ordinals[i]];
968 if (strcmp( name, "DefDlgProcA" ) &&
969 strcmp( name, "DefDlgProcW" ) &&
970 strcmp( name, "DefWindowProcA" ) &&
971 strcmp( name, "DefWindowProcW" )) continue;
972
973 if (!strcmp( name, "DefDlgProcA" ) && !(forward >= (char *)exp && forward < (char *)exp + size))
974 {
975 win_skip( "Windows version too old, not using forwards\n" );
977 CloseHandle( file );
978 CloseHandle( map );
979 return;
980 }
981 ok( forward >= (char *)exp && forward < (char *)exp + size,
982 "not a forward %s %lx\n", name, functions[ordinals[i]] );
983 ok( !strncmp( forward, "NTDLL.Ntdll", 11 ), "wrong forward %s -> %s\n", name, forward );
984 }
986 CloseHandle( file );
987 CloseHandle( map );
988
989 /* loaded dll is patched to avoid forwards (on 32-bit) */
990
991 base = (char *)user32;
993 ok( exp != NULL, "no exports\n" );
994 functions = (ULONG *)(base + exp->AddressOfFunctions);
995 names = (ULONG *)(base + exp->AddressOfNames);
996 ordinals = (WORD *)(base + exp->AddressOfNameOrdinals);
997 for (i = 0; i < exp->NumberOfNames; i++)
998 {
999 const char *name = base + names[i];
1000 const char *forward = base + functions[ordinals[i]];
1001 if (strcmp( name, "DefDlgProcA" ) &&
1002 strcmp( name, "DefDlgProcW" ) &&
1003 strcmp( name, "DefWindowProcA" ) &&
1004 strcmp( name, "DefWindowProcW" )) continue;
1005 if (is_win64)
1006 {
1007 ok( forward >= (char *)exp && forward < (char *)exp + size,
1008 "not a forward %s %lx\n", name, functions[ordinals[i]] );
1009 ok( !strncmp( forward, "NTDLL.Ntdll", 11 ), "wrong forward %s -> %s\n", name, forward );
1010 }
1011 else
1012 {
1013 void *expect = GetProcAddress( user32, name );
1014 ok( !(forward >= (char *)exp && forward < (char *)exp + size),
1015 "%s %lx is a forward\n", name, functions[ordinals[i]] );
1016 ok( forward == expect ||
1017 broken( !strcmp( name, "DefWindowProcW" )), /* DefWindowProcW can be hooked on first run */
1018 "wrong function %s %p / %p\n", name, forward, expect );
1019 }
1020 }
1021}
1022
1023
1025{
1026 return DefDlgProcA(hWnd, uMsg, wParam, lParam);
1027}
1028
1030{
1031 WNDCLASSEXA wcx;
1032 ATOM atom = 0;
1033
1034 ZeroMemory(&wcx, sizeof(WNDCLASSEXA));
1035 wcx.cbSize = sizeof(wcx);
1037 wcx.cbClsExtra = 0;
1039 wcx.hInstance = hInstance;
1043 wcx.lpszClassName = "TestDialog";
1044 wcx.lpszMenuName = "TestDialog";
1048
1049 atom = RegisterClassExA(&wcx);
1050 ok(atom != 0, "RegisterClassEx returned 0\n");
1051
1052 return atom;
1053}
1054
1055/* test registering a dialog box created by using the CLASS directive in a
1056 resource file, then test creating the dialog using CreateDialogParam. */
1058{
1059 HWND hWndMain;
1060
1062 {
1063 hWndMain = CreateDialogParamA(hInstance, "CLASS_TEST_DIALOG", NULL, 0, 0);
1064 ok(hWndMain != NULL, "CreateDialogParam returned NULL\n");
1067 }
1068}
1069
1070static const struct
1071{
1072 const char name[9];
1074 int value64; /* 64-bit Windows use 64-bit size also for 32-bit applications */
1075} extra_values[] =
1076{
1077 {"#32770",30,30}, /* Dialog */
1078 {"Edit",6,8},
1080
1081static void test_extra_values(void)
1082{
1083 int i;
1084 for(i = 0; i < ARRAY_SIZE(extra_values); i++)
1085 {
1086 WNDCLASSEXA wcx;
1088
1089 ok( ret, "GetClassInfo (0) failed for global class %s\n", extra_values[i].name);
1090 if (!ret) continue;
1091 ok(extra_values[i].value == wcx.cbWndExtra || extra_values[i].value64 == wcx.cbWndExtra,
1092 "expected %d, got %d\n", extra_values[i].value, wcx.cbWndExtra);
1093 }
1094}
1095
1096static void test_GetClassInfo(void)
1097{
1098 static const WCHAR staticW[] = {'s','t','a','t','i','c',0};
1099 WNDCLASSA wc;
1100 WNDCLASSEXA wcx;
1101 BOOL ret;
1102
1103 SetLastError(0xdeadbeef);
1104 ret = GetClassInfoA(0, "static", &wc);
1105 ok(ret, "GetClassInfoA() error %ld\n", GetLastError());
1106
1107if (0) { /* crashes under XP */
1108 SetLastError(0xdeadbeef);
1109 ret = GetClassInfoA(0, "static", NULL);
1110 ok(ret, "GetClassInfoA() error %ld\n", GetLastError());
1111
1112 SetLastError(0xdeadbeef);
1114 ok(ret, "GetClassInfoW() error %ld\n", GetLastError());
1115}
1116
1117 wcx.cbSize = sizeof(wcx);
1118 SetLastError(0xdeadbeef);
1119 ret = GetClassInfoExA(0, "static", &wcx);
1120 ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
1121
1122 SetLastError(0xdeadbeef);
1123 ret = GetClassInfoExA(0, "static", NULL);
1124 ok(!ret, "GetClassInfoExA() should fail\n");
1126 broken(GetLastError() == 0xdeadbeef), /* win9x */
1127 "expected ERROR_NOACCESS, got %ld\n", GetLastError());
1128
1129 SetLastError(0xdeadbeef);
1131 ok(!ret, "GetClassInfoExW() should fail\n");
1133 broken(GetLastError() == 0xdeadbeef) /* NT4 */ ||
1135 "expected ERROR_NOACCESS, got %ld\n", GetLastError());
1136
1137 wcx.cbSize = 0;
1138 wcx.lpfnWndProc = NULL;
1139 SetLastError(0xdeadbeef);
1140 ret = GetClassInfoExA(0, "static", &wcx);
1141 ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
1142 ok(GetLastError() == 0xdeadbeef, "Unexpected error code %ld\n", GetLastError());
1143 ok(wcx.cbSize == 0, "expected 0, got %u\n", wcx.cbSize);
1144 ok(wcx.lpfnWndProc != NULL, "got null proc\n");
1145
1146 wcx.cbSize = sizeof(wcx) - 1;
1147 wcx.lpfnWndProc = NULL;
1148 SetLastError(0xdeadbeef);
1149 ret = GetClassInfoExA(0, "static", &wcx);
1150 ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
1151 ok(wcx.cbSize == sizeof(wcx) - 1, "expected sizeof(wcx)-1, got %u\n", wcx.cbSize);
1152 ok(wcx.lpfnWndProc != NULL, "got null proc\n");
1153
1154 wcx.cbSize = sizeof(wcx) + 1;
1155 wcx.lpfnWndProc = NULL;
1156 SetLastError(0xdeadbeef);
1157 ret = GetClassInfoExA(0, "static", &wcx);
1158 ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
1159 ok(wcx.cbSize == sizeof(wcx) + 1, "expected sizeof(wcx)+1, got %u\n", wcx.cbSize);
1160 ok(wcx.lpfnWndProc != NULL, "got null proc\n");
1161
1162 wcx.cbSize = sizeof(wcx);
1163 ret = GetClassInfoExA(0, "stati", &wcx);
1165 "GetClassInfoExA() returned %x %ld\n", ret, GetLastError());
1166}
1167
1168static void test_icons(void)
1169{
1170 WNDCLASSEXW wcex, ret_wcex;
1171 WCHAR cls_name[] = {'I','c','o','n','T','e','s','t','C','l','a','s','s',0};
1172 HWND hwnd;
1174 HICON hsmicon, hsmallnew;
1175 ICONINFO icinf;
1176
1177 memset(&wcex, 0, sizeof wcex);
1178 wcex.cbSize = sizeof wcex;
1181 wcex.hInstance = hinst;
1182 wcex.lpszClassName = cls_name;
1183 ok(RegisterClassExW(&wcex), "RegisterClassExW returned 0\n");
1185 0, 0, 0, 0, NULL, NULL, hinst, 0);
1186 ok(hwnd != NULL, "Window was not created\n");
1187
1188 ok(GetClassInfoExW(hinst, cls_name, &ret_wcex), "Class info was not retrieved\n");
1189 ok(wcex.hIcon == ret_wcex.hIcon, "Icons don't match\n");
1190 ok(ret_wcex.hIconSm != NULL, "hIconSm should be non-zero handle\n");
1191
1193 ok(hsmicon != NULL, "GetClassLong should return non-zero handle\n");
1194
1195 ok(SendMessageA(hwnd, WM_GETICON, ICON_BIG, 0) == 0,
1196 "WM_GETICON with ICON_BIG should not return the class icon\n");
1197 ok(SendMessageA(hwnd, WM_GETICON, ICON_SMALL, 0) == 0,
1198 "WM_GETICON with ICON_SMALL should not return the class icon\n");
1199 ok(SendMessageA(hwnd, WM_GETICON, ICON_SMALL2, 0) == 0,
1200 "WM_GETICON with ICON_SMALL2 should not return the class icon\n");
1201
1205 "Previous hIconSm should be zero\n");
1206 ok(hsmallnew == (HICON)GetClassLongPtrW(hwnd, GCLP_HICONSM),
1207 "Should return explicitly assigned small icon\n");
1208 ok(!GetIconInfo(hsmicon, &icinf), "Previous small icon should be destroyed\n");
1209
1212 ok( hsmicon != NULL, "GetClassLong should return non-zero handle\n");
1213
1215 ok(!GetClassLongPtrW(hwnd, GCLP_HICONSM), "GetClassLong should return zero handle\n");
1216
1219 ok(hsmicon != NULL, "GetClassLong should return non-zero handle\n");
1221 ok(GetIconInfo(hsmicon, &icinf), "Icon should NOT be destroyed\n");
1222
1223 DestroyIcon(hsmallnew);
1225}
1226
1227static void create_manifest_file(const char *filename, const char *manifest)
1228{
1230 HANDLE file;
1231 DWORD size;
1232
1235 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
1238}
1239
1240static HANDLE create_test_actctx(const char *file)
1241{
1243 ACTCTXW actctx;
1244 HANDLE handle;
1245
1247 memset(&actctx, 0, sizeof(ACTCTXW));
1248 actctx.cbSize = sizeof(ACTCTXW);
1249 actctx.lpSource = path;
1250
1252 ok(handle != INVALID_HANDLE_VALUE, "failed to create context, error %lu\n", GetLastError());
1253
1254 ok(actctx.cbSize == sizeof(actctx), "cbSize=%ld\n", actctx.cbSize);
1255 ok(actctx.dwFlags == 0, "dwFlags=%ld\n", actctx.dwFlags);
1256 ok(actctx.lpSource == path, "lpSource=%p\n", actctx.lpSource);
1257 ok(actctx.wProcessorArchitecture == 0, "wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
1258 ok(actctx.wLangId == 0, "wLangId=%d\n", actctx.wLangId);
1259 ok(actctx.lpAssemblyDirectory == NULL, "lpAssemblyDirectory=%p\n", actctx.lpAssemblyDirectory);
1260 ok(actctx.lpResourceName == NULL, "lpResourceName=%p\n", actctx.lpResourceName);
1261 ok(actctx.lpApplicationName == NULL, "lpApplicationName=%p\n", actctx.lpApplicationName);
1262 ok(actctx.hModule == NULL, "hModule=%p\n", actctx.hModule);
1263
1264 return handle;
1265}
1266static void test_comctl32_class( const char *name )
1267{
1268 WNDCLASSA wcA;
1269 WNDCLASSW wcW;
1270 BOOL ret;
1272 WCHAR nameW[20];
1273 HWND hwnd;
1274
1275 if (name[0] == '!')
1276 {
1277 char path[MAX_PATH];
1280
1281 name++;
1282
1284 strcat(path, "comctl32_class.manifest");
1285
1288 ret = DeleteFileA(path);
1289 ok(ret, "Failed to delete manifest file, error %ld.\n", GetLastError());
1290
1291 module = GetModuleHandleA( "comctl32" );
1292 ok( !module, "comctl32 already loaded\n" );
1293
1295 ok(ret, "Failed to activate context.\n");
1296
1297 /* Some systems load modules during context activation. In this case skip the rest of the test. */
1298 module = GetModuleHandleA( "comctl32" );
1299 ok( !module || broken(module != NULL) /* Vista/Win7 */, "comctl32 already loaded\n" );
1300 if (module)
1301 {
1302 win_skip("Module loaded during context activation. Skipping tests.\n");
1303 goto skiptest;
1304 }
1305
1306 ret = GetClassInfoA( 0, name, &wcA );
1307 ok( ret || broken(!ret) /* WinXP */, "GetClassInfoA failed for %s\n", name );
1308 if (!ret)
1309 goto skiptest;
1310
1312 ret = GetClassInfoW( 0, nameW, &wcW );
1313 ok( ret, "GetClassInfoW failed for %s\n", name );
1314 module = GetModuleHandleA( "comctl32" );
1315 ok( module != 0, "comctl32 not loaded\n" );
1317 module = GetModuleHandleA( "comctl32" );
1318 ok( !module || broken(module != NULL) /* Vista */, "comctl32 still loaded\n" );
1319 hwnd = CreateWindowA( name, "test", WS_OVERLAPPEDWINDOW, 0, 0, 10, 10, NULL, NULL, NULL, 0 );
1320 ok( hwnd != 0, "failed to create window for %s\n", name );
1321 module = GetModuleHandleA( "comctl32" );
1322 ok( module != 0, "comctl32 not loaded\n" );
1324
1325 skiptest:
1327 ok(ret, "Failed to deactivate context.\n");
1329 }
1330 else
1331 {
1332 module = GetModuleHandleA( "comctl32" );
1333 ok( !module, "comctl32 already loaded\n" );
1334 ret = GetClassInfoA( 0, name, &wcA );
1335 ok( ret || broken(!ret) /* <= winxp */, "GetClassInfoA failed for %s\n", name );
1336 if (!ret) return;
1338 ret = GetClassInfoW( 0, nameW, &wcW );
1339 ok( ret, "GetClassInfoW failed for %s\n", name );
1340 module = GetModuleHandleA( "comctl32" );
1341 ok( module != 0, "comctl32 not loaded\n" );
1343 module = GetModuleHandleA( "comctl32" );
1344 ok( !module, "comctl32 still loaded\n" );
1345 hwnd = CreateWindowA( name, "test", WS_OVERLAPPEDWINDOW, 0, 0, 10, 10, NULL, NULL, NULL, 0 );
1346 ok( hwnd != 0, "failed to create window for %s\n", name );
1347 module = GetModuleHandleA( "comctl32" );
1348 ok( module != 0, "comctl32 not loaded\n" );
1350 }
1351}
1352
1353/* verify that comctl32 classes are automatically loaded by user32 */
1354static void test_comctl32_classes(void)
1355{
1356 char path_name[MAX_PATH];
1359 char **argv;
1360 int i;
1361
1362 static const char *classes[] =
1363 {
1367 WC_HEADERA,
1377 "SysLink",
1384 "!Button",
1385 "!Edit",
1386 "!Static",
1387 "!Listbox",
1388 "!ComboBox",
1389 "!ComboLBox",
1390 };
1391
1393 for (i = 0; i < ARRAY_SIZE(classes); i++)
1394 {
1395 memset( &startup, 0, sizeof(startup) );
1396 startup.cb = sizeof( startup );
1397 sprintf( path_name, "%s class %s", argv[0], classes[i] );
1399 "CreateProcess failed.\n" );
1400 wait_child_process( info.hProcess );
1401 CloseHandle( info.hProcess );
1402 CloseHandle( info.hThread );
1403 }
1404}
1405
1406static void test_IME(void)
1407{
1408 static const WCHAR ime_classW[] = {'I','M','E',0};
1409
1410 char module_name[MAX_PATH], *ptr;
1412 WNDCLASSW wnd_classw;
1414 SIZE_T size;
1415 BOOL ret;
1416
1417 if (!GetProcAddress(GetModuleHandleA("user32.dll"), "BroadcastSystemMessageExA"))
1418 {
1419 win_skip("BroadcastSystemMessageExA not available, skipping IME class test\n");
1420 return;
1421 }
1422
1423 ok(GetModuleHandleA("imm32") != 0, "imm32.dll is not loaded\n");
1424
1425 ret = GetClassInfoA(NULL, "IME", &wnd_class);
1426 ok(ret, "GetClassInfo failed: %ld\n", GetLastError());
1427
1428 size = VirtualQuery(wnd_class.lpfnWndProc, &mbi, sizeof(mbi));
1429 ok(size == sizeof(mbi), "VirtualQuery returned %Id\n", size);
1430 if (size == sizeof(mbi)) {
1432 ok(size, "GetModuleFileName failed\n");
1433 for (ptr = module_name+size-1; ptr > module_name; ptr--)
1434 if (*ptr == '\\' || *ptr == '/') break;
1435 if (*ptr == '\\' || *ptr=='/') ptr++;
1436 ok(!lstrcmpiA(ptr, "user32.dll") || !lstrcmpiA(ptr, "ntdll.dll"), "IME window proc implemented in %s\n", ptr);
1437 }
1438
1439 ret = GetClassInfoW(NULL, ime_classW, &wnd_classw);
1440 ok(ret, "GetClassInfo failed: %ld\n", GetLastError());
1441
1442 size = VirtualQuery(wnd_classw.lpfnWndProc, &mbi, sizeof(mbi));
1443 ok(size == sizeof(mbi), "VirtualQuery returned %Id\n", size);
1445 ok(size, "GetModuleFileName failed\n");
1446 for (ptr = module_name+size-1; ptr > module_name; ptr--)
1447 if (*ptr == '\\' || *ptr == '/') break;
1448 if (*ptr == '\\' || *ptr=='/') ptr++;
1449 ok(!lstrcmpiA(ptr, "user32.dll") || !lstrcmpiA(ptr, "ntdll.dll"), "IME window proc implemented in %s\n", ptr);
1450}
1451
1452static void test_actctx_classes(void)
1453{
1454 static const char main_manifest[] =
1455 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
1456 "<assemblyIdentity version=\"4.3.2.1\" name=\"Wine.WndClass.Test\" type=\"win32\" />"
1457 "<file name=\"file.exe\">"
1458 "<windowClass>MyTestClass</windowClass>"
1459 "</file>"
1460 "</assembly>";
1461 static const char *testclass = "MyTestClass";
1462 WNDCLASSA wc;
1465 BOOL ret;
1466 ATOM class;
1468 char buff[64];
1469 HWND hwnd, hwnd2;
1470 char path[MAX_PATH];
1471
1473 strcat(path, "actctx_classes.manifest");
1474
1475 create_manifest_file(path, main_manifest);
1477 ret = DeleteFileA(path);
1478 ok(ret, "Failed to delete manifest file, error %ld.\n", GetLastError());
1479
1481 ok(ret, "Failed to activate context.\n");
1482
1483 memset(&wc, 0, sizeof(wc));
1486 wc.lpszClassName = testclass;
1487
1489
1490 ret = GetClassInfoA(hinst, testclass, &wc);
1491 ok(!ret, "Expected failure.\n");
1492
1493 class = RegisterClassA(&wc);
1494 ok(class != 0, "Failed to register class.\n");
1495
1496 /* Class info is available by versioned and regular names. */
1497 ret = GetClassInfoA(hinst, testclass, &wc);
1498 ok(ret, "Failed to get class info.\n");
1499
1500 hwnd = CreateWindowExA(0, testclass, "test", 0, 0, 0, 0, 0, 0, 0, hinst, 0);
1501 ok(hwnd != NULL, "Failed to create a window.\n");
1502
1503 hwnd2 = FindWindowExA(NULL, NULL, "MyTestClass", NULL);
1504 ok(hwnd2 == hwnd, "Failed to find test window.\n");
1505
1506 hwnd2 = FindWindowExA(NULL, NULL, "4.3.2.1!MyTestClass", NULL);
1507 ok(hwnd2 == NULL, "Unexpected find result %p.\n", hwnd2);
1508
1509 ret = GetClassNameA(hwnd, buff, sizeof(buff));
1510 ok(ret, "Failed to get class name.\n");
1511 ok(!strcmp(buff, testclass), "Unexpected class name.\n");
1512
1513 ret = GetClassInfoA(hinst, "4.3.2.1!MyTestClass", &wc);
1514 ok(ret, "Failed to get class info.\n");
1515
1516 ret = UnregisterClassA(testclass, hinst);
1517 ok(!ret, "Failed to unregister class.\n");
1518
1520 ok(ret, "Failed to deactivate context.\n");
1521
1522 ret = GetClassInfoA(hinst, testclass, &wc);
1523 ok(!ret, "Unexpected ret val %d.\n", ret);
1524
1525 ret = GetClassInfoA(hinst, "4.3.2.1!MyTestClass", &wc);
1526 ok(ret, "Failed to get class info.\n");
1527
1528 ret = GetClassNameA(hwnd, buff, sizeof(buff));
1529 ok(ret, "Failed to get class name.\n");
1530 ok(!strcmp(buff, testclass), "Unexpected class name.\n");
1531
1533
1534 hwnd = CreateWindowExA(0, "4.3.2.1!MyTestClass", "test", 0, 0, 0, 0, 0, 0, 0, hinst, 0);
1535 ok(hwnd != NULL, "Failed to create a window.\n");
1536
1537 hwnd2 = FindWindowExA(NULL, NULL, "MyTestClass", NULL);
1538 ok(hwnd2 == hwnd, "Failed to find test window.\n");
1539
1540 hwnd2 = FindWindowExA(NULL, NULL, "4.3.2.1!MyTestClass", NULL);
1541 ok(hwnd2 == NULL, "Unexpected find result %p.\n", hwnd2);
1542
1544
1545 ret = UnregisterClassA("MyTestClass", hinst);
1546 ok(!ret, "Unexpected ret value %d.\n", ret);
1547
1548 ret = UnregisterClassA("4.3.2.1!MyTestClass", hinst);
1549 ok(ret, "Failed to unregister class.\n");
1550
1551 /* Register versioned class without active context. */
1552 wc.lpszClassName = "4.3.2.1!MyTestClass";
1553 class = RegisterClassA(&wc);
1554 ok(class != 0, "Failed to register class.\n");
1555
1557 ok(ret, "Failed to activate context.\n");
1558
1559 wc.lpszClassName = "MyTestClass";
1560 class = RegisterClassA(&wc);
1561 ok(class == 0, "Expected failure.\n");
1562
1564 ok(ret, "Failed to deactivate context.\n");
1565
1566 ret = UnregisterClassA("4.3.2.1!MyTestClass", hinst);
1567 ok(ret, "Failed to unregister class.\n");
1568
1569 /* Only versioned name is registered. */
1571 ok(ret, "Failed to activate context.\n");
1572
1573 wc.lpszClassName = "MyTestClass";
1574 class = RegisterClassA(&wc);
1575 ok(class != 0, "Failed to register class\n");
1576
1578 ok(ret, "Failed to deactivate context.\n");
1579
1580 ret = GetClassInfoA(hinst, "MyTestClass", &wc);
1581 ok(!ret, "Expected failure.\n");
1582
1583 ret = GetClassInfoA(hinst, "4.3.2.1!MyTestClass", &wc);
1584 ok(ret, "Failed to get class info.\n");
1585
1586 ret = UnregisterClassA("4.3.2.1!MyTestClass", hinst);
1587 ok(ret, "Failed to unregister class.\n");
1588
1589 /* Register regular name first, it's not considered when versioned name is registered. */
1590 wc.lpszClassName = "MyTestClass";
1591 class = RegisterClassA(&wc);
1592 ok(class != 0, "Failed to register class.\n");
1593
1595 ok(ret, "Failed to activate context.\n");
1596
1597 wc.lpszClassName = "MyTestClass";
1598 class = RegisterClassA(&wc);
1599 ok(class != 0, "Failed to register class.\n");
1600
1602 ok(ret, "Failed to deactivate context.\n");
1603
1604 ret = UnregisterClassA("4.3.2.1!MyTestClass", hinst);
1605 ok(ret, "Failed to unregister class.\n");
1606
1607 ret = UnregisterClassA("MyTestClass", hinst);
1608 ok(ret, "Failed to unregister class.\n");
1609
1611}
1612
1613static void test_uxtheme(void)
1614{
1615 static const CHAR *class_name = "test_uxtheme_class";
1617 BOOL dll_loaded, is_theme_active;
1618 WNDCLASSEXA class;
1619 HMODULE uxtheme;
1620 ATOM atom;
1621 HWND hwnd;
1622
1623 memset(&class, 0, sizeof(class));
1624 class.cbSize = sizeof(class);
1625 class.lpfnWndProc = DefWindowProcA;
1626 class.hInstance = GetModuleHandleA(NULL);
1627 class.lpszClassName = class_name;
1628 atom = RegisterClassExA(&class);
1629 ok(atom, "RegisterClassExA failed, error %lu.\n", GetLastError());
1630
1631 dll_loaded = !!GetModuleHandleA("comctl32.dll");
1632 ok(!dll_loaded, "Expected comctl32.dll not loaded.\n");
1633 dll_loaded = !!GetModuleHandleA("uxtheme.dll");
1634 todo_wine_if(dll_loaded)
1635 ok(!dll_loaded, "Expected uxtheme.dll not loaded.\n");
1636
1637 /* Creating a window triggers uxtheme load when theming is active */
1638 hwnd = CreateWindowA(class_name, "Test", WS_POPUP, 0, 0, 1, 1, NULL, NULL,
1640 ok(!!hwnd, "Failed to create a test window, error %lu.\n", GetLastError());
1641
1642 dll_loaded = !!GetModuleHandleA("comctl32.dll");
1643 ok(!dll_loaded, "Expected comctl32.dll not loaded.\n");
1644
1645 /* Uxtheme is loaded when theming is active */
1646 dll_loaded = !!GetModuleHandleA("uxtheme.dll");
1647
1648 uxtheme = LoadLibraryA("uxtheme.dll");
1649 ok(!!uxtheme, "Failed to load uxtheme.dll, error %lu.\n", GetLastError());
1650 pIsThemeActive = (void *)GetProcAddress(uxtheme, "IsThemeActive");
1651 ok(!!pIsThemeActive, "Failed to load IsThemeActive, error %lu.\n", GetLastError());
1652 is_theme_active = pIsThemeActive();
1653 FreeLibrary(uxtheme);
1654
1655 ok(dll_loaded == is_theme_active, "Expected uxtheme %s when theming is %s.\n",
1656 is_theme_active ? "loaded" : "not loaded", is_theme_active ? "active" : "inactive");
1657
1660}
1661
1662static void test_class_name(void)
1663{
1664 WCHAR class_name[] = L"ClassNameTest";
1666 WNDCLASSEXW wcex;
1667 const WCHAR *nameW;
1668 const char *nameA;
1669 UINT_PTR res;
1670 HWND hwnd;
1671
1672#ifdef __REACTOS__
1673 if (is_reactos()) {
1674 ok(FALSE, "FIXME: ReactOS crashes on test_class_name()!\n");
1675 return;
1676 }
1677#endif
1678 memset(&wcex, 0, sizeof wcex);
1679 wcex.cbSize = sizeof wcex;
1682 wcex.hInstance = hinst;
1683 wcex.lpszClassName = class_name;
1684 wcex.lpszMenuName = L"menu name";
1685 ok(RegisterClassExW(&wcex), "RegisterClassExW returned 0\n");
1686 hwnd = CreateWindowExW(0, class_name, NULL, WS_OVERLAPPEDWINDOW,
1687 0, 0, 0, 0, NULL, NULL, hinst, 0);
1688 ok(hwnd != NULL, "Window was not created\n");
1689
1690 nameA = (const char *)GetClassLongPtrA(hwnd, GCLP_MENUNAME);
1691 ok(!strcmp(nameA, "menu name"), "unexpected class name %s\n", debugstr_a(nameA));
1693 ok(!wcscmp(nameW, L"menu name"), "unexpected class name %s\n", debugstr_w(nameW));
1694
1696 todo_wine
1697 ok(res, "SetClassLongPtrA returned 0\n");
1698 nameA = (const char *)GetClassLongPtrA(hwnd, GCLP_MENUNAME);
1699 ok(!strcmp(nameA, "nameA"), "unexpected class name %s\n", debugstr_a(nameA));
1701 ok(!wcscmp(nameW, L"nameA"), "unexpected class name %s\n", debugstr_w(nameW));
1702
1704 todo_wine
1705 ok(res, "SetClassLongPtrW returned 0\n");
1706 nameA = (const char *)GetClassLongPtrA(hwnd, GCLP_MENUNAME);
1707 ok(!strcmp(nameA, "nameW"), "unexpected class name %s\n", debugstr_a(nameA));
1709 ok(!wcscmp(nameW, L"nameW"), "unexpected class name %s\n", debugstr_w(nameW));
1710
1712 UnregisterClassW(class_name, hinst);
1713}
1714
1716{
1717 char **argv;
1720
1721 if (argc >= 3)
1722 {
1724 return;
1725 }
1726
1727 test_uxtheme();
1728 test_IME();
1731
1732 if (!GetModuleHandleW(0))
1733 {
1734 trace("Class test is incompatible with Win9x implementation, skipping\n");
1735 return;
1736 }
1737
1740 ClassTest((HANDLE)((ULONG_PTR)hInstance | 0x1234), FALSE);
1741 ClassTest((HANDLE)((ULONG_PTR)hInstance | 0x1234), TRUE);
1743 test_styles();
1747 test_icons();
1751
1752 /* this test unregisters the Button class so it should be executed at the end */
1754}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
COMPILER_DEPENDENT_UINT64 UINT64
Definition: actypes.h:131
static void startup(void)
Arabic default style
Definition: afstyles.h:94
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
static const WCHAR nameW[]
Definition: main.c:49
#define ARRAY_SIZE(A)
Definition: main.h:20
HINSTANCE hInstance
Definition: charmap.c:19
Definition: _map.h:48
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:171
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NTSTATUS
Definition: precomp.h:19
#define CloseHandle
Definition: compat.h:739
#define IMAGE_DIRECTORY_ENTRY_EXPORT
Definition: compat.h:151
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define PAGE_READONLY
Definition: compat.h:138
#define UnmapViewOfFile
Definition: compat.h:746
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
#define FreeLibrary(x)
Definition: compat.h:748
#define RtlImageDirectoryEntryToData
Definition: compat.h:809
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define CreateFileW
Definition: compat.h:741
#define FILE_MAP_READ
Definition: compat.h:776
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define MapViewOfFile
Definition: compat.h:745
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
#define lstrlenW
Definition: compat.h:750
VOID WINAPI ReleaseActCtx(IN HANDLE hActCtx)
Definition: actctx.c:208
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:1973
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
HANDLE WINAPI CreateActCtxW(PCACTCTXW pActCtx)
Definition: actctx.c:102
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4133
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(const char *app_name, char *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const char *cur_dir, STARTUPINFOA *startup_info, PROCESS_INFORMATION *info)
Definition: process.c:686
MonoAssembly int argc
Definition: metahost.c:107
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3330
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define INFINITE
Definition: serial.h:102
int global
Definition: ehframes.cpp:22
static unsigned char buff[32768]
Definition: fatten.c:17
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
static char * path_name(DOS_FILE *file)
Definition: check.c:208
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint res
Definition: glext.h:9613
GLuint GLuint * names
Definition: glext.h:11545
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLfloat param
Definition: glext.h:5796
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static TfClientId tid
const char * filename
Definition: ioapi.h:137
#define debugstr_a
Definition: kernel32.h:31
#define actctx
Definition: kernel32.h:8
#define debugstr_w
Definition: kernel32.h:32
#define win_skip
Definition: minitest.h:67
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define todo_wine
Definition: minitest.h:80
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define CREATE_ALWAYS
Definition: disk.h:72
static PVOID ptr
Definition: dispmode.c:27
#define sprintf
Definition: sprintf.c:45
static HINSTANCE hinst
Definition: edit.c:551
static HICON
Definition: imagelist.c:80
static const char cls_name[]
Definition: compobj.c:2614
static void test_wndproc_forwards(void)
Definition: class.c:940
static void check_style(const char *name, int must_exist, UINT style, UINT ignore)
Definition: class.c:277
static void ClassTest(HINSTANCE hInstance, BOOL global)
Definition: class.c:97
static void test_comctl32_classes(void)
Definition: class.c:1354
static void test_builtinproc(void)
Definition: class.c:677
#define IS_WNDPROC_HANDLE(x)
Definition: class.c:43
int value64
Definition: class.c:1074
static void test_extra_values(void)
Definition: class.c:1081
static void test_class_name(void)
Definition: class.c:1662
static void test_IME(void)
Definition: class.c:1406
static const struct @1854 extra_values[]
static DWORD WINAPI thread_proc(void *param)
Definition: class.c:362
#define NUMCLASSWORDS
Definition: class.c:41
static const char comctl32_manifest[]
Definition: class.c:59
static LRESULT WINAPI TestDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: class.c:1024
#define ARCH
Definition: class.c:54
static void test_styles(void)
Definition: class.c:293
static BOOL RegisterTestDialog(HINSTANCE hInstance)
Definition: class.c:1029
static void create_manifest_file(const char *filename, const char *manifest)
Definition: class.c:1227
static const BOOL is_win64
Definition: class.c:57
static void check_instance_(int line, const char *name, HINSTANCE inst, HINSTANCE info_inst, HINSTANCE gcl_inst)
Definition: class.c:331
static HANDLE create_test_actctx(const char *file)
Definition: class.c:1240
static void test_icons(void)
Definition: class.c:1168
static void check_thread_instance(const char *name, HINSTANCE inst, HINSTANCE info_inst, HINSTANCE gcl_inst)
Definition: class.c:371
#define check_class(inst, name, menu)
Definition: class.c:329
static void test_actctx_classes(void)
Definition: class.c:1452
static void test_instances(void)
Definition: class.c:389
#define check_instance(name, inst, info_inst, gcl_inst)
Definition: class.c:354
int value
Definition: class.c:1073
static void test_uxtheme(void)
Definition: class.c:1613
static LRESULT WINAPI ClassTest_WndProc2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: class.c:89
static void check_class_(int line, HINSTANCE inst, const char *name, const char *menu_name)
Definition: class.c:313
static void CreateDialogParamTest(HINSTANCE hInstance)
Definition: class.c:1057
static void test_GetClassInfo(void)
Definition: class.c:1096
static void test_ntdll_wndprocs(void)
Definition: class.c:867
static LRESULT WINAPI ClassTest_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: class.c:83
static void test_comctl32_class(const char *name)
Definition: class.c:1266
DWORD exp
Definition: msg.c:18625
#define argv
Definition: mplay32.c:18
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
#define SEC_IMAGE
Definition: mmtypes.h:97
HANDLE hThread
Definition: wizard.c:28
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
#define GENERIC_WRITE
Definition: nt_native.h:90
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_POPUP
Definition: pedump.c:616
#define WS_VSCROLL
Definition: pedump.c:627
long LONG
Definition: pedump.c:60
#define WS_HSCROLL
Definition: pedump.c:628
#define WC_LISTVIEWA
Definition: commctrl.h:2261
#define WC_HEADERA
Definition: commctrl.h:623
#define UPDOWN_CLASSA
Definition: commctrl.h:2123
#define WC_PAGESCROLLERA
Definition: commctrl.h:4503
#define TRACKBAR_CLASSA
Definition: commctrl.h:2015
#define WC_EDITW
Definition: commctrl.h:4692
#define WC_COMBOBOXEXA
Definition: commctrl.h:3787
#define WC_TABCONTROLA
Definition: commctrl.h:3939
#define WC_EDITA
Definition: commctrl.h:4691
#define WC_TREEVIEWA
Definition: commctrl.h:3247
#define TOOLTIPS_CLASSA
Definition: commctrl.h:1708
#define REBARCLASSNAMEA
Definition: commctrl.h:1464
#define PROGRESS_CLASSA
Definition: commctrl.h:2180
#define WC_IPADDRESSA
Definition: commctrl.h:4478
#define STATUSCLASSNAMEA
Definition: commctrl.h:1942
#define WC_NATIVEFONTCTLA
Definition: commctrl.h:4612
#define DATETIMEPICK_CLASSA
Definition: commctrl.h:4328
#define ANIMATE_CLASSA
Definition: commctrl.h:4147
#define HOTKEY_CLASSA
Definition: commctrl.h:2240
#define MONTHCAL_CLASSA
Definition: commctrl.h:4181
#define TOOLBARCLASSNAMEA
Definition: commctrl.h:944
WNDCLASSW wnd_class
Definition: startup.c:16
const WCHAR * str
strcat
Definition: string.h:92
int winetest_get_mainargs(char ***pargv)
#define wait_child_process
Definition: test.h:159
#define memset(x, y, z)
Definition: compat.h:39
HICON hIcon
Definition: winuser.h:3276
HINSTANCE hInstance
Definition: winuser.h:3275
int cbWndExtra
Definition: winuser.h:3274
UINT style
Definition: winuser.h:3271
LPCSTR lpszMenuName
Definition: winuser.h:3279
LPCSTR lpszClassName
Definition: winuser.h:3280
WNDPROC lpfnWndProc
Definition: winuser.h:3272
int cbClsExtra
Definition: winuser.h:3273
int cbClsExtra
Definition: winuser.h:3312
HINSTANCE hInstance
Definition: winuser.h:3314
HCURSOR hCursor
Definition: winuser.h:3316
LPCSTR lpszMenuName
Definition: winuser.h:3318
HICON hIconSm
Definition: winuser.h:3320
int cbWndExtra
Definition: winuser.h:3313
UINT cbSize
Definition: winuser.h:3309
WNDPROC lpfnWndProc
Definition: winuser.h:3311
LPCSTR lpszClassName
Definition: winuser.h:3319
HICON hIcon
Definition: winuser.h:3315
HBRUSH hbrBackground
Definition: winuser.h:3317
LPCWSTR lpszClassName
Definition: winuser.h:3334
LPCWSTR lpszMenuName
Definition: winuser.h:3333
WNDPROC lpfnWndProc
Definition: winuser.h:3326
UINT cbSize
Definition: winuser.h:3324
HICON hIconSm
Definition: winuser.h:3335
HINSTANCE hInstance
Definition: winuser.h:3329
HICON hIcon
Definition: winuser.h:3330
LPCWSTR lpszClassName
Definition: winuser.h:3293
LPCWSTR lpszMenuName
Definition: winuser.h:3292
HBRUSH hbrBackground
Definition: winuser.h:3291
HICON hIcon
Definition: winuser.h:3289
HINSTANCE hInstance
Definition: winuser.h:3288
int cbClsExtra
Definition: winuser.h:3286
UINT style
Definition: winuser.h:3284
WNDPROC lpfnWndProc
Definition: winuser.h:3285
int cbWndExtra
Definition: winuser.h:3287
HCURSOR hCursor
Definition: winuser.h:3290
HINSTANCE gcl_inst
Definition: class.c:359
HINSTANCE info_inst
Definition: class.c:359
HINSTANCE inst
Definition: class.c:359
const char * name
Definition: class.c:358
Definition: http.c:7252
Definition: cookie.c:34
Definition: fci.c:127
Definition: parser.c:49
Definition: name.c:39
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
static IsThemeActiveT pIsThemeActive
Definition: treelist.c:367
#define GWLP_WNDPROC
Definition: treelist.c:66
HANDLE HINSTANCE
Definition: typedefs.h:77
uint32_t DWORD_PTR
Definition: typedefs.h:65
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
Definition: pdh_main.c:96
static const CHAR manifest[]
Definition: v6util.h:41
static const WCHAR classW[]
Definition: lex.c:40
HWND hWndMain
Definition: welcome.c:60
SIZE_T NTAPI VirtualQuery(IN LPCVOID lpAddress, OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength)
Definition: virtmem.c:211
static const WCHAR staticW[]
Definition: static.c:80
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WAIT_OBJECT_0
Definition: winbase.h:383
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
#define ERROR_CLASS_HAS_WINDOWS
Definition: winerror.h:1238
#define ERROR_CLASS_ALREADY_EXISTS
Definition: winerror.h:1236
#define ERROR_CLASS_DOES_NOT_EXIST
Definition: winerror.h:1237
#define ERROR_NOACCESS
Definition: winerror.h:902
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
#define DLGWINDOWEXTRA
Definition: winuser.h:2601
#define CS_DROPSHADOW
Definition: winuser.h:668
#define CS_VREDRAW
Definition: winuser.h:666
#define SetWindowLongPtrA
Definition: winuser.h:5511
#define SetClassLongPtrW
Definition: winuser.h:5431
#define GCLP_MENUNAME
Definition: winuser.h:685
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define SetClassLongPtrA
Definition: winuser.h:5430
#define GCLP_HICONSM
Definition: winuser.h:683
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)
#define IDI_QUESTION
Definition: winuser.h:714
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
#define GCLP_HMODULE
Definition: winuser.h:684
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI CreateDialogParamA(_In_opt_ HINSTANCE, _In_ LPCSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2414
#define GCLP_HICON
Definition: winuser.h:682
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4469
int WINAPI GetClassNameA(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPSTR lpClassName, _In_ int nMaxCount)
#define CS_HREDRAW
Definition: winuser.h:661
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:695
#define GCLP_WNDPROC
Definition: winuser.h:686
#define SM_CYSMICON
Definition: winuser.h:1024
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI GetClassInfoExA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSEXA)
#define WM_GETTEXT
Definition: winuser.h:1646
#define GetWindowLongPtrA
Definition: winuser.h:4982
#define CS_DBLCLKS
Definition: winuser.h:659
HWND WINAPI FindWindowExA(_In_opt_ HWND, _In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR)
BOOL WINAPI GetClassInfoExW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSEXW)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2474
LRESULT WINAPI DefDlgProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HANDLE WINAPI CopyImage(_In_ HANDLE, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2307
#define GWLP_HINSTANCE
Definition: winuser.h:867
#define WM_NCCREATE
Definition: winuser.h:1711
#define IDI_APPLICATION
Definition: winuser.h:712
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define SM_CXSMICON
Definition: winuser.h:1023
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR 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)
HICON WINAPI LoadIconA(_In_opt_ HINSTANCE hInstance, _In_ LPCSTR lpIconName)
Definition: cursoricon.c:2429
DWORD WINAPI SetClassLongW(_In_ HWND, _In_ int, _In_ LONG)
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4470
BOOL WINAPI GetClassInfoA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSA)
#define CW_USEDEFAULT
Definition: winuser.h:225
#define GetClassLongPtrW
Definition: winuser.h:4718
int WINAPI GetClipboardFormatNameW(_In_ UINT format, _Out_writes_(cchMaxCount) LPWSTR lpszFormatName, _In_ int cchMaxCount)
#define CS_GLOBALCLASS
Definition: winuser.h:660
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
HANDLE WINAPI LoadImageA(_In_opt_ HINSTANCE hInst, _In_ LPCSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2547
#define CS_SAVEBITS
Definition: winuser.h:665
DWORD WINAPI SetClassLongA(_In_ HWND, _In_ int, _In_ LONG)
#define LR_DEFAULTCOLOR
Definition: winuser.h:1098
#define SW_SHOW
Definition: winuser.h:786
#define GetClassLongPtrA
Definition: winuser.h:4717
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
DWORD WINAPI GetClassLongW(_In_ HWND, _In_ int)
BOOL WINAPI GetClassInfoW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSW)
#define SetWindowLongPtrW
Definition: winuser.h:5512
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CS_PARENTDC
Definition: winuser.h:664
BOOL WINAPI DestroyWindow(_In_ HWND)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2444
int WINAPI GetSystemMetrics(_In_ int)
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define GCL_STYLE
Definition: winuser.h:678
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2459
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2422
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char * LPSTR
Definition: xmlstorage.h:182
char CHAR
Definition: xmlstorage.h:175