https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6585803681900b91e0f38…
commit 6585803681900b91e0f384e896da2ddd34fd9a8e
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Fri Oct 21 16:04:59 2022 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Fri Oct 21 16:04:59 2022 +0900
[IMM32] Add uCodePage parameter to Imm32WideFromAnsi/Imm32AnsiFromWide
This needs for multiple codepage support.
CORE-11700
---
dll/win32/imm32/candidate.c | 23 +++++++++++++++--------
dll/win32/imm32/compstr.c | 3 +++
dll/win32/imm32/guideline.c | 20 ++++++++++++--------
dll/win32/imm32/ime.c | 24 ++++++++++++------------
dll/win32/imm32/precomp.h | 4 ++--
dll/win32/imm32/regword.c | 40 ++++++++++++++++++++++------------------
dll/win32/imm32/utils.c | 8 ++++----
7 files changed, 70 insertions(+), 52 deletions(-)
diff --git a/dll/win32/imm32/candidate.c b/dll/win32/imm32/candidate.c
index a54d0e8305b..f816500d75d 100644
--- a/dll/win32/imm32/candidate.c
+++ b/dll/win32/imm32/candidate.c
@@ -153,17 +153,18 @@ static DWORD APIENTRY
ImmGetCandidateListAW(HIMC hIMC, DWORD dwIndex, LPCANDIDATELIST lpCandList, DWORD
dwBufLen,
BOOL bAnsi)
{
- DWORD ret = 0;
+ DWORD dwSize, ret = 0;
+ UINT uCodePage;
LPINPUTCONTEXT pIC;
PCLIENTIMC pClientImc;
LPCANDIDATEINFO pCI;
LPCANDIDATELIST pCL;
- DWORD dwSize;
pClientImc = ImmLockClientImc(hIMC);
if (!pClientImc)
return 0;
+ uCodePage = pClientImc->uCodePage;
pIC = ImmLockIMC(hIMC);
if (pIC == NULL)
{
@@ -187,7 +188,7 @@ ImmGetCandidateListAW(HIMC hIMC, DWORD dwIndex, LPCANDIDATELIST
lpCandList, DWOR
if (bAnsi)
{
if (pClientImc->dwFlags & CLIENTIMC_WIDE)
- dwSize = CandidateListAnsiToWide(pCL, NULL, 0, CP_ACP);
+ dwSize = CandidateListAnsiToWide(pCL, NULL, 0, uCodePage);
else
dwSize = pCL->dwSize;
}
@@ -196,7 +197,7 @@ ImmGetCandidateListAW(HIMC hIMC, DWORD dwIndex, LPCANDIDATELIST
lpCandList, DWOR
if (pClientImc->dwFlags & CLIENTIMC_WIDE)
dwSize = pCL->dwSize;
else
- dwSize = CandidateListWideToAnsi(pCL, NULL, 0, CP_ACP);
+ dwSize = CandidateListWideToAnsi(pCL, NULL, 0, uCodePage);
}
if (dwBufLen != 0 && dwSize != 0)
@@ -208,7 +209,7 @@ ImmGetCandidateListAW(HIMC hIMC, DWORD dwIndex, LPCANDIDATELIST
lpCandList, DWOR
if (bAnsi)
{
if (pClientImc->dwFlags & CLIENTIMC_WIDE)
- CandidateListAnsiToWide(pCL, lpCandList, dwSize, CP_ACP);
+ CandidateListAnsiToWide(pCL, lpCandList, dwSize, uCodePage);
else
RtlCopyMemory(lpCandList, pCL, dwSize);
}
@@ -217,7 +218,7 @@ ImmGetCandidateListAW(HIMC hIMC, DWORD dwIndex, LPCANDIDATELIST
lpCandList, DWOR
if (pClientImc->dwFlags & CLIENTIMC_WIDE)
RtlCopyMemory(lpCandList, pCL, dwSize);
else
- CandidateListWideToAnsi(pCL, lpCandList, dwSize, CP_ACP);
+ CandidateListWideToAnsi(pCL, lpCandList, dwSize, uCodePage);
}
}
@@ -227,6 +228,7 @@ Quit:
ImmUnlockIMCC(pIC->hCandInfo);
ImmUnlockIMC(hIMC);
ImmUnlockClientImc(pClientImc);
+ TRACE("ret: 0x%X\n", ret);
return ret;
}
@@ -237,6 +239,7 @@ ImmGetCandidateListCountAW(HIMC hIMC, LPDWORD lpdwListCount, BOOL
bAnsi)
DWORD ret = 0, cbGot, dwIndex;
PCLIENTIMC pClientImc;
LPINPUTCONTEXT pIC;
+ UINT uCodePage;
const CANDIDATEINFO *pCI;
const BYTE *pb;
const CANDIDATELIST *pCL;
@@ -258,6 +261,8 @@ ImmGetCandidateListCountAW(HIMC hIMC, LPDWORD lpdwListCount, BOOL
bAnsi)
return 0;
}
+ uCodePage = pClientImc->uCodePage;
+
pCI = ImmLockIMCC(pIC->hCandInfo);
if (pCI == NULL)
{
@@ -282,7 +287,7 @@ ImmGetCandidateListCountAW(HIMC hIMC, LPDWORD lpdwListCount, BOOL
bAnsi)
{
pb = (const BYTE *)pCI + pdwOffsets[dwIndex];
pCL = (const CANDIDATELIST *)pb;
- cbGot = CandidateListWideToAnsi(pCL, NULL, 0, CP_ACP);
+ cbGot = CandidateListWideToAnsi(pCL, NULL, 0, uCodePage);
ret += cbGot;
}
}
@@ -305,7 +310,7 @@ ImmGetCandidateListCountAW(HIMC hIMC, LPDWORD lpdwListCount, BOOL
bAnsi)
{
pb = (const BYTE *)pCI + pdwOffsets[dwIndex];
pCL = (const CANDIDATELIST *)pb;
- cbGot = CandidateListAnsiToWide(pCL, NULL, 0, CP_ACP);
+ cbGot = CandidateListAnsiToWide(pCL, NULL, 0, uCodePage);
ret += cbGot;
}
}
@@ -315,6 +320,7 @@ Quit:
ImmUnlockIMCC(pIC->hCandInfo);
ImmUnlockIMC(hIMC);
ImmUnlockClientImc(pClientImc);
+ TRACE("ret: 0x%X\n", ret);
return ret;
}
@@ -379,6 +385,7 @@ ImmGetCandidateWindow(HIMC hIMC, DWORD dwIndex, LPCANDIDATEFORM
lpCandidate)
}
ImmUnlockIMC(hIMC);
+ TRACE("ret: %d\n", ret);
return ret;
}
diff --git a/dll/win32/imm32/compstr.c b/dll/win32/imm32/compstr.c
index e6354450901..2230a0858bc 100644
--- a/dll/win32/imm32/compstr.c
+++ b/dll/win32/imm32/compstr.c
@@ -841,6 +841,7 @@ Quit:
ImmLocalFree(pCompNew);
ImmLocalFree(pReadNew);
ImmUnlockImeDpi(pImeDpi);
+ TRACE("ret: %d\n", ret);
return ret;
}
@@ -883,6 +884,7 @@ LONG WINAPI ImmGetCompositionStringA(HIMC hIMC, DWORD dwIndex, LPVOID
lpBuf, DWO
ret = Imm32GetCompStrA(hIMC, pCS, dwIndex, lpBuf, dwBufLen, bAnsiClient, uCodePage);
ImmUnlockIMCC(pIC->hCompStr);
ImmUnlockIMC(hIMC);
+ TRACE("ret: %ld\n", ret);
return ret;
}
@@ -925,6 +927,7 @@ LONG WINAPI ImmGetCompositionStringW(HIMC hIMC, DWORD dwIndex, LPVOID
lpBuf, DWO
ret = Imm32GetCompStrW(hIMC, pCS, dwIndex, lpBuf, dwBufLen, bAnsiClient, uCodePage);
ImmUnlockIMCC(pIC->hCompStr);
ImmUnlockIMC(hIMC);
+ TRACE("ret: %ld\n", ret);
return ret;
}
diff --git a/dll/win32/imm32/guideline.c b/dll/win32/imm32/guideline.c
index 5ee9986bf25..ea0658e0505 100644
--- a/dll/win32/imm32/guideline.c
+++ b/dll/win32/imm32/guideline.c
@@ -19,11 +19,14 @@ ImmGetGuideLineAW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD
dwBufLen, BOOL b
DWORD cb, ret = 0;
LPVOID pvStr, pvPrivate;
BOOL bUsedDefault;
+ UINT uCodePage;
pClientImc = ImmLockClientImc(hIMC);
if (!pClientImc)
return 0;
+ uCodePage = pClientImc->uCodePage;
+
pIC = ImmLockIMC(hIMC);
if (!pIC)
{
@@ -60,7 +63,7 @@ ImmGetGuideLineAW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD
dwBufLen, BOOL b
{
if (pClientImc->dwFlags & CLIENTIMC_WIDE)
{
- cb = WideCharToMultiByte(CP_ACP, 0, pvStr, pGuideLine->dwStrLen,
+ cb = WideCharToMultiByte(uCodePage, 0, pvStr, pGuideLine->dwStrLen,
NULL, 0, NULL, &bUsedDefault);
}
else
@@ -76,7 +79,7 @@ ImmGetGuideLineAW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD
dwBufLen, BOOL b
}
else
{
- cb = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pvStr,
pGuideLine->dwStrLen,
+ cb = MultiByteToWideChar(uCodePage, MB_PRECOMPOSED, pvStr,
pGuideLine->dwStrLen,
NULL, 0) * sizeof(WCHAR);
}
}
@@ -92,7 +95,7 @@ ImmGetGuideLineAW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD
dwBufLen, BOOL b
{
if (pClientImc->dwFlags & CLIENTIMC_WIDE)
{
- ret = WideCharToMultiByte(CP_ACP, 0, pvStr, pGuideLine->dwStrLen,
+ ret = WideCharToMultiByte(uCodePage, 0, pvStr, pGuideLine->dwStrLen,
lpBuf, dwBufLen, NULL, &bUsedDefault);
goto Quit;
}
@@ -101,7 +104,7 @@ ImmGetGuideLineAW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD
dwBufLen, BOOL b
{
if (!(pClientImc->dwFlags & CLIENTIMC_WIDE))
{
- ret = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pvStr,
pGuideLine->dwStrLen,
+ ret = MultiByteToWideChar(uCodePage, MB_PRECOMPOSED, pvStr,
pGuideLine->dwStrLen,
lpBuf, dwBufLen) * sizeof(WCHAR);
goto Quit;
}
@@ -122,7 +125,7 @@ ImmGetGuideLineAW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD
dwBufLen, BOOL b
if ((pClientImc->dwFlags & CLIENTIMC_WIDE) &&
pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
{
- cb = CandidateListWideToAnsi(pvPrivate, NULL, 0, CP_ACP);
+ cb = CandidateListWideToAnsi(pvPrivate, NULL, 0, uCodePage);
}
else
{
@@ -134,7 +137,7 @@ ImmGetGuideLineAW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD
dwBufLen, BOOL b
if (!(pClientImc->dwFlags & CLIENTIMC_WIDE) &&
pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
{
- cb = CandidateListAnsiToWide(pvPrivate, NULL, 0, CP_ACP);
+ cb = CandidateListAnsiToWide(pvPrivate, NULL, 0, uCodePage);
}
else
{
@@ -154,7 +157,7 @@ ImmGetGuideLineAW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD
dwBufLen, BOOL b
if ((pClientImc->dwFlags & CLIENTIMC_WIDE) &&
pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
{
- ret = CandidateListWideToAnsi(pvPrivate, lpBuf, cb, CP_ACP);
+ ret = CandidateListWideToAnsi(pvPrivate, lpBuf, cb, uCodePage);
goto Quit;
}
}
@@ -163,7 +166,7 @@ ImmGetGuideLineAW(HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD
dwBufLen, BOOL b
if (!(pClientImc->dwFlags & CLIENTIMC_WIDE) &&
pGuideLine->dwIndex == GL_ID_REVERSECONVERSION)
{
- ret = CandidateListAnsiToWide(pvPrivate, lpBuf, cb, CP_ACP);
+ ret = CandidateListAnsiToWide(pvPrivate, lpBuf, cb, uCodePage);
goto Quit;
}
}
@@ -177,6 +180,7 @@ Quit:
ImmUnlockIMCC(pIC->hGuideLine);
ImmUnlockIMC(hIMC);
ImmUnlockClientImc(pClientImc);
+ TRACE("ret: 0x%X\n", ret);
return ret;
}
diff --git a/dll/win32/imm32/ime.c b/dll/win32/imm32/ime.c
index 0fc3494d9d0..48bfd1dc914 100644
--- a/dll/win32/imm32/ime.c
+++ b/dll/win32/imm32/ime.c
@@ -655,13 +655,13 @@ ImmGetImeMenuItemsAW(HIMC hIMC, DWORD dwFlags, DWORD dwType, LPVOID
lpImeParentM
if (bTargetIsAnsi)
{
if (pNewParent)
- Imm32ImeMenuWideToAnsi(pNewParent, lpImeParentMenu, CP_ACP);
+ Imm32ImeMenuWideToAnsi(pNewParent, lpImeParentMenu,
pImeDpi->uCodePage);
pItemW = pNewItems;
pItemA = lpImeMenu;
for (iItem = 0; iItem < ret; ++iItem, ++pItemW, ++pItemA)
{
- if (!Imm32ImeMenuWideToAnsi(pItemW, pItemA, CP_ACP))
+ if (!Imm32ImeMenuWideToAnsi(pItemW, pItemA, pImeDpi->uCodePage))
{
ret = 0;
break;
@@ -704,11 +704,11 @@ HKL WINAPI ImmInstallIMEA(LPCSTR lpszIMEFileName, LPCSTR
lpszLayoutText)
TRACE("(%s, %s)\n", debugstr_a(lpszIMEFileName),
debugstr_a(lpszLayoutText));
- pszFileNameW = Imm32WideFromAnsi(lpszIMEFileName);
+ pszFileNameW = Imm32WideFromAnsi(CP_ACP, lpszIMEFileName);
if (!pszFileNameW)
goto Quit;
- pszLayoutTextW = Imm32WideFromAnsi(lpszLayoutText);
+ pszLayoutTextW = Imm32WideFromAnsi(CP_ACP, lpszLayoutText);
if (!pszLayoutTextW)
goto Quit;
@@ -1712,7 +1712,7 @@ ImmGetConversionListA(HKL hKL, HIMC hIMC, LPCSTR pSrc,
LPCANDIDATELIST lpDst,
if (pSrc)
{
- pszSrcW = Imm32WideFromAnsi(pSrc);
+ pszSrcW = Imm32WideFromAnsi(pImeDpi->uCodePage, pSrc);
if (pszSrcW == NULL)
goto Quit;
}
@@ -1729,7 +1729,7 @@ ImmGetConversionListA(HKL hKL, HIMC hIMC, LPCSTR pSrc,
LPCANDIDATELIST lpDst,
if (cb == 0)
goto Quit;
- ret = CandidateListWideToAnsi(pCL, lpDst, dwBufLen, CP_ACP);
+ ret = CandidateListWideToAnsi(pCL, lpDst, dwBufLen, pImeDpi->uCodePage);
Quit:
ImmLocalFree(pszSrcW);
@@ -1767,7 +1767,7 @@ ImmGetConversionListW(HKL hKL, HIMC hIMC, LPCWSTR pSrc,
LPCANDIDATELIST lpDst,
if (pSrc)
{
- pszSrcA = Imm32AnsiFromWide(pSrc);
+ pszSrcA = Imm32AnsiFromWide(pImeDpi->uCodePage, pSrc);
if (pszSrcA == NULL)
goto Quit;
}
@@ -1784,7 +1784,7 @@ ImmGetConversionListW(HKL hKL, HIMC hIMC, LPCWSTR pSrc,
LPCANDIDATELIST lpDst,
if (!cb)
goto Quit;
- ret = CandidateListAnsiToWide(pCL, lpDst, dwBufLen, CP_ACP);
+ ret = CandidateListAnsiToWide(pCL, lpDst, dwBufLen, pImeDpi->uCodePage);
Quit:
ImmLocalFree(pszSrcA);
@@ -1902,14 +1902,14 @@ BOOL WINAPI ImmConfigureIMEA(HKL hKL, HWND hWnd, DWORD dwMode,
LPVOID lpData)
if (pRegWordA->lpReading)
{
- RegWordW.lpReading = Imm32WideFromAnsi(pRegWordA->lpReading);
+ RegWordW.lpReading = Imm32WideFromAnsi(pImeDpi->uCodePage,
pRegWordA->lpReading);
if (!RegWordW.lpReading)
goto Quit;
}
if (pRegWordA->lpWord)
{
- RegWordW.lpWord = Imm32WideFromAnsi(pRegWordA->lpWord);
+ RegWordW.lpWord = Imm32WideFromAnsi(pImeDpi->uCodePage,
pRegWordA->lpWord);
if (!RegWordW.lpWord)
goto Quit;
}
@@ -1956,14 +1956,14 @@ BOOL WINAPI ImmConfigureIMEW(HKL hKL, HWND hWnd, DWORD dwMode,
LPVOID lpData)
if (pRegWordW->lpReading)
{
- RegWordA.lpReading = Imm32AnsiFromWide(pRegWordW->lpReading);
+ RegWordA.lpReading = Imm32AnsiFromWide(pImeDpi->uCodePage,
pRegWordW->lpReading);
if (!RegWordA.lpReading)
goto Quit;
}
if (pRegWordW->lpWord)
{
- RegWordA.lpWord = Imm32AnsiFromWide(pRegWordW->lpWord);
+ RegWordA.lpWord = Imm32AnsiFromWide(pImeDpi->uCodePage,
pRegWordW->lpWord);
if (!RegWordA.lpWord)
goto Quit;
}
diff --git a/dll/win32/imm32/precomp.h b/dll/win32/imm32/precomp.h
index 91eb68c984a..8e996ab4ab0 100644
--- a/dll/win32/imm32/precomp.h
+++ b/dll/win32/imm32/precomp.h
@@ -88,8 +88,8 @@ BOOL APIENTRY Imm32CheckImcProcess(PIMC pIMC);
LPVOID APIENTRY ImmLocalAlloc(DWORD dwFlags, DWORD dwBytes);
#define ImmLocalFree(lpData) HeapFree(ghImmHeap, 0, (lpData))
-LPWSTR APIENTRY Imm32WideFromAnsi(LPCSTR pszA);
-LPSTR APIENTRY Imm32AnsiFromWide(LPCWSTR pszW);
+LPWSTR APIENTRY Imm32WideFromAnsi(UINT uCodePage, LPCSTR pszA);
+LPSTR APIENTRY Imm32AnsiFromWide(UINT uCodePage, LPCWSTR pszW);
LONG APIENTRY IchWideFromAnsi(LONG cchAnsi, LPCSTR pchAnsi, UINT uCodePage);
LONG APIENTRY IchAnsiFromWide(LONG cchWide, LPCWSTR pchWide, UINT uCodePage);
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi(HKL hKL);
diff --git a/dll/win32/imm32/regword.c b/dll/win32/imm32/regword.c
index 8aec56aa2d2..dfa4114a9ed 100644
--- a/dll/win32/imm32/regword.c
+++ b/dll/win32/imm32/regword.c
@@ -14,6 +14,7 @@ typedef struct ENUM_WORD_A2W
REGISTERWORDENUMPROCW lpfnEnumProc;
LPVOID lpData;
UINT ret;
+ UINT uCodePage;
} ENUM_WORD_A2W, *LPENUM_WORD_A2W;
typedef struct ENUM_WORD_W2A
@@ -21,6 +22,7 @@ typedef struct ENUM_WORD_W2A
REGISTERWORDENUMPROCA lpfnEnumProc;
LPVOID lpData;
UINT ret;
+ UINT uCodePage;
} ENUM_WORD_W2A, *LPENUM_WORD_W2A;
/*
@@ -35,14 +37,14 @@ Imm32EnumWordProcA2W(LPCSTR pszReadingA, DWORD dwStyle, LPCSTR
pszRegisterA, LPV
if (pszReadingA)
{
- pszReadingW = Imm32WideFromAnsi(pszReadingA);
+ pszReadingW = Imm32WideFromAnsi(lpEnumData->uCodePage, pszReadingA);
if (pszReadingW == NULL)
goto Quit;
}
if (pszRegisterA)
{
- pszRegisterW = Imm32WideFromAnsi(pszRegisterA);
+ pszRegisterW = Imm32WideFromAnsi(lpEnumData->uCodePage, pszRegisterA);
if (pszRegisterW == NULL)
goto Quit;
}
@@ -65,14 +67,14 @@ Imm32EnumWordProcW2A(LPCWSTR pszReadingW, DWORD dwStyle, LPCWSTR
pszRegisterW, L
if (pszReadingW)
{
- pszReadingA = Imm32AnsiFromWide(pszReadingW);
+ pszReadingA = Imm32AnsiFromWide(lpEnumData->uCodePage, pszReadingW);
if (pszReadingW == NULL)
goto Quit;
}
if (pszRegisterW)
{
- pszRegisterA = Imm32AnsiFromWide(pszRegisterW);
+ pszRegisterA = Imm32AnsiFromWide(lpEnumData->uCodePage, pszRegisterW);
if (pszRegisterA == NULL)
goto Quit;
}
@@ -116,14 +118,14 @@ ImmEnumRegisterWordA(HKL hKL, REGISTERWORDENUMPROCA lpfnEnumProc,
if (lpszReading)
{
- pszReadingW = Imm32WideFromAnsi(lpszReading);
+ pszReadingW = Imm32WideFromAnsi(pImeDpi->uCodePage, lpszReading);
if (pszReadingW == NULL)
goto Quit;
}
if (lpszRegister)
{
- pszRegisterW = Imm32WideFromAnsi(lpszRegister);
+ pszRegisterW = Imm32WideFromAnsi(pImeDpi->uCodePage, lpszRegister);
if (pszRegisterW == NULL)
goto Quit;
}
@@ -131,6 +133,7 @@ ImmEnumRegisterWordA(HKL hKL, REGISTERWORDENUMPROCA lpfnEnumProc,
EnumDataW2A.lpfnEnumProc = lpfnEnumProc;
EnumDataW2A.lpData = lpData;
EnumDataW2A.ret = 0;
+ EnumDataW2A.uCodePage = pImeDpi->uCodePage;
pImeDpi->ImeEnumRegisterWord(Imm32EnumWordProcW2A, pszReadingW, dwStyle,
pszRegisterW, &EnumDataW2A);
ret = EnumDataW2A.ret;
@@ -172,14 +175,14 @@ ImmEnumRegisterWordW(HKL hKL, REGISTERWORDENUMPROCW lpfnEnumProc,
if (lpszReading)
{
- pszReadingA = Imm32AnsiFromWide(lpszReading);
+ pszReadingA = Imm32AnsiFromWide(pImeDpi->uCodePage, lpszReading);
if (pszReadingA == NULL)
goto Quit;
}
if (lpszRegister)
{
- pszRegisterA = Imm32AnsiFromWide(lpszRegister);
+ pszRegisterA = Imm32AnsiFromWide(pImeDpi->uCodePage, lpszRegister);
if (pszRegisterA == NULL)
goto Quit;
}
@@ -187,6 +190,7 @@ ImmEnumRegisterWordW(HKL hKL, REGISTERWORDENUMPROCW lpfnEnumProc,
EnumDataA2W.lpfnEnumProc = lpfnEnumProc;
EnumDataA2W.lpData = lpData;
EnumDataA2W.ret = 0;
+ EnumDataA2W.uCodePage = pImeDpi->uCodePage;
pImeDpi->ImeEnumRegisterWord(Imm32EnumWordProcA2W, pszReadingA, dwStyle,
pszRegisterA, &EnumDataA2W);
ret = EnumDataA2W.ret;
@@ -240,7 +244,7 @@ UINT WINAPI ImmGetRegisterWordStyleA(HKL hKL, UINT nItem, LPSTYLEBUFA
lpStyleBuf
pDestA = &lpStyleBuf[iItem];
pDestA->dwStyle = pSrcW->dwStyle;
StringCchLengthW(pSrcW->szDescription, _countof(pSrcW->szDescription),
&cchW);
- cchA = WideCharToMultiByte(CP_ACP, MB_PRECOMPOSED,
+ cchA = WideCharToMultiByte(pImeDpi->uCodePage, MB_PRECOMPOSED,
pSrcW->szDescription, (INT)cchW,
pDestA->szDescription,
_countof(pDestA->szDescription),
NULL, NULL);
@@ -298,7 +302,7 @@ UINT WINAPI ImmGetRegisterWordStyleW(HKL hKL, UINT nItem, LPSTYLEBUFW
lpStyleBuf
pDestW = &lpStyleBuf[iItem];
pDestW->dwStyle = pSrcA->dwStyle;
StringCchLengthA(pSrcA->szDescription, _countof(pSrcA->szDescription),
&cchA);
- cchW = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
+ cchW = MultiByteToWideChar(pImeDpi->uCodePage, MB_PRECOMPOSED,
pSrcA->szDescription, (INT)cchA,
pDestW->szDescription,
_countof(pDestW->szDescription));
if (cchW > _countof(pDestW->szDescription) - 1)
@@ -339,14 +343,14 @@ ImmRegisterWordA(HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR
lpszRegister
if (lpszReading)
{
- pszReadingW = Imm32WideFromAnsi(lpszReading);
+ pszReadingW = Imm32WideFromAnsi(pImeDpi->uCodePage, lpszReading);
if (pszReadingW == NULL)
goto Quit;
}
if (lpszRegister)
{
- pszRegisterW = Imm32WideFromAnsi(lpszRegister);
+ pszRegisterW = Imm32WideFromAnsi(pImeDpi->uCodePage, lpszRegister);
if (pszRegisterW == NULL)
goto Quit;
}
@@ -386,14 +390,14 @@ ImmRegisterWordW(HKL hKL, LPCWSTR lpszReading, DWORD dwStyle,
LPCWSTR lpszRegist
if (lpszReading)
{
- pszReadingA = Imm32AnsiFromWide(lpszReading);
+ pszReadingA = Imm32AnsiFromWide(pImeDpi->uCodePage, lpszReading);
if (!pszReadingA)
goto Quit;
}
if (lpszRegister)
{
- pszRegisterA = Imm32AnsiFromWide(lpszRegister);
+ pszRegisterA = Imm32AnsiFromWide(pImeDpi->uCodePage, lpszRegister);
if (!pszRegisterA)
goto Quit;
}
@@ -433,14 +437,14 @@ ImmUnregisterWordA(HKL hKL, LPCSTR lpszReading, DWORD dwStyle,
LPCSTR lpszUnregi
if (lpszReading)
{
- pszReadingW = Imm32WideFromAnsi(lpszReading);
+ pszReadingW = Imm32WideFromAnsi(pImeDpi->uCodePage, lpszReading);
if (pszReadingW == NULL)
goto Quit;
}
if (lpszUnregister)
{
- pszUnregisterW = Imm32WideFromAnsi(lpszUnregister);
+ pszUnregisterW = Imm32WideFromAnsi(pImeDpi->uCodePage, lpszUnregister);
if (pszUnregisterW == NULL)
goto Quit;
}
@@ -480,14 +484,14 @@ ImmUnregisterWordW(HKL hKL, LPCWSTR lpszReading, DWORD dwStyle,
LPCWSTR lpszUnre
if (lpszReading)
{
- pszReadingA = Imm32AnsiFromWide(lpszReading);
+ pszReadingA = Imm32AnsiFromWide(pImeDpi->uCodePage, lpszReading);
if (!pszReadingA)
goto Quit;
}
if (lpszUnregister)
{
- pszUnregisterA = Imm32AnsiFromWide(lpszUnregister);
+ pszUnregisterA = Imm32AnsiFromWide(pImeDpi->uCodePage, lpszUnregister);
if (!pszUnregisterA)
goto Quit;
}
diff --git a/dll/win32/imm32/utils.c b/dll/win32/imm32/utils.c
index bef252b665b..e9906ced61e 100644
--- a/dll/win32/imm32/utils.c
+++ b/dll/win32/imm32/utils.c
@@ -184,25 +184,25 @@ BOOL WINAPI Imm32IsImcAnsi(HIMC hIMC)
return ret;
}
-LPWSTR APIENTRY Imm32WideFromAnsi(LPCSTR pszA)
+LPWSTR APIENTRY Imm32WideFromAnsi(UINT uCodePage, LPCSTR pszA)
{
INT cch = lstrlenA(pszA);
LPWSTR pszW = ImmLocalAlloc(0, (cch + 1) * sizeof(WCHAR));
if (pszW == NULL)
return NULL;
- cch = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, pszA, cch, pszW, cch + 1);
+ cch = MultiByteToWideChar(uCodePage, MB_PRECOMPOSED, pszA, cch, pszW, cch + 1);
pszW[cch] = 0;
return pszW;
}
-LPSTR APIENTRY Imm32AnsiFromWide(LPCWSTR pszW)
+LPSTR APIENTRY Imm32AnsiFromWide(UINT uCodePage, LPCWSTR pszW)
{
INT cchW = lstrlenW(pszW);
INT cchA = (cchW + 1) * sizeof(WCHAR);
LPSTR pszA = ImmLocalAlloc(0, cchA);
if (!pszA)
return NULL;
- cchA = WideCharToMultiByte(CP_ACP, 0, pszW, cchW, pszA, cchA, NULL, NULL);
+ cchA = WideCharToMultiByte(uCodePage, 0, pszW, cchW, pszA, cchA, NULL, NULL);
pszA[cchA] = 0;
return pszA;
}