ReactOS 0.4.16-dev-1535-gea189a3
class.c File Reference
#include <user32.h>
Include dependency graph for class.c:

Go to the source code of this file.

Classes

struct  strsection_header
 
struct  wndclass_redirect_data
 

Macros

#define USE_VERSIONED_CLASSES
 
#define PUBLIC_EXSTYLE
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
LPCWSTR is_comctl32_class (const WCHAR *name)
 
LPCWSTR FASTCALL ClassNameToVersion (const void *lpszClass, LPCWSTR lpszMenuName, LPCWSTR *plpLibFileName, HANDLE *pContext, BOOL bAnsi)
 
BOOL FASTCALL VersionRegisterClass (PCWSTR pszClass, LPCWSTR lpLibFileName, HANDLE Contex, HMODULE *phLibModule)
 
BOOL WINAPI GetClassInfoExA (HINSTANCE hInstance, LPCSTR lpszClass, LPWNDCLASSEXA lpwcx)
 
BOOL WINAPI GetClassInfoExW (HINSTANCE hInstance, LPCWSTR lpszClass, LPWNDCLASSEXW lpwcx)
 
BOOL WINAPI GetClassInfoA (HINSTANCE hInstance, LPCSTR lpClassName, LPWNDCLASSA lpWndClass)
 
BOOL WINAPI GetClassInfoW (HINSTANCE hInstance, LPCWSTR lpClassName, LPWNDCLASSW lpWndClass)
 
ULONG_PTR FASTCALL IntGetClsWndProc (PWND pWnd, PCLS Class, BOOL Ansi)
 
WNDPROC FASTCALL IntGetWndProc (PWND pWnd, BOOL Ansi)
 
static ULONG_PTR FASTCALL IntGetClassLongA (PWND Wnd, PCLS Class, int nIndex)
 
static ULONG_PTR FASTCALL IntGetClassLongW (PWND Wnd, PCLS Class, int nIndex)
 
DWORD WINAPI GetClassLongA (HWND hWnd, int nIndex)
 
DWORD WINAPI GetClassLongW (HWND hWnd, int nIndex)
 
int WINAPI GetClassNameA (HWND hWnd, LPSTR lpClassName, int nMaxCount)
 
int WINAPI GetClassNameW (HWND hWnd, LPWSTR lpClassName, int nMaxCount)
 
WORD WINAPI GetClassWord (HWND hwnd, int offset)
 
LONG_PTR IntGetWindowLong (HWND hwnd, INT offset, UINT size, BOOL unicode)
 
LONG WINAPI GetWindowLongA (HWND hWnd, int nIndex)
 
LONG WINAPI GetWindowLongW (HWND hWnd, int nIndex)
 
WORD WINAPI GetWindowWord (HWND hWnd, int nIndex)
 
UINT WINAPI RealGetWindowClassW (HWND hwnd, LPWSTR pszType, UINT cchType)
 
UINT WINAPI RealGetWindowClassA (HWND hwnd, LPSTR pszType, UINT cchType)
 
ATOM WINAPI RegisterClassExWOWW (WNDCLASSEXW *lpwcx, LPDWORD pdwWowData, WORD fnID, DWORD dwFlags, BOOL ChkRegCls)
 
ATOM WINAPI RegisterClassExA (CONST WNDCLASSEXA *lpwcx)
 
ATOM WINAPI RegisterClassExW (CONST WNDCLASSEXW *lpwcx)
 
ATOM WINAPI RegisterClassA (CONST WNDCLASSA *lpWndClass)
 
ATOM WINAPI RegisterClassW (CONST WNDCLASSW *lpWndClass)
 
DWORD WINAPI SetClassLongA (HWND hWnd, int nIndex, LONG dwNewLong)
 
DWORD WINAPI SetClassLongW (HWND hWnd, int nIndex, LONG dwNewLong)
 
WORD WINAPI SetClassWord (HWND hWnd, int nIndex, WORD wNewWord)
 
WORD WINAPI SetWindowWord (HWND hWnd, int nIndex, WORD wNewWord)
 
LONG WINAPI DECLSPEC_HOTPATCH SetWindowLongA (HWND hWnd, int nIndex, LONG dwNewLong)
 
LONG WINAPI SetWindowLongW (HWND hWnd, int nIndex, LONG dwNewLong)
 
BOOL WINAPI UnregisterClassA (LPCSTR lpClassName, HINSTANCE hInstance)
 
BOOL WINAPI UnregisterClassW (LPCWSTR lpClassName, HINSTANCE hInstance)
 

Macro Definition Documentation

◆ PUBLIC_EXSTYLE

#define PUBLIC_EXSTYLE
Value:
( \
)
#define WS_EX_NOPARENTNOTIFY
Definition: pedump.c:646
#define WS_EX_ACCEPTFILES
Definition: pedump.c:648
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
#define WS_EX_DRAGDETECT
Definition: undocuser.h:23
#define WS_EX_LAYOUTRTL
Definition: winuser.h:390
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define WS_EX_COMPOSITED
Definition: winuser.h:385
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define WS_EX_CONTROLPARENT
Definition: winuser.h:387
#define WS_EX_NOACTIVATE
Definition: winuser.h:395
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define WS_EX_LAYERED
Definition: winuser.h:389
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
#define WS_EX_CONTEXTHELP
Definition: winuser.h:386
#define WS_EX_RTLREADING
Definition: winuser.h:402
#define WS_EX_NOINHERITLAYOUT
Definition: winuser.h:396
#define WS_EX_RIGHT
Definition: winuser.h:400

Definition at line 1080 of file class.c.

◆ USE_VERSIONED_CLASSES

#define USE_VERSIONED_CLASSES

Definition at line 15 of file class.c.

Function Documentation

◆ ClassNameToVersion()

LPCWSTR FASTCALL ClassNameToVersion ( const void lpszClass,
LPCWSTR  lpszMenuName,
LPCWSTR plpLibFileName,
HANDLE pContext,
BOOL  bAnsi 
)

Definition at line 85 of file class.c.

91{
92 LPCWSTR VersionedClass = NULL;
93#ifdef USE_VERSIONED_CLASSES
95#endif
96 UNICODE_STRING SectionName;
97 WCHAR SectionNameBuf[MAX_PATH] = {0};
98 ACTCTX_SECTION_KEYED_DATA KeyedData = { sizeof(KeyedData) };
99
100 if (!lpszClass)
101 {
102 ERR("Null class given !\n");
103 return NULL;
104 }
105
106 if (IS_ATOM(lpszClass))
107 {
108 RtlInitEmptyUnicodeString(&SectionName, SectionNameBuf, sizeof(SectionNameBuf));
109 if(!NtUserGetAtomName(LOWORD((DWORD_PTR)lpszClass), &SectionName))
110 {
111 ERR("Couldn't get atom name for atom %x !\n", LOWORD((DWORD_PTR)lpszClass));
112 return NULL;
113 }
114 SectionName.Length = (USHORT)wcslen(SectionNameBuf) * sizeof(WCHAR);
115 TRACE("ClassNameToVersion got name %wZ from atom\n", &SectionName);
116 }
117 else
118 {
119 if (bAnsi)
120 {
122 RtlInitAnsiString(&AnsiString, lpszClass);
123 RtlInitEmptyUnicodeString(&SectionName, SectionNameBuf, sizeof(SectionNameBuf));
125 }
126 else
127 {
128 RtlInitUnicodeString(&SectionName, lpszClass);
129 }
130 }
131#ifdef USE_VERSIONED_CLASSES
132 Status = RtlFindActivationContextSectionString( FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX,
133 NULL,
134 ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION,
135 &SectionName,
136 &KeyedData );
137
138 if (NT_SUCCESS(Status) && KeyedData.ulDataFormatVersion == 1)
139 {
140 struct strsection_header *SectionHeader = KeyedData.lpSectionBase;
141
142 /* Find activation context */
143 if(SectionHeader && SectionHeader->count > 0)
144 {
145 struct wndclass_redirect_data *WindowRedirectionData = KeyedData.lpData;
146 if(WindowRedirectionData && WindowRedirectionData->module_len)
147 {
148 LPCWSTR lpLibFileName;
149
150 VersionedClass = (WCHAR*)((BYTE*)WindowRedirectionData + WindowRedirectionData->name_offset);
151 lpLibFileName = (WCHAR*)((BYTE*)KeyedData.lpSectionBase + WindowRedirectionData->module_offset);
152 TRACE("Returning VersionedClass=%S, plpLibFileName=%S for class %S\n", VersionedClass, lpLibFileName, SectionName.Buffer);
153
154 if (pContext) *pContext = KeyedData.hActCtx;
155 if (plpLibFileName) *plpLibFileName = lpLibFileName;
156
157 }
158 }
159 }
160
161 if (KeyedData.hActCtx)
162 RtlReleaseActivationContext(KeyedData.hActCtx);
163#endif
164
165#ifndef DEFAULT_ACTIVATION_CONTEXTS_SUPPORTED
166 /* This block is a hack! */
167 if (!VersionedClass)
168 {
169 /*
170 * In windows the default activation context always contains comctl32v5
171 * In reactos we don't have a default activation context so we
172 * mimic wine here.
173 */
174 VersionedClass = is_comctl32_class(SectionName.Buffer);
175 if (VersionedClass)
176 {
177 if (pContext) *pContext = 0;
178 if (plpLibFileName) *plpLibFileName = L"comctl32";
179 }
180 }
181#endif
182
183 /*
184 * The returned strings are pointers in the activation context and
185 * will get freed when the activation context gets freed
186 */
187 return VersionedClass;
188}
LONG NTSTATUS
Definition: precomp.h:26
#define ERR(fmt,...)
Definition: precomp.h:57
#define IS_ATOM(x)
Definition: class.h:3
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define MAX_PATH
Definition: compat.h:34
@ AnsiString
Definition: dnslib.h:19
#define L(x)
Definition: resources.c:13
Status
Definition: gdiplustypes.h:25
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI NTSTATUS WINAPI RtlFindActivationContextSectionString(ULONG, const GUID *, ULONG, const UNICODE_STRING *, PVOID)
Definition: actctx.c:5874
NTSYSAPI void WINAPI RtlReleaseActivationContext(HANDLE)
Definition: actctx.c:5384
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define LOWORD(l)
Definition: pedump.c:82
unsigned short USHORT
Definition: pedump.c:61
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t DWORD_PTR
Definition: typedefs.h:65
LPCWSTR is_comctl32_class(const WCHAR *name)
Definition: class.c:46
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193

Referenced by GetClassInfoExA(), GetClassInfoExW(), RegisterClassExWOWW(), UnregisterClassA(), UnregisterClassW(), and User32CreateWindowEx().

◆ GetClassInfoA()

BOOL WINAPI GetClassInfoA ( HINSTANCE  hInstance,
LPCSTR  lpClassName,
LPWNDCLASSA  lpWndClass 
)

Definition at line 476 of file class.c.

480{
481 WNDCLASSEXA wcex;
482 BOOL retval;
483
484 retval = GetClassInfoExA(hInstance, lpClassName, &wcex);
485 if (retval)
486 {
487 lpWndClass->style = wcex.style;
488 lpWndClass->lpfnWndProc = wcex.lpfnWndProc;
489 lpWndClass->cbClsExtra = wcex.cbClsExtra;
490 lpWndClass->cbWndExtra = wcex.cbWndExtra;
491 lpWndClass->hInstance = wcex.hInstance;
492 lpWndClass->hIcon = wcex.hIcon;
493 lpWndClass->hCursor = wcex.hCursor;
494 lpWndClass->hbrBackground = wcex.hbrBackground;
495 lpWndClass->lpszMenuName = wcex.lpszMenuName;
496 lpWndClass->lpszClassName = wcex.lpszClassName;
497 }
498
499 return retval;
500}
HINSTANCE hInstance
Definition: charmap.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
HBRUSH hbrBackground
Definition: winuser.h:3272
HICON hIcon
Definition: winuser.h:3270
HINSTANCE hInstance
Definition: winuser.h:3269
HCURSOR hCursor
Definition: winuser.h:3271
int cbWndExtra
Definition: winuser.h:3268
UINT style
Definition: winuser.h:3265
LPCSTR lpszMenuName
Definition: winuser.h:3273
LPCSTR lpszClassName
Definition: winuser.h:3274
WNDPROC lpfnWndProc
Definition: winuser.h:3266
int cbClsExtra
Definition: winuser.h:3267
int cbClsExtra
Definition: winuser.h:3306
HINSTANCE hInstance
Definition: winuser.h:3308
HCURSOR hCursor
Definition: winuser.h:3310
LPCSTR lpszMenuName
Definition: winuser.h:3312
UINT style
Definition: winuser.h:3304
int cbWndExtra
Definition: winuser.h:3307
WNDPROC lpfnWndProc
Definition: winuser.h:3305
LPCSTR lpszClassName
Definition: winuser.h:3313
HICON hIcon
Definition: winuser.h:3309
HBRUSH hbrBackground
Definition: winuser.h:3311
int retval
Definition: wcstombs.cpp:91
BOOL WINAPI GetClassInfoExA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSEXA)

◆ GetClassInfoExA()

BOOL WINAPI GetClassInfoExA ( HINSTANCE  hInstance,
LPCSTR  lpszClass,
LPWNDCLASSEXA  lpwcx 
)

Definition at line 264 of file class.c.

268{
269 UNICODE_STRING ClassName = {0};
270 LPCSTR pszMenuName;
272 DWORD dwLastError;
273 BOOL Ret, ClassFound = FALSE, ConvertedString = FALSE;
274 LPCWSTR lpszClsVersion;
275 HANDLE pCtx = NULL;
276 LPCWSTR lpLibFileName = NULL;
277
278 TRACE("%p class/atom: %s/%04x %p\n", hInstance,
279 IS_ATOM(lpszClass) ? NULL : lpszClass,
280 IS_ATOM(lpszClass) ? lpszClass : 0,
281 lpwcx);
282
283 if (!lpwcx)
284 {
286 return FALSE;
287 }
288
290 {
291 hInstance = NULL;
292 }
293
294 if (lpszClass == NULL)
295 {
297 return FALSE;
298 }
299
300 lpszClsVersion = ClassNameToVersion(lpszClass, NULL, &lpLibFileName, &pCtx, TRUE);
301 if (lpszClsVersion)
302 {
303 RtlInitUnicodeString(&ClassName, lpszClsVersion);
304 }
305 else if (IS_ATOM(lpszClass))
306 {
307 ClassName.Buffer = (PWSTR)((ULONG_PTR)lpszClass);
308 }
309 else
310 {
311 ConvertedString = TRUE;
312 if (!RtlCreateUnicodeStringFromAsciiz(&ClassName, lpszClass))
313 {
315 return FALSE;
316 }
317 }
318
320 {
321 TRACE("RegisterSystemControls\n");
323 }
324
325 for(;;)
326 {
328 &ClassName,
329 (LPWNDCLASSEXW)lpwcx,
330 (LPWSTR *)&pszMenuName,
331 TRUE);
332 if (Ret) break;
333 if (!lpLibFileName) break;
334 if (!ClassFound)
335 {
336 dwLastError = GetLastError();
337 if ( dwLastError == ERROR_CANNOT_FIND_WND_CLASS ||
338 dwLastError == ERROR_CLASS_DOES_NOT_EXIST )
339 {
340 ClassFound = VersionRegisterClass(ClassName.Buffer, lpLibFileName, pCtx, &hLibModule);
341 if (ClassFound) continue;
342 }
343 }
344 if (hLibModule)
345 {
346 dwLastError = GetLastError();
348 SetLastError(dwLastError);
349 hLibModule = 0;
350 }
351 break;
352 }
353
354 if (Ret)
355 {
356 lpwcx->lpszClassName = lpszClass;
357// lpwcx->lpszMenuName = pszMenuName;
358 }
359
360 if (ConvertedString)
361 {
362 RtlFreeUnicodeString(&ClassName);
363 }
364
365 return Ret;
366}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define FreeLibrary(x)
Definition: compat.h:748
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL NTAPI NtUserGetClassInfo(HINSTANCE hInstance, PUNICODE_STRING ClassName, LPWNDCLASSEXW wcex, LPWSTR *ppszMenuName, BOOL Ansi)
Definition: class.c:2779
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
DWORD RegisterDefaultClasses
Definition: regcontrol.c:13
BOOL WINAPI RegisterSystemControls(VOID)
Definition: regcontrol.c:71
HINSTANCE hLibModule
Definition: sfc.c:23
LPCWSTR lpszClassName
Definition: winuser.h:3328
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:65
HINSTANCE User32Instance
Definition: dllmain.c:27
BOOL FASTCALL VersionRegisterClass(PCWSTR pszClass, LPCWSTR lpLibFileName, HANDLE Contex, HMODULE *phLibModule)
Definition: class.c:195
LPCWSTR FASTCALL ClassNameToVersion(const void *lpszClass, LPCWSTR lpszMenuName, LPCWSTR *plpLibFileName, HANDLE *pContext, BOOL bAnsi)
Definition: class.c:85
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_CLASS_DOES_NOT_EXIST
Definition: winerror.h:1238
#define ERROR_CANNOT_FIND_WND_CLASS
Definition: winerror.h:1234
#define ERROR_NOACCESS
Definition: winerror.h:903
const char * LPCSTR
Definition: xmlstorage.h:183
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ GetClassInfoExW()

BOOL WINAPI GetClassInfoExW ( HINSTANCE  hInstance,
LPCWSTR  lpszClass,
LPWNDCLASSEXW  lpwcx 
)

Definition at line 374 of file class.c.

378{
379 UNICODE_STRING ClassName = {0};
380 LPWSTR pszMenuName;
382 DWORD dwLastError;
383 BOOL Ret, ClassFound = FALSE;
384 LPCWSTR lpszClsVersion;
385 HANDLE pCtx = NULL;
386 LPCWSTR lpLibFileName = NULL;
387
388 TRACE("%p class/atom: %S/%04x %p\n", hInstance,
389 IS_ATOM(lpszClass) ? NULL : lpszClass,
390 IS_ATOM(lpszClass) ? lpszClass : 0,
391 lpwcx);
392
393 /* From wine, for speed only, ReactOS supports the correct return in
394 * Win32k. cbSize is ignored.
395 */
396 if (!lpwcx)
397 {
399 return FALSE;
400 }
401
403 {
404 hInstance = NULL;
405 }
406
407 if (lpszClass == NULL)
408 {
410 return FALSE;
411 }
412
413 lpszClsVersion = ClassNameToVersion(lpszClass, NULL, &lpLibFileName, &pCtx, FALSE);
414 if (lpszClsVersion)
415 {
416 RtlInitUnicodeString(&ClassName, lpszClsVersion);
417 }
418 else if (IS_ATOM(lpszClass))
419 {
420 ClassName.Buffer = (PWSTR)((ULONG_PTR)lpszClass);
421 }
422 else
423 {
424 RtlInitUnicodeString(&ClassName, lpszClass);
425 }
426
428 {
429 TRACE("RegisterSystemControls\n");
431 }
432
433 for(;;)
434 {
436 &ClassName,
437 lpwcx,
438 &pszMenuName,
439 FALSE);
440 if (Ret) break;
441 if (!lpLibFileName) break;
442 if (!ClassFound)
443 {
444 dwLastError = GetLastError();
445 if ( dwLastError == ERROR_CANNOT_FIND_WND_CLASS ||
446 dwLastError == ERROR_CLASS_DOES_NOT_EXIST )
447 {
448 ClassFound = VersionRegisterClass(ClassName.Buffer, lpLibFileName, pCtx, &hLibModule);
449 if (ClassFound) continue;
450 }
451 }
452 if (hLibModule)
453 {
454 dwLastError = GetLastError();
456 SetLastError(dwLastError);
457 hLibModule = 0;
458 }
459 break;
460 }
461
462 if (Ret)
463 {
464 lpwcx->lpszClassName = lpszClass;
465// lpwcx->lpszMenuName = pszMenuName;
466 }
467 return Ret;
468}

◆ GetClassInfoW()

BOOL WINAPI GetClassInfoW ( HINSTANCE  hInstance,
LPCWSTR  lpClassName,
LPWNDCLASSW  lpWndClass 
)

Definition at line 507 of file class.c.

511{
512 WNDCLASSEXW wcex;
513 BOOL retval;
514
515 retval = GetClassInfoExW(hInstance, lpClassName, &wcex);
516 if (retval)
517 {
518 lpWndClass->style = wcex.style;
519 lpWndClass->lpfnWndProc = wcex.lpfnWndProc;
520 lpWndClass->cbClsExtra = wcex.cbClsExtra;
521 lpWndClass->cbWndExtra = wcex.cbWndExtra;
522 lpWndClass->hInstance = wcex.hInstance;
523 lpWndClass->hIcon = wcex.hIcon;
524 lpWndClass->hCursor = wcex.hCursor;
525 lpWndClass->hbrBackground = wcex.hbrBackground;
526 lpWndClass->lpszMenuName = wcex.lpszMenuName;
527 lpWndClass->lpszClassName = wcex.lpszClassName;
528 }
529 return retval;
530}
LPCWSTR lpszMenuName
Definition: winuser.h:3327
HBRUSH hbrBackground
Definition: winuser.h:3326
WNDPROC lpfnWndProc
Definition: winuser.h:3320
int cbWndExtra
Definition: winuser.h:3322
HCURSOR hCursor
Definition: winuser.h:3325
HINSTANCE hInstance
Definition: winuser.h:3323
UINT style
Definition: winuser.h:3319
int cbClsExtra
Definition: winuser.h:3321
HICON hIcon
Definition: winuser.h:3324
LPCWSTR lpszClassName
Definition: winuser.h:3287
LPCWSTR lpszMenuName
Definition: winuser.h:3286
HBRUSH hbrBackground
Definition: winuser.h:3285
HICON hIcon
Definition: winuser.h:3283
HINSTANCE hInstance
Definition: winuser.h:3282
int cbClsExtra
Definition: winuser.h:3280
UINT style
Definition: winuser.h:3278
WNDPROC lpfnWndProc
Definition: winuser.h:3279
int cbWndExtra
Definition: winuser.h:3281
HCURSOR hCursor
Definition: winuser.h:3284
BOOL WINAPI GetClassInfoExW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _Out_ LPWNDCLASSEXW)

◆ GetClassLongA()

DWORD WINAPI GetClassLongA ( HWND  hWnd,
int  nIndex 
)

Definition at line 805 of file class.c.

806{
807 PWND Wnd;
808 PCLS Class;
809 ULONG_PTR Ret = 0;
810
811 TRACE("%p %d\n", hWnd, nIndex);
812
813 Wnd = ValidateHwnd(hWnd);
814 if (!Wnd)
815 return 0;
816
818 {
820 if (Class != NULL)
821 {
822#ifdef _WIN64
823 switch (nIndex)
824 {
826 case GCLP_HCURSOR:
827 case GCLP_HICON:
828 case GCLP_HICONSM:
829 case GCLP_HMODULE:
830 case GCLP_MENUNAME:
831 case GCLP_WNDPROC:
833 break;
834
835 default:
836 Ret = IntGetClassLongA(Wnd, Class, nIndex);
837 break;
838 }
839#else
840 Ret = IntGetClassLongA(Wnd, Class, nIndex);
841#endif
842 }
843 else
844 {
845 WARN("Invalid class for hwnd 0x%p!\n", hWnd);
846 }
847 }
849 {
850 Ret = 0;
851 }
852 _SEH2_END;
853
854 return (DWORD)Ret;
855}
HWND hWnd
Definition: settings.c:17
#define WARN(fmt,...)
Definition: precomp.h:61
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
Definition: ntuser.h:566
Definition: ntuser.h:694
PCLS pcls
Definition: ntuser.h:720
#define ValidateHwnd(hwnd)
Definition: precomp.h:101
static PVOID FASTCALL DesktopPtrToUser(PVOID ptr)
Definition: utils.c:188
static ULONG_PTR FASTCALL IntGetClassLongA(PWND Wnd, PCLS Class, int nIndex)
Definition: class.c:653
#define ERROR_INVALID_INDEX
Definition: winerror.h:1240
#define GCLP_MENUNAME
Definition: winuser.h:685
#define GCLP_HICONSM
Definition: winuser.h:683
#define GCLP_HMODULE
Definition: winuser.h:684
#define GCLP_HICON
Definition: winuser.h:682
#define GCLP_WNDPROC
Definition: winuser.h:686
#define GCLP_HCURSOR
Definition: winuser.h:681
#define GCLP_HBRBACKGROUND
Definition: winuser.h:680

Referenced by GetClassWord().

◆ GetClassLongW()

DWORD WINAPI GetClassLongW ( HWND  hWnd,
int  nIndex 
)

Definition at line 861 of file class.c.

862{
863 PWND Wnd;
864 PCLS Class;
865 ULONG_PTR Ret = 0;
866
867 TRACE("%p %d\n", hWnd, nIndex);
868
869 Wnd = ValidateHwnd(hWnd);
870 if (!Wnd)
871 return 0;
872
874 {
876 if (Class != NULL)
877 {
878#ifdef _WIN64
879 switch (nIndex)
880 {
882 case GCLP_HCURSOR:
883 case GCLP_HICON:
884 case GCLP_HICONSM:
885 case GCLP_HMODULE:
886 case GCLP_MENUNAME:
887 case GCLP_WNDPROC:
889 break;
890
891 default:
892 Ret = IntGetClassLongW(Wnd, Class, nIndex);
893 break;
894 }
895#else
896 Ret = IntGetClassLongW(Wnd, Class, nIndex);
897#endif
898 }
899 else
900 {
901 WARN("Invalid class for hwnd 0x%p!\n", hWnd);
902 }
903 }
905 {
906 Ret = 0;
907 }
908 _SEH2_END;
909
910 return (DWORD)Ret;
911}
static ULONG_PTR FASTCALL IntGetClassLongW(PWND Wnd, PCLS Class, int nIndex)
Definition: class.c:728

◆ GetClassNameA()

int WINAPI GetClassNameA ( HWND  hWnd,
LPSTR  lpClassName,
int  nMaxCount 
)

Definition at line 998 of file class.c.

1002{
1003 WCHAR tmpbuf[MAX_ATOM_LEN + 1];
1004 int len;
1005
1006 if (nMaxCount <= 0) return 0;
1007 if (!GetClassNameW( hWnd, tmpbuf, sizeof(tmpbuf)/sizeof(WCHAR) )) return 0;
1008 RtlUnicodeToMultiByteN( lpClassName, nMaxCount - 1, (PULONG)&len, tmpbuf, strlenW(tmpbuf) * sizeof(WCHAR) );
1009 lpClassName[len] = 0;
1010
1011 TRACE("%p class/atom: %s/%04x %x\n", hWnd,
1012 IS_ATOM(lpClassName) ? NULL : lpClassName,
1013 IS_ATOM(lpClassName) ? lpClassName : 0,
1014 nMaxCount);
1015
1016 return len;
1017}
#define MAX_ATOM_LEN
Definition: dde_private.h:30
GLenum GLsizei len
Definition: glext.h:6722
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteN(_Out_ PCHAR MbString, _In_ ULONG MbSize, _Out_opt_ PULONG ResultSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:107
#define strlenW(s)
Definition: unicode.h:34
uint32_t * PULONG
Definition: typedefs.h:59
_In_ int nMaxCount
Definition: winuser.h:4979
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)

◆ GetClassNameW()

int WINAPI GetClassNameW ( HWND  hWnd,
LPWSTR  lpClassName,
int  nMaxCount 
)

Definition at line 1025 of file class.c.

1029{
1030 UNICODE_STRING ClassName;
1031 int Result;
1032
1033 RtlInitEmptyUnicodeString(&ClassName,
1034 lpClassName,
1035 nMaxCount * sizeof(WCHAR));
1036
1038 FALSE,
1039 &ClassName);
1040
1041 TRACE("%p class/atom: %S/%04x %x\n", hWnd,
1042 IS_ATOM(lpClassName) ? NULL : lpClassName,
1043 IS_ATOM(lpClassName) ? lpClassName : 0,
1044 nMaxCount);
1045
1046 return Result;
1047}
INT NTAPI NtUserGetClassName(HWND hWnd, BOOL Real, PUNICODE_STRING ClassName)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

◆ GetClassWord()

WORD WINAPI GetClassWord ( HWND  hwnd,
int  offset 
)

Definition at line 1055 of file class.c.

1058{
1059 PWND Wnd;
1060 PCLS class;
1061 WORD retvalue = 0;
1062
1063 if (offset < 0) return GetClassLongA( hwnd, offset );
1064
1065 Wnd = ValidateHwnd(hwnd);
1066 if (!Wnd)
1067 return 0;
1068
1069 class = DesktopPtrToUser(Wnd->pcls);
1070 if (class == NULL) return 0;
1071
1072 if (offset <= class->cbclsExtra - sizeof(WORD))
1073 memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) );
1074 else
1076
1077 return retvalue;
1078}
unsigned short WORD
Definition: ntddk_ex.h:93
GLintptr offset
Definition: glext.h:5920
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
DWORD WINAPI GetClassLongA(HWND hWnd, int nIndex)
Definition: class.c:805
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

◆ GetWindowLongA()

LONG WINAPI GetWindowLongA ( HWND  hWnd,
int  nIndex 
)

Definition at line 1164 of file class.c.

1165{
1166 return IntGetWindowLong( hWnd, nIndex, sizeof(LONG), FALSE );
1167}
long LONG
Definition: pedump.c:60
LONG_PTR IntGetWindowLong(HWND hwnd, INT offset, UINT size, BOOL unicode)
Definition: class.c:1089

◆ GetWindowLongW()

LONG WINAPI GetWindowLongW ( HWND  hWnd,
int  nIndex 
)

Definition at line 1174 of file class.c.

1175{
1176 return IntGetWindowLong( hWnd, nIndex, sizeof(LONG), TRUE );
1177}

◆ GetWindowWord()

WORD WINAPI GetWindowWord ( HWND  hWnd,
int  nIndex 
)

Definition at line 1209 of file class.c.

1210{
1211 switch(nIndex)
1212 {
1213 case GWLP_ID:
1214 case GWLP_HINSTANCE:
1215 case GWLP_HWNDPARENT:
1216 break;
1217 default:
1218 if (nIndex < 0)
1219 {
1220 WARN("Invalid offset %d\n", nIndex );
1222 return 0;
1223 }
1224 break;
1225 }
1226 return IntGetWindowLong( hWnd, nIndex, sizeof(WORD), FALSE );
1227}
#define GWLP_HINSTANCE
Definition: winuser.h:867
#define GWLP_HWNDPARENT
Definition: winuser.h:869
#define GWLP_ID
Definition: winuser.h:871

◆ IntGetClassLongA()

static ULONG_PTR FASTCALL IntGetClassLongA ( PWND  Wnd,
PCLS  Class,
int  nIndex 
)
static

Definition at line 653 of file class.c.

654{
655 ULONG_PTR Ret = 0;
656
657 if (nIndex >= 0)
658 {
659 if (nIndex + sizeof(ULONG_PTR) < nIndex ||
660 nIndex + sizeof(ULONG_PTR) > Class->cbclsExtra)
661 {
663 }
664 else
665 Ret = *(PULONG_PTR)((ULONG_PTR)(Class + 1) + nIndex);
666 }
667 else
668 {
669 switch (nIndex)
670 {
671 case GCL_CBWNDEXTRA:
672 Ret = (ULONG_PTR)Class->cbwndExtra;
673 break;
674
675 case GCL_CBCLSEXTRA:
676 Ret = (ULONG_PTR)Class->cbclsExtra;
677 break;
678
680 Ret = (ULONG_PTR)Class->hbrBackground;
681 if (Ret != 0 && Ret < 0x4000)
682 Ret = (ULONG_PTR)GetSysColorBrush((ULONG)Ret - 1);
683 break;
684
685 case GCL_HMODULE:
686 //ERR("Cls 0x%x GCL_HMODULE 0x%x\n", Wnd->pcls, Class->hModule);
687 Ret = (ULONG_PTR)Class->hModule;
688 break;
689
690 case GCL_MENUNAME:
691 Ret = (ULONG_PTR)Class->lpszClientAnsiMenuName;
692 break;
693
694 case GCL_STYLE:
695 Ret = (ULONG_PTR)Class->style;
696 break;
697
698 case GCW_ATOM:
699 Ret = (ULONG_PTR)Class->atomNVClassName;
700 break;
701
702 case GCLP_HCURSOR:
703 Ret = Class->spcur ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spcur))->h : 0;
704 break;
705
706 case GCLP_HICON:
707 Ret = Class->spicn ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spicn))->h : 0;
708 break;
709
710 case GCLP_HICONSM:
711 Ret = Class->spicnSm ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spicnSm))->h : 0;
712 break;
713
714 case GCLP_WNDPROC:
715 Ret = IntGetClsWndProc(Wnd, Class, TRUE);
716 break;
717
718 default:
720 break;
721 }
722 }
723
724 return Ret;
725}
#define ULONG_PTR
Definition: config.h:101
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
if(dx< 0)
Definition: linetemp.h:194
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
static __inline PVOID SharedPtrToUser(PVOID Ptr)
Definition: user_x.h:4
ULONG_PTR FASTCALL IntGetClsWndProc(PWND pWnd, PCLS Class, BOOL Ansi)
Definition: class.c:536
#define GCL_HMODULE
Definition: winuser.h:676
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define GCL_MENUNAME
Definition: winuser.h:677
#define GCL_CBWNDEXTRA
Definition: winuser.h:671
#define GCL_HBRBACKGROUND
Definition: winuser.h:672
#define GCW_ATOM
Definition: winuser.h:669
#define GCL_STYLE
Definition: winuser.h:678
#define GCL_CBCLSEXTRA
Definition: winuser.h:670

Referenced by GetClassLongA().

◆ IntGetClassLongW()

static ULONG_PTR FASTCALL IntGetClassLongW ( PWND  Wnd,
PCLS  Class,
int  nIndex 
)
static

Definition at line 728 of file class.c.

729{
730 ULONG_PTR Ret = 0;
731
732 if (nIndex >= 0)
733 {
734 if (nIndex + sizeof(ULONG_PTR) < nIndex ||
735 nIndex + sizeof(ULONG_PTR) > Class->cbclsExtra)
736 {
738 }
739 else
740 Ret = *(PULONG_PTR)((ULONG_PTR)(Class + 1) + nIndex);
741 }
742 else
743 {
744 switch (nIndex)
745 {
746 case GCL_CBWNDEXTRA:
747 Ret = (ULONG_PTR)Class->cbwndExtra;
748 break;
749
750 case GCL_CBCLSEXTRA:
751 Ret = (ULONG_PTR)Class->cbclsExtra;
752 break;
753
755 Ret = (ULONG_PTR)Class->hbrBackground;
756 if (Ret != 0 && Ret < 0x4000)
757 Ret = (ULONG_PTR)GetSysColorBrush((ULONG)Ret - 1);
758 break;
759
760 case GCL_HMODULE:
761 Ret = (ULONG_PTR)Class->hModule;
762 break;
763
764 case GCLP_MENUNAME:
765 Ret = (ULONG_PTR)Class->lpszClientUnicodeMenuName;
766 break;
767
768 case GCL_STYLE:
769 Ret = (ULONG_PTR)Class->style;
770 break;
771
772 case GCW_ATOM:
773 Ret = (ULONG_PTR)Class->atomNVClassName;
774 break;
775
776 case GCLP_HCURSOR:
777 Ret = Class->spcur ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spcur))->h : 0;
778 break;
779
780 case GCLP_HICON:
781 Ret = Class->spicn ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spicn))->h : 0;
782 break;
783
784 case GCLP_HICONSM:
785 Ret = Class->spicnSm ? (ULONG_PTR)((PPROCMARKHEAD)SharedPtrToUser(Class->spicnSm))->h : 0;
786 break;
787
788 case GCLP_WNDPROC:
789 Ret = IntGetClsWndProc(Wnd, Class, FALSE);
790 break;
791
792 default:
794 break;
795 }
796 }
797
798 return Ret;
799}

Referenced by GetClassLongW().

◆ IntGetClsWndProc()

ULONG_PTR FASTCALL IntGetClsWndProc ( PWND  pWnd,
PCLS  Class,
BOOL  Ansi 
)

Definition at line 536 of file class.c.

537{
538 INT i;
539 ULONG_PTR gcpd, Ret = 0;
540 // If server side, sweep through proc list and return the client side proc.
541 if (Class->CSF_flags & CSF_SERVERSIDEPROC)
542 { // Always scan through the list due to wine class "deftest".
543 for ( i = FNID_FIRST; i <= FNID_SWITCH; i++)
544 {
545 if (GETPFNSERVER(i) == Class->lpfnWndProc)
546 {
547 if (Ansi)
548 Ret = (ULONG_PTR)GETPFNCLIENTA(i);
549 else
550 Ret = (ULONG_PTR)GETPFNCLIENTW(i);
551 }
552 }
553 return Ret;
554 }
555 // Set return proc.
556 Ret = (ULONG_PTR)Class->lpfnWndProc;
557 // Return the proc if one of the FnId default class type.
558 if (Class->fnid <= FNID_GHOST && Class->fnid >= FNID_BUTTON)
559 {
560 if (Ansi)
561 { // If match return the right proc by type.
562 if (GETPFNCLIENTW(Class->fnid) == Class->lpfnWndProc)
563 Ret = (ULONG_PTR)GETPFNCLIENTA(Class->fnid);
564 }
565 else
566 {
567 if (GETPFNCLIENTA(Class->fnid) == Class->lpfnWndProc)
568 Ret = (ULONG_PTR)GETPFNCLIENTW(Class->fnid);
569 }
570 }
571 // Return on change or Ansi/Unicode proc equal.
572 if ( Ret != (ULONG_PTR)Class->lpfnWndProc ||
573 Ansi == !!(Class->CSF_flags & CSF_ANSIPROC) )
574 return Ret;
575
576 /* We have an Ansi and Unicode swap! If Ansi create Unicode proc handle.
577 This will force CallWindowProc to deal with it. */
578 gcpd = NtUserGetCPD( UserHMGetHandle(pWnd),
580 Ret);
581
582 return (gcpd ? gcpd : Ret);
583}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FNID_SWITCH
Definition: ntuser.h:865
#define GETPFNCLIENTW(fnid)
Definition: ntuser.h:906
#define GETPFNCLIENTA(fnid)
Definition: ntuser.h:904
#define CSF_ANSIPROC
Definition: ntuser.h:557
#define FNID_FIRST
Definition: ntuser.h:858
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define FNID_BUTTON
Definition: ntuser.h:866
@ UserGetCPDWndtoCls
Definition: ntuser.h:545
@ UserGetCPDU2A
Definition: ntuser.h:541
@ UserGetCPDA2U
Definition: ntuser.h:540
#define GETPFNSERVER(fnid)
Definition: ntuser.h:909
ULONG_PTR NTAPI NtUserGetCPD(HWND hWnd, GETCPD Flags, ULONG_PTR Proc)
Definition: callproc.c:176
#define CSF_SERVERSIDEPROC
Definition: ntuser.h:556
#define FNID_GHOST
Definition: ntuser.h:875
int32_t INT
Definition: typedefs.h:58

Referenced by IntGetClassLongA(), and IntGetClassLongW().

◆ IntGetWindowLong()

LONG_PTR IntGetWindowLong ( HWND  hwnd,
INT  offset,
UINT  size,
BOOL  unicode 
)

Definition at line 1089 of file class.c.

1090{
1091 LONG_PTR retvalue = 0;
1092 WND *wndPtr;
1093
1094 if (offset == GWLP_HWNDPARENT)
1095 {
1098 return (ULONG_PTR)parent;
1099 }
1100
1101 if (!(wndPtr = ValidateHwnd( hwnd )))
1102 {
1104 return 0;
1105 }
1106
1107 if (offset >= 0 && wndPtr->fnid != FNID_DESKTOP)
1108 {
1109 if (offset > (int)(wndPtr->cbwndExtra - size))
1110 {
1111 WARN("Invalid offset %d\n", offset );
1113 return 0;
1114 }
1115 retvalue = *((LONG_PTR *)((PCHAR)(wndPtr + 1) + offset));
1116
1117 /* WINE: special case for dialog window procedure */
1118 //if ((offset == DWLP_DLGPROC) && (size == sizeof(LONG_PTR)) && (wndPtr->flags & WIN_ISDIALOG))
1119 // retvalue = (LONG_PTR)IntGetWndProc( (WNDPROC)retvalue, unicode );
1120 return retvalue;
1121 }
1122
1123 switch(offset)
1124 {
1125 case GWLP_USERDATA: retvalue = wndPtr->dwUserData; break;
1126 case GWL_STYLE: retvalue = wndPtr->style; break;
1127 case GWL_EXSTYLE: retvalue = (wndPtr->ExStyle & PUBLIC_EXSTYLE); break;
1128 case GWLP_ID: retvalue = wndPtr->IDMenu; break;
1129 case GWLP_HINSTANCE: retvalue = (ULONG_PTR)wndPtr->hModule; break;
1130#if 0
1131 /* -1 is an undocumented case which returns WW* */
1132 /* source: http://www.geoffchappell.com/studies/windows/win32/user32/structs/wnd/index.htm*/
1133 case -1: retvalue = (ULONG_PTR)&wndPtr->ww; break;
1134#else
1135 /* We don't have a WW but WND already contains the same fields in the right order, */
1136 /* so we can return a pointer to its first field */
1137 case -1: retvalue = (ULONG_PTR)&wndPtr->state; break;
1138#endif
1139 case GWLP_WNDPROC:
1140 {
1141 if (!TestWindowProcess(wndPtr))
1142 {
1144 retvalue = 0;
1145 ERR("Outside Access and Denied!\n");
1146 break;
1147 }
1148 retvalue = (ULONG_PTR)IntGetWndProc(wndPtr, !unicode);
1149 break;
1150 }
1151 default:
1152 WARN("Unknown offset %d\n", offset );
1154 break;
1155 }
1156 return retvalue;
1157
1158}
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
r parent
Definition: btrfs.c:3010
GLsizeiptr size
Definition: glext.h:5919
#define FNID_DESKTOP
Definition: ntuser.h:862
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
DWORD ExStyle
Definition: ntuser.h:704
DWORD style
Definition: ntuser.h:706
DWORD fnid
Definition: ntuser.h:709
DWORD state
Definition: ntuser.h:701
UINT_PTR IDMenu
Definition: ntuser.h:731
LONG_PTR dwUserData
Definition: ntuser.h:741
HINSTANCE hModule
Definition: ntuser.h:708
ULONG cbwndExtra
Definition: ntuser.h:738
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63
char * PCHAR
Definition: typedefs.h:51
BOOL FASTCALL TestWindowProcess(PWND)
Definition: misc.c:166
WNDPROC FASTCALL IntGetWndProc(PWND pWnd, BOOL Ansi)
Definition: class.c:589
#define PUBLIC_EXSTYLE
Definition: class.c:1080
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:1227
#define GW_OWNER
Definition: winuser.h:777
#define GA_PARENT
Definition: winuser.h:2890
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define GWL_STYLE
Definition: winuser.h:863
HWND WINAPI GetAncestor(_In_ HWND, _In_ UINT)
Definition: window.c:929
#define GWL_EXSTYLE
Definition: winuser.h:862

Referenced by GetWindowLongA(), GetWindowLongW(), and GetWindowWord().

◆ IntGetWndProc()

WNDPROC FASTCALL IntGetWndProc ( PWND  pWnd,
BOOL  Ansi 
)

Definition at line 589 of file class.c.

590{
591 INT i;
592 WNDPROC gcpd, Ret = 0;
594
595 if (!Class) return Ret;
596
598 {
599 for ( i = FNID_FIRST; i <= FNID_SWITCH; i++)
600 {
601 if (GETPFNSERVER(i) == pWnd->lpfnWndProc)
602 {
603 if (Ansi)
604 Ret = GETPFNCLIENTA(i);
605 else
606 Ret = GETPFNCLIENTW(i);
607 }
608 }
609 return Ret;
610 }
611 // Wine Class tests:
612 /* Edit controls are special - they return a wndproc handle when
613 GetWindowLongPtr is called with a different A/W.
614 On the other hand there is no W->A->W conversion so this control
615 is treated specially.
616 */
617 if (Class->fnid == FNID_EDIT)
618 Ret = pWnd->lpfnWndProc;
619 else
620 {
621 // Set return proc.
622 Ret = pWnd->lpfnWndProc;
623
624 if (Class->fnid <= FNID_GHOST && Class->fnid >= FNID_BUTTON)
625 {
626 if (Ansi)
627 {
628 if (GETPFNCLIENTW(Class->fnid) == pWnd->lpfnWndProc)
629 Ret = GETPFNCLIENTA(Class->fnid);
630 }
631 else
632 {
633 if (GETPFNCLIENTA(Class->fnid) == pWnd->lpfnWndProc)
634 Ret = GETPFNCLIENTW(Class->fnid);
635 }
636 }
637 // Return on the change.
638 if ( Ret != pWnd->lpfnWndProc)
639 return Ret;
640 }
641
642 if ( Ansi == !!(pWnd->state & WNDS_ANSIWINDOWPROC) )
643 return Ret;
644
645 gcpd = (WNDPROC)NtUserGetCPD( UserHMGetHandle(pWnd),
647 (ULONG_PTR)Ret);
648
649 return (gcpd ? gcpd : Ret);
650}
#define WNDS_SERVERSIDEWINDOWPROC
Definition: ntuser.h:623
@ UserGetCPDWindow
Definition: ntuser.h:543
#define FNID_EDIT
Definition: ntuser.h:870
#define WNDS_ANSIWINDOWPROC
Definition: ntuser.h:624
WNDPROC lpfnWndProc
Definition: ntuser.h:718
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3008

Referenced by IntGetWindowLong().

◆ is_comctl32_class()

LPCWSTR is_comctl32_class ( const WCHAR name)

Definition at line 46 of file class.c.

47{
48 static const WCHAR classesW[][20] =
49 {
50 {'C','o','m','b','o','B','o','x','E','x','3','2',0},
51 {'m','s','c','t','l','s','_','h','o','t','k','e','y','3','2',0},
52 {'m','s','c','t','l','s','_','p','r','o','g','r','e','s','s','3','2',0},
53 {'m','s','c','t','l','s','_','s','t','a','t','u','s','b','a','r','3','2',0},
54 {'m','s','c','t','l','s','_','t','r','a','c','k','b','a','r','3','2',0},
55 {'m','s','c','t','l','s','_','u','p','d','o','w','n','3','2',0},
56 {'N','a','t','i','v','e','F','o','n','t','C','t','l',0},
57 {'R','e','B','a','r','W','i','n','d','o','w','3','2',0},
58 {'S','y','s','A','n','i','m','a','t','e','3','2',0},
59 {'S','y','s','D','a','t','e','T','i','m','e','P','i','c','k','3','2',0},
60 {'S','y','s','H','e','a','d','e','r','3','2',0},
61 {'S','y','s','I','P','A','d','d','r','e','s','s','3','2',0},
62 {'S','y','s','L','i','s','t','V','i','e','w','3','2',0},
63 {'S','y','s','M','o','n','t','h','C','a','l','3','2',0},
64 {'S','y','s','P','a','g','e','r',0},
65 {'S','y','s','T','a','b','C','o','n','t','r','o','l','3','2',0},
66 {'S','y','s','T','r','e','e','V','i','e','w','3','2',0},
67 {'T','o','o','l','b','a','r','W','i','n','d','o','w','3','2',0},
68 {'t','o','o','l','t','i','p','s','_','c','l','a','s','s','3','2',0},
69 };
70
71 int min = 0, max = (sizeof(classesW) / sizeof(classesW[0])) - 1;
72
73 while (min <= max)
74 {
75 int res, pos = (min + max) / 2;
76 if (!(res = strcmpiW( name, classesW[pos] ))) return classesW[pos];
77 if (res < 0) max = pos - 1;
78 else min = pos + 1;
79 }
80 return NULL;
81}
GLuint res
Definition: glext.h:9613
#define min(a, b)
Definition: monoChain.cc:55
#define strcmpiW(s1, s2)
Definition: unicode.h:45
Definition: name.c:39
#define max(a, b)
Definition: svc.c:63

Referenced by ClassNameToVersion().

◆ RealGetWindowClassA()

UINT WINAPI RealGetWindowClassA ( HWND  hwnd,
LPSTR  pszType,
UINT  cchType 
)

Definition at line 1254 of file class.c.

1258{
1259 WCHAR tmpbuf[MAX_ATOM_LEN + 1];
1260 UINT len;
1261
1262 if ((INT)cchType <= 0) return 0;
1263 if (!RealGetWindowClassW( hwnd, tmpbuf, sizeof(tmpbuf)/sizeof(WCHAR) )) return 0;
1264 RtlUnicodeToMultiByteN( pszType, cchType - 1, (PULONG)&len, tmpbuf, strlenW(tmpbuf) * sizeof(WCHAR) );
1265 pszType[len] = 0;
1266 return len;
1267}
unsigned int UINT
Definition: ndis.h:50
UINT WINAPI RealGetWindowClassW(HWND hwnd, LPWSTR pszType, UINT cchType)
Definition: class.c:1234

◆ RealGetWindowClassW()

UINT WINAPI RealGetWindowClassW ( HWND  hwnd,
LPWSTR  pszType,
UINT  cchType 
)

Definition at line 1234 of file class.c.

1238{
1239 UNICODE_STRING ClassName;
1240
1241 RtlInitEmptyUnicodeString(&ClassName,
1242 pszType,
1243 cchType * sizeof(WCHAR));
1244
1245 return NtUserGetClassName(hwnd,TRUE,&ClassName);
1246}

Referenced by RealGetWindowClassA().

◆ RegisterClassA()

ATOM WINAPI RegisterClassA ( CONST WNDCLASSA lpWndClass)

Definition at line 1442 of file class.c.

1443{
1445
1446 if (lpWndClass == NULL)
1447 return 0;
1448
1449 /* These MUST be copied manually, since on 64 bit architectures the
1450 alignment of the members is different between the 2 structs! */
1451 Class.style = lpWndClass->style;
1452 Class.lpfnWndProc = lpWndClass->lpfnWndProc;
1453 Class.cbClsExtra = lpWndClass->cbClsExtra;
1454 Class.cbWndExtra = lpWndClass->cbWndExtra;
1455 Class.hInstance = lpWndClass->hInstance;
1456 Class.hIcon = lpWndClass->hIcon;
1457 Class.hCursor = lpWndClass->hCursor;
1458 Class.hbrBackground = lpWndClass->hbrBackground;
1459 Class.lpszMenuName = lpWndClass->lpszMenuName;
1460 Class.lpszClassName = lpWndClass->lpszClassName;
1461
1462 Class.cbSize = sizeof(Class);
1463 Class.hIconSm = NULL;
1464
1465 return RegisterClassExA(&Class);
1466}
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)

◆ RegisterClassExA()

ATOM WINAPI RegisterClassExA ( CONST WNDCLASSEXA lpwcx)

Definition at line 1378 of file class.c.

1379{
1380 ATOM Atom;
1383 WCHAR cname[MAX_BUFFER_LEN];
1384
1385 C_ASSERT(sizeof(WndClass) == sizeof(*lpwcx));
1386
1387 RtlCopyMemory(&WndClass, lpwcx, sizeof(*lpwcx));
1388
1389 if (WndClass.lpszMenuName && !IS_INTRESOURCE(WndClass.lpszMenuName))
1390 {
1391 if (WndClass.lpszMenuName[0])
1392 {
1393 if (!MultiByteToWideChar(CP_ACP, 0, lpwcx->lpszMenuName, -1, mname, MAX_ATOM_LEN + 1 ))
1394 return 0;
1395
1396 WndClass.lpszMenuName = mname;
1397 }
1398 }
1399
1400 if (WndClass.lpszClassName && !IS_ATOM(WndClass.lpszClassName))
1401 {
1402 if (!MultiByteToWideChar(CP_ACP, 0, lpwcx->lpszClassName, -1, cname, MAX_ATOM_LEN + 1 ))
1403 return 0;
1404
1405 WndClass.lpszClassName = cname;
1406 }
1407
1409 NULL,
1410 0,
1412 TRUE);
1413
1414 TRACE("A atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n",
1415 Atom, lpwcx->lpfnWndProc, lpwcx->hInstance, lpwcx->hbrBackground,
1416 lpwcx->style, lpwcx->cbClsExtra, lpwcx->cbWndExtra, WndClass);
1417
1418 return Atom;
1419}
const char * mname
Definition: cmds.c:37
WCHAR WndClass[]
Definition: capicon.c:23
_Out_ RTL_ATOM * Atom
Definition: class.h:54
#define MAX_BUFFER_LEN
Definition: dde_private.h:34
WORD ATOM
Definition: dimm.idl:113
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
#define IS_INTRESOURCE(x)
Definition: loader.c:613
#define C_ASSERT(e)
Definition: intsafe.h:73
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
ATOM WINAPI RegisterClassExWOWW(WNDCLASSEXW *lpwcx, LPDWORD pdwWowData, WORD fnID, DWORD dwFlags, BOOL ChkRegCls)
Definition: class.c:1270

◆ RegisterClassExW()

ATOM WINAPI RegisterClassExW ( CONST WNDCLASSEXW lpwcx)

Definition at line 1425 of file class.c.

1426{
1427 ATOM Atom;
1428
1429 Atom = RegisterClassExWOWW((WNDCLASSEXW *)lpwcx, NULL, 0, 0, TRUE);
1430
1431 TRACE("W atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d\n",
1432 Atom, lpwcx->lpfnWndProc, lpwcx->hInstance, lpwcx->hbrBackground,
1433 lpwcx->style, lpwcx->cbClsExtra, lpwcx->cbWndExtra);
1434
1435 return Atom;
1436}

◆ RegisterClassExWOWW()

ATOM WINAPI RegisterClassExWOWW ( WNDCLASSEXW lpwcx,
LPDWORD  pdwWowData,
WORD  fnID,
DWORD  dwFlags,
BOOL  ChkRegCls 
)

Definition at line 1270 of file class.c.

1275{
1276 ATOM Atom;
1278 UNICODE_STRING ClassName;
1279 UNICODE_STRING ClassVersion;
1280 UNICODE_STRING MenuName = {0};
1281 CLSMENUNAME clsMenuName;
1282 ANSI_STRING AnsiMenuName;
1283 LPCWSTR lpszClsVersion;
1284
1285 if (lpwcx == NULL || lpwcx->cbSize != sizeof(*lpwcx) ||
1286 lpwcx->cbClsExtra < 0 || lpwcx->cbWndExtra < 0 ||
1287 lpwcx->lpszClassName == NULL)
1288 {
1289 TRACE("RegisterClassExWOWW Invalid Parameter Error!\n");
1291 return 0;
1292 }
1293
1294 if (ChkRegCls)
1295 {
1297 }
1298 /*
1299 * On real Windows this looks more like:
1300 * if (lpwcx->hInstance == User32Instance &&
1301 * *(PULONG)((ULONG_PTR)NtCurrentTeb() + 0x6D4) & 0x400)
1302 * But since I have no idea what the magic field in the
1303 * TEB structure means, I rather decided to omit that.
1304 * -- Filip Navara
1305
1306 GetWin32ClientInfo()->dwExpWinVer & (WINVER == 0x400)
1307 */
1308 if (lpwcx->hInstance == User32Instance)
1309 {
1310 TRACE("RegisterClassExWOWW User32Instance!\n");
1312 return 0;
1313 }
1314 /* Yes, this is correct. We should modify the passed structure. */
1315 if (lpwcx->hInstance == NULL)
1316 ((WNDCLASSEXW*)lpwcx)->hInstance = GetModuleHandleW(NULL);
1317
1318 RtlCopyMemory(&WndClass, lpwcx, sizeof(*lpwcx));
1319
1320 RtlInitEmptyAnsiString(&AnsiMenuName, NULL, 0);
1321 if (!IS_INTRESOURCE(WndClass.lpszMenuName))
1322 {
1323 if (WndClass.lpszMenuName[0])
1324 {
1325 RtlInitUnicodeString(&MenuName, WndClass.lpszMenuName);
1326 RtlUnicodeStringToAnsiString(&AnsiMenuName, &MenuName, TRUE);
1327 }
1328 }
1329 else
1330 {
1331 MenuName.Buffer = (LPWSTR)WndClass.lpszMenuName;
1332 AnsiMenuName.Buffer = (PCHAR)WndClass.lpszMenuName;
1333 }
1334
1335 if (WndClass.lpszClassName && !IS_ATOM(WndClass.lpszClassName))
1336 {
1337 RtlInitUnicodeString(&ClassName, WndClass.lpszClassName);
1338 }
1339 else
1340 {
1341 ClassName.Length = ClassName.MaximumLength = 0;
1342 ClassName.Buffer = (LPWSTR)WndClass.lpszClassName;
1343 }
1344
1345 ClassVersion = ClassName;
1346 if (fnID == 0)
1347 {
1348 lpszClsVersion = ClassNameToVersion(lpwcx->lpszClassName, NULL, NULL, NULL, FALSE);
1349 if (lpszClsVersion)
1350 {
1351 RtlInitUnicodeString(&ClassVersion, lpszClsVersion);
1352 }
1353 }
1354
1355 clsMenuName.pszClientAnsiMenuName = AnsiMenuName.Buffer;
1356 clsMenuName.pwszClientUnicodeMenuName = MenuName.Buffer;
1357 clsMenuName.pusMenuName = &MenuName;
1358
1360 &ClassName,
1361 &ClassVersion,
1362 &clsMenuName,
1363 fnID,
1364 dwFlags,
1365 pdwWowData);
1366
1367 TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n",
1368 Atom, lpwcx->lpfnWndProc, lpwcx->hInstance, lpwcx->hbrBackground,
1369 lpwcx->style, lpwcx->cbClsExtra, lpwcx->cbWndExtra, WndClass);
1370
1371 return Atom;
1372}
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
RTL_ATOM NTAPI NtUserRegisterClassExWOW(WNDCLASSEXW *lpwcx, PUNICODE_STRING pustrClassName, PUNICODE_STRING pustrCVersion, PCLSMENUNAME pClassMenuName, DWORD fnID, DWORD Flags, LPDWORD pWow)
Definition: class.c:2444
LPCWSTR LPCWSTR LPCWSTR DWORD dwFlags
Definition: env.c:37
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
PUNICODE_STRING pusMenuName
Definition: ntuser.h:500
LPSTR pszClientAnsiMenuName
Definition: ntuser.h:498
LPWSTR pwszClientUnicodeMenuName
Definition: ntuser.h:499
USHORT MaximumLength
Definition: env_spec_w32.h:370
UINT cbSize
Definition: winuser.h:3318

Referenced by RegisterClassExA(), RegisterClassExW(), and RegisterSystemControls().

◆ RegisterClassW()

ATOM WINAPI RegisterClassW ( CONST WNDCLASSW lpWndClass)

Definition at line 1472 of file class.c.

1473{
1475
1476 if (lpWndClass == NULL)
1477 return 0;
1478
1479 /* These MUST be copied manually, since on 64 bit architectures the
1480 alignment of the members is different between the 2 structs! */
1481 Class.style = lpWndClass->style;
1482 Class.lpfnWndProc = lpWndClass->lpfnWndProc;
1483 Class.cbClsExtra = lpWndClass->cbClsExtra;
1484 Class.cbWndExtra = lpWndClass->cbWndExtra;
1485 Class.hInstance = lpWndClass->hInstance;
1486 Class.hIcon = lpWndClass->hIcon;
1487 Class.hCursor = lpWndClass->hCursor;
1488 Class.hbrBackground = lpWndClass->hbrBackground;
1489 Class.lpszMenuName = lpWndClass->lpszMenuName;
1490 Class.lpszClassName = lpWndClass->lpszClassName;
1491
1492 Class.cbSize = sizeof(Class);
1493 Class.hIconSm = NULL;
1494
1495 return RegisterClassExW(&Class);
1496}
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)

◆ SetClassLongA()

DWORD WINAPI SetClassLongA ( HWND  hWnd,
int  nIndex,
LONG  dwNewLong 
)

Definition at line 1503 of file class.c.

1506{
1507 PSTR lpStr = (PSTR)(ULONG_PTR)dwNewLong;
1508 UNICODE_STRING Value = {0};
1510 DWORD Ret;
1511
1512 /* FIXME - portability!!!! */
1513
1514 if (nIndex == GCL_MENUNAME && lpStr != NULL)
1515 {
1516 if (!IS_INTRESOURCE(lpStr))
1517 {
1519 {
1521 return 0;
1522 }
1523
1524 Allocated = TRUE;
1525 }
1526 else
1527 {
1528 Value.Buffer = (PWSTR)lpStr;
1529 }
1530
1531 dwNewLong = (LONG_PTR)&Value;
1532 }
1533 else if (nIndex == GCW_ATOM && lpStr != NULL)
1534 {
1535 if (!IS_ATOM(lpStr))
1536 {
1538 {
1540 return 0;
1541 }
1542
1543 Allocated = TRUE;
1544 }
1545 else
1546 {
1547 Value.Buffer = (PWSTR)lpStr;
1548 }
1549
1550 dwNewLong = (LONG_PTR)&Value;
1551 }
1552
1554 nIndex,
1555 dwNewLong,
1556 TRUE);
1557
1558 if (Allocated)
1559 {
1561 }
1562
1563 return Ret;
1564}
IN PFCB IN VBO OUT PLBO OUT PULONG OUT PBOOLEAN Allocated
Definition: fatprocs.h:311
ULONG_PTR NTAPI NtUserSetClassLong(_In_ HWND hWnd, _In_ INT Offset, _In_ ULONG dwNewLong, _In_ BOOL Ansi)
Definition: class.c:2706
#define DWORD
Definition: nt_native.h:44
#define LONG_PTR
Definition: treelist.c:79
char * PSTR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

◆ SetClassLongW()

DWORD WINAPI SetClassLongW ( HWND  hWnd,
int  nIndex,
LONG  dwNewLong 
)

Definition at line 1572 of file class.c.

1575{
1576 PWSTR lpStr = (PWSTR)(ULONG_PTR)dwNewLong;
1577 UNICODE_STRING Value = {0};
1578
1579 TRACE("%p %d %lx\n", hWnd, nIndex, dwNewLong);
1580
1581 /* FIXME - portability!!!! */
1582
1583 if (nIndex == GCL_MENUNAME && lpStr != NULL)
1584 {
1585 if (!IS_INTRESOURCE(lpStr))
1586 RtlInitUnicodeString(&Value, lpStr);
1587 else
1588 Value.Buffer = lpStr;
1589
1590 dwNewLong = (LONG_PTR)&Value;
1591 }
1592 else if (nIndex == GCW_ATOM && lpStr != NULL)
1593 {
1594 if (!IS_ATOM(lpStr))
1595 RtlInitUnicodeString(&Value, lpStr);
1596 else
1597 Value.Buffer = lpStr;
1598
1599 dwNewLong = (LONG_PTR)&Value;
1600 }
1601
1603 nIndex,
1604 dwNewLong,
1605 FALSE);
1606}

◆ SetClassWord()

WORD WINAPI SetClassWord ( HWND  hWnd,
int  nIndex,
WORD  wNewWord 
)

Definition at line 1645 of file class.c.

1652{
1653 if ((nIndex < 0) && (nIndex != GCW_ATOM))
1654 return 0;
1655
1656 return (WORD) SetClassLongW ( hWnd, nIndex, wNewWord );
1657}
DWORD WINAPI SetClassLongW(_In_ HWND, _In_ int, _In_ LONG)

◆ SetWindowLongA()

LONG WINAPI DECLSPEC_HOTPATCH SetWindowLongA ( HWND  hWnd,
int  nIndex,
LONG  dwNewLong 
)

Definition at line 1691 of file class.c.

1695{
1696 /* DO NOT USE NtUserSetWindowLongPtr! */
1697 return NtUserSetWindowLong(hWnd, nIndex, dwNewLong, TRUE);
1698}
LONG NTAPI NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
Definition: window.c:4061

◆ SetWindowLongW()

LONG WINAPI SetWindowLongW ( HWND  hWnd,
int  nIndex,
LONG  dwNewLong 
)

Definition at line 1705 of file class.c.

1709{
1710 /* DO NOT USE NtUserSetWindowLongPtr! */
1711 return NtUserSetWindowLong(hWnd, nIndex, dwNewLong, FALSE);
1712}

◆ SetWindowWord()

WORD WINAPI SetWindowWord ( HWND  hWnd,
int  nIndex,
WORD  wNewWord 
)

Definition at line 1664 of file class.c.

1665{
1666 switch(nIndex)
1667 {
1668 case GWLP_ID:
1669 case GWLP_HINSTANCE:
1670 case GWLP_HWNDPARENT:
1671 break;
1672 default:
1673 if (nIndex < 0)
1674 {
1675 WARN("Invalid offset %d\n", nIndex );
1677 return 0;
1678 }
1679 break;
1680 }
1681 /* DO NOT USE NtUserSetWindowLong(Ptr)! */
1682 return NtUserSetWindowWord(hWnd, nIndex, wNewWord);
1683}
WORD NTAPI NtUserSetWindowWord(HWND hWnd, INT Index, WORD NewVal)
Definition: window.c:4136

◆ UnregisterClassA()

BOOL WINAPI UnregisterClassA ( LPCSTR  lpClassName,
HINSTANCE  hInstance 
)

Definition at line 1745 of file class.c.

1748{
1749 UNICODE_STRING ClassName = {0};
1750 BOOL Ret;
1751 LPCWSTR lpszClsVersion;
1752 BOOL ConvertedString = FALSE;
1753
1754 TRACE("class/atom: %s/%04x %p\n",
1755 IS_ATOM(lpClassName) ? NULL : lpClassName,
1756 IS_ATOM(lpClassName) ? lpClassName : 0,
1757 hInstance);
1758
1759 lpszClsVersion = ClassNameToVersion(lpClassName, NULL, NULL, NULL, TRUE);
1760 if (lpszClsVersion)
1761 {
1762 RtlInitUnicodeString(&ClassName, lpszClsVersion);
1763 }
1764 else if (!IS_ATOM(lpClassName))
1765 {
1766 ConvertedString = TRUE;
1767 if (!RtlCreateUnicodeStringFromAsciiz(&ClassName, lpClassName))
1768 {
1770 return 0;
1771 }
1772 }
1773 else
1774 {
1775 ClassName.Buffer = (PWSTR)((ULONG_PTR)lpClassName);
1776 }
1777
1778 Ret = NtUserUnregisterClass(&ClassName, hInstance, 0);
1779
1780 if (ConvertedString)
1781 RtlFreeUnicodeString(&ClassName);
1782
1783 return Ret;
1784}
BOOL NTAPI NtUserUnregisterClass(PUNICODE_STRING ClassNameOrAtom, HINSTANCE hInstance, PCLSMENUNAME pClassMenuName)

◆ UnregisterClassW()

BOOL WINAPI UnregisterClassW ( LPCWSTR  lpClassName,
HINSTANCE  hInstance 
)

Definition at line 1791 of file class.c.

1794{
1795 UNICODE_STRING ClassName = {0};
1796 LPCWSTR lpszClsVersion;
1797
1798 TRACE("class/atom: %S/%04x %p\n",
1799 IS_ATOM(lpClassName) ? NULL : lpClassName,
1800 IS_ATOM(lpClassName) ? lpClassName : 0,
1801 hInstance);
1802
1803 lpszClsVersion = ClassNameToVersion(lpClassName, NULL, NULL, NULL, FALSE);
1804 if (lpszClsVersion)
1805 {
1806 RtlInitUnicodeString(&ClassName, lpszClsVersion);
1807 }
1808 else if (!IS_ATOM(lpClassName))
1809 {
1810 RtlInitUnicodeString(&ClassName, lpClassName);
1811 }
1812 else
1813 {
1814 ClassName.Buffer = (PWSTR)((ULONG_PTR)lpClassName);
1815 }
1816
1817 return NtUserUnregisterClass(&ClassName, hInstance, 0);
1818}

◆ VersionRegisterClass()

BOOL FASTCALL VersionRegisterClass ( PCWSTR  pszClass,
LPCWSTR  lpLibFileName,
HANDLE  Contex,
HMODULE phLibModule 
)

Definition at line 195 of file class.c.

200{
201 BOOL Ret = FALSE;
203 PREGISTERCLASSNAMEW pRegisterClassNameW;
204 UNICODE_STRING ClassName;
205 WCHAR ClassNameBuf[MAX_PATH] = {0};
206 RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame = { sizeof(Frame), 1 };
207
208 ERR("VersionRegisterClass: Attempting to call RegisterClassNameW in %S.\n", lpLibFileName);
209
210 RtlActivateActivationContextUnsafeFast(&Frame, Contex);
211
213 {
214 hLibModule = LoadLibraryW(lpLibFileName);
215 if (hLibModule)
216 {
217 if ((pRegisterClassNameW = (void*)GetProcAddress(hLibModule, "RegisterClassNameW")))
218 {
219 if (IS_ATOM(pszClass))
220 {
221 RtlInitEmptyUnicodeString(&ClassName, ClassNameBuf, sizeof(ClassNameBuf));
222 if (!NtUserGetAtomName(LOWORD((DWORD_PTR)pszClass), &ClassName))
223 {
224 ERR("Error while verifying ATOM\n");
225 _SEH2_YIELD(goto Error_Exit);
226 }
227 pszClass = ClassName.Buffer;
228 }
229 Ret = pRegisterClassNameW(pszClass);
230 }
231 else
232 {
233 WARN("No RegisterClassNameW PROC\n");
234 }
235 }
236 }
238 {
239 ERR("Got exception while trying to call RegisterClassNameW!\n");
240 }
242
243Error_Exit:
244 if (Ret || !hLibModule)
245 {
246 if (phLibModule) *phLibModule = hLibModule;
247 }
248 else
249 {
250 DWORD dwLastError = GetLastError();
252 SetLastError(dwLastError);
253 }
254
255 RtlDeactivateActivationContextUnsafeFast(&Frame);
256 return Ret;
257}
#define GetProcAddress(x, y)
Definition: compat.h:753
#define LoadLibraryW(x)
Definition: compat.h:747
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:184

Referenced by GetClassInfoExA(), GetClassInfoExW(), and User32CreateWindowEx().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )