Aric Stewart aric@codeweavers.com writes:
- if (rc > 0)
 - {
 if (uBufLen && lpszFileName)rc = WideCharToMultiByte(CP_ACP, 0, bufW, uBufLen, lpszFileName,uBufLen, NULL, NULL);else /* get the length */rc = WideCharToMultiByte(CP_ACP, 0, bufW, wBufLen, NULL, 0, NULL,NULL);
The source length should be -1, you don't want to convert the whole buffer.
- static CHAR KeyboardKey[] = "System\CurrentControlSet\Control\Keyboard Layouts";
 - static WCHAR szImeFileW[] = {'I','m','e',' ','F','i','l','e',0};
 - HKEY keyboardKey;
 - DWORD length;
 - DWORD rc;
 - CHAR regKey[sizeof(KeyboardKey) + 11];
 - wsprintfA( regKey, "%s\%08x", KeyboardKey, (unsigned)hKL );
 - rc = RegOpenKeyA( HKEY_LOCAL_MACHINE, regKey, &keyboardKey);
 
This should use Unicode like the rest of the function.