Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Window classes functions |
| 3 | * |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 4 | * Copyright 1993, 1996 Alexandre Julliard |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 5 | * 1998 Juergen Schmied (jsch) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 6 | * |
| 7 | * FIXME: In win32 all classes are local. They are registered at |
| 8 | * program start. Processes CANNOT share classes. (Source: some |
| 9 | * win31->NT migration book) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 10 | * |
| 11 | * FIXME: There seems to be a general problem with hInstance in WINE |
| 12 | * classes are getting registred with wrong hInstance. |
Alexandre Julliard | bd34d4f | 1995-06-20 19:08:12 +0000 | [diff] [blame] | 13 | */ |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 14 | |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 15 | #include <stdlib.h> |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 16 | #include <string.h> |
Marcus Meissner | 317af32 | 1999-02-17 13:51:06 +0000 | [diff] [blame] | 17 | #include "wine/winbase16.h" |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 18 | #include "class.h" |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 19 | #include "heap.h" |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 20 | #include "win.h" |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 21 | #include "dce.h" |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 22 | #include "ldt.h" |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 23 | #include "toolhelp.h" |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 24 | #include "winproc.h" |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 25 | #include "debugtools.h" |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 26 | #include "winerror.h" |
Michael Veksler | ca1bc86 | 1999-01-01 18:57:33 +0000 | [diff] [blame] | 27 | #include "wine/winuser16.h" |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 28 | |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 29 | DEFAULT_DEBUG_CHANNEL(class) |
| 30 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 31 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 32 | static CLASS *firstClass = NULL; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 33 | |
| 34 | |
| 35 | /*********************************************************************** |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 36 | * CLASS_DumpClass |
| 37 | * |
| 38 | * Dump the content of a class structure to stderr. |
| 39 | */ |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 40 | void CLASS_DumpClass( CLASS *ptr ) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 41 | { |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 42 | char className[MAX_CLASSNAME+1]; |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 43 | int i; |
| 44 | |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 45 | if (ptr->magic != CLASS_MAGIC) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 46 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 47 | DPRINTF("%p is not a class\n", ptr ); |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 48 | return; |
| 49 | } |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 50 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 51 | GlobalGetAtomNameA( ptr->atomName, className, sizeof(className) ); |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 52 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 53 | DPRINTF( "Class %p:\n", ptr ); |
| 54 | DPRINTF( "next=%p name=%04x '%s' style=%08x wndProc=%08x\n" |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 55 | "inst=%04x dce=%08x icon=%04x cursor=%04x bkgnd=%04x\n" |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 56 | "clsExtra=%d winExtra=%d #windows=%d\n", |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 57 | ptr->next, ptr->atomName, className, ptr->style, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 58 | (UINT)ptr->winproc, ptr->hInstance, (UINT)ptr->dce, |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 59 | ptr->hIcon, ptr->hCursor, ptr->hbrBackground, |
| 60 | ptr->cbClsExtra, ptr->cbWndExtra, ptr->cWindows ); |
| 61 | if (ptr->cbClsExtra) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 62 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 63 | DPRINTF( "extra bytes:" ); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 64 | for (i = 0; i < ptr->cbClsExtra; i++) |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 65 | DPRINTF( " %02x", *((BYTE *)ptr->wExtra+i) ); |
| 66 | DPRINTF( "\n" ); |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 67 | } |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 68 | DPRINTF( "\n" ); |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | |
| 72 | /*********************************************************************** |
| 73 | * CLASS_WalkClasses |
| 74 | * |
| 75 | * Walk the class list and print each class on stderr. |
| 76 | */ |
| 77 | void CLASS_WalkClasses(void) |
| 78 | { |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 79 | CLASS *ptr; |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 80 | char className[MAX_CLASSNAME+1]; |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 81 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 82 | DPRINTF( " Class Name Style WndProc\n" ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 83 | for (ptr = firstClass; ptr; ptr = ptr->next) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 84 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 85 | GlobalGetAtomNameA( ptr->atomName, className, sizeof(className) ); |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 86 | DPRINTF( "%08x %-20.20s %08x %08x\n", (UINT)ptr, className, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 87 | ptr->style, (UINT)ptr->winproc ); |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 88 | } |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 89 | DPRINTF( "\n" ); |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | |
| 93 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 94 | * CLASS_GetMenuNameA |
| 95 | * |
| 96 | * Get the menu name as a ASCII string. |
| 97 | */ |
| 98 | static LPSTR CLASS_GetMenuNameA( CLASS *classPtr ) |
| 99 | { |
| 100 | if (!classPtr->menuNameA && classPtr->menuNameW) |
| 101 | { |
| 102 | /* We need to copy the Unicode string */ |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 103 | classPtr->menuNameA = SEGPTR_STRDUP_WtoA( classPtr->menuNameW ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 104 | } |
| 105 | return classPtr->menuNameA; |
| 106 | } |
| 107 | |
| 108 | |
| 109 | /*********************************************************************** |
| 110 | * CLASS_GetMenuNameW |
| 111 | * |
| 112 | * Get the menu name as a Unicode string. |
| 113 | */ |
| 114 | static LPWSTR CLASS_GetMenuNameW( CLASS *classPtr ) |
| 115 | { |
| 116 | if (!classPtr->menuNameW && classPtr->menuNameA) |
| 117 | { |
| 118 | if (!HIWORD(classPtr->menuNameA)) |
| 119 | return (LPWSTR)classPtr->menuNameA; |
| 120 | /* Now we need to copy the ASCII string */ |
Alexandre Julliard | 7ebe1a4 | 1996-12-22 18:27:48 +0000 | [diff] [blame] | 121 | classPtr->menuNameW = HEAP_strdupAtoW( SystemHeap, 0, |
| 122 | classPtr->menuNameA ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 123 | } |
| 124 | return classPtr->menuNameW; |
| 125 | } |
| 126 | |
| 127 | |
| 128 | /*********************************************************************** |
| 129 | * CLASS_SetMenuNameA |
| 130 | * |
| 131 | * Set the menu name in a class structure by copying the string. |
| 132 | */ |
| 133 | static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name ) |
| 134 | { |
| 135 | if (HIWORD(classPtr->menuNameA)) SEGPTR_FREE( classPtr->menuNameA ); |
| 136 | if (classPtr->menuNameW) HeapFree( SystemHeap, 0, classPtr->menuNameW ); |
| 137 | classPtr->menuNameA = SEGPTR_STRDUP( name ); |
| 138 | classPtr->menuNameW = 0; |
| 139 | } |
| 140 | |
| 141 | |
| 142 | /*********************************************************************** |
| 143 | * CLASS_SetMenuNameW |
| 144 | * |
| 145 | * Set the menu name in a class structure by copying the string. |
| 146 | */ |
| 147 | static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name ) |
| 148 | { |
| 149 | if (!HIWORD(name)) |
| 150 | { |
| 151 | CLASS_SetMenuNameA( classPtr, (LPCSTR)name ); |
| 152 | return; |
| 153 | } |
| 154 | if (HIWORD(classPtr->menuNameA)) SEGPTR_FREE( classPtr->menuNameA ); |
| 155 | if (classPtr->menuNameW) HeapFree( SystemHeap, 0, classPtr->menuNameW ); |
| 156 | if ((classPtr->menuNameW = HeapAlloc( SystemHeap, 0, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 157 | (lstrlenW(name)+1)*sizeof(WCHAR) ))) |
| 158 | lstrcpyW( classPtr->menuNameW, name ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 159 | classPtr->menuNameA = 0; |
| 160 | } |
| 161 | |
| 162 | |
| 163 | /*********************************************************************** |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 164 | * CLASS_GetClassNameA |
| 165 | * |
| 166 | * Get the clas name as a ASCII string. |
| 167 | */ |
| 168 | static LPSTR CLASS_GetClassNameA( CLASS *classPtr ) |
| 169 | { |
| 170 | if (!classPtr->classNameA && classPtr->classNameW) |
| 171 | { |
| 172 | /* We need to copy the Unicode string */ |
| 173 | classPtr->classNameA = SEGPTR_STRDUP_WtoA( classPtr->classNameW ); |
| 174 | } |
| 175 | return classPtr->classNameA; |
| 176 | } |
| 177 | |
| 178 | |
| 179 | /*********************************************************************** |
| 180 | * CLASS_GetClassNameW |
| 181 | * |
| 182 | * Get the class name as a Unicode string. |
| 183 | */ |
| 184 | static LPWSTR CLASS_GetClassNameW( CLASS *classPtr ) |
| 185 | { |
| 186 | if (!classPtr->classNameW && classPtr->classNameA) |
| 187 | { |
| 188 | if (!HIWORD(classPtr->classNameA)) |
| 189 | return (LPWSTR)classPtr->classNameA; |
| 190 | /* Now we need to copy the ASCII string */ |
| 191 | classPtr->classNameW = HEAP_strdupAtoW( SystemHeap, 0, |
| 192 | classPtr->classNameA ); |
| 193 | } |
| 194 | return classPtr->classNameW; |
| 195 | } |
| 196 | |
| 197 | /*********************************************************************** |
| 198 | * CLASS_SetClassNameA |
| 199 | * |
| 200 | * Set the class name in a class structure by copying the string. |
| 201 | */ |
| 202 | static void CLASS_SetClassNameA( CLASS *classPtr, LPCSTR name ) |
| 203 | { |
| 204 | if (HIWORD(classPtr->classNameA)) SEGPTR_FREE( classPtr->classNameA ); |
| 205 | if (classPtr->classNameW) HeapFree( SystemHeap, 0, classPtr->classNameW ); |
| 206 | classPtr->classNameA = SEGPTR_STRDUP( name ); |
| 207 | classPtr->classNameW = 0; |
| 208 | } |
| 209 | |
| 210 | |
| 211 | /*********************************************************************** |
| 212 | * CLASS_SetClassNameW |
| 213 | * |
| 214 | * Set the class name in a class structure by copying the string. |
| 215 | */ |
| 216 | static void CLASS_SetClassNameW( CLASS *classPtr, LPCWSTR name ) |
| 217 | { |
| 218 | if (!HIWORD(name)) |
| 219 | { |
| 220 | CLASS_SetClassNameA( classPtr, (LPCSTR)name ); |
| 221 | return; |
| 222 | } |
| 223 | if (HIWORD(classPtr->classNameA)) SEGPTR_FREE( classPtr->classNameA ); |
| 224 | if (classPtr->classNameW) HeapFree( SystemHeap, 0, classPtr->classNameW ); |
| 225 | if ((classPtr->classNameW = HeapAlloc( SystemHeap, 0, |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 226 | (lstrlenW(name)+1)*sizeof(WCHAR) ))) |
| 227 | lstrcpyW( classPtr->classNameW, name ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 228 | classPtr->classNameA = 0; |
| 229 | } |
| 230 | |
| 231 | |
| 232 | /*********************************************************************** |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 233 | * CLASS_FreeClass |
| 234 | * |
| 235 | * Free a class structure. |
| 236 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 237 | static BOOL CLASS_FreeClass( CLASS *classPtr ) |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 238 | { |
| 239 | CLASS **ppClass; |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 240 | TRACE("%p \n", classPtr); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 241 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 242 | /* Check if we can remove this class */ |
| 243 | |
| 244 | if (classPtr->cWindows > 0) return FALSE; |
| 245 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 246 | /* Remove the class from the linked list */ |
| 247 | |
| 248 | for (ppClass = &firstClass; *ppClass; ppClass = &(*ppClass)->next) |
| 249 | if (*ppClass == classPtr) break; |
| 250 | if (!*ppClass) |
| 251 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 252 | ERR("Class list corrupted\n" ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 253 | return FALSE; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 254 | } |
| 255 | *ppClass = classPtr->next; |
| 256 | |
| 257 | /* Delete the class */ |
| 258 | |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 259 | if (classPtr->dce) DCE_FreeDCE( classPtr->dce ); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 260 | if (classPtr->hbrBackground) DeleteObject( classPtr->hbrBackground ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 261 | GlobalDeleteAtom( classPtr->atomName ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 262 | CLASS_SetMenuNameA( classPtr, NULL ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 263 | CLASS_SetClassNameA( classPtr, NULL ); |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 264 | WINPROC_FreeProc( classPtr->winproc, WIN_PROC_CLASS ); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 265 | HeapFree( SystemHeap, 0, classPtr ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 266 | return TRUE; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | |
| 270 | /*********************************************************************** |
| 271 | * CLASS_FreeModuleClasses |
| 272 | */ |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 273 | void CLASS_FreeModuleClasses( HMODULE16 hModule ) |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 274 | { |
| 275 | CLASS *ptr, *next; |
| 276 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 277 | TRACE("0x%08x \n", hModule); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 278 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 279 | for (ptr = firstClass; ptr; ptr = next) |
| 280 | { |
| 281 | next = ptr->next; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 282 | if (ptr->hInstance == hModule) CLASS_FreeClass( ptr ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 283 | } |
| 284 | } |
| 285 | |
| 286 | |
| 287 | /*********************************************************************** |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 288 | * CLASS_FindClassByAtom |
| 289 | * |
| 290 | * Return a pointer to the class. |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 291 | * hinstance has been normalized by the caller. |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 292 | * |
| 293 | * NOTES |
| 294 | * 980805 a local class will be found now if registred with hInst=0 |
| 295 | * and looed up with a hInst!=0. msmoney does it (jsch) |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 296 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 297 | CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE hinstance ) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 298 | { CLASS * class, *tclass=0; |
| 299 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 300 | TRACE("0x%08x 0x%08x\n", atom, hinstance); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 301 | |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 302 | /* First search task-specific classes */ |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 303 | |
| 304 | for (class = firstClass; (class); class = class->next) |
| 305 | { |
| 306 | if (class->style & CS_GLOBALCLASS) continue; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 307 | if (class->atomName == atom) |
| 308 | { |
| 309 | if (hinstance==class->hInstance || hinstance==0xffff ) |
| 310 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 311 | TRACE("-- found local %p\n", class); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 312 | return class; |
| 313 | } |
| 314 | if (class->hInstance==0) tclass = class; |
| 315 | } |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | /* Then search global classes */ |
| 319 | |
| 320 | for (class = firstClass; (class); class = class->next) |
| 321 | { |
| 322 | if (!(class->style & CS_GLOBALCLASS)) continue; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 323 | if (class->atomName == atom) |
| 324 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 325 | TRACE("-- found global %p\n", class); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 326 | return class; |
| 327 | } |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 328 | } |
| 329 | |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 330 | /* Then check if there was a local class with hInst=0*/ |
| 331 | if ( tclass ) |
| 332 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 333 | WARN("-- found local Class registred with hInst=0\n"); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 334 | return tclass; |
| 335 | } |
| 336 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 337 | TRACE("-- not found\n"); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 338 | return 0; |
| 339 | } |
| 340 | |
| 341 | |
| 342 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 343 | * CLASS_RegisterClass |
| 344 | * |
| 345 | * The real RegisterClass() functionality. |
| 346 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 347 | static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE hInstance, |
| 348 | DWORD style, INT classExtra, |
| 349 | INT winExtra, WNDPROC16 wndProc, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 350 | WINDOWPROCTYPE wndProcType ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 351 | { |
| 352 | CLASS *classPtr; |
| 353 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 354 | TRACE("atom=0x%x hinst=0x%x style=0x%lx clExtr=0x%x winExtr=0x%x wndProc=0x%p ProcType=0x%x\n", |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 355 | atom, hInstance, style, classExtra, winExtra, wndProc, wndProcType); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 356 | |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 357 | /* Check if a class with this name already exists */ |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 358 | classPtr = CLASS_FindClassByAtom( atom, hInstance ); |
| 359 | if (classPtr) |
| 360 | { |
| 361 | /* Class can be created only if it is local and */ |
| 362 | /* if the class with the same name is global. */ |
| 363 | |
| 364 | if (style & CS_GLOBALCLASS) return NULL; |
| 365 | if (!(classPtr->style & CS_GLOBALCLASS)) return NULL; |
| 366 | } |
| 367 | |
| 368 | /* Fix the extra bytes value */ |
| 369 | |
| 370 | if (classExtra < 0) classExtra = 0; |
| 371 | else if (classExtra > 40) /* Extra bytes are limited to 40 in Win32 */ |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 372 | WARN("Class extra bytes %d is > 40\n", classExtra); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 373 | if (winExtra < 0) winExtra = 0; |
| 374 | else if (winExtra > 40) /* Extra bytes are limited to 40 in Win32 */ |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 375 | WARN("Win extra bytes %d is > 40\n", winExtra ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 376 | |
| 377 | /* Create the class */ |
| 378 | |
| 379 | classPtr = (CLASS *)HeapAlloc( SystemHeap, 0, sizeof(CLASS) + |
| 380 | classExtra - sizeof(classPtr->wExtra) ); |
| 381 | if (!classPtr) return NULL; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 382 | classPtr->next = firstClass; |
| 383 | classPtr->magic = CLASS_MAGIC; |
| 384 | classPtr->cWindows = 0; |
| 385 | classPtr->style = style; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 386 | classPtr->winproc = (HWINDOWPROC)0; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 387 | classPtr->cbWndExtra = winExtra; |
| 388 | classPtr->cbClsExtra = classExtra; |
| 389 | classPtr->hInstance = hInstance; |
| 390 | classPtr->atomName = atom; |
| 391 | classPtr->menuNameA = 0; |
| 392 | classPtr->menuNameW = 0; |
Rein Klazes | cb37dfd | 1998-11-22 14:13:47 +0000 | [diff] [blame] | 393 | classPtr->classNameA = 0; |
| 394 | classPtr->classNameW = 0; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 395 | classPtr->dce = (style & CS_CLASSDC) ? |
| 396 | DCE_AllocDCE( 0, DCE_CLASS_DC ) : NULL; |
| 397 | |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 398 | WINPROC_SetProc( &classPtr->winproc, wndProc, wndProcType, WIN_PROC_CLASS); |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 399 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 400 | /* Other values must be set by caller */ |
| 401 | |
| 402 | if (classExtra) memset( classPtr->wExtra, 0, classExtra ); |
| 403 | firstClass = classPtr; |
| 404 | return classPtr; |
| 405 | } |
| 406 | |
| 407 | |
| 408 | /*********************************************************************** |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 409 | * RegisterClass16 (USER.57) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 410 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 411 | ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 412 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 413 | ATOM atom; |
| 414 | CLASS *classPtr; |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 415 | HINSTANCE16 hInstance=GetExePtr(wc->hInstance); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 416 | |
| 417 | if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0; |
| 418 | if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 419 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 420 | wc->lpfnWndProc, WIN_PROC_16 ))) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 421 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 422 | GlobalDeleteAtom( atom ); |
| 423 | return 0; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 424 | } |
| 425 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 426 | TRACE("atom=%04x wndproc=%08lx hinst=%04x " |
Patrik Stridvall | a9a671d | 1999-04-25 19:01:52 +0000 | [diff] [blame] | 427 | "bg=%04x style=%08x clsExt=%d winExt=%d class=%p name='%s'\n", |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 428 | atom, (DWORD)wc->lpfnWndProc, hInstance, |
| 429 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
Alexandre Julliard | 641ee76 | 1997-08-04 16:34:36 +0000 | [diff] [blame] | 430 | wc->cbWndExtra, classPtr, |
| 431 | HIWORD(wc->lpszClassName) ? |
| 432 | (char *)PTR_SEG_TO_LIN(wc->lpszClassName) : "" ); |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 433 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 434 | classPtr->hIcon = wc->hIcon; |
| 435 | classPtr->hIconSm = 0; |
| 436 | classPtr->hCursor = wc->hCursor; |
| 437 | classPtr->hbrBackground = wc->hbrBackground; |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 438 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 439 | CLASS_SetMenuNameA( classPtr, HIWORD(wc->lpszMenuName) ? |
| 440 | PTR_SEG_TO_LIN(wc->lpszMenuName) : (LPCSTR)wc->lpszMenuName ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 441 | CLASS_SetClassNameA( classPtr, HIWORD(wc->lpszClassName) ? |
| 442 | PTR_SEG_TO_LIN(wc->lpszClassName) : (LPCSTR)wc->lpszClassName ); |
| 443 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 444 | return atom; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 445 | } |
| 446 | |
| 447 | |
| 448 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 449 | * RegisterClass32A (USER32.427) |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 450 | * RETURNS |
| 451 | * >0: Unique identifier |
| 452 | * 0: Failure |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 453 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 454 | ATOM WINAPI RegisterClassA( |
| 455 | const WNDCLASSA* wc /* Address of structure with class data */ |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 456 | ) { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 457 | ATOM atom; |
| 458 | CLASS *classPtr; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 459 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 460 | if (!(atom = GlobalAddAtomA( wc->lpszClassName ))) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 461 | { |
| 462 | SetLastError(ERROR_CLASS_ALREADY_EXISTS); |
| 463 | return FALSE; |
| 464 | } |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 465 | if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 466 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 467 | (WNDPROC16)wc->lpfnWndProc, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 468 | WIN_PROC_32A ))) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 469 | { GlobalDeleteAtom( atom ); |
| 470 | SetLastError(ERROR_CLASS_ALREADY_EXISTS); |
| 471 | return FALSE; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 472 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 473 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 474 | TRACE("atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p name='%s'\n", |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 475 | atom, (DWORD)wc->lpfnWndProc, wc->hInstance, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 476 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
Alexandre Julliard | 641ee76 | 1997-08-04 16:34:36 +0000 | [diff] [blame] | 477 | wc->cbWndExtra, classPtr, |
| 478 | HIWORD(wc->lpszClassName) ? wc->lpszClassName : "" ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 479 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 480 | classPtr->hIcon = (HICON16)wc->hIcon; |
| 481 | classPtr->hIconSm = 0; |
| 482 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 483 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 484 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 485 | CLASS_SetMenuNameA( classPtr, wc->lpszMenuName ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 486 | CLASS_SetClassNameA( classPtr, wc->lpszClassName ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 487 | return atom; |
| 488 | } |
| 489 | |
| 490 | |
| 491 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 492 | * RegisterClass32W (USER32.430) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 493 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 494 | ATOM WINAPI RegisterClassW( const WNDCLASSW* wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 495 | { |
| 496 | ATOM atom; |
| 497 | CLASS *classPtr; |
| 498 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 499 | if (!(atom = GlobalAddAtomW( wc->lpszClassName ))) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 500 | { |
| 501 | SetLastError(ERROR_CLASS_ALREADY_EXISTS); |
| 502 | return FALSE; |
| 503 | } |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 504 | if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 505 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 506 | (WNDPROC16)wc->lpfnWndProc, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 507 | WIN_PROC_32W ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 508 | { |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 509 | SetLastError(ERROR_CLASS_ALREADY_EXISTS); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 510 | GlobalDeleteAtom( atom ); |
| 511 | return 0; |
| 512 | } |
| 513 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 514 | TRACE("atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 515 | atom, (DWORD)wc->lpfnWndProc, wc->hInstance, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 516 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 517 | wc->cbWndExtra, classPtr ); |
| 518 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 519 | classPtr->hIcon = (HICON16)wc->hIcon; |
| 520 | classPtr->hIconSm = 0; |
| 521 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 522 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 523 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 524 | CLASS_SetMenuNameW( classPtr, wc->lpszMenuName ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 525 | CLASS_SetClassNameW( classPtr, wc->lpszClassName ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 526 | return atom; |
| 527 | } |
| 528 | |
| 529 | |
| 530 | /*********************************************************************** |
| 531 | * RegisterClassEx16 (USER.397) |
| 532 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 533 | ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 534 | { |
| 535 | ATOM atom; |
| 536 | CLASS *classPtr; |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 537 | HINSTANCE16 hInstance = GetExePtr( wc->hInstance ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 538 | |
| 539 | if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0; |
| 540 | if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 541 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 542 | wc->lpfnWndProc, WIN_PROC_16 ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 543 | { |
| 544 | GlobalDeleteAtom( atom ); |
| 545 | return 0; |
| 546 | } |
| 547 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 548 | TRACE("atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 549 | atom, (DWORD)wc->lpfnWndProc, hInstance, |
| 550 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 551 | wc->cbWndExtra, classPtr ); |
| 552 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 553 | classPtr->hIcon = wc->hIcon; |
| 554 | classPtr->hIconSm = wc->hIconSm; |
| 555 | classPtr->hCursor = wc->hCursor; |
| 556 | classPtr->hbrBackground = wc->hbrBackground; |
| 557 | |
| 558 | CLASS_SetMenuNameA( classPtr, HIWORD(wc->lpszMenuName) ? |
| 559 | PTR_SEG_TO_LIN(wc->lpszMenuName) : (LPCSTR)wc->lpszMenuName ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 560 | CLASS_SetClassNameA( classPtr, HIWORD(wc->lpszClassName) ? |
| 561 | PTR_SEG_TO_LIN(wc->lpszClassName) : (LPCSTR)wc->lpszClassName ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 562 | return atom; |
| 563 | } |
| 564 | |
| 565 | |
| 566 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 567 | * RegisterClassEx32A (USER32.428) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 568 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 569 | ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 570 | { |
| 571 | ATOM atom; |
| 572 | CLASS *classPtr; |
| 573 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 574 | if (!(atom = GlobalAddAtomA( wc->lpszClassName ))) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 575 | { |
| 576 | SetLastError(ERROR_CLASS_ALREADY_EXISTS); |
| 577 | return FALSE; |
| 578 | } |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 579 | if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 580 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 581 | (WNDPROC16)wc->lpfnWndProc, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 582 | WIN_PROC_32A ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 583 | { |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 584 | SetLastError(ERROR_CLASS_ALREADY_EXISTS); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 585 | GlobalDeleteAtom( atom ); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 586 | return FALSE; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 587 | } |
| 588 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 589 | TRACE("atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 590 | atom, (DWORD)wc->lpfnWndProc, wc->hInstance, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 591 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 592 | wc->cbWndExtra, classPtr ); |
| 593 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 594 | classPtr->hIcon = (HICON16)wc->hIcon; |
| 595 | classPtr->hIconSm = (HICON16)wc->hIconSm; |
| 596 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 597 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 598 | CLASS_SetMenuNameA( classPtr, wc->lpszMenuName ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 599 | CLASS_SetClassNameA( classPtr, wc->lpszClassName ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 600 | return atom; |
| 601 | } |
| 602 | |
| 603 | |
| 604 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 605 | * RegisterClassEx32W (USER32.429) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 606 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 607 | ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 608 | { |
| 609 | ATOM atom; |
| 610 | CLASS *classPtr; |
| 611 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 612 | if (!(atom = GlobalAddAtomW( wc->lpszClassName ))) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 613 | { |
| 614 | SetLastError(ERROR_CLASS_ALREADY_EXISTS); |
| 615 | return 0; |
| 616 | } |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 617 | if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 618 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 619 | (WNDPROC16)wc->lpfnWndProc, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 620 | WIN_PROC_32W ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 621 | { |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 622 | SetLastError(ERROR_CLASS_ALREADY_EXISTS); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 623 | GlobalDeleteAtom( atom ); |
| 624 | return 0; |
| 625 | } |
| 626 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 627 | TRACE("atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 628 | atom, (DWORD)wc->lpfnWndProc, wc->hInstance, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 629 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 630 | wc->cbWndExtra, classPtr ); |
| 631 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 632 | classPtr->hIcon = (HICON16)wc->hIcon; |
| 633 | classPtr->hIconSm = (HICON16)wc->hIconSm; |
| 634 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 635 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 636 | CLASS_SetMenuNameW( classPtr, wc->lpszMenuName ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 637 | CLASS_SetClassNameW( classPtr, wc->lpszClassName ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 638 | return atom; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 639 | } |
| 640 | |
| 641 | |
| 642 | /*********************************************************************** |
| 643 | * UnregisterClass16 (USER.403) |
| 644 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 645 | BOOL16 WINAPI UnregisterClass16( SEGPTR className, HINSTANCE16 hInstance ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 646 | { |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 647 | CLASS *classPtr; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 648 | ATOM atom; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 649 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 650 | hInstance = GetExePtr( hInstance ); |
| 651 | if (!(atom = GlobalFindAtom16( className ))) return FALSE; |
| 652 | if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 653 | (classPtr->hInstance != hInstance)) return FALSE; |
| 654 | return CLASS_FreeClass( classPtr ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 655 | } |
| 656 | |
| 657 | |
| 658 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 659 | * UnregisterClass32A (USER32.563) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 660 | * |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 661 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 662 | BOOL WINAPI UnregisterClassA( LPCSTR className, HINSTANCE hInstance ) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 663 | { CLASS *classPtr; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 664 | ATOM atom; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 665 | BOOL ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 666 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 667 | TRACE("%s %x\n",debugres_a(className), hInstance); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 668 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 669 | if (!(atom = GlobalFindAtomA( className ))) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 670 | { |
| 671 | SetLastError(ERROR_CLASS_DOES_NOT_EXIST); |
| 672 | return FALSE; |
| 673 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 674 | if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 675 | (classPtr->hInstance != hInstance)) |
| 676 | { |
| 677 | SetLastError(ERROR_CLASS_DOES_NOT_EXIST); |
| 678 | return FALSE; |
| 679 | } |
| 680 | if (!(ret = CLASS_FreeClass( classPtr ))) |
| 681 | SetLastError(ERROR_CLASS_HAS_WINDOWS); |
| 682 | return ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 683 | } |
| 684 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 685 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 686 | * UnregisterClass32W (USER32.564) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 687 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 688 | BOOL WINAPI UnregisterClassW( LPCWSTR className, HINSTANCE hInstance ) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 689 | { CLASS *classPtr; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 690 | ATOM atom; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 691 | BOOL ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 692 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 693 | TRACE("%s %x\n",debugres_w(className), hInstance); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 694 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 695 | if (!(atom = GlobalFindAtomW( className ))) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 696 | { |
| 697 | SetLastError(ERROR_CLASS_DOES_NOT_EXIST); |
| 698 | return FALSE; |
| 699 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 700 | if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 701 | (classPtr->hInstance != hInstance)) |
| 702 | { |
| 703 | SetLastError(ERROR_CLASS_DOES_NOT_EXIST); |
| 704 | return FALSE; |
| 705 | } |
| 706 | if (!(ret = CLASS_FreeClass( classPtr ))) |
| 707 | SetLastError(ERROR_CLASS_HAS_WINDOWS); |
| 708 | return ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 709 | } |
| 710 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 711 | /*********************************************************************** |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 712 | * GetClassWord16 (USER.129) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 713 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 714 | WORD WINAPI GetClassWord16( HWND16 hwnd, INT16 offset ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 715 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 716 | return GetClassWord( hwnd, offset ); |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 717 | } |
| 718 | |
| 719 | |
| 720 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 721 | * GetClassWord32 (USER32.219) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 722 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 723 | WORD WINAPI GetClassWord( HWND hwnd, INT offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 724 | { |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 725 | WND * wndPtr; |
Guy Albertelli | 2fa281f | 1999-04-24 11:54:40 +0000 | [diff] [blame] | 726 | WORD retvalue = 0; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 727 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 728 | TRACE("%x %x\n",hwnd, offset); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 729 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 730 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
| 731 | if (offset >= 0) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 732 | { |
| 733 | if (offset <= wndPtr->class->cbClsExtra - sizeof(WORD)) |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 734 | { |
Guy Albertelli | 2fa281f | 1999-04-24 11:54:40 +0000 | [diff] [blame] | 735 | retvalue = GET_WORD(((char *)wndPtr->class->wExtra) + offset); |
| 736 | goto END; |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 737 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 738 | } |
| 739 | else switch(offset) |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 740 | { |
Guy Albertelli | 2fa281f | 1999-04-24 11:54:40 +0000 | [diff] [blame] | 741 | case GCW_HBRBACKGROUND: retvalue = wndPtr->class->hbrBackground; |
| 742 | goto END; |
| 743 | case GCW_HCURSOR: retvalue = wndPtr->class->hCursor; |
| 744 | goto END; |
| 745 | case GCW_HICON: retvalue = wndPtr->class->hIcon; |
| 746 | goto END; |
| 747 | case GCW_HICONSM: retvalue = wndPtr->class->hIconSm; |
| 748 | goto END; |
| 749 | case GCW_ATOM: retvalue = wndPtr->class->atomName; |
| 750 | goto END; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 751 | case GCW_STYLE: |
| 752 | case GCW_CBWNDEXTRA: |
| 753 | case GCW_CBCLSEXTRA: |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 754 | case GCW_HMODULE: |
Guy Albertelli | 2fa281f | 1999-04-24 11:54:40 +0000 | [diff] [blame] | 755 | retvalue = (WORD)GetClassLongA( hwnd, offset ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 756 | } |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 757 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 758 | WARN("Invalid offset %d\n", offset); |
Guy Albertelli | 2fa281f | 1999-04-24 11:54:40 +0000 | [diff] [blame] | 759 | END: |
| 760 | WIN_ReleaseWndPtr(wndPtr); |
| 761 | return retvalue; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 762 | } |
| 763 | |
| 764 | |
| 765 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 766 | * GetClassLong16 (USER.131) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 767 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 768 | LONG WINAPI GetClassLong16( HWND16 hwnd, INT16 offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 769 | { |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 770 | WND *wndPtr; |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 771 | LONG ret; |
| 772 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 773 | TRACE("%x %x\n",hwnd, offset); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 774 | |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 775 | switch( offset ) |
| 776 | { |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 777 | case GCL_WNDPROC: |
| 778 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 779 | ret = (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_16 ); |
| 780 | WIN_ReleaseWndPtr(wndPtr); |
| 781 | return ret; |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 782 | case GCL_MENUNAME: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 783 | ret = GetClassLongA( hwnd, offset ); |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 784 | return (LONG)SEGPTR_GET( (void *)ret ); |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 785 | default: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 786 | return GetClassLongA( hwnd, offset ); |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 787 | } |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 788 | } |
| 789 | |
| 790 | |
| 791 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 792 | * GetClassLong32A (USER32.215) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 793 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 794 | LONG WINAPI GetClassLongA( HWND hwnd, INT offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 795 | { |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 796 | WND * wndPtr; |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 797 | LONG retvalue; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 798 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 799 | TRACE("%x %x\n",hwnd, offset); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 800 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 801 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 802 | if (offset >= 0) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 803 | { |
| 804 | if (offset <= wndPtr->class->cbClsExtra - sizeof(LONG)) |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 805 | { |
| 806 | retvalue = GET_DWORD(((char *)wndPtr->class->wExtra) + offset); |
| 807 | goto END; |
| 808 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 809 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 810 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 811 | switch(offset) |
| 812 | { |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 813 | case GCL_STYLE: retvalue = (LONG)wndPtr->class->style; |
| 814 | goto END; |
| 815 | case GCL_CBWNDEXTRA: retvalue = (LONG)wndPtr->class->cbWndExtra; |
| 816 | goto END; |
| 817 | case GCL_CBCLSEXTRA: retvalue = (LONG)wndPtr->class->cbClsExtra; |
| 818 | goto END; |
| 819 | case GCL_HMODULE: retvalue = (LONG)wndPtr->class->hInstance; |
| 820 | goto END; |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 821 | case GCL_WNDPROC: |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 822 | retvalue = (LONG)WINPROC_GetProc(wndPtr->class->winproc, WIN_PROC_32A); |
| 823 | goto END; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 824 | case GCL_MENUNAME: |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 825 | retvalue = (LONG)CLASS_GetMenuNameA( wndPtr->class ); |
| 826 | goto END; |
NF Stevens | be15666 | 1998-12-07 12:48:16 +0000 | [diff] [blame] | 827 | case GCW_ATOM: |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 828 | case GCL_HBRBACKGROUND: |
| 829 | case GCL_HCURSOR: |
| 830 | case GCL_HICON: |
| 831 | case GCL_HICONSM: |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 832 | retvalue = GetClassWord( hwnd, offset ); |
| 833 | goto END; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 834 | } |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 835 | WARN("Invalid offset %d\n", offset); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 836 | retvalue = 0; |
| 837 | END: |
| 838 | WIN_ReleaseWndPtr(wndPtr); |
| 839 | return retvalue; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 840 | } |
| 841 | |
| 842 | |
| 843 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 844 | * GetClassLong32W (USER32.216) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 845 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 846 | LONG WINAPI GetClassLongW( HWND hwnd, INT offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 847 | { |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 848 | WND * wndPtr; |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 849 | LONG retvalue; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 850 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 851 | TRACE("%x %x\n",hwnd, offset); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 852 | |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 853 | switch(offset) |
| 854 | { |
| 855 | case GCL_WNDPROC: |
| 856 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 857 | retvalue = (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_32W ); |
| 858 | WIN_ReleaseWndPtr(wndPtr); |
| 859 | return retvalue; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 860 | case GCL_MENUNAME: |
| 861 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 862 | retvalue = (LONG)CLASS_GetMenuNameW( wndPtr->class ); |
| 863 | WIN_ReleaseWndPtr(wndPtr); |
| 864 | return retvalue; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 865 | default: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 866 | return GetClassLongA( hwnd, offset ); |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 867 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 868 | } |
| 869 | |
| 870 | |
| 871 | /*********************************************************************** |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 872 | * SetClassWord16 (USER.130) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 873 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 874 | WORD WINAPI SetClassWord16( HWND16 hwnd, INT16 offset, WORD newval ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 875 | { |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 876 | return SetClassWord( hwnd, offset, newval ); |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 877 | } |
| 878 | |
| 879 | |
| 880 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 881 | * SetClassWord32 (USER32.469) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 882 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 883 | WORD WINAPI SetClassWord( HWND hwnd, INT offset, WORD newval ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 884 | { |
| 885 | WND * wndPtr; |
| 886 | WORD retval = 0; |
| 887 | void *ptr; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 888 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 889 | TRACE("%x %x %x\n",hwnd, offset, newval); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 890 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 891 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 892 | if (offset >= 0) |
| 893 | { |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 894 | if (offset + sizeof(WORD) <= wndPtr->class->cbClsExtra) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 895 | ptr = ((char *)wndPtr->class->wExtra) + offset; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 896 | else |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 897 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 898 | WARN("Invalid offset %d\n", offset ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 899 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 900 | return 0; |
| 901 | } |
| 902 | } |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 903 | else switch(offset) |
| 904 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 905 | case GCW_STYLE: |
| 906 | case GCW_CBWNDEXTRA: |
| 907 | case GCW_CBCLSEXTRA: |
| 908 | case GCW_HMODULE: |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 909 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 910 | return (WORD)SetClassLongA( hwnd, offset, (LONG)newval ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 911 | case GCW_HBRBACKGROUND: ptr = &wndPtr->class->hbrBackground; break; |
| 912 | case GCW_HCURSOR: ptr = &wndPtr->class->hCursor; break; |
| 913 | case GCW_HICON: ptr = &wndPtr->class->hIcon; break; |
| 914 | case GCW_HICONSM: ptr = &wndPtr->class->hIconSm; break; |
| 915 | case GCW_ATOM: ptr = &wndPtr->class->atomName; break; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 916 | default: |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 917 | WARN("Invalid offset %d\n", offset); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 918 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 919 | return 0; |
| 920 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 921 | retval = GET_WORD(ptr); |
| 922 | PUT_WORD( ptr, newval ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 923 | |
| 924 | /* Note: If the GCW_ATOM was changed, this means that the WNDCLASS className fields |
| 925 | need to be updated as well. Problem is that we can't tell whether the atom is |
| 926 | using wide or narrow characters. For now, we'll just NULL out the className |
| 927 | fields, and emit a FIXME. */ |
| 928 | if (offset == GCW_ATOM) |
| 929 | { |
| 930 | CLASS_SetClassNameA( wndPtr->class, NULL ); |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 931 | FIXME("GCW_ATOM changed for a class. Not updating className, so GetClassInfoEx may not return correct className!\n"); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 932 | } |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 933 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 934 | return retval; |
| 935 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 936 | |
| 937 | |
| 938 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 939 | * SetClassLong16 (USER.132) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 940 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 941 | LONG WINAPI SetClassLong16( HWND16 hwnd, INT16 offset, LONG newval ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 942 | { |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 943 | WND *wndPtr; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 944 | LONG retval; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 945 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 946 | TRACE("%x %x %lx\n",hwnd, offset, newval); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 947 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 948 | switch(offset) |
| 949 | { |
| 950 | case GCL_WNDPROC: |
| 951 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 952 | retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_16 ); |
| 953 | WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 954 | WIN_PROC_16, WIN_PROC_CLASS ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 955 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 956 | return retval; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 957 | case GCL_MENUNAME: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 958 | return SetClassLongA( hwnd, offset, (LONG)PTR_SEG_TO_LIN(newval) ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 959 | default: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 960 | return SetClassLongA( hwnd, offset, newval ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 961 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 962 | } |
| 963 | |
| 964 | |
| 965 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 966 | * SetClassLong32A (USER32.467) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 967 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 968 | LONG WINAPI SetClassLongA( HWND hwnd, INT offset, LONG newval ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 969 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 970 | WND * wndPtr; |
| 971 | LONG retval = 0; |
| 972 | void *ptr; |
| 973 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 974 | TRACE("%x %x %lx\n",hwnd, offset, newval); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 975 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 976 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
| 977 | if (offset >= 0) |
| 978 | { |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 979 | if (offset + sizeof(LONG) <= wndPtr->class->cbClsExtra) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 980 | ptr = ((char *)wndPtr->class->wExtra) + offset; |
| 981 | else |
| 982 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 983 | WARN("Invalid offset %d\n", offset ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 984 | retval = 0; |
| 985 | goto END; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 986 | } |
| 987 | } |
| 988 | else switch(offset) |
| 989 | { |
| 990 | case GCL_MENUNAME: |
| 991 | CLASS_SetMenuNameA( wndPtr->class, (LPCSTR)newval ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 992 | retval = 0; /* Old value is now meaningless anyway */ |
| 993 | goto END; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 994 | case GCL_WNDPROC: |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 995 | retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc, |
| 996 | WIN_PROC_32A ); |
| 997 | WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 998 | WIN_PROC_32A, WIN_PROC_CLASS ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 999 | goto END; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1000 | case GCL_HBRBACKGROUND: |
| 1001 | case GCL_HCURSOR: |
| 1002 | case GCL_HICON: |
| 1003 | case GCL_HICONSM: |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1004 | retval = SetClassWord( hwnd, offset, (WORD)newval ); |
| 1005 | goto END; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1006 | case GCL_STYLE: ptr = &wndPtr->class->style; break; |
| 1007 | case GCL_CBWNDEXTRA: ptr = &wndPtr->class->cbWndExtra; break; |
| 1008 | case GCL_CBCLSEXTRA: ptr = &wndPtr->class->cbClsExtra; break; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1009 | case GCL_HMODULE: ptr = &wndPtr->class->hInstance; break; |
| 1010 | default: |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1011 | WARN("Invalid offset %d\n", offset ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1012 | retval = 0; |
| 1013 | goto END; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1014 | } |
| 1015 | retval = GET_DWORD(ptr); |
| 1016 | PUT_DWORD( ptr, newval ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1017 | END: |
| 1018 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1019 | return retval; |
| 1020 | } |
| 1021 | |
| 1022 | |
| 1023 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1024 | * SetClassLong32W (USER32.468) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1025 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1026 | LONG WINAPI SetClassLongW( HWND hwnd, INT offset, LONG newval ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1027 | { |
| 1028 | WND *wndPtr; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1029 | LONG retval; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1030 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1031 | TRACE("%x %x %lx\n",hwnd, offset, newval); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1032 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1033 | switch(offset) |
| 1034 | { |
| 1035 | case GCL_WNDPROC: |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1036 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
| 1037 | retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_32W ); |
| 1038 | WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval, |
Alexandre Julliard | df2673b | 1997-03-29 17:20:20 +0000 | [diff] [blame] | 1039 | WIN_PROC_32W, WIN_PROC_CLASS ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1040 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1041 | return retval; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1042 | case GCL_MENUNAME: |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1043 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1044 | CLASS_SetMenuNameW( wndPtr->class, (LPCWSTR)newval ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1045 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1046 | return 0; /* Old value is now meaningless anyway */ |
| 1047 | default: |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1048 | return SetClassLongA( hwnd, offset, newval ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1049 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1050 | } |
| 1051 | |
| 1052 | |
| 1053 | /*********************************************************************** |
| 1054 | * GetClassName16 (USER.58) |
| 1055 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1056 | INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1057 | { |
| 1058 | WND *wndPtr; |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1059 | INT16 retvalue; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1060 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1061 | retvalue = GlobalGetAtomName16( wndPtr->class->atomName, buffer, count ); |
| 1062 | WIN_ReleaseWndPtr(wndPtr); |
| 1063 | return retvalue; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1064 | } |
| 1065 | |
| 1066 | |
| 1067 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1068 | * GetClassName32A (USER32.217) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1069 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1070 | INT WINAPI GetClassNameA( HWND hwnd, LPSTR buffer, INT count ) |
| 1071 | { INT ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1072 | WND *wndPtr; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1073 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1074 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1075 | ret = GlobalGetAtomNameA( wndPtr->class->atomName, buffer, count ); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1076 | |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1077 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1078 | TRACE("%x %s %x\n",hwnd, buffer, count); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1079 | return ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1080 | } |
| 1081 | |
| 1082 | |
| 1083 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1084 | * GetClassName32W (USER32.218) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1085 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1086 | INT WINAPI GetClassNameW( HWND hwnd, LPWSTR buffer, INT count ) |
| 1087 | { INT ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1088 | WND *wndPtr; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1089 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1090 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1091 | ret = GlobalGetAtomNameW( wndPtr->class->atomName, buffer, count ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 1092 | WIN_ReleaseWndPtr(wndPtr); |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1093 | TRACE("%x %s %x\n",hwnd, debugstr_w(buffer), count); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1094 | |
| 1095 | return ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1096 | } |
| 1097 | |
| 1098 | |
| 1099 | /*********************************************************************** |
| 1100 | * GetClassInfo16 (USER.404) |
| 1101 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1102 | BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, |
| 1103 | WNDCLASS16 *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1104 | { |
| 1105 | ATOM atom; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1106 | CLASS *classPtr; |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 1107 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1108 | TRACE("%x %p %p\n",hInstance, PTR_SEG_TO_LIN (name), wc); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1109 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1110 | hInstance = GetExePtr( hInstance ); |
| 1111 | if (!(atom = GlobalFindAtom16( name )) || |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1112 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance ))) |
| 1113 | return FALSE; |
| 1114 | if ((hInstance != classPtr->hInstance) && |
| 1115 | !(classPtr->style & CS_GLOBALCLASS)) /*BWCC likes to pass hInstance=0*/ |
| 1116 | return FALSE; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1117 | wc->style = (UINT16)classPtr->style; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1118 | wc->lpfnWndProc = WINPROC_GetProc( classPtr->winproc, WIN_PROC_16 ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1119 | wc->cbClsExtra = (INT16)classPtr->cbClsExtra; |
| 1120 | wc->cbWndExtra = (INT16)classPtr->cbWndExtra; |
| 1121 | wc->hInstance = (HINSTANCE16)classPtr->hInstance; |
| 1122 | wc->hIcon = classPtr->hIcon; |
| 1123 | wc->hCursor = classPtr->hCursor; |
| 1124 | wc->hbrBackground = classPtr->hbrBackground; |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 1125 | wc->lpszClassName = (SEGPTR)CLASS_GetClassNameA( classPtr );; |
NF Stevens | a406682 | 1998-12-01 08:29:29 +0000 | [diff] [blame] | 1126 | if (HIWORD(wc->lpszClassName)) /* Make it a SEGPTR */ |
| 1127 | wc->lpszClassName = SEGPTR_GET( (LPSTR)wc->lpszClassName ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1128 | wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr ); |
| 1129 | if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */ |
| 1130 | wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName ); |
| 1131 | return TRUE; |
| 1132 | } |
| 1133 | |
| 1134 | |
| 1135 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1136 | * GetClassInfo32A (USER32.211) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1137 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1138 | BOOL WINAPI GetClassInfoA( HINSTANCE hInstance, LPCSTR name, |
| 1139 | WNDCLASSA *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1140 | { |
| 1141 | ATOM atom; |
| 1142 | CLASS *classPtr; |
| 1143 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1144 | TRACE("%x %p %p\n",hInstance, name, wc); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1145 | |
| 1146 | /* workaround: if hInstance=NULL you expect to get the system classes |
| 1147 | but this classes (as example from comctl32.dll SysListView) won't be |
| 1148 | registred with hInstance=NULL in WINE because of the late loading |
| 1149 | of this dll. fixes file dialogs in WinWord95 (jsch)*/ |
| 1150 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1151 | if (!(atom=GlobalFindAtomA(name)) || !(classPtr=CLASS_FindClassByAtom(atom,hInstance))) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1152 | return FALSE; |
| 1153 | |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1154 | if (classPtr->hInstance && (hInstance != classPtr->hInstance)) |
| 1155 | { |
| 1156 | if (hInstance) return FALSE; |
| 1157 | else |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1158 | WARN("systemclass %s (hInst=0) demanded but only class with hInst!=0 found\n",name); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1159 | } |
| 1160 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1161 | wc->style = classPtr->style; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1162 | wc->lpfnWndProc = (WNDPROC)WINPROC_GetProc( classPtr->winproc, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1163 | WIN_PROC_32A ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1164 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 1165 | wc->cbWndExtra = classPtr->cbWndExtra; |
| 1166 | wc->hInstance = classPtr->hInstance; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1167 | wc->hIcon = (HICON)classPtr->hIcon; |
| 1168 | wc->hCursor = (HCURSOR)classPtr->hCursor; |
| 1169 | wc->hbrBackground = (HBRUSH)classPtr->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1170 | wc->lpszMenuName = CLASS_GetMenuNameA( classPtr ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 1171 | wc->lpszClassName = CLASS_GetClassNameA( classPtr ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1172 | return TRUE; |
| 1173 | } |
| 1174 | |
| 1175 | |
| 1176 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1177 | * GetClassInfo32W (USER32.214) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1178 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1179 | BOOL WINAPI GetClassInfoW( HINSTANCE hInstance, LPCWSTR name, |
| 1180 | WNDCLASSW *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1181 | { |
| 1182 | ATOM atom; |
| 1183 | CLASS *classPtr; |
| 1184 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1185 | TRACE("%x %p %p\n",hInstance, name, wc); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1186 | |
Marcus Meissner | 43806217 | 1999-09-03 12:28:20 +0000 | [diff] [blame^] | 1187 | if ( !(atom=GlobalFindAtomW(name)) || |
| 1188 | !(classPtr=CLASS_FindClassByAtom(atom,hInstance)) |
| 1189 | ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1190 | return FALSE; |
| 1191 | |
Marcus Meissner | 43806217 | 1999-09-03 12:28:20 +0000 | [diff] [blame^] | 1192 | if (classPtr->hInstance && (hInstance != classPtr->hInstance)) { |
| 1193 | if (hInstance) |
| 1194 | return FALSE; |
| 1195 | else |
| 1196 | WARN("systemclass %s (hInst=0) demanded but only class with hInst!=0 found\n",debugstr_w(name)); |
| 1197 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1198 | wc->style = classPtr->style; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1199 | wc->lpfnWndProc = (WNDPROC)WINPROC_GetProc( classPtr->winproc, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1200 | WIN_PROC_32W ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1201 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 1202 | wc->cbWndExtra = classPtr->cbWndExtra; |
| 1203 | wc->hInstance = classPtr->hInstance; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1204 | wc->hIcon = (HICON)classPtr->hIcon; |
| 1205 | wc->hCursor = (HCURSOR)classPtr->hCursor; |
| 1206 | wc->hbrBackground = (HBRUSH)classPtr->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1207 | wc->lpszMenuName = CLASS_GetMenuNameW( classPtr ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 1208 | wc->lpszClassName = CLASS_GetClassNameW( classPtr ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1209 | return TRUE; |
| 1210 | } |
| 1211 | |
| 1212 | |
| 1213 | /*********************************************************************** |
| 1214 | * GetClassInfoEx16 (USER.398) |
| 1215 | * |
| 1216 | * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the |
| 1217 | * same in Win16 as in Win32. --AJ |
| 1218 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1219 | BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, |
| 1220 | WNDCLASSEX16 *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1221 | { |
| 1222 | ATOM atom; |
| 1223 | CLASS *classPtr; |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 1224 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1225 | TRACE("%x %p %p\n",hInstance,PTR_SEG_TO_LIN( name ), wc); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1226 | |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 1227 | hInstance = GetExePtr( hInstance ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1228 | if (!(atom = GlobalFindAtom16( name )) || |
| 1229 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 1230 | (hInstance != classPtr->hInstance)) return FALSE; |
| 1231 | wc->style = classPtr->style; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1232 | wc->lpfnWndProc = WINPROC_GetProc( classPtr->winproc, WIN_PROC_16 ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1233 | wc->cbClsExtra = (INT16)classPtr->cbClsExtra; |
| 1234 | wc->cbWndExtra = (INT16)classPtr->cbWndExtra; |
| 1235 | wc->hInstance = (HINSTANCE16)classPtr->hInstance; |
| 1236 | wc->hIcon = classPtr->hIcon; |
| 1237 | wc->hIconSm = classPtr->hIconSm; |
| 1238 | wc->hCursor = classPtr->hCursor; |
| 1239 | wc->hbrBackground = classPtr->hbrBackground; |
| 1240 | wc->lpszClassName = (SEGPTR)0; |
| 1241 | wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr ); |
| 1242 | if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */ |
| 1243 | wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 1244 | wc->lpszClassName = (SEGPTR)CLASS_GetClassNameA( classPtr ); |
| 1245 | if (HIWORD(wc->lpszClassName)) /* Make it a SEGPTR */ |
| 1246 | wc->lpszClassName = SEGPTR_GET( (LPSTR)wc->lpszClassName ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1247 | return TRUE; |
| 1248 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1249 | |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 1250 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1251 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1252 | * GetClassInfoEx32A (USER32.212) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1253 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1254 | BOOL WINAPI GetClassInfoExA( HINSTANCE hInstance, LPCSTR name, |
| 1255 | WNDCLASSEXA *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1256 | { |
| 1257 | ATOM atom; |
| 1258 | CLASS *classPtr; |
| 1259 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1260 | TRACE("%x %p %p\n",hInstance, name, wc); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1261 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1262 | if (!(atom = GlobalFindAtomA( name )) || |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1263 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) |
| 1264 | /*|| (hInstance != classPtr->hInstance) */ ) return FALSE; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1265 | wc->style = classPtr->style; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1266 | wc->lpfnWndProc = (WNDPROC)WINPROC_GetProc( classPtr->winproc, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1267 | WIN_PROC_32A ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1268 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 1269 | wc->cbWndExtra = classPtr->cbWndExtra; |
| 1270 | wc->hInstance = classPtr->hInstance; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1271 | wc->hIcon = (HICON)classPtr->hIcon; |
| 1272 | wc->hIconSm = (HICON)classPtr->hIconSm; |
| 1273 | wc->hCursor = (HCURSOR)classPtr->hCursor; |
| 1274 | wc->hbrBackground = (HBRUSH)classPtr->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1275 | wc->lpszMenuName = CLASS_GetMenuNameA( classPtr ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 1276 | wc->lpszClassName = CLASS_GetClassNameA( classPtr ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1277 | return TRUE; |
| 1278 | } |
| 1279 | |
| 1280 | |
| 1281 | /*********************************************************************** |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 1282 | * GetClassInfoEx32W (USER32.213) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1283 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1284 | BOOL WINAPI GetClassInfoExW( HINSTANCE hInstance, LPCWSTR name, |
| 1285 | WNDCLASSEXW *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1286 | { |
| 1287 | ATOM atom; |
| 1288 | CLASS *classPtr; |
| 1289 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1290 | TRACE("%x %p %p\n",hInstance, name, wc); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1291 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1292 | if (!(atom = GlobalFindAtomW( name )) || |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1293 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 1294 | (hInstance != classPtr->hInstance)) return FALSE; |
| 1295 | wc->style = classPtr->style; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1296 | wc->lpfnWndProc = (WNDPROC)WINPROC_GetProc( classPtr->winproc, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1297 | WIN_PROC_32W ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1298 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 1299 | wc->cbWndExtra = classPtr->cbWndExtra; |
| 1300 | wc->hInstance = classPtr->hInstance; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1301 | wc->hIcon = (HICON)classPtr->hIcon; |
| 1302 | wc->hIconSm = (HICON)classPtr->hIconSm; |
| 1303 | wc->hCursor = (HCURSOR)classPtr->hCursor; |
| 1304 | wc->hbrBackground = (HBRUSH)classPtr->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1305 | wc->lpszMenuName = CLASS_GetMenuNameW( classPtr ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 1306 | wc->lpszClassName = CLASS_GetClassNameW( classPtr );; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1307 | return TRUE; |
| 1308 | } |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1309 | |
| 1310 | |
| 1311 | /*********************************************************************** |
| 1312 | * ClassFirst (TOOLHELP.69) |
| 1313 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1314 | BOOL16 WINAPI ClassFirst16( CLASSENTRY *pClassEntry ) |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1315 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1316 | TRACE("%p\n",pClassEntry); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1317 | pClassEntry->wNext = 1; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1318 | return ClassNext16( pClassEntry ); |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1319 | } |
| 1320 | |
| 1321 | |
| 1322 | /*********************************************************************** |
| 1323 | * ClassNext (TOOLHELP.70) |
| 1324 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1325 | BOOL16 WINAPI ClassNext16( CLASSENTRY *pClassEntry ) |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1326 | { |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1327 | int i; |
| 1328 | CLASS *class = firstClass; |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1329 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1330 | TRACE("%p\n",pClassEntry); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1331 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1332 | if (!pClassEntry->wNext) return FALSE; |
| 1333 | for (i = 1; (i < pClassEntry->wNext) && class; i++) class = class->next; |
| 1334 | if (!class) |
| 1335 | { |
| 1336 | pClassEntry->wNext = 0; |
| 1337 | return FALSE; |
| 1338 | } |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 1339 | pClassEntry->hInst = class->hInstance; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1340 | pClassEntry->wNext++; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1341 | GlobalGetAtomNameA( class->atomName, pClassEntry->szClassName, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1342 | sizeof(pClassEntry->szClassName) ); |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1343 | return TRUE; |
| 1344 | } |