Commit 5035a855 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

imm: Implement ImmGetIMEFileNameW and ImmGetIMEFileNameA.

parent a71998d0
...@@ -4,7 +4,7 @@ SRCDIR = @srcdir@ ...@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = imm32.dll MODULE = imm32.dll
IMPORTLIB = imm32 IMPORTLIB = imm32
IMPORTS = user32 gdi32 kernel32 IMPORTS = user32 gdi32 advapi32 kernel32
C_SRCS = \ C_SRCS = \
imm.c imm.c
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "imm.h" #include "imm.h"
#include "ddk/imm.h" #include "ddk/imm.h"
#include "winnls.h" #include "winnls.h"
#include "winreg.h"
WINE_DEFAULT_DEBUG_CHANNEL(imm); WINE_DEFAULT_DEBUG_CHANNEL(imm);
...@@ -1178,23 +1179,83 @@ DWORD WINAPI ImmGetGuideLineW(HIMC hIMC, DWORD dwIndex, LPWSTR lpBuf, DWORD dwBu ...@@ -1178,23 +1179,83 @@ DWORD WINAPI ImmGetGuideLineW(HIMC hIMC, DWORD dwIndex, LPWSTR lpBuf, DWORD dwBu
/*********************************************************************** /***********************************************************************
* ImmGetIMEFileNameA (IMM32.@) * ImmGetIMEFileNameA (IMM32.@)
*/ */
UINT WINAPI ImmGetIMEFileNameA( UINT WINAPI ImmGetIMEFileNameA( HKL hKL, LPSTR lpszFileName, UINT uBufLen)
HKL hKL, LPSTR lpszFileName, UINT uBufLen)
{ {
FIXME("(%p, %p, %d): stub\n", hKL, lpszFileName, uBufLen); LPWSTR bufW = NULL;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); UINT wBufLen = uBufLen;
return 0; UINT rc;
if (uBufLen && lpszFileName)
bufW = HeapAlloc(GetProcessHeap(),0,uBufLen * sizeof(WCHAR));
else /* We need this to get the number of byte required */
{
bufW = HeapAlloc(GetProcessHeap(),0,MAX_PATH * sizeof(WCHAR));
wBufLen = MAX_PATH;
}
rc = ImmGetIMEFileNameW(hKL,bufW,wBufLen);
if (rc > 0)
{
if (uBufLen && lpszFileName)
rc = WideCharToMultiByte(CP_ACP, 0, bufW, -1, lpszFileName,
uBufLen, NULL, NULL);
else /* get the length */
rc = WideCharToMultiByte(CP_ACP, 0, bufW, -1, NULL, 0, NULL,
NULL);
}
HeapFree(GetProcessHeap(),0,bufW);
return rc;
} }
/*********************************************************************** /***********************************************************************
* ImmGetIMEFileNameW (IMM32.@) * ImmGetIMEFileNameW (IMM32.@)
*/ */
UINT WINAPI ImmGetIMEFileNameW( UINT WINAPI ImmGetIMEFileNameW(HKL hKL, LPWSTR lpszFileName, UINT uBufLen)
HKL hKL, LPWSTR lpszFileName, UINT uBufLen)
{ {
FIXME("(%p, %p, %d): stub\n", hKL, lpszFileName, uBufLen); static const WCHAR szImeFileW[] = {'I','m','e',' ','F','i','l','e',0};
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); static const WCHAR fmt[] = {'S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\','C','o','n','t','r','o','l','\\','K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','s','\\','%','0','8','x',0};
HKEY hkey;
DWORD length;
DWORD rc;
WCHAR regKey[sizeof(fmt)/sizeof(WCHAR)+8];
wsprintfW( regKey, fmt, (unsigned)hKL );
rc = RegOpenKeyW( HKEY_LOCAL_MACHINE, regKey, &hkey);
if (rc != ERROR_SUCCESS)
{
SetLastError(rc);
return 0; return 0;
}
length = 0;
rc = RegGetValueW(hkey, NULL, szImeFileW, RRF_RT_REG_SZ, NULL, NULL, &length);
if (rc != ERROR_SUCCESS)
{
RegCloseKey(hkey);
SetLastError(rc);
return 0;
}
if (length > uBufLen * sizeof(WCHAR) || !lpszFileName)
{
RegCloseKey(hkey);
if (lpszFileName)
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return 0;
}
else
return length / sizeof(WCHAR);
}
RegGetValueW(hkey, NULL, szImeFileW, RRF_RT_REG_SZ, NULL, lpszFileName, &length);
RegCloseKey(hkey);
return length / sizeof(WCHAR);
} }
/*********************************************************************** /***********************************************************************
......
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