d3d11: Report D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW in CheckFormatSupport().
[wine.git] / dlls / user32 / class.c
blobc17a612c5b95bd3e8aaf00898e3b1eef6eb71f56
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <assert.h>
23 #include <stdarg.h>
24 #include <stdlib.h>
25 #include <string.h>
27 #include "winerror.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winnls.h"
32 #include "win.h"
33 #include "user_private.h"
34 #include "controls.h"
35 #include "wine/server.h"
36 #include "wine/list.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(class);
41 #define MAX_ATOM_LEN 255 /* from dlls/kernel32/atom.c */
43 typedef struct tagCLASS
45 struct list entry; /* Entry in class list */
46 UINT style; /* Class style */
47 BOOL local; /* Local class? */
48 WNDPROC winproc; /* Window procedure */
49 INT cbClsExtra; /* Class extra bytes */
50 INT cbWndExtra; /* Window extra bytes */
51 LPWSTR menuName; /* Default menu name (Unicode followed by ASCII) */
52 struct dce *dce; /* Opaque pointer to class DCE */
53 HINSTANCE hInstance; /* Module that created the task */
54 HICON hIcon; /* Default icon */
55 HICON hIconSm; /* Default small icon */
56 HICON hIconSmIntern; /* Internal small icon, derived from hIcon */
57 HCURSOR hCursor; /* Default cursor */
58 HBRUSH hbrBackground; /* Default background */
59 ATOM atomName; /* Name of the class */
60 WCHAR name[MAX_ATOM_LEN + 1];
61 WCHAR *basename; /* Base name for redirected classes, pointer within 'name'. */
62 } CLASS;
64 static struct list class_list = LIST_INIT( class_list );
65 static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT;
67 #define CLASS_OTHER_PROCESS ((CLASS *)1)
69 /***********************************************************************
70 * get_class_ptr
72 static CLASS *get_class_ptr( HWND hwnd, BOOL write_access )
74 WND *ptr = WIN_GetPtr( hwnd );
76 if (ptr)
78 if (ptr != WND_OTHER_PROCESS && ptr != WND_DESKTOP) return ptr->class;
79 if (!write_access) return CLASS_OTHER_PROCESS;
81 /* modifying classes in other processes is not allowed */
82 if (ptr == WND_DESKTOP || IsWindow( hwnd ))
84 SetLastError( ERROR_ACCESS_DENIED );
85 return NULL;
88 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
89 return NULL;
93 /***********************************************************************
94 * release_class_ptr
96 static inline void release_class_ptr( CLASS *ptr )
98 USER_Unlock();
102 /***********************************************************************
103 * get_int_atom_value
105 ATOM get_int_atom_value( LPCWSTR name )
107 UINT ret = 0;
109 if (IS_INTRESOURCE(name)) return LOWORD(name);
110 if (*name++ != '#') return 0;
111 while (*name)
113 if (*name < '0' || *name > '9') return 0;
114 ret = ret * 10 + *name++ - '0';
115 if (ret > 0xffff) return 0;
117 return ret;
121 /***********************************************************************
122 * is_comctl32_class
124 static BOOL is_comctl32_class( const WCHAR *name )
126 static const WCHAR *classesW[] =
128 L"ComboBoxEx32",
129 L"msctls_hotkey32",
130 L"msctls_progress32",
131 L"msctls_statusbar32",
132 L"msctls_trackbar32",
133 L"msctls_updown32",
134 L"NativeFontCtl",
135 L"ReBarWindow32",
136 L"SysAnimate32",
137 L"SysDateTimePick32",
138 L"SysHeader32",
139 L"SysIPAddress32",
140 L"SysLink",
141 L"SysListView32",
142 L"SysMonthCal32",
143 L"SysPager",
144 L"SysTabControl32",
145 L"SysTreeView32",
146 L"ToolbarWindow32",
147 L"tooltips_class32",
150 int min = 0, max = ARRAY_SIZE( classesW ) - 1;
152 while (min <= max)
154 int res, pos = (min + max) / 2;
155 if (!(res = wcsicmp( name, classesW[pos] ))) return TRUE;
156 if (res < 0) max = pos - 1;
157 else min = pos + 1;
159 return FALSE;
162 static BOOL is_builtin_class( const WCHAR *name )
164 static const WCHAR *classesW[] =
166 L"IME",
167 L"MDIClient",
168 L"Scrollbar",
171 int min = 0, max = ARRAY_SIZE( classesW ) - 1;
173 while (min <= max)
175 int res, pos = (min + max) / 2;
176 if (!(res = wcsicmp( name, classesW[pos] ))) return TRUE;
177 if (res < 0) max = pos - 1;
178 else min = pos + 1;
180 return FALSE;
183 /***********************************************************************
184 * set_server_info
186 * Set class info with the wine server.
188 static BOOL set_server_info( HWND hwnd, INT offset, LONG_PTR newval, UINT size )
190 BOOL ret;
192 SERVER_START_REQ( set_class_info )
194 req->window = wine_server_user_handle( hwnd );
195 req->extra_offset = -1;
196 switch(offset)
198 case GCW_ATOM:
199 req->flags = SET_CLASS_ATOM;
200 req->atom = LOWORD(newval);
201 break;
202 case GCL_STYLE:
203 req->flags = SET_CLASS_STYLE;
204 req->style = newval;
205 break;
206 case GCL_CBWNDEXTRA:
207 req->flags = SET_CLASS_WINEXTRA;
208 req->win_extra = newval;
209 break;
210 case GCLP_HMODULE:
211 req->flags = SET_CLASS_INSTANCE;
212 req->instance = wine_server_client_ptr( (void *)newval );
213 break;
214 default:
215 assert( offset >= 0 );
216 req->flags = SET_CLASS_EXTRA;
217 req->extra_offset = offset;
218 req->extra_size = size;
219 if ( size == sizeof(LONG) )
221 LONG newlong = newval;
222 memcpy( &req->extra_value, &newlong, sizeof(LONG) );
224 else
225 memcpy( &req->extra_value, &newval, sizeof(LONG_PTR) );
226 break;
228 ret = !wine_server_call_err( req );
230 SERVER_END_REQ;
231 return ret;
235 /***********************************************************************
236 * CLASS_GetMenuNameA
238 * Get the menu name as a ASCII string.
240 static inline LPSTR CLASS_GetMenuNameA( CLASS *classPtr )
242 if (IS_INTRESOURCE(classPtr->menuName)) return (LPSTR)classPtr->menuName;
243 return (LPSTR)(classPtr->menuName + lstrlenW(classPtr->menuName) + 1);
247 /***********************************************************************
248 * CLASS_GetMenuNameW
250 * Get the menu name as a Unicode string.
252 static inline LPWSTR CLASS_GetMenuNameW( CLASS *classPtr )
254 return classPtr->menuName;
258 /***********************************************************************
259 * CLASS_SetMenuNameA
261 * Set the menu name in a class structure by copying the string.
263 static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name )
265 if (!IS_INTRESOURCE(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
266 if (!IS_INTRESOURCE(name))
268 DWORD lenA = strlen(name) + 1;
269 DWORD lenW = MultiByteToWideChar( CP_ACP, 0, name, lenA, NULL, 0 );
270 classPtr->menuName = HeapAlloc( GetProcessHeap(), 0, lenA + lenW*sizeof(WCHAR) );
271 MultiByteToWideChar( CP_ACP, 0, name, lenA, classPtr->menuName, lenW );
272 memcpy( classPtr->menuName + lenW, name, lenA );
274 else classPtr->menuName = (LPWSTR)name;
278 /***********************************************************************
279 * CLASS_SetMenuNameW
281 * Set the menu name in a class structure by copying the string.
283 static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name )
285 if (!IS_INTRESOURCE(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
286 if (!IS_INTRESOURCE(name))
288 DWORD lenW = lstrlenW(name) + 1;
289 DWORD lenA = WideCharToMultiByte( CP_ACP, 0, name, lenW, NULL, 0, NULL, NULL );
290 classPtr->menuName = HeapAlloc( GetProcessHeap(), 0, lenA + lenW*sizeof(WCHAR) );
291 memcpy( classPtr->menuName, name, lenW*sizeof(WCHAR) );
292 WideCharToMultiByte( CP_ACP, 0, name, lenW,
293 (char *)(classPtr->menuName + lenW), lenA, NULL, NULL );
295 else classPtr->menuName = (LPWSTR)name;
299 /***********************************************************************
300 * CLASS_FreeClass
302 * Free a class structure.
304 static void CLASS_FreeClass( CLASS *classPtr )
306 TRACE("%p\n", classPtr);
308 USER_Lock();
310 if (classPtr->dce) free_dce( classPtr->dce, 0 );
311 list_remove( &classPtr->entry );
312 if (classPtr->hbrBackground > (HBRUSH)(COLOR_GRADIENTINACTIVECAPTION + 1))
313 DeleteObject( classPtr->hbrBackground );
314 DestroyIcon( classPtr->hIconSmIntern );
315 HeapFree( GetProcessHeap(), 0, classPtr->menuName );
316 HeapFree( GetProcessHeap(), 0, classPtr );
317 USER_Unlock();
320 const WCHAR *CLASS_GetVersionedName( const WCHAR *name, UINT *basename_offset, WCHAR *combined, BOOL register_class )
322 ACTCTX_SECTION_KEYED_DATA data;
323 struct wndclass_redirect_data
325 ULONG size;
326 DWORD res;
327 ULONG name_len;
328 ULONG name_offset;
329 ULONG module_len;
330 ULONG module_offset;
331 } *wndclass;
332 const WCHAR *module, *ret;
333 UNICODE_STRING name_us;
334 HMODULE hmod;
335 UINT offset;
337 if (!basename_offset)
338 basename_offset = &offset;
340 *basename_offset = 0;
342 if (IS_INTRESOURCE( name ))
343 return name;
345 if (is_comctl32_class( name ) || is_builtin_class( name ))
346 return name;
348 data.cbSize = sizeof(data);
349 RtlInitUnicodeString(&name_us, name);
350 if (RtlFindActivationContextSectionString(0, NULL, ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION,
351 &name_us, &data))
352 return name;
354 wndclass = (struct wndclass_redirect_data *)data.lpData;
355 *basename_offset = wndclass->name_len / sizeof(WCHAR) - lstrlenW(name);
357 module = (const WCHAR *)((BYTE *)data.lpSectionBase + wndclass->module_offset);
358 if (!(hmod = GetModuleHandleW( module )))
359 hmod = LoadLibraryW( module );
361 /* Combined name is used to register versioned class name. Base name part will match exactly
362 original class name and won't be reused from context data. */
363 ret = (const WCHAR *)((BYTE *)wndclass + wndclass->name_offset);
364 if (combined)
366 memcpy(combined, ret, *basename_offset * sizeof(WCHAR));
367 lstrcpyW(&combined[*basename_offset], name);
368 ret = combined;
371 if (register_class && hmod)
373 BOOL found = FALSE;
374 struct list *ptr;
376 USER_Lock();
378 LIST_FOR_EACH( ptr, &class_list )
380 CLASS *class = LIST_ENTRY( ptr, CLASS, entry );
381 if (wcsicmp( class->name, ret )) continue;
382 if (!class->local || class->hInstance == hmod)
384 found = TRUE;
385 break;
389 USER_Unlock();
391 if (!found)
393 BOOL (WINAPI *pRegisterClassNameW)(const WCHAR *class);
395 pRegisterClassNameW = (void *)GetProcAddress(hmod, "RegisterClassNameW");
396 if (pRegisterClassNameW)
397 pRegisterClassNameW(name);
401 return ret;
404 /***********************************************************************
405 * CLASS_FindClass
407 * Return a pointer to the class.
409 static CLASS *CLASS_FindClass( LPCWSTR name, HINSTANCE hinstance )
411 struct list *ptr;
412 ATOM atom = get_int_atom_value( name );
414 GetDesktopWindow(); /* create the desktop window to trigger builtin class registration */
416 if (!name) return NULL;
418 name = CLASS_GetVersionedName( name, NULL, NULL, TRUE );
420 for (;;)
422 USER_Lock();
424 LIST_FOR_EACH( ptr, &class_list )
426 CLASS *class = LIST_ENTRY( ptr, CLASS, entry );
427 if (atom)
429 if (class->atomName != atom) continue;
431 else
433 if (wcsicmp( class->name, name )) continue;
435 if (!class->local || class->hInstance == hinstance)
437 TRACE("%s %p -> %p\n", debugstr_w(name), hinstance, class);
438 return class;
441 USER_Unlock();
443 if (atom) break;
444 if (!is_comctl32_class( name )) break;
445 if (GetModuleHandleW( L"comctl32.dll" )) break;
446 if (!LoadLibraryW( L"comctl32.dll" )) break;
447 TRACE( "%s retrying after loading comctl32\n", debugstr_w(name) );
450 TRACE("%s %p -> not found\n", debugstr_w(name), hinstance);
451 return NULL;
454 /***********************************************************************
455 * CLASS_RegisterClass
457 * The real RegisterClass() functionality.
459 static CLASS *CLASS_RegisterClass( LPCWSTR name, UINT basename_offset, HINSTANCE hInstance, BOOL local,
460 DWORD style, INT classExtra, INT winExtra )
462 CLASS *classPtr;
463 BOOL ret;
465 TRACE("name=%s hinst=%p style=0x%x clExtr=0x%x winExtr=0x%x\n",
466 debugstr_w(name), hInstance, style, classExtra, winExtra );
468 /* Fix the extra bytes value */
470 if (classExtra > 40) /* Extra bytes are limited to 40 in Win32 */
471 WARN("Class extra bytes %d is > 40\n", classExtra);
472 if (winExtra > 40) /* Extra bytes are limited to 40 in Win32 */
473 WARN("Win extra bytes %d is > 40\n", winExtra );
475 classPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLASS) + classExtra );
476 if (!classPtr) return NULL;
478 classPtr->atomName = get_int_atom_value( name );
479 classPtr->basename = classPtr->name;
480 if (!classPtr->atomName && name)
482 lstrcpyW( classPtr->name, name );
483 classPtr->basename += basename_offset;
485 else GlobalGetAtomNameW( classPtr->atomName, classPtr->name, ARRAY_SIZE( classPtr->name ));
487 SERVER_START_REQ( create_class )
489 req->local = local;
490 req->style = style;
491 req->instance = wine_server_client_ptr( hInstance );
492 req->extra = classExtra;
493 req->win_extra = winExtra;
494 req->client_ptr = wine_server_client_ptr( classPtr );
495 req->atom = classPtr->atomName;
496 req->name_offset = basename_offset;
497 if (!req->atom && name) wine_server_add_data( req, name, lstrlenW(name) * sizeof(WCHAR) );
498 ret = !wine_server_call_err( req );
499 classPtr->atomName = reply->atom;
501 SERVER_END_REQ;
502 if (!ret)
504 HeapFree( GetProcessHeap(), 0, classPtr );
505 return NULL;
508 classPtr->style = style;
509 classPtr->local = local;
510 classPtr->cbWndExtra = winExtra;
511 classPtr->cbClsExtra = classExtra;
512 classPtr->hInstance = hInstance;
514 /* Other non-null values must be set by caller */
516 USER_Lock();
517 if (local) list_add_head( &class_list, &classPtr->entry );
518 else list_add_tail( &class_list, &classPtr->entry );
519 return classPtr;
523 /***********************************************************************
524 * register_builtin
526 * Register a builtin control class.
527 * This allows having both ASCII and Unicode winprocs for the same class.
529 static void register_builtin( const struct builtin_class_descr *descr )
531 CLASS *classPtr;
533 if (!(classPtr = CLASS_RegisterClass( descr->name, 0, user32_module, FALSE,
534 descr->style, 0, descr->extra ))) return;
536 if (descr->cursor) classPtr->hCursor = LoadCursorA( 0, (LPSTR)descr->cursor );
537 classPtr->hbrBackground = descr->brush;
538 classPtr->winproc = BUILTIN_WINPROC( descr->proc );
539 release_class_ptr( classPtr );
543 /***********************************************************************
544 * register_builtins
546 static BOOL WINAPI register_builtins( INIT_ONCE *once, void *param, void **context )
548 register_builtin( &BUTTON_builtin_class );
549 register_builtin( &COMBO_builtin_class );
550 register_builtin( &COMBOLBOX_builtin_class );
551 register_builtin( &DIALOG_builtin_class );
552 register_builtin( &EDIT_builtin_class );
553 register_builtin( &ICONTITLE_builtin_class );
554 register_builtin( &LISTBOX_builtin_class );
555 register_builtin( &MDICLIENT_builtin_class );
556 register_builtin( &MENU_builtin_class );
557 register_builtin( &SCROLL_builtin_class );
558 register_builtin( &STATIC_builtin_class );
559 register_builtin( &IME_builtin_class );
560 return TRUE;
564 /***********************************************************************
565 * register_builtin_classes
567 void register_builtin_classes(void)
569 InitOnceExecuteOnce( &init_once, register_builtins, NULL, NULL );
573 /***********************************************************************
574 * register_desktop_class
576 void register_desktop_class(void)
578 register_builtin( &DESKTOP_builtin_class );
579 register_builtin( &MESSAGE_builtin_class );
583 /***********************************************************************
584 * get_class_winproc
586 WNDPROC get_class_winproc( CLASS *class )
588 return class->winproc;
592 /***********************************************************************
593 * get_class_dce
595 struct dce *get_class_dce( CLASS *class )
597 return class->dce;
601 /***********************************************************************
602 * set_class_dce
604 struct dce *set_class_dce( CLASS *class, struct dce *dce )
606 if (class->dce) return class->dce; /* already set, don't change it */
607 class->dce = dce;
608 return dce;
612 /***********************************************************************
613 * RegisterClassA (USER32.@)
615 * Register a window class.
617 * RETURNS
618 * >0: Unique identifier
619 * 0: Failure
621 ATOM WINAPI RegisterClassA( const WNDCLASSA* wc ) /* [in] Address of structure with class data */
623 WNDCLASSEXA wcex;
625 wcex.cbSize = sizeof(wcex);
626 wcex.style = wc->style;
627 wcex.lpfnWndProc = wc->lpfnWndProc;
628 wcex.cbClsExtra = wc->cbClsExtra;
629 wcex.cbWndExtra = wc->cbWndExtra;
630 wcex.hInstance = wc->hInstance;
631 wcex.hIcon = wc->hIcon;
632 wcex.hCursor = wc->hCursor;
633 wcex.hbrBackground = wc->hbrBackground;
634 wcex.lpszMenuName = wc->lpszMenuName;
635 wcex.lpszClassName = wc->lpszClassName;
636 wcex.hIconSm = 0;
637 return RegisterClassExA( &wcex );
641 /***********************************************************************
642 * RegisterClassW (USER32.@)
644 * See RegisterClassA.
646 ATOM WINAPI RegisterClassW( const WNDCLASSW* wc )
648 WNDCLASSEXW wcex;
650 wcex.cbSize = sizeof(wcex);
651 wcex.style = wc->style;
652 wcex.lpfnWndProc = wc->lpfnWndProc;
653 wcex.cbClsExtra = wc->cbClsExtra;
654 wcex.cbWndExtra = wc->cbWndExtra;
655 wcex.hInstance = wc->hInstance;
656 wcex.hIcon = wc->hIcon;
657 wcex.hCursor = wc->hCursor;
658 wcex.hbrBackground = wc->hbrBackground;
659 wcex.lpszMenuName = wc->lpszMenuName;
660 wcex.lpszClassName = wc->lpszClassName;
661 wcex.hIconSm = 0;
662 return RegisterClassExW( &wcex );
666 /***********************************************************************
667 * RegisterClassExA (USER32.@)
669 ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc )
671 WCHAR name[MAX_ATOM_LEN + 1], combined[MAX_ATOM_LEN + 1];
672 const WCHAR *classname = NULL;
673 ATOM atom;
674 CLASS *classPtr;
675 HINSTANCE instance;
677 GetDesktopWindow(); /* create the desktop window to trigger builtin class registration */
679 if (wc->cbSize != sizeof(*wc) || wc->cbClsExtra < 0 || wc->cbWndExtra < 0 ||
680 wc->hInstance == user32_module) /* we can't register a class for user32 */
682 SetLastError( ERROR_INVALID_PARAMETER );
683 return 0;
685 if (!(instance = wc->hInstance)) instance = GetModuleHandleW( NULL );
687 if (!IS_INTRESOURCE(wc->lpszClassName))
689 UINT basename_offset;
690 if (!MultiByteToWideChar( CP_ACP, 0, wc->lpszClassName, -1, name, MAX_ATOM_LEN + 1 )) return 0;
691 classname = CLASS_GetVersionedName( name, &basename_offset, combined, FALSE );
692 classPtr = CLASS_RegisterClass( classname, basename_offset, instance, !(wc->style & CS_GLOBALCLASS),
693 wc->style, wc->cbClsExtra, wc->cbWndExtra );
695 else
697 classPtr = CLASS_RegisterClass( (LPCWSTR)wc->lpszClassName, 0, instance,
698 !(wc->style & CS_GLOBALCLASS), wc->style,
699 wc->cbClsExtra, wc->cbWndExtra );
701 if (!classPtr) return 0;
702 atom = classPtr->atomName;
704 TRACE("name=%s%s%s atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n",
705 debugstr_a(wc->lpszClassName), classname != name ? "->" : "", classname != name ? debugstr_w(classname) : "",
706 atom, wc->lpfnWndProc, instance, wc->hbrBackground, wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr );
708 classPtr->hIcon = wc->hIcon;
709 classPtr->hIconSm = wc->hIconSm;
710 classPtr->hIconSmIntern = wc->hIcon && !wc->hIconSm ?
711 CopyImage( wc->hIcon, IMAGE_ICON,
712 GetSystemMetrics( SM_CXSMICON ),
713 GetSystemMetrics( SM_CYSMICON ),
714 LR_COPYFROMRESOURCE ) : NULL;
715 classPtr->hCursor = wc->hCursor;
716 classPtr->hbrBackground = wc->hbrBackground;
717 classPtr->winproc = WINPROC_AllocProc( wc->lpfnWndProc, FALSE );
718 CLASS_SetMenuNameA( classPtr, wc->lpszMenuName );
719 release_class_ptr( classPtr );
720 return atom;
724 /***********************************************************************
725 * RegisterClassExW (USER32.@)
727 ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc )
729 WCHAR name[MAX_ATOM_LEN + 1];
730 const WCHAR *classname;
731 UINT basename_offset;
732 ATOM atom;
733 CLASS *classPtr;
734 HINSTANCE instance;
736 GetDesktopWindow(); /* create the desktop window to trigger builtin class registration */
738 if (wc->cbSize != sizeof(*wc) || wc->cbClsExtra < 0 || wc->cbWndExtra < 0 ||
739 wc->hInstance == user32_module) /* we can't register a class for user32 */
741 SetLastError( ERROR_INVALID_PARAMETER );
742 return 0;
744 if (!(instance = wc->hInstance)) instance = GetModuleHandleW( NULL );
746 classname = CLASS_GetVersionedName( wc->lpszClassName, &basename_offset, name, FALSE );
747 if (!(classPtr = CLASS_RegisterClass( classname, basename_offset, instance, !(wc->style & CS_GLOBALCLASS),
748 wc->style, wc->cbClsExtra, wc->cbWndExtra )))
749 return 0;
751 atom = classPtr->atomName;
753 TRACE("name=%s%s%s atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n",
754 debugstr_w(wc->lpszClassName), classname != wc->lpszClassName ? "->" : "",
755 classname != wc->lpszClassName ? debugstr_w(classname) : "", atom, wc->lpfnWndProc, instance,
756 wc->hbrBackground, wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr );
758 classPtr->hIcon = wc->hIcon;
759 classPtr->hIconSm = wc->hIconSm;
760 classPtr->hIconSmIntern = wc->hIcon && !wc->hIconSm ?
761 CopyImage( wc->hIcon, IMAGE_ICON,
762 GetSystemMetrics( SM_CXSMICON ),
763 GetSystemMetrics( SM_CYSMICON ),
764 LR_COPYFROMRESOURCE ) : NULL;
765 classPtr->hCursor = wc->hCursor;
766 classPtr->hbrBackground = wc->hbrBackground;
767 classPtr->winproc = WINPROC_AllocProc( wc->lpfnWndProc, TRUE );
768 CLASS_SetMenuNameW( classPtr, wc->lpszMenuName );
769 release_class_ptr( classPtr );
770 return atom;
774 /***********************************************************************
775 * UnregisterClassA (USER32.@)
777 BOOL WINAPI UnregisterClassA( LPCSTR className, HINSTANCE hInstance )
779 if (!IS_INTRESOURCE(className))
781 WCHAR name[MAX_ATOM_LEN + 1];
783 if (!MultiByteToWideChar( CP_ACP, 0, className, -1, name, MAX_ATOM_LEN + 1 ))
784 return FALSE;
785 return UnregisterClassW( name, hInstance );
787 return UnregisterClassW( (LPCWSTR)className, hInstance );
790 /***********************************************************************
791 * UnregisterClassW (USER32.@)
793 BOOL WINAPI UnregisterClassW( LPCWSTR className, HINSTANCE hInstance )
795 CLASS *classPtr = NULL;
797 GetDesktopWindow(); /* create the desktop window to trigger builtin class registration */
799 className = CLASS_GetVersionedName( className, NULL, NULL, FALSE );
800 SERVER_START_REQ( destroy_class )
802 req->instance = wine_server_client_ptr( hInstance );
803 if (!(req->atom = get_int_atom_value(className)) && className)
804 wine_server_add_data( req, className, lstrlenW(className) * sizeof(WCHAR) );
805 if (!wine_server_call_err( req )) classPtr = wine_server_get_ptr( reply->client_ptr );
807 SERVER_END_REQ;
809 if (classPtr) CLASS_FreeClass( classPtr );
810 return (classPtr != NULL);
814 /***********************************************************************
815 * GetClassWord (USER32.@)
817 WORD WINAPI GetClassWord( HWND hwnd, INT offset )
819 CLASS *class;
820 WORD retvalue = 0;
822 if (offset < 0) return GetClassLongA( hwnd, offset );
824 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
826 if (class == CLASS_OTHER_PROCESS)
828 SERVER_START_REQ( set_class_info )
830 req->window = wine_server_user_handle( hwnd );
831 req->flags = 0;
832 req->extra_offset = offset;
833 req->extra_size = sizeof(retvalue);
834 if (!wine_server_call_err( req ))
835 memcpy( &retvalue, &reply->old_extra_value, sizeof(retvalue) );
837 SERVER_END_REQ;
838 return retvalue;
841 if (offset <= class->cbClsExtra - sizeof(WORD))
842 memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) );
843 else
844 SetLastError( ERROR_INVALID_INDEX );
845 release_class_ptr( class );
846 return retvalue;
850 /***********************************************************************
851 * CLASS_GetClassLong
853 * Implementation of GetClassLong(Ptr)A/W
855 static ULONG_PTR CLASS_GetClassLong( HWND hwnd, INT offset, UINT size,
856 BOOL unicode )
858 CLASS *class;
859 ULONG_PTR retvalue = 0;
861 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
863 if (class == CLASS_OTHER_PROCESS)
865 SERVER_START_REQ( set_class_info )
867 req->window = wine_server_user_handle( hwnd );
868 req->flags = 0;
869 req->extra_offset = (offset >= 0) ? offset : -1;
870 req->extra_size = (offset >= 0) ? size : 0;
871 if (!wine_server_call_err( req ))
873 switch(offset)
875 case GCLP_HBRBACKGROUND:
876 case GCLP_HCURSOR:
877 case GCLP_HICON:
878 case GCLP_HICONSM:
879 case GCLP_WNDPROC:
880 case GCLP_MENUNAME:
881 FIXME( "offset %d (%s) not supported on other process window %p\n",
882 offset, SPY_GetClassLongOffsetName(offset), hwnd );
883 SetLastError( ERROR_INVALID_HANDLE );
884 break;
885 case GCL_STYLE:
886 retvalue = reply->old_style;
887 break;
888 case GCL_CBWNDEXTRA:
889 retvalue = reply->old_win_extra;
890 break;
891 case GCL_CBCLSEXTRA:
892 retvalue = reply->old_extra;
893 break;
894 case GCLP_HMODULE:
895 retvalue = (ULONG_PTR)wine_server_get_ptr( reply->old_instance );
896 break;
897 case GCW_ATOM:
898 retvalue = reply->old_atom;
899 break;
900 default:
901 if (offset >= 0)
903 if (size == sizeof(DWORD))
905 DWORD retdword;
906 memcpy( &retdword, &reply->old_extra_value, sizeof(DWORD) );
907 retvalue = retdword;
909 else
910 memcpy( &retvalue, &reply->old_extra_value,
911 sizeof(ULONG_PTR) );
913 else SetLastError( ERROR_INVALID_INDEX );
914 break;
918 SERVER_END_REQ;
919 return retvalue;
922 if (offset >= 0)
924 if (offset <= class->cbClsExtra - size)
926 if (size == sizeof(DWORD))
928 DWORD retdword;
929 memcpy( &retdword, (char *)(class + 1) + offset, sizeof(DWORD) );
930 retvalue = retdword;
932 else
933 memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(ULONG_PTR) );
935 else
936 SetLastError( ERROR_INVALID_INDEX );
937 release_class_ptr( class );
938 return retvalue;
941 switch(offset)
943 case GCLP_HBRBACKGROUND:
944 retvalue = (ULONG_PTR)class->hbrBackground;
945 break;
946 case GCLP_HCURSOR:
947 retvalue = (ULONG_PTR)class->hCursor;
948 break;
949 case GCLP_HICON:
950 retvalue = (ULONG_PTR)class->hIcon;
951 break;
952 case GCLP_HICONSM:
953 retvalue = (ULONG_PTR)(class->hIconSm ? class->hIconSm : class->hIconSmIntern);
954 break;
955 case GCL_STYLE:
956 retvalue = class->style;
957 break;
958 case GCL_CBWNDEXTRA:
959 retvalue = class->cbWndExtra;
960 break;
961 case GCL_CBCLSEXTRA:
962 retvalue = class->cbClsExtra;
963 break;
964 case GCLP_HMODULE:
965 retvalue = (ULONG_PTR)class->hInstance;
966 break;
967 case GCLP_WNDPROC:
968 retvalue = (ULONG_PTR)WINPROC_GetProc( class->winproc, unicode );
969 break;
970 case GCLP_MENUNAME:
971 retvalue = (ULONG_PTR)CLASS_GetMenuNameW( class );
972 if (unicode)
973 retvalue = (ULONG_PTR)CLASS_GetMenuNameW( class );
974 else
975 retvalue = (ULONG_PTR)CLASS_GetMenuNameA( class );
976 break;
977 case GCW_ATOM:
978 retvalue = class->atomName;
979 break;
980 default:
981 SetLastError( ERROR_INVALID_INDEX );
982 break;
984 release_class_ptr( class );
985 return retvalue;
989 /***********************************************************************
990 * GetClassLongW (USER32.@)
992 DWORD WINAPI GetClassLongW( HWND hwnd, INT offset )
994 return CLASS_GetClassLong( hwnd, offset, sizeof(DWORD), TRUE );
999 /***********************************************************************
1000 * GetClassLongA (USER32.@)
1002 DWORD WINAPI GetClassLongA( HWND hwnd, INT offset )
1004 return CLASS_GetClassLong( hwnd, offset, sizeof(DWORD), FALSE );
1008 /***********************************************************************
1009 * SetClassWord (USER32.@)
1011 WORD WINAPI SetClassWord( HWND hwnd, INT offset, WORD newval )
1013 CLASS *class;
1014 WORD retval = 0;
1016 if (offset < 0) return SetClassLongA( hwnd, offset, (DWORD)newval );
1018 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
1020 SERVER_START_REQ( set_class_info )
1022 req->window = wine_server_user_handle( hwnd );
1023 req->flags = SET_CLASS_EXTRA;
1024 req->extra_offset = offset;
1025 req->extra_size = sizeof(newval);
1026 memcpy( &req->extra_value, &newval, sizeof(newval) );
1027 if (!wine_server_call_err( req ))
1029 void *ptr = (char *)(class + 1) + offset;
1030 memcpy( &retval, ptr, sizeof(retval) );
1031 memcpy( ptr, &newval, sizeof(newval) );
1034 SERVER_END_REQ;
1035 release_class_ptr( class );
1036 return retval;
1040 /***********************************************************************
1041 * CLASS_SetClassLong
1043 * Implementation of SetClassLong(Ptr)A/W
1045 static ULONG_PTR CLASS_SetClassLong( HWND hwnd, INT offset, LONG_PTR newval,
1046 UINT size, BOOL unicode )
1048 CLASS *class;
1049 ULONG_PTR retval = 0;
1051 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
1053 if (offset >= 0)
1055 if (set_server_info( hwnd, offset, newval, size ))
1057 void *ptr = (char *)(class + 1) + offset;
1058 if ( size == sizeof(LONG) )
1060 DWORD retdword;
1061 LONG newlong = newval;
1062 memcpy( &retdword, ptr, sizeof(DWORD) );
1063 memcpy( ptr, &newlong, sizeof(LONG) );
1064 retval = retdword;
1066 else
1068 memcpy( &retval, ptr, sizeof(ULONG_PTR) );
1069 memcpy( ptr, &newval, sizeof(LONG_PTR) );
1073 else switch(offset)
1075 case GCLP_MENUNAME:
1076 if ( unicode )
1077 CLASS_SetMenuNameW( class, (LPCWSTR)newval );
1078 else
1079 CLASS_SetMenuNameA( class, (LPCSTR)newval );
1080 retval = 0; /* Old value is now meaningless anyway */
1081 break;
1082 case GCLP_WNDPROC:
1083 retval = (ULONG_PTR)WINPROC_GetProc( class->winproc, unicode );
1084 class->winproc = WINPROC_AllocProc( (WNDPROC)newval, unicode );
1085 break;
1086 case GCLP_HBRBACKGROUND:
1087 retval = (ULONG_PTR)class->hbrBackground;
1088 class->hbrBackground = (HBRUSH)newval;
1089 break;
1090 case GCLP_HCURSOR:
1091 retval = (ULONG_PTR)class->hCursor;
1092 class->hCursor = (HCURSOR)newval;
1093 break;
1094 case GCLP_HICON:
1095 retval = (ULONG_PTR)class->hIcon;
1096 if (class->hIconSmIntern)
1098 DestroyIcon(class->hIconSmIntern);
1099 class->hIconSmIntern = NULL;
1101 if (newval && !class->hIconSm)
1102 class->hIconSmIntern = CopyImage( (HICON)newval, IMAGE_ICON,
1103 GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ),
1104 LR_COPYFROMRESOURCE );
1105 class->hIcon = (HICON)newval;
1106 break;
1107 case GCLP_HICONSM:
1108 retval = (ULONG_PTR)class->hIconSm;
1109 if (retval && !newval && class->hIcon)
1110 class->hIconSmIntern = CopyImage( class->hIcon, IMAGE_ICON,
1111 GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ),
1112 LR_COPYFROMRESOURCE );
1113 else if (newval && class->hIconSmIntern)
1115 DestroyIcon(class->hIconSmIntern);
1116 class->hIconSmIntern = NULL;
1118 class->hIconSm = (HICON)newval;
1119 break;
1120 case GCL_STYLE:
1121 if (!set_server_info( hwnd, offset, newval, size )) break;
1122 retval = class->style;
1123 class->style = newval;
1124 break;
1125 case GCL_CBWNDEXTRA:
1126 if (!set_server_info( hwnd, offset, newval, size )) break;
1127 retval = class->cbWndExtra;
1128 class->cbWndExtra = newval;
1129 break;
1130 case GCLP_HMODULE:
1131 if (!set_server_info( hwnd, offset, newval, size )) break;
1132 retval = (ULONG_PTR)class->hInstance;
1133 class->hInstance = (HINSTANCE)newval;
1134 break;
1135 case GCW_ATOM:
1136 if (!set_server_info( hwnd, offset, newval, size )) break;
1137 retval = class->atomName;
1138 class->atomName = newval;
1139 GlobalGetAtomNameW( newval, class->name, ARRAY_SIZE( class->name ));
1140 break;
1141 case GCL_CBCLSEXTRA: /* cannot change this one */
1142 SetLastError( ERROR_INVALID_PARAMETER );
1143 break;
1144 default:
1145 SetLastError( ERROR_INVALID_INDEX );
1146 break;
1148 release_class_ptr( class );
1149 return retval;
1153 /***********************************************************************
1154 * SetClassLongW (USER32.@)
1156 DWORD WINAPI SetClassLongW( HWND hwnd, INT offset, LONG newval )
1158 return CLASS_SetClassLong( hwnd, offset, newval, sizeof(LONG), TRUE );
1162 /***********************************************************************
1163 * SetClassLongA (USER32.@)
1165 DWORD WINAPI SetClassLongA( HWND hwnd, INT offset, LONG newval )
1167 return CLASS_SetClassLong( hwnd, offset, newval, sizeof(LONG), FALSE );
1171 /***********************************************************************
1172 * GetClassNameA (USER32.@)
1174 INT WINAPI GetClassNameA( HWND hwnd, LPSTR buffer, INT count )
1176 WCHAR tmpbuf[MAX_ATOM_LEN + 1];
1177 DWORD len;
1179 if (count <= 0) return 0;
1180 if (!GetClassNameW( hwnd, tmpbuf, ARRAY_SIZE( tmpbuf ))) return 0;
1181 RtlUnicodeToMultiByteN( buffer, count - 1, &len, tmpbuf, lstrlenW(tmpbuf) * sizeof(WCHAR) );
1182 buffer[len] = 0;
1183 return len;
1187 /***********************************************************************
1188 * GetClassNameW (USER32.@)
1190 INT WINAPI GetClassNameW( HWND hwnd, LPWSTR buffer, INT count )
1192 CLASS *class;
1193 INT ret;
1195 TRACE("%p %p %d\n", hwnd, buffer, count);
1197 if (count <= 0) return 0;
1199 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
1201 if (class == CLASS_OTHER_PROCESS)
1203 WCHAR tmpbuf[MAX_ATOM_LEN + 1];
1204 ATOM atom = 0;
1206 SERVER_START_REQ( set_class_info )
1208 req->window = wine_server_user_handle( hwnd );
1209 req->flags = 0;
1210 req->extra_offset = -1;
1211 req->extra_size = 0;
1212 if (!wine_server_call_err( req ))
1213 atom = reply->base_atom;
1215 SERVER_END_REQ;
1217 ret = GlobalGetAtomNameW( atom, tmpbuf, MAX_ATOM_LEN + 1 );
1218 if (ret)
1220 ret = min(count - 1, ret);
1221 memcpy(buffer, tmpbuf, ret * sizeof(WCHAR));
1222 buffer[ret] = 0;
1225 else
1227 /* Return original name class was registered with. */
1228 lstrcpynW( buffer, class->basename, count );
1229 release_class_ptr( class );
1230 ret = lstrlenW( buffer );
1232 return ret;
1236 /***********************************************************************
1237 * RealGetWindowClassA (USER32.@)
1239 UINT WINAPI RealGetWindowClassA( HWND hwnd, LPSTR buffer, UINT count )
1241 return GetClassNameA( hwnd, buffer, count );
1245 /***********************************************************************
1246 * RealGetWindowClassW (USER32.@)
1248 UINT WINAPI RealGetWindowClassW( HWND hwnd, LPWSTR buffer, UINT count )
1250 return GetClassNameW( hwnd, buffer, count );
1254 /***********************************************************************
1255 * GetClassInfoA (USER32.@)
1257 BOOL WINAPI GetClassInfoA( HINSTANCE hInstance, LPCSTR name, WNDCLASSA *wc )
1259 WNDCLASSEXA wcex;
1260 UINT ret = GetClassInfoExA( hInstance, name, &wcex );
1262 if (ret)
1264 wc->style = wcex.style;
1265 wc->lpfnWndProc = wcex.lpfnWndProc;
1266 wc->cbClsExtra = wcex.cbClsExtra;
1267 wc->cbWndExtra = wcex.cbWndExtra;
1268 wc->hInstance = wcex.hInstance;
1269 wc->hIcon = wcex.hIcon;
1270 wc->hCursor = wcex.hCursor;
1271 wc->hbrBackground = wcex.hbrBackground;
1272 wc->lpszMenuName = wcex.lpszMenuName;
1273 wc->lpszClassName = wcex.lpszClassName;
1275 return ret;
1279 /***********************************************************************
1280 * GetClassInfoW (USER32.@)
1282 BOOL WINAPI GetClassInfoW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSW *wc )
1284 WNDCLASSEXW wcex;
1285 UINT ret = GetClassInfoExW( hInstance, name, &wcex );
1287 if (ret)
1289 wc->style = wcex.style;
1290 wc->lpfnWndProc = wcex.lpfnWndProc;
1291 wc->cbClsExtra = wcex.cbClsExtra;
1292 wc->cbWndExtra = wcex.cbWndExtra;
1293 wc->hInstance = wcex.hInstance;
1294 wc->hIcon = wcex.hIcon;
1295 wc->hCursor = wcex.hCursor;
1296 wc->hbrBackground = wcex.hbrBackground;
1297 wc->lpszMenuName = wcex.lpszMenuName;
1298 wc->lpszClassName = wcex.lpszClassName;
1300 return ret;
1304 /***********************************************************************
1305 * GetClassInfoExA (USER32.@)
1307 BOOL WINAPI GetClassInfoExA( HINSTANCE hInstance, LPCSTR name, WNDCLASSEXA *wc )
1309 ATOM atom;
1310 CLASS *classPtr;
1312 TRACE("%p %s %p\n", hInstance, debugstr_a(name), wc);
1314 if (!wc)
1316 SetLastError( ERROR_NOACCESS );
1317 return FALSE;
1320 if (!hInstance) hInstance = user32_module;
1322 if (!IS_INTRESOURCE(name))
1324 WCHAR nameW[MAX_ATOM_LEN + 1];
1325 if (!MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, ARRAY_SIZE( nameW )))
1326 return FALSE;
1327 classPtr = CLASS_FindClass( nameW, hInstance );
1329 else classPtr = CLASS_FindClass( (LPCWSTR)name, hInstance );
1331 if (!classPtr)
1333 SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
1334 return FALSE;
1336 wc->style = classPtr->style;
1337 wc->lpfnWndProc = WINPROC_GetProc( classPtr->winproc, FALSE );
1338 wc->cbClsExtra = classPtr->cbClsExtra;
1339 wc->cbWndExtra = classPtr->cbWndExtra;
1340 wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
1341 wc->hIcon = classPtr->hIcon;
1342 wc->hIconSm = classPtr->hIconSm ? classPtr->hIconSm : classPtr->hIconSmIntern;
1343 wc->hCursor = classPtr->hCursor;
1344 wc->hbrBackground = classPtr->hbrBackground;
1345 wc->lpszMenuName = CLASS_GetMenuNameA( classPtr );
1346 wc->lpszClassName = name;
1347 atom = classPtr->atomName;
1348 release_class_ptr( classPtr );
1350 /* We must return the atom of the class here instead of just TRUE. */
1351 return atom;
1355 /***********************************************************************
1356 * GetClassInfoExW (USER32.@)
1358 BOOL WINAPI GetClassInfoExW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSEXW *wc )
1360 ATOM atom;
1361 CLASS *classPtr;
1363 TRACE("%p %s %p\n", hInstance, debugstr_w(name), wc);
1365 if (!wc)
1367 SetLastError( ERROR_NOACCESS );
1368 return FALSE;
1371 if (!hInstance) hInstance = user32_module;
1373 if (!(classPtr = CLASS_FindClass( name, hInstance )))
1375 SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
1376 return FALSE;
1378 wc->style = classPtr->style;
1379 wc->lpfnWndProc = WINPROC_GetProc( classPtr->winproc, TRUE );
1380 wc->cbClsExtra = classPtr->cbClsExtra;
1381 wc->cbWndExtra = classPtr->cbWndExtra;
1382 wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
1383 wc->hIcon = classPtr->hIcon;
1384 wc->hIconSm = classPtr->hIconSm ? classPtr->hIconSm : classPtr->hIconSmIntern;
1385 wc->hCursor = classPtr->hCursor;
1386 wc->hbrBackground = classPtr->hbrBackground;
1387 wc->lpszMenuName = CLASS_GetMenuNameW( classPtr );
1388 wc->lpszClassName = name;
1389 atom = classPtr->atomName;
1390 release_class_ptr( classPtr );
1392 /* We must return the atom of the class here instead of just TRUE. */
1393 return atom;
1397 #if 0 /* toolhelp is in kernel, so this cannot work */
1399 /***********************************************************************
1400 * ClassFirst (TOOLHELP.69)
1402 BOOL16 WINAPI ClassFirst16( CLASSENTRY *pClassEntry )
1404 TRACE("%p\n",pClassEntry);
1405 pClassEntry->wNext = 1;
1406 return ClassNext16( pClassEntry );
1410 /***********************************************************************
1411 * ClassNext (TOOLHELP.70)
1413 BOOL16 WINAPI ClassNext16( CLASSENTRY *pClassEntry )
1415 int i;
1416 CLASS *class = firstClass;
1418 TRACE("%p\n",pClassEntry);
1420 if (!pClassEntry->wNext) return FALSE;
1421 for (i = 1; (i < pClassEntry->wNext) && class; i++) class = class->next;
1422 if (!class)
1424 pClassEntry->wNext = 0;
1425 return FALSE;
1427 pClassEntry->hInst = class->hInstance;
1428 pClassEntry->wNext++;
1429 GlobalGetAtomNameA( class->atomName, pClassEntry->szClassName,
1430 sizeof(pClassEntry->szClassName) );
1431 return TRUE;
1433 #endif
1435 /* 64bit versions */
1437 #ifdef GetClassLongPtrA
1438 #undef GetClassLongPtrA
1439 #endif
1441 #ifdef GetClassLongPtrW
1442 #undef GetClassLongPtrW
1443 #endif
1445 #ifdef SetClassLongPtrA
1446 #undef SetClassLongPtrA
1447 #endif
1449 #ifdef SetClassLongPtrW
1450 #undef SetClassLongPtrW
1451 #endif
1453 /***********************************************************************
1454 * GetClassLongPtrA (USER32.@)
1456 ULONG_PTR WINAPI GetClassLongPtrA( HWND hwnd, INT offset )
1458 return CLASS_GetClassLong( hwnd, offset, sizeof(ULONG_PTR), FALSE );
1461 /***********************************************************************
1462 * GetClassLongPtrW (USER32.@)
1464 ULONG_PTR WINAPI GetClassLongPtrW( HWND hwnd, INT offset )
1466 return CLASS_GetClassLong( hwnd, offset, sizeof(ULONG_PTR), TRUE );
1469 /***********************************************************************
1470 * SetClassLongPtrW (USER32.@)
1472 ULONG_PTR WINAPI SetClassLongPtrW( HWND hwnd, INT offset, LONG_PTR newval )
1474 return CLASS_SetClassLong( hwnd, offset, newval, sizeof(LONG_PTR), TRUE );
1477 /***********************************************************************
1478 * SetClassLongPtrA (USER32.@)
1480 ULONG_PTR WINAPI SetClassLongPtrA( HWND hwnd, INT offset, LONG_PTR newval )
1482 return CLASS_SetClassLong( hwnd, offset, newval, sizeof(LONG_PTR), FALSE );