ReactOS 0.4.15-dev-7968-g24a56f8
misc.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CModeBias
 
class  CFunctionProviderBase
 
class  CFunctionProvider
 
class  CFnDocFeed
 

Functions

BOOLEAN DllShutdownInProgress (VOID)
 
BOOL IsEALang (_In_opt_ LANGID LangID)
 
BOOL IsInteractiveUserLogon (VOID)
 
BYTE GetCharsetFromLangId (_In_ DWORD dwValue)
 
HIMC GetActiveContext (VOID)
 
BOOL MsimtfIsGuidMapEnable (_In_ HIMC hIMC, _Out_opt_ LPBOOL pbValue)
 @implemented
 
BOOL IsVKDBEKey (_In_ UINT uVirtKey)
 @implemented
 
ITfCategoryMgrGetUIMCat (PCIC_LIBTHREAD pLibThread)
 @implemented
 
HRESULT InitDisplayAttrbuteLib (PCIC_LIBTHREAD pLibThread)
 @implemented
 
HRESULT UninitDisplayAttrbuteLib (PCIC_LIBTHREAD pLibThread)
 @implemented
 
HRESULT GetCompartment (IUnknown *pUnknown, REFGUID rguid, ITfCompartment **ppComp, BOOL bThread)
 @implemented
 
HRESULT SetCompartmentDWORD (TfEditCookie cookie, IUnknown *pUnknown, REFGUID rguid, DWORD dwValue, BOOL bThread)
 @implemented
 
HRESULT GetCompartmentDWORD (IUnknown *pUnknown, REFGUID rguid, LPDWORD pdwValue, BOOL bThread)
 @implemented
 
HRESULT SetCompartmentUnknown (TfEditCookie cookie, IUnknown *pUnknown, REFGUID rguid, IUnknown *punkValue)
 @implemented
 
HRESULT ClearCompartment (TfClientId tid, IUnknown *pUnknown, REFGUID rguid, BOOL bThread)
 @implemented
 

Function Documentation

◆ ClearCompartment()

HRESULT ClearCompartment ( TfClientId  tid,
IUnknown pUnknown,
REFGUID  rguid,
BOOL  bThread 
)

@implemented

Definition at line 331 of file misc.cpp.

336{
338 ITfThreadMgr *pThreadMgr = NULL;
339
340 HRESULT hr;
341 if (bThread)
342 {
343 hr = pUnknown->QueryInterface(IID_ITfThreadMgr, (void **)&pThreadMgr);
344 if (FAILED(hr))
345 return hr;
346
347 hr = pThreadMgr->GetGlobalCompartment(&pCompMgr);
348 }
349 else
350 {
351 hr = pUnknown->QueryInterface(IID_ITfCompartmentMgr, (void **)&pCompMgr);
352 }
353
354 if (SUCCEEDED(hr))
355 {
356 hr = E_FAIL;
357 if (pCompMgr)
358 {
359 hr = pCompMgr->ClearCompartment(tid, rguid);
360 pCompMgr->Release();
361 }
362 }
363
364 if (pThreadMgr)
365 pThreadMgr->Release();
366
367 return hr;
368}
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
nsrefcnt Release()
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static TfClientId tid
static nsIComponentManager * pCompMgr
Definition: nsembed.c:62
HRESULT hr
Definition: shlfolder.c:183

Referenced by CicInputContext::DestroyInputContext().

◆ DllShutdownInProgress()

BOOLEAN DllShutdownInProgress ( VOID  )

This function calls ntdll!RtlDllShutdownInProgress. It can detect the system is shutting down or not. @implemented

Definition at line 42 of file misc.cpp.

43{
44 HMODULE hNTDLL;
45 static FN_DllShutdownInProgress s_fnDllShutdownInProgress = NULL;
46
47 if (s_fnDllShutdownInProgress)
48 return s_fnDllShutdownInProgress();
49
50 hNTDLL = cicGetSystemModuleHandle(L"ntdll.dll", FALSE);
51 s_fnDllShutdownInProgress =
52 (FN_DllShutdownInProgress)GetProcAddress(hNTDLL, "RtlDllShutdownInProgress");
53 if (!s_fnDllShutdownInProgress)
54 return FALSE;
55
56 return s_fnDllShutdownInProgress();
57}
EXTERN_C HINSTANCE cicGetSystemModuleHandle(_In_ LPCTSTR pszFileName, _In_ BOOL bSysWinDir)
Definition: cicbase.cpp:130
#define FALSE
Definition: types.h:117
BOOLEAN(WINAPI * FN_DllShutdownInProgress)(VOID)
Definition: misc.cpp:37
#define GetProcAddress(x, y)
Definition: compat.h:753
#define L(x)
Definition: ntvdm.h:50

Referenced by TLS::InternalAllocateTLS(), and CFunctionProviderBase::~CFunctionProviderBase().

◆ GetActiveContext()

HIMC GetActiveContext ( VOID  )

Get the active input context. @implemented

Definition at line 94 of file misc.cpp.

95{
96 HWND hwndFocus = ::GetFocus();
97 if (!hwndFocus)
98 hwndFocus = ::GetActiveWindow();
99 return ::ImmGetContext(hwndFocus);
100}
HWND WINAPI GetFocus(void)
Definition: window.c:1893
HWND WINAPI GetActiveWindow(void)
Definition: winpos.c:138

Referenced by CFnDocFeed::ClearDocFeedBuffer(), CFnDocFeed::DocFeed(), CFnDocFeed::StartReconvert(), and CFnDocFeed::StartUndoCompositionString().

◆ GetCharsetFromLangId()

BYTE GetCharsetFromLangId ( _In_ DWORD  dwValue)

Gets the charset from a language ID. @implemented

Definition at line 84 of file misc.cpp.

85{
88 return 0;
89 return info.ciCharset;
90}
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define TCI_SRCLOCALE
Definition: wingdi.h:964
BOOL WINAPI TranslateCharsetInfo(_Inout_ PDWORD, _Out_ LPCHARSETINFO, _In_ DWORD)

Referenced by InternalSelectEx().

◆ GetCompartment()

HRESULT GetCompartment ( IUnknown pUnknown,
REFGUID  rguid,
ITfCompartment **  ppComp,
BOOL  bThread 
)

@implemented

Definition at line 219 of file misc.cpp.

224{
225 *ppComp = NULL;
226
227 ITfThreadMgr *pThreadMgr = NULL;
229
230 HRESULT hr;
231 if (bThread)
232 {
233 hr = pUnknown->QueryInterface(IID_ITfThreadMgr, (void **)&pThreadMgr);
234 if (FAILED(hr))
235 return hr;
236
237 hr = pThreadMgr->GetGlobalCompartment(&pCompMgr);
238 }
239 else
240 {
241 hr = pUnknown->QueryInterface(IID_ITfCompartmentMgr, (void **)&pCompMgr);
242 }
243
244 if (SUCCEEDED(hr))
245 {
246 hr = E_FAIL;
247 if (pCompMgr)
248 {
249 hr = pCompMgr->GetCompartment(rguid, ppComp);
250 pCompMgr->Release();
251 }
252 }
253
254 if (pThreadMgr)
255 pThreadMgr->Release();
256
257 return hr;
258}

Referenced by CCompartmentEventSink::_Advise(), GetCompartmentDWORD(), SetCompartmentDWORD(), and SetCompartmentUnknown().

◆ GetCompartmentDWORD()

HRESULT GetCompartmentDWORD ( IUnknown pUnknown,
REFGUID  rguid,
LPDWORD  pdwValue,
BOOL  bThread 
)

@implemented

Definition at line 285 of file misc.cpp.

290{
291 *pdwValue = 0;
292
293 ITfCompartment *pComp = NULL;
294 HRESULT hr = GetCompartment(pUnknown, rguid, &pComp, bThread);
295 if (FAILED(hr))
296 return hr;
297
298 VARIANT vari;
299 hr = pComp->GetValue(&vari);
300 if (hr == S_OK)
301 *pdwValue = V_I4(&vari);
302
303 pComp->Release();
304 return hr;
305}
HRESULT GetCompartment(IUnknown *pUnknown, REFGUID rguid, ITfCompartment **ppComp, BOOL bThread)
@implemented
Definition: misc.cpp:219
HRESULT GetValue([out] VARIANT *pvarValue)
ULONG Release()
#define S_OK
Definition: intsafe.h:52
#define V_I4(A)
Definition: oleauto.h:247

Referenced by CicBridge::IsOwnDim().

◆ GetUIMCat()

ITfCategoryMgr * GetUIMCat ( PCIC_LIBTHREAD  pLibThread)

@implemented

Definition at line 129 of file misc.cpp.

130{
131 if (!pLibThread)
132 return NULL;
133
134 if (pLibThread->m_pCategoryMgr)
135 return pLibThread->m_pCategoryMgr;
136
137 if (FAILED(cicCoCreateInstance(CLSID_TF_CategoryMgr, NULL, CLSCTX_INPROC_SERVER,
138 IID_ITfCategoryMgr, (void **)&pLibThread->m_pCategoryMgr)))
139 {
140 return NULL;
141 }
142 return pLibThread->m_pCategoryMgr;
143}
HRESULT cicCoCreateInstance(_In_ REFCLSID rclsid, _In_ LPUNKNOWN pUnkOuter, _In_ DWORD dwClsContext, _In_ REFIID iid, _Out_ LPVOID *ppv)
Definition: cicbase.cpp:231
EXTERN_C const CLSID CLSID_TF_CategoryMgr
Definition: msctf.idl:84
ITfCategoryMgr * m_pCategoryMgr
Definition: cicutb.h:25

Referenced by LibEnumItemsInCategory().

◆ InitDisplayAttrbuteLib()

HRESULT InitDisplayAttrbuteLib ( PCIC_LIBTHREAD  pLibThread)

@implemented

Definition at line 156 of file misc.cpp.

157{
158 if (!pLibThread)
159 return E_FAIL;
160
161 if (pLibThread->m_pDisplayAttrMgr)
162 {
163 pLibThread->m_pDisplayAttrMgr->Release();
164 pLibThread->m_pDisplayAttrMgr = NULL;
165 }
166
168 IID_ITfDisplayAttributeMgr,
169 (void **)&pLibThread->m_pDisplayAttrMgr)))
170 {
171 return E_FAIL;
172 }
173
174 IEnumGUID *pEnumGuid;
175 LibEnumItemsInCategory(pLibThread, GUID_TFCAT_DISPLAYATTRIBUTEPROPERTY, &pEnumGuid);
176
178
180 if (pEnumGuid && !g_pPropCache)
181 {
183 if (g_pPropCache)
184 {
186 GUID guid;
187 while (pEnumGuid->Next(1, &guid, NULL) == S_OK)
188 {
191 }
192 hr = S_OK;
193 }
194 }
196
197 return hr;
198}
#define cicNoThrow
Definition: cicbase.h:34
BOOL Add(const T_ITEM &item)
Definition: cicarray.h:60
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT LibEnumItemsInCategory(PCIC_LIBTHREAD pLibThread, REFGUID rguid, IEnumGUID **ppEnum)
@implemented
Definition: misc.cpp:147
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] GUID *rgelt, [out] ULONG *pceltFetched)
const GUID * guid
EXTERN_C const GUID GUID_PROP_ATTRIBUTE
Definition: msctf.idl:76
EXTERN_C const CLSID CLSID_TF_DisplayAttributeMgr
Definition: msctf.idl:85
CRITICAL_SECTION g_csLock
Definition: msctfime.cpp:17
CDispAttrPropCache * g_pPropCache
Definition: msctfime.cpp:18
CicArray< GUID > CDispAttrPropCache
Definition: msctfime.h:41
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
ITfDisplayAttributeMgr * m_pDisplayAttrMgr
Definition: cicutb.h:26
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by CicBridge::InitIMMX().

◆ IsEALang()

BOOL IsEALang ( _In_opt_ LANGID  LangID)

East-Asian language? @implemented

Definition at line 14 of file misc.cpp.

15{
16 if (LangID == 0)
17 {
18 TLS *pTLS = TLS::GetTLS();
19 if (!pTLS || !pTLS->m_pProfile)
20 return FALSE;
21
23 }
24
25 switch (PRIMARYLANGID(LangID))
26 {
27 case LANG_CHINESE:
28 case LANG_JAPANESE:
29 case LANG_KOREAN:
30 return TRUE;
31
32 default:
33 return FALSE;
34 }
35}
HRESULT GetLangId(_Out_ LANGID *pLangID)
@implemented
Definition: profile.cpp:114
Definition: tls.h:14
static TLS * GetTLS()
@implemented
Definition: tls.cpp:32
CicProfile * m_pProfile
Definition: tls.h:20
#define TRUE
Definition: types.h:120
#define LANG_CHINESE
Definition: nls.h:42
#define LANG_JAPANESE
Definition: nls.h:76
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_KOREAN
Definition: nls.h:84
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083

Referenced by UIComposition::CreateCompButtonWnd(), and CicBridge::SetActiveContextAlways().

◆ IsInteractiveUserLogon()

BOOL IsInteractiveUserLogon ( VOID  )

This function checks if the current user logon session is interactive. @implemented

Definition at line 61 of file misc.cpp.

62{
63 BOOL bOK, IsMember = FALSE;
64 PSID pSid;
66
68 0, 0, 0, 0, 0, 0, 0, &pSid))
69 {
70 ERR("Error: %ld\n", GetLastError());
71 return FALSE;
72 }
73
74 bOK = CheckTokenMembership(NULL, pSid, &IsMember);
75
76 if (pSid)
78
79 return bOK && IsMember;
80}
#define ERR(fmt,...)
Definition: debug.h:110
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
unsigned int BOOL
Definition: ntddk_ex.h:94
static PSID pSid
Definition: security.c:74
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define SECURITY_INTERACTIVE_RID
Definition: setypes.h:559
#define SECURITY_NT_AUTHORITY
Definition: setypes.h:554

Referenced by CtfImeInquireExW().

◆ IsVKDBEKey()

BOOL IsVKDBEKey ( _In_ UINT  uVirtKey)

@implemented

Definition at line 116 of file misc.cpp.

117{
118 switch (uVirtKey)
119 {
120 case VK_KANJI:
121 case VK_CONVERT:
122 return TRUE;
123 default:
124 return (VK_OEM_ATTN <= uVirtKey && uVirtKey <= VK_PA1);
125 }
126}
#define VK_CONVERT
Definition: winuser.h:2215
#define VK_PA1
Definition: winuser.h:2351
#define VK_OEM_ATTN
Definition: winuser.h:2338
#define VK_KANJI
Definition: winuser.h:2213

Referenced by ImeProcessKey().

◆ MsimtfIsGuidMapEnable()

BOOL MsimtfIsGuidMapEnable ( _In_ HIMC  hIMC,
_Out_opt_ LPBOOL  pbValue 
)

@implemented

Definition at line 107 of file misc.cpp.

108{
109 static FN_MsimtfIsGuidMapEnable s_fn = NULL;
110 if (!cicGetFN(g_hMSIMTF, s_fn, L"msimtf.dll", "MsimtfIsGuidMapEnable"))
111 return FALSE;
112 return s_fn(hIMC, pbValue);
113}
HINSTANCE g_hMSIMTF
Definition: misc.cpp:104
BOOL(WINAPI * FN_MsimtfIsGuidMapEnable)(HIMC hIMC, LPBOOL pbValue)
Definition: misc.cpp:103

Referenced by ImeProcessKey().

◆ SetCompartmentDWORD()

HRESULT SetCompartmentDWORD ( TfEditCookie  cookie,
IUnknown pUnknown,
REFGUID  rguid,
DWORD  dwValue,
BOOL  bThread 
)

@implemented

Definition at line 262 of file misc.cpp.

268{
269 ITfCompartment *pComp = NULL;
270 HRESULT hr = GetCompartment(pUnknown, rguid, &pComp, bThread);
271 if (FAILED(hr))
272 return hr;
273
274 VARIANT vari;
275 V_I4(&vari) = dwValue;
276 V_VT(&vari) = VT_I4;
277 hr = pComp->SetValue(cookie, &vari);
278
279 pComp->Release();
280 return hr;
281}
@ VT_I4
Definition: compat.h:2298
HRESULT SetValue([in] TfClientId tid, [in] const VARIANT *pvarValue)
#define V_VT(A)
Definition: oleauto.h:211
Definition: cookie.c:34

Referenced by CicBridge::ActivateIMMX(), and CicBridge::OnSetOpenStatus().

◆ SetCompartmentUnknown()

HRESULT SetCompartmentUnknown ( TfEditCookie  cookie,
IUnknown pUnknown,
REFGUID  rguid,
IUnknown punkValue 
)

@implemented

Definition at line 309 of file misc.cpp.

314{
315 ITfCompartment *pComp = NULL;
316 HRESULT hr = GetCompartment(pUnknown, rguid, &pComp, FALSE);
317 if (FAILED(hr))
318 return hr;
319
320 VARIANT vari;
321 V_UNKNOWN(&vari) = punkValue;
322 V_VT(&vari) = VT_UNKNOWN;
323 hr = pComp->SetValue(cookie, &vari);
324
325 pComp->Release();
326 return hr;
327}
@ VT_UNKNOWN
Definition: compat.h:2308
#define V_UNKNOWN(A)
Definition: oleauto.h:281

◆ UninitDisplayAttrbuteLib()

HRESULT UninitDisplayAttrbuteLib ( PCIC_LIBTHREAD  pLibThread)

@implemented

Definition at line 201 of file misc.cpp.

202{
203 if (!pLibThread)
204 return E_FAIL;
205
206 if (pLibThread->m_pDisplayAttrMgr)
207 {
208 pLibThread->m_pDisplayAttrMgr->Release();
209 pLibThread->m_pDisplayAttrMgr = NULL;
210 }
211
212 return S_OK;
213}

Referenced by CicBridge::UnInitIMMX().