ReactOS 0.4.16-dev-1946-g52006dd
cicbase.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CicNoThrow
 

Macros

#define cicNoThrow   CicNoThrow{}
 
#define CIC_OSINFO_NT   0x01
 
#define CIC_OSINFO_2KPLUS   0x02
 
#define CIC_OSINFO_95   0x04
 
#define CIC_OSINFO_98PLUS   0x08
 
#define CIC_OSINFO_CJK   0x10
 
#define CIC_OSINFO_IMM   0x20
 
#define CIC_OSINFO_DBCS   0x40
 
#define CIC_OSINFO_XPPLUS   0x80
 

Typedefs

typedef HRESULT(WINAPIFN_CoCreateInstance) (REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
 

Functions

static LPVOID cicMemAlloc (SIZE_T size)
 
static LPVOID cicMemAllocClear (SIZE_T size)
 
static void cicMemFree (LPVOID ptr)
 
static LPVOID cicMemReAlloc (LPVOID ptr, SIZE_T newSize)
 
LPVOID cicMemReCalloc (LPVOID mem, SIZE_T num, SIZE_T size) noexcept
 
static bool cicIsNullPtr (LPCVOID ptr)
 
voidoperator new (size_t size, const CicNoThrow &) noexcept
 
voidoperator new[] (size_t size, const CicNoThrow &) noexcept
 
void operator delete (void *ptr) noexcept
 
void operator delete[] (void *ptr) noexcept
 
void operator delete (void *ptr, size_t size) noexcept
 
void operator delete[] (void *ptr, size_t size) noexcept
 
EXTERN_C void cicGetOSInfo (LPUINT puACP, LPDWORD pdwOSInfo)
 
EXTERN_C HINSTANCE cicGetSystemModuleHandle (_In_ LPCTSTR pszFileName, _In_ BOOL bSysWinDir)
 
EXTERN_C HINSTANCE cicLoadSystemLibrary (_In_ LPCTSTR pszFileName, _In_ BOOL bSysWinDir)
 
EXTERN_C BOOL cicIsWow64 (VOID)
 
EXTERN_C HRESULT cicRealCoCreateInstance (_In_ REFCLSID rclsid, _In_ LPUNKNOWN pUnkOuter, _In_ DWORD dwClsContext, _In_ REFIID iid, _Out_ LPVOID *ppv)
 
EXTERN_C HRESULT cicCoCreateInstance (_In_ REFCLSID rclsid, _In_ LPUNKNOWN pUnkOuter, _In_ DWORD dwClsContext, _In_ REFIID iid, _Out_ LPVOID *ppv)
 
EXTERN_C BOOL TFInitLib (FN_CoCreateInstance fnCoCreateInstance=NULL)
 
EXTERN_C VOID TFUninitLib (VOID)
 

Macro Definition Documentation

◆ CIC_OSINFO_2KPLUS

#define CIC_OSINFO_2KPLUS   0x02

Definition at line 57 of file cicbase.h.

◆ CIC_OSINFO_95

#define CIC_OSINFO_95   0x04

Definition at line 58 of file cicbase.h.

◆ CIC_OSINFO_98PLUS

#define CIC_OSINFO_98PLUS   0x08

Definition at line 59 of file cicbase.h.

◆ CIC_OSINFO_CJK

#define CIC_OSINFO_CJK   0x10

Definition at line 60 of file cicbase.h.

◆ CIC_OSINFO_DBCS

#define CIC_OSINFO_DBCS   0x40

Definition at line 62 of file cicbase.h.

◆ CIC_OSINFO_IMM

#define CIC_OSINFO_IMM   0x20

Definition at line 61 of file cicbase.h.

◆ CIC_OSINFO_NT

#define CIC_OSINFO_NT   0x01

Definition at line 56 of file cicbase.h.

◆ CIC_OSINFO_XPPLUS

#define CIC_OSINFO_XPPLUS   0x80

Definition at line 63 of file cicbase.h.

◆ cicNoThrow

#define cicNoThrow   CicNoThrow{}

Definition at line 46 of file cicbase.h.

Typedef Documentation

◆ FN_CoCreateInstance

typedef HRESULT(WINAPI * FN_CoCreateInstance) (REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)

Definition at line 137 of file cicbase.h.

Function Documentation

◆ cicCoCreateInstance()

EXTERN_C HRESULT cicCoCreateInstance ( _In_ REFCLSID  rclsid,
_In_ LPUNKNOWN  pUnkOuter,
_In_ DWORD  dwClsContext,
_In_ REFIID  iid,
_Out_ LPVOID ppv 
)

@implemented

Definition at line 250 of file cicbase.cpp.

256{
257 // NOTE: It looks like Cicero wants to hook CoCreateInstance
259 if (fnUserCoCreateInstance)
260 return fnUserCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv);
261
262 return cicRealCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv);
263}
EXTERN_C HRESULT cicRealCoCreateInstance(_In_ REFCLSID rclsid, _In_ LPUNKNOWN pUnkOuter, _In_ DWORD dwClsContext, _In_ REFIID iid, _Out_ LPVOID *ppv)
Definition: cicbase.cpp:225
static FN_CoCreateInstance _cicGetSetUserCoCreateInstance(FN_CoCreateInstance fnUserCoCreateInstance)
Definition: cicbase.cpp:215
HRESULT(WINAPI * FN_CoCreateInstance)(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: cicbase.h:137
#define NULL
Definition: types.h:112
REFIID LPVOID * ppv
Definition: atlbase.h:39

Referenced by GetUIMCat(), and InitDisplayAttrbuteLib().

◆ cicGetOSInfo()

EXTERN_C void cicGetOSInfo ( LPUINT  puACP,
LPDWORD  pdwOSInfo 
)

Definition at line 101 of file cicbase.cpp.

102{
103 *pdwOSInfo = 0;
104
105 /* Check OS version info */
106 OSVERSIONINFO VerInfo;
107 VerInfo.dwOSVersionInfoSize = sizeof(VerInfo);
108 GetVersionEx(&VerInfo);
109 if (VerInfo.dwPlatformId == DLLVER_PLATFORM_NT)
110 {
111 *pdwOSInfo |= CIC_OSINFO_NT;
112 if (VerInfo.dwMajorVersion >= 5)
113 {
114 *pdwOSInfo |= CIC_OSINFO_2KPLUS;
115 if (VerInfo.dwMinorVersion > 0)
116 *pdwOSInfo |= CIC_OSINFO_XPPLUS;
117 }
118 }
119 else
120 {
121 if (VerInfo.dwMinorVersion >= 10)
122 *pdwOSInfo |= CIC_OSINFO_98PLUS;
123 else
124 *pdwOSInfo |= CIC_OSINFO_95;
125 }
126
127 /* Check codepage */
128 *puACP = GetACP();
129 switch (*puACP)
130 {
131 case 932: /* Japanese (Japan) */
132 case 936: /* Chinese (PRC, Singapore) */
133 case 949: /* Korean (Korea) */
134 case 950: /* Chinese (Taiwan, Hong Kong) */
135 *pdwOSInfo |= CIC_OSINFO_CJK;
136 break;
137 }
138
139 if (GetSystemMetrics(SM_IMMENABLED))
140 *pdwOSInfo |= CIC_OSINFO_IMM;
141
143 *pdwOSInfo |= CIC_OSINFO_DBCS;
144}
#define CIC_OSINFO_IMM
Definition: cicbase.h:61
#define CIC_OSINFO_NT
Definition: cicbase.h:56
#define CIC_OSINFO_DBCS
Definition: cicbase.h:62
#define CIC_OSINFO_2KPLUS
Definition: cicbase.h:57
#define CIC_OSINFO_XPPLUS
Definition: cicbase.h:63
#define CIC_OSINFO_95
Definition: cicbase.h:58
#define CIC_OSINFO_CJK
Definition: cicbase.h:60
#define CIC_OSINFO_98PLUS
Definition: cicbase.h:59
UINT WINAPI GetACP(void)
Definition: locale.c:2023
#define DLLVER_PLATFORM_NT
Definition: shlwapi.h:117
ULONG dwPlatformId
Definition: rtltypes.h:241
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
ULONG dwMajorVersion
Definition: rtltypes.h:238
ULONG dwMinorVersion
Definition: rtltypes.h:239
#define GetVersionEx
Definition: winbase.h:3601
#define SM_DBCSENABLED
Definition: winuser.h:1016
int WINAPI GetSystemMetrics(_In_ int)

Referenced by InitApp(), and ProcessAttach().

◆ cicGetSystemModuleHandle()

EXTERN_C HINSTANCE cicGetSystemModuleHandle ( _In_ LPCTSTR  pszFileName,
_In_ BOOL  bSysWinDir 
)

Definition at line 149 of file cicbase.cpp.

152{
153 CicSystemModulePath ModPath;
154 if (!ModPath.Init(pszFileName, bSysWinDir))
155 return NULL;
156 return GetModuleHandle(ModPath.m_szPath);
157}
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44
#define GetModuleHandle
Definition: winbase.h:3576

Referenced by CheckX64System(), cicIsWow64(), DelayedRegNotifyChangeKeyValue(), DllShutdownInProgress(), and InitApp().

◆ cicIsNullPtr()

◆ cicIsWow64()

EXTERN_C BOOL cicIsWow64 ( VOID  )

Definition at line 77 of file cicbase.cpp.

78{
79 static FN_NtQueryInformationProcess s_fnNtQueryInformationProcess = NULL;
81
82 if (!s_fnNtQueryInformationProcess)
83 {
84 HMODULE hNTDLL = cicGetSystemModuleHandle(TEXT("ntdll.dll"), FALSE);
85 if (!hNTDLL)
86 return FALSE;
87
88 s_fnNtQueryInformationProcess =
89 (FN_NtQueryInformationProcess)GetProcAddress(hNTDLL, "NtQueryInformationProcess");
90 if (!s_fnNtQueryInformationProcess)
91 return FALSE;
92 }
93
94 Value = 0;
95 s_fnNtQueryInformationProcess(GetCurrentProcess(), ProcessWow64Information,
96 &Value, sizeof(Value), NULL);
97 return !!Value;
98}
NTSTATUS(WINAPI * FN_NtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG)
Definition: cicbase.cpp:74
@ ProcessWow64Information
Definition: cicbase.cpp:65
EXTERN_C HINSTANCE cicGetSystemModuleHandle(_In_ LPCTSTR pszFileName, _In_ BOOL bSysWinDir)
Definition: cicbase.cpp:149
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
#define GetCurrentProcess()
Definition: compat.h:759
#define TEXT(s)
Definition: k32.h:28
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by InitApp(), and ProcessAttach().

◆ cicLoadSystemLibrary()

EXTERN_C HINSTANCE cicLoadSystemLibrary ( _In_ LPCTSTR  pszFileName,
_In_ BOOL  bSysWinDir 
)

Definition at line 162 of file cicbase.cpp.

165{
166 CicSystemModulePath ModPath;
167 if (!ModPath.Init(pszFileName, bSysWinDir))
168 return NULL;
169 return ::LoadLibrary(ModPath.m_szPath);
170}

Referenced by cicRealCoCreateInstance(), and CRegWatcher::UpdateSpTip().

◆ cicMemAlloc()

static LPVOID cicMemAlloc ( SIZE_T  size)
inlinestatic

◆ cicMemAllocClear()

static LPVOID cicMemAllocClear ( SIZE_T  size)
inlinestatic

◆ cicMemFree()

◆ cicMemReAlloc()

static LPVOID cicMemReAlloc ( LPVOID  ptr,
SIZE_T  newSize 
)
inlinestatic

Definition at line 26 of file cicbase.h.

27{
28 if (!newSize)
29 {
31 return NULL;
32 }
33 if (!ptr)
34 return LocalAlloc(LMEM_ZEROINIT, newSize);
35 return LocalReAlloc(ptr, newSize, LMEM_ZEROINIT | LMEM_MOVEABLE);
36}
static void cicMemFree(LPVOID ptr)
Definition: cicbase.h:20
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:1625
#define LMEM_MOVEABLE
Definition: minwinbase.h:82

Referenced by cicMemReCalloc(), UIComposition::GetCompStrBuffer(), CicArrayBase::Insert(), and CicArray< LANGBARITEMSTATE >::Remove().

◆ cicMemReCalloc()

LPVOID cicMemReCalloc ( LPVOID  mem,
SIZE_T  num,
SIZE_T  size 
)
noexcept

Definition at line 41 of file cicbase.cpp.

42{
44 LPVOID ret;
45
46 if (!mem)
48
51 if (!ret)
52 return NULL;
53
54 if (new_size > old_size)
56
57 return ret;
58}
static LPVOID cicMemReAlloc(LPVOID ptr, SIZE_T newSize)
Definition: cicbase.h:26
static LPVOID cicMemAllocClear(SIZE_T size)
Definition: cicbase.h:15
return ret
Definition: mutex.c:146
size_t const old_size
Definition: expand.cpp:65
size_t const new_size
Definition: expand.cpp:66
GLuint GLuint num
Definition: glext.h:9618
SIZE_T NTAPI LocalSize(HLOCAL hMem)
Definition: heapmem.c:1794
#define ZeroMemory
Definition: minwinbase.h:31
BYTE * PBYTE
Definition: pedump.c:66
Definition: mem.c:349
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by generate_Cookie().

◆ cicRealCoCreateInstance()

EXTERN_C HRESULT cicRealCoCreateInstance ( _In_ REFCLSID  rclsid,
_In_ LPUNKNOWN  pUnkOuter,
_In_ DWORD  dwClsContext,
_In_ REFIID  iid,
_Out_ LPVOID ppv 
)

Definition at line 225 of file cicbase.cpp.

231{
232 static HINSTANCE s_hOle32 = NULL;
233 static FN_CoCreateInstance s_fnCoCreateInstance = NULL;
234 if (!s_fnCoCreateInstance)
235 {
236 if (!s_hOle32)
237 s_hOle32 = cicLoadSystemLibrary(TEXT("ole32.dll"), FALSE);
238 s_fnCoCreateInstance = (FN_CoCreateInstance)GetProcAddress(s_hOle32, "CoCreateInstance");
239 if (!s_fnCoCreateInstance)
240 return E_NOTIMPL;
241 }
242
243 return s_fnCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv);
244}
EXTERN_C HINSTANCE cicLoadSystemLibrary(_In_ LPCTSTR pszFileName, _In_ BOOL bSysWinDir)
Definition: cicbase.cpp:162
#define E_NOTIMPL
Definition: ddrawi.h:99

Referenced by cicCoCreateInstance(), and MsUtbCoCreateInstance().

◆ operator delete() [1/2]

void operator delete ( void ptr)
noexcept

Definition at line 24 of file cicbase.cpp.

25{
27}

◆ operator delete() [2/2]

void operator delete ( void ptr,
size_t  size 
)
noexcept

Definition at line 32 of file cicbase.cpp.

33{
35}

◆ operator delete[]() [1/2]

void operator delete[] ( void ptr)
noexcept

Definition at line 28 of file cicbase.cpp.

29{
31}

◆ operator delete[]() [2/2]

void operator delete[] ( void ptr,
size_t  size 
)
noexcept

Definition at line 36 of file cicbase.cpp.

37{
39}

◆ operator new()

void * operator new ( size_t  size,
const CicNoThrow  
)
noexcept

Definition at line 16 of file cicbase.cpp.

17{
18 return cicMemAllocClear(size);
19}

◆ operator new[]()

void * operator new[] ( size_t  size,
const CicNoThrow  
)
noexcept

Definition at line 20 of file cicbase.cpp.

21{
22 return cicMemAllocClear(size);
23}

◆ TFInitLib()

EXTERN_C BOOL TFInitLib ( FN_CoCreateInstance  fnCoCreateInstance)

@implemented

Definition at line 270 of file cicbase.cpp.

271{
272 if (fnCoCreateInstance)
273 _cicGetSetUserCoCreateInstance(fnCoCreateInstance);
274 return TRUE;
275}
#define TRUE
Definition: types.h:120

Referenced by ProcessAttach().

◆ TFUninitLib()

EXTERN_C VOID TFUninitLib ( VOID  )

Definition at line 760 of file utils.cpp.

761{
762 // Do nothing
763}

Referenced by ProcessDetach().