blob: 19ae80690006784c2265dc0cfe13adcc4e8c17f0 [file] [log] [blame]
Alexandre Julliard401710d1993-09-04 10:09:32 +00001/*
2 * Window classes functions
3 *
Alexandre Julliardbfce1512003-12-10 04:08:06 +00004 * Copyright 1993, 1996, 2003 Alexandre Julliard
5 * Copyright 1998 Juergen Schmied (jsch)
Alexandre Julliard21979011997-03-05 08:22:35 +00006 *
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00007 * 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.
11 *
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.
16 *
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
Alexandre Julliardbd34d4f1995-06-20 19:08:12 +000020 */
Alexandre Julliard401710d1993-09-04 10:09:32 +000021
François Gouget14259412001-11-06 20:57:11 +000022#include "config.h"
Francois Gouget386cf6e2001-10-14 16:25:47 +000023#include "wine/port.h"
24
Alexandre Julliardbfce1512003-12-10 04:08:06 +000025#include <assert.h>
Alexandre Julliarde37c6e12003-09-05 23:08:26 +000026#include <stdarg.h>
Alexandre Julliard8d24ae61994-04-05 21:42:43 +000027#include <stdlib.h>
Alexandre Julliard8d24ae61994-04-05 21:42:43 +000028#include <string.h>
Francois Gouget386cf6e2001-10-14 16:25:47 +000029
Marcus Meissner317af321999-02-17 13:51:06 +000030#include "wine/winbase16.h"
Alexandre Julliardc7e7df82000-08-14 14:41:19 +000031#include "winerror.h"
32#include "windef.h"
Alexandre Julliarde37c6e12003-09-05 23:08:26 +000033#include "winbase.h"
Alexandre Julliardc7e7df82000-08-14 14:41:19 +000034#include "wingdi.h"
35#include "wine/winuser16.h"
Alexandre Julliard0ca051e2002-10-17 16:43:42 +000036#include "wownt32.h"
Alexandre Julliardc7e7df82000-08-14 14:41:19 +000037#include "wine/unicode.h"
Alexandre Julliard401710d1993-09-04 10:09:32 +000038#include "win.h"
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +000039#include "user.h"
Alexandre Julliard91222da2000-12-10 23:01:33 +000040#include "controls.h"
Alexandre Julliard5f721f81994-01-04 20:14:34 +000041#include "dce.h"
Alexandre Julliard2d93d001996-05-21 15:01:41 +000042#include "winproc.h"
Alexandre Julliardbfce1512003-12-10 04:08:06 +000043#include "wine/server.h"
44#include "wine/list.h"
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000045#include "wine/debug.h"
Alexandre Julliard8d24ae61994-04-05 21:42:43 +000046
Alexandre Julliard0799c1a2002-03-09 23:29:33 +000047WINE_DEFAULT_DEBUG_CHANNEL(class);
Patrik Stridvallb4b9fae1999-04-19 14:56:29 +000048
Alexandre Julliard98779062000-12-07 23:39:16 +000049typedef struct tagCLASS
50{
Alexandre Julliardbfce1512003-12-10 04:08:06 +000051 struct list entry; /* Entry in class list */
Alexandre Julliard98779062000-12-07 23:39:16 +000052 UINT style; /* Class style */
Alexandre Julliardbfce1512003-12-10 04:08:06 +000053 BOOL local; /* Local class? */
Alexandre Julliard18d02972002-12-03 23:34:52 +000054 WNDPROC winprocA; /* Window procedure (ASCII) */
55 WNDPROC winprocW; /* Window procedure (Unicode) */
Alexandre Julliard98779062000-12-07 23:39:16 +000056 INT cbClsExtra; /* Class extra bytes */
57 INT cbWndExtra; /* Window extra bytes */
58 LPWSTR menuName; /* Default menu name (Unicode followed by ASCII) */
Alexandre Julliardd7b76822001-12-20 00:19:40 +000059 SEGPTR segMenuName; /* Default menu name as SEGPTR */
Alexandre Julliard98779062000-12-07 23:39:16 +000060 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 */
Alexandre Julliard98779062000-12-07 23:39:16 +000067} CLASS;
Alexandre Julliard401710d1993-09-04 10:09:32 +000068
Alexandre Julliardbfce1512003-12-10 04:08:06 +000069static struct list class_list = LIST_INIT( class_list );
Alexandre Julliardbd13ab82003-12-11 05:34:53 +000070static CLASS *desktop_class;
Alexandre Julliardbfce1512003-12-10 04:08:06 +000071static HMODULE user32_module;
72
73#define CLASS_OTHER_PROCESS ((CLASS *)1)
Alexandre Julliard401710d1993-09-04 10:09:32 +000074
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +000075/***********************************************************************
76 * get_class_ptr
77 */
Alexandre Julliard8fd26b92001-10-15 17:56:45 +000078static CLASS *get_class_ptr( HWND hwnd, BOOL write_access )
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +000079{
Alexandre Julliard8fd26b92001-10-15 17:56:45 +000080 WND *ptr = WIN_GetPtr( hwnd );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +000081
Alexandre Julliard8fd26b92001-10-15 17:56:45 +000082 if (ptr)
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +000083 {
Alexandre Julliard8fd26b92001-10-15 17:56:45 +000084 if (ptr != WND_OTHER_PROCESS) return ptr->class;
Alexandre Julliardbfce1512003-12-10 04:08:06 +000085 if (write_access && IsWindow( hwnd )) /* check other processes */
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +000086 {
Alexandre Julliardbfce1512003-12-10 04:08:06 +000087 /* modifying classes in other processes is not allowed */
88 SetLastError( ERROR_ACCESS_DENIED );
89 return NULL;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +000090 }
Alexandre Julliardbfce1512003-12-10 04:08:06 +000091 return CLASS_OTHER_PROCESS;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +000092 }
Alexandre Julliard8fd26b92001-10-15 17:56:45 +000093 SetLastError( ERROR_INVALID_WINDOW_HANDLE );
94 return NULL;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +000095}
96
97
98/***********************************************************************
99 * release_class_ptr
100 */
101inline static void release_class_ptr( CLASS *ptr )
102{
103 USER_Unlock();
104}
105
Alexandre Julliard401710d1993-09-04 10:09:32 +0000106
107/***********************************************************************
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000108 * set_server_info
109 *
110 * Set class info with the wine server.
111 */
112static BOOL set_server_info( HWND hwnd, INT offset, LONG newval )
113{
114 BOOL ret;
115
116 SERVER_START_REQ( set_class_info )
117 {
118 req->window = hwnd;
119 req->extra_offset = -1;
120 switch(offset)
121 {
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;
144 }
145 ret = !wine_server_call_err( req );
146 }
147 SERVER_END_REQ;
148 return ret;
149}
150
151
152/***********************************************************************
Alexandre Julliard98779062000-12-07 23:39:16 +0000153 * CLASS_GetProc
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000154 *
Alexandre Julliard98779062000-12-07 23:39:16 +0000155 * Get the class winproc for a given proc type
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000156 */
Alexandre Julliard98779062000-12-07 23:39:16 +0000157static WNDPROC16 CLASS_GetProc( CLASS *classPtr, WINDOWPROCTYPE type )
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000158{
Alexandre Julliard18d02972002-12-03 23:34:52 +0000159 WNDPROC proc = classPtr->winprocA;
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000160
Alexandre Julliard98779062000-12-07 23:39:16 +0000161 if (classPtr->winprocW)
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000162 {
Alexandre Julliard98779062000-12-07 23:39:16 +0000163 /* if we have a Unicode proc, use it if we have no ASCII proc
164 * or if we have both and Unicode was requested
165 */
166 if (!proc || type == WIN_PROC_32W) proc = classPtr->winprocW;
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000167 }
Alexandre Julliard98779062000-12-07 23:39:16 +0000168 return WINPROC_GetProc( proc, type );
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000169}
170
171
172/***********************************************************************
Alexandre Julliard98779062000-12-07 23:39:16 +0000173 * CLASS_SetProc
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000174 *
Alexandre Julliard98779062000-12-07 23:39:16 +0000175 * Set the class winproc for a given proc type.
176 * Returns the previous window proc.
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000177 */
Alexandre Julliard98779062000-12-07 23:39:16 +0000178static WNDPROC16 CLASS_SetProc( CLASS *classPtr, WNDPROC newproc, WINDOWPROCTYPE type )
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000179{
Alexandre Julliard18d02972002-12-03 23:34:52 +0000180 WNDPROC *proc = &classPtr->winprocA;
Alexandre Julliard98779062000-12-07 23:39:16 +0000181 WNDPROC16 ret;
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000182
Alexandre Julliard98779062000-12-07 23:39:16 +0000183 if (classPtr->winprocW)
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000184 {
Alexandre Julliard98779062000-12-07 23:39:16 +0000185 /* if we have a Unicode proc, use it if we have no ASCII proc
186 * or if we have both and Unicode was requested
187 */
188 if (!*proc || type == WIN_PROC_32W) proc = &classPtr->winprocW;
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000189 }
Alexandre Julliard98779062000-12-07 23:39:16 +0000190 ret = WINPROC_GetProc( *proc, type );
Alexandre Julliard18d02972002-12-03 23:34:52 +0000191 WINPROC_SetProc( proc, newproc, type, WIN_PROC_CLASS );
Alexandre Julliard98779062000-12-07 23:39:16 +0000192 /* now free the one that we didn't set */
193 if (classPtr->winprocA && classPtr->winprocW)
194 {
195 if (proc == &classPtr->winprocA)
196 {
197 WINPROC_FreeProc( classPtr->winprocW, WIN_PROC_CLASS );
198 classPtr->winprocW = 0;
199 }
200 else
201 {
202 WINPROC_FreeProc( classPtr->winprocA, WIN_PROC_CLASS );
203 classPtr->winprocA = 0;
204 }
205 }
206 return ret;
Alexandre Julliardb817f4f1996-03-14 18:08:34 +0000207}
208
209
210/***********************************************************************
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000211 * CLASS_GetMenuNameA
212 *
213 * Get the menu name as a ASCII string.
214 */
Alexandre Julliard98779062000-12-07 23:39:16 +0000215inline static LPSTR CLASS_GetMenuNameA( CLASS *classPtr )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000216{
Alexandre Julliard98779062000-12-07 23:39:16 +0000217 if (!HIWORD(classPtr->menuName)) return (LPSTR)classPtr->menuName;
218 return (LPSTR)(classPtr->menuName + strlenW(classPtr->menuName) + 1);
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000219}
220
221
222/***********************************************************************
Alexandre Julliardd7b76822001-12-20 00:19:40 +0000223 * CLASS_GetMenuName16
224 *
225 * Get the menu name as a SEGPTR.
226 */
227inline static SEGPTR CLASS_GetMenuName16( CLASS *classPtr )
228{
229 if (!HIWORD(classPtr->menuName)) return (SEGPTR)classPtr->menuName;
230 if (!classPtr->segMenuName)
231 classPtr->segMenuName = MapLS( CLASS_GetMenuNameA(classPtr) );
232 return classPtr->segMenuName;
233}
234
235
236/***********************************************************************
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000237 * CLASS_GetMenuNameW
238 *
239 * Get the menu name as a Unicode string.
240 */
Alexandre Julliard98779062000-12-07 23:39:16 +0000241inline static LPWSTR CLASS_GetMenuNameW( CLASS *classPtr )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000242{
Alexandre Julliard98779062000-12-07 23:39:16 +0000243 return classPtr->menuName;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000244}
245
246
247/***********************************************************************
248 * CLASS_SetMenuNameA
249 *
250 * Set the menu name in a class structure by copying the string.
251 */
252static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name )
253{
Alexandre Julliardd7b76822001-12-20 00:19:40 +0000254 UnMapLS( classPtr->segMenuName );
255 classPtr->segMenuName = 0;
256 if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
Alexandre Julliard98779062000-12-07 23:39:16 +0000257 if (HIWORD(name))
258 {
259 DWORD lenA = strlen(name) + 1;
260 DWORD lenW = MultiByteToWideChar( CP_ACP, 0, name, lenA, NULL, 0 );
Alexandre Julliardd7b76822001-12-20 00:19:40 +0000261 classPtr->menuName = HeapAlloc( GetProcessHeap(), 0, lenA + lenW*sizeof(WCHAR) );
Alexandre Julliard98779062000-12-07 23:39:16 +0000262 MultiByteToWideChar( CP_ACP, 0, name, lenA, classPtr->menuName, lenW );
263 memcpy( classPtr->menuName + lenW, name, lenA );
264 }
265 else classPtr->menuName = (LPWSTR)name;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000266}
267
268
269/***********************************************************************
270 * CLASS_SetMenuNameW
271 *
272 * Set the menu name in a class structure by copying the string.
273 */
274static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name )
275{
Alexandre Julliardd7b76822001-12-20 00:19:40 +0000276 UnMapLS( classPtr->segMenuName );
277 classPtr->segMenuName = 0;
278 if (HIWORD(classPtr->menuName)) HeapFree( GetProcessHeap(), 0, classPtr->menuName );
Alexandre Julliard98779062000-12-07 23:39:16 +0000279 if (HIWORD(name))
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000280 {
Alexandre Julliard98779062000-12-07 23:39:16 +0000281 DWORD lenW = strlenW(name) + 1;
282 DWORD lenA = WideCharToMultiByte( CP_ACP, 0, name, lenW, NULL, 0, NULL, NULL );
Alexandre Julliardd7b76822001-12-20 00:19:40 +0000283 classPtr->menuName = HeapAlloc( GetProcessHeap(), 0, lenA + lenW*sizeof(WCHAR) );
Alexandre Julliard98779062000-12-07 23:39:16 +0000284 memcpy( classPtr->menuName, name, lenW*sizeof(WCHAR) );
285 WideCharToMultiByte( CP_ACP, 0, name, lenW,
286 (char *)(classPtr->menuName + lenW), lenA, NULL, NULL );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000287 }
Alexandre Julliard98779062000-12-07 23:39:16 +0000288 else classPtr->menuName = (LPWSTR)name;
Gavriel Statec77c5921998-11-15 09:21:17 +0000289}
290
291
292/***********************************************************************
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000293 * CLASS_FreeClass
294 *
295 * Free a class structure.
296 */
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000297static void CLASS_FreeClass( CLASS *classPtr )
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000298{
Alexandre Julliard98779062000-12-07 23:39:16 +0000299 TRACE("%p\n", classPtr);
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000300
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000301 USER_Lock();
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000302
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000303 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();
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000313}
314
315
316/***********************************************************************
317 * CLASS_FreeModuleClasses
318 */
Alexandre Julliard3051b641996-07-05 17:14:13 +0000319void CLASS_FreeModuleClasses( HMODULE16 hModule )
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000320{
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000321 struct list *ptr, *next;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000322
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000323 TRACE("0x%08x\n", hModule);
324
325 USER_Lock();
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000326 for (ptr = list_head( &class_list ); ptr; ptr = next)
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000327 {
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000328 CLASS *class = LIST_ENTRY( ptr, CLASS, entry );
329 next = list_next( &class_list, ptr );
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000330 if (class->hInstance == HINSTANCE_32(hModule))
331 {
332 BOOL ret;
333
334 SERVER_START_REQ( destroy_class )
335 {
336 req->atom = class->atomName;
337 req->instance = class->hInstance;
338 ret = !wine_server_call_err( req );
339 }
340 SERVER_END_REQ;
341 if (ret) CLASS_FreeClass( class );
342 }
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000343 }
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000344 USER_Unlock();
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000345}
346
347
348/***********************************************************************
Alexandre Julliard1285c2f1996-05-06 16:06:24 +0000349 * CLASS_FindClassByAtom
350 *
351 * Return a pointer to the class.
Alexandre Julliard77b99181997-09-14 17:17:23 +0000352 * hinstance has been normalized by the caller.
Alexandre Julliard1285c2f1996-05-06 16:06:24 +0000353 */
Alexandre Julliard98779062000-12-07 23:39:16 +0000354static CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE hinstance )
355{
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000356 struct list *ptr;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000357
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000358 USER_Lock();
359
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000360 LIST_FOR_EACH( ptr, &class_list )
Alexandre Julliard1285c2f1996-05-06 16:06:24 +0000361 {
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000362 CLASS *class = LIST_ENTRY( ptr, CLASS, entry );
363 if (class->atomName != atom) continue;
364 if (!hinstance || !class->local || class->hInstance == hinstance)
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000365 {
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000366 TRACE("0x%04x %p -> %p\n", atom, hinstance, class);
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000367 return class;
368 }
Alexandre Julliard1285c2f1996-05-06 16:06:24 +0000369 }
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000370 USER_Unlock();
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000371 TRACE("0x%04x %p -> not found\n", atom, hinstance);
372 return NULL;
Alexandre Julliard1285c2f1996-05-06 16:06:24 +0000373}
374
375
376/***********************************************************************
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000377 * CLASS_RegisterClass
378 *
379 * The real RegisterClass() functionality.
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000380 * The atom is deleted no matter what.
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000381 */
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000382static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE hInstance, BOOL local,
Alexandre Julliard98779062000-12-07 23:39:16 +0000383 DWORD style, INT classExtra, INT winExtra )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000384{
385 CLASS *classPtr;
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000386 BOOL ret;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000387
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000388 TRACE("atom=0x%x hinst=%p style=0x%lx clExtr=0x%x winExtr=0x%x\n",
Alexandre Julliard98779062000-12-07 23:39:16 +0000389 atom, hInstance, style, classExtra, winExtra );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000390
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000391 /* Fix the extra bytes value */
392
393 if (classExtra < 0) classExtra = 0;
394 else if (classExtra > 40) /* Extra bytes are limited to 40 in Win32 */
Alexandre Julliard359f497e1999-07-04 16:02:24 +0000395 WARN("Class extra bytes %d is > 40\n", classExtra);
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000396 if (winExtra < 0) winExtra = 0;
397 else if (winExtra > 40) /* Extra bytes are limited to 40 in Win32 */
Alexandre Julliard359f497e1999-07-04 16:02:24 +0000398 WARN("Win extra bytes %d is > 40\n", winExtra );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000399
Alexandre Julliardd44e4952001-08-20 18:09:39 +0000400 classPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLASS) + classExtra );
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000401 if (!classPtr)
402 {
403 GlobalDeleteAtom( atom );
404 return NULL;
405 }
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000406
407 SERVER_START_REQ( create_class )
408 {
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000409 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;
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000416 ret = !wine_server_call_err( req );
417 }
418 SERVER_END_REQ;
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000419 GlobalDeleteAtom( atom ); /* the server increased the atom ref count */
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000420 if (!ret)
421 {
422 HeapFree( GetProcessHeap(), 0, classPtr );
423 return NULL;
424 }
425
Alexandre Julliard2d93d001996-05-21 15:01:41 +0000426 classPtr->style = style;
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000427 classPtr->local = local;
Alexandre Julliard2d93d001996-05-21 15:01:41 +0000428 classPtr->cbWndExtra = winExtra;
429 classPtr->cbClsExtra = classExtra;
430 classPtr->hInstance = hInstance;
431 classPtr->atomName = atom;
Alexandre Julliard98779062000-12-07 23:39:16 +0000432 classPtr->dce = (style & CS_CLASSDC) ? DCE_AllocDCE( 0, DCE_CLASS_DC ) : NULL;
Alexandre Julliard2c69f6d1996-09-28 18:11:01 +0000433
Alexandre Julliard98779062000-12-07 23:39:16 +0000434 /* Other non-null values must be set by caller */
Alexandre Julliard3051b641996-07-05 17:14:13 +0000435
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000436 USER_Lock();
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000437 if (local) list_add_head( &class_list, &classPtr->entry );
438 else list_add_tail( &class_list, &classPtr->entry );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000439 return classPtr;
440}
441
442
443/***********************************************************************
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000444 * register_builtin
Alexandre Julliard98779062000-12-07 23:39:16 +0000445 *
446 * Register a builtin control class.
447 * This allows having both ASCII and Unicode winprocs for the same class.
448 */
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000449static CLASS *register_builtin( const struct builtin_class_descr *descr )
Alexandre Julliard98779062000-12-07 23:39:16 +0000450{
451 ATOM atom;
452 CLASS *classPtr;
453
Alexandre Julliard91222da2000-12-10 23:01:33 +0000454 if (!(atom = GlobalAddAtomA( descr->name ))) return 0;
Alexandre Julliard98779062000-12-07 23:39:16 +0000455
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000456 if (!(classPtr = CLASS_RegisterClass( atom, user32_module, FALSE,
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000457 descr->style, 0, descr->extra ))) return 0;
Alexandre Julliard98779062000-12-07 23:39:16 +0000458
Alexandre Julliardcf526442003-09-10 03:56:47 +0000459 classPtr->hCursor = LoadCursorA( 0, (LPSTR)descr->cursor );
Alexandre Julliard91222da2000-12-10 23:01:33 +0000460 classPtr->hbrBackground = descr->brush;
Alexandre Julliard98779062000-12-07 23:39:16 +0000461
Alexandre Julliard18d02972002-12-03 23:34:52 +0000462 if (descr->procA) WINPROC_SetProc( &classPtr->winprocA, descr->procA,
Alexandre Julliard91222da2000-12-10 23:01:33 +0000463 WIN_PROC_32A, WIN_PROC_CLASS );
Alexandre Julliard18d02972002-12-03 23:34:52 +0000464 if (descr->procW) WINPROC_SetProc( &classPtr->winprocW, descr->procW,
Alexandre Julliard91222da2000-12-10 23:01:33 +0000465 WIN_PROC_32W, WIN_PROC_CLASS );
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000466 release_class_ptr( classPtr );
467 return classPtr;
Alexandre Julliard98779062000-12-07 23:39:16 +0000468}
469
470
471/***********************************************************************
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000472 * CLASS_RegisterBuiltinClasses
473 */
474void CLASS_RegisterBuiltinClasses( HMODULE user32 )
475{
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;
488
489 user32_module = user32;
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000490 desktop_class = register_builtin( &DESKTOP_builtin_class );
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000491 register_builtin( &BUTTON_builtin_class );
492 register_builtin( &COMBO_builtin_class );
493 register_builtin( &COMBOLBOX_builtin_class );
494 register_builtin( &DIALOG_builtin_class );
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000495 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 );
502}
503
504
505/***********************************************************************
Alexandre Julliard98779062000-12-07 23:39:16 +0000506 * CLASS_AddWindow
507 *
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000508 * Add a new window using this class, and set the necessary
509 * information inside the window structure.
Alexandre Julliard98779062000-12-07 23:39:16 +0000510 */
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000511void CLASS_AddWindow( CLASS *class, WND *win, WINDOWPROCTYPE type )
Alexandre Julliard98779062000-12-07 23:39:16 +0000512{
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000513 if (!class) class = desktop_class;
Alexandre Julliard98779062000-12-07 23:39:16 +0000514
515 if (type == WIN_PROC_32W)
516 {
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000517 if (!(win->winproc = class->winprocW)) win->winproc = class->winprocA;
Alexandre Julliard98779062000-12-07 23:39:16 +0000518 }
519 else
520 {
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000521 if (!(win->winproc = class->winprocA)) win->winproc = class->winprocW;
Alexandre Julliard98779062000-12-07 23:39:16 +0000522 }
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000523 win->class = class;
524 win->clsStyle = class->style;
525 win->dce = class->dce;
Alexandre Julliard98779062000-12-07 23:39:16 +0000526}
527
528
529/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000530 * RegisterClass (USER.57)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000531 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000532ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000533{
Alexandre Julliard5f325662003-12-10 01:46:52 +0000534 WNDCLASSEX16 wcex;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000535
Alexandre Julliard5f325662003-12-10 01:46:52 +0000536 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 );
Alexandre Julliard401710d1993-09-04 10:09:32 +0000549}
550
551
552/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000553 * RegisterClassA (USER32.@)
Alexandre Julliarda69b88b1998-03-15 20:29:56 +0000554 * RETURNS
555 * >0: Unique identifier
556 * 0: Failure
Alexandre Julliard401710d1993-09-04 10:09:32 +0000557 */
Patrik Stridvall2b3aa612000-12-01 23:58:28 +0000558ATOM WINAPI RegisterClassA( const WNDCLASSA* wc ) /* [in] Address of structure with class data */
Alexandre Julliardf681cd02000-08-23 19:18:44 +0000559{
Alexandre Julliard5f325662003-12-10 01:46:52 +0000560 WNDCLASSEXA wcex;
Alexandre Julliard1285c2f1996-05-06 16:06:24 +0000561
Alexandre Julliard5f325662003-12-10 01:46:52 +0000562 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 );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000575}
576
577
578/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000579 * RegisterClassW (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000580 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000581ATOM WINAPI RegisterClassW( const WNDCLASSW* wc )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000582{
Alexandre Julliard5f325662003-12-10 01:46:52 +0000583 WNDCLASSEXW wcex;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000584
Alexandre Julliard5f325662003-12-10 01:46:52 +0000585 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 );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000598}
599
600
601/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000602 * RegisterClassEx (USER.397)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000603 */
Alexandre Julliard670cdc41997-08-24 16:00:30 +0000604ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000605{
606 ATOM atom;
607 CLASS *classPtr;
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000608 HINSTANCE hInstance;
609
610 if (!(hInstance = HINSTANCE_32(GetExePtr(wc->hInstance))))
611 hInstance = HINSTANCE_32(GetModuleHandle16(NULL));
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000612
Alexandre Julliard982a2232000-12-13 20:20:09 +0000613 if (!(atom = GlobalAddAtomA( MapSL(wc->lpszClassName) ))) return 0;
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000614 if (!(classPtr = CLASS_RegisterClass( atom, hInstance, !(wc->style & CS_GLOBALCLASS),
615 wc->style, wc->cbClsExtra, wc->cbWndExtra )))
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000616 return 0;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000617
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000618 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 );
Vincent Béron9a624912002-05-31 23:06:46 +0000622
Michael Stefaniucbc54d782002-10-10 21:22:09 +0000623 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);
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000627
Alexandre Julliard18d02972002-12-03 23:34:52 +0000628 WINPROC_SetProc( &classPtr->winprocA, (WNDPROC)wc->lpfnWndProc,
Alexandre Julliard98779062000-12-07 23:39:16 +0000629 WIN_PROC_16, WIN_PROC_CLASS );
Alexandre Julliard982a2232000-12-13 20:20:09 +0000630 CLASS_SetMenuNameA( classPtr, MapSL(wc->lpszMenuName) );
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000631 release_class_ptr( classPtr );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000632 return atom;
633}
634
635
636/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000637 * RegisterClassExA (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000638 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000639ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000640{
641 ATOM atom;
642 CLASS *classPtr;
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000643 HINSTANCE instance;
644
645 if (wc->hInstance == user32_module)
646 {
647 /* we can't register a class for user32 */
648 SetLastError( ERROR_INVALID_PARAMETER );
649 return 0;
650 }
651 if (!(instance = wc->hInstance)) instance = GetModuleHandleW( NULL );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000652
Alexandre Julliardf681cd02000-08-23 19:18:44 +0000653 if (!(atom = GlobalAddAtomA( wc->lpszClassName ))) return 0;
654
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000655 if (!(classPtr = CLASS_RegisterClass( atom, instance, !(wc->style & CS_GLOBALCLASS),
656 wc->style, wc->cbClsExtra, wc->cbWndExtra )))
Alexandre Julliard98779062000-12-07 23:39:16 +0000657 return 0;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000658
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000659 TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n",
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000660 atom, wc->lpfnWndProc, instance, wc->hbrBackground,
661 wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr );
Vincent Béron9a624912002-05-31 23:06:46 +0000662
Michael Stefaniucbc54d782002-10-10 21:22:09 +0000663 classPtr->hIcon = wc->hIcon;
664 classPtr->hIconSm = wc->hIconSm;
665 classPtr->hCursor = wc->hCursor;
666 classPtr->hbrBackground = wc->hbrBackground;
Alexandre Julliard18d02972002-12-03 23:34:52 +0000667 WINPROC_SetProc( &classPtr->winprocA, wc->lpfnWndProc, WIN_PROC_32A, WIN_PROC_CLASS );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000668 CLASS_SetMenuNameA( classPtr, wc->lpszMenuName );
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000669 release_class_ptr( classPtr );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000670 return atom;
671}
672
673
674/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000675 * RegisterClassExW (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000676 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000677ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000678{
679 ATOM atom;
680 CLASS *classPtr;
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000681 HINSTANCE instance;
682
683 if (wc->hInstance == user32_module)
684 {
685 /* we can't register a class for user32 */
686 SetLastError( ERROR_INVALID_PARAMETER );
687 return 0;
688 }
689 if (!(instance = wc->hInstance)) instance = GetModuleHandleW( NULL );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000690
Alexandre Julliardf681cd02000-08-23 19:18:44 +0000691 if (!(atom = GlobalAddAtomW( wc->lpszClassName ))) return 0;
692
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000693 if (!(classPtr = CLASS_RegisterClass( atom, instance, !(wc->style & CS_GLOBALCLASS),
694 wc->style, wc->cbClsExtra, wc->cbWndExtra )))
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000695 return 0;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000696
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000697 TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n",
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000698 atom, wc->lpfnWndProc, instance, wc->hbrBackground,
699 wc->style, wc->cbClsExtra, wc->cbWndExtra, classPtr );
Vincent Béron9a624912002-05-31 23:06:46 +0000700
Michael Stefaniucbc54d782002-10-10 21:22:09 +0000701 classPtr->hIcon = wc->hIcon;
702 classPtr->hIconSm = wc->hIconSm;
703 classPtr->hCursor = wc->hCursor;
704 classPtr->hbrBackground = wc->hbrBackground;
Alexandre Julliard18d02972002-12-03 23:34:52 +0000705 WINPROC_SetProc( &classPtr->winprocW, wc->lpfnWndProc, WIN_PROC_32W, WIN_PROC_CLASS );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000706 CLASS_SetMenuNameW( classPtr, wc->lpszMenuName );
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000707 release_class_ptr( classPtr );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000708 return atom;
Alexandre Julliard1285c2f1996-05-06 16:06:24 +0000709}
710
711
712/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000713 * UnregisterClass (USER.403)
Alexandre Julliard1285c2f1996-05-06 16:06:24 +0000714 */
Alexandre Julliardb849d792000-02-13 13:56:13 +0000715BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000716{
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000717 if (hInstance == GetModuleHandle16("user")) hInstance = 0;
Alexandre Julliarda8a422f2002-11-22 20:43:01 +0000718 return UnregisterClassA( className, HINSTANCE_32(GetExePtr( hInstance )) );
Alexandre Julliard401710d1993-09-04 10:09:32 +0000719}
720
Alexandre Julliard401710d1993-09-04 10:09:32 +0000721/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000722 * UnregisterClassA (USER32.@)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000723 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000724BOOL WINAPI UnregisterClassA( LPCSTR className, HINSTANCE hInstance )
Alexandre Julliard98779062000-12-07 23:39:16 +0000725{
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000726 ATOM atom = HIWORD(className) ? GlobalFindAtomA( className ) : LOWORD(className);
727 return UnregisterClassW( MAKEINTATOMW(atom), hInstance );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000728}
729
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000730/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000731 * UnregisterClassW (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000732 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000733BOOL WINAPI UnregisterClassW( LPCWSTR className, HINSTANCE hInstance )
Alexandre Julliard98779062000-12-07 23:39:16 +0000734{
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000735 CLASS *classPtr = NULL;
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000736 ATOM atom = HIWORD(className) ? GlobalFindAtomW( className ) : LOWORD(className);
737
738 TRACE("%s %p %x\n",debugstr_w(className), hInstance, atom);
739
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000740 if (!atom)
741 {
742 SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
743 return FALSE;
744 }
745
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000746 if (!hInstance) hInstance = GetModuleHandleW( NULL );
747
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000748 SERVER_START_REQ( destroy_class )
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000749 {
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000750 req->atom = atom;
751 req->instance = hInstance;
752 if (!wine_server_call_err( req )) classPtr = reply->client_ptr;
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000753 }
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000754 SERVER_END_REQ;
755
756 if (classPtr) CLASS_FreeClass( classPtr );
757 return (classPtr != NULL);
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000758}
759
Alexandre Julliard21979011997-03-05 08:22:35 +0000760
761/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000762 * GetClassWord (USER32.@)
Alexandre Julliard21979011997-03-05 08:22:35 +0000763 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000764WORD WINAPI GetClassWord( HWND hwnd, INT offset )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000765{
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000766 CLASS *class;
Guy Albertelli2fa281f1999-04-24 11:54:40 +0000767 WORD retvalue = 0;
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000768
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000769 if (offset < 0) return GetClassLongA( hwnd, offset );
770
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000771 TRACE("%p %x\n",hwnd, offset);
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000772
Alexandre Julliard8fd26b92001-10-15 17:56:45 +0000773 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000774
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000775 if (class == CLASS_OTHER_PROCESS)
776 {
777 SERVER_START_REQ( set_class_info )
778 {
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) );
785 }
786 SERVER_END_REQ;
787 return retvalue;
788 }
789
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000790 if (offset <= class->cbClsExtra - sizeof(WORD))
Alexandre Julliard7fbd74e2002-05-23 02:53:10 +0000791 memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000792 else
793 SetLastError( ERROR_INVALID_INDEX );
794 release_class_ptr( class );
Guy Albertelli2fa281f1999-04-24 11:54:40 +0000795 return retvalue;
Alexandre Julliard401710d1993-09-04 10:09:32 +0000796}
797
798
799/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000800 * GetClassLong (USER.131)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000801 */
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000802LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000803{
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000804 CLASS *class;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000805 LONG ret;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000806 HWND hwnd = (HWND)(ULONG_PTR)hwnd16; /* no need for full handle */
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000807
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000808 TRACE("%p %d\n",hwnd, offset);
Alexandre Julliard767e6f61998-08-09 12:47:43 +0000809
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000810 switch( offset )
811 {
Alexandre Julliard3051b641996-07-05 17:14:13 +0000812 case GCL_WNDPROC:
Alexandre Julliard8fd26b92001-10-15 17:56:45 +0000813 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000814 if (class == CLASS_OTHER_PROCESS) break;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000815 ret = (LONG)CLASS_GetProc( class, WIN_PROC_16 );
816 release_class_ptr( class );
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000817 return ret;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000818 case GCL_MENUNAME:
Alexandre Julliardd7b76822001-12-20 00:19:40 +0000819 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000820 if (class == CLASS_OTHER_PROCESS) break;
Alexandre Julliardd7b76822001-12-20 00:19:40 +0000821 ret = (LONG)CLASS_GetMenuName16( class );
822 release_class_ptr( class );
823 return ret;
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000824 default:
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000825 return GetClassLongA( hwnd, offset );
Alexandre Julliard1e9ac791996-06-06 18:38:27 +0000826 }
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000827 FIXME( "offset %d not supported on other process window %p\n", offset, hwnd );
828 SetLastError( ERROR_INVALID_HANDLE );
829 return 0;
Alexandre Julliard401710d1993-09-04 10:09:32 +0000830}
831
832
833/***********************************************************************
Stefan Leichter2c756722002-11-21 21:48:27 +0000834 * GetClassLongW (USER32.@)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000835 */
Stefan Leichter2c756722002-11-21 21:48:27 +0000836LONG WINAPI GetClassLongW( HWND hwnd, INT offset )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000837{
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000838 CLASS *class;
839 LONG retvalue = 0;
840
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000841 TRACE("%p %d\n", hwnd, offset);
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000842
Alexandre Julliard8fd26b92001-10-15 17:56:45 +0000843 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000844
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000845 if (class == CLASS_OTHER_PROCESS)
846 {
847 SERVER_START_REQ( set_class_info )
848 {
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 ))
854 {
855 switch(offset)
856 {
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;
885 }
886 }
887 }
888 SERVER_END_REQ;
889 return retvalue;
890 }
891
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000892 if (offset >= 0)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000893 {
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000894 if (offset <= class->cbClsExtra - sizeof(LONG))
Alexandre Julliard7fbd74e2002-05-23 02:53:10 +0000895 memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000896 else
897 SetLastError( ERROR_INVALID_INDEX );
898 release_class_ptr( class );
899 return retvalue;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000900 }
Alexandre Julliardd44e4952001-08-20 18:09:39 +0000901
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000902 switch(offset)
903 {
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000904 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:
Stefan Leichter2c756722002-11-21 21:48:27 +0000929 retvalue = (LONG)CLASS_GetProc( class, WIN_PROC_32W );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000930 break;
931 case GCL_MENUNAME:
Stefan Leichter2c756722002-11-21 21:48:27 +0000932 retvalue = (LONG)CLASS_GetMenuNameW( class );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000933 break;
934 case GCW_ATOM:
935 retvalue = (DWORD)class->atomName;
936 break;
937 default:
938 SetLastError( ERROR_INVALID_INDEX );
939 break;
Alexandre Julliard2ace16a1996-04-28 15:09:19 +0000940 }
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000941 release_class_ptr( class );
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000942 return retvalue;
Alexandre Julliard401710d1993-09-04 10:09:32 +0000943}
944
945
946/***********************************************************************
Stefan Leichter2c756722002-11-21 21:48:27 +0000947 * GetClassLongA (USER32.@)
Alexandre Julliard401710d1993-09-04 10:09:32 +0000948 */
Stefan Leichter2c756722002-11-21 21:48:27 +0000949LONG WINAPI GetClassLongA( HWND hwnd, INT offset )
Alexandre Julliard401710d1993-09-04 10:09:32 +0000950{
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000951 CLASS *class;
Francois Boisvert6b1b41c1999-03-14 17:25:32 +0000952 LONG retvalue;
Alexandre Julliard3051b641996-07-05 17:14:13 +0000953
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000954 if (offset != GCL_WNDPROC && offset != GCL_MENUNAME)
Stefan Leichter2c756722002-11-21 21:48:27 +0000955 return GetClassLongW( hwnd, offset );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000956
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000957 TRACE("%p %d\n", hwnd, offset);
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000958
Alexandre Julliard8fd26b92001-10-15 17:56:45 +0000959 if (!(class = get_class_ptr( hwnd, FALSE ))) return 0;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000960
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000961 if (class == CLASS_OTHER_PROCESS)
962 {
963 FIXME( "offset %d not supported on other process window %p\n", offset, hwnd );
964 SetLastError( ERROR_INVALID_HANDLE );
965 return 0;
966 }
967
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000968 if (offset == GCL_WNDPROC)
Stefan Leichter2c756722002-11-21 21:48:27 +0000969 retvalue = (LONG)CLASS_GetProc( class, WIN_PROC_32A );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000970 else /* GCL_MENUNAME */
Stefan Leichter2c756722002-11-21 21:48:27 +0000971 retvalue = (LONG)CLASS_GetMenuNameA( class );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000972
973 release_class_ptr( class );
974 return retvalue;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000975}
976
977
978/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +0000979 * SetClassWord (USER32.@)
Alexandre Julliard21979011997-03-05 08:22:35 +0000980 */
Alexandre Julliarda3960291999-02-26 11:11:13 +0000981WORD WINAPI SetClassWord( HWND hwnd, INT offset, WORD newval )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000982{
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000983 CLASS *class;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000984 WORD retval = 0;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000985
986 if (offset < 0) return SetClassLongA( hwnd, offset, (DWORD)newval );
987
Alexandre Julliardaff7dda2002-11-22 21:22:14 +0000988 TRACE("%p %d %x\n", hwnd, offset, newval);
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000989
Alexandre Julliard8fd26b92001-10-15 17:56:45 +0000990 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +0000991
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000992 SERVER_START_REQ( set_class_info )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +0000993 {
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000994 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 ))
1000 {
1001 void *ptr = (char *)(class + 1) + offset;
1002 memcpy( &retval, ptr, sizeof(retval) );
1003 memcpy( ptr, &newval, sizeof(newval) );
1004 }
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001005 }
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001006 SERVER_END_REQ;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001007 release_class_ptr( class );
Alexandre Julliard401710d1993-09-04 10:09:32 +00001008 return retval;
1009}
Alexandre Julliard5f721f81994-01-04 20:14:34 +00001010
1011
1012/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001013 * SetClassLong (USER.132)
Alexandre Julliard5f721f81994-01-04 20:14:34 +00001014 */
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001015LONG WINAPI SetClassLong16( HWND16 hwnd16, INT16 offset, LONG newval )
Alexandre Julliard5f721f81994-01-04 20:14:34 +00001016{
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001017 CLASS *class;
Alexandre Julliard3051b641996-07-05 17:14:13 +00001018 LONG retval;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001019 HWND hwnd = (HWND)(ULONG_PTR)hwnd16; /* no need for full handle */
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001020
Alexandre Julliardaff7dda2002-11-22 21:22:14 +00001021 TRACE("%p %d %lx\n", hwnd, offset, newval);
Alexandre Julliard767e6f61998-08-09 12:47:43 +00001022
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001023 switch(offset)
1024 {
1025 case GCL_WNDPROC:
Alexandre Julliard8fd26b92001-10-15 17:56:45 +00001026 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001027 retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_16 );
1028 release_class_ptr( class );
Alexandre Julliard3051b641996-07-05 17:14:13 +00001029 return retval;
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001030 case GCL_MENUNAME:
Alexandre Julliardd23a82b2001-09-19 20:37:04 +00001031 newval = (LONG)MapSL( newval );
1032 /* fall through */
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001033 default:
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001034 return SetClassLongA( hwnd, offset, newval );
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001035 }
Alexandre Julliard5f721f81994-01-04 20:14:34 +00001036}
1037
1038
1039/***********************************************************************
Stefan Leichter2c756722002-11-21 21:48:27 +00001040 * SetClassLongW (USER32.@)
Alexandre Julliard5f721f81994-01-04 20:14:34 +00001041 */
Stefan Leichter2c756722002-11-21 21:48:27 +00001042LONG WINAPI SetClassLongW( HWND hwnd, INT offset, LONG newval )
Alexandre Julliard5f721f81994-01-04 20:14:34 +00001043{
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001044 CLASS *class;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001045 LONG retval = 0;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001046
Alexandre Julliardaff7dda2002-11-22 21:22:14 +00001047 TRACE("%p %d %lx\n", hwnd, offset, newval);
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001048
Alexandre Julliard8fd26b92001-10-15 17:56:45 +00001049 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001050
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001051 if (offset >= 0)
1052 {
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001053 if (set_server_info( hwnd, offset, newval ))
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001054 {
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001055 void *ptr = (char *)(class + 1) + offset;
Alexandre Julliard7fbd74e2002-05-23 02:53:10 +00001056 memcpy( &retval, ptr, sizeof(retval) );
1057 memcpy( ptr, &newval, sizeof(newval) );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001058 }
1059 }
1060 else switch(offset)
1061 {
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001062 case GCL_MENUNAME:
Stefan Leichter2c756722002-11-21 21:48:27 +00001063 CLASS_SetMenuNameW( class, (LPCWSTR)newval );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001064 retval = 0; /* Old value is now meaningless anyway */
1065 break;
1066 case GCL_WNDPROC:
Stefan Leichter2c756722002-11-21 21:48:27 +00001067 retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_32W );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001068 break;
1069 case GCL_HBRBACKGROUND:
1070 retval = (LONG)class->hbrBackground;
Alexandre Julliard7ef66af2002-11-22 04:47:10 +00001071 class->hbrBackground = (HBRUSH)newval;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001072 break;
1073 case GCL_HCURSOR:
1074 retval = (LONG)class->hCursor;
Michael Stefaniucbc54d782002-10-10 21:22:09 +00001075 class->hCursor = (HCURSOR)newval;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001076 break;
1077 case GCL_HICON:
1078 retval = (LONG)class->hIcon;
Michael Stefaniucbc54d782002-10-10 21:22:09 +00001079 class->hIcon = (HICON)newval;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001080 break;
1081 case GCL_HICONSM:
1082 retval = (LONG)class->hIconSm;
Michael Stefaniucbc54d782002-10-10 21:22:09 +00001083 class->hIconSm = (HICON)newval;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001084 break;
1085 case GCL_STYLE:
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001086 if (!set_server_info( hwnd, offset, newval )) break;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001087 retval = (LONG)class->style;
1088 class->style = newval;
1089 break;
1090 case GCL_CBWNDEXTRA:
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001091 if (!set_server_info( hwnd, offset, newval )) break;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001092 retval = (LONG)class->cbWndExtra;
1093 class->cbWndExtra = newval;
1094 break;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001095 case GCL_HMODULE:
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001096 if (!set_server_info( hwnd, offset, newval )) break;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001097 retval = (LONG)class->hInstance;
Alexandre Julliard7ef66af2002-11-22 04:47:10 +00001098 class->hInstance = (HINSTANCE)newval;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001099 break;
1100 case GCW_ATOM:
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001101 if (!set_server_info( hwnd, offset, newval )) break;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001102 retval = (DWORD)class->atomName;
1103 class->atomName = newval;
1104 break;
Alexandre Julliard8fd26b92001-10-15 17:56:45 +00001105 case GCL_CBCLSEXTRA: /* cannot change this one */
1106 SetLastError( ERROR_INVALID_PARAMETER );
1107 break;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001108 default:
1109 SetLastError( ERROR_INVALID_INDEX );
1110 break;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001111 }
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001112 release_class_ptr( class );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001113 return retval;
1114}
1115
1116
1117/***********************************************************************
Stefan Leichter2c756722002-11-21 21:48:27 +00001118 * SetClassLongA (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001119 */
Stefan Leichter2c756722002-11-21 21:48:27 +00001120LONG WINAPI SetClassLongA( HWND hwnd, INT offset, LONG newval )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001121{
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001122 CLASS *class;
Alexandre Julliard3051b641996-07-05 17:14:13 +00001123 LONG retval;
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001124
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001125 if (offset != GCL_WNDPROC && offset != GCL_MENUNAME)
Stefan Leichter2c756722002-11-21 21:48:27 +00001126 return SetClassLongW( hwnd, offset, newval );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001127
Alexandre Julliardaff7dda2002-11-22 21:22:14 +00001128 TRACE("%p %d %lx\n", hwnd, offset, newval);
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001129
Alexandre Julliard8fd26b92001-10-15 17:56:45 +00001130 if (!(class = get_class_ptr( hwnd, TRUE ))) return 0;
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001131
1132 if (offset == GCL_WNDPROC)
Stefan Leichter2c756722002-11-21 21:48:27 +00001133 retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_32A );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001134 else /* GCL_MENUNAME */
1135 {
Stefan Leichter2c756722002-11-21 21:48:27 +00001136 CLASS_SetMenuNameA( class, (LPCSTR)newval );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001137 retval = 0; /* Old value is now meaningless anyway */
Alexandre Julliard2d93d001996-05-21 15:01:41 +00001138 }
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001139 release_class_ptr( class );
1140 return retval;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001141}
1142
1143
1144/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001145 * GetClassNameA (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001146 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001147INT WINAPI GetClassNameA( HWND hwnd, LPSTR buffer, INT count )
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001148{
Alexandre Julliard8fd26b92001-10-15 17:56:45 +00001149 INT ret = GlobalGetAtomNameA( GetClassLongA( hwnd, GCW_ATOM ), buffer, count );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001150
Alexandre Julliardaff7dda2002-11-22 21:22:14 +00001151 TRACE("%p %s %x\n",hwnd, debugstr_a(buffer), count);
Alexandre Julliard767e6f61998-08-09 12:47:43 +00001152 return ret;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001153}
1154
1155
1156/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001157 * GetClassNameW (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001158 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001159INT WINAPI GetClassNameW( HWND hwnd, LPWSTR buffer, INT count )
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001160{
Alexandre Julliard8fd26b92001-10-15 17:56:45 +00001161 INT ret = GlobalGetAtomNameW( GetClassLongW( hwnd, GCW_ATOM ), buffer, count );
Alexandre Julliarde6d90ea2001-10-09 23:27:17 +00001162
Alexandre Julliardaff7dda2002-11-22 21:22:14 +00001163 TRACE("%p %s %x\n",hwnd, debugstr_w(buffer), count);
Alexandre Julliard767e6f61998-08-09 12:47:43 +00001164 return ret;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001165}
1166
1167
1168/***********************************************************************
Dmitry Timoshkov29991652003-09-27 03:47:07 +00001169 * RealGetWindowClassA (USER32.@)
1170 */
1171UINT WINAPI RealGetWindowClassA( HWND hwnd, LPSTR buffer, UINT count )
1172{
1173 return GetClassNameA( hwnd, buffer, count );
1174}
1175
1176
1177/***********************************************************************
1178 * RealGetWindowClassW (USER32.@)
1179 */
1180UINT WINAPI RealGetWindowClassW( HWND hwnd, LPWSTR buffer, UINT count )
1181{
1182 return GetClassNameW( hwnd, buffer, count );
1183}
1184
1185
1186/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001187 * GetClassInfo (USER.404)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001188 */
Alexandre Julliarda8a422f2002-11-22 20:43:01 +00001189BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASS16 *wc )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001190{
Alexandre Julliard5f325662003-12-10 01:46:52 +00001191 WNDCLASSEX16 wcex;
1192 UINT16 ret = GetClassInfoEx16( hInst16, name, &wcex );
Alexandre Julliard3ed37e01994-11-07 18:20:42 +00001193
Alexandre Julliard5f325662003-12-10 01:46:52 +00001194 if (ret)
1195 {
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;
1206 }
1207 return ret;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001208}
1209
1210
1211/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001212 * GetClassInfoA (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001213 */
Alexandre Julliard5f325662003-12-10 01:46:52 +00001214BOOL WINAPI GetClassInfoA( HINSTANCE hInstance, LPCSTR name, WNDCLASSA *wc )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001215{
Alexandre Julliard5f325662003-12-10 01:46:52 +00001216 WNDCLASSEXA wcex;
1217 UINT ret = GetClassInfoExA( hInstance, name, &wcex );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001218
Alexandre Julliard5f325662003-12-10 01:46:52 +00001219 if (ret)
Alexandre Julliard767e6f61998-08-09 12:47:43 +00001220 {
Alexandre Julliard5f325662003-12-10 01:46:52 +00001221 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;
Alexandre Julliard767e6f61998-08-09 12:47:43 +00001231 }
Alexandre Julliard5f325662003-12-10 01:46:52 +00001232 return ret;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001233}
1234
1235
1236/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001237 * GetClassInfoW (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001238 */
Alexandre Julliard5f325662003-12-10 01:46:52 +00001239BOOL WINAPI GetClassInfoW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSW *wc )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001240{
Alexandre Julliard5f325662003-12-10 01:46:52 +00001241 WNDCLASSEXW wcex;
1242 UINT ret = GetClassInfoExW( hInstance, name, &wcex );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001243
Alexandre Julliard5f325662003-12-10 01:46:52 +00001244 if (ret)
Noomen Hamza1040eaf2000-07-09 12:21:07 +00001245 {
Alexandre Julliard5f325662003-12-10 01:46:52 +00001246 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;
Marcus Meissner438062171999-09-03 12:28:20 +00001256 }
Alexandre Julliard5f325662003-12-10 01:46:52 +00001257 return ret;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001258}
1259
1260
1261/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001262 * GetClassInfoEx (USER.398)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001263 *
1264 * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
1265 * same in Win16 as in Win32. --AJ
1266 */
Alexandre Julliarda8a422f2002-11-22 20:43:01 +00001267BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInst16, SEGPTR name, WNDCLASSEX16 *wc )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001268{
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001269 ATOM atom = HIWORD(name) ? GlobalFindAtomA( MapSL(name) ) : LOWORD(name);
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001270 CLASS *classPtr;
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001271 HINSTANCE hInstance;
Alexandre Julliard808cb041995-08-17 17:11:36 +00001272
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001273 if (hInst16 == GetModuleHandle16("user")) hInstance = user32_module;
1274 else hInstance = HINSTANCE_32(GetExePtr( hInst16 ));
Alexandre Julliard98779062000-12-07 23:39:16 +00001275
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001276 TRACE("%p %s %x %p\n", hInstance, debugstr_a( MapSL(name) ), atom, wc);
1277
1278 if (!atom || !(classPtr = CLASS_FindClassByAtom( atom, hInstance ))) return FALSE;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001279 wc->style = classPtr->style;
Alexandre Julliard98779062000-12-07 23:39:16 +00001280 wc->lpfnWndProc = CLASS_GetProc( classPtr, WIN_PROC_16 );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001281 wc->cbClsExtra = (INT16)classPtr->cbClsExtra;
1282 wc->cbWndExtra = (INT16)classPtr->cbWndExtra;
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001283 wc->hInstance = (classPtr->hInstance == user32_module) ? GetModuleHandle16("user") : HINSTANCE_16(classPtr->hInstance);
Michael Stefaniucbc54d782002-10-10 21:22:09 +00001284 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);
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001288 wc->lpszClassName = (SEGPTR)0;
Alexandre Julliardd7b76822001-12-20 00:19:40 +00001289 wc->lpszMenuName = CLASS_GetMenuName16( classPtr );
1290 wc->lpszClassName = name;
Alexandre Julliardbd13ab82003-12-11 05:34:53 +00001291 release_class_ptr( classPtr );
James Hatheway9fa09e72000-06-18 17:19:38 +00001292
1293 /* We must return the atom of the class here instead of just TRUE. */
1294 return atom;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001295}
Alexandre Julliard5f721f81994-01-04 20:14:34 +00001296
Alexandre Julliard1285c2f1996-05-06 16:06:24 +00001297
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001298/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001299 * GetClassInfoExA (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001300 */
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001301BOOL WINAPI GetClassInfoExA( HINSTANCE hInstance, LPCSTR name, WNDCLASSEXA *wc )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001302{
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001303 ATOM atom = HIWORD(name) ? GlobalFindAtomA( name ) : LOWORD(name);
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001304 CLASS *classPtr;
1305
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001306 TRACE("%p %s %x %p\n", hInstance, debugstr_a(name), atom, wc);
Vincent Béron9a624912002-05-31 23:06:46 +00001307
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001308 if (!hInstance) hInstance = user32_module;
1309
1310 if (!atom || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )))
1311 {
1312 SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
1313 return FALSE;
1314 }
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001315 wc->style = classPtr->style;
Alexandre Julliard98779062000-12-07 23:39:16 +00001316 wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32A );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001317 wc->cbClsExtra = classPtr->cbClsExtra;
1318 wc->cbWndExtra = classPtr->cbWndExtra;
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001319 wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
Alexandre Julliarda3960291999-02-26 11:11:13 +00001320 wc->hIcon = (HICON)classPtr->hIcon;
1321 wc->hIconSm = (HICON)classPtr->hIconSm;
1322 wc->hCursor = (HCURSOR)classPtr->hCursor;
1323 wc->hbrBackground = (HBRUSH)classPtr->hbrBackground;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001324 wc->lpszMenuName = CLASS_GetMenuNameA( classPtr );
Alexandre Julliard98779062000-12-07 23:39:16 +00001325 wc->lpszClassName = name;
Alexandre Julliardbd13ab82003-12-11 05:34:53 +00001326 release_class_ptr( classPtr );
Alexandre Julliard98779062000-12-07 23:39:16 +00001327
James Hatheway9fa09e72000-06-18 17:19:38 +00001328 /* We must return the atom of the class here instead of just TRUE. */
1329 return atom;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001330}
1331
1332
1333/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001334 * GetClassInfoExW (USER32.@)
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001335 */
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001336BOOL WINAPI GetClassInfoExW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSEXW *wc )
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001337{
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001338 ATOM atom = HIWORD(name) ? GlobalFindAtomW( name ) : LOWORD(name);
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001339 CLASS *classPtr;
1340
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001341 TRACE("%p %s %x %p\n", hInstance, debugstr_w(name), atom, wc);
Vincent Béron9a624912002-05-31 23:06:46 +00001342
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001343 if (!hInstance) hInstance = user32_module;
1344
1345 if (!atom || !(classPtr = CLASS_FindClassByAtom( atom, hInstance )))
1346 {
1347 SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
1348 return FALSE;
1349 }
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001350 wc->style = classPtr->style;
Alexandre Julliard98779062000-12-07 23:39:16 +00001351 wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32W );
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001352 wc->cbClsExtra = classPtr->cbClsExtra;
1353 wc->cbWndExtra = classPtr->cbWndExtra;
Alexandre Julliardbfce1512003-12-10 04:08:06 +00001354 wc->hInstance = (hInstance == user32_module) ? 0 : hInstance;
Alexandre Julliarda3960291999-02-26 11:11:13 +00001355 wc->hIcon = (HICON)classPtr->hIcon;
1356 wc->hIconSm = (HICON)classPtr->hIconSm;
1357 wc->hCursor = (HCURSOR)classPtr->hCursor;
1358 wc->hbrBackground = (HBRUSH)classPtr->hbrBackground;
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001359 wc->lpszMenuName = CLASS_GetMenuNameW( classPtr );
Alexandre Julliard98779062000-12-07 23:39:16 +00001360 wc->lpszClassName = name;
Alexandre Julliardbd13ab82003-12-11 05:34:53 +00001361 release_class_ptr( classPtr );
Alexandre Julliard98779062000-12-07 23:39:16 +00001362
James Hatheway9fa09e72000-06-18 17:19:38 +00001363 /* We must return the atom of the class here instead of just TRUE. */
1364 return atom;
Alexandre Julliard5f721f81994-01-04 20:14:34 +00001365}
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001366
1367
Alexandre Julliardf899ef02001-07-23 00:04:00 +00001368#if 0 /* toolhelp is in kernel, so this cannot work */
1369
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001370/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001371 * ClassFirst (TOOLHELP.69)
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001372 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001373BOOL16 WINAPI ClassFirst16( CLASSENTRY *pClassEntry )
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001374{
Alexandre Julliard359f497e1999-07-04 16:02:24 +00001375 TRACE("%p\n",pClassEntry);
Alexandre Julliard2ace16a1996-04-28 15:09:19 +00001376 pClassEntry->wNext = 1;
Alexandre Julliarda3960291999-02-26 11:11:13 +00001377 return ClassNext16( pClassEntry );
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001378}
1379
1380
1381/***********************************************************************
Patrik Stridvall2ece70e2000-12-22 01:38:01 +00001382 * ClassNext (TOOLHELP.70)
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001383 */
Alexandre Julliarda3960291999-02-26 11:11:13 +00001384BOOL16 WINAPI ClassNext16( CLASSENTRY *pClassEntry )
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001385{
Alexandre Julliard2ace16a1996-04-28 15:09:19 +00001386 int i;
1387 CLASS *class = firstClass;
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001388
Alexandre Julliard359f497e1999-07-04 16:02:24 +00001389 TRACE("%p\n",pClassEntry);
Vincent Béron9a624912002-05-31 23:06:46 +00001390
Alexandre Julliard2ace16a1996-04-28 15:09:19 +00001391 if (!pClassEntry->wNext) return FALSE;
1392 for (i = 1; (i < pClassEntry->wNext) && class; i++) class = class->next;
1393 if (!class)
1394 {
1395 pClassEntry->wNext = 0;
1396 return FALSE;
1397 }
Alexandre Julliard1285c2f1996-05-06 16:06:24 +00001398 pClassEntry->hInst = class->hInstance;
Alexandre Julliard2ace16a1996-04-28 15:09:19 +00001399 pClassEntry->wNext++;
Alexandre Julliarda3960291999-02-26 11:11:13 +00001400 GlobalGetAtomNameA( class->atomName, pClassEntry->szClassName,
Alexandre Julliarde2bfa4c1996-05-16 18:21:06 +00001401 sizeof(pClassEntry->szClassName) );
Alexandre Julliarde2abbb11995-03-19 17:39:39 +00001402 return TRUE;
1403}
Alexandre Julliardf899ef02001-07-23 00:04:00 +00001404#endif