ReactOS 0.4.15-dev-7098-ge0c17c3
ctf.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS IMM32
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Implementing the IMM32 Cicero-aware Text Framework (CTF)
5 * COPYRIGHT: Copyright 2022-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6 */
7
8#include "precomp.h"
9#include <msctf.h> /* for ITfLangBarMgr */
10#include <objidl.h> /* for IInitializeSpy */
11
13
14/* FIXME: Use RTL */
16{
17 return FALSE;
18}
19
21{
22 return NtCurrentTeb()->ProcessEnvironmentBlock->LoaderLock->OwningThread ==
23 NtCurrentTeb()->ClientId.UniqueThread;
24}
25
26static BOOL
28{
29 BOOL bOK, IsMember = FALSE;
30 PSID pSid;
32
34 0, 0, 0, 0, 0, 0, 0, &pSid))
35 {
36 ERR("Error: %ld\n", GetLastError());
37 return FALSE;
38 }
39
40 bOK = CheckTokenMembership(NULL, pSid, &IsMember);
41
42 if (pSid)
44
45 return bOK && IsMember;
46}
47
48static BOOL
50{
51 LPWSTR pchFilePart = NULL;
53
55 return FALSE;
56
58 if (!pchFilePart)
59 return FALSE;
60
61 return lstrcmpiW(pchFilePart, L"msoobe.exe") == 0;
62}
63
64static BOOL
66{
67 HKEY hKey;
69 DWORD dwType, dwData, cbData;
70
71 error = RegOpenKeyW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\CTF\\SystemShared", &hKey);
72 if (error != ERROR_SUCCESS)
73 return FALSE;
74
75 dwData = 0;
76 cbData = sizeof(dwData);
77 error = RegQueryValueExW(hKey, L"CUAS", NULL, &dwType, (LPBYTE)&dwData, &cbData);
79
80 if (error != ERROR_SUCCESS || dwType != REG_DWORD)
81 return FALSE;
82
83 return !!dwData;
84}
85
86BOOL
88 _Inout_opt_ FARPROC *ppfn,
89 _Inout_ HINSTANCE *phinstDLL,
91 _In_ LPCSTR pszFuncName)
92{
94
95 if (*ppfn)
96 return TRUE;
97
98 if (*phinstDLL == NULL)
99 {
101 *phinstDLL = LoadLibraryExW(szPath, NULL, 0);
102 if (*phinstDLL == NULL)
103 return FALSE;
104 }
105
106 *ppfn = (FARPROC)GetProcAddress(*phinstDLL, pszFuncName);
107 return *ppfn != NULL;
108}
109
110#define IMM32_GET_FN(ppfn, phinstDLL, dll_name, func_name) \
111 Imm32GetFn((FARPROC*)(ppfn), (phinstDLL), (dll_name), #func_name)
112
113/***********************************************************************
114 * OLE32.DLL
115 */
116
118
119#define OLE32_FN(name) g_pfnOLE32_##name
120
125
130
131#define Imm32GetOle32Fn(func_name) \
132 IMM32_GET_FN(&OLE32_FN(func_name), &g_hOle32, L"ole32.dll", #func_name)
133
135{
137 return E_FAIL;
138
140}
141
143{
145 return;
146
148}
149
151{
153 return E_FAIL;
154
156}
157
159{
161 return E_FAIL;
162
164}
165
166/***********************************************************************
167 * MSCTF.DLL
168 */
169
171
172#define MSCTF_FN(name) g_pfnMSCTF_##name
173
176
179
180#define Imm32GetMsctfFn(func_name) \
181 IMM32_GET_FN(&MSCTF_FN(func_name), &g_hMsctf, L"msctf.dll", #func_name)
182
184{
185 TRACE("TF_CreateLangBarMgr(%p)\n", ppBarMgr);
186
188 return E_FAIL;
189
190 return MSCTF_FN(TF_CreateLangBarMgr)(ppBarMgr);
191}
192
194{
195 TRACE("TF_InvalidAssemblyListCacheIfExist()\n");
196
198 return;
199
201}
202
203/***********************************************************************
204 * CTF IME support
205 *
206 * TSF stands for "Text Services Framework". "Cicero" is the code name of TSF.
207 * CTF stands for "Cicero-aware Text Framework".
208 *
209 * Comparing with old-style IMM IME, the combination of CTF IME and TSF provides
210 * new-style and high-level input method.
211 *
212 * The CTF IME file is a DLL file that the software developer distributes.
213 * The export functions of the CTF IME file are defined in <CtfImeTable.h> of
214 * this folder.
215 */
216
217/* "Active IMM" compatibility flags */
219
220/* Disable CUAS? */
222
223/* The instance of the CTF IME file */
225
226/* Define the function types (FN_...) for CTF IME functions */
227#undef DEFINE_CTF_IME_FN
228#define DEFINE_CTF_IME_FN(func_name, ret_type, params) \
229 typedef ret_type (WINAPI *FN_##func_name)params;
230#include <CtfImeTable.h>
231
232/* Define the global variables (g_pfn...) for CTF IME functions */
233#undef DEFINE_CTF_IME_FN
234#define DEFINE_CTF_IME_FN(func_name, ret_type, params) \
235 FN_##func_name g_pfn##func_name = NULL;
236#include <CtfImeTable.h>
237
238/* The macro that gets the variable name from the CTF IME function name */
239#define CTF_IME_FN(func_name) g_pfn##func_name
240
241/* The type of ApphelpCheckIME function in apphelp.dll */
243
244/* FIXME: This is kernel32 function. We have to declare this in some header. */
249 _Out_ PULONG pdwReason);
250
251/***********************************************************************
252 * This function checks whether the app's IME is disabled by application
253 * compatibility patcher.
254 */
255BOOL
258 _In_z_ LPCWSTR pszAppName)
259{
260 HINSTANCE hinstApphelp;
261 FN_ApphelpCheckIME pApphelpCheckIME;
262
263 /* Query the application compatibility patcher */
265 return TRUE; /* The app's IME is not disabled */
266
267 /* Load apphelp.dll if necessary */
268 hinstApphelp = GetModuleHandleW(L"apphelp.dll");
269 if (!hinstApphelp)
270 {
271 hinstApphelp = LoadLibraryW(L"apphelp.dll");
272 if (!hinstApphelp)
273 return TRUE; /* There is no apphelp.dll. The app's IME is not disabled */
274 }
275
276 /* Is ApphelpCheckIME implemented? */
277 pApphelpCheckIME = (FN_ApphelpCheckIME)GetProcAddress(hinstApphelp, "ApphelpCheckIME");
278 if (!pApphelpCheckIME)
279 return TRUE; /* Not implemented. The app's IME is not disabled */
280
281 /* Is the app's IME disabled or not? */
282 return pApphelpCheckIME(pszAppName);
283}
284
285/***********************************************************************
286 * TLS (Thread-Local Storage)
287 *
288 * See: TlsAlloc
289 */
290
292
293/* IMM Thread-Local Storage (TLS) data */
294typedef struct IMMTLSDATA
295{
296 IInitializeSpy *pSpy; /* CoInitialize Spy */
298 ULARGE_INTEGER uliCookie; /* Spy requires a cookie for revoking */
299 BOOL bDoCount; /* Is it counting? */
300 DWORD dwSkipCount; /* The skipped count */
301 BOOL bUninitializing; /* Is it uninitializing? */
304
305static VOID
307{
309
310 if (g_dwTLSIndex == -1)
312
314}
315
316static IMMTLSDATA*
318{
320
321 if (g_dwTLSIndex == -1)
322 return NULL;
323
325 if (pData)
326 return pData;
327
330 return NULL;
331
333 {
335 return NULL;
336 }
337
338 return pData;
339}
340
341static IMMTLSDATA*
343{
344 if (g_dwTLSIndex == -1)
345 return NULL;
346
348}
349
350/* Get */
351static DWORD
353{
355 if (!pData)
356 return 0;
357 return pData->dwSkipCount;
358}
359
360/* Increment */
361static DWORD
363{
365 DWORD dwOldSkipCount;
366
367 pData = Imm32GetTLS();
368 if (!pData)
369 return 0;
370
371 dwOldSkipCount = pData->dwSkipCount;
372 if (pData->bDoCount)
373 pData->dwSkipCount = dwOldSkipCount + 1;
374
375 return dwOldSkipCount;
376}
377
378/* Decrement */
379static DWORD
381{
382 DWORD dwSkipCount;
384
385 pData = Imm32GetTLS();;
386 if (!pData)
387 return 0;
388
389 dwSkipCount = pData->dwSkipCount;
390 if (pData->bDoCount)
391 {
392 if (dwSkipCount)
393 pData->dwSkipCount = dwSkipCount - 1;
394 }
395
396 return dwSkipCount;
397}
398
399/***********************************************************************
400 * CtfImmEnterCoInitCountSkipMode (IMM32.@)
401 */
403{
405
406 TRACE("()\n");
407
408 pData = Imm32GetTLS();
409 if (pData)
410 ++(pData->bDoCount);
411}
412
413/***********************************************************************
414 * CtfImmLeaveCoInitCountSkipMode (IMM32.@)
415 */
417{
419
420 TRACE("()\n");
421
422 pData = Imm32GetTLS();
423 if (!pData || !pData->bDoCount)
424 return FALSE;
425
426 --(pData->bDoCount);
427 return TRUE;
428}
429
430/***********************************************************************
431 * ISPY (I am not spy!)
432 *
433 * ISPY watches CoInitialize[Ex] / CoUninitialize to manage COM initialization status.
434 */
435
436typedef struct ISPY
437{
438 const IInitializeSpyVtbl *m_pSpyVtbl;
441
442static STDMETHODIMP
444 _Inout_ IInitializeSpy *pThis,
446 _Inout_ LPVOID *ppvObj)
447{
448 ISPY *pSpy = (ISPY*)pThis;
449
450 if (!ppvObj)
451 return E_INVALIDARG;
452
453 *ppvObj = NULL;
454
455 if (!IsEqualIID(riid, &IID_IUnknown) && !IsEqualIID(riid, &IID_IInitializeSpy))
456 return E_NOINTERFACE;
457
458 ++(pSpy->m_cRefs);
459 *ppvObj = pSpy;
460 return S_OK;
461}
462
464ISPY_AddRef(
465 _Inout_ IInitializeSpy *pThis)
466{
467 ISPY *pSpy = (ISPY*)pThis;
468 return ++pSpy->m_cRefs;
469}
470
471static STDMETHODIMP_(ULONG)
472ISPY_Release(
473 _Inout_ IInitializeSpy *pThis)
474{
475 ISPY *pSpy = (ISPY*)pThis;
476 if (--pSpy->m_cRefs == 0)
477 {
478 ImmLocalFree(pSpy);
479 return 0;
480 }
481 return pSpy->m_cRefs;
482}
483
484/*
485 * (Pre/Post)(Initialize/Uninitialize) will be automatically called from OLE32
486 * as the results of watching.
487 */
488
489static STDMETHODIMP
491 _Inout_ IInitializeSpy *pThis,
493 _In_ DWORD dwCurThreadAptRefs)
494{
495 DWORD cCount;
496
498
499 cCount = Imm32IncCoInitCountSkip();
500 if (!dwCoInit &&
501 (dwCurThreadAptRefs == cCount + 1) &&
502 (GetWin32ClientInfo()->CI_flags & CI_CTFCOINIT))
503 {
506 }
507
508 return S_OK;
509}
510
511static STDMETHODIMP
513 _Inout_ IInitializeSpy *pThis,
514 _In_ HRESULT hrCoInit,
516 _In_ DWORD dwNewThreadAptRefs)
517{
518 DWORD CoInitCountSkip;
519
522
523 CoInitCountSkip = Imm32GetCoInitCountSkip();
524
525 if ((hrCoInit != S_FALSE) ||
526 (dwNewThreadAptRefs != CoInitCountSkip + 2) ||
527 !(GetWin32ClientInfo()->CI_flags & CI_CTFCOINIT))
528 {
529 return hrCoInit;
530 }
531
532 return S_OK;
533}
534
535static STDMETHODIMP
537 _Inout_ IInitializeSpy *pThis,
538 _In_ DWORD dwCurThreadAptRefs)
539{
541
542 if (dwCurThreadAptRefs == 1 &&
545 (GetWin32ClientInfo()->CI_flags & CI_CTFCOINIT))
546 {
548 if (pData && !pData->bUninitializing)
550 }
551
552 return S_OK;
553}
554
555static STDMETHODIMP
557 _In_ IInitializeSpy *pThis,
558 _In_ DWORD dwNewThreadAptRefs)
559{
561 UNREFERENCED_PARAMETER(dwNewThreadAptRefs);
563 return S_OK;
564}
565
566static const IInitializeSpyVtbl g_vtblISPY =
567{
569 ISPY_AddRef,
570 ISPY_Release,
575};
576
577static ISPY*
579{
580 ISPY *pSpy = (ISPY*)ImmLocalAlloc(0, sizeof(ISPY));
581 if (!pSpy)
582 return NULL;
583
584 pSpy->m_pSpyVtbl = &g_vtblISPY;
585 pSpy->m_cRefs = 1;
586 return pSpy;
587}
588
589#define Imm32DeleteIMMISPY(pSpy) ImmLocalFree(pSpy)
590
591/***********************************************************************
592 * CtfImmCoInitialize (Not exported)
593 */
596{
597 HRESULT hr;
599 ISPY *pSpy;
600
601 if (GetWin32ClientInfo()->CI_flags & CI_CTFCOINIT)
602 return S_OK; /* Already initialized */
603
606 return hr; /* CoInitializeEx failed */
607
608 GetWin32ClientInfo()->CI_flags |= CI_CTFCOINIT;
609 Imm32InitTLS();
610
612 if (!pData || pData->pSpy)
613 return S_OK; /* Cannot allocate or already it has a spy */
614
615 pSpy = Imm32AllocIMMISPY();
616 pData->pSpy = (IInitializeSpy*)pSpy;
617 if (IS_NULL_UNEXPECTEDLY(pSpy))
618 return S_OK; /* Cannot allocate a spy */
619
621 {
622 /* Failed to register the spy */
624 pData->pSpy = NULL;
625 pData->uliCookie.QuadPart = 0;
626 }
627
628 return S_OK;
629}
630
631/***********************************************************************
632 * CtfImmCoUninitialize (IMM32.@)
633 */
636{
638
639 if (!(GetWin32ClientInfo()->CI_flags & CI_CTFCOINIT))
640 return; /* Not CoInitialize'd */
641
642 pData = Imm32GetTLS();
643 if (pData)
644 {
645 pData->bUninitializing = TRUE;
646 Imm32CoUninitialize(); /* Do CoUninitialize */
647 pData->bUninitializing = FALSE;
648
649 GetWin32ClientInfo()->CI_flags &= ~CI_CTFCOINIT;
650 }
651
653 if (!pData || !pData->pSpy)
654 return; /* There were no spy */
655
656 /* Our work is done. We don't need spies like you anymore. */
658 ISPY_Release(pData->pSpy);
659 pData->pSpy = NULL;
660 pData->uliCookie.QuadPart = 0;
661}
662
663/***********************************************************************
664 * This function loads the CTF IME file if necessary and establishes
665 * communication with the CTF IME.
666 */
669{
671 IMEINFOEX ImeInfoEx;
672 WCHAR szImeFile[MAX_PATH];
673
674 /* Lock the IME interface */
676
677 do
678 {
679 if (g_hCtfIme) /* Already loaded? */
680 {
681 bSuccess = TRUE;
682 break;
683 }
684
685 /*
686 * NOTE: (HKL)0x04090409 is English US keyboard (default).
687 * The Cicero keyboard logically uses English US keyboard.
688 */
689 if (!ImmLoadLayout((HKL)ULongToHandle(0x04090409), &ImeInfoEx))
690 break;
691
692 /* Build a path string in system32. The installed IME file must be in system32. */
693 Imm32GetSystemLibraryPath(szImeFile, _countof(szImeFile), ImeInfoEx.wszImeFile);
694
695 /* Is the CTF IME disabled by app compatibility patcher? */
696 if (!Imm32CheckAndApplyAppCompat(0, szImeFile))
697 break; /* This IME is disabled */
698
699 /* Load a CTF IME file */
700 g_hCtfIme = LoadLibraryW(szImeFile);
701 if (!g_hCtfIme)
702 break;
703
704 /* Assume success */
705 bSuccess = TRUE;
706
707 /* Retrieve the CTF IME functions */
708#undef DEFINE_CTF_IME_FN
709#define DEFINE_CTF_IME_FN(func_name, ret_type, params) \
710 CTF_IME_FN(func_name) = (FN_##func_name)GetProcAddress(g_hCtfIme, #func_name); \
711 if (!CTF_IME_FN(func_name)) \
712 { \
713 bSuccess = FALSE; /* Failed */ \
714 break; \
715 }
716#include <CtfImeTable.h>
717 } while (0);
718
719 /* Unload the CTF IME if failed */
720 if (!bSuccess)
721 {
722 /* Set NULL to the function pointers */
723#undef DEFINE_CTF_IME_FN
724#define DEFINE_CTF_IME_FN(func_name, ret_type, params) CTF_IME_FN(func_name) = NULL;
725#include <CtfImeTable.h>
726
727 if (g_hCtfIme)
728 {
730 g_hCtfIme = NULL;
731 }
732 }
733
734 /* Unlock the IME interface */
736
737 return g_hCtfIme;
738}
739
740/***********************************************************************
741 * This function calls the same name function of the CTF IME side.
742 */
745{
746 TRACE("()\n");
747
748 if (!Imm32LoadCtfIme())
749 return E_FAIL;
750
752}
753
754/***********************************************************************
755 * This function calls the same name function of the CTF IME side.
756 */
759{
760 TRACE("()\n");
761
762 if (!Imm32LoadCtfIme())
763 return E_FAIL;
764
766}
767
768/***********************************************************************
769 * CtfAImmIsIME (IMM32.@)
770 *
771 * @return TRUE if CTF IME or IMM IME is enabled.
772 */
775{
776 TRACE("(%p)\n", hKL);
777 if (!Imm32LoadCtfIme())
778 return ImmIsIME(hKL);
779 return CTF_IME_FN(CtfImeIsIME)(hKL);
780}
781
782/***********************************************************************
783 * CtfImmIsCiceroStartedInThread (IMM32.@)
784 *
785 * @return TRUE if Cicero is started in the current thread.
786 */
789{
790 TRACE("()\n");
791 return !!(GetWin32ClientInfo()->CI_flags & 0x200);
792}
793
794/***********************************************************************
795 * CtfImmSetCiceroStartInThread (IMM32.@)
796 */
798{
799 TRACE("(%d)\n", bStarted);
800 if (bStarted)
801 GetWin32ClientInfo()->CI_flags |= 0x200;
802 else
803 GetWin32ClientInfo()->CI_flags &= ~0x200;
804}
805
806/***********************************************************************
807 * CtfImmSetAppCompatFlags (IMM32.@)
808 *
809 * Sets the application compatibility flags.
810 */
813{
814 TRACE("(0x%08X)\n", dwFlags);
815 if (!(dwFlags & 0xF0FFFFFF))
817}
818
819/***********************************************************************
820 * This function calls the same name function of the CTF IME side.
821 */
824 _In_ HIMC hIMC)
825{
826 TRACE("(%p)\n", hIMC);
827
828 if (!Imm32LoadCtfIme())
829 return E_FAIL;
830
832}
833
834/***********************************************************************
835 * This function calls the same name function of the CTF IME side.
836 */
839{
840 TRACE("(%p)\n", hIMC);
841
842 if (!Imm32LoadCtfIme())
843 return E_FAIL;
844
846}
847
848/***********************************************************************
849 * The callback function to activate CTF IMEs. Used in CtfAImmActivate.
850 */
851static BOOL CALLBACK
853 _In_ HIMC hIMC,
855{
858 return TRUE; /* Continue */
859}
860
861/***********************************************************************
862 * Thread Input Manager (TIM)
863 */
864
865static BOOL
867{
868 DWORD dwData, cbData;
869 HKEY hKey;
871
872 error = RegOpenKeyW(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\CTF", &hKey);
873 if (error != ERROR_SUCCESS)
874 return FALSE;
875
876 dwData = 0;
877 cbData = sizeof(dwData);
878 RegQueryValueExW(hKey, L"Disable Thread Input Manager", NULL, NULL, (LPBYTE)&dwData, &cbData);
880 return !!dwData;
881}
882
886{
887 HRESULT hr = S_OK;
888
889 if (!IS_CICERO_MODE() || IS_16BIT_MODE() ||
890 !(GetWin32ClientInfo()->CI_flags & CI_CTFCOINIT))
891 {
892 return S_OK; /* No need to activate/de-activate TIM */
893 }
894
895 if (bCreate)
896 {
897 if (!(GetWin32ClientInfo()->CI_flags & CI_CTFTIM))
898 {
900 if (SUCCEEDED(hr))
901 GetWin32ClientInfo()->CI_flags |= CI_CTFTIM;
902 }
903 }
904 else /* Destroy */
905 {
906 if (GetWin32ClientInfo()->CI_flags & CI_CTFTIM)
907 {
909 if (SUCCEEDED(hr))
910 GetWin32ClientInfo()->CI_flags &= ~CI_CTFTIM;
911 }
912 }
913
914 return hr;
915}
916
919 _In_ HIMC hIMC)
920{
921 if (!IS_CICERO_MODE() || (GetWin32ClientInfo()->dwCompatFlags2 & 2))
922 return E_NOINTERFACE;
923
924 return CtfImeDestroyInputContext(hIMC);
925}
926
929 _In_ HIMC hIMC)
930{
931 PCLIENTIMC pClientImc;
932 DWORD_PTR dwImeThreadId, dwCurrentThreadId;
934
935 TRACE("(%p)\n", hIMC);
936
937 pClientImc = ImmLockClientImc(hIMC);
938 if (!pClientImc)
939 return E_FAIL;
940
941 if (GetWin32ClientInfo()->CI_flags & CI_AIMMACTIVATED)
942 {
943 if (!pClientImc->bCtfIme)
944 {
945 dwImeThreadId = NtUserQueryInputContext(hIMC, QIC_INPUTTHREADID);
946 dwCurrentThreadId = GetCurrentThreadId();
947 if (dwImeThreadId == dwCurrentThreadId)
948 {
949 pClientImc->bCtfIme = TRUE;
952 pClientImc->bCtfIme = FALSE;
953 }
954 }
955 }
956 else
957 {
958 if (!(GetWin32ClientInfo()->CI_flags & CI_CTFTIM))
959 return S_OK;
960
961 if (!pClientImc->bCtfIme)
962 {
963 dwImeThreadId = NtUserQueryInputContext(hIMC, QIC_INPUTTHREADID);
964 dwCurrentThreadId = GetCurrentThreadId();
965 if ((dwImeThreadId == dwCurrentThreadId) && IS_CICERO_MODE() && !IS_16BIT_MODE())
966 {
967 pClientImc->bCtfIme = TRUE;
970 pClientImc->bCtfIme = FALSE;
971 }
972 }
973 }
974
975 ImmUnlockClientImc(pClientImc);
976 return hr;
977}
978
979/***********************************************************************
980 * CtfImmLastEnabledWndDestroy (IMM32.@)
981 *
982 * Same as Imm32ActivateOrDeactivateTIM but its naming is improper.
983 */
987{
988 TRACE("(%d)\n", bCreate);
990}
991
992/***********************************************************************
993 * CtfAImmActivate (IMM32.@)
994 *
995 * This function activates "Active IMM" (AIMM) and TSF.
996 */
999 _Out_opt_ HINSTANCE *phinstCtfIme)
1000{
1001 HRESULT hr;
1002 HINSTANCE hinstCtfIme;
1003
1004 TRACE("(%p)\n", phinstCtfIme);
1005
1006 /* Load a CTF IME file if necessary */
1007 hinstCtfIme = Imm32LoadCtfIme();
1008
1009 /* Create a thread manager of the CTF IME */
1011 if (hr == S_OK)
1012 {
1013 /* Update CI_... flags of the thread client info */
1014 GetWin32ClientInfo()->CI_flags |= CI_AIMMACTIVATED; /* Activate AIMM */
1015 GetWin32ClientInfo()->CI_flags &= ~CI_TSFDISABLED; /* Enable TSF */
1016
1017 /* Create the CTF input contexts */
1019 }
1020
1021 if (phinstCtfIme)
1022 *phinstCtfIme = hinstCtfIme;
1023
1024 return hr;
1025}
1026
1027/***********************************************************************
1028 * CtfAImmDeactivate (IMM32.@)
1029 *
1030 * This function de-activates "Active IMM" (AIMM) and TSF.
1031 */
1034 _In_ BOOL bDestroy)
1035{
1036 HRESULT hr;
1037
1038 if (!bDestroy)
1039 return E_FAIL;
1040
1042 if (hr == S_OK)
1043 {
1044 GetWin32ClientInfo()->CI_flags &= ~CI_AIMMACTIVATED; /* Deactivate AIMM */
1045 GetWin32ClientInfo()->CI_flags |= CI_TSFDISABLED; /* Disable TSF */
1046 }
1047
1048 return hr;
1049}
1050
1051/***********************************************************************
1052 * CtfImmIsCiceroEnabled (IMM32.@)
1053 *
1054 * @return TRUE if Cicero is enabled.
1055 */
1058{
1059 return IS_CICERO_MODE();
1060}
1061
1062/***********************************************************************
1063 * CtfImmIsTextFrameServiceDisabled (IMM32.@)
1064 *
1065 * @return TRUE if TSF is disabled.
1066 */
1069{
1070 return !!(GetWin32ClientInfo()->CI_flags & CI_TSFDISABLED);
1071}
1072
1073/***********************************************************************
1074 * ImmDisableTextFrameService (IMM32.@)
1075 */
1078{
1079 HRESULT hr = S_OK;
1080
1081 TRACE("(0x%lX)\n", dwThreadId);
1082
1083 if (dwThreadId == -1)
1085
1087 return TRUE;
1088
1089 GetWin32ClientInfo()->CI_flags |= CI_TSFDISABLED;
1090
1091 if (IS_CICERO_MODE() && !IS_16BIT_MODE() &&
1092 (GetWin32ClientInfo()->CI_flags & CI_CTFCOINIT) &&
1093 (GetWin32ClientInfo()->CI_flags & CI_CTFTIM))
1094 {
1096 if (SUCCEEDED(hr))
1097 {
1098 GetWin32ClientInfo()->CI_flags &= ~CI_CTFTIM;
1100 }
1101 }
1102
1103 return hr == S_OK;
1104}
1105
1106/***********************************************************************
1107 * CtfImmTIMActivate (IMM32.@)
1108 *
1109 * Activates Thread Input Manager (TIM) in the thread.
1110 */
1113{
1114 HRESULT hr = S_OK;
1115
1116 TRACE("(%p)\n", hKL);
1117
1119 {
1120 TRACE("g_disable_CUAS_flag\n");
1121 GetWin32ClientInfo()->CI_flags |= CI_TSFDISABLED;
1122 return FALSE;
1123 }
1124
1125 if (GetWin32ClientInfo()->CI_flags & CI_TSFDISABLED)
1126 {
1127 TRACE("CI_TSFDISABLED\n");
1128 return FALSE;
1129 }
1130
1132 {
1133 TRACE("TIM is disabled in registry\n");
1134 GetWin32ClientInfo()->CI_flags |= CI_TSFDISABLED;
1135 return FALSE;
1136 }
1137
1139 {
1140 TRACE("TIM is disabled due to LOGON or MSOBE\n");
1141 return FALSE;
1142 }
1143
1145 {
1146 TRACE("CUAS is disabled in registry\n");
1147 GetWin32ClientInfo()->CI_flags |= CI_TSFDISABLED;
1148 return FALSE;
1149 }
1150
1151 if (NtCurrentTeb()->ProcessEnvironmentBlock->AppCompatFlags.LowPart & 0x100)
1152 {
1153 TRACE("CUAS is disabled by AppCompatFlags\n");
1154 GetWin32ClientInfo()->CI_flags |= CI_TSFDISABLED;
1155 return FALSE;
1156 }
1157
1159 {
1160 TRACE("TIM is disabled by Loader\n");
1161 return FALSE;
1162 }
1163
1164 if (!IS_CICERO_MODE() || IS_16BIT_MODE())
1165 {
1166 TRACE("TIM is disabled because CICERO mode is unset\n");
1167 return FALSE;
1168 }
1169
1170 if (IS_IME_HKL(hKL))
1171 hKL = (HKL)UlongToHandle(MAKELONG(LOWORD(hKL), LOWORD(hKL)));
1172
1173 if (!ImmLoadIME(hKL))
1175
1177
1178 if ((GetWin32ClientInfo()->CI_flags & CI_CTFCOINIT) &&
1179 !(GetWin32ClientInfo()->CI_flags & CI_CTFTIM))
1180 {
1182 if (SUCCEEDED(hr))
1183 GetWin32ClientInfo()->CI_flags |= CI_CTFTIM;
1184 }
1185
1186 return hr;
1187}
1188
1189/***********************************************************************
1190 * CtfImmGenerateMessage (IMM32.@)
1191 */
1194 _In_ HIMC hIMC,
1195 _In_ BOOL bSend)
1196{
1197 DWORD_PTR dwImeThreadId, dwCurrentThreadId;
1198 PCLIENTIMC pClientImc;
1199 BOOL bUnicode;
1200 LPINPUTCONTEXT pIC;
1201 DWORD iMsg, dwNumMsgBuf;
1202 LPTRANSMSG pOldTransMsg, pNewTransMsg;
1203 SIZE_T cbTransMsg;
1204
1205 TRACE("(%p, %d)\n", hIMC, bSend);
1206
1207 dwImeThreadId = NtUserQueryInputContext(hIMC, QIC_INPUTTHREADID);
1208 dwCurrentThreadId = GetCurrentThreadId();
1209 if (dwImeThreadId != dwCurrentThreadId)
1210 {
1211 ERR("%p vs %p\n", dwImeThreadId, dwCurrentThreadId);
1212 return FALSE;
1213 }
1214
1215 pClientImc = ImmLockClientImc(hIMC);
1216 if (IS_NULL_UNEXPECTEDLY(pClientImc))
1217 return FALSE;
1218
1219 bUnicode = !!(pClientImc->dwFlags & CLIENTIMC_WIDE);
1220 ImmUnlockClientImc(pClientImc);
1221
1222 pIC = (LPINPUTCONTEXT)ImmLockIMC(hIMC);
1223 if (IS_NULL_UNEXPECTEDLY(pIC))
1224 return FALSE;
1225
1226 dwNumMsgBuf = pIC->dwNumMsgBuf;
1227 pOldTransMsg = (LPTRANSMSG)ImmLockIMCC(pIC->hMsgBuf);
1228 if (IS_NULL_UNEXPECTEDLY(pOldTransMsg))
1229 {
1230 pIC->dwNumMsgBuf = 0;
1231 ImmUnlockIMC(hIMC);
1232 return TRUE;
1233 }
1234
1235 cbTransMsg = sizeof(TRANSMSG) * dwNumMsgBuf;
1236 pNewTransMsg = (PTRANSMSG)ImmLocalAlloc(0, cbTransMsg);
1237 if (IS_NULL_UNEXPECTEDLY(pNewTransMsg))
1238 {
1239 ImmUnlockIMCC(pIC->hMsgBuf);
1240 pIC->dwNumMsgBuf = 0;
1241 ImmUnlockIMC(hIMC);
1242 return TRUE;
1243 }
1244
1245 RtlCopyMemory(pNewTransMsg, pOldTransMsg, cbTransMsg);
1246
1247 for (iMsg = 0; iMsg < dwNumMsgBuf; ++iMsg)
1248 {
1249 HWND hWnd = pIC->hWnd;
1250 UINT uMsg = pNewTransMsg[iMsg].message;
1251 WPARAM wParam = pNewTransMsg[iMsg].wParam;
1252 LPARAM lParam = pNewTransMsg[iMsg].lParam;
1253 if (bSend)
1254 {
1255 if (bUnicode)
1256 SendMessageW(hWnd, uMsg, wParam, lParam);
1257 else
1258 SendMessageA(hWnd, uMsg, wParam, lParam);
1259 }
1260 else
1261 {
1262 if (bUnicode)
1263 PostMessageW(hWnd, uMsg, wParam, lParam);
1264 else
1265 PostMessageA(hWnd, uMsg, wParam, lParam);
1266 }
1267 }
1268
1269 ImmLocalFree(pNewTransMsg);
1270 ImmUnlockIMCC(pIC->hMsgBuf);
1271 pIC->dwNumMsgBuf = 0; /* Processed */
1272 ImmUnlockIMC(hIMC);
1273
1274 return TRUE;
1275}
1276
1277/***********************************************************************
1278 * CtfImmHideToolbarWnd (IMM32.@)
1279 *
1280 * Used with CtfImmRestoreToolbarWnd.
1281 */
1284{
1285 ITfLangBarMgr *pBarMgr;
1286 DWORD dwShowFlags = 0;
1287 BOOL bShown;
1288
1289 TRACE("()\n");
1290
1291 if (FAILED(Imm32TF_CreateLangBarMgr(&pBarMgr)))
1292 return dwShowFlags;
1293
1294 if (SUCCEEDED(pBarMgr->lpVtbl->GetShowFloatingStatus(pBarMgr, &dwShowFlags)))
1295 {
1296 bShown = !(dwShowFlags & 0x800);
1297 dwShowFlags &= 0xF;
1298 if (bShown)
1299 pBarMgr->lpVtbl->ShowFloating(pBarMgr, 8);
1300 }
1301
1302 pBarMgr->lpVtbl->Release(pBarMgr);
1303 return dwShowFlags;
1304}
1305
1306/***********************************************************************
1307 * CtfImmRestoreToolbarWnd (IMM32.@)
1308 *
1309 * Used with CtfImmHideToolbarWnd.
1310 */
1313 _In_ LPVOID pUnused,
1314 _In_ DWORD dwShowFlags)
1315{
1316 HRESULT hr;
1317 ITfLangBarMgr *pBarMgr;
1318
1319 UNREFERENCED_PARAMETER(pUnused);
1320
1321 TRACE("(%p, 0x%X)\n", pUnused, dwShowFlags);
1322
1323 hr = Imm32TF_CreateLangBarMgr(&pBarMgr);
1325 return;
1326
1327 if (dwShowFlags)
1328 pBarMgr->lpVtbl->ShowFloating(pBarMgr, dwShowFlags);
1329
1330 pBarMgr->lpVtbl->Release(pBarMgr);
1331}
1332
1333/***********************************************************************
1334 * CtfImmDispatchDefImeMessage (IMM32.@)
1335 */
1338 _In_ HWND hWnd,
1339 _In_ UINT uMsg,
1342{
1343 TRACE("(%p, %u, %p, %p)\n", hWnd, uMsg, wParam, lParam);
1344
1346 return 0;
1347
1348 return CTF_IME_FN(CtfImeDispatchDefImeMessage)(hWnd, uMsg, wParam, lParam);
1349}
1350
1351/***********************************************************************
1352 * CtfImmIsGuidMapEnable (IMM32.@)
1353 */
1356 _In_ HIMC hIMC)
1357{
1359 HKL hKL;
1360 PIMEDPI pImeDpi;
1361 BOOL ret = FALSE;
1362
1363 TRACE("(%p)\n", hIMC);
1364
1365 if (!IS_CICERO_MODE() || IS_16BIT_MODE())
1366 return ret;
1367
1370
1371 if (IS_IME_HKL(hKL))
1372 return ret;
1373
1374 pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1375 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
1376 return ret;
1377
1378 ret = pImeDpi->CtfImeIsGuidMapEnable(hIMC);
1379
1380 ImmUnlockImeDpi(pImeDpi);
1381 return ret;
1382}
1383
1384/***********************************************************************
1385 * CtfImmGetGuidAtom (IMM32.@)
1386 */
1389 _In_ HIMC hIMC,
1390 _In_ DWORD dwUnknown,
1391 _Out_ LPDWORD pdwGuidAtom)
1392{
1393 HRESULT hr = E_FAIL;
1394 PIMEDPI pImeDpi;
1396 HKL hKL;
1397
1398 TRACE("(%p, 0xlX, %p)\n", hIMC, dwUnknown, pdwGuidAtom);
1399
1400 *pdwGuidAtom = 0;
1401
1402 if (!IS_CICERO_MODE() || IS_16BIT_MODE())
1403 return hr;
1404
1407 if (IS_IME_HKL(hKL))
1408 return S_OK;
1409
1410 pImeDpi = Imm32FindOrLoadImeDpi(hKL);
1411 if (IS_NULL_UNEXPECTEDLY(pImeDpi))
1412 return hr;
1413
1414 hr = pImeDpi->CtfImeGetGuidAtom(hIMC, dwUnknown, pdwGuidAtom);
1415
1416 ImmUnlockImeDpi(pImeDpi);
1417 return hr;
1418}
#define VOID
Definition: acefi.h:82
HWND hWnd
Definition: settings.c:17
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
DWORD dwReason
Definition: misc.cpp:154
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define ULongToHandle(h)
Definition: basetsd.h:81
#define STDMETHODIMP
Definition: basetyps.h:43
#define STDMETHODIMP_(t)
Definition: basetyps.h:44
const GUID IID_IUnknown
#define ERR(fmt,...)
Definition: debug.h:110
#define RegCloseKey(hKey)
Definition: registry.h:49
Definition: bufpool.h:45
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
HRESULT WINAPI CtfAImmActivate(_Out_opt_ HINSTANCE *phinstCtfIme)
Definition: ctf.c:998
static const IInitializeSpyVtbl g_vtblISPY
Definition: ctf.c:566
static STDMETHODIMP ISPY_PostUninitialize(_In_ IInitializeSpy *pThis, _In_ DWORD dwNewThreadAptRefs)
Definition: ctf.c:556
#define OLE32_FN(name)
Definition: ctf.c:119
static DWORD Imm32IncCoInitCountSkip(VOID)
Definition: ctf.c:362
VOID Imm32CoUninitialize(VOID)
Definition: ctf.c:142
static IMMTLSDATA * Imm32AllocateTLS(VOID)
Definition: ctf.c:317
HRESULT WINAPI CtfImmLastEnabledWndDestroy(_In_ BOOL bCreate)
Definition: ctf.c:985
VOID WINAPI CtfImmEnterCoInitCountSkipMode(VOID)
Definition: ctf.c:402
HRESULT CtfImeDestroyInputContext(_In_ HIMC hIMC)
Definition: ctf.c:838
VOID WINAPI CtfImmRestoreToolbarWnd(_In_ LPVOID pUnused, _In_ DWORD dwShowFlags)
Definition: ctf.c:1312
BOOL WINAPI CtfImmIsCiceroStartedInThread(VOID)
Definition: ctf.c:788
HINSTANCE g_hOle32
Definition: ctf.c:117
HRESULT CtfImeCreateInputContext(_In_ HIMC hIMC)
Definition: ctf.c:823
LRESULT WINAPI CtfImmDispatchDefImeMessage(_In_ HWND hWnd, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: ctf.c:1337
VOID WINAPI CtfImmSetAppCompatFlags(_In_ DWORD dwFlags)
Definition: ctf.c:812
static STDMETHODIMP ISPY_PreUninitialize(_Inout_ IInitializeSpy *pThis, _In_ DWORD dwCurThreadAptRefs)
Definition: ctf.c:536
HRESULT(WINAPI * FN_CoInitializeEx)(LPVOID, DWORD)
Definition: ctf.c:121
#define Imm32GetOle32Fn(func_name)
Definition: ctf.c:131
static BOOL Imm32IsRunningInMsoobe(VOID)
Definition: ctf.c:49
HRESULT CtfImeCreateThreadMgr(VOID)
Definition: ctf.c:744
HRESULT CtfImmCoInitialize(VOID)
Definition: ctf.c:595
struct ISPY * PISPY
HRESULT CtfImeDestroyThreadMgr(VOID)
Definition: ctf.c:758
HRESULT WINAPI CtfImmTIMActivate(_In_ HKL hKL)
Definition: ctf.c:1112
BOOL WINAPI CtfImmGenerateMessage(_In_ HIMC hIMC, _In_ BOOL bSend)
Definition: ctf.c:1193
static ISPY * Imm32AllocIMMISPY(VOID)
Definition: ctf.c:578
VOID WINAPI CtfImmCoUninitialize(VOID)
Definition: ctf.c:635
static DWORD Imm32GetCoInitCountSkip(VOID)
Definition: ctf.c:352
HRESULT CtfImmTIMCreateInputContext(_In_ HIMC hIMC)
Definition: ctf.c:928
static STDMETHODIMP ISPY_PostInitialize(_Inout_ IInitializeSpy *pThis, _In_ HRESULT hrCoInit, _In_ DWORD dwCoInit, _In_ DWORD dwNewThreadAptRefs)
Definition: ctf.c:512
#define Imm32GetMsctfFn(func_name)
Definition: ctf.c:180
BOOL WINAPI CtfImmIsCiceroEnabled(VOID)
Definition: ctf.c:1057
VOID Imm32TF_InvalidAssemblyListCacheIfExist(VOID)
Definition: ctf.c:193
static BOOL Imm32IsTIMDisabledInRegistry(VOID)
Definition: ctf.c:866
#define Imm32DeleteIMMISPY(pSpy)
Definition: ctf.c:589
BOOL WINAPI BaseCheckAppcompatCache(_In_z_ LPCWSTR ApplicationName, _In_ HANDLE FileHandle, _In_opt_z_ LPCWSTR Environment, _Out_ PULONG pdwReason)
HRESULT Imm32ActivateOrDeactivateTIM(_In_ BOOL bCreate)
Definition: ctf.c:884
BOOL WINAPI ImmDisableTextFrameService(_In_ DWORD dwThreadId)
Definition: ctf.c:1077
static STDMETHODIMP ISPY_PreInitialize(_Inout_ IInitializeSpy *pThis, _In_ DWORD dwCoInit, _In_ DWORD dwCurThreadAptRefs)
Definition: ctf.c:490
#define MSCTF_FN(name)
Definition: ctf.c:172
VOID(WINAPI * FN_CoUninitialize)(VOID)
Definition: ctf.c:122
VOID(WINAPI * FN_TF_InvalidAssemblyListCacheIfExist)(VOID)
Definition: ctf.c:175
BOOL WINAPI CtfImmIsGuidMapEnable(_In_ HIMC hIMC)
Definition: ctf.c:1355
DWORD WINAPI CtfImmHideToolbarWnd(VOID)
Definition: ctf.c:1283
BOOL WINAPI CtfImmIsTextFrameServiceDisabled(VOID)
Definition: ctf.c:1068
struct IMMTLSDATA * PIMMTLSDATA
HRESULT(WINAPI * FN_CoRegisterInitializeSpy)(IInitializeSpy *, ULARGE_INTEGER *)
Definition: ctf.c:123
static DWORD Imm32DecCoInitCountSkip(VOID)
Definition: ctf.c:380
static BOOL Imm32IsCUASEnabledInRegistry(VOID)
Definition: ctf.c:65
static IMMTLSDATA * Imm32GetTLS(VOID)
Definition: ctf.c:342
HRESULT CtfImmTIMDestroyInputContext(_In_ HIMC hIMC)
Definition: ctf.c:918
HRESULT Imm32CoRevokeInitializeSpy(ULARGE_INTEGER cookie)
Definition: ctf.c:158
static BOOL Imm32InsideLoaderLock(VOID)
Definition: ctf.c:20
HRESULT WINAPI CtfAImmDeactivate(_In_ BOOL bDestroy)
Definition: ctf.c:1033
HRESULT Imm32CoInitializeEx(VOID)
Definition: ctf.c:134
HRESULT(WINAPI * FN_TF_CreateLangBarMgr)(ITfLangBarMgr **)
Definition: ctf.c:174
BOOL WINAPI CtfImmLeaveCoInitCountSkipMode(VOID)
Definition: ctf.c:416
HINSTANCE Imm32LoadCtfIme(VOID)
Definition: ctf.c:668
HRESULT(WINAPI * FN_CoRevokeInitializeSpy)(ULARGE_INTEGER)
Definition: ctf.c:124
BOOL g_disable_CUAS_flag
Definition: ctf.c:221
static BOOL CALLBACK Imm32EnumCreateCtfICProc(_In_ HIMC hIMC, _In_ LPARAM lParam)
Definition: ctf.c:852
HRESULT WINAPI CtfImmGetGuidAtom(_In_ HIMC hIMC, _In_ DWORD dwUnknown, _Out_ LPDWORD pdwGuidAtom)
Definition: ctf.c:1388
VOID WINAPI CtfImmSetCiceroStartInThread(_In_ BOOL bStarted)
Definition: ctf.c:797
BOOL WINAPI CtfAImmIsIME(_In_ HKL hKL)
Definition: ctf.c:774
static STDMETHODIMP ISPY_QueryInterface(_Inout_ IInitializeSpy *pThis, _In_ REFIID riid, _Inout_ LPVOID *ppvObj)
Definition: ctf.c:443
HINSTANCE g_hMsctf
Definition: ctf.c:170
HRESULT Imm32CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cookie)
Definition: ctf.c:150
#define CTF_IME_FN(func_name)
Definition: ctf.c:239
BOOL(WINAPI * FN_ApphelpCheckIME)(_In_z_ LPCWSTR AppName)
Definition: ctf.c:242
DWORD g_aimm_compat_flags
Definition: ctf.c:218
DWORD g_dwTLSIndex
Definition: ctf.c:291
static BOOL Imm32IsInteractiveUserLogon(VOID)
Definition: ctf.c:27
static VOID Imm32InitTLS(VOID)
Definition: ctf.c:306
BOOL Imm32GetFn(_Inout_opt_ FARPROC *ppfn, _Inout_ HINSTANCE *phinstDLL, _In_ LPCWSTR pszDllName, _In_ LPCSTR pszFuncName)
Definition: ctf.c:87
BOOL Imm32CheckAndApplyAppCompat(_In_ ULONG dwReason, _In_z_ LPCWSTR pszAppName)
Definition: ctf.c:256
HRESULT Imm32TF_CreateLangBarMgr(_Inout_ ITfLangBarMgr **ppBarMgr)
Definition: ctf.c:183
HINSTANCE g_hCtfIme
Definition: ctf.c:224
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
static CHAR AppName[MAX_PATH]
Definition: dem.c:252
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD HIMC
Definition: dimm.idl:75
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOLEAN NTAPI RtlIsThreadWithinLoaderCallout(VOID)
Definition: libsupp.c:345
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3288
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4123
BOOL WINAPI CheckTokenMembership(IN HANDLE ExistingTokenHandle, IN PSID SidToCheck, OUT PBOOL IsMember)
Definition: token.c:21
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
Definition: security.c:674
PVOID WINAPI FreeSid(PSID pSid)
Definition: security.c:698
int(* FARPROC)()
Definition: compat.h:36
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define FreeLibrary(x)
Definition: compat.h:748
#define MAX_PATH
Definition: compat.h:34
#define CALLBACK
Definition: compat.h:35
#define LoadLibraryW(x)
Definition: compat.h:747
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
BOOL WINAPI ImmIsIME(HKL hKL)
Definition: ime.c:880
VOID WINAPI ImmUnlockImeDpi(PIMEDPI pImeDpi)
Definition: ime.c:1016
RTL_CRITICAL_SECTION gcsImeDpi
Definition: ime.c:16
PIMEDPI APIENTRY Imm32FindOrLoadImeDpi(HKL hKL)
Definition: ime.c:343
BOOL WINAPI ImmLoadIME(HKL hKL)
Definition: ime.c:1064
BOOL WINAPI ImmUnlockIMC(HIMC hIMC)
Definition: imm.c:1079
BOOL WINAPI ImmLoadLayout(HKL hKL, PIMEINFOEX pImeInfoEx)
Definition: imm.c:68
VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc)
Definition: imm.c:996
PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc)
Definition: imm.c:950
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC)
Definition: imm.c:1070
BOOL WINAPI ImmEnumInputContext(DWORD dwThreadId, IMCENUMPROC lpfn, LPARAM lParam)
Definition: imm.c:1109
LPVOID APIENTRY ImmLocalAlloc(DWORD dwFlags, DWORD dwBytes)
Definition: utils.c:415
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:122
#define ImmLocalFree(lpData)
Definition: precomp.h:90
BOOL Imm32GetSystemLibraryPath(LPWSTR pszPath, DWORD cchPath, LPCWSTR pszFileName)
Definition: utils.c:286
#define IS_NULL_UNEXPECTEDLY(p)
Definition: precomp.h:126
#define IS_FALSE_UNEXPECTEDLY(x)
Definition: precomp.h:138
BOOL WINAPI ImmUnlockIMCC(HIMCC imcc)
Definition: utils.c:1208
LPVOID WINAPI ImmLockIMCC(HIMCC imcc)
Definition: utils.c:1198
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1106
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1240
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1100
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1276
HRESULT WINAPI CoRegisterInitializeSpy(IInitializeSpy *spy, ULARGE_INTEGER *cookie)
Definition: compobj.c:1832
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
HRESULT WINAPI CoRevokeInitializeSpy(ULARGE_INTEGER cookie)
Definition: compobj.c:1891
static BOOLEAN bSuccess
Definition: drive.cpp:433
DWORD dwThreadId
Definition: fdebug.c:31
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
FxAutoRegKey hKey
struct _tagTRANSMSG * LPTRANSMSG
struct _tagTRANSMSG TRANSMSG
struct _tagINPUTCONTEXT * LPINPUTCONTEXT
struct _tagTRANSMSG * PTRANSMSG
#define CLIENTIMC_WIDE
Definition: immdev.h:337
#define CI_AIMMACTIVATED
Definition: ntuser.h:309
#define CI_CTFTIM
Definition: ntuser.h:307
#define CI_TSFDISABLED
Definition: ntuser.h:308
DWORD_PTR NTAPI NtUserQueryInputContext(HIMC hIMC, DWORD dwType)
Definition: ime.c:1791
#define IS_16BIT_MODE()
Definition: ntuser.h:1237
#define IS_CICERO_MODE()
Definition: ntuser.h:1236
#define GetWin32ClientInfo()
Definition: ntuser.h:350
#define CI_CTFCOINIT
Definition: ntuser.h:306
REFIID riid
Definition: atlbase.h:39
NTSYSAPI BOOLEAN WINAPI RtlDllShutdownInProgress(void)
Definition: ldrapi.c:1597
HRESULT GetShowFloatingStatus([out] DWORD *pdwFlags)
HRESULT ShowFloating([in] DWORD dwFlags)
ULONG Release()
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define NtCurrentTeb
#define IS_IME_HKL(hKL)
Definition: kbswitch.c:32
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define error(str)
Definition: mkdosfs.c:1605
LPCWSTR szPath
Definition: env.c:37
PVOID PVOID PWCHAR PVOID Environment
Definition: env.c:47
PVOID PVOID PWCHAR ApplicationName
Definition: env.c:47
static PSID pSid
Definition: security.c:74
static HANDLE ULONG_PTR dwData
Definition: file.c:35
static DWORD dwCoInit
Definition: compobj.c:73
struct _ULARGE_INTEGER ULARGE_INTEGER
#define _Out_opt_
Definition: ms_sal.h:346
#define _Inout_
Definition: ms_sal.h:378
#define _In_z_
Definition: ms_sal.h:313
#define _In_opt_z_
Definition: ms_sal.h:314
#define _Inout_opt_
Definition: ms_sal.h:379
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
HRESULT WINAPI TF_CreateLangBarMgr(ITfLangBarMgr **pppbm)
Definition: msctf.c:686
HRESULT WINAPI TF_InvalidAssemblyListCacheIfExist(void)
Definition: msctf.c:677
UINT_PTR HKL
Definition: msctf.idl:104
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
#define LPVOID
Definition: nt_native.h:45
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define L(x)
Definition: ntvdm.h:50
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
#define LOWORD(l)
Definition: pedump.c:82
long LONG
Definition: pedump.c:60
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define REG_DWORD
Definition: sdbapi.c:596
HRESULT hr
Definition: shlfolder.c:183
_In_ int _In_ BOOL bCreate
Definition: shlobj.h:1511
#define _countof(array)
Definition: sndvol32.h:68
#define TRACE(s)
Definition: solgame.cpp:4
char * pszDllName
Definition: spec2def.c:73
Definition: immdev.h:261
BOOL bDoCount
Definition: ctf.c:299
DWORD dwUnknown2
Definition: ctf.c:302
DWORD dwUnknown1
Definition: ctf.c:297
ULARGE_INTEGER uliCookie
Definition: ctf.c:298
DWORD dwSkipCount
Definition: ctf.c:300
BOOL bUninitializing
Definition: ctf.c:301
IInitializeSpy * pSpy
Definition: ctf.c:296
Definition: ctf.c:437
LONG m_cRefs
Definition: ctf.c:439
const IInitializeSpyVtbl * m_pSpyVtbl
Definition: ctf.c:438
HIMCC hMsgBuf
Definition: immdev.h:89
DWORD dwNumMsgBuf
Definition: immdev.h:88
LPARAM lParam
Definition: imm32.c:68
WPARAM wParam
Definition: imm32.c:67
UINT message
Definition: imm32.c:66
Definition: cookie.c:34
BOOL bCtfIme
Definition: immdev.h:322
DWORD dwFlags
Definition: immdev.h:317
WCHAR wszImeFile[80]
Definition: ntuser.h:1218
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
uint32_t * PULONG
Definition: typedefs.h:59
uint32_t DWORD_PTR
Definition: typedefs.h:65
unsigned char * LPBYTE
Definition: typedefs.h:53
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t * LPDWORD
Definition: typedefs.h:59
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define MAKELONG(a, b)
Definition: typedefs.h:249
uint32_t ULONG
Definition: typedefs.h:59
@ QIC_INPUTTHREADID
Definition: undocuser.h:393
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HKL WINAPI GetKeyboardLayout(_In_ DWORD)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SECURITY_INTERACTIVE_RID
Definition: setypes.h:559
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:554
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185