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

imm32: Transform "Ime File" value in ImmInstallIMEW.

parent 4eba0765
...@@ -2048,34 +2048,30 @@ HKL WINAPI ImmInstallIMEA( ...@@ -2048,34 +2048,30 @@ HKL WINAPI ImmInstallIMEA(
/*********************************************************************** /***********************************************************************
* ImmInstallIMEW (IMM32.@) * ImmInstallIMEW (IMM32.@)
*/ */
HKL WINAPI ImmInstallIMEW( HKL WINAPI ImmInstallIMEW( const WCHAR *filename, const WCHAR *description )
LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText)
{ {
INT lcid = GetUserDefaultLCID(); WCHAR path[ARRAY_SIZE(layouts_formatW)+8], buffer[MAX_PATH];
INT count; LCID lcid = GetUserDefaultLCID();
HKL hkl; WORD count = 0x20;
DWORD rc; const WCHAR *tmp;
DWORD length;
HKEY hkey; HKEY hkey;
WCHAR regKey[ARRAY_SIZE(layouts_formatW)+8]; HKL hkl;
TRACE ("(%s, %s):\n", debugstr_w(lpszIMEFileName),
debugstr_w(lpszLayoutText));
/* Start with 2. e001 will be blank and so default to the wine internal IME */ TRACE( "filename %s, description %s\n", debugstr_w(filename), debugstr_w(description) );
count = 2;
while (count < 0xfff) while (count < 0xfff)
{ {
DWORD disposition = 0; DWORD disposition = 0;
hkl = (HKL)MAKELPARAM( lcid, 0xe000 | count ); hkl = (HKL)MAKELPARAM( lcid, 0xe000 | count );
wsprintfW( regKey, layouts_formatW, (ULONG_PTR)hkl); swprintf( path, ARRAY_SIZE(path), layouts_formatW, (ULONG_PTR)hkl);
if (!RegCreateKeyExW( HKEY_LOCAL_MACHINE, path, 0, NULL, 0,
rc = RegCreateKeyExW(HKEY_LOCAL_MACHINE, regKey, 0, NULL, 0, KEY_WRITE, NULL, &hkey, &disposition); KEY_WRITE, NULL, &hkey, &disposition ))
if (rc == ERROR_SUCCESS && disposition == REG_CREATED_NEW_KEY) {
break; if (disposition == REG_CREATED_NEW_KEY) break;
else if (rc == ERROR_SUCCESS) RegCloseKey( hkey );
RegCloseKey(hkey); }
count++; count++;
} }
...@@ -2086,21 +2082,22 @@ HKL WINAPI ImmInstallIMEW( ...@@ -2086,21 +2082,22 @@ HKL WINAPI ImmInstallIMEW(
return 0; return 0;
} }
if (rc == ERROR_SUCCESS) if ((tmp = wcsrchr( filename, '\\' ))) tmp++;
{ else tmp = filename;
rc = RegSetValueExW(hkey, L"Ime File", 0, REG_SZ, (const BYTE*)lpszIMEFileName,
(lstrlenW(lpszIMEFileName) + 1) * sizeof(WCHAR)); length = LCMapStringW( LOCALE_USER_DEFAULT, LCMAP_UPPERCASE, tmp, -1, buffer, ARRAY_SIZE(buffer) );
if (rc == ERROR_SUCCESS)
rc = RegSetValueExW(hkey, L"Layout Text", 0, REG_SZ, (const BYTE*)lpszLayoutText, if (RegSetValueExW( hkey, L"Ime File", 0, REG_SZ, (const BYTE *)buffer, length * sizeof(WCHAR) ) ||
(lstrlenW(lpszLayoutText) + 1) * sizeof(WCHAR)); RegSetValueExW( hkey, L"Layout Text", 0, REG_SZ, (const BYTE *)description,
RegCloseKey(hkey); (wcslen(description) + 1) * sizeof(WCHAR) ))
return hkl;
}
else
{ {
WARN("Unable to set IME registry values\n"); WARN( "Unable to write registry to install IME\n");
return 0; hkl = 0;
} }
RegCloseKey( hkey );
if (!hkl) RegDeleteKeyW( HKEY_LOCAL_MACHINE, path );
return hkl;
} }
/*********************************************************************** /***********************************************************************
......
...@@ -2693,7 +2693,6 @@ static HKL ime_install(void) ...@@ -2693,7 +2693,6 @@ static HKL ime_install(void)
memset( buffer, 0xcd, sizeof(buffer) ); memset( buffer, 0xcd, sizeof(buffer) );
ret = RegQueryValueExW( hkey, L"Ime File", NULL, NULL, (BYTE *)buffer, &len ); ret = RegQueryValueExW( hkey, L"Ime File", NULL, NULL, (BYTE *)buffer, &len );
ok( !ret, "RegQueryValueExW returned %#lx, error %lu\n", ret, GetLastError() ); ok( !ret, "RegQueryValueExW returned %#lx, error %lu\n", ret, GetLastError() );
todo_wine
ok( !wcsicmp( buffer, wcsrchr( ime_path, '\\' ) + 1 ), "got Ime File %s\n", debugstr_w(buffer) ); ok( !wcsicmp( buffer, wcsrchr( ime_path, '\\' ) + 1 ), "got Ime File %s\n", debugstr_w(buffer) );
len = sizeof(buffer); len = sizeof(buffer);
...@@ -2996,13 +2995,11 @@ static void test_ImmGetIMEFileName(void) ...@@ -2996,13 +2995,11 @@ static void test_ImmGetIMEFileName(void)
ret = ImmGetIMEFileNameW( hkl, bufferW, 13 ); ret = ImmGetIMEFileNameW( hkl, bufferW, 13 );
todo_wine todo_wine
ok( ret == 12, "ImmGetIMEFileNameW returned %lu\n", ret ); ok( ret == 12, "ImmGetIMEFileNameW returned %lu\n", ret );
todo_wine
ok( !wcscmp( bufferW, expectW ), "got bufferW %s\n", debugstr_w(bufferW) ); ok( !wcscmp( bufferW, expectW ), "got bufferW %s\n", debugstr_w(bufferW) );
memset( bufferA, 0xcd, sizeof(bufferA) ); memset( bufferA, 0xcd, sizeof(bufferA) );
ret = ImmGetIMEFileNameA( hkl, bufferA, 13 ); ret = ImmGetIMEFileNameA( hkl, bufferA, 13 );
todo_wine todo_wine
ok( ret == 12, "ImmGetIMEFileNameA returned %lu\n", ret ); ok( ret == 12, "ImmGetIMEFileNameA returned %lu\n", ret );
todo_wine
ok( !strcmp( bufferA, expectA ), "got bufferA %s\n", debugstr_a(bufferA) ); ok( !strcmp( bufferA, expectA ), "got bufferA %s\n", debugstr_a(bufferA) );
ime_cleanup( hkl ); ime_cleanup( 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