Jacek Caban : user32: Move module class registration to get_class_info.
Alexandre Julliard
julliard at winehq.org
Mon Mar 7 16:04:56 CST 2022
Module: wine
Branch: master
Commit: 18697bb7b598ccff23def7822a2b96f52e7ccb00
URL: https://source.winehq.org/git/wine.git/?a=commit;h=18697bb7b598ccff23def7822a2b96f52e7ccb00
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Mar 7 14:41:42 2022 +0100
user32: Move module class registration to get_class_info.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/class.c | 50 ++++++++++++++++++++++++++------------------------
1 file changed, 26 insertions(+), 24 deletions(-)
diff --git a/dlls/user32/class.c b/dlls/user32/class.c
index 1855a2c3804..cf5fd27184b 100644
--- a/dlls/user32/class.c
+++ b/dlls/user32/class.c
@@ -332,7 +332,8 @@ static CLASS *find_class( HINSTANCE module, const WCHAR *name )
return NULL;
}
-static const WCHAR *CLASS_GetVersionedName( const WCHAR *name, UINT *basename_offset, WCHAR *combined, BOOL register_class )
+static const WCHAR *CLASS_GetVersionedName( const WCHAR *name, UINT *basename_offset, WCHAR *combined,
+ HMODULE *reg_module )
{
ACTCTX_SECTION_KEYED_DATA data;
struct wndclass_redirect_data
@@ -349,6 +350,7 @@ static const WCHAR *CLASS_GetVersionedName( const WCHAR *name, UINT *basename_of
HMODULE hmod;
UINT offset;
+ if (reg_module) *reg_module = 0;
if (!basename_offset)
basename_offset = &offset;
@@ -383,21 +385,7 @@ static const WCHAR *CLASS_GetVersionedName( const WCHAR *name, UINT *basename_of
ret = combined;
}
- if (register_class && hmod)
- {
- CLASS *class;
-
- if (!(class = find_class( hmod, ret )))
- {
- BOOL (WINAPI *pRegisterClassNameW)(const WCHAR *class);
-
- pRegisterClassNameW = (void *)GetProcAddress(hmod, "RegisterClassNameW");
- if (pRegisterClassNameW)
- pRegisterClassNameW(name);
- }
- else release_class_ptr( class );
- }
-
+ if (reg_module) *reg_module = hmod;
return ret;
}
@@ -1237,28 +1225,42 @@ BOOL WINAPI GetClassInfoW( HINSTANCE hInstance, LPCWSTR name, WNDCLASSW *wc )
ATOM get_class_info( HINSTANCE instance, const WCHAR *name, WNDCLASSEXW *info,
UNICODE_STRING *name_str, BOOL ansi )
{
+ const WCHAR *class_name;
+ HMODULE module;
CLASS *class;
ATOM atom;
+ class_name = CLASS_GetVersionedName( name, NULL, NULL, &module );
+
if (!name_str && !instance) instance = user32_module;
if (name != (LPCWSTR)DESKTOP_CLASS_ATOM && (IS_INTRESOURCE(name) || wcsicmp( name, L"Message" )))
GetDesktopWindow(); /* create the desktop window to trigger builtin class registration */
- name = CLASS_GetVersionedName( name, NULL, NULL, TRUE );
-
- while (name && !(class = find_class( instance, name )))
+ while (class_name && !(class = find_class( instance, class_name )))
{
- if (IS_INTRESOURCE( name )) break;
- if (!is_comctl32_class( name )) break;
+ if (module)
+ {
+ BOOL (WINAPI *pRegisterClassNameW)( const WCHAR *class );
+ pRegisterClassNameW = (void *)GetProcAddress( module, "RegisterClassNameW" );
+ module = NULL;
+ if (pRegisterClassNameW)
+ {
+ TRACE( "registering %s\n", debugstr_w(name) );
+ pRegisterClassNameW( name );
+ continue;
+ }
+ }
+ if (IS_INTRESOURCE( class_name )) break;
+ if (!is_comctl32_class( class_name )) break;
if (GetModuleHandleW( L"comctl32.dll" )) break;
if (!LoadLibraryW( L"comctl32.dll" )) break;
- TRACE( "%s retrying after loading comctl32\n", debugstr_w(name) );
+ TRACE( "%s retrying after loading comctl32\n", debugstr_w(class_name) );
}
if (!class)
{
- TRACE("%s %p -> not found\n", debugstr_w(name), instance);
+ TRACE("%s %p -> not found\n", debugstr_w(class_name), instance);
SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
return 0;
}
@@ -1279,7 +1281,7 @@ ATOM get_class_info( HINSTANCE instance, const WCHAR *name, WNDCLASSEXW *info,
info->lpszClassName = name;
}
- if (name_str) init_class_name( name_str, name );
+ if (name_str) init_class_name( name_str, class_name );
atom = class->atomName;
release_class_ptr( class );
return atom;
More information about the wine-cvs
mailing list