Fixed some message sequences to succeed on XP.
[wine.git] / windows / class.c
blob0c7cdc953b8b30fcb6409910305ed2c7263f426e
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;
72 #define CLASS_OTHER_PROCESS ((CLASS *)1)
74 /***********************************************************************
75 * get_class_ptr
77 static CLASS *get_class_ptr( HWND hwnd, BOOL write_access )
79 WND *ptr = WIN_GetPtr( hwnd );
81 if (ptr)
83 if (ptr != WND_OTHER_PROCESS) return ptr->class;
84 if (write_access && IsWindow( hwnd )) /* check other processes */
86 /* modifying classes in other processes is not allowed */
87 SetLastError( ERROR_ACCESS_DENIED );
88 return NULL;
90 return CLASS_OTHER_PROCESS;
92 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
93 return NULL;
97 /***********************************************************************
98 * release_class_ptr
100 inline static void release_class_ptr( CLASS *ptr )
102 USER_Unlock();
106 /***********************************************************************
107 * set_server_info
109 * Set class info with the wine server.
111 static BOOL set_server_info( HWND hwnd, INT offset, LONG newval )
113 BOOL ret;
115 SERVER_START_REQ( set_class_info )
117 req->window = hwnd;
118 req->extra_offset = -1;
119 switch(offset)
121 case GCW_ATOM:
122 req->flags = SET_CLASS_ATOM;
123 req->atom = newval;
124 case GCL_STYLE:
125 req->flags = SET_CLASS_STYLE;
126 req->style = newval;
127 break;
128 case GCL_CBWNDEXTRA:
129 req->flags = SET_CLASS_WINEXTRA;
130 req->win_extra = newval;
131 break;
132 case GCL_HMODULE:
133 req->flags = SET_CLASS_INSTANCE;
134 req->instance = (void *)newval;
135 break;
136 default:
137 assert( offset >= 0 );
138 req->flags = SET_CLASS_EXTRA;
139 req->extra_offset = offset;
140 req->extra_size = sizeof(newval);
141 memcpy( &req->extra_value, &newval, sizeof(newval) );
142 break;
144 ret = !wine_server_call_err( req );
146 SERVER_END_REQ;
147 return ret;
151 /***********************************************************************
152 * CLASS_GetProc
154 * Get the class winproc for a given proc type
156 static WNDPROC16 CLASS_GetProc( CLASS *classPtr, WINDOWPROCTYPE type )
158 WNDPROC proc = classPtr->winprocA;
160 if (classPtr->winprocW)
162 /* if we have a Unicode proc, use it if we have no ASCII proc
163 * or if we have both and Unicode was requested
165 if (!proc || type == WIN_PROC_32W) proc = classPtr->winprocW;
167 return WINPROC_GetProc( proc, type );
171 /***********************************************************************
172 * CLASS_SetProc
174 * Set the class winproc for a given proc type.
175 * Returns the previous window proc.
177 static WNDPROC16 CLASS_SetProc( CLASS *classPtr, WNDPROC newproc, WINDOWPROCTYPE type )
179 WNDPROC *proc = &classPtr->winprocA;
180 WNDPROC16 ret;
182 if (classPtr->winprocW)
184 /* if we have a Unicode proc, use it if we have no ASCII proc
185 * or if we have both and Unicode was requested
187 if (!*proc || type == WIN_PROC_32W) proc = &classPtr->winprocW;
189 ret = WINPROC_GetProc( *proc, type );
190 WINPROC_SetProc( proc, newproc, type, WIN_PROC_CLASS );
191 /* now free the one that we didn't set */
192 if (classPtr->winprocA && classPtr->winprocW)
194 if (proc == &classPtr->winprocA)
196 WINPROC_FreeProc( classPtr->winprocW, WIN_PROC_CLASS );
197 classPtr->winprocW = 0;
199 else
201 WINPROC_FreeProc( classPtr->winprocA, WIN_PROC_CLASS );
202 classPtr->winprocA = 0;
205 return ret;
209 /***********************************************************************
210 * CLASS_GetMenuNameA
212 * Get the menu name as a ASCII string.
214 inline static LPSTR CLASS_GetMenuNameA( CLASS *classPtr )
216 if (!HIWORD(classPtr->menuName)) return (LPSTR)classPtr->menuName;
217 return (LPSTR)(classPtr->menuName + strlenW(classPtr->menuName) + 1);
221 /***********************************************************************
222 * CLASS_GetMenuName16
224 * Get the menu name as a SEGPTR.
226 inline static SEGPTR CLASS_GetMenuName16( CLASS *classPtr )
228 if (!HIWORD(classPtr->menuName)) return (SEGPTR)classPtr->menuName;
229 if (!classPtr->segMenuName)
230 classPtr->segMenuName = MapLS( CLASS_GetMenuNameA(classPtr) );
231 return classPtr->segMenuName;
235 /***********************************************************************
236 * CLASS_GetMenuNameW
238 * Get the menu name as a Unicode string.
240 inline static LPWSTR CLASS_GetMenuNameW( CLASS *classPtr )
242 return classPtr->menuName;
246 /***********************************************************************
247 * CLASS_SetMenuNameA
249 * Set the menu name in a class structure by copying the string.
251 static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name )
253 UnMapLS( classPtr->segMenuName );
254 classPtr->segMenuName = 0;
255 if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
256 if (HIWORD(name))
258 DWORD lenA = strlen(name) + 1;
259 DWORD lenW = MultiByteToWideChar( CP_ACP, 0, name, lenA, NULL, 0 );
260 classPtr->menuName = HeapAlloc( GetProcessHeap(), 0, lenA + lenW*sizeof(WCHAR) );
261 MultiByteToWideChar( CP_ACP, 0, name, lenA, classPtr->menuName, lenW );
262 memcpy( classPtr->menuName + lenW, name, lenA );
264 else classPtr->menuName = (LPWSTR)name;
268 /***********************************************************************
269 * CLASS_SetMenuNameW
271 * Set the menu name in a class structure by copying the string.
273 static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name )
275 UnMapLS( classPtr->segMenuName );
276 classPtr->segMenuName = 0;
277 if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
278 if (HIWORD(name))
280 DWORD lenW = strlenW(name) + 1;
281 DWORD lenA = WideCharToMultiByte( CP_ACP, 0, name, lenW, NULL, 0, NULL, NULL );
282 classPtr->menuName = HeapAlloc( GetProcessHeap(), 0, lenA + lenW*sizeof(WCHAR) );
283 memcpy( classPtr->menuName, name, lenW*sizeof(WCHAR) );
284 WideCharToMultiByte( CP_ACP, 0, name, lenW,
285 (char *)(classPtr->menuName + lenW), lenA, NULL, NULL );
287 else classPtr->menuName = (LPWSTR)name;
291 /***********************************************************************
292 * CLASS_FreeClass
294 * Free a class structure.
296 static void CLASS_FreeClass( CLASS *classPtr )
298 TRACE("%p\n", classPtr);
300 USER_Lock();
302 list_remove( &classPtr->entry );
303 if (classPtr->dce) DCE_FreeDCE( classPtr->dce );
304 if (classPtr->hbrBackground > (HBRUSH)(COLOR_GRADIENTINACTIVECAPTION + 1))
305 DeleteObject( classPtr->hbrBackground );
306 WINPROC_FreeProc( classPtr->winprocA, WIN_PROC_CLASS );
307 WINPROC_FreeProc( classPtr->winprocW, WIN_PROC_CLASS );
308 UnMapLS( classPtr->segMenuName );
309 HeapFree( GetProcessHeap(), 0, classPtr->menuName );
310 HeapFree( GetProcessHeap(), 0, classPtr );
311 USER_Unlock();
315 /***********************************************************************
316 * CLASS_FreeModuleClasses
318 void CLASS_FreeModuleClasses( HMODULE16 hModule )
320 struct list *ptr, *next;
322 TRACE("0x%08x\n", hModule);
324 USER_Lock();
325 for (ptr = list_head( &class_list ); ptr; ptr = next)
327 CLASS *class = LIST_ENTRY( ptr, CLASS, entry );
328 next = list_next( &class_list, ptr );
329 if (class->hInstance == HINSTANCE_32(hModule))
331 BOOL ret;
333 SERVER_START_REQ( destroy_class )
335 req->atom = class->atomName;
336 req->instance = class->hInstance;
337 ret = !wine_server_call_err( req );
339 SERVER_END_REQ;
340 if (ret) CLASS_FreeClass( class );
343 USER_Unlock();
347 /***********************************************************************
348 * CLASS_FindClassByAtom
350 * Return a pointer to the class.
351 * hinstance has been normalized by the caller.
353 static CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE hinstance )
355 struct list *ptr;
357 USER_Lock();
359 LIST_FOR_EACH( ptr, &class_list )
361 CLASS *class = LIST_ENTRY( ptr, CLASS, entry );
362 if (class->atomName != atom) continue;
363 if (!hinstance || !class->local || class->hInstance == hinstance)
365 TRACE("0x%04x %p -> %p\n", atom, hinstance, class);
366 return class;
369 USER_Unlock();
370 TRACE("0x%04x %p -> not found\n", atom, hinstance);
371 return NULL;
375 /***********************************************************************
376 * CLASS_RegisterClass
378 * The real RegisterClass() functionality.
379 * The atom is deleted no matter what.
381 static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE hInstance, BOOL local,
382 DWORD style, INT classExtra, INT winExtra )
384 CLASS *classPtr;
385 BOOL ret;
387 TRACE("atom=0x%x hinst=%p style=0x%lx clExtr=0x%x winExtr=0x%x\n",
388 atom, hInstance, style, classExtra, winExtra );
390 /* Fix the extra bytes value */
392 if (classExtra < 0) classExtra = 0;
393 else if (classExtra > 40) /* Extra bytes are limited to 40 in Win32 */
394 WARN("Class extra bytes %d is > 40\n", classExtra);
395 if (winExtra < 0) winExtra = 0;
396 else if (winExtra > 40) /* Extra bytes are limited to 40 in Win32 */
397 WARN("Win extra bytes %d is > 40\n", winExtra );
399 classPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLASS) + classExtra );
400 if (!classPtr)
402 GlobalDeleteAtom( atom );
403 return NULL;
406 SERVER_START_REQ( create_class )
408 req->local = local;
409 req->atom = atom;
410 req->style = style;
411 req->instance = hInstance;
412 req->extra = classExtra;
413 req->win_extra = winExtra;
414 req->client_ptr = classPtr;
415 ret = !wine_server_call_err( req );
417 SERVER_END_REQ;
418 GlobalDeleteAtom( atom ); /* the server increased the atom ref count */
419 if (!ret)
421 HeapFree( GetProcessHeap(), 0, classPtr );
422 return NULL;
425 classPtr->style = style;
426 classPtr->local = local;
427 classPtr->cbWndExtra = winExtra;
428 classPtr->cbClsExtra = classExtra;
429 classPtr->hInstance = hInstance;
430 classPtr->atomName = atom;
431 classPtr->dce = (style & CS_CLASSDC) ? DCE_AllocDCE( 0, DCE_CLASS_DC ) : NULL;
433 /* Other non-null values must be set by caller */
435 USER_Lock();
436 if (local) list_add_head( &class_list, &classPtr->entry );
437 else list_add_tail( &class_list, &classPtr->entry );
438 return classPtr;
442 /***********************************************************************
443 * register_builtin
445 * Register a builtin control class.
446 * This allows having both ASCII and Unicode winprocs for the same class.
448 static CLASS *register_builtin( const struct builtin_class_descr *descr )
450 ATOM atom;
451 CLASS *classPtr;
453 if (!(atom = GlobalAddAtomA( descr->name ))) return 0;
455 if (!(classPtr = CLASS_RegisterClass( atom, user32_module, FALSE,
456 descr->style, 0, descr->extra ))) return 0;
458 classPtr->hCursor = LoadCursorA( 0, (LPSTR)descr->cursor );
459 classPtr->hbrBackground = descr->brush;
461 if (descr->procA) WINPROC_SetProc( &classPtr->winprocA, descr->procA,
462 WIN_PROC_32A, WIN_PROC_CLASS );
463 if (descr->procW) WINPROC_SetProc( &classPtr->winprocW, descr->procW,
464 WIN_PROC_32W, WIN_PROC_CLASS );
465 release_class_ptr( classPtr );
466 return classPtr;
470 /***********************************************************************
471 * CLASS_RegisterBuiltinClasses
473 void CLASS_RegisterBuiltinClasses(void)
475 extern const struct builtin_class_descr BUTTON_builtin_class;
476 extern const struct builtin_class_descr COMBO_builtin_class;
477 extern const struct builtin_class_descr COMBOLBOX_builtin_class;
478 extern const struct builtin_class_descr DIALOG_builtin_class;
479 extern const struct builtin_class_descr DESKTOP_builtin_class;
480 extern const struct builtin_class_descr EDIT_builtin_class;
481 extern const struct builtin_class_descr ICONTITLE_builtin_class;
482 extern const struct builtin_class_descr LISTBOX_builtin_class;
483 extern const struct builtin_class_descr MDICLIENT_builtin_class;
484 extern const struct builtin_class_descr MENU_builtin_class;
485 extern const struct builtin_class_descr SCROLL_builtin_class;
486 extern const struct builtin_class_descr STATIC_builtin_class;
488 desktop_class = register_builtin( &DESKTOP_builtin_class );
489 register_builtin( &BUTTON_builtin_class );
490 register_builtin( &COMBO_builtin_class );
491 register_builtin( &COMBOLBOX_builtin_class );
492 register_builtin( &DIALOG_builtin_class );
493 register_builtin( &EDIT_builtin_class );
494 register_builtin( &ICONTITLE_builtin_class );
495 register_builtin( &LISTBOX_builtin_class );
496 register_builtin( &MDICLIENT_builtin_class );
497 register_builtin( &MENU_builtin_class );
498 register_builtin( &SCROLL_builtin_class );
499 register_builtin( &STATIC_builtin_class );
503 /***********************************************************************
504 * CLASS_AddWindow
506 * Add a new window using this class, and set the necessary
507 * information inside the window structure.
509 void CLASS_AddWindow( CLASS *class, WND *win, WINDOWPROCTYPE type )
511 if (!class) class = desktop_class;
513 if (type == WIN_PROC_32W)
515 if (!(win->winproc = class->winprocW)) win->winproc = class->winprocA;
517 else
519 if (!(win->winproc = class->winprocA)) win->winproc = class->winprocW;
521 win->class = class;
522 win->clsStyle = class->style;
523 win->dce = class->dce;
527 /***********************************************************************
528 * RegisterClass (USER.57)
530 ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
532 WNDCLASSEX16 wcex;
534 wcex.cbSize = sizeof(wcex);
535 wcex.style = wc->style;
536 wcex.lpfnWndProc = wc->lpfnWndProc;
537 wcex.cbClsExtra = wc->cbClsExtra;
538 wcex.cbWndExtra = wc->cbWndExtra;
539 wcex.hInstance = wc->hInstance;
540 wcex.hIcon = wc->hIcon;
541 wcex.hCursor = wc->hCursor;
542 wcex.hbrBackground = wc->hbrBackground;
543 wcex.lpszMenuName = wc->lpszMenuName;
544 wcex.lpszClassName = wc->lpszClassName;
545 wcex.hIconSm = 0;
546 return RegisterClassEx16( &wcex );
550 /***********************************************************************
551 * RegisterClassA (USER32.@)
552 * RETURNS
553 * >0: Unique identifier
554 * 0: Failure
556 ATOM WINAPI RegisterClassA( const WNDCLASSA* wc ) /* [in] Address of structure with class data */
558 WNDCLASSEXA wcex;
560 wcex.cbSize = sizeof(wcex);
561 wcex.style = wc->style;
562 wcex.lpfnWndProc = wc->lpfnWndProc;
563 wcex.cbClsExtra = wc->cbClsExtra;
564 wcex.cbWndExtra = wc->cbWndExtra;
565 wcex.hInstance = wc->hInstance;
566 wcex.hIcon = wc->hIcon;
567 wcex.hCursor = wc->hCursor;
568 wcex.hbrBackground = wc->hbrBackground;
569 wcex.lpszMenuName = wc->lpszMenuName;
570 wcex.lpszClassName = wc->lpszClassName;
571 wcex.hIconSm = 0;
572 return RegisterClassExA( &wcex );
576 /***********************************************************************
577 * RegisterClassW (USER32.@)
579 ATOM WINAPI RegisterClassW( const WNDCLASSW* wc )
581 WNDCLASSEXW wcex;
583 wcex.cbSize = sizeof(wcex);
584 wcex.style = wc->style;
585 wcex.lpfnWndProc = wc->lpfnWndProc;
586 wcex.cbClsExtra = wc->cbClsExtra;
587 wcex.cbWndExtra = wc->cbWndExtra;
588 wcex.hInstance = wc->hInstance;
589 wcex.hIcon = wc->hIcon;
590 wcex.hCursor = wc->hCursor;
591 wcex.hbrBackground = wc->hbrBackground;
592 wcex.lpszMenuName = wc->lpszMenuName;
593 wcex.lpszClassName = wc->lpszClassName;
594 wcex.hIconSm = 0;
595 return RegisterClassExW( &wcex );
599 /***********************************************************************
600 * RegisterClassEx (USER.397)
602 ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc )
604 ATOM atom;
605 CLASS *classPtr;
606 HINSTANCE hInstance;
608 if (!(hInstance = HINSTANCE_32(GetExePtr(wc->hInstance))))
609 hInstance = HINSTANCE_32(GetModuleHandle16(NULL));
611 if (!(atom = GlobalAddAtomA( MapSL(wc->lpszClassName) ))) return 0;
612 if (!(classPtr = CLASS_RegisterClass( atom, hInstance, !(wc->style & CS_GLOBALCLASS),
613 wc->style, wc->cbClsExtra, wc->cbWndExtra )))
614 return 0;
616 TRACE("atom=%04x wndproc=%p hinst=%p bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
617 atom, wc->lpfnWndProc, hInstance,
618 wc->hbrBackground, wc->style, wc->cbClsExtra,
619 wc->cbWndExtra, classPtr );
621 classPtr->hIcon = HICON_32(wc->hIcon);
622 classPtr->hIconSm = HICON_32(wc->hIconSm);
623 classPtr->hCursor = HCURSOR_32(wc->hCursor);
624 classPtr->hbrBackground = HBRUSH_32(wc->hbrBackground);
626 WINPROC_SetProc( &classPtr->winprocA, (WNDPROC)wc->lpfnWndProc,
627 WIN_PROC_16, WIN_PROC_CLASS );
628 CLASS_SetMenuNameA( classPtr, MapSL(wc->lpszMenuName) );
629 release_class_ptr( classPtr );
630 return atom;
634 /***********************************************************************
635 * RegisterClassExA (USER32.@)
637 ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc )
639 ATOM atom;
640 CLASS *classPtr;
641 HINSTANCE instance;
643 if (wc->hInstance == user32_module)
645 /* we can't register a class for user32 */
646 SetLastError( ERROR_INVALID_PARAMETER );
647 return 0;
649 if (!(instance = wc->hInstance)) instance = GetModuleHandleW( NULL );
651 if (!(atom = GlobalAddAtomA( wc->lpszClassName ))) return 0;
653 if (!(classPtr = CLASS_RegisterClass( atom, instance, !(wc->style & CS_GLOBALCLASS),
654 wc->style, wc->cbClsExtra, wc->cbWndExtra )))
655 return 0;
657 TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n",
658 atom, wc->lpfnWndProc, instance, wc->hbrBackground,
659 wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr );
661 classPtr->hIcon = wc->hIcon;
662 classPtr->hIconSm = wc->hIconSm;
663 classPtr->hCursor = wc->hCursor;
664 classPtr->hbrBackground = wc->hbrBackground;
665 WINPROC_SetProc( &classPtr->winprocA, wc->lpfnWndProc, WIN_PROC_32A, WIN_PROC_CLASS );
666 CLASS_SetMenuNameA( classPtr, wc->lpszMenuName );
667 release_class_ptr( classPtr );
668 return atom;
672 /***********************************************************************
673 * RegisterClassExW (USER32.@)
675 ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc )
677 ATOM atom;
678 CLASS *classPtr;
679 HINSTANCE instance;
681 if (wc->hInstance == user32_module)
683 /* we can't register a class for user32 */
684 SetLastError( ERROR_INVALID_PARAMETER );
685 return 0;
687 if (!(instance = wc->hInstance)) instance = GetModuleHandleW( NULL );
689 if (!(atom = GlobalAddAtomW( wc->lpszClassName ))) return 0;
691 if (!(classPtr = CLASS_RegisterClass( atom, instance, !(wc->style & CS_GLOBALCLASS),
692 wc->style, wc->cbClsExtra, wc->cbWndExtra )))
693 return 0;
695 TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n",
696 atom, wc->lpfnWndProc, instance, wc->hbrBackground,
697 wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr );
699 classPtr->hIcon = wc->hIcon;
700 classPtr->hIconSm = wc->hIconSm;
701 classPtr->hCursor = wc->hCursor;
702 classPtr->hbrBackground = wc->hbrBackground;
703 WINPROC_SetProc( &classPtr->winprocW, wc->lpfnWndProc, WIN_PROC_32W, WIN_PROC_CLASS );
704 CLASS_SetMenuNameW( classPtr, wc->lpszMenuName );
705 release_class_ptr( classPtr );
706 return atom;
710 /***********************************************************************
711 * UnregisterClass (USER.403)
713 BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance )
715 if (hInstance == GetModuleHandle16("user")) hInstance = 0;
716 return UnregisterClassA( className, HINSTANCE_32(GetExePtr( hInstance )) );
719 /***********************************************************************
720 * UnregisterClassA (USER32.@)
722 BOOL WINAPI UnregisterClassA( LPCSTR className, HINSTANCE hInstance )
724 ATOM atom = HIWORD(className) ? GlobalFindAtomA( className ) : LOWORD(className);
725 return UnregisterClassW( MAKEINTATOMW(atom), hInstance );
728 /***********************************************************************
729 * UnregisterClassW (USER32.@)
731 BOOL WINAPI UnregisterClassW( LPCWSTR className, HINSTANCE hInstance )
733 CLASS *classPtr = NULL;
734 ATOM atom = HIWORD(className) ? GlobalFindAtomW( className ) : LOWORD(className);
736 TRACE("%s %p %x\n",debugstr_w(className), hInstance, atom);
738 if (!atom)
740 SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
741 return FALSE;
744 SERVER_START_REQ( destroy_class )
746 req->atom = atom;
747 req->instance = hInstance;
748 if (!wine_server_call_err( req )) classPtr = reply->client_ptr;
750 SERVER_END_REQ;
752 if (classPtr) CLASS_FreeClass( classPtr );
753 return (classPtr != NULL);
757 /***********************************************************************
758 * GetClassWord (USER32.@)
760 WORD WINAPI GetClassWord( HWND hwnd, INT offset )
762 CLASS *class;
763 WORD retvalue = 0;
765 if (offset < 0) return GetClassLongA( hwnd, offset );
767 TRACE("%p %x\n",hwnd, offset);
769 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
771 if (class == CLASS_OTHER_PROCESS)
773 SERVER_START_REQ( set_class_info )
775 req->window = hwnd;
776 req->flags = 0;
777 req->extra_offset = offset;
778 req->extra_size = sizeof(retvalue);
779 if (!wine_server_call_err( req ))
780 memcpy( &retvalue, &reply->old_extra_value, sizeof(retvalue) );
782 SERVER_END_REQ;
783 return retvalue;
786 if (offset <= class->cbClsExtra - sizeof(WORD))
787 memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) );
788 else
789 SetLastError( ERROR_INVALID_INDEX );
790 release_class_ptr( class );
791 return retvalue;
795 /***********************************************************************
796 * GetClassLong (USER.131)
798 LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset )
800 CLASS *class;
801 LONG ret;
802 HWND hwnd = (HWND)(ULONG_PTR)hwnd16; /* no need for full handle */
804 TRACE("%p %d\n",hwnd, offset);
806 switch( offset )
808 case GCL_WNDPROC:
809 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
810 if (class == CLASS_OTHER_PROCESS) break;
811 ret = (LONG)CLASS_GetProc( class, WIN_PROC_16 );
812 release_class_ptr( class );
813 return ret;
814 case GCL_MENUNAME:
815 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
816 if (class == CLASS_OTHER_PROCESS) break;
817 ret = (LONG)CLASS_GetMenuName16( class );
818 release_class_ptr( class );
819 return ret;
820 default:
821 return GetClassLongA( hwnd, offset );
823 FIXME( "offset %d not supported on other process window %p\n", offset, hwnd );
824 SetLastError( ERROR_INVALID_HANDLE );
825 return 0;
829 /***********************************************************************
830 * GetClassLongW (USER32.@)
832 LONG WINAPI GetClassLongW( HWND hwnd, INT offset )
834 CLASS *class;
835 LONG retvalue = 0;
837 TRACE("%p %d\n", hwnd, offset);
839 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
841 if (class == CLASS_OTHER_PROCESS)
843 SERVER_START_REQ( set_class_info )
845 req->window = hwnd;
846 req->flags = 0;
847 req->extra_offset = (offset >= 0) ? offset : -1;
848 req->extra_size = (offset >= 0) ? sizeof(retvalue) : 0;
849 if (!wine_server_call_err( req ))
851 switch(offset)
853 case GCL_HBRBACKGROUND:
854 case GCL_HCURSOR:
855 case GCL_HICON:
856 case GCL_HICONSM:
857 case GCL_WNDPROC:
858 case GCL_MENUNAME:
859 FIXME( "offset %d not supported on other process window %p\n", offset, hwnd );
860 SetLastError( ERROR_INVALID_HANDLE );
861 break;
862 case GCL_STYLE:
863 retvalue = reply->old_style;
864 break;
865 case GCL_CBWNDEXTRA:
866 retvalue = reply->old_win_extra;
867 break;
868 case GCL_CBCLSEXTRA:
869 retvalue = reply->old_extra;
870 break;
871 case GCL_HMODULE:
872 retvalue = (LONG)reply->old_instance;
873 break;
874 case GCW_ATOM:
875 retvalue = reply->old_atom;
876 break;
877 default:
878 if (offset >= 0) memcpy( &retvalue, &reply->old_extra_value, sizeof(retvalue) );
879 else SetLastError( ERROR_INVALID_INDEX );
880 break;
884 SERVER_END_REQ;
885 return retvalue;
888 if (offset >= 0)
890 if (offset <= class->cbClsExtra - sizeof(LONG))
891 memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) );
892 else
893 SetLastError( ERROR_INVALID_INDEX );
894 release_class_ptr( class );
895 return retvalue;
898 switch(offset)
900 case GCL_HBRBACKGROUND:
901 retvalue = (LONG)class->hbrBackground;
902 break;
903 case GCL_HCURSOR:
904 retvalue = (LONG)class->hCursor;
905 break;
906 case GCL_HICON:
907 retvalue = (LONG)class->hIcon;
908 break;
909 case GCL_HICONSM:
910 retvalue = (LONG)class->hIconSm;
911 break;
912 case GCL_STYLE:
913 retvalue = (LONG)class->style;
914 break;
915 case GCL_CBWNDEXTRA:
916 retvalue = (LONG)class->cbWndExtra;
917 break;
918 case GCL_CBCLSEXTRA:
919 retvalue = (LONG)class->cbClsExtra;
920 break;
921 case GCL_HMODULE:
922 retvalue = (LONG)class->hInstance;
923 break;
924 case GCL_WNDPROC:
925 retvalue = (LONG)CLASS_GetProc( class, WIN_PROC_32W );
926 break;
927 case GCL_MENUNAME:
928 retvalue = (LONG)CLASS_GetMenuNameW( class );
929 break;
930 case GCW_ATOM:
931 retvalue = (DWORD)class->atomName;
932 break;
933 default:
934 SetLastError( ERROR_INVALID_INDEX );
935 break;
937 release_class_ptr( class );
938 return retvalue;
942 /***********************************************************************
943 * GetClassLongA (USER32.@)
945 LONG WINAPI GetClassLongA( HWND hwnd, INT offset )
947 CLASS *class;
948 LONG retvalue;
950 if (offset != GCL_WNDPROC && offset != GCL_MENUNAME)
951 return GetClassLongW( hwnd, offset );
953 TRACE("%p %d\n", hwnd, offset);
955 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
957 if (class == CLASS_OTHER_PROCESS)
959 FIXME( "offset %d not supported on other process window %p\n", offset, hwnd );
960 SetLastError( ERROR_INVALID_HANDLE );
961 return 0;
964 if (offset == GCL_WNDPROC)
965 retvalue = (LONG)CLASS_GetProc( class, WIN_PROC_32A );
966 else /* GCL_MENUNAME */
967 retvalue = (LONG)CLASS_GetMenuNameA( class );
969 release_class_ptr( class );
970 return retvalue;
974 /***********************************************************************
975 * SetClassWord (USER32.@)
977 WORD WINAPI SetClassWord( HWND hwnd, INT offset, WORD newval )
979 CLASS *class;
980 WORD retval = 0;
982 if (offset < 0) return SetClassLongA( hwnd, offset, (DWORD)newval );
984 TRACE("%p %d %x\n", hwnd, offset, newval);
986 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
988 SERVER_START_REQ( set_class_info )
990 req->window = hwnd;
991 req->flags = SET_CLASS_EXTRA;
992 req->extra_offset = offset;
993 req->extra_size = sizeof(newval);
994 memcpy( &req->extra_value, &newval, sizeof(newval) );
995 if (!wine_server_call_err( req ))
997 void *ptr = (char *)(class + 1) + offset;
998 memcpy( &retval, ptr, sizeof(retval) );
999 memcpy( ptr, &newval, sizeof(newval) );
1002 SERVER_END_REQ;
1003 release_class_ptr( class );
1004 return retval;
1008 /***********************************************************************
1009 * SetClassLong (USER.132)
1011 LONG WINAPI SetClassLong16( HWND16 hwnd16, INT16 offset, LONG newval )
1013 CLASS *class;
1014 LONG retval;
1015 HWND hwnd = (HWND)(ULONG_PTR)hwnd16; /* no need for full handle */
1017 TRACE("%p %d %lx\n", hwnd, offset, newval);
1019 switch(offset)
1021 case GCL_WNDPROC:
1022 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
1023 retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_16 );
1024 release_class_ptr( class );
1025 return retval;
1026 case GCL_MENUNAME:
1027 newval = (LONG)MapSL( newval );
1028 /* fall through */
1029 default:
1030 return SetClassLongA( hwnd, offset, newval );
1035 /***********************************************************************
1036 * SetClassLongW (USER32.@)
1038 LONG WINAPI SetClassLongW( HWND hwnd, INT offset, LONG newval )
1040 CLASS *class;
1041 LONG retval = 0;
1043 TRACE("%p %d %lx\n", hwnd, offset, newval);
1045 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
1047 if (offset >= 0)
1049 if (set_server_info( hwnd, offset, newval ))
1051 void *ptr = (char *)(class + 1) + offset;
1052 memcpy( &retval, ptr, sizeof(retval) );
1053 memcpy( ptr, &newval, sizeof(newval) );
1056 else switch(offset)
1058 case GCL_MENUNAME:
1059 CLASS_SetMenuNameW( class, (LPCWSTR)newval );
1060 retval = 0; /* Old value is now meaningless anyway */
1061 break;
1062 case GCL_WNDPROC:
1063 retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_32W );
1064 break;
1065 case GCL_HBRBACKGROUND:
1066 retval = (LONG)class->hbrBackground;
1067 class->hbrBackground = (HBRUSH)newval;
1068 break;
1069 case GCL_HCURSOR:
1070 retval = (LONG)class->hCursor;
1071 class->hCursor = (HCURSOR)newval;
1072 break;
1073 case GCL_HICON:
1074 retval = (LONG)class->hIcon;
1075 class->hIcon = (HICON)newval;
1076 break;
1077 case GCL_HICONSM:
1078 retval = (LONG)class->hIconSm;
1079 class->hIconSm = (HICON)newval;
1080 break;
1081 case GCL_STYLE:
1082 if (!set_server_info( hwnd, offset, newval )) break;
1083 retval = (LONG)class->style;
1084 class->style = newval;
1085 break;
1086 case GCL_CBWNDEXTRA:
1087 if (!set_server_info( hwnd, offset, newval )) break;
1088 retval = (LONG)class->cbWndExtra;
1089 class->cbWndExtra = newval;
1090 break;
1091 case GCL_HMODULE:
1092 if (!set_server_info( hwnd, offset, newval )) break;
1093 retval = (LONG)class->hInstance;
1094 class->hInstance = (HINSTANCE)newval;
1095 break;
1096 case GCW_ATOM:
1097 if (!set_server_info( hwnd, offset, newval )) break;
1098 retval = (DWORD)class->atomName;
1099 class->atomName = newval;
1100 break;
1101 case GCL_CBCLSEXTRA: /* cannot change this one */
1102 SetLastError( ERROR_INVALID_PARAMETER );
1103 break;
1104 default:
1105 SetLastError( ERROR_INVALID_INDEX );
1106 break;
1108 release_class_ptr( class );
1109 return retval;
1113 /***********************************************************************
1114 * SetClassLongA (USER32.@)
1116 LONG WINAPI SetClassLongA( HWND hwnd, INT offset, LONG newval )
1118 CLASS *class;
1119 LONG retval;
1121 if (offset != GCL_WNDPROC && offset != GCL_MENUNAME)
1122 return SetClassLongW( hwnd, offset, newval );
1124 TRACE("%p %d %lx\n", hwnd, offset, newval);
1126 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
1128 if (offset == GCL_WNDPROC)
1129 retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_32A );
1130 else /* GCL_MENUNAME */
1132 CLASS_SetMenuNameA( class, (LPCSTR)newval );
1133 retval = 0; /* Old value is now meaningless anyway */
1135 release_class_ptr( class );
1136 return retval;
1140 /***********************************************************************
1141 * GetClassNameA (USER32.@)
1143 INT WINAPI GetClassNameA( HWND hwnd, LPSTR buffer, INT count )
1145 INT ret = GlobalGetAtomNameA( GetClassLongA( hwnd, GCW_ATOM ), buffer, count );
1147 TRACE("%p %s %x\n",hwnd, debugstr_a(buffer), count);
1148 return ret;
1152 /***********************************************************************
1153 * GetClassNameW (USER32.@)
1155 INT WINAPI GetClassNameW( HWND hwnd, LPWSTR buffer, INT count )
1157 INT ret = GlobalGetAtomNameW( GetClassLongW( hwnd, GCW_ATOM ), buffer, count );
1159 TRACE("%p %s %x\n",hwnd, debugstr_w(buffer), count);
1160 return ret;
1164 /***********************************************************************
1165 * RealGetWindowClassA (USER32.@)
1167 UINT WINAPI RealGetWindowClassA( HWND hwnd, LPSTR buffer, UINT count )
1169 return GetClassNameA( hwnd, buffer, count );
1173 /***********************************************************************
1174 * RealGetWindowClassW (USER32.@)
1176 UINT WINAPI RealGetWindowClassW( HWND hwnd, LPWSTR buffer, UINT count )
1178 return GetClassNameW( hwnd, buffer, count );
1182 /***********************************************************************
1183 * GetClassInfo (USER.404)
1185 BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASS16 *wc )
1187 WNDCLASSEX16 wcex;
1188 UINT16 ret = GetClassInfoEx16( hInst16, name, &wcex );
1190 if (ret)
1192 wc->style = wcex.style;
1193 wc->lpfnWndProc = wcex.lpfnWndProc;
1194 wc->cbClsExtra = wcex.cbClsExtra;
1195 wc->cbWndExtra = wcex.cbWndExtra;
1196 wc->hInstance = wcex.hInstance;
1197 wc->hIcon = wcex.hIcon;
1198 wc->hCursor = wcex.hCursor;
1199 wc->hbrBackground = wcex.hbrBackground;
1200 wc->lpszMenuName = wcex.lpszMenuName;
1201 wc->lpszClassName = wcex.lpszClassName;
1203 return ret;
1207 /***********************************************************************
1208 * GetClassInfoA (USER32.@)
1210 BOOL WINAPI GetClassInfoA( HINSTANCE hInstance, LPCSTR name, WNDCLASSA *wc )
1212 WNDCLASSEXA wcex;
1213 UINT ret = GetClassInfoExA( hInstance, name, &wcex );
1215 if (ret)
1217 wc->style = wcex.style;
1218 wc->lpfnWndProc = wcex.lpfnWndProc;
1219 wc->cbClsExtra = wcex.cbClsExtra;
1220 wc->cbWndExtra = wcex.cbWndExtra;
1221 wc->hInstance = wcex.hInstance;
1222 wc->hIcon = wcex.hIcon;
1223 wc->hCursor = wcex.hCursor;
1224 wc->hbrBackground = wcex.hbrBackground;
1225 wc->lpszMenuName = wcex.lpszMenuName;
1226 wc->lpszClassName = wcex.lpszClassName;
1228 return ret;
1232 /***********************************************************************
1233 * GetClassInfoW (USER32.@)
1235 BOOL WINAPI GetClassInfoW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSW *wc )
1237 WNDCLASSEXW wcex;
1238 UINT ret = GetClassInfoExW( hInstance, name, &wcex );
1240 if (ret)
1242 wc->style = wcex.style;
1243 wc->lpfnWndProc = wcex.lpfnWndProc;
1244 wc->cbClsExtra = wcex.cbClsExtra;
1245 wc->cbWndExtra = wcex.cbWndExtra;
1246 wc->hInstance = wcex.hInstance;
1247 wc->hIcon = wcex.hIcon;
1248 wc->hCursor = wcex.hCursor;
1249 wc->hbrBackground = wcex.hbrBackground;
1250 wc->lpszMenuName = wcex.lpszMenuName;
1251 wc->lpszClassName = wcex.lpszClassName;
1253 return ret;
1257 /***********************************************************************
1258 * GetClassInfoEx (USER.398)
1260 * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
1261 * same in Win16 as in Win32. --AJ
1263 BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASSEX16 *wc )
1265 ATOM atom = HIWORD(name) ? GlobalFindAtomA( MapSL(name) ) : LOWORD(name);
1266 CLASS *classPtr;
1267 HINSTANCE hInstance;
1269 if (hInst16 == GetModuleHandle16("user")) hInstance = user32_module;
1270 else hInstance = HINSTANCE_32(GetExePtr( hInst16 ));
1272 TRACE("%p %s %x %p\n", hInstance, debugstr_a( MapSL(name) ), atom, wc);
1274 if (!atom || !(classPtr = CLASS_FindClassByAtom( atom, hInstance ))) return FALSE;
1275 wc->style = classPtr->style;
1276 wc->lpfnWndProc = CLASS_GetProc( classPtr, WIN_PROC_16 );
1277 wc->cbClsExtra = (INT16)classPtr->cbClsExtra;
1278 wc->cbWndExtra = (INT16)classPtr->cbWndExtra;
1279 wc->hInstance = (classPtr->hInstance == user32_module) ? GetModuleHandle16("user") : HINSTANCE_16(classPtr->hInstance);
1280 wc->hIcon = HICON_16(classPtr->hIcon);
1281 wc->hIconSm = HICON_16(classPtr->hIconSm);
1282 wc->hCursor = HCURSOR_16(classPtr->hCursor);
1283 wc->hbrBackground = HBRUSH_16(classPtr->hbrBackground);
1284 wc->lpszClassName = (SEGPTR)0;
1285 wc->lpszMenuName = CLASS_GetMenuName16( classPtr );
1286 wc->lpszClassName = name;
1287 release_class_ptr( classPtr );
1289 /* We must return the atom of the class here instead of just TRUE. */
1290 return atom;
1294 /***********************************************************************
1295 * GetClassInfoExA (USER32.@)
1297 BOOL WINAPI GetClassInfoExA( HINSTANCE hInstance, LPCSTR name, WNDCLASSEXA *wc )
1299 ATOM atom = HIWORD(name) ? GlobalFindAtomA( name ) : LOWORD(name);
1300 CLASS *classPtr;
1302 TRACE("%p %s %x %p\n", hInstance, debugstr_a(name), atom, wc);
1304 if (!hInstance) hInstance = user32_module;
1306 if (!atom || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )))
1308 SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
1309 return FALSE;
1311 wc->style = classPtr->style;
1312 wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32A );
1313 wc->cbClsExtra = classPtr->cbClsExtra;
1314 wc->cbWndExtra = classPtr->cbWndExtra;
1315 wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
1316 wc->hIcon = (HICON)classPtr->hIcon;
1317 wc->hIconSm = (HICON)classPtr->hIconSm;
1318 wc->hCursor = (HCURSOR)classPtr->hCursor;
1319 wc->hbrBackground = (HBRUSH)classPtr->hbrBackground;
1320 wc->lpszMenuName = CLASS_GetMenuNameA( classPtr );
1321 wc->lpszClassName = name;
1322 release_class_ptr( classPtr );
1324 /* We must return the atom of the class here instead of just TRUE. */
1325 return atom;
1329 /***********************************************************************
1330 * GetClassInfoExW (USER32.@)
1332 BOOL WINAPI GetClassInfoExW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSEXW *wc )
1334 ATOM atom = HIWORD(name) ? GlobalFindAtomW( name ) : LOWORD(name);
1335 CLASS *classPtr;
1337 TRACE("%p %s %x %p\n", hInstance, debugstr_w(name), atom, wc);
1339 if (!hInstance) hInstance = user32_module;
1341 if (!atom || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )))
1343 SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
1344 return FALSE;
1346 wc->style = classPtr->style;
1347 wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32W );
1348 wc->cbClsExtra = classPtr->cbClsExtra;
1349 wc->cbWndExtra = classPtr->cbWndExtra;
1350 wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
1351 wc->hIcon = (HICON)classPtr->hIcon;
1352 wc->hIconSm = (HICON)classPtr->hIconSm;
1353 wc->hCursor = (HCURSOR)classPtr->hCursor;
1354 wc->hbrBackground = (HBRUSH)classPtr->hbrBackground;
1355 wc->lpszMenuName = CLASS_GetMenuNameW( classPtr );
1356 wc->lpszClassName = name;
1357 release_class_ptr( classPtr );
1359 /* We must return the atom of the class here instead of just TRUE. */
1360 return atom;
1364 #if 0 /* toolhelp is in kernel, so this cannot work */
1366 /***********************************************************************
1367 * ClassFirst (TOOLHELP.69)
1369 BOOL16 WINAPI ClassFirst16( CLASSENTRY *pClassEntry )
1371 TRACE("%p\n",pClassEntry);
1372 pClassEntry->wNext = 1;
1373 return ClassNext16( pClassEntry );
1377 /***********************************************************************
1378 * ClassNext (TOOLHELP.70)
1380 BOOL16 WINAPI ClassNext16( CLASSENTRY *pClassEntry )
1382 int i;
1383 CLASS *class = firstClass;
1385 TRACE("%p\n",pClassEntry);
1387 if (!pClassEntry->wNext) return FALSE;
1388 for (i = 1; (i < pClassEntry->wNext) && class; i++) class = class->next;
1389 if (!class)
1391 pClassEntry->wNext = 0;
1392 return FALSE;
1394 pClassEntry->hInst = class->hInstance;
1395 pClassEntry->wNext++;
1396 GlobalGetAtomNameA( class->atomName, pClassEntry->szClassName,
1397 sizeof(pClassEntry->szClassName) );
1398 return TRUE;
1400 #endif