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

imm32: Use installed IME language for the created HKL.

parent 4571456e
MODULE = imm32.dll
IMPORTLIB = imm32
IMPORTS = user32 gdi32 advapi32 win32u
IMPORTS = user32 gdi32 advapi32 kernelbase win32u
DELAYIMPORTS = ole32
C_SRCS = \
......
......@@ -2012,13 +2012,31 @@ HKL WINAPI ImmInstallIMEA( const char *filenameA, const char *descriptionA )
return hkl;
}
static LCID get_ime_file_lang( const WCHAR *filename )
{
DWORD *languages;
LCID lcid = 0;
void *info;
UINT len;
if (!(len = GetFileVersionInfoSizeW( filename, NULL ))) return 0;
if (!(info = malloc( len ))) goto done;
if (!GetFileVersionInfoW( filename, 0, len, info )) goto done;
if (!VerQueryValueW( info, L"\\VarFileInfo\\Translation", (void **)&languages, &len ) || !len) goto done;
lcid = languages[0];
done:
free( info );
return lcid;
}
/***********************************************************************
* ImmInstallIMEW (IMM32.@)
*/
HKL WINAPI ImmInstallIMEW( const WCHAR *filename, const WCHAR *description )
{
WCHAR path[ARRAY_SIZE(layouts_formatW)+8], buffer[MAX_PATH];
LCID lcid = GetUserDefaultLCID();
LCID lcid;
WORD count = 0x20;
const WCHAR *tmp;
DWORD length;
......@@ -2027,7 +2045,7 @@ HKL WINAPI ImmInstallIMEW( const WCHAR *filename, const WCHAR *description )
TRACE( "filename %s, description %s\n", debugstr_w(filename), debugstr_w(description) );
if (!filename || !description)
if (!filename || !description || !(lcid = get_ime_file_lang( filename )))
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
......@@ -2037,8 +2055,8 @@ HKL WINAPI ImmInstallIMEW( const WCHAR *filename, const WCHAR *description )
{
DWORD disposition = 0;
hkl = (HKL)MAKELPARAM( lcid, 0xe000 | count );
swprintf( path, ARRAY_SIZE(path), layouts_formatW, (ULONG_PTR)hkl);
hkl = (HKL)(UINT_PTR)MAKELONG( lcid, 0xe000 | count );
swprintf( path, ARRAY_SIZE(path), layouts_formatW, (ULONG)(ULONG_PTR)hkl);
if (!RegCreateKeyExW( HKEY_LOCAL_MACHINE, path, 0, NULL, 0,
KEY_WRITE, NULL, &hkey, &disposition ))
{
......
......@@ -2930,7 +2930,6 @@ static HKL ime_install(void)
"MoveFileW failed, error %lu\n", GetLastError() );
hkl = ImmInstallIMEW( ime_path, L"WineTest IME" );
todo_wine
ok( hkl == (HKL)(int)0xe020047f, "ImmInstallIMEW returned %p, error %lu\n", hkl, GetLastError() );
swprintf( buffer, ARRAY_SIZE(buffer), L"System\\CurrentControlSet\\Control\\Keyboard Layouts\\%08x", hkl );
......
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