user32: Move module class registration to get_class_info.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7dfdf5a5ca
commit
18697bb7b5
|
@ -332,7 +332,8 @@ static CLASS *find_class( HINSTANCE module, const WCHAR *name )
|
||||||
return NULL;
|
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;
|
ACTCTX_SECTION_KEYED_DATA data;
|
||||||
struct wndclass_redirect_data
|
struct wndclass_redirect_data
|
||||||
|
@ -349,6 +350,7 @@ static const WCHAR *CLASS_GetVersionedName( const WCHAR *name, UINT *basename_of
|
||||||
HMODULE hmod;
|
HMODULE hmod;
|
||||||
UINT offset;
|
UINT offset;
|
||||||
|
|
||||||
|
if (reg_module) *reg_module = 0;
|
||||||
if (!basename_offset)
|
if (!basename_offset)
|
||||||
basename_offset = &offset;
|
basename_offset = &offset;
|
||||||
|
|
||||||
|
@ -383,21 +385,7 @@ static const WCHAR *CLASS_GetVersionedName( const WCHAR *name, UINT *basename_of
|
||||||
ret = combined;
|
ret = combined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (register_class && hmod)
|
if (reg_module) *reg_module = 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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
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,
|
ATOM get_class_info( HINSTANCE instance, const WCHAR *name, WNDCLASSEXW *info,
|
||||||
UNICODE_STRING *name_str, BOOL ansi )
|
UNICODE_STRING *name_str, BOOL ansi )
|
||||||
{
|
{
|
||||||
|
const WCHAR *class_name;
|
||||||
|
HMODULE module;
|
||||||
CLASS *class;
|
CLASS *class;
|
||||||
ATOM atom;
|
ATOM atom;
|
||||||
|
|
||||||
|
class_name = CLASS_GetVersionedName( name, NULL, NULL, &module );
|
||||||
|
|
||||||
if (!name_str && !instance) instance = user32_module;
|
if (!name_str && !instance) instance = user32_module;
|
||||||
|
|
||||||
if (name != (LPCWSTR)DESKTOP_CLASS_ATOM && (IS_INTRESOURCE(name) || wcsicmp( name, L"Message" )))
|
if (name != (LPCWSTR)DESKTOP_CLASS_ATOM && (IS_INTRESOURCE(name) || wcsicmp( name, L"Message" )))
|
||||||
GetDesktopWindow(); /* create the desktop window to trigger builtin class registration */
|
GetDesktopWindow(); /* create the desktop window to trigger builtin class registration */
|
||||||
|
|
||||||
name = CLASS_GetVersionedName( name, NULL, NULL, TRUE );
|
while (class_name && !(class = find_class( instance, class_name )))
|
||||||
|
|
||||||
while (name && !(class = find_class( instance, name )))
|
|
||||||
{
|
{
|
||||||
if (IS_INTRESOURCE( name )) break;
|
if (module)
|
||||||
if (!is_comctl32_class( name )) break;
|
{
|
||||||
|
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 (GetModuleHandleW( L"comctl32.dll" )) break;
|
||||||
if (!LoadLibraryW( 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)
|
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 );
|
SetLastError( ERROR_CLASS_DOES_NOT_EXIST );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1279,7 +1281,7 @@ ATOM get_class_info( HINSTANCE instance, const WCHAR *name, WNDCLASSEXW *info,
|
||||||
info->lpszClassName = name;
|
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;
|
atom = class->atomName;
|
||||||
release_class_ptr( class );
|
release_class_ptr( class );
|
||||||
return atom;
|
return atom;
|
||||||
|
|
Loading…
Reference in New Issue