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