diff --git a/dll/win32/imm32/ime.c b/dll/win32/imm32/ime.c index b06afb628da..1fd912b1a86 100644 --- a/dll/win32/imm32/ime.c +++ b/dll/win32/imm32/ime.c @@ -46,23 +46,26 @@ BOOL APIENTRY Imm32InquireIme(PIMEDPI pImeDpi) { WCHAR szUIClass[64]; WNDCLASSW wcW; - DWORD dwSysInfoFlags = 0; // TODO: ??? + DWORD dwSysInfoFlags = 0; LPIMEINFO pImeInfo = &pImeDpi->ImeInfo; - // TODO: NtUserGetThreadState(16); + if (NtUserGetThreadState(16)) + dwSysInfoFlags |= IME_SYSINFO_WINLOGON; - if (!IS_IME_HKL(pImeDpi->hKL)) + if (IS_IME_HKL(pImeDpi->hKL)) { - if (g_psi && (g_psi->dwSRVIFlags & SRVINFO_CICERO_ENABLED) && - pImeDpi->CtfImeInquireExW) - { - // TODO: + if (!pImeDpi->ImeInquire(pImeInfo, szUIClass, dwSysInfoFlags)) return FALSE; - } } - - if (!pImeDpi->ImeInquire(pImeInfo, szUIClass, dwSysInfoFlags)) + else if (Imm32IsCiceroMode() && pImeDpi->CtfImeInquireExW) + { + if (!pImeDpi->CtfImeInquireExW(pImeInfo, szUIClass, dwSysInfoFlags, pImeDpi->hKL)) + return FALSE; + } + else + { return FALSE; + } szUIClass[_countof(szUIClass) - 1] = 0; @@ -257,18 +260,10 @@ PIMEDPI APIENTRY Ime32LoadImeDpi(HKL hKL, BOOL bLock) PIMEDPI APIENTRY ImmLockOrLoadImeDpi(HKL hKL) { - PW32CLIENTINFO pInfo; PIMEDPI pImeDpi; - if (!IS_IME_HKL(hKL)) - { - if (!g_psi || !(g_psi->dwSRVIFlags & SRVINFO_CICERO_ENABLED)) - return NULL; - - pInfo = (PW32CLIENTINFO)(NtCurrentTeb()->Win32ClientInfo); - if ((pInfo->W32ClientInfo[0] & 2)) - return NULL; - } + if (!IS_IME_HKL(hKL) && (!Imm32IsCiceroMode() || Imm32Is16BitMode())) + return NULL; pImeDpi = ImmLockImeDpi(hKL); if (pImeDpi == NULL) @@ -282,11 +277,9 @@ ImeDpi_Escape(PIMEDPI pImeDpi, HIMC hIMC, UINT uSubFunc, LPVOID lpData, HKL hKL) if (IS_IME_HKL(hKL)) return pImeDpi->ImeEscape(hIMC, uSubFunc, lpData); - if (g_psi && (g_psi->dwSRVIFlags & SRVINFO_CICERO_ENABLED)) - { - if (pImeDpi->CtfImeEscapeEx) - return pImeDpi->CtfImeEscapeEx(hIMC, uSubFunc, lpData, hKL); - } + if (Imm32IsCiceroMode() && pImeDpi->CtfImeEscapeEx) + return pImeDpi->CtfImeEscapeEx(hIMC, uSubFunc, lpData, hKL); + return 0; } @@ -305,7 +298,7 @@ BOOL WINAPI ImmIsIME(HKL hKL) */ HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd) { - if (!g_psi || !(g_psi->dwSRVIFlags & SRVINFO_IMM32)) + if (!Imm32IsImmMode()) return NULL; // FIXME: NtUserGetThreadState and enum ThreadStateRoutines are broken. @@ -367,7 +360,6 @@ ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearch { BOOL bDisabled = FALSE; HKL hKL; - PTEB pTeb; switch (SearchType) { @@ -390,10 +382,9 @@ ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, IMEINFOEXCLASS SearchType, PVOID pvSearch if (!IS_IME_HKL(hKL)) { - if (g_psi && (g_psi->dwSRVIFlags & SRVINFO_CICERO_ENABLED)) + if (Imm32IsCiceroMode()) { - pTeb = NtCurrentTeb(); - if (((PW32CLIENTINFO)pTeb->Win32ClientInfo)->W32ClientInfo[0] & 2) + if (Imm32Is16BitMode()) return FALSE; if (!bDisabled) goto Quit; @@ -487,18 +478,10 @@ VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi) */ BOOL WINAPI ImmLoadIME(HKL hKL) { - PW32CLIENTINFO pInfo; PIMEDPI pImeDpi; - if (!IS_IME_HKL(hKL)) - { - if (!g_psi || !(g_psi->dwSRVIFlags & SRVINFO_CICERO_ENABLED)) - return FALSE; - - pInfo = (PW32CLIENTINFO)(NtCurrentTeb()->Win32ClientInfo); - if ((pInfo->W32ClientInfo[0] & 2)) - return FALSE; - } + if (!IS_IME_HKL(hKL) && (!Imm32IsCiceroMode() || Imm32Is16BitMode())) + return FALSE; pImeDpi = Imm32FindImeDpi(hKL); if (pImeDpi == NULL) @@ -1319,20 +1302,14 @@ BOOL WINAPI ImmSetConversionStatus(HIMC hIMC, DWORD fdwConversion, DWORD fdwSent HKL hKL; LPINPUTCONTEXT pIC; DWORD dwOldConversion, dwOldSentence; - BOOL fConversionChange = FALSE, fSentenceChange = FALSE; + BOOL fConversionChange = FALSE, fSentenceChange = FALSE, fUseCicero = FALSE; HWND hWnd; TRACE("(%p, 0x%lX, 0x%lX)\n", hIMC, fdwConversion, fdwSentence); hKL = GetKeyboardLayout(0); - if (!IS_IME_HKL(hKL)) - { - if (g_psi && (g_psi->dwSRVIFlags & SRVINFO_CICERO_ENABLED)) - { - FIXME("Cicero\n"); - return FALSE; - } - } + if (!IS_IME_HKL(hKL) && Imm32IsCiceroMode() && !Imm32Is16BitMode()) + fUseCicero = TRUE; if (Imm32IsCrossThreadAccess(hIMC)) return FALSE; @@ -1358,14 +1335,15 @@ BOOL WINAPI ImmSetConversionStatus(HIMC hIMC, DWORD fdwConversion, DWORD fdwSent hWnd = pIC->hWnd; ImmUnlockIMC(hIMC); - if (fConversionChange) + if (fConversionChange || fUseCicero) { Imm32NotifyAction(hIMC, hWnd, NI_CONTEXTUPDATED, dwOldConversion, IMC_SETCONVERSIONMODE, IMN_SETCONVERSIONMODE, 0); - NtUserNotifyIMEStatus(hWnd, hIMC, fdwConversion); + if (fConversionChange) + NtUserNotifyIMEStatus(hWnd, hIMC, fdwConversion); } - if (fSentenceChange) + if (fSentenceChange || fUseCicero) { Imm32NotifyAction(hIMC, hWnd, NI_CONTEXTUPDATED, dwOldSentence, IMC_SETSENTENCEMODE, IMN_SETSENTENCEMODE, 0); diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c index 0351cdae680..3297fa085e9 100644 --- a/dll/win32/imm32/imm.c +++ b/dll/win32/imm32/imm.c @@ -62,9 +62,7 @@ HKL WINAPI ImmLoadLayout(HKL hKL, PIMEINFOEX pImeInfoEx) TRACE("(%p, %p)\n", hKL, pImeInfoEx); - if (IS_IME_HKL(hKL) || - !g_psi || !(g_psi->dwSRVIFlags & SRVINFO_CICERO_ENABLED) || - ((PW32CLIENTINFO)NtCurrentTeb()->Win32ClientInfo)->W32ClientInfo[0] & 2) + if (IS_IME_HKL(hKL) || !Imm32IsCiceroMode() || Imm32Is16BitMode()) { UnicodeString.Buffer = szLayout; UnicodeString.MaximumLength = sizeof(szLayout); @@ -266,7 +264,7 @@ BOOL WINAPI ImmAssociateContextEx(HWND hWnd, HIMC hIMC, DWORD dwFlags) TRACE("(%p, %p, 0x%lX)\n", hWnd, hIMC, dwFlags); - if (!g_psi || !(g_psi->dwSRVIFlags & SRVINFO_IMM32)) + if (!Imm32IsImmMode()) return FALSE; if (hIMC && !(dwFlags & IACE_DEFAULT) && Imm32IsCrossThreadAccess(hIMC)) @@ -311,7 +309,7 @@ HIMC WINAPI ImmCreateContext(void) TRACE("()\n"); - if (g_psi == NULL || !(g_psi->dwSRVIFlags & SRVINFO_IMM32)) + if (!Imm32IsImmMode()) return NULL; pClientImc = Imm32HeapAlloc(HEAP_ZERO_MEMORY, sizeof(CLIENTIMC)); @@ -350,7 +348,7 @@ BOOL APIENTRY Imm32CleanupContext(HIMC hIMC, HKL hKL, BOOL bKeep) LPINPUTCONTEXT pIC; PCLIENTIMC pClientImc; - if (g_psi == NULL || !(g_psi->dwSRVIFlags & SRVINFO_IMM32) || hIMC == NULL) + if (!Imm32IsImmMode() || hIMC == NULL) return FALSE; FIXME("We have do something to do here\n"); @@ -385,9 +383,9 @@ BOOL APIENTRY Imm32CleanupContext(HIMC hIMC, HKL hKL, BOOL bKeep) { pImeDpi->ImeSelect(hIMC, FALSE); } - else if (g_psi && (g_psi->dwSRVIFlags & SRVINFO_CICERO_ENABLED)) + else if (Imm32IsCiceroMode() && pImeDpi->CtfImeSelectEx) { - FIXME("We have do something to do here\n"); + pImeDpi->CtfImeSelectEx(hIMC, FALSE, hKL); } ImmUnlockImeDpi(pImeDpi); } @@ -422,7 +420,7 @@ BOOL WINAPI ImmDestroyContext(HIMC hIMC) TRACE("(%p)\n", hIMC); - if (g_psi == NULL || !(g_psi->dwSRVIFlags & SRVINFO_IMM32)) + if (!Imm32IsImmMode()) return FALSE; if (Imm32IsCrossThreadAccess(hIMC)) @@ -508,7 +506,7 @@ static HIMC APIENTRY Imm32GetContextEx(HWND hWnd, DWORD dwContextFlags) PCLIENTIMC pClientImc; PWND pWnd; - if (!g_psi || !(g_psi->dwSRVIFlags & SRVINFO_IMM32)) + if (!Imm32IsImmMode()) return NULL; if (!hWnd) @@ -843,7 +841,7 @@ HIMC WINAPI ImmGetContext(HWND hWnd) */ BOOL WINAPI CtfImmIsCiceroEnabled(VOID) { - return (g_psi && (g_psi->dwSRVIFlags & SRVINFO_CICERO_ENABLED)); + return Imm32IsCiceroMode(); } /*********************************************************************** @@ -1380,7 +1378,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) break; case DLL_THREAD_DETACH: - if (g_psi == NULL || !(g_psi->dwSRVIFlags & SRVINFO_IMM32)) + if (!Imm32IsImmMode()) return TRUE; pTeb = NtCurrentTeb(); diff --git a/dll/win32/imm32/precomp.h b/dll/win32/imm32/precomp.h index 2c82e5b3746..b914f8f625a 100644 --- a/dll/win32/imm32/precomp.h +++ b/dll/win32/imm32/precomp.h @@ -93,7 +93,10 @@ static inline BOOL Imm32IsCrossProcessAccess(HWND hWnd) (DWORD_PTR)NtCurrentTeb()->ClientId.UniqueProcess); } -#define ImeDpi_IsUnicode(pImeDpi) ((pImeDpi)->ImeInfo.fdwProperty & IME_PROP_UNICODE) +#define ImeDpi_IsUnicode(pImeDpi) ((pImeDpi)->ImeInfo.fdwProperty & IME_PROP_UNICODE) +#define Imm32IsImmMode() (g_psi && (g_psi->dwSRVIFlags & SRVINFO_IMM32)) +#define Imm32IsCiceroMode() (g_psi && (g_psi->dwSRVIFlags & SRVINFO_CICERO_ENABLED)) +#define Imm32Is16BitMode() (GetWin32ClientInfo()->dwTIFlags & TIF_16BIT) DWORD APIENTRY CandidateListWideToAnsi(const CANDIDATELIST *pWideCL, LPCANDIDATELIST pAnsiCL, DWORD dwBufLen, diff --git a/sdk/include/psdk/imm.h b/sdk/include/psdk/imm.h index 6232ee115ff..14458e26203 100644 --- a/sdk/include/psdk/imm.h +++ b/sdk/include/psdk/imm.h @@ -237,6 +237,10 @@ typedef struct tagCANDIDATEINFO { #define NI_SETCANDIDATE_PAGESIZE 0x0017 #define NI_IMEMENUSELECTED 0x0018 +/* dwSystemInfoFlags bits */ +#define IME_SYSINFO_WINLOGON 0x0001 +#define IME_SYSINFO_WOW16 0x0002 + BOOL WINAPI ImmUnlockIMC(HIMC); DWORD WINAPI ImmGetIMCLockCount(HIMC); HIMCC WINAPI ImmCreateIMCC(DWORD); diff --git a/win32ss/include/imetable.h b/win32ss/include/imetable.h index d9d0929757d..09580a4ac95 100644 --- a/win32ss/include/imetable.h +++ b/win32ss/include/imetable.h @@ -15,8 +15,8 @@ DEFINE_IME_ENTRY(UINT, ImeToAsciiEx, (UINT uVirKey, UINT uScanCode, CONST LPBYTE DEFINE_IME_ENTRY(BOOL, NotifyIME, (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue), FALSE) DEFINE_IME_ENTRY(BOOL, ImeSetCompositionString, (HIMC hIMC, DWORD dwIndex, LPCVOID lpComp, DWORD dwCompLen, LPCVOID lpRead, DWORD dwReadLen), FALSE) DEFINE_IME_ENTRY(DWORD, ImeGetImeMenuItems, (HIMC hIMC, DWORD dwFlags, DWORD dwType, LPIMEMENUITEMINFOW lpImeParentMenu, LPIMEMENUITEMINFOW lpImeMenu, DWORD dwSize), FALSE) -DEFINE_IME_ENTRY(DWORD, CtfImeInquireExW, (VOID /* FIXME: unknown */), TRUE) -DEFINE_IME_ENTRY(DWORD, CtfImeSelectEx, (VOID /* FIXME: unknown */), TRUE) +DEFINE_IME_ENTRY(BOOL, CtfImeInquireExW, (LPIMEINFO lpIMEInfo, LPVOID lpszWndClass, DWORD dwSystemInfoFlags, HKL hKL), TRUE) +DEFINE_IME_ENTRY(BOOL, CtfImeSelectEx, (HIMC hIMC, BOOL fSelect, HKL hKL), TRUE) DEFINE_IME_ENTRY(LRESULT, CtfImeEscapeEx, (HIMC hIMC, UINT uSubFunc, LPVOID lpData, HKL hKL), TRUE) DEFINE_IME_ENTRY(DWORD, CtfImeGetGuidAtom, (VOID /* FIXME: unknown */), TRUE) DEFINE_IME_ENTRY(DWORD, CtfImeIsGuidMapEnable, (VOID /* FIXME: unknown */), TRUE)