Improved error handling.
[wine.git] / windows / class.c
blob19ae80690006784c2265dc0cfe13adcc4e8c17f0
1 /*
2 * Window classes functions
4 * Copyright 1993, 1996, 2003 Alexandre Julliard
5 * Copyright 1998 Juergen Schmied (jsch)
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "config.h"
23 #include "wine/port.h"
25 #include <assert.h>
26 #include <stdarg.h>
27 #include <stdlib.h>
28 #include <string.h>
30 #include "wine/winbase16.h"
31 #include "winerror.h"
32 #include "windef.h"
33 #include "winbase.h"
34 #include "wingdi.h"
35 #include "wine/winuser16.h"
36 #include "wownt32.h"
37 #include "wine/unicode.h"
38 #include "win.h"
39 #include "user.h"
40 #include "controls.h"
41 #include "dce.h"
42 #include "winproc.h"
43 #include "wine/server.h"
44 #include "wine/list.h"
45 #include "wine/debug.h"
47 WINE_DEFAULT_DEBUG_CHANNEL(class);
49 typedef struct tagCLASS
51 struct list entry; /* Entry in class list */
52 UINT style; /* Class style */
53 BOOL local; /* Local class? */
54 WNDPROC winprocA; /* Window procedure (ASCII) */
55 WNDPROC winprocW; /* Window procedure (Unicode) */
56 INT cbClsExtra; /* Class extra bytes */
57 INT cbWndExtra; /* Window extra bytes */
58 LPWSTR menuName; /* Default menu name (Unicode followed by ASCII) */
59 SEGPTR segMenuName; /* Default menu name as SEGPTR */
60 struct tagDCE *dce; /* Class DCE (if CS_CLASSDC) */
61 HINSTANCE hInstance; /* Module that created the task */
62 HICON hIcon; /* Default icon */
63 HICON hIconSm; /* Default small icon */
64 HCURSOR hCursor; /* Default cursor */
65 HBRUSH hbrBackground; /* Default background */
66 ATOM atomName; /* Name of the class */
67 } CLASS;
69 static struct list class_list = LIST_INIT( class_list );
70 static CLASS *desktop_class;
71 static HMODULE user32_module;
73 #define CLASS_OTHER_PROCESS ((CLASS *)1)
75 /***********************************************************************
76 * get_class_ptr
78 static CLASS *get_class_ptr( HWND hwnd, BOOL write_access )
80 WND *ptr = WIN_GetPtr( hwnd );
82 if (ptr)
84 if (ptr != WND_OTHER_PROCESS) return ptr->class;
85 if (write_access && IsWindow( hwnd )) /* check other processes */
87 /* modifying classes in other processes is not allowed */
88 SetLastError( ERROR_ACCESS_DENIED );
89 return NULL;
91 return CLASS_OTHER_PROCESS;
93 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
94 return NULL;
98 /***********************************************************************
99 * release_class_ptr
101 inline static void release_class_ptr( CLASS *ptr )
103 USER_Unlock();
107 /***********************************************************************
108 * set_server_info
110 * Set class info with the wine server.
112 static BOOL set_server_info( HWND hwnd, INT offset, LONG newval )
114 BOOL ret;
116 SERVER_START_REQ( set_class_info )
118 req->window = hwnd;
119 req->extra_offset = -1;
120 switch(offset)
122 case GCW_ATOM:
123 req->flags = SET_CLASS_ATOM;
124 req->atom = newval;
125 case GCL_STYLE:
126 req->flags = SET_CLASS_STYLE;
127 req->style = newval;
128 break;
129 case GCL_CBWNDEXTRA:
130 req->flags = SET_CLASS_WINEXTRA;
131 req->win_extra = newval;
132 break;
133 case GCL_HMODULE:
134 req->flags = SET_CLASS_INSTANCE;
135 req->instance = (void *)newval;
136 break;
137 default:
138 assert( offset >= 0 );
139 req->flags = SET_CLASS_EXTRA;
140 req->extra_offset = offset;
141 req->extra_size = sizeof(newval);
142 memcpy( &req->extra_value, &newval, sizeof(newval) );
143 break;
145 ret = !wine_server_call_err( req );
147 SERVER_END_REQ;
148 return ret;
152 /***********************************************************************
153 * CLASS_GetProc
155 * Get the class winproc for a given proc type
157 static WNDPROC16 CLASS_GetProc( CLASS *classPtr, WINDOWPROCTYPE type )
159 WNDPROC proc = classPtr->winprocA;
161 if (classPtr->winprocW)
163 /* if we have a Unicode proc, use it if we have no ASCII proc
164 * or if we have both and Unicode was requested
166 if (!proc || type == WIN_PROC_32W) proc = classPtr->winprocW;
168 return WINPROC_GetProc( proc, type );
172 /***********************************************************************
173 * CLASS_SetProc
175 * Set the class winproc for a given proc type.
176 * Returns the previous window proc.
178 static WNDPROC16 CLASS_SetProc( CLASS *classPtr, WNDPROC newproc, WINDOWPROCTYPE type )
180 WNDPROC *proc = &classPtr->winprocA;
181 WNDPROC16 ret;
183 if (classPtr->winprocW)
185 /* if we have a Unicode proc, use it if we have no ASCII proc
186 * or if we have both and Unicode was requested
188 if (!*proc || type == WIN_PROC_32W) proc = &classPtr->winprocW;
190 ret = WINPROC_GetProc( *proc, type );
191 WINPROC_SetProc( proc, newproc, type, WIN_PROC_CLASS );
192 /* now free the one that we didn't set */
193 if (classPtr->winprocA && classPtr->winprocW)
195 if (proc == &classPtr->winprocA)
197 WINPROC_FreeProc( classPtr->winprocW, WIN_PROC_CLASS );
198 classPtr->winprocW = 0;
200 else
202 WINPROC_FreeProc( classPtr->winprocA, WIN_PROC_CLASS );
203 classPtr->winprocA = 0;
206 return ret;
210 /***********************************************************************
211 * CLASS_GetMenuNameA
213 * Get the menu name as a ASCII string.
215 inline static LPSTR CLASS_GetMenuNameA( CLASS *classPtr )
217 if (!HIWORD(classPtr->menuName)) return (LPSTR)classPtr->menuName;
218 return (LPSTR)(classPtr->menuName + strlenW(classPtr->menuName) + 1);
222 /***********************************************************************
223 * CLASS_GetMenuName16
225 * Get the menu name as a SEGPTR.
227 inline static SEGPTR CLASS_GetMenuName16( CLASS *classPtr )
229 if (!HIWORD(classPtr->menuName)) return (SEGPTR)classPtr->menuName;
230 if (!classPtr->segMenuName)
231 classPtr->segMenuName = MapLS( CLASS_GetMenuNameA(classPtr) );
232 return classPtr->segMenuName;
236 /***********************************************************************
237 * CLASS_GetMenuNameW
239 * Get the menu name as a Unicode string.
241 inline static LPWSTR CLASS_GetMenuNameW( CLASS *classPtr )
243 return classPtr->menuName;
247 /***********************************************************************
248 * CLASS_SetMenuNameA
250 * Set the menu name in a class structure by copying the string.
252 static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name )
254 UnMapLS( classPtr->segMenuName );
255 classPtr->segMenuName = 0;
256 if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
257 if (HIWORD(name))
259 DWORD lenA = strlen(name) + 1;
260 DWORD lenW = MultiByteToWideChar( CP_ACP, 0, name, lenA, NULL, 0 );
261 classPtr->menuName = HeapAlloc( GetProcessHeap(), 0, lenA + lenW*sizeof(WCHAR) );
262 MultiByteToWideChar( CP_ACP, 0, name, lenA, classPtr->menuName, lenW );
263 memcpy( classPtr->menuName + lenW, name, lenA );
265 else classPtr->menuName = (LPWSTR)name;
269 /***********************************************************************
270 * CLASS_SetMenuNameW
272 * Set the menu name in a class structure by copying the string.
274 static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name )
276 UnMapLS( classPtr->segMenuName );
277 classPtr->segMenuName = 0;
278 if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
279 if (HIWORD(name))
281 DWORD lenW = strlenW(name) + 1;
282 DWORD lenA = WideCharToMultiByte( CP_ACP, 0, name, lenW, NULL, 0, NULL, NULL );
283 classPtr->menuName = HeapAlloc( GetProcessHeap(), 0, lenA + lenW*sizeof(WCHAR) );
284 memcpy( classPtr->menuName, name, lenW*sizeof(WCHAR) );
285 WideCharToMultiByte( CP_ACP, 0, name, lenW,
286 (char *)(classPtr->menuName + lenW), lenA, NULL, NULL );
288 else classPtr->menuName = (LPWSTR)name;
292 /***********************************************************************
293 * CLASS_FreeClass
295 * Free a class structure.
297 static void CLASS_FreeClass( CLASS *classPtr )
299 TRACE("%p\n", classPtr);
301 USER_Lock();
303 list_remove( &classPtr->entry );
304 if (classPtr->dce) DCE_FreeDCE( classPtr->dce );
305 if (classPtr->hbrBackground > (HBRUSH)(COLOR_GRADIENTINACTIVECAPTION + 1))
306 DeleteObject( classPtr->hbrBackground );
307 WINPROC_FreeProc( classPtr->winprocA, WIN_PROC_CLASS );
308 WINPROC_FreeProc( classPtr->winprocW, WIN_PROC_CLASS );
309 UnMapLS( classPtr->segMenuName );
310 HeapFree( GetProcessHeap(), 0, classPtr->menuName );
311 HeapFree( GetProcessHeap(), 0, classPtr );
312 USER_Unlock();
316 /***********************************************************************
317 * CLASS_FreeModuleClasses
319 void CLASS_FreeModuleClasses( HMODULE16 hModule )
321 struct list *ptr, *next;
323 TRACE("0x%08x\n", hModule);
325 USER_Lock();
326 for (ptr = list_head( &class_list ); ptr; ptr = next)
328 CLASS *class = LIST_ENTRY( ptr, CLASS, entry );
329 next = list_next( &class_list, ptr );
330 if (class->hInstance == HINSTANCE_32(hModule))
332 BOOL ret;
334 SERVER_START_REQ( destroy_class )
336 req->atom = class->atomName;
337 req->instance = class->hInstance;
338 ret = !wine_server_call_err( req );
340 SERVER_END_REQ;
341 if (ret) CLASS_FreeClass( class );
344 USER_Unlock();
348 /***********************************************************************
349 * CLASS_FindClassByAtom
351 * Return a pointer to the class.
352 * hinstance has been normalized by the caller.
354 static CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE hinstance )
356 struct list *ptr;
358 USER_Lock();
360 LIST_FOR_EACH( ptr, &class_list )
362 CLASS *class = LIST_ENTRY( ptr, CLASS, entry );
363 if (class->atomName != atom) continue;
364 if (!hinstance || !class->local || class->hInstance == hinstance)
366 TRACE("0x%04x %p -> %p\n", atom, hinstance, class);
367 return class;
370 USER_Unlock();
371 TRACE("0x%04x %p -> not found\n", atom, hinstance);
372 return NULL;
376 /***********************************************************************
377 * CLASS_RegisterClass
379 * The real RegisterClass() functionality.
380 * The atom is deleted no matter what.
382 static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE hInstance, BOOL local,
383 DWORD style, INT classExtra, INT winExtra )
385 CLASS *classPtr;
386 BOOL ret;
388 TRACE("atom=0x%x hinst=%p style=0x%lx clExtr=0x%x winExtr=0x%x\n",
389 atom, hInstance, style, classExtra, winExtra );
391 /* Fix the extra bytes value */
393 if (classExtra < 0) classExtra = 0;
394 else if (classExtra > 40) /* Extra bytes are limited to 40 in Win32 */
395 WARN("Class extra bytes %d is > 40\n", classExtra);
396 if (winExtra < 0) winExtra = 0;
397 else if (winExtra > 40) /* Extra bytes are limited to 40 in Win32 */
398 WARN("Win extra bytes %d is > 40\n", winExtra );
400 classPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLASS) + classExtra );
401 if (!classPtr)
403 GlobalDeleteAtom( atom );
404 return NULL;
407 SERVER_START_REQ( create_class )
409 req->local = local;
410 req->atom = atom;
411 req->style = style;
412 req->instance = hInstance;
413 req->extra = classExtra;
414 req->win_extra = winExtra;
415 req->client_ptr = classPtr;
416 ret = !wine_server_call_err( req );
418 SERVER_END_REQ;
419 GlobalDeleteAtom( atom ); /* the server increased the atom ref count */
420 if (!ret)
422 HeapFree( GetProcessHeap(), 0, classPtr );
423 return NULL;
426 classPtr->style = style;
427 classPtr->local = local;
428 classPtr->cbWndExtra = winExtra;
429 classPtr->cbClsExtra = classExtra;
430 classPtr->hInstance = hInstance;
431 classPtr->atomName = atom;
432 classPtr->dce = (style & CS_CLASSDC) ? DCE_AllocDCE( 0, DCE_CLASS_DC ) : NULL;
434 /* Other non-null values must be set by caller */
436 USER_Lock();
437 if (local) list_add_head( &class_list, &classPtr->entry );
438 else list_add_tail( &class_list, &classPtr->entry );
439 return classPtr;
443 /***********************************************************************
444 * register_builtin
446 * Register a builtin control class.
447 * This allows having both ASCII and Unicode winprocs for the same class.
449 static CLASS *register_builtin( const struct builtin_class_descr *descr )
451 ATOM atom;
452 CLASS *classPtr;
454 if (!(atom = GlobalAddAtomA( descr->name ))) return 0;
456 if (!(classPtr = CLASS_RegisterClass( atom, user32_module, FALSE,
457 descr->style, 0, descr->extra ))) return 0;
459 classPtr->hCursor = LoadCursorA( 0, (LPSTR)descr->cursor );
460 classPtr->hbrBackground = descr->brush;
462 if (descr->procA) WINPROC_SetProc( &classPtr->winprocA, descr->procA,
463 WIN_PROC_32A, WIN_PROC_CLASS );
464 if (descr->procW) WINPROC_SetProc( &classPtr->winprocW, descr->procW,
465 WIN_PROC_32W, WIN_PROC_CLASS );
466 release_class_ptr( classPtr );
467 return classPtr;
471 /***********************************************************************
472 * CLASS_RegisterBuiltinClasses
474 void CLASS_RegisterBuiltinClasses( HMODULE user32 )
476 extern const struct builtin_class_descr BUTTON_builtin_class;
477 extern const struct builtin_class_descr COMBO_builtin_class;
478 extern const struct builtin_class_descr COMBOLBOX_builtin_class;
479 extern const struct builtin_class_descr DIALOG_builtin_class;
480 extern const struct builtin_class_descr DESKTOP_builtin_class;
481 extern const struct builtin_class_descr EDIT_builtin_class;
482 extern const struct builtin_class_descr ICONTITLE_builtin_class;
483 extern const struct builtin_class_descr LISTBOX_builtin_class;
484 extern const struct builtin_class_descr MDICLIENT_builtin_class;
485 extern const struct builtin_class_descr MENU_builtin_class;
486 extern const struct builtin_class_descr SCROLL_builtin_class;
487 extern const struct builtin_class_descr STATIC_builtin_class;
489 user32_module = user32;
490 desktop_class = register_builtin( &DESKTOP_builtin_class );
491 register_builtin( &BUTTON_builtin_class );
492 register_builtin( &COMBO_builtin_class );
493 register_builtin( &COMBOLBOX_builtin_class );
494 register_builtin( &DIALOG_builtin_class );
495 register_builtin( &EDIT_builtin_class );
496 register_builtin( &ICONTITLE_builtin_class );
497 register_builtin( &LISTBOX_builtin_class );
498 register_builtin( &MDICLIENT_builtin_class );
499 register_builtin( &MENU_builtin_class );
500 register_builtin( &SCROLL_builtin_class );
501 register_builtin( &STATIC_builtin_class );
505 /***********************************************************************
506 * CLASS_AddWindow
508 * Add a new window using this class, and set the necessary
509 * information inside the window structure.
511 void CLASS_AddWindow( CLASS *class, WND *win, WINDOWPROCTYPE type )
513 if (!class) class = desktop_class;
515 if (type == WIN_PROC_32W)
517 if (!(win->winproc = class->winprocW)) win->winproc = class->winprocA;
519 else
521 if (!(win->winproc = class->winprocA)) win->winproc = class->winprocW;
523 win->class = class;
524 win->clsStyle = class->style;
525 win->dce = class->dce;
529 /***********************************************************************
530 * RegisterClass (USER.57)
532 ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
534 WNDCLASSEX16 wcex;
536 wcex.cbSize = sizeof(wcex);
537 wcex.style = wc->style;
538 wcex.lpfnWndProc = wc->lpfnWndProc;
539 wcex.cbClsExtra = wc->cbClsExtra;
540 wcex.cbWndExtra = wc->cbWndExtra;
541 wcex.hInstance = wc->hInstance;
542 wcex.hIcon = wc->hIcon;
543 wcex.hCursor = wc->hCursor;
544 wcex.hbrBackground = wc->hbrBackground;
545 wcex.lpszMenuName = wc->lpszMenuName;
546 wcex.lpszClassName = wc->lpszClassName;
547 wcex.hIconSm = 0;
548 return RegisterClassEx16( &wcex );
552 /***********************************************************************
553 * RegisterClassA (USER32.@)
554 * RETURNS
555 * >0: Unique identifier
556 * 0: Failure
558 ATOM WINAPI RegisterClassA( const WNDCLASSA* wc ) /* [in] Address of structure with class data */
560 WNDCLASSEXA wcex;
562 wcex.cbSize = sizeof(wcex);
563 wcex.style = wc->style;
564 wcex.lpfnWndProc = wc->lpfnWndProc;
565 wcex.cbClsExtra = wc->cbClsExtra;
566 wcex.cbWndExtra = wc->cbWndExtra;
567 wcex.hInstance = wc->hInstance;
568 wcex.hIcon = wc->hIcon;
569 wcex.hCursor = wc->hCursor;
570 wcex.hbrBackground = wc->hbrBackground;
571 wcex.lpszMenuName = wc->lpszMenuName;
572 wcex.lpszClassName = wc->lpszClassName;
573 wcex.hIconSm = 0;
574 return RegisterClassExA( &wcex );
578 /***********************************************************************
579 * RegisterClassW (USER32.@)
581 ATOM WINAPI RegisterClassW( const WNDCLASSW* wc )
583 WNDCLASSEXW wcex;
585 wcex.cbSize = sizeof(wcex);
586 wcex.style = wc->style;
587 wcex.lpfnWndProc = wc->lpfnWndProc;
588 wcex.cbClsExtra = wc->cbClsExtra;
589 wcex.cbWndExtra = wc->cbWndExtra;
590 wcex.hInstance = wc->hInstance;
591 wcex.hIcon = wc->hIcon;
592 wcex.hCursor = wc->hCursor;
593 wcex.hbrBackground = wc->hbrBackground;
594 wcex.lpszMenuName = wc->lpszMenuName;
595 wcex.lpszClassName = wc->lpszClassName;
596 wcex.hIconSm = 0;
597 return RegisterClassExW( &wcex );
601 /***********************************************************************
602 * RegisterClassEx (USER.397)
604 ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc )
606 ATOM atom;
607 CLASS *classPtr;
608 HINSTANCE hInstance;
610 if (!(hInstance = HINSTANCE_32(GetExePtr(wc->hInstance))))
611 hInstance = HINSTANCE_32(GetModuleHandle16(NULL));
613 if (!(atom = GlobalAddAtomA( MapSL(wc->lpszClassName) ))) return 0;
614 if (!(classPtr = CLASS_RegisterClass( atom, hInstance, !(wc->style & CS_GLOBALCLASS),
615 wc->style, wc->cbClsExtra, wc->cbWndExtra )))
616 return 0;
618 TRACE("atom=%04x wndproc=%p hinst=%p bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
619 atom, wc->lpfnWndProc, hInstance,
620 wc->hbrBackground, wc->style, wc->cbClsExtra,
621 wc->cbWndExtra, classPtr );
623 classPtr->hIcon = HICON_32(wc->hIcon);
624 classPtr->hIconSm = HICON_32(wc->hIconSm);
625 classPtr->hCursor = HCURSOR_32(wc->hCursor);
626 classPtr->hbrBackground = HBRUSH_32(wc->hbrBackground);
628 WINPROC_SetProc( &classPtr->winprocA, (WNDPROC)wc->lpfnWndProc,
629 WIN_PROC_16, WIN_PROC_CLASS );
630 CLASS_SetMenuNameA( classPtr, MapSL(wc->lpszMenuName) );
631 release_class_ptr( classPtr );
632 return atom;
636 /***********************************************************************
637 * RegisterClassExA (USER32.@)
639 ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc )
641 ATOM atom;
642 CLASS *classPtr;
643 HINSTANCE instance;
645 if (wc->hInstance == user32_module)
647 /* we can't register a class for user32 */
648 SetLastError( ERROR_INVALID_PARAMETER );
649 return 0;
651 if (!(instance = wc->hInstance)) instance = GetModuleHandleW( NULL );
653 if (!(atom = GlobalAddAtomA( wc->lpszClassName ))) return 0;
655 if (!(classPtr = CLASS_RegisterClass( atom, instance, !(wc->style & CS_GLOBALCLASS),
656 wc->style, wc->cbClsExtra, wc->cbWndExtra )))
657 return 0;
659 TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n",
660 atom, wc->lpfnWndProc, instance, wc->hbrBackground,
661 wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr );
663 classPtr->hIcon = wc->hIcon;
664 classPtr->hIconSm = wc->hIconSm;
665 classPtr->hCursor = wc->hCursor;
666 classPtr->hbrBackground = wc->hbrBackground;
667 WINPROC_SetProc( &classPtr->winprocA, wc->lpfnWndProc, WIN_PROC_32A, WIN_PROC_CLASS );
668 CLASS_SetMenuNameA( classPtr, wc->lpszMenuName );
669 release_class_ptr( classPtr );
670 return atom;
674 /***********************************************************************
675 * RegisterClassExW (USER32.@)
677 ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc )
679 ATOM atom;
680 CLASS *classPtr;
681 HINSTANCE instance;
683 if (wc->hInstance == user32_module)
685 /* we can't register a class for user32 */
686 SetLastError( ERROR_INVALID_PARAMETER );
687 return 0;
689 if (!(instance = wc->hInstance)) instance = GetModuleHandleW( NULL );
691 if (!(atom = GlobalAddAtomW( wc->lpszClassName ))) return 0;
693 if (!(classPtr = CLASS_RegisterClass( atom, instance, !(wc->style & CS_GLOBALCLASS),
694 wc->style, wc->cbClsExtra, wc->cbWndExtra )))
695 return 0;
697 TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n",
698 atom, wc->lpfnWndProc, instance, wc->hbrBackground,
699 wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr );
701 classPtr->hIcon = wc->hIcon;
702 classPtr->hIconSm = wc->hIconSm;
703 classPtr->hCursor = wc->hCursor;
704 classPtr->hbrBackground = wc->hbrBackground;
705 WINPROC_SetProc( &classPtr->winprocW, wc->lpfnWndProc, WIN_PROC_32W, WIN_PROC_CLASS );
706 CLASS_SetMenuNameW( classPtr, wc->lpszMenuName );
707 release_class_ptr( classPtr );
708 return atom;
712 /***********************************************************************
713 * UnregisterClass (USER.403)
715 BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance )
717 if (hInstance == GetModuleHandle16("user")) hInstance = 0;
718 return UnregisterClassA( className, HINSTANCE_32(GetExePtr( hInstance )) );
721 /***********************************************************************
722 * UnregisterClassA (USER32.@)
724 BOOL WINAPI UnregisterClassA( LPCSTR className, HINSTANCE hInstance )
726 ATOM atom = HIWORD(className) ? GlobalFindAtomA( className ) : LOWORD(className);
727 return UnregisterClassW( MAKEINTATOMW(atom), hInstance );
730 /***********************************************************************
731 * UnregisterClassW (USER32.@)
733 BOOL WINAPI UnregisterClassW( LPCWSTR className, HINSTANCE hInstance )
735 CLASS *classPtr = NULL;
736 ATOM atom = HIWORD(className) ? GlobalFindAtomW( className ) : LOWORD(className);
738 TRACE("%s %p %x\n",debugstr_w(className), hInstance, atom);
740 if (!atom)
742 SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
743 return FALSE;
746 if (!hInstance) hInstance = GetModuleHandleW( NULL );
748 SERVER_START_REQ( destroy_class )
750 req->atom = atom;
751 req->instance = hInstance;
752 if (!wine_server_call_err( req )) classPtr = reply->client_ptr;
754 SERVER_END_REQ;
756 if (classPtr) CLASS_FreeClass( classPtr );
757 return (classPtr != NULL);
761 /***********************************************************************
762 * GetClassWord (USER32.@)
764 WORD WINAPI GetClassWord( HWND hwnd, INT offset )
766 CLASS *class;
767 WORD retvalue = 0;
769 if (offset < 0) return GetClassLongA( hwnd, offset );
771 TRACE("%p %x\n",hwnd, offset);
773 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
775 if (class == CLASS_OTHER_PROCESS)
777 SERVER_START_REQ( set_class_info )
779 req->window = hwnd;
780 req->flags = 0;
781 req->extra_offset = offset;
782 req->extra_size = sizeof(retvalue);
783 if (!wine_server_call_err( req ))
784 memcpy( &retvalue, &reply->old_extra_value, sizeof(retvalue) );
786 SERVER_END_REQ;
787 return retvalue;
790 if (offset <= class->cbClsExtra - sizeof(WORD))
791 memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) );
792 else
793 SetLastError( ERROR_INVALID_INDEX );
794 release_class_ptr( class );
795 return retvalue;
799 /***********************************************************************
800 * GetClassLong (USER.131)
802 LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset )
804 CLASS *class;
805 LONG ret;
806 HWND hwnd = (HWND)(ULONG_PTR)hwnd16; /* no need for full handle */
808 TRACE("%p %d\n",hwnd, offset);
810 switch( offset )
812 case GCL_WNDPROC:
813 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
814 if (class == CLASS_OTHER_PROCESS) break;
815 ret = (LONG)CLASS_GetProc( class, WIN_PROC_16 );
816 release_class_ptr( class );
817 return ret;
818 case GCL_MENUNAME:
819 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
820 if (class == CLASS_OTHER_PROCESS) break;
821 ret = (LONG)CLASS_GetMenuName16( class );
822 release_class_ptr( class );
823 return ret;
824 default:
825 return GetClassLongA( hwnd, offset );
827 FIXME( "offset %d not supported on other process window %p\n", offset, hwnd );
828 SetLastError( ERROR_INVALID_HANDLE );
829 return 0;
833 /***********************************************************************
834 * GetClassLongW (USER32.@)
836 LONG WINAPI GetClassLongW( HWND hwnd, INT offset )
838 CLASS *class;
839 LONG retvalue = 0;
841 TRACE("%p %d\n", hwnd, offset);
843 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
845 if (class == CLASS_OTHER_PROCESS)
847 SERVER_START_REQ( set_class_info )
849 req->window = hwnd;
850 req->flags = 0;
851 req->extra_offset = (offset >= 0) ? offset : -1;
852 req->extra_size = (offset >= 0) ? sizeof(retvalue) : 0;
853 if (!wine_server_call_err( req ))
855 switch(offset)
857 case GCL_HBRBACKGROUND:
858 case GCL_HCURSOR:
859 case GCL_HICON:
860 case GCL_HICONSM:
861 case GCL_WNDPROC:
862 case GCL_MENUNAME:
863 FIXME( "offset %d not supported on other process window %p\n", offset, hwnd );
864 SetLastError( ERROR_INVALID_HANDLE );
865 break;
866 case GCL_STYLE:
867 retvalue = reply->old_style;
868 break;
869 case GCL_CBWNDEXTRA:
870 retvalue = reply->old_win_extra;
871 break;
872 case GCL_CBCLSEXTRA:
873 retvalue = reply->old_extra;
874 break;
875 case GCL_HMODULE:
876 retvalue = (LONG)reply->old_instance;
877 break;
878 case GCW_ATOM:
879 retvalue = reply->old_atom;
880 break;
881 default:
882 if (offset >= 0) memcpy( &retvalue, &reply->old_extra_value, sizeof(retvalue) );
883 else SetLastError( ERROR_INVALID_INDEX );
884 break;
888 SERVER_END_REQ;
889 return retvalue;
892 if (offset >= 0)
894 if (offset <= class->cbClsExtra - sizeof(LONG))
895 memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) );
896 else
897 SetLastError( ERROR_INVALID_INDEX );
898 release_class_ptr( class );
899 return retvalue;
902 switch(offset)
904 case GCL_HBRBACKGROUND:
905 retvalue = (LONG)class->hbrBackground;
906 break;
907 case GCL_HCURSOR:
908 retvalue = (LONG)class->hCursor;
909 break;
910 case GCL_HICON:
911 retvalue = (LONG)class->hIcon;
912 break;
913 case GCL_HICONSM:
914 retvalue = (LONG)class->hIconSm;
915 break;
916 case GCL_STYLE:
917 retvalue = (LONG)class->style;
918 break;
919 case GCL_CBWNDEXTRA:
920 retvalue = (LONG)class->cbWndExtra;
921 break;
922 case GCL_CBCLSEXTRA:
923 retvalue = (LONG)class->cbClsExtra;
924 break;
925 case GCL_HMODULE:
926 retvalue = (LONG)class->hInstance;
927 break;
928 case GCL_WNDPROC:
929 retvalue = (LONG)CLASS_GetProc( class, WIN_PROC_32W );
930 break;
931 case GCL_MENUNAME:
932 retvalue = (LONG)CLASS_GetMenuNameW( class );
933 break;
934 case GCW_ATOM:
935 retvalue = (DWORD)class->atomName;
936 break;
937 default:
938 SetLastError( ERROR_INVALID_INDEX );
939 break;
941 release_class_ptr( class );
942 return retvalue;
946 /***********************************************************************
947 * GetClassLongA (USER32.@)
949 LONG WINAPI GetClassLongA( HWND hwnd, INT offset )
951 CLASS *class;
952 LONG retvalue;
954 if (offset != GCL_WNDPROC && offset != GCL_MENUNAME)
955 return GetClassLongW( hwnd, offset );
957 TRACE("%p %d\n", hwnd, offset);
959 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
961 if (class == CLASS_OTHER_PROCESS)
963 FIXME( "offset %d not supported on other process window %p\n", offset, hwnd );
964 SetLastError( ERROR_INVALID_HANDLE );
965 return 0;
968 if (offset == GCL_WNDPROC)
969 retvalue = (LONG)CLASS_GetProc( class, WIN_PROC_32A );
970 else /* GCL_MENUNAME */
971 retvalue = (LONG)CLASS_GetMenuNameA( class );
973 release_class_ptr( class );
974 return retvalue;
978 /***********************************************************************
979 * SetClassWord (USER32.@)
981 WORD WINAPI SetClassWord( HWND hwnd, INT offset, WORD newval )
983 CLASS *class;
984 WORD retval = 0;
986 if (offset < 0) return SetClassLongA( hwnd, offset, (DWORD)newval );
988 TRACE("%p %d %x\n", hwnd, offset, newval);
990 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
992 SERVER_START_REQ( set_class_info )
994 req->window = hwnd;
995 req->flags = SET_CLASS_EXTRA;
996 req->extra_offset = offset;
997 req->extra_size = sizeof(newval);
998 memcpy( &req->extra_value, &newval, sizeof(newval) );
999 if (!wine_server_call_err( req ))
1001 void *ptr = (char *)(class + 1) + offset;
1002 memcpy( &retval, ptr, sizeof(retval) );
1003 memcpy( ptr, &newval, sizeof(newval) );
1006 SERVER_END_REQ;
1007 release_class_ptr( class );
1008 return retval;
1012 /***********************************************************************
1013 * SetClassLong (USER.132)
1015 LONG WINAPI SetClassLong16( HWND16 hwnd16, INT16 offset, LONG newval )
1017 CLASS *class;
1018 LONG retval;
1019 HWND hwnd = (HWND)(ULONG_PTR)hwnd16; /* no need for full handle */
1021 TRACE("%p %d %lx\n", hwnd, offset, newval);
1023 switch(offset)
1025 case GCL_WNDPROC:
1026 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
1027 retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_16 );
1028 release_class_ptr( class );
1029 return retval;
1030 case GCL_MENUNAME:
1031 newval = (LONG)MapSL( newval );
1032 /* fall through */
1033 default:
1034 return SetClassLongA( hwnd, offset, newval );
1039 /***********************************************************************
1040 * SetClassLongW (USER32.@)
1042 LONG WINAPI SetClassLongW( HWND hwnd, INT offset, LONG newval )
1044 CLASS *class;
1045 LONG retval = 0;
1047 TRACE("%p %d %lx\n", hwnd, offset, newval);
1049 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
1051 if (offset >= 0)
1053 if (set_server_info( hwnd, offset, newval ))
1055 void *ptr = (char *)(class + 1) + offset;
1056 memcpy( &retval, ptr, sizeof(retval) );
1057 memcpy( ptr, &newval, sizeof(newval) );
1060 else switch(offset)
1062 case GCL_MENUNAME:
1063 CLASS_SetMenuNameW( class, (LPCWSTR)newval );
1064 retval = 0; /* Old value is now meaningless anyway */
1065 break;
1066 case GCL_WNDPROC:
1067 retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_32W );
1068 break;
1069 case GCL_HBRBACKGROUND:
1070 retval = (LONG)class->hbrBackground;
1071 class->hbrBackground = (HBRUSH)newval;
1072 break;
1073 case GCL_HCURSOR:
1074 retval = (LONG)class->hCursor;
1075 class->hCursor = (HCURSOR)newval;
1076 break;
1077 case GCL_HICON:
1078 retval = (LONG)class->hIcon;
1079 class->hIcon = (HICON)newval;
1080 break;
1081 case GCL_HICONSM:
1082 retval = (LONG)class->hIconSm;
1083 class->hIconSm = (HICON)newval;
1084 break;
1085 case GCL_STYLE:
1086 if (!set_server_info( hwnd, offset, newval )) break;
1087 retval = (LONG)class->style;
1088 class->style = newval;
1089 break;
1090 case GCL_CBWNDEXTRA:
1091 if (!set_server_info( hwnd, offset, newval )) break;
1092 retval = (LONG)class->cbWndExtra;
1093 class->cbWndExtra = newval;
1094 break;
1095 case GCL_HMODULE:
1096 if (!set_server_info( hwnd, offset, newval )) break;
1097 retval = (LONG)class->hInstance;
1098 class->hInstance = (HINSTANCE)newval;
1099 break;
1100 case GCW_ATOM:
1101 if (!set_server_info( hwnd, offset, newval )) break;
1102 retval = (DWORD)class->atomName;
1103 class->atomName = newval;
1104 break;
1105 case GCL_CBCLSEXTRA: /* cannot change this one */
1106 SetLastError( ERROR_INVALID_PARAMETER );
1107 break;
1108 default:
1109 SetLastError( ERROR_INVALID_INDEX );
1110 break;
1112 release_class_ptr( class );
1113 return retval;
1117 /***********************************************************************
1118 * SetClassLongA (USER32.@)
1120 LONG WINAPI SetClassLongA( HWND hwnd, INT offset, LONG newval )
1122 CLASS *class;
1123 LONG retval;
1125 if (offset != GCL_WNDPROC && offset != GCL_MENUNAME)
1126 return SetClassLongW( hwnd, offset, newval );
1128 TRACE("%p %d %lx\n", hwnd, offset, newval);
1130 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
1132 if (offset == GCL_WNDPROC)
1133 retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_32A );
1134 else /* GCL_MENUNAME */
1136 CLASS_SetMenuNameA( class, (LPCSTR)newval );
1137 retval = 0; /* Old value is now meaningless anyway */
1139 release_class_ptr( class );
1140 return retval;
1144 /***********************************************************************
1145 * GetClassNameA (USER32.@)
1147 INT WINAPI GetClassNameA( HWND hwnd, LPSTR buffer, INT count )
1149 INT ret = GlobalGetAtomNameA( GetClassLongA( hwnd, GCW_ATOM ), buffer, count );
1151 TRACE("%p %s %x\n",hwnd, debugstr_a(buffer), count);
1152 return ret;
1156 /***********************************************************************
1157 * GetClassNameW (USER32.@)
1159 INT WINAPI GetClassNameW( HWND hwnd, LPWSTR buffer, INT count )
1161 INT ret = GlobalGetAtomNameW( GetClassLongW( hwnd, GCW_ATOM ), buffer, count );
1163 TRACE("%p %s %x\n",hwnd, debugstr_w(buffer), count);
1164 return ret;
1168 /***********************************************************************
1169 * RealGetWindowClassA (USER32.@)
1171 UINT WINAPI RealGetWindowClassA( HWND hwnd, LPSTR buffer, UINT count )
1173 return GetClassNameA( hwnd, buffer, count );
1177 /***********************************************************************
1178 * RealGetWindowClassW (USER32.@)
1180 UINT WINAPI RealGetWindowClassW( HWND hwnd, LPWSTR buffer, UINT count )
1182 return GetClassNameW( hwnd, buffer, count );
1186 /***********************************************************************
1187 * GetClassInfo (USER.404)
1189 BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASS16 *wc )
1191 WNDCLASSEX16 wcex;
1192 UINT16 ret = GetClassInfoEx16( hInst16, name, &wcex );
1194 if (ret)
1196 wc->style = wcex.style;
1197 wc->lpfnWndProc = wcex.lpfnWndProc;
1198 wc->cbClsExtra = wcex.cbClsExtra;
1199 wc->cbWndExtra = wcex.cbWndExtra;
1200 wc->hInstance = wcex.hInstance;
1201 wc->hIcon = wcex.hIcon;
1202 wc->hCursor = wcex.hCursor;
1203 wc->hbrBackground = wcex.hbrBackground;
1204 wc->lpszMenuName = wcex.lpszMenuName;
1205 wc->lpszClassName = wcex.lpszClassName;
1207 return ret;
1211 /***********************************************************************
1212 * GetClassInfoA (USER32.@)
1214 BOOL WINAPI GetClassInfoA( HINSTANCE hInstance, LPCSTR name, WNDCLASSA *wc )
1216 WNDCLASSEXA wcex;
1217 UINT ret = GetClassInfoExA( hInstance, name, &wcex );
1219 if (ret)
1221 wc->style = wcex.style;
1222 wc->lpfnWndProc = wcex.lpfnWndProc;
1223 wc->cbClsExtra = wcex.cbClsExtra;
1224 wc->cbWndExtra = wcex.cbWndExtra;
1225 wc->hInstance = wcex.hInstance;
1226 wc->hIcon = wcex.hIcon;
1227 wc->hCursor = wcex.hCursor;
1228 wc->hbrBackground = wcex.hbrBackground;
1229 wc->lpszMenuName = wcex.lpszMenuName;
1230 wc->lpszClassName = wcex.lpszClassName;
1232 return ret;
1236 /***********************************************************************
1237 * GetClassInfoW (USER32.@)
1239 BOOL WINAPI GetClassInfoW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSW *wc )
1241 WNDCLASSEXW wcex;
1242 UINT ret = GetClassInfoExW( hInstance, name, &wcex );
1244 if (ret)
1246 wc->style = wcex.style;
1247 wc->lpfnWndProc = wcex.lpfnWndProc;
1248 wc->cbClsExtra = wcex.cbClsExtra;
1249 wc->cbWndExtra = wcex.cbWndExtra;
1250 wc->hInstance = wcex.hInstance;
1251 wc->hIcon = wcex.hIcon;
1252 wc->hCursor = wcex.hCursor;
1253 wc->hbrBackground = wcex.hbrBackground;
1254 wc->lpszMenuName = wcex.lpszMenuName;
1255 wc->lpszClassName = wcex.lpszClassName;
1257 return ret;
1261 /***********************************************************************
1262 * GetClassInfoEx (USER.398)
1264 * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
1265 * same in Win16 as in Win32. --AJ
1267 BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASSEX16 *wc )
1269 ATOM atom = HIWORD(name) ? GlobalFindAtomA( MapSL(name) ) : LOWORD(name);
1270 CLASS *classPtr;
1271 HINSTANCE hInstance;
1273 if (hInst16 == GetModuleHandle16("user")) hInstance = user32_module;
1274 else hInstance = HINSTANCE_32(GetExePtr( hInst16 ));
1276 TRACE("%p %s %x %p\n", hInstance, debugstr_a( MapSL(name) ), atom, wc);
1278 if (!atom || !(classPtr = CLASS_FindClassByAtom( atom, hInstance ))) return FALSE;
1279 wc->style = classPtr->style;
1280 wc->lpfnWndProc = CLASS_GetProc( classPtr, WIN_PROC_16 );
1281 wc->cbClsExtra = (INT16)classPtr->cbClsExtra;
1282 wc->cbWndExtra = (INT16)classPtr->cbWndExtra;
1283 wc->hInstance = (classPtr->hInstance == user32_module) ? GetModuleHandle16("user") : HINSTANCE_16(classPtr->hInstance);
1284 wc->hIcon = HICON_16(classPtr->hIcon);
1285 wc->hIconSm = HICON_16(classPtr->hIconSm);
1286 wc->hCursor = HCURSOR_16(classPtr->hCursor);
1287 wc->hbrBackground = HBRUSH_16(classPtr->hbrBackground);
1288 wc->lpszClassName = (SEGPTR)0;
1289 wc->lpszMenuName = CLASS_GetMenuName16( classPtr );
1290 wc->lpszClassName = name;
1291 release_class_ptr( classPtr );
1293 /* We must return the atom of the class here instead of just TRUE. */
1294 return atom;
1298 /***********************************************************************
1299 * GetClassInfoExA (USER32.@)
1301 BOOL WINAPI GetClassInfoExA( HINSTANCE hInstance, LPCSTR name, WNDCLASSEXA *wc )
1303 ATOM atom = HIWORD(name) ? GlobalFindAtomA( name ) : LOWORD(name);
1304 CLASS *classPtr;
1306 TRACE("%p %s %x %p\n", hInstance, debugstr_a(name), atom, wc);
1308 if (!hInstance) hInstance = user32_module;
1310 if (!atom || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )))
1312 SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
1313 return FALSE;
1315 wc->style = classPtr->style;
1316 wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32A );
1317 wc->cbClsExtra = classPtr->cbClsExtra;
1318 wc->cbWndExtra = classPtr->cbWndExtra;
1319 wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
1320 wc->hIcon = (HICON)classPtr->hIcon;
1321 wc->hIconSm = (HICON)classPtr->hIconSm;
1322 wc->hCursor = (HCURSOR)classPtr->hCursor;
1323 wc->hbrBackground = (HBRUSH)classPtr->hbrBackground;
1324 wc->lpszMenuName = CLASS_GetMenuNameA( classPtr );
1325 wc->lpszClassName = name;
1326 release_class_ptr( classPtr );
1328 /* We must return the atom of the class here instead of just TRUE. */
1329 return atom;
1333 /***********************************************************************
1334 * GetClassInfoExW (USER32.@)
1336 BOOL WINAPI GetClassInfoExW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSEXW *wc )
1338 ATOM atom = HIWORD(name) ? GlobalFindAtomW( name ) : LOWORD(name);
1339 CLASS *classPtr;
1341 TRACE("%p %s %x %p\n", hInstance, debugstr_w(name), atom, wc);
1343 if (!hInstance) hInstance = user32_module;
1345 if (!atom || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )))
1347 SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
1348 return FALSE;
1350 wc->style = classPtr->style;
1351 wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32W );
1352 wc->cbClsExtra = classPtr->cbClsExtra;
1353 wc->cbWndExtra = classPtr->cbWndExtra;
1354 wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
1355 wc->hIcon = (HICON)classPtr->hIcon;
1356 wc->hIconSm = (HICON)classPtr->hIconSm;
1357 wc->hCursor = (HCURSOR)classPtr->hCursor;
1358 wc->hbrBackground = (HBRUSH)classPtr->hbrBackground;
1359 wc->lpszMenuName = CLASS_GetMenuNameW( classPtr );
1360 wc->lpszClassName = name;
1361 release_class_ptr( classPtr );
1363 /* We must return the atom of the class here instead of just TRUE. */
1364 return atom;
1368 #if 0 /* toolhelp is in kernel, so this cannot work */
1370 /***********************************************************************
1371 * ClassFirst (TOOLHELP.69)
1373 BOOL16 WINAPI ClassFirst16( CLASSENTRY *pClassEntry )
1375 TRACE("%p\n",pClassEntry);
1376 pClassEntry->wNext = 1;
1377 return ClassNext16( pClassEntry );
1381 /***********************************************************************
1382 * ClassNext (TOOLHELP.70)
1384 BOOL16 WINAPI ClassNext16( CLASSENTRY *pClassEntry )
1386 int i;
1387 CLASS *class = firstClass;
1389 TRACE("%p\n",pClassEntry);
1391 if (!pClassEntry->wNext) return FALSE;
1392 for (i = 1; (i < pClassEntry->wNext) && class; i++) class = class->next;
1393 if (!class)
1395 pClassEntry->wNext = 0;
1396 return FALSE;
1398 pClassEntry->hInst = class->hInstance;
1399 pClassEntry->wNext++;
1400 GlobalGetAtomNameA( class->atomName, pClassEntry->szClassName,
1401 sizeof(pClassEntry->szClassName) );
1402 return TRUE;
1404 #endif