From: Rémi Bernon rbernon@codeweavers.com
--- dlls/imm32/imm.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index ea5dd127a9e..c05a4845f5d 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -2138,31 +2138,26 @@ BOOL WINAPI ImmNotifyIME( /*********************************************************************** * ImmRegisterWordA (IMM32.@) */ -BOOL WINAPI ImmRegisterWordA( - HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszRegister) +BOOL WINAPI ImmRegisterWordA( HKL hkl, const char *readingA, DWORD style, const char *stringA ) { - struct ime *immHkl = IMM_GetImmHkl( hKL ); - TRACE("(%p, %s, %ld, %s):\n", hKL, debugstr_a(lpszReading), dwStyle, - debugstr_a(lpszRegister)); - if (immHkl->hIME && immHkl->pImeRegisterWord) - { - if (!is_kbd_ime_unicode(immHkl)) - return immHkl->pImeRegisterWord((LPCWSTR)lpszReading,dwStyle, - (LPCWSTR)lpszRegister); - else - { - LPWSTR lpszwReading = strdupAtoW(lpszReading); - LPWSTR lpszwRegister = strdupAtoW(lpszRegister); - BOOL rc; + struct ime *ime = IMM_GetImmHkl( hkl ); + BOOL ret;
- rc = immHkl->pImeRegisterWord(lpszwReading,dwStyle,lpszwRegister); - HeapFree(GetProcessHeap(),0,lpszwReading); - HeapFree(GetProcessHeap(),0,lpszwRegister); - return rc; - } - } + TRACE( "hkl %p, readingA %s, style %lu, stringA %s.\n", hkl, debugstr_a(readingA), style, debugstr_a(stringA) ); + + if (!ime->hIME || !ime->pImeRegisterWord) return FALSE; + + if (!is_kbd_ime_unicode( ime )) + ret = ime->pImeRegisterWord( (const WCHAR *)readingA, style, (const WCHAR *)stringA ); else - return FALSE; + { + WCHAR *readingW = strdupAtoW( readingA ), *stringW = strdupAtoW( stringA ); + ret = ime->pImeRegisterWord( readingW, style, stringW ); + HeapFree( GetProcessHeap(), 0, readingW ); + HeapFree( GetProcessHeap(), 0, stringW ); + } + + return ret; }
/***********************************************************************