mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[CTFMON][MSCTFIME][SDK] Refactoring on Cicero design
CORE-19362
This commit is contained in:
parent
50755684cf
commit
eb72347672
3 changed files with 133 additions and 31 deletions
|
@ -180,6 +180,9 @@ InitApp(
|
||||||
g_bOnWow64 = cicIsWow64(); // Is the current process on WoW64?
|
g_bOnWow64 = cicIsWow64(); // Is the current process on WoW64?
|
||||||
cicGetOSInfo(&g_uACP, &g_dwOsInfo); // Get OS info
|
cicGetOSInfo(&g_uACP, &g_dwOsInfo); // Get OS info
|
||||||
|
|
||||||
|
// Initialize Cicero
|
||||||
|
TFInitLib();
|
||||||
|
|
||||||
// Create a mutex for Cicero
|
// Create a mutex for Cicero
|
||||||
g_hCicMutex = TF_CreateCicLoadMutex(&g_fWinLogon);
|
g_hCicMutex = TF_CreateCicLoadMutex(&g_fWinLogon);
|
||||||
if (!g_hCicMutex)
|
if (!g_hCicMutex)
|
||||||
|
@ -234,6 +237,9 @@ UninitApp(VOID)
|
||||||
// Close TIP Bar Popup
|
// Close TIP Bar Popup
|
||||||
ClosePopupTipbar();
|
ClosePopupTipbar();
|
||||||
|
|
||||||
|
// Release Cicero
|
||||||
|
TFUninitLib();
|
||||||
|
|
||||||
// Close the mutex
|
// Close the mutex
|
||||||
::CloseHandle(g_hCicMutex);
|
::CloseHandle(g_hCicMutex);
|
||||||
g_hCicMutex = NULL;
|
g_hCicMutex = NULL;
|
||||||
|
|
|
@ -120,13 +120,7 @@ IsInteractiveUserLogon(VOID)
|
||||||
return bOK && IsMember;
|
return bOK && IsMember;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct LIBTHREAD
|
HRESULT InitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread)
|
||||||
{
|
|
||||||
IUnknown *m_pUnknown1;
|
|
||||||
ITfDisplayAttributeMgr *m_pDisplayAttrMgr;
|
|
||||||
} LIBTHREAD, *PLIBTHREAD;
|
|
||||||
|
|
||||||
HRESULT InitDisplayAttrbuteLib(PLIBTHREAD pLibThread)
|
|
||||||
{
|
{
|
||||||
if (!pLibThread)
|
if (!pLibThread)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
@ -141,7 +135,7 @@ HRESULT InitDisplayAttrbuteLib(PLIBTHREAD pLibThread)
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT UninitDisplayAttrbuteLib(PLIBTHREAD pLibThread)
|
HRESULT UninitDisplayAttrbuteLib(PCIC_LIBTHREAD pLibThread)
|
||||||
{
|
{
|
||||||
if (!pLibThread)
|
if (!pLibThread)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
@ -155,23 +149,6 @@ HRESULT UninitDisplayAttrbuteLib(PLIBTHREAD pLibThread)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFUninitLib_Thread(PLIBTHREAD pLibThread)
|
|
||||||
{
|
|
||||||
if (!pLibThread)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (pLibThread->m_pUnknown1)
|
|
||||||
{
|
|
||||||
pLibThread->m_pUnknown1->Release();
|
|
||||||
pLibThread->m_pUnknown1 = NULL;
|
|
||||||
}
|
|
||||||
if (pLibThread->m_pDisplayAttrMgr)
|
|
||||||
{
|
|
||||||
pLibThread->m_pDisplayAttrMgr->Release();
|
|
||||||
pLibThread->m_pDisplayAttrMgr = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Compartment
|
* Compartment
|
||||||
*/
|
*/
|
||||||
|
@ -542,7 +519,7 @@ public:
|
||||||
DWORD m_dw3[19];
|
DWORD m_dw3[19];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CicInputContext(TfClientId cliendId, LIBTHREAD *pLibThread, HIMC hIMC);
|
CicInputContext(TfClientId cliendId, PCIC_LIBTHREAD pLibThread, HIMC hIMC);
|
||||||
virtual ~CicInputContext()
|
virtual ~CicInputContext()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -576,7 +553,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
CicInputContext::CicInputContext(TfClientId cliendId, LIBTHREAD *pLibThread, HIMC hIMC)
|
CicInputContext::CicInputContext(TfClientId cliendId, PCIC_LIBTHREAD pLibThread, HIMC hIMC)
|
||||||
{
|
{
|
||||||
m_hIMC = hIMC;
|
m_hIMC = hIMC;
|
||||||
m_guid = GUID_NULL;
|
m_guid = GUID_NULL;
|
||||||
|
@ -1040,7 +1017,7 @@ protected:
|
||||||
ITfDocumentMgr *m_pDocMgr;
|
ITfDocumentMgr *m_pDocMgr;
|
||||||
CThreadMgrEventSink *m_pThreadMgrEventSink;
|
CThreadMgrEventSink *m_pThreadMgrEventSink;
|
||||||
TfClientId m_cliendId;
|
TfClientId m_cliendId;
|
||||||
LIBTHREAD m_LibThread;
|
CIC_LIBTHREAD m_LibThread;
|
||||||
DWORD m_dw21;
|
DWORD m_dw21;
|
||||||
|
|
||||||
static BOOL CALLBACK EnumCreateInputContextCallback(HIMC hIMC, LPARAM lParam);
|
static BOOL CALLBACK EnumCreateInputContextCallback(HIMC hIMC, LPARAM lParam);
|
||||||
|
@ -2833,6 +2810,22 @@ VOID DetachIME(VOID)
|
||||||
/**
|
/**
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
*/
|
*/
|
||||||
|
VOID InitUIFLib(VOID)
|
||||||
|
{
|
||||||
|
//FIXME
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @unimplemented
|
||||||
|
*/
|
||||||
|
VOID DoneUIFLib(VOID)
|
||||||
|
{
|
||||||
|
//FIXME
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
BOOL ProcessAttach(HINSTANCE hinstDLL)
|
BOOL ProcessAttach(HINSTANCE hinstDLL)
|
||||||
{
|
{
|
||||||
g_hInst = hinstDLL;
|
g_hInst = hinstDLL;
|
||||||
|
@ -2844,7 +2837,10 @@ BOOL ProcessAttach(HINSTANCE hinstDLL)
|
||||||
|
|
||||||
cicGetOSInfo(&g_uACP, &g_dwOSInfo);
|
cicGetOSInfo(&g_uACP, &g_dwOSInfo);
|
||||||
|
|
||||||
// FIXME
|
InitUIFLib();
|
||||||
|
|
||||||
|
if (!TFInitLib())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
gfTFInitLib = TRUE;
|
gfTFInitLib = TRUE;
|
||||||
return AttachIME();
|
return AttachIME();
|
||||||
|
@ -2857,14 +2853,18 @@ VOID ProcessDetach(HINSTANCE hinstDLL)
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
|
|
||||||
|
TF_DllDetachInOther();
|
||||||
|
|
||||||
if (gfTFInitLib)
|
if (gfTFInitLib)
|
||||||
|
{
|
||||||
DetachIME();
|
DetachIME();
|
||||||
|
TFUninitLib();
|
||||||
|
}
|
||||||
|
|
||||||
DeleteCriticalSection(&g_csLock);
|
DeleteCriticalSection(&g_csLock);
|
||||||
TLS::InternalDestroyTLS();
|
TLS::InternalDestroyTLS();
|
||||||
TLS::Uninitialize();
|
TLS::Uninitialize();
|
||||||
|
DoneUIFLib();
|
||||||
// FIXME
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,6 +49,12 @@ inline void __cdecl operator delete(void* ptr, size_t size) noexcept
|
||||||
cicMemFree(ptr);
|
cicMemFree(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct CIC_LIBTHREAD
|
||||||
|
{
|
||||||
|
IUnknown *m_pUnknown1;
|
||||||
|
ITfDisplayAttributeMgr *m_pDisplayAttrMgr;
|
||||||
|
} CIC_LIBTHREAD, *PCIC_LIBTHREAD;
|
||||||
|
|
||||||
/* The flags of cicGetOSInfo() */
|
/* The flags of cicGetOSInfo() */
|
||||||
#define CIC_OSINFO_NT 0x01
|
#define CIC_OSINFO_NT 0x01
|
||||||
#define CIC_OSINFO_2KPLUS 0x02
|
#define CIC_OSINFO_2KPLUS 0x02
|
||||||
|
@ -217,3 +223,93 @@ Failure:
|
||||||
m_cchPath = 0;
|
m_cchPath = 0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ole32!CoCreateInstance
|
||||||
|
typedef HRESULT (WINAPI *FN_CoCreateInstance)(
|
||||||
|
REFCLSID rclsid,
|
||||||
|
LPUNKNOWN pUnkOuter,
|
||||||
|
DWORD dwClsContext,
|
||||||
|
REFIID iid,
|
||||||
|
LPVOID *ppv);
|
||||||
|
|
||||||
|
static inline FN_CoCreateInstance
|
||||||
|
_cicGetSetUserCoCreateInstance(FN_CoCreateInstance fnUserCoCreateInstance)
|
||||||
|
{
|
||||||
|
static FN_CoCreateInstance s_fn = NULL;
|
||||||
|
if (fnUserCoCreateInstance)
|
||||||
|
s_fn = fnUserCoCreateInstance;
|
||||||
|
return s_fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
static inline HRESULT
|
||||||
|
cicCoCreateInstance(
|
||||||
|
REFCLSID rclsid,
|
||||||
|
LPUNKNOWN pUnkOuter,
|
||||||
|
DWORD dwClsContext,
|
||||||
|
REFIID iid,
|
||||||
|
LPVOID *ppv)
|
||||||
|
{
|
||||||
|
FN_CoCreateInstance fnUserCoCreateInstance = _cicGetSetUserCoCreateInstance(NULL);
|
||||||
|
if (fnUserCoCreateInstance)
|
||||||
|
return fnUserCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv);
|
||||||
|
|
||||||
|
static HINSTANCE s_hOle32 = NULL;
|
||||||
|
static FN_CoCreateInstance s_fnCoCreateInstance = NULL;
|
||||||
|
if (!s_fnCoCreateInstance)
|
||||||
|
{
|
||||||
|
if (!s_hOle32)
|
||||||
|
s_hOle32 = cicLoadSystemLibrary(L"ole32.dll", FALSE);
|
||||||
|
if (!s_hOle32)
|
||||||
|
return E_NOTIMPL;
|
||||||
|
s_fnCoCreateInstance = (FN_CoCreateInstance)GetProcAddress(s_hOle32, "CoCreateInstance");
|
||||||
|
if (!s_fnCoCreateInstance)
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s_fnCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
static inline BOOL
|
||||||
|
TFInitLib(FN_CoCreateInstance fnCoCreateInstance = NULL)
|
||||||
|
{
|
||||||
|
if (fnCoCreateInstance)
|
||||||
|
_cicGetSetUserCoCreateInstance(fnCoCreateInstance);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @unimplemented
|
||||||
|
*/
|
||||||
|
static inline VOID
|
||||||
|
TFUninitLib(VOID)
|
||||||
|
{
|
||||||
|
//FIXME
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
static inline VOID
|
||||||
|
TFUninitLib_Thread(PCIC_LIBTHREAD pLibThread)
|
||||||
|
{
|
||||||
|
if (!pLibThread)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (pLibThread->m_pUnknown1)
|
||||||
|
{
|
||||||
|
pLibThread->m_pUnknown1->Release();
|
||||||
|
pLibThread->m_pUnknown1 = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pLibThread->m_pDisplayAttrMgr)
|
||||||
|
{
|
||||||
|
pLibThread->m_pDisplayAttrMgr->Release();
|
||||||
|
pLibThread->m_pDisplayAttrMgr = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue