From a3b85a5a2ed615292f919638b52016aeff764ee4 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 11 Feb 2013 11:39:23 +0100 Subject: [PATCH] imm32: Retrieve the graphics driver module from gdi32. --- dlls/imm32/imm.c | 39 +++++++-------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 1ade13af8db..fbb683f50d4 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -32,6 +32,7 @@ #include "ddk/imm.h" #include "winnls.h" #include "winreg.h" +#include "wine/gdi_driver.h" #include "wine/list.h" WINE_DEFAULT_DEBUG_CHANNEL(imm); @@ -247,37 +248,6 @@ static void IMM_FreeThreadData(void) } } -static HMODULE LoadDefaultWineIME(void) -{ - char buffer[MAX_PATH], libname[32], *name, *next; - HMODULE module = 0; - HKEY hkey; - - TRACE("Attempting to fall back to wine default IME\n"); - - strcpy( buffer, "x11" ); /* default value */ - /* @@ Wine registry key: HKCU\Software\Wine\Drivers */ - if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey )) - { - DWORD type, count = sizeof(buffer); - RegQueryValueExA( hkey, "Ime", 0, &type, (LPBYTE) buffer, &count ); - RegCloseKey( hkey ); - } - - name = buffer; - while (name) - { - next = strchr( name, ',' ); - if (next) *next++ = 0; - - snprintf( libname, sizeof(libname), "wine%s.drv", name ); - if ((module = LoadLibraryA( libname )) != 0) break; - name = next; - } - - return module; -} - /* ImmHkl loading and freeing */ #define LOAD_FUNCPTR(f) if((ptr->p##f = (LPVOID)GetProcAddress(ptr->hIME, #f)) == NULL){WARN("Can't find function %s in ime\n", #f);} static ImmHkl *IMM_GetImmHkl(HKL hkl) @@ -299,7 +269,12 @@ static ImmHkl *IMM_GetImmHkl(HKL hkl) ptr->hkl = hkl; if (ImmGetIMEFileNameW(hkl, filename, MAX_PATH)) ptr->hIME = LoadLibraryW(filename); if (!ptr->hIME) - ptr->hIME = LoadDefaultWineIME(); + { + HDC hdc = GetDC( 0 ); + GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + (LPCWSTR)__wine_get_driver_module( hdc ), &ptr->hIME ); + ReleaseDC( 0, hdc ); + } if (ptr->hIME) { LOAD_FUNCPTR(ImeInquire);