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 | bd34d4f | 1995-06-20 19:08:12 +0000 | [diff] [blame] | 5 | */ |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 6 | |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 7 | #include <stdlib.h> |
| 8 | #include <stdio.h> |
| 9 | #include <string.h> |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 10 | #include "class.h" |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 11 | #include "heap.h" |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 12 | #include "win.h" |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 13 | #include "dce.h" |
Alexandre Julliard | e2991ea | 1995-07-29 13:09:43 +0000 | [diff] [blame] | 14 | #include "atom.h" |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 15 | #include "ldt.h" |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 16 | #include "string32.h" |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 17 | #include "toolhelp.h" |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 18 | #include "winproc.h" |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 19 | #include "stddebug.h" |
Alexandre Julliard | aca0578 | 1994-10-17 18:12:41 +0000 | [diff] [blame] | 20 | #include "debug.h" |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 21 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 22 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 23 | static CLASS *firstClass = NULL; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 24 | |
| 25 | |
| 26 | /*********************************************************************** |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 27 | * CLASS_DumpClass |
| 28 | * |
| 29 | * Dump the content of a class structure to stderr. |
| 30 | */ |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 31 | void CLASS_DumpClass( CLASS *ptr ) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 32 | { |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 33 | char className[80]; |
| 34 | int i; |
| 35 | |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 36 | if (ptr->magic != CLASS_MAGIC) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 37 | { |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 38 | fprintf( stderr, "%p is not a class\n", ptr ); |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 39 | return; |
| 40 | } |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 41 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 42 | GlobalGetAtomName32A( ptr->atomName, className, sizeof(className) ); |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 43 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 44 | fprintf( stderr, "Class %p:\n", ptr ); |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 45 | fprintf( stderr, |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 46 | "next=%p name=%04x '%s' style=%08x wndProc=%08x\n" |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 47 | "inst=%04x hdce=%04x icon=%04x cursor=%04x bkgnd=%04x\n" |
| 48 | "clsExtra=%d winExtra=%d #windows=%d\n", |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 49 | ptr->next, ptr->atomName, className, ptr->style, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 50 | (UINT32)ptr->winproc, ptr->hInstance, ptr->hdce, |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 51 | ptr->hIcon, ptr->hCursor, ptr->hbrBackground, |
| 52 | ptr->cbClsExtra, ptr->cbWndExtra, ptr->cWindows ); |
| 53 | if (ptr->cbClsExtra) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 54 | { |
| 55 | fprintf( stderr, "extra bytes:" ); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 56 | for (i = 0; i < ptr->cbClsExtra; i++) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 57 | fprintf( stderr, " %02x", *((BYTE *)ptr->wExtra+i) ); |
| 58 | fprintf( stderr, "\n" ); |
| 59 | } |
| 60 | fprintf( stderr, "\n" ); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | /*********************************************************************** |
| 65 | * CLASS_WalkClasses |
| 66 | * |
| 67 | * Walk the class list and print each class on stderr. |
| 68 | */ |
| 69 | void CLASS_WalkClasses(void) |
| 70 | { |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 71 | CLASS *ptr; |
| 72 | char className[80]; |
| 73 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 74 | fprintf( stderr, " Class Name Style WndProc\n" ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 75 | for (ptr = firstClass; ptr; ptr = ptr->next) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 76 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 77 | GlobalGetAtomName32A( ptr->atomName, className, sizeof(className) ); |
| 78 | fprintf( stderr, "%08x %-20.20s %08x %08x\n", (UINT32)ptr, className, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 79 | ptr->style, (UINT32)ptr->winproc ); |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 80 | } |
| 81 | fprintf( stderr, "\n" ); |
| 82 | } |
| 83 | |
| 84 | |
| 85 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 86 | * CLASS_GetMenuNameA |
| 87 | * |
| 88 | * Get the menu name as a ASCII string. |
| 89 | */ |
| 90 | static LPSTR CLASS_GetMenuNameA( CLASS *classPtr ) |
| 91 | { |
| 92 | if (!classPtr->menuNameA && classPtr->menuNameW) |
| 93 | { |
| 94 | /* We need to copy the Unicode string */ |
| 95 | if ((classPtr->menuNameA = SEGPTR_ALLOC( |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 96 | lstrlen32W(classPtr->menuNameW) + 1 ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 97 | STRING32_UniToAnsi( classPtr->menuNameA, classPtr->menuNameW ); |
| 98 | } |
| 99 | return classPtr->menuNameA; |
| 100 | } |
| 101 | |
| 102 | |
| 103 | /*********************************************************************** |
| 104 | * CLASS_GetMenuNameW |
| 105 | * |
| 106 | * Get the menu name as a Unicode string. |
| 107 | */ |
| 108 | static LPWSTR CLASS_GetMenuNameW( CLASS *classPtr ) |
| 109 | { |
| 110 | if (!classPtr->menuNameW && classPtr->menuNameA) |
| 111 | { |
| 112 | if (!HIWORD(classPtr->menuNameA)) |
| 113 | return (LPWSTR)classPtr->menuNameA; |
| 114 | /* Now we need to copy the ASCII string */ |
| 115 | if ((classPtr->menuNameW = HeapAlloc( SystemHeap, 0, |
| 116 | (strlen(classPtr->menuNameA)+1)*sizeof(WCHAR) ))) |
| 117 | STRING32_AnsiToUni( classPtr->menuNameW, classPtr->menuNameA ); |
| 118 | } |
| 119 | return classPtr->menuNameW; |
| 120 | } |
| 121 | |
| 122 | |
| 123 | /*********************************************************************** |
| 124 | * CLASS_SetMenuNameA |
| 125 | * |
| 126 | * Set the menu name in a class structure by copying the string. |
| 127 | */ |
| 128 | static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name ) |
| 129 | { |
| 130 | if (HIWORD(classPtr->menuNameA)) SEGPTR_FREE( classPtr->menuNameA ); |
| 131 | if (classPtr->menuNameW) HeapFree( SystemHeap, 0, classPtr->menuNameW ); |
| 132 | classPtr->menuNameA = SEGPTR_STRDUP( name ); |
| 133 | classPtr->menuNameW = 0; |
| 134 | } |
| 135 | |
| 136 | |
| 137 | /*********************************************************************** |
| 138 | * CLASS_SetMenuNameW |
| 139 | * |
| 140 | * Set the menu name in a class structure by copying the string. |
| 141 | */ |
| 142 | static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name ) |
| 143 | { |
| 144 | if (!HIWORD(name)) |
| 145 | { |
| 146 | CLASS_SetMenuNameA( classPtr, (LPCSTR)name ); |
| 147 | return; |
| 148 | } |
| 149 | if (HIWORD(classPtr->menuNameA)) SEGPTR_FREE( classPtr->menuNameA ); |
| 150 | if (classPtr->menuNameW) HeapFree( SystemHeap, 0, classPtr->menuNameW ); |
| 151 | if ((classPtr->menuNameW = HeapAlloc( SystemHeap, 0, |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 152 | (lstrlen32W(name)+1)*sizeof(WCHAR) ))) |
| 153 | lstrcpy32W( classPtr->menuNameW, name ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 154 | classPtr->menuNameA = 0; |
| 155 | } |
| 156 | |
| 157 | |
| 158 | /*********************************************************************** |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 159 | * CLASS_FreeClass |
| 160 | * |
| 161 | * Free a class structure. |
| 162 | */ |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 163 | static BOOL CLASS_FreeClass( CLASS *classPtr ) |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 164 | { |
| 165 | CLASS **ppClass; |
| 166 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 167 | /* Check if we can remove this class */ |
| 168 | |
| 169 | if (classPtr->cWindows > 0) return FALSE; |
| 170 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 171 | /* Remove the class from the linked list */ |
| 172 | |
| 173 | for (ppClass = &firstClass; *ppClass; ppClass = &(*ppClass)->next) |
| 174 | if (*ppClass == classPtr) break; |
| 175 | if (!*ppClass) |
| 176 | { |
| 177 | fprintf(stderr, "ERROR: Class list corrupted\n" ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 178 | return FALSE; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 179 | } |
| 180 | *ppClass = classPtr->next; |
| 181 | |
| 182 | /* Delete the class */ |
| 183 | |
| 184 | if (classPtr->hdce) DCE_FreeDCE( classPtr->hdce ); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 185 | if (classPtr->hbrBackground) DeleteObject( classPtr->hbrBackground ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 186 | GlobalDeleteAtom( classPtr->atomName ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 187 | CLASS_SetMenuNameA( classPtr, NULL ); |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 188 | WINPROC_FreeProc( classPtr->winproc ); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 189 | HeapFree( SystemHeap, 0, classPtr ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 190 | return TRUE; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 191 | } |
| 192 | |
| 193 | |
| 194 | /*********************************************************************** |
| 195 | * CLASS_FreeModuleClasses |
| 196 | */ |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 197 | void CLASS_FreeModuleClasses( HMODULE16 hModule ) |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 198 | { |
| 199 | CLASS *ptr, *next; |
| 200 | |
| 201 | for (ptr = firstClass; ptr; ptr = next) |
| 202 | { |
| 203 | next = ptr->next; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 204 | if (ptr->hInstance == hModule) CLASS_FreeClass( ptr ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 205 | } |
| 206 | } |
| 207 | |
| 208 | |
| 209 | /*********************************************************************** |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 210 | * CLASS_FindClassByAtom |
| 211 | * |
| 212 | * Return a pointer to the class. |
| 213 | */ |
| 214 | CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE16 hinstance ) |
| 215 | { |
| 216 | CLASS * class; |
| 217 | |
| 218 | /* First search task-specific classes */ |
| 219 | |
| 220 | for (class = firstClass; (class); class = class->next) |
| 221 | { |
| 222 | if (class->style & CS_GLOBALCLASS) continue; |
| 223 | if ((class->atomName == atom) && |
| 224 | ((hinstance==(HINSTANCE16)0xffff) || |
| 225 | (hinstance == class->hInstance))) return class; |
| 226 | } |
| 227 | |
| 228 | /* Then search global classes */ |
| 229 | |
| 230 | for (class = firstClass; (class); class = class->next) |
| 231 | { |
| 232 | if (!(class->style & CS_GLOBALCLASS)) continue; |
| 233 | if (class->atomName == atom) return class; |
| 234 | } |
| 235 | |
| 236 | return 0; |
| 237 | } |
| 238 | |
| 239 | |
| 240 | /*********************************************************************** |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 241 | * CLASS_FindClassByName |
| 242 | * |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 243 | * Return a pointer to the class. |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 244 | */ |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 245 | CLASS *CLASS_FindClassByName( SEGPTR name, HINSTANCE hinstance ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 246 | { |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 247 | ATOM atom; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 248 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 249 | if (!(atom = GlobalFindAtom16( name ))) return 0; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 250 | return CLASS_FindClassByAtom( atom, hinstance ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 251 | } |
| 252 | |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 253 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 254 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 255 | * CLASS_RegisterClass |
| 256 | * |
| 257 | * The real RegisterClass() functionality. |
| 258 | */ |
| 259 | static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE32 hInstance, |
| 260 | DWORD style, INT32 classExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 261 | INT32 winExtra, WNDPROC16 wndProc, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 262 | WINDOWPROCTYPE wndProcType ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 263 | { |
| 264 | CLASS *classPtr; |
| 265 | |
| 266 | /* Check if a class with this name already exists */ |
| 267 | |
| 268 | classPtr = CLASS_FindClassByAtom( atom, hInstance ); |
| 269 | if (classPtr) |
| 270 | { |
| 271 | /* Class can be created only if it is local and */ |
| 272 | /* if the class with the same name is global. */ |
| 273 | |
| 274 | if (style & CS_GLOBALCLASS) return NULL; |
| 275 | if (!(classPtr->style & CS_GLOBALCLASS)) return NULL; |
| 276 | } |
| 277 | |
| 278 | /* Fix the extra bytes value */ |
| 279 | |
| 280 | if (classExtra < 0) classExtra = 0; |
| 281 | else if (classExtra > 40) /* Extra bytes are limited to 40 in Win32 */ |
| 282 | fprintf(stderr, "Warning: class extra bytes %d is > 40\n", classExtra); |
| 283 | if (winExtra < 0) winExtra = 0; |
| 284 | else if (winExtra > 40) /* Extra bytes are limited to 40 in Win32 */ |
| 285 | fprintf( stderr, "Warning: win extra bytes %d is > 40\n", winExtra ); |
| 286 | |
| 287 | /* Create the class */ |
| 288 | |
| 289 | classPtr = (CLASS *)HeapAlloc( SystemHeap, 0, sizeof(CLASS) + |
| 290 | classExtra - sizeof(classPtr->wExtra) ); |
| 291 | if (!classPtr) return NULL; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 292 | classPtr->next = firstClass; |
| 293 | classPtr->magic = CLASS_MAGIC; |
| 294 | classPtr->cWindows = 0; |
| 295 | classPtr->style = style; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 296 | classPtr->winproc = (HWINDOWPROC)0; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 297 | classPtr->cbWndExtra = winExtra; |
| 298 | classPtr->cbClsExtra = classExtra; |
| 299 | classPtr->hInstance = hInstance; |
| 300 | classPtr->atomName = atom; |
| 301 | classPtr->menuNameA = 0; |
| 302 | classPtr->menuNameW = 0; |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 303 | classPtr->hdce = (style&CS_CLASSDC) ? DCE_AllocDCE(0, DCE_CLASS_DC): 0; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 304 | WINPROC_SetProc( &classPtr->winproc, wndProc, wndProcType ); |
| 305 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 306 | /* Other values must be set by caller */ |
| 307 | |
| 308 | if (classExtra) memset( classPtr->wExtra, 0, classExtra ); |
| 309 | firstClass = classPtr; |
| 310 | return classPtr; |
| 311 | } |
| 312 | |
| 313 | |
| 314 | /*********************************************************************** |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 315 | * RegisterClass16 (USER.57) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 316 | */ |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 317 | ATOM RegisterClass16( const WNDCLASS16 *wc ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 318 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 319 | ATOM atom; |
| 320 | CLASS *classPtr; |
Alexandre Julliard | 6b81b39 | 1994-07-07 16:23:58 +0000 | [diff] [blame] | 321 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 322 | HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); |
| 323 | |
| 324 | if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0; |
| 325 | if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 326 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 327 | wc->lpfnWndProc, WIN_PROC_16 ))) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 328 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 329 | GlobalDeleteAtom( atom ); |
| 330 | return 0; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 331 | } |
| 332 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 333 | dprintf_class( stddeb, "RegisterClass16: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
| 334 | atom, (DWORD)wc->lpfnWndProc, hInstance, |
| 335 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 336 | wc->cbWndExtra, classPtr ); |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 337 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 338 | classPtr->hIcon = wc->hIcon; |
| 339 | classPtr->hIconSm = 0; |
| 340 | classPtr->hCursor = wc->hCursor; |
| 341 | classPtr->hbrBackground = wc->hbrBackground; |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 342 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 343 | CLASS_SetMenuNameA( classPtr, HIWORD(wc->lpszMenuName) ? |
| 344 | PTR_SEG_TO_LIN(wc->lpszMenuName) : (LPCSTR)wc->lpszMenuName ); |
| 345 | return atom; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | |
| 349 | /*********************************************************************** |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 350 | * RegisterClass32A (USER32.426) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 351 | */ |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 352 | ATOM RegisterClass32A( const WNDCLASS32A* wc ) |
| 353 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 354 | ATOM atom; |
| 355 | CLASS *classPtr; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 356 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 357 | /* FIXME: this should not be necessary for Win32 */ |
| 358 | HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 359 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 360 | if (!(atom = GlobalAddAtom32A( wc->lpszClassName ))) return 0; |
| 361 | if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 362 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 363 | (WNDPROC16)wc->lpfnWndProc, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 364 | WIN_PROC_32A ))) |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 365 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 366 | GlobalDeleteAtom( atom ); |
| 367 | return 0; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 368 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 369 | |
| 370 | dprintf_class( stddeb, "RegisterClass32A: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
| 371 | atom, (DWORD)wc->lpfnWndProc, hInstance, |
| 372 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 373 | wc->cbWndExtra, classPtr ); |
| 374 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 375 | classPtr->hIcon = (HICON16)wc->hIcon; |
| 376 | classPtr->hIconSm = 0; |
| 377 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 378 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 379 | CLASS_SetMenuNameA( classPtr, wc->lpszMenuName ); |
| 380 | return atom; |
| 381 | } |
| 382 | |
| 383 | |
| 384 | /*********************************************************************** |
| 385 | * RegisterClass32W (USER32.429) |
| 386 | */ |
| 387 | ATOM RegisterClass32W( const WNDCLASS32W* wc ) |
| 388 | { |
| 389 | ATOM atom; |
| 390 | CLASS *classPtr; |
| 391 | |
| 392 | /* FIXME: this should not be necessary for Win32 */ |
| 393 | HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); |
| 394 | |
| 395 | if (!(atom = GlobalAddAtom32W( wc->lpszClassName ))) return 0; |
| 396 | if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 397 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 398 | (WNDPROC16)wc->lpfnWndProc, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 399 | WIN_PROC_32W ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 400 | { |
| 401 | GlobalDeleteAtom( atom ); |
| 402 | return 0; |
| 403 | } |
| 404 | |
| 405 | dprintf_class( stddeb, "RegisterClass32W: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
| 406 | atom, (DWORD)wc->lpfnWndProc, hInstance, |
| 407 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 408 | wc->cbWndExtra, classPtr ); |
| 409 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 410 | classPtr->hIcon = (HICON16)wc->hIcon; |
| 411 | classPtr->hIconSm = 0; |
| 412 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 413 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 414 | CLASS_SetMenuNameW( classPtr, wc->lpszMenuName ); |
| 415 | return atom; |
| 416 | } |
| 417 | |
| 418 | |
| 419 | /*********************************************************************** |
| 420 | * RegisterClassEx16 (USER.397) |
| 421 | */ |
| 422 | ATOM RegisterClassEx16( const WNDCLASSEX16 *wc ) |
| 423 | { |
| 424 | ATOM atom; |
| 425 | CLASS *classPtr; |
| 426 | |
| 427 | HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); |
| 428 | |
| 429 | if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0; |
| 430 | if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 431 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 432 | wc->lpfnWndProc, WIN_PROC_16 ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 433 | { |
| 434 | GlobalDeleteAtom( atom ); |
| 435 | return 0; |
| 436 | } |
| 437 | |
| 438 | dprintf_class( stddeb, "RegisterClassEx16: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
| 439 | atom, (DWORD)wc->lpfnWndProc, hInstance, |
| 440 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 441 | wc->cbWndExtra, classPtr ); |
| 442 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 443 | classPtr->hIcon = wc->hIcon; |
| 444 | classPtr->hIconSm = wc->hIconSm; |
| 445 | classPtr->hCursor = wc->hCursor; |
| 446 | classPtr->hbrBackground = wc->hbrBackground; |
| 447 | |
| 448 | CLASS_SetMenuNameA( classPtr, HIWORD(wc->lpszMenuName) ? |
| 449 | PTR_SEG_TO_LIN(wc->lpszMenuName) : (LPCSTR)wc->lpszMenuName ); |
| 450 | return atom; |
| 451 | } |
| 452 | |
| 453 | |
| 454 | /*********************************************************************** |
| 455 | * RegisterClassEx32A (USER32.427) |
| 456 | */ |
| 457 | ATOM RegisterClassEx32A( const WNDCLASSEX32A* wc ) |
| 458 | { |
| 459 | ATOM atom; |
| 460 | CLASS *classPtr; |
| 461 | |
| 462 | /* FIXME: this should not be necessary for Win32 */ |
| 463 | HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); |
| 464 | |
| 465 | if (!(atom = GlobalAddAtom32A( wc->lpszClassName ))) return 0; |
| 466 | if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 467 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 468 | (WNDPROC16)wc->lpfnWndProc, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 469 | WIN_PROC_32A ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 470 | { |
| 471 | GlobalDeleteAtom( atom ); |
| 472 | return 0; |
| 473 | } |
| 474 | |
| 475 | dprintf_class( stddeb, "RegisterClassEx32A: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
| 476 | atom, (DWORD)wc->lpfnWndProc, hInstance, |
| 477 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 478 | wc->cbWndExtra, classPtr ); |
| 479 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 480 | classPtr->hIcon = (HICON16)wc->hIcon; |
| 481 | classPtr->hIconSm = (HICON16)wc->hIconSm; |
| 482 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 483 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 484 | CLASS_SetMenuNameA( classPtr, wc->lpszMenuName ); |
| 485 | return atom; |
| 486 | } |
| 487 | |
| 488 | |
| 489 | /*********************************************************************** |
| 490 | * RegisterClassEx32W (USER32.428) |
| 491 | */ |
| 492 | ATOM RegisterClassEx32W( const WNDCLASSEX32W* wc ) |
| 493 | { |
| 494 | ATOM atom; |
| 495 | CLASS *classPtr; |
| 496 | |
| 497 | /* FIXME: this should not be necessary for Win32 */ |
| 498 | HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); |
| 499 | |
| 500 | if (!(atom = GlobalAddAtom32W( wc->lpszClassName ))) return 0; |
| 501 | if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 502 | wc->cbClsExtra, wc->cbWndExtra, |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 503 | (WNDPROC16)wc->lpfnWndProc, |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 504 | WIN_PROC_32W ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 505 | { |
| 506 | GlobalDeleteAtom( atom ); |
| 507 | return 0; |
| 508 | } |
| 509 | |
| 510 | dprintf_class( stddeb, "RegisterClassEx32W: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
| 511 | atom, (DWORD)wc->lpfnWndProc, hInstance, |
| 512 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 513 | wc->cbWndExtra, classPtr ); |
| 514 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 515 | classPtr->hIcon = (HICON16)wc->hIcon; |
| 516 | classPtr->hIconSm = (HICON16)wc->hIconSm; |
| 517 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 518 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 519 | CLASS_SetMenuNameW( classPtr, wc->lpszMenuName ); |
| 520 | return atom; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 521 | } |
| 522 | |
| 523 | |
| 524 | /*********************************************************************** |
| 525 | * UnregisterClass16 (USER.403) |
| 526 | */ |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 527 | BOOL16 UnregisterClass16( SEGPTR className, HINSTANCE16 hInstance ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 528 | { |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 529 | CLASS *classPtr; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 530 | ATOM atom; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 531 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 532 | hInstance = GetExePtr( hInstance ); |
| 533 | if (!(atom = GlobalFindAtom16( className ))) return FALSE; |
| 534 | if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 535 | (classPtr->hInstance != hInstance)) return FALSE; |
| 536 | return CLASS_FreeClass( classPtr ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 537 | } |
| 538 | |
| 539 | |
| 540 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 541 | * UnregisterClass32A (USER32.562) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 542 | */ |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 543 | BOOL32 UnregisterClass32A( LPCSTR className, HINSTANCE32 hInstance ) |
| 544 | { |
| 545 | CLASS *classPtr; |
| 546 | ATOM atom; |
| 547 | |
| 548 | hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ |
| 549 | if (!(atom = GlobalFindAtom32A( className ))) return FALSE; |
| 550 | if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 551 | (classPtr->hInstance != hInstance)) return FALSE; |
| 552 | return CLASS_FreeClass( classPtr ); |
| 553 | } |
| 554 | |
| 555 | |
| 556 | /*********************************************************************** |
| 557 | * UnregisterClass32W (USER32.563) |
| 558 | */ |
| 559 | BOOL32 UnregisterClass32W( LPCWSTR className, HINSTANCE32 hInstance ) |
| 560 | { |
| 561 | CLASS *classPtr; |
| 562 | ATOM atom; |
| 563 | |
| 564 | hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ |
| 565 | if (!(atom = GlobalFindAtom32W( className ))) return FALSE; |
| 566 | if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 567 | (classPtr->hInstance != hInstance)) return FALSE; |
| 568 | return CLASS_FreeClass( classPtr ); |
| 569 | } |
| 570 | |
| 571 | |
| 572 | /*********************************************************************** |
| 573 | * GetClassWord (USER.129) (USER32.218) |
| 574 | */ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 575 | WORD GetClassWord( HWND32 hwnd, INT32 offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 576 | { |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 577 | WND * wndPtr; |
| 578 | |
| 579 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
| 580 | if (offset >= 0) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 581 | { |
| 582 | if (offset <= wndPtr->class->cbClsExtra - sizeof(WORD)) |
| 583 | return GET_WORD(((char *)wndPtr->class->wExtra) + offset); |
| 584 | } |
| 585 | else switch(offset) |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 586 | { |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 587 | case GCW_HBRBACKGROUND: return wndPtr->class->hbrBackground; |
| 588 | case GCW_HCURSOR: return wndPtr->class->hCursor; |
| 589 | case GCW_HICON: return wndPtr->class->hIcon; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 590 | case GCW_HICONSM: return wndPtr->class->hIconSm; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 591 | case GCW_ATOM: return wndPtr->class->atomName; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 592 | case GCW_STYLE: |
| 593 | case GCW_CBWNDEXTRA: |
| 594 | case GCW_CBCLSEXTRA: |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 595 | case GCW_HMODULE: |
| 596 | return (WORD)GetClassLong32A( hwnd, offset ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 597 | } |
| 598 | fprintf(stderr, "Warning: invalid offset %d for GetClassWord()\n", offset); |
| 599 | return 0; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 600 | } |
| 601 | |
| 602 | |
| 603 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 604 | * GetClassLong16 (USER.131) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 605 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 606 | LONG GetClassLong16( HWND16 hwnd, INT16 offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 607 | { |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 608 | WND *wndPtr; |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 609 | LONG ret; |
| 610 | |
| 611 | switch( offset ) |
| 612 | { |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 613 | case GCL_WNDPROC: |
| 614 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
| 615 | return (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_16 ); |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 616 | case GCL_MENUNAME: |
| 617 | ret = GetClassLong32A( hwnd, offset ); |
| 618 | return (LONG)SEGPTR_GET( (void *)ret ); |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 619 | default: |
| 620 | return GetClassLong32A( hwnd, offset ); |
| 621 | } |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 622 | } |
| 623 | |
| 624 | |
| 625 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 626 | * GetClassLong32A (USER32.214) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 627 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 628 | LONG GetClassLong32A( HWND32 hwnd, INT32 offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 629 | { |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 630 | WND * wndPtr; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 631 | |
| 632 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 633 | if (offset >= 0) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 634 | { |
| 635 | if (offset <= wndPtr->class->cbClsExtra - sizeof(LONG)) |
| 636 | return GET_DWORD(((char *)wndPtr->class->wExtra) + offset); |
| 637 | } |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 638 | switch(offset) |
| 639 | { |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 640 | case GCL_STYLE: return (LONG)wndPtr->class->style; |
| 641 | case GCL_CBWNDEXTRA: return (LONG)wndPtr->class->cbWndExtra; |
| 642 | case GCL_CBCLSEXTRA: return (LONG)wndPtr->class->cbClsExtra; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 643 | case GCL_HMODULE: return (LONG)wndPtr->class->hInstance; |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 644 | case GCL_WNDPROC: |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 645 | return (LONG)WINPROC_GetProc(wndPtr->class->winproc, WIN_PROC_32A); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 646 | case GCL_MENUNAME: |
| 647 | return (LONG)CLASS_GetMenuNameA( wndPtr->class ); |
| 648 | case GCL_HBRBACKGROUND: |
| 649 | case GCL_HCURSOR: |
| 650 | case GCL_HICON: |
| 651 | case GCL_HICONSM: |
| 652 | return GetClassWord( hwnd, offset ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 653 | } |
| 654 | fprintf(stderr, "Warning: invalid offset %d for GetClassLong()\n", offset); |
| 655 | return 0; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 656 | } |
| 657 | |
| 658 | |
| 659 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 660 | * GetClassLong32W (USER32.215) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 661 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 662 | LONG GetClassLong32W( HWND32 hwnd, INT32 offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 663 | { |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 664 | WND * wndPtr; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 665 | |
| 666 | switch(offset) |
| 667 | { |
| 668 | case GCL_WNDPROC: |
| 669 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
| 670 | return (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_32W ); |
| 671 | case GCL_MENUNAME: |
| 672 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
| 673 | return (LONG)CLASS_GetMenuNameW( wndPtr->class ); |
| 674 | default: |
| 675 | return GetClassLong32A( hwnd, offset ); |
| 676 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 677 | } |
| 678 | |
| 679 | |
| 680 | /*********************************************************************** |
| 681 | * SetClassWord (USER.130) (USER32.468) |
| 682 | */ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 683 | WORD SetClassWord( HWND32 hwnd, INT32 offset, WORD newval ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 684 | { |
| 685 | WND * wndPtr; |
| 686 | WORD retval = 0; |
| 687 | void *ptr; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 688 | |
| 689 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 690 | if (offset >= 0) |
| 691 | { |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 692 | if (offset + sizeof(WORD) <= wndPtr->class->cbClsExtra) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 693 | ptr = ((char *)wndPtr->class->wExtra) + offset; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 694 | else |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 695 | { |
| 696 | fprintf( stderr, "Warning: invalid offset %d for SetClassWord()\n", |
| 697 | offset ); |
| 698 | return 0; |
| 699 | } |
| 700 | } |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 701 | else switch(offset) |
| 702 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 703 | case GCW_STYLE: |
| 704 | case GCW_CBWNDEXTRA: |
| 705 | case GCW_CBCLSEXTRA: |
| 706 | case GCW_HMODULE: |
| 707 | return (WORD)SetClassLong32A( hwnd, offset, (LONG)newval ); |
| 708 | case GCW_HBRBACKGROUND: ptr = &wndPtr->class->hbrBackground; break; |
| 709 | case GCW_HCURSOR: ptr = &wndPtr->class->hCursor; break; |
| 710 | case GCW_HICON: ptr = &wndPtr->class->hIcon; break; |
| 711 | case GCW_HICONSM: ptr = &wndPtr->class->hIconSm; break; |
| 712 | case GCW_ATOM: ptr = &wndPtr->class->atomName; break; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 713 | default: |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 714 | fprintf( stderr, "Warning: invalid offset %d for SetClassWord()\n", |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 715 | offset); |
| 716 | return 0; |
| 717 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 718 | retval = GET_WORD(ptr); |
| 719 | PUT_WORD( ptr, newval ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 720 | return retval; |
| 721 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 722 | |
| 723 | |
| 724 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 725 | * SetClassLong16 (USER.132) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 726 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 727 | LONG SetClassLong16( HWND16 hwnd, INT16 offset, LONG newval ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 728 | { |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 729 | WND *wndPtr; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 730 | LONG retval; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 731 | |
| 732 | switch(offset) |
| 733 | { |
| 734 | case GCL_WNDPROC: |
| 735 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 736 | retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_16 ); |
| 737 | WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval, |
| 738 | WIN_PROC_16 ); |
| 739 | return retval; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 740 | case GCL_MENUNAME: |
| 741 | return SetClassLong32A( hwnd, offset, (LONG)PTR_SEG_TO_LIN(newval) ); |
| 742 | default: |
| 743 | return SetClassLong32A( hwnd, offset, newval ); |
| 744 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 745 | } |
| 746 | |
| 747 | |
| 748 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 749 | * SetClassLong32A (USER32.466) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 750 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 751 | LONG SetClassLong32A( HWND32 hwnd, INT32 offset, LONG newval ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 752 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 753 | WND * wndPtr; |
| 754 | LONG retval = 0; |
| 755 | void *ptr; |
| 756 | |
| 757 | if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; |
| 758 | if (offset >= 0) |
| 759 | { |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 760 | if (offset + sizeof(LONG) <= wndPtr->class->cbClsExtra) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 761 | ptr = ((char *)wndPtr->class->wExtra) + offset; |
| 762 | else |
| 763 | { |
| 764 | fprintf( stderr, "Warning: invalid offset %d for SetClassLong()\n", |
| 765 | offset ); |
| 766 | return 0; |
| 767 | } |
| 768 | } |
| 769 | else switch(offset) |
| 770 | { |
| 771 | case GCL_MENUNAME: |
| 772 | CLASS_SetMenuNameA( wndPtr->class, (LPCSTR)newval ); |
| 773 | return 0; /* Old value is now meaningless anyway */ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 774 | case GCL_WNDPROC: |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 775 | retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc, |
| 776 | WIN_PROC_32A ); |
| 777 | WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval, |
| 778 | WIN_PROC_32A ); |
| 779 | return retval; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 780 | case GCL_HBRBACKGROUND: |
| 781 | case GCL_HCURSOR: |
| 782 | case GCL_HICON: |
| 783 | case GCL_HICONSM: |
| 784 | return SetClassWord( hwnd, offset, (WORD)newval ); |
| 785 | case GCL_STYLE: ptr = &wndPtr->class->style; break; |
| 786 | case GCL_CBWNDEXTRA: ptr = &wndPtr->class->cbWndExtra; break; |
| 787 | case GCL_CBCLSEXTRA: ptr = &wndPtr->class->cbClsExtra; break; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 788 | case GCL_HMODULE: ptr = &wndPtr->class->hInstance; break; |
| 789 | default: |
| 790 | fprintf( stderr, "Warning: invalid offset %d for SetClassLong()\n", |
| 791 | offset); |
| 792 | return 0; |
| 793 | } |
| 794 | retval = GET_DWORD(ptr); |
| 795 | PUT_DWORD( ptr, newval ); |
| 796 | return retval; |
| 797 | } |
| 798 | |
| 799 | |
| 800 | /*********************************************************************** |
| 801 | * SetClassLong32W (USER32.467) |
| 802 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 803 | LONG SetClassLong32W( HWND32 hwnd, INT32 offset, LONG newval ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 804 | { |
| 805 | WND *wndPtr; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 806 | LONG retval; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 807 | |
| 808 | switch(offset) |
| 809 | { |
| 810 | case GCL_WNDPROC: |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 811 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
| 812 | retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_32W ); |
| 813 | WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval, |
| 814 | WIN_PROC_32W ); |
| 815 | return retval; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 816 | case GCL_MENUNAME: |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 817 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 818 | CLASS_SetMenuNameW( wndPtr->class, (LPCWSTR)newval ); |
| 819 | return 0; /* Old value is now meaningless anyway */ |
| 820 | default: |
| 821 | return SetClassLong32A( hwnd, offset, newval ); |
| 822 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 823 | } |
| 824 | |
| 825 | |
| 826 | /*********************************************************************** |
| 827 | * GetClassName16 (USER.58) |
| 828 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 829 | INT16 GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 830 | { |
| 831 | WND *wndPtr; |
| 832 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
| 833 | return GlobalGetAtomName16( wndPtr->class->atomName, buffer, count ); |
| 834 | } |
| 835 | |
| 836 | |
| 837 | /*********************************************************************** |
| 838 | * GetClassName32A (USER32.216) |
| 839 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 840 | INT32 GetClassName32A( HWND32 hwnd, LPSTR buffer, INT32 count ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 841 | { |
| 842 | WND *wndPtr; |
| 843 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
| 844 | return GlobalGetAtomName32A( wndPtr->class->atomName, buffer, count ); |
| 845 | } |
| 846 | |
| 847 | |
| 848 | /*********************************************************************** |
| 849 | * GetClassName32W (USER32.217) |
| 850 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 851 | INT32 GetClassName32W( HWND32 hwnd, LPWSTR buffer, INT32 count ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 852 | { |
| 853 | WND *wndPtr; |
| 854 | if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; |
| 855 | return GlobalGetAtomName32W( wndPtr->class->atomName, buffer, count ); |
| 856 | } |
| 857 | |
| 858 | |
| 859 | /*********************************************************************** |
| 860 | * GetClassInfo16 (USER.404) |
| 861 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 862 | BOOL16 GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASS16 *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 863 | { |
| 864 | ATOM atom; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 865 | CLASS *classPtr; |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 866 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 867 | hInstance = GetExePtr( hInstance ); |
| 868 | if (!(atom = GlobalFindAtom16( name )) || |
| 869 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 870 | (hInstance != classPtr->hInstance)) return FALSE; |
| 871 | wc->style = (UINT16)classPtr->style; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 872 | wc->lpfnWndProc = WINPROC_GetProc( classPtr->winproc, WIN_PROC_16 ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 873 | wc->cbClsExtra = (INT16)classPtr->cbClsExtra; |
| 874 | wc->cbWndExtra = (INT16)classPtr->cbWndExtra; |
| 875 | wc->hInstance = (HINSTANCE16)classPtr->hInstance; |
| 876 | wc->hIcon = classPtr->hIcon; |
| 877 | wc->hCursor = classPtr->hCursor; |
| 878 | wc->hbrBackground = classPtr->hbrBackground; |
| 879 | wc->lpszClassName = (SEGPTR)0; |
| 880 | wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr ); |
| 881 | if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */ |
| 882 | wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName ); |
| 883 | return TRUE; |
| 884 | } |
| 885 | |
| 886 | |
| 887 | /*********************************************************************** |
| 888 | * GetClassInfo32A (USER32.210) |
| 889 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 890 | BOOL32 GetClassInfo32A( HINSTANCE32 hInstance, LPCSTR name, WNDCLASS32A *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 891 | { |
| 892 | ATOM atom; |
| 893 | CLASS *classPtr; |
| 894 | |
| 895 | hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ |
| 896 | if (!(atom = GlobalFindAtom32A( name )) || |
| 897 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 898 | (hInstance != classPtr->hInstance)) return FALSE; |
| 899 | wc->style = classPtr->style; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 900 | wc->lpfnWndProc = (WNDPROC32)WINPROC_GetProc( classPtr->winproc, |
| 901 | WIN_PROC_32A ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 902 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 903 | wc->cbWndExtra = classPtr->cbWndExtra; |
| 904 | wc->hInstance = classPtr->hInstance; |
| 905 | wc->hIcon = (HICON32)classPtr->hIcon; |
| 906 | wc->hCursor = (HCURSOR32)classPtr->hCursor; |
| 907 | wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground; |
| 908 | wc->lpszMenuName = CLASS_GetMenuNameA( classPtr ); |
| 909 | wc->lpszClassName = NULL; |
| 910 | return TRUE; |
| 911 | } |
| 912 | |
| 913 | |
| 914 | /*********************************************************************** |
| 915 | * GetClassInfo32W (USER32.213) |
| 916 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 917 | BOOL32 GetClassInfo32W( HINSTANCE32 hInstance, LPCWSTR name, WNDCLASS32W *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 918 | { |
| 919 | ATOM atom; |
| 920 | CLASS *classPtr; |
| 921 | |
| 922 | hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ |
| 923 | if (!(atom = GlobalFindAtom32W( name )) || |
| 924 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 925 | (hInstance != classPtr->hInstance)) return FALSE; |
| 926 | wc->style = classPtr->style; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 927 | wc->lpfnWndProc = (WNDPROC32)WINPROC_GetProc( classPtr->winproc, |
| 928 | WIN_PROC_32W ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 929 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 930 | wc->cbWndExtra = classPtr->cbWndExtra; |
| 931 | wc->hInstance = classPtr->hInstance; |
| 932 | wc->hIcon = (HICON32)classPtr->hIcon; |
| 933 | wc->hCursor = (HCURSOR32)classPtr->hCursor; |
| 934 | wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground; |
| 935 | wc->lpszMenuName = CLASS_GetMenuNameW( classPtr ); |
| 936 | wc->lpszClassName = NULL; |
| 937 | return TRUE; |
| 938 | } |
| 939 | |
| 940 | |
| 941 | /*********************************************************************** |
| 942 | * GetClassInfoEx16 (USER.398) |
| 943 | * |
| 944 | * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the |
| 945 | * same in Win16 as in Win32. --AJ |
| 946 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 947 | BOOL16 GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASSEX16 *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 948 | { |
| 949 | ATOM atom; |
| 950 | CLASS *classPtr; |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 951 | |
| 952 | hInstance = GetExePtr( hInstance ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 953 | if (!(atom = GlobalFindAtom16( name )) || |
| 954 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 955 | (hInstance != classPtr->hInstance)) return FALSE; |
| 956 | wc->style = classPtr->style; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 957 | wc->lpfnWndProc = WINPROC_GetProc( classPtr->winproc, WIN_PROC_16 ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 958 | wc->cbClsExtra = (INT16)classPtr->cbClsExtra; |
| 959 | wc->cbWndExtra = (INT16)classPtr->cbWndExtra; |
| 960 | wc->hInstance = (HINSTANCE16)classPtr->hInstance; |
| 961 | wc->hIcon = classPtr->hIcon; |
| 962 | wc->hIconSm = classPtr->hIconSm; |
| 963 | wc->hCursor = classPtr->hCursor; |
| 964 | wc->hbrBackground = classPtr->hbrBackground; |
| 965 | wc->lpszClassName = (SEGPTR)0; |
| 966 | wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr ); |
| 967 | if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */ |
| 968 | wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName ); |
| 969 | return TRUE; |
| 970 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 971 | |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 972 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 973 | /*********************************************************************** |
| 974 | * GetClassInfoEx32A (USER32.211) |
| 975 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 976 | BOOL32 GetClassInfoEx32A( HINSTANCE32 hInstance, LPCSTR name, |
| 977 | WNDCLASSEX32A *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 978 | { |
| 979 | ATOM atom; |
| 980 | CLASS *classPtr; |
| 981 | |
| 982 | hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ |
| 983 | if (!(atom = GlobalFindAtom32A( name )) || |
| 984 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 985 | (hInstance != classPtr->hInstance)) return FALSE; |
| 986 | wc->style = classPtr->style; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 987 | wc->lpfnWndProc = (WNDPROC32)WINPROC_GetProc( classPtr->winproc, |
| 988 | WIN_PROC_32A ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 989 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 990 | wc->cbWndExtra = classPtr->cbWndExtra; |
| 991 | wc->hInstance = classPtr->hInstance; |
| 992 | wc->hIcon = (HICON32)classPtr->hIcon; |
| 993 | wc->hIconSm = (HICON32)classPtr->hIconSm; |
| 994 | wc->hCursor = (HCURSOR32)classPtr->hCursor; |
| 995 | wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground; |
| 996 | wc->lpszMenuName = CLASS_GetMenuNameA( classPtr ); |
| 997 | wc->lpszClassName = NULL; |
| 998 | return TRUE; |
| 999 | } |
| 1000 | |
| 1001 | |
| 1002 | /*********************************************************************** |
| 1003 | * GetClassInfoEx32W (USER32.212) |
| 1004 | */ |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 1005 | BOOL32 GetClassInfoEx32W( HINSTANCE32 hInstance, LPCWSTR name, |
| 1006 | WNDCLASSEX32W *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1007 | { |
| 1008 | ATOM atom; |
| 1009 | CLASS *classPtr; |
| 1010 | |
| 1011 | hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ |
| 1012 | if (!(atom = GlobalFindAtom32W( name )) || |
| 1013 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 1014 | (hInstance != classPtr->hInstance)) return FALSE; |
| 1015 | wc->style = classPtr->style; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 1016 | wc->lpfnWndProc = (WNDPROC32)WINPROC_GetProc( classPtr->winproc, |
| 1017 | WIN_PROC_32W ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1018 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 1019 | wc->cbWndExtra = classPtr->cbWndExtra; |
| 1020 | wc->hInstance = classPtr->hInstance; |
| 1021 | wc->hIcon = (HICON32)classPtr->hIcon; |
| 1022 | wc->hIconSm = (HICON32)classPtr->hIconSm; |
| 1023 | wc->hCursor = (HCURSOR32)classPtr->hCursor; |
| 1024 | wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground; |
| 1025 | wc->lpszMenuName = CLASS_GetMenuNameW( classPtr ); |
| 1026 | wc->lpszClassName = NULL; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1027 | return TRUE; |
| 1028 | } |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1029 | |
| 1030 | |
| 1031 | /*********************************************************************** |
| 1032 | * ClassFirst (TOOLHELP.69) |
| 1033 | */ |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 1034 | BOOL16 ClassFirst( CLASSENTRY *pClassEntry ) |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1035 | { |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1036 | pClassEntry->wNext = 1; |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1037 | return ClassNext( pClassEntry ); |
| 1038 | } |
| 1039 | |
| 1040 | |
| 1041 | /*********************************************************************** |
| 1042 | * ClassNext (TOOLHELP.70) |
| 1043 | */ |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame^] | 1044 | BOOL16 ClassNext( CLASSENTRY *pClassEntry ) |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1045 | { |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1046 | int i; |
| 1047 | CLASS *class = firstClass; |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1048 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1049 | if (!pClassEntry->wNext) return FALSE; |
| 1050 | for (i = 1; (i < pClassEntry->wNext) && class; i++) class = class->next; |
| 1051 | if (!class) |
| 1052 | { |
| 1053 | pClassEntry->wNext = 0; |
| 1054 | return FALSE; |
| 1055 | } |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 1056 | pClassEntry->hInst = class->hInstance; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1057 | pClassEntry->wNext++; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1058 | GlobalGetAtomName32A( class->atomName, pClassEntry->szClassName, |
| 1059 | sizeof(pClassEntry->szClassName) ); |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1060 | return TRUE; |
| 1061 | } |