Commit d61a7864 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

imm32: Get rid of the graphics driver loading mechanism.

parent f7d4eec4
...@@ -429,31 +429,6 @@ static struct imc *query_imc_data( HIMC handle ) ...@@ -429,31 +429,6 @@ static struct imc *query_imc_data( HIMC handle )
return ret && ret->handle == handle ? ret : NULL; return ret && ret->handle == handle ? ret : NULL;
} }
static HMODULE load_graphics_driver(void)
{
static const WCHAR key_pathW[] = L"System\\CurrentControlSet\\Control\\Video\\{";
static const WCHAR displayW[] = L"}\\0000";
HMODULE ret = 0;
HKEY hkey;
DWORD size;
WCHAR path[MAX_PATH];
WCHAR key[ARRAY_SIZE( key_pathW ) + ARRAY_SIZE( displayW ) + 40];
UINT guid_atom = HandleToULong( GetPropW( GetDesktopWindow(), L"__wine_display_device_guid" ));
if (!guid_atom) return 0;
memcpy( key, key_pathW, sizeof(key_pathW) );
if (!GlobalGetAtomNameW( guid_atom, key + lstrlenW(key), 40 )) return 0;
lstrcatW( key, displayW );
if (RegOpenKeyW( HKEY_LOCAL_MACHINE, key, &hkey )) return 0;
size = sizeof(path);
if (!RegQueryValueExW( hkey, L"GraphicsDriver", NULL, NULL, (BYTE *)path, &size ))
ret = LoadLibraryW( path );
RegCloseKey( hkey );
TRACE( "%s %p\n", debugstr_w(path), ret );
return ret;
}
/* lookup an IME from a HKL, must hold ime_cs */ /* lookup an IME from a HKL, must hold ime_cs */
static struct ime *find_ime_from_hkl( HKL hkl ) static struct ime *find_ime_from_hkl( HKL hkl )
{ {
...@@ -511,17 +486,33 @@ BOOL WINAPI ImmLoadIME( HKL hkl ) ...@@ -511,17 +486,33 @@ BOOL WINAPI ImmLoadIME( HKL hkl )
if (use_default_ime) if (use_default_ime)
{ {
if (*buffer) WARN( "Failed to load %s, falling back to default.\n", debugstr_w(buffer) ); if (*buffer) WARN( "Failed to load %s, falling back to default.\n", debugstr_w(buffer) );
if (!(ime->module = load_graphics_driver())) ime->module = LoadLibraryW( L"imm32" ); ime->module = LoadLibraryW( L"imm32" );
ime->pImeInquire = (void *)ImeInquire;
ime->pImeDestroy = ImeDestroy;
ime->pImeSelect = ImeSelect;
ime->pImeConfigure = ImeConfigure;
ime->pImeEscape = ImeEscape;
ime->pImeSetActiveContext = ImeSetActiveContext;
ime->pImeToAsciiEx = (void *)ImeToAsciiEx;
ime->pNotifyIME = NotifyIME;
ime->pImeRegisterWord = (void *)ImeRegisterWord;
ime->pImeUnregisterWord = (void *)ImeUnregisterWord;
ime->pImeEnumRegisterWord = (void *)ImeEnumRegisterWord;
ime->pImeSetCompositionString = ImeSetCompositionString;
ime->pImeConversionList = (void *)ImeConversionList;
ime->pImeProcessKey = (void *)ImeProcessKey;
ime->pImeGetRegisterWordStyle = (void *)ImeGetRegisterWordStyle;
ime->pImeGetImeMenuItems = (void *)ImeGetImeMenuItems;
} }
else
{
#define LOAD_FUNCPTR( f ) \ #define LOAD_FUNCPTR( f ) \
if (!(ime->p##f = (void *)GetProcAddress( ime->module, #f )) && \ if (!(ime->p##f = (void *)GetProcAddress( ime->module, #f ))) \
!(ime->p##f = use_default_ime ? (void *)f : NULL)) \
{ \ { \
LeaveCriticalSection( &ime_cs ); \
WARN( "Can't find function %s in HKL %p IME\n", #f, hkl ); \ WARN( "Can't find function %s in HKL %p IME\n", #f, hkl ); \
goto failed; \ goto failed; \
} }
LOAD_FUNCPTR( ImeInquire ); LOAD_FUNCPTR( ImeInquire );
LOAD_FUNCPTR( ImeDestroy ); LOAD_FUNCPTR( ImeDestroy );
LOAD_FUNCPTR( ImeSelect ); LOAD_FUNCPTR( ImeSelect );
...@@ -539,13 +530,10 @@ BOOL WINAPI ImmLoadIME( HKL hkl ) ...@@ -539,13 +530,10 @@ BOOL WINAPI ImmLoadIME( HKL hkl )
LOAD_FUNCPTR( ImeGetRegisterWordStyle ); LOAD_FUNCPTR( ImeGetRegisterWordStyle );
LOAD_FUNCPTR( ImeGetImeMenuItems ); LOAD_FUNCPTR( ImeGetImeMenuItems );
#undef LOAD_FUNCPTR #undef LOAD_FUNCPTR
}
ime->hkl = hkl; ime->hkl = hkl;
if (!ime->pImeInquire( &ime->info, buffer, 0 )) if (!ime->pImeInquire( &ime->info, buffer, 0 )) goto failed;
{
LeaveCriticalSection( &ime_cs );
goto failed;
}
if (ime_is_unicode( ime )) lstrcpynW( ime->ui_class, buffer, ARRAY_SIZE(ime->ui_class) ); if (ime_is_unicode( ime )) lstrcpynW( ime->ui_class, buffer, ARRAY_SIZE(ime->ui_class) );
else MultiByteToWideChar( CP_ACP, 0, (char *)buffer, -1, ime->ui_class, ARRAY_SIZE(ime->ui_class) ); else MultiByteToWideChar( CP_ACP, 0, (char *)buffer, -1, ime->ui_class, ARRAY_SIZE(ime->ui_class) );
...@@ -558,6 +546,8 @@ BOOL WINAPI ImmLoadIME( HKL hkl ) ...@@ -558,6 +546,8 @@ BOOL WINAPI ImmLoadIME( HKL hkl )
return TRUE; return TRUE;
failed: failed:
LeaveCriticalSection( &ime_cs );
if (ime->module) FreeLibrary( ime->module ); if (ime->module) FreeLibrary( ime->module );
free( ime ); free( ime );
return FALSE; return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment