[CICERO] Move sdk/lib/cicero to base/ctf/cicero (#8055)

The CTF modules depend on Cicero
static library. Cicero should be a
component in CTF.
This move will improve code
readability and grep-ability.
JIRA issue: CORE-19361
JIRA issue: CORE-19363
- Move sdk/lib/cicero to base/ctf/cicero.
- Adapt CMakeLists.txt to this move.
- No code content change except
  CMakeLists.txt.
This commit is contained in:
Katayama Hirofumi MZ 2025-05-30 22:17:09 +09:00 committed by GitHub
parent 543cf1e2fd
commit e43e639c30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 1 additions and 1 deletions

View file

@ -7,7 +7,6 @@ if(CMAKE_CROSSCOMPILING)
add_subdirectory(3rdparty)
add_subdirectory(apisets)
add_subdirectory(cicero)
add_subdirectory(comsupp)
add_subdirectory(conutils)
add_subdirectory(cportlib)

View file

@ -1,15 +0,0 @@
list(APPEND SOURCE
cicarray.cpp
cicbase.cpp
ciccaret.cpp
cicfmap.cpp
cicimc.cpp
cicreg.cpp
cicuif.cpp)
add_library(cicero STATIC ${SOURCE})
target_compile_definitions(cicero PRIVATE UNICODE _UNICODE)
add_dependencies(cicero psdk)
target_include_directories(cicero INTERFACE
$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}>)

View file

@ -1,78 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero dynamic array
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#include "precomp.h"
#include "cicarray.h"
CicArrayBase::CicArrayBase(size_t cbItem)
{
m_cbItem = cbItem;
m_pb = NULL;
m_cItems = m_cCapacity = 0;
}
CicArrayBase::~CicArrayBase()
{
cicMemFree(m_pb);
}
LPVOID CicArrayBase::Append(size_t cGrow)
{
if (!Insert(m_cItems, cGrow))
return NULL;
return &m_pb[(m_cItems - cGrow) * m_cbItem];
}
BOOL CicArrayBase::Insert(size_t iItem, size_t cGrow)
{
size_t cNewCapacity = m_cItems + cGrow;
if (m_cCapacity < cNewCapacity)
{
if (cNewCapacity <= m_cItems + m_cItems / 2)
cNewCapacity = m_cItems + m_cItems / 2;
LPBYTE pbNew = (LPBYTE)cicMemReAlloc(m_pb, cNewCapacity * m_cbItem);
if (!pbNew)
return FALSE;
m_pb = pbNew;
m_cCapacity = cNewCapacity;
}
if (iItem < m_cItems)
{
MoveMemory(&m_pb[(cGrow + iItem) * m_cbItem],
&m_pb[iItem * m_cbItem],
(m_cItems - iItem) * m_cbItem);
}
m_cItems += cGrow;
return TRUE;
}
void CicArrayBase::Remove(size_t iItem, size_t cRemove)
{
if (iItem + cRemove < m_cItems)
{
MoveMemory(&m_pb[iItem * m_cbItem],
&m_pb[(iItem + cRemove) * m_cbItem],
(m_cItems - iItem - cRemove) * m_cbItem);
}
m_cItems -= cRemove;
size_t cHalfCapacity = m_cCapacity / 2;
if (cHalfCapacity <= m_cItems)
return;
LPBYTE pb = (LPBYTE)cicMemReAlloc(m_pb, cHalfCapacity * m_cbItem);
if (pb)
{
m_pb = pb;
m_cCapacity = cHalfCapacity;
}
}

View file

@ -1,78 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero dynamic array
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
#include "cicbase.h"
class CicArrayBase
{
protected:
LPBYTE m_pb;
size_t m_cItems, m_cbItem, m_cCapacity;
public:
CicArrayBase(size_t cbItem);
virtual ~CicArrayBase();
BOOL Insert(size_t iItem, size_t cGrow);
LPVOID Append(size_t cGrow);
void Remove(size_t iItem, size_t cRemove = 1);
};
template <typename T_ITEM>
class CicArray : protected CicArrayBase
{
public:
CicArray() : CicArrayBase(sizeof(T_ITEM)) { }
T_ITEM* data() const { return (T_ITEM*)m_pb; }
size_t size() const { return m_cItems; }
bool empty() const { return !size(); }
void clear()
{
cicMemFree(m_pb);
m_pb = NULL;
m_cItems = m_cCapacity = 0;
}
T_ITEM& operator[](size_t iItem)
{
return *(T_ITEM*)&m_pb[iItem * m_cbItem];
}
const T_ITEM& operator[](size_t iItem) const
{
return *(const T_ITEM*)&m_pb[iItem * m_cbItem];
}
T_ITEM* Append(size_t cGrow)
{
return (T_ITEM*)CicArrayBase::Append(cGrow);
}
using CicArrayBase::Insert;
using CicArrayBase::Remove;
BOOL Add(const T_ITEM& item)
{
T_ITEM *pItem = Append(1);
if (!pItem)
return FALSE;
CopyMemory(pItem, &item, sizeof(T_ITEM));
return TRUE;
}
ptrdiff_t Find(const T_ITEM& item) const
{
for (size_t iItem = 0; iItem < m_cItems; ++iItem)
{
if ((*this)[iItem] == item)
return iItem;
}
return -1;
}
};

View file

@ -1,256 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero base
* COPYRIGHT: Copyright 2023-2024 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#include "precomp.h"
#include "cicbase.h"
#include <shlwapi.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
#include <strsafe.h>
void* operator new(size_t size, const CicNoThrow&) noexcept
{
return cicMemAllocClear(size);
}
void* operator new[](size_t size, const CicNoThrow&) noexcept
{
return cicMemAllocClear(size);
}
void operator delete(void* ptr) noexcept
{
cicMemFree(ptr);
}
void operator delete[](void* ptr) noexcept
{
cicMemFree(ptr);
}
void operator delete(void* ptr, size_t size) noexcept
{
cicMemFree(ptr);
}
void operator delete[](void* ptr, size_t size) noexcept
{
cicMemFree(ptr);
}
// FIXME
typedef enum _PROCESSINFOCLASS
{
ProcessBasicInformation = 0,
ProcessDebugPort = 7,
ProcessWow64Information = 26,
ProcessImageFileName = 27,
ProcessBreakOnTermination = 29
} PROCESSINFOCLASS;
// FIXME
typedef LONG NTSTATUS;
/* ntdll!NtQueryInformationProcess */
typedef NTSTATUS (WINAPI *FN_NtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);
EXTERN_C
BOOL cicIsWow64(VOID)
{
static FN_NtQueryInformationProcess s_fnNtQueryInformationProcess = NULL;
ULONG_PTR Value;
if (!s_fnNtQueryInformationProcess)
{
HMODULE hNTDLL = cicGetSystemModuleHandle(TEXT("ntdll.dll"), FALSE);
if (!hNTDLL)
return FALSE;
s_fnNtQueryInformationProcess =
(FN_NtQueryInformationProcess)GetProcAddress(hNTDLL, "NtQueryInformationProcess");
if (!s_fnNtQueryInformationProcess)
return FALSE;
}
Value = 0;
s_fnNtQueryInformationProcess(GetCurrentProcess(), ProcessWow64Information,
&Value, sizeof(Value), NULL);
return !!Value;
}
EXTERN_C
void cicGetOSInfo(LPUINT puACP, LPDWORD pdwOSInfo)
{
*pdwOSInfo = 0;
/* Check OS version info */
OSVERSIONINFO VerInfo;
VerInfo.dwOSVersionInfoSize = sizeof(VerInfo);
GetVersionEx(&VerInfo);
if (VerInfo.dwPlatformId == DLLVER_PLATFORM_NT)
{
*pdwOSInfo |= CIC_OSINFO_NT;
if (VerInfo.dwMajorVersion >= 5)
{
*pdwOSInfo |= CIC_OSINFO_2KPLUS;
if (VerInfo.dwMinorVersion > 0)
*pdwOSInfo |= CIC_OSINFO_XPPLUS;
}
}
else
{
if (VerInfo.dwMinorVersion >= 10)
*pdwOSInfo |= CIC_OSINFO_98PLUS;
else
*pdwOSInfo |= CIC_OSINFO_95;
}
/* Check codepage */
*puACP = GetACP();
switch (*puACP)
{
case 932: /* Japanese (Japan) */
case 936: /* Chinese (PRC, Singapore) */
case 949: /* Korean (Korea) */
case 950: /* Chinese (Taiwan, Hong Kong) */
*pdwOSInfo |= CIC_OSINFO_CJK;
break;
}
if (GetSystemMetrics(SM_IMMENABLED))
*pdwOSInfo |= CIC_OSINFO_IMM;
if (GetSystemMetrics(SM_DBCSENABLED))
*pdwOSInfo |= CIC_OSINFO_DBCS;
}
// Get an instance handle that is already loaded
EXTERN_C
HINSTANCE
cicGetSystemModuleHandle(
_In_ LPCTSTR pszFileName,
_In_ BOOL bSysWinDir)
{
CicSystemModulePath ModPath;
if (!ModPath.Init(pszFileName, bSysWinDir))
return NULL;
return GetModuleHandle(ModPath.m_szPath);
}
// Load a system library
EXTERN_C
HINSTANCE
cicLoadSystemLibrary(
_In_ LPCTSTR pszFileName,
_In_ BOOL bSysWinDir)
{
CicSystemModulePath ModPath;
if (!ModPath.Init(pszFileName, bSysWinDir))
return NULL;
return ::LoadLibrary(ModPath.m_szPath);
}
BOOL
CicSystemModulePath::Init(
_In_ LPCTSTR pszFileName,
_In_ BOOL bSysWinDir)
{
SIZE_T cchPath;
if (bSysWinDir)
{
// Usually C:\Windows or C:\ReactOS
cchPath = ::GetSystemWindowsDirectory(m_szPath, _countof(m_szPath));
}
else
{
// Usually C:\Windows\system32 or C:\ReactOS\system32
cchPath = ::GetSystemDirectory(m_szPath, _countof(m_szPath));
}
m_szPath[_countof(m_szPath) - 1] = TEXT('\0'); // Avoid buffer overrun
if ((cchPath == 0) || (cchPath > _countof(m_szPath) - 2))
goto Failure;
// Add backslash if necessary
if ((cchPath > 0) && (m_szPath[cchPath - 1] != TEXT('\\')))
{
m_szPath[cchPath + 0] = TEXT('\\');
m_szPath[cchPath + 1] = TEXT('\0');
}
// Append pszFileName
if (FAILED(StringCchCat(m_szPath, _countof(m_szPath), pszFileName)))
goto Failure;
m_cchPath = _tcslen(m_szPath);
return TRUE;
Failure:
m_szPath[0] = UNICODE_NULL;
m_cchPath = 0;
return FALSE;
}
static FN_CoCreateInstance
_cicGetSetUserCoCreateInstance(FN_CoCreateInstance fnUserCoCreateInstance)
{
static FN_CoCreateInstance s_fn = NULL;
if (fnUserCoCreateInstance)
s_fn = fnUserCoCreateInstance;
return s_fn;
}
EXTERN_C
HRESULT
cicRealCoCreateInstance(
_In_ REFCLSID rclsid,
_In_ LPUNKNOWN pUnkOuter,
_In_ DWORD dwClsContext,
_In_ REFIID iid,
_Out_ LPVOID *ppv)
{
static HINSTANCE s_hOle32 = NULL;
static FN_CoCreateInstance s_fnCoCreateInstance = NULL;
if (!s_fnCoCreateInstance)
{
if (!s_hOle32)
s_hOle32 = cicLoadSystemLibrary(TEXT("ole32.dll"), FALSE);
s_fnCoCreateInstance = (FN_CoCreateInstance)GetProcAddress(s_hOle32, "CoCreateInstance");
if (!s_fnCoCreateInstance)
return E_NOTIMPL;
}
return s_fnCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv);
}
/**
* @implemented
*/
HRESULT
cicCoCreateInstance(
_In_ REFCLSID rclsid,
_In_ LPUNKNOWN pUnkOuter,
_In_ DWORD dwClsContext,
_In_ REFIID iid,
_Out_ LPVOID *ppv)
{
// NOTE: It looks like Cicero wants to hook CoCreateInstance
FN_CoCreateInstance fnUserCoCreateInstance = _cicGetSetUserCoCreateInstance(NULL);
if (fnUserCoCreateInstance)
return fnUserCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv);
return cicRealCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv);
}
/**
* @implemented
*/
EXTERN_C
BOOL
TFInitLib(FN_CoCreateInstance fnCoCreateInstance)
{
if (fnCoCreateInstance)
_cicGetSetUserCoCreateInstance(fnCoCreateInstance);
return TRUE;
}

View file

@ -1,133 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero base
* COPYRIGHT: Copyright 2023-2024 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
static inline LPVOID cicMemAlloc(SIZE_T size)
{
return LocalAlloc(0, size);
}
static inline LPVOID cicMemAllocClear(SIZE_T size)
{
return LocalAlloc(LMEM_ZEROINIT, size);
}
static inline LPVOID cicMemReAlloc(LPVOID ptr, SIZE_T newSize)
{
if (!ptr)
return LocalAlloc(LMEM_ZEROINIT, newSize);
return LocalReAlloc(ptr, newSize, LMEM_ZEROINIT);
}
static inline void cicMemFree(LPVOID ptr)
{
if (ptr)
LocalFree(ptr);
}
struct CicNoThrow { };
#define cicNoThrow CicNoThrow{}
void* operator new(size_t size, const CicNoThrow&) noexcept;
void* operator 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;
/* The flags of cicGetOSInfo() */
#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
EXTERN_C
void cicGetOSInfo(LPUINT puACP, LPDWORD pdwOSInfo);
#ifdef __cplusplus
struct CicSystemModulePath
{
TCHAR m_szPath[MAX_PATH + 2];
SIZE_T m_cchPath;
CicSystemModulePath()
{
m_szPath[0] = UNICODE_NULL;
m_cchPath = 0;
}
BOOL Init(_In_ LPCTSTR pszFileName, _In_ BOOL bSysWinDir);
};
#endif
// Get an instance handle that is already loaded
EXTERN_C
HINSTANCE
cicGetSystemModuleHandle(
_In_ LPCTSTR pszFileName,
_In_ BOOL bSysWinDir);
// Load a system library
EXTERN_C
HINSTANCE
cicLoadSystemLibrary(
_In_ LPCTSTR pszFileName,
_In_ BOOL bSysWinDir);
#ifdef __cplusplus
template <typename T_FN>
static inline BOOL
cicGetFN(HINSTANCE& hinstDLL, T_FN& fn, LPCTSTR pszDllName, LPCSTR pszFuncName)
{
if (fn)
return TRUE;
if (!hinstDLL)
hinstDLL = cicLoadSystemLibrary(pszDllName, FALSE);
if (!hinstDLL)
return FALSE;
fn = reinterpret_cast<T_FN>(GetProcAddress(hinstDLL, pszFuncName));
return !!fn;
}
#endif
/* Is the current process on WoW64? */
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);
// ole32!CoCreateInstance
typedef HRESULT (WINAPI *FN_CoCreateInstance)(
REFCLSID rclsid,
LPUNKNOWN pUnkOuter,
DWORD dwClsContext,
REFIID iid,
LPVOID *ppv);
EXTERN_C BOOL TFInitLib(FN_CoCreateInstance fnCoCreateInstance = NULL);
EXTERN_C VOID TFUninitLib(VOID);

View file

@ -1,110 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Displaying Cicero caret
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#include "precomp.h"
#include "ciccaret.h"
/**
* @implemented
*/
CicCaret::CicCaret()
{
m_bCaretBlinking = FALSE;
m_bCaretVisible = FALSE;
m_uCaretBlinkTimerID = 0;
m_pt.x = m_pt.y = 0;
m_size.cx = m_size.cy = 0;
}
/**
* @implemented
*/
CicCaret::~CicCaret()
{
HideCaret();
::KillTimer(m_hWnd, m_uCaretBlinkTimerID);
m_uCaretBlinkTimerID = 0;
}
/**
* @implemented
*/
void CicCaret::CreateCaret(HWND hWnd, SIZE size)
{
m_hWnd = hWnd;
m_size = size;
if (::IsWindow(hWnd))
m_uCaretBlinkTimerID = ::SetTimer(m_hWnd, TIMER_ID, ::GetCaretBlinkTime(), NULL);
}
/**
* @implemented
*/
void CicCaret::DestroyCaret()
{
HideCaret();
::KillTimer(m_hWnd, m_uCaretBlinkTimerID);
m_uCaretBlinkTimerID = 0;
}
/**
* @implemented
*/
void CicCaret::HideCaret()
{
if (m_bCaretVisible)
{
m_bCaretVisible = FALSE;
InvertCaret();
}
m_bCaretBlinking = FALSE;
}
/**
* @implemented
*/
void CicCaret::InvertCaret()
{
HDC hDC = ::GetDC(m_hWnd);
::PatBlt(hDC, m_pt.x, m_pt.y, m_size.cx, m_size.cy, DSTINVERT);
::ReleaseDC(m_hWnd, hDC);
}
/**
* @implemented
*/
void CicCaret::OnTimer()
{
if (m_bCaretBlinking)
{
m_bCaretVisible = !m_bCaretVisible;
InvertCaret();
}
}
/**
* @implemented
*/
void CicCaret::SetCaretPos(POINT pt)
{
BOOL bCaretVisible = m_bCaretVisible;
if (bCaretVisible)
InvertCaret();
m_pt = pt;
if (bCaretVisible)
InvertCaret();
}
/**
* @implemented
*/
void CicCaret::SetBlinking(BOOL bBlinking)
{
m_bCaretBlinking = bBlinking;
}

View file

@ -1,33 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Displaying Cicero caret
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
class CicCaret
{
protected:
HWND m_hWnd;
UINT m_uCaretBlinkTimerID;
POINT m_pt;
SIZE m_size;
BOOL m_bCaretBlinking;
BOOL m_bCaretVisible;
public:
enum { TIMER_ID = 0x4F83AF91 };
CicCaret();
virtual ~CicCaret();
operator HWND() const { return m_hWnd; }
void CreateCaret(HWND hWnd, SIZE size);
void DestroyCaret();
void HideCaret();
void InvertCaret();
void OnTimer();
void SetCaretPos(POINT pt);
void SetBlinking(BOOL bBlinking);
};

View file

@ -1,55 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero event object handling
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
#include "cicbase.h"
class CicEvent
{
HANDLE m_hEvent;
LPCTSTR m_pszName;
public:
CicEvent() : m_hEvent(NULL), m_pszName(NULL)
{
}
~CicEvent()
{
Close();
}
BOOL Create(LPSECURITY_ATTRIBUTES lpSA, LPCTSTR pszName)
{
if (pszName)
m_pszName = pszName;
if (!m_pszName)
return FALSE;
m_hEvent = ::CreateEvent(lpSA, FALSE, FALSE, m_pszName);
return (m_hEvent != NULL);
}
BOOL Open(LPCTSTR pszName)
{
if (pszName)
m_pszName = pszName;
m_hEvent = ::OpenEvent(EVENT_ALL_ACCESS, FALSE, m_pszName);
return (m_hEvent != NULL);
}
void Close()
{
if (m_hEvent)
{
::CloseHandle(m_hEvent);
m_hEvent = NULL;
}
}
BOOL Wait(DWORD dwMilliseconds)
{
return (::WaitForSingleObject(m_hEvent, dwMilliseconds) == WAIT_OBJECT_0);
}
};

View file

@ -1,123 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero file mapping
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#include "precomp.h"
#include "cicfmap.h"
CicFileMapping::CicFileMapping(LPCTSTR pszName, CicMutex *pMutex)
{
m_pszName = NULL;
m_pView = NULL;
m_hMapping = NULL;
m_bCreated = FALSE;
m_bHasMutex = FALSE;
m_pMutex = NULL;
Init(pszName, pMutex);
}
void CicFileMappingStatic::Close()
{
if (m_pView)
{
::UnmapViewOfFile(m_pView);
m_pView = NULL;
}
if (m_hMapping)
{
::CloseHandle(m_hMapping);
m_hMapping = NULL;
}
m_bCreated = FALSE;
}
void CicFileMappingStatic::Init(LPCTSTR pszName, CicMutex *pMutex)
{
if (pMutex)
m_pMutex = pMutex;
m_bCreated = FALSE;
m_pszName = pszName;
m_bHasMutex = (pMutex != NULL);
}
LPVOID
CicFileMappingStatic::Create(
LPSECURITY_ATTRIBUTES pSA,
DWORD dwMaximumSizeLow,
LPBOOL pbAlreadyExists)
{
if (!m_pszName)
return NULL;
m_hMapping = ::CreateFileMapping(INVALID_HANDLE_VALUE,
pSA,
PAGE_READWRITE,
0,
dwMaximumSizeLow,
m_pszName);
if (pbAlreadyExists)
*pbAlreadyExists = (::GetLastError() == ERROR_ALREADY_EXISTS);
if (!m_hMapping)
return NULL;
m_bCreated = TRUE;
return _Map();
}
LPVOID CicFileMappingStatic::Open()
{
if (!m_pszName)
return NULL;
m_hMapping = ::OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, m_pszName);
if (!m_hMapping)
return NULL;
return _Map();
}
LPVOID CicFileMappingStatic::_Map()
{
m_pView = ::MapViewOfFile(m_hMapping, FILE_MAP_WRITE, 0, 0, 0);
if (!m_pView)
{
Close();
return NULL;
}
return m_pView;
}
BOOL CicFileMappingStatic::Enter()
{
if (!m_bHasMutex)
return TRUE;
return m_pMutex->Enter();
}
void CicFileMappingStatic::Leave()
{
if (!m_bHasMutex)
return;
m_pMutex->Leave();
}
BOOL CicFileMappingStatic::Flush(SIZE_T dwNumberOfBytesToFlush)
{
if (!m_pView)
return FALSE;
return ::FlushViewOfFile(m_pView, dwNumberOfBytesToFlush);
}
void CicFileMappingStatic::Finalize()
{
if (!m_bHasMutex)
return;
Close();
Leave();
}

View file

@ -1,48 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero file mapping
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
#include "cicmutex.h"
// class CicFileMappingStatic;
// class CicFileMapping;
class CicFileMappingStatic
{
protected:
LPCTSTR m_pszName;
LPVOID m_pView;
HANDLE m_hMapping;
BOOL m_bCreated;
BOOL m_bHasMutex;
CicMutex *m_pMutex;
LPVOID _Map();
public:
CicFileMappingStatic() { }
~CicFileMappingStatic() { }
void Init(LPCTSTR pszName, CicMutex *pMutex);
LPVOID Create(LPSECURITY_ATTRIBUTES pSA, DWORD dwMaximumSizeLow, LPBOOL pbAlreadyExists);
LPVOID Open();
void Close();
BOOL Enter();
void Leave();
BOOL Flush(SIZE_T dwNumberOfBytesToFlush);
void Finalize();
};
class CicFileMapping : public CicFileMappingStatic
{
public:
CicFileMapping(LPCTSTR pszName, CicMutex *pMutex);
virtual ~CicFileMapping() { Finalize(); }
};

View file

@ -1,53 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Locking and Unlocking IMC and IMCC handles
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#include "precomp.h"
#include <imm.h>
#include <immdev.h>
#include <imm32_undoc.h>
#include "cicimc.h"
#define CUSTOM_CAND_INFO_SIZE 1964
BOOL CicIMCLock::ClearCand()
{
HIMCC hNewCandInfo, hCandInfo = m_pIC->hCandInfo;
if (hCandInfo)
{
hNewCandInfo = ImmReSizeIMCC(hCandInfo, CUSTOM_CAND_INFO_SIZE);
if (!hNewCandInfo)
{
ImmDestroyIMCC(m_pIC->hCandInfo);
m_pIC->hCandInfo = ImmCreateIMCC(CUSTOM_CAND_INFO_SIZE);
return FALSE;
}
}
else
{
hNewCandInfo = ImmCreateIMCC(CUSTOM_CAND_INFO_SIZE);
}
m_pIC->hCandInfo = hNewCandInfo;
if (!m_pIC->hCandInfo)
return FALSE;
CicIMCCLock<CANDIDATEINFO> candInfo(m_pIC->hCandInfo);
if (!candInfo)
{
ImmDestroyIMCC(m_pIC->hCandInfo);
m_pIC->hCandInfo = ImmCreateIMCC(CUSTOM_CAND_INFO_SIZE);
return FALSE;
}
candInfo.get().dwSize = CUSTOM_CAND_INFO_SIZE;
candInfo.get().dwCount = 0;
candInfo.get().dwOffset[0] = sizeof(CANDIDATEINFO);
// FIXME: Something is trailing after CANDIDATEINFO...
return TRUE;
}

View file

@ -1,184 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Locking and Unlocking IMC and IMCC handles
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
// struct CTFIMECONTEXT;
// class CIC_IMCC_LOCK<T_DATA>;
// class CicIMCCLock<T_DATA>;
// class CIC_IMC_LOCK;
// class CicIMCLock;
class CicInputContext;
typedef struct tagCTFIMECONTEXT
{
CicInputContext *m_pCicIC;
DWORD m_dwCicFlags;
} CTFIMECONTEXT, *PCTFIMECONTEXT;
template <typename T_DATA>
class CIC_IMCC_LOCK
{
protected:
T_DATA *m_pIMCC;
public:
HIMCC m_hIMCC;
HRESULT m_hr;
CIC_IMCC_LOCK(HIMCC hIMCC)
{
m_pIMCC = NULL;
m_hr = S_OK;
m_hIMCC = hIMCC;
}
};
template <typename T_DATA>
class CicIMCCLock : public CIC_IMCC_LOCK<T_DATA>
{
public:
CicIMCCLock(HIMCC hIMCC) : CIC_IMCC_LOCK<T_DATA>(hIMCC)
{
this->m_hr = _LockIMCC(this->m_hIMCC, &this->m_pIMCC);
}
~CicIMCCLock()
{
unlock();
}
void unlock()
{
if (this->m_pIMCC)
{
_UnlockIMCC(this->m_hIMCC);
this->m_pIMCC = NULL;
}
}
operator T_DATA*() const
{
return this->m_pIMCC;
}
T_DATA& get() const
{
return *this->m_pIMCC;
}
protected:
HRESULT _LockIMCC(HIMCC hIMCC, T_DATA **pptr)
{
if (!hIMCC)
return E_INVALIDARG;
*pptr = (T_DATA*)::ImmLockIMCC(hIMCC);
return (*pptr ? S_OK : E_FAIL);
}
HRESULT _UnlockIMCC(HIMCC hIMCC)
{
if (!::ImmUnlockIMCC(hIMCC))
return (::GetLastError() ? E_FAIL : S_OK);
return S_OK;
}
};
class CIC_IMC_LOCK
{
protected:
LPINPUTCONTEXTDX m_pIC;
public:
HIMC m_hIMC;
HRESULT m_hr;
DWORD m_dw3;
CIC_IMC_LOCK(HIMC hIMC)
{
m_pIC = NULL;
m_hIMC = hIMC;
m_hr = S_OK;
m_dw3 = 0;
}
BOOL Invalid() const
{
return (!m_pIC || m_hr != S_OK);
}
};
class CicIMCLock : public CIC_IMC_LOCK
{
public:
CicIMCLock(HIMC hIMC) : CIC_IMC_LOCK(hIMC)
{
m_hr = _LockIMC(hIMC, &m_pIC);
}
~CicIMCLock()
{
unlock();
}
void unlock()
{
if (m_pIC)
{
_UnlockIMC(m_hIMC);
m_pIC = NULL;
}
}
void InitContext()
{
if (!(m_pIC->fdwInit & INIT_COMPFORM))
m_pIC->cfCompForm.dwStyle = 0;
for (UINT i = 0; i < 4; ++i)
m_pIC->cfCandForm[i].dwStyle = 0;
}
BOOL ValidCompositionString()
{
if (ImmGetIMCCSize(m_pIC->hCompStr) < sizeof(COMPOSITIONSTRING))
return FALSE;
CicIMCCLock<COMPOSITIONSTRING> imccLock(m_pIC->hCompStr);
if (!imccLock)
return FALSE;
return imccLock.get().dwCompStrLen > 0;
}
BOOL ClearCand();
BOOL UseVerticalCompWindow() const
{
return m_pIC->cfCompForm.dwStyle && ((m_pIC->lfFont.A.lfEscapement / 900) % 4 == 3);
}
operator INPUTCONTEXTDX*() const
{
return m_pIC;
}
INPUTCONTEXTDX& get() const
{
return *m_pIC;
}
protected:
HRESULT _LockIMC(HIMC hIMC, LPINPUTCONTEXTDX *ppIC)
{
if (!hIMC)
return E_INVALIDARG;
LPINPUTCONTEXTDX pIC = (LPINPUTCONTEXTDX)ImmLockIMC(hIMC);
*ppIC = pIC;
return (pIC ? S_OK : E_FAIL);
}
HRESULT _UnlockIMC(HIMC hIMC)
{
return ::ImmUnlockIMC(hIMC) ? S_OK : E_FAIL;
}
};

View file

@ -1,50 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero mutex handling
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
#include "cicbase.h"
class CicMutex
{
HANDLE m_hMutex;
BOOL m_bInit;
public:
CicMutex() : m_hMutex(NULL), m_bInit(FALSE)
{
}
~CicMutex()
{
Uninit();
}
void Init(LPSECURITY_ATTRIBUTES lpSA, LPCTSTR pszMutexName)
{
m_hMutex = ::CreateMutex(lpSA, FALSE, pszMutexName);
m_bInit = TRUE;
}
void Uninit()
{
if (m_hMutex)
{
::CloseHandle(m_hMutex);
m_hMutex = NULL;
}
m_bInit = FALSE;
}
BOOL Enter()
{
DWORD dwWait = ::WaitForSingleObject(m_hMutex, 5000);
return (dwWait == WAIT_OBJECT_0) || (dwWait == WAIT_ABANDONED);
}
void Leave()
{
::ReleaseMutex(m_hMutex);
}
};

View file

@ -1,83 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero registry handling
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#include "precomp.h"
#include <cicreg.h>
EXTERN_C LSTATUS
_cicRegKey_Open(CicRegKey& self, HKEY hKey, LPCTSTR lpSubKey, REGSAM samDesired)
{
HKEY hNewKey;
LSTATUS error = ::RegOpenKeyEx(hKey, lpSubKey, 0, samDesired, &hNewKey);
if (error != ERROR_SUCCESS)
return error;
self.Close();
self.m_hKey = hNewKey;
return error;
}
EXTERN_C LSTATUS
_cicRegKey_Create(CicRegKey& self, HKEY hKey, LPCTSTR lpSubKey)
{
HKEY hNewKey;
LSTATUS error = ::RegCreateKeyEx(hKey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, NULL, &hNewKey, NULL);
if (error != ERROR_SUCCESS)
return error;
self.Close();
self.m_hKey = hNewKey;
return error;
}
EXTERN_C LSTATUS
_cicRegKey_EnumValue(CicRegKey& self, DWORD dwIndex, LPTSTR lpValueName, DWORD cchValueName)
{
DWORD dwSaveLen = cchValueName;
LSTATUS error = ::RegEnumValue(self.m_hKey, dwIndex, lpValueName, &cchValueName,
NULL, NULL, NULL, NULL);
if (dwSaveLen)
lpValueName[error == ERROR_SUCCESS ? dwSaveLen - 1 : 0] = 0;
return error;
}
EXTERN_C LSTATUS
_cicRegKey_QuerySz(CicRegKey& self, LPCTSTR pszValueName, LPTSTR pszValue, DWORD cchValueMax)
{
DWORD cbValueMax = cchValueMax * sizeof(TCHAR);
LSTATUS error = ::RegQueryValueEx(self.m_hKey, pszValueName, 0, NULL, (LPBYTE)pszValue, &cbValueMax);
if (cchValueMax > 0)
pszValue[(error == ERROR_SUCCESS) ? (cchValueMax - 1) : 0] = UNICODE_NULL;
return error;
}
EXTERN_C LSTATUS
_cicRegKey_RecurseDeleteKey(CicRegKey& self, LPCTSTR lpSubKey)
{
CicRegKey regKey;
LSTATUS error = regKey.Open(self.m_hKey, lpSubKey, KEY_READ | KEY_WRITE);
if (error != ERROR_SUCCESS)
return error;
TCHAR szName[MAX_PATH];
DWORD cchName;
do
{
cchName = _countof(szName);
error = ::RegEnumKeyEx(regKey, 0, szName, &cchName, NULL, NULL, NULL, NULL);
if (error != ERROR_SUCCESS)
break;
szName[_countof(szName) - 1] = UNICODE_NULL;
error = regKey.RecurseDeleteKey(szName);
} while (error == ERROR_SUCCESS);
regKey.Close();
return self.DeleteSubKey(lpSubKey);
}

View file

@ -1,116 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero registry handling
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
class CicRegKey
{
public:
HKEY m_hKey;
CicRegKey() : m_hKey(NULL) { }
~CicRegKey() { Close(); }
operator HKEY() { return m_hKey; }
LSTATUS Open(HKEY hKey, LPCTSTR lpSubKey, REGSAM samDesired = KEY_READ);
LSTATUS Create(HKEY hKey, LPCTSTR lpSubKey);
void Close();
LSTATUS QueryDword(LPCTSTR pszValueName, LPDWORD pdwValue);
LSTATUS SetDword(LPCTSTR pszValueName, DWORD dwValue);
LSTATUS QuerySz(LPCTSTR pszValueName, LPTSTR pszValue, DWORD cchValueMax);
LSTATUS SetSz(LPCTSTR pszValueName, LPCTSTR pszValue);
LSTATUS SetSzW(LPCWSTR pszValueName, LPCWSTR pszValue);
LSTATUS DeleteValue(LPCTSTR pszValueName);
LSTATUS DeleteSubKey(LPCTSTR lpSubKey);
LSTATUS RecurseDeleteKey(LPCTSTR lpSubKey);
LSTATUS EnumValue(DWORD dwIndex, LPTSTR lpValueName, DWORD cchValueName);
};
/***********************************************************************/
// FIXME: Here, directly using C++ methods causes compile errors... Why?
EXTERN_C LSTATUS _cicRegKey_Open(CicRegKey& self, HKEY hKey, LPCTSTR lpSubKey, REGSAM samDesired);
EXTERN_C LSTATUS _cicRegKey_Create(CicRegKey& self, HKEY hKey, LPCTSTR lpSubKey);
EXTERN_C LSTATUS _cicRegKey_RecurseDeleteKey(CicRegKey& self, LPCTSTR lpSubKey);
EXTERN_C LSTATUS
_cicRegKey_EnumValue(CicRegKey& self, DWORD dwIndex, LPTSTR lpValueName, DWORD cchValueName);
EXTERN_C LSTATUS
_cicRegKey_QuerySz(CicRegKey& self, LPCTSTR pszValueName, LPTSTR pszValue, DWORD cchValueMax);
inline LSTATUS CicRegKey::Open(HKEY hKey, LPCTSTR lpSubKey, REGSAM samDesired)
{
return _cicRegKey_Open(*this, hKey, lpSubKey, samDesired);
}
inline LSTATUS CicRegKey::Create(HKEY hKey, LPCTSTR lpSubKey)
{
return _cicRegKey_Create(*this, hKey, lpSubKey);
}
inline LSTATUS CicRegKey::QueryDword(LPCTSTR pszValueName, LPDWORD pdwValue)
{
DWORD cbData = sizeof(DWORD);
return ::RegQueryValueEx(m_hKey, pszValueName, 0, NULL, (LPBYTE)pdwValue, &cbData);
}
inline LSTATUS CicRegKey::SetDword(LPCTSTR pszValueName, DWORD dwValue)
{
return ::RegSetValueEx(m_hKey, pszValueName, 0, REG_DWORD, (LPBYTE)&dwValue, sizeof(dwValue));
}
inline LSTATUS CicRegKey::SetSz(LPCTSTR pszValueName, LPCTSTR pszValue)
{
DWORD cbValue = (lstrlen(pszValue) + 1) * sizeof(TCHAR);
return ::RegSetValueEx(m_hKey, pszValueName, 0, REG_SZ, (LPBYTE)pszValue, cbValue);
}
inline LSTATUS CicRegKey::SetSzW(LPCWSTR pszValueName, LPCWSTR pszValue)
{
DWORD cbValue = (lstrlenW(pszValue) + 1) * sizeof(WCHAR);
return ::RegSetValueExW(m_hKey, pszValueName, 0, REG_SZ, (LPBYTE)pszValue, cbValue);
}
inline LSTATUS CicRegKey::QuerySz(LPCTSTR pszValueName, LPTSTR pszValue, DWORD cchValueMax)
{
return _cicRegKey_QuerySz(*this, pszValueName, pszValue, cchValueMax);
}
inline void CicRegKey::Close()
{
if (!m_hKey)
return;
::RegCloseKey(m_hKey);
m_hKey = NULL;
}
inline LSTATUS CicRegKey::DeleteValue(LPCTSTR pszValueName)
{
return ::RegDeleteValue(m_hKey, pszValueName);
}
inline LSTATUS CicRegKey::DeleteSubKey(LPCTSTR lpSubKey)
{
return ::RegDeleteKey(m_hKey, lpSubKey);
}
inline LSTATUS CicRegKey::EnumValue(DWORD dwIndex, LPTSTR lpValueName, DWORD cchValueName)
{
return _cicRegKey_EnumValue(*this, dwIndex, lpValueName, cchValueName);
}
inline LSTATUS CicRegKey::RecurseDeleteKey(LPCTSTR lpSubKey)
{
return _cicRegKey_RecurseDeleteKey(*this, lpSubKey);
}

View file

@ -1,44 +0,0 @@
/*
* PROJECT: ReactOS Cicero
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: Cicero Text Framework
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
DEFINE_GUID(IID_ITfSysHookSink, 0x495388DA, 0x21A5, 0x4852, 0x8B, 0xB1, 0xED, 0x2F, 0x29, 0xDA, 0x8D, 0x60);
struct ITfSysHookSink : IUnknown
{
STDMETHOD(OnPreFocusDIM)(HWND hwnd) = 0;
STDMETHOD(OnSysKeyboardProc)(UINT, LONG) = 0;
STDMETHOD(OnSysShellProc)(INT, UINT, LONG) = 0;
};
DEFINE_GUID(IID_ITfThreadMgr_P, 0x7C6247A1, 0x2884, 0x4B7C, 0xAF, 0x24, 0xF1, 0x98, 0x04, 0x7A, 0xA7, 0x28);
struct ITfThreadMgr_P : ITfThreadMgr
{
STDMETHOD(GetAssociated)(HWND hwnd, ITfDocumentMgr **ppDocMgr) = 0;
STDMETHOD(SetSysHookSink)(ITfSysHookSink *pSysHookSink) = 0;
STDMETHOD(RequestPostponedLock)(ITfContext *pContext) = 0;
STDMETHOD(IsKeystrokeFeedEnabled)(int *) = 0;
STDMETHOD(CallImm32HotkeyHandler)(UINT vKey, LPARAM lParam, HRESULT* phrResult) = 0;
STDMETHOD(ActivateEx)(TfClientId*, DWORD) = 0;
};
DEFINE_GUID(IID_ITfKeystrokeMgr_P, 0x53FA1BEC, 0x5BE1, 0x458E, 0xAE, 0x70, 0xA9, 0xF1, 0xDC, 0x84, 0x3E, 0x81);
// FIXME: ITfKeystrokeMgr_P
DEFINE_GUID(IID_IAImmFnDocFeed, 0x6E098993, 0x9577, 0x499A, 0xA8, 0x30, 0x52, 0x34, 0x4F, 0x3E, 0x20, 0x0D);
DEFINE_GUID(CLSID_CAImmLayer, 0xB676DB87, 0x64DC, 0x4651, 0x99, 0xEC, 0x91, 0x07, 0x0E, 0xA4, 0x87, 0x90);
struct IAImmFnDocFeed : IUnknown
{
STDMETHOD(DocFeed)() = 0;
STDMETHOD(ClearDocFeedBuffer)() = 0;
STDMETHOD(StartReconvert)() = 0;
STDMETHOD(StartUndoCompositionString)() = 0;
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,59 +0,0 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Private header for msutb.dll
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*/
#pragma once
DEFINE_GUID(GUID_COMPARTMENT_SPEECH_OPENCLOSE, 0x544D6A63, 0xE2E8, 0x4752, 0xBB, 0xD1, 0x00, 0x09, 0x60, 0xBC, 0xA0, 0x83);
DEFINE_GUID(GUID_LBI_TRAYMAIN, 0xE0B724E9, 0x6F76, 0x45F7, 0xB4, 0xC1, 0xB1, 0xC0, 0xFA, 0xBC, 0xE2, 0x3E);
DEFINE_GUID(GUID_LBI_INATITEM, 0xCDBC683A, 0x55CE, 0x4717, 0xBA, 0xC0, 0x50, 0xBF, 0x44, 0xA3, 0x27, 0x0C);
DEFINE_GUID(GUID_LBI_CTRL, 0x58C99D96, 0x2F9B, 0x42CE, 0x91, 0xBE, 0x37, 0xEF, 0x18, 0x60, 0xF8, 0x82);
DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745C63, 0xB2F0, 0x4784, 0x8B, 0x67, 0x5E, 0x12, 0xC8, 0x70, 0x1A, 0x31);
DEFINE_GUID(CLSID_SYSTEMLANGBARITEM, 0xBEBACC94, 0x5CD3, 0x4662, 0xA1, 0xE0, 0xF3, 0x31, 0x99, 0x49, 0x36, 0x69);
DEFINE_GUID(IID_ITfLangBarMgr_P, 0xD72C0FA9, 0xADD5, 0x4AF0, 0x87, 0x06, 0x4F, 0xA9, 0xAE, 0x3E, 0x2E, 0xFF);
DEFINE_GUID(IID_ITfLangBarEventSink_P, 0x7A460360, 0xDA21, 0x4B09, 0xA8, 0xA0, 0x8A, 0x69, 0xE7, 0x28, 0xD8, 0x93);
DEFINE_GUID(CLSID_MSUTBDeskBand, 0x540D8A8B, 0x1C3F, 0x4E32, 0x81, 0x32, 0x53, 0x0F, 0x6A, 0x50, 0x20, 0x90);
DEFINE_GUID(CATID_DeskBand, 0x00021492, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46);
DEFINE_GUID(
GUID_TFCAT_DISPLAYATTRIBUTEPROPERTY, 0xB95F181B, 0xEA4C, 0x4AF1, 0x80, 0x56, 0x7C, 0x32, 0x1A, 0xBB, 0xB0, 0x91);
typedef struct CIC_LIBTHREAD
{
ITfCategoryMgr *m_pCategoryMgr;
ITfDisplayAttributeMgr *m_pDisplayAttrMgr;
} CIC_LIBTHREAD, *PCIC_LIBTHREAD;
EXTERN_C PCIC_LIBTHREAD WINAPI GetLibTls(VOID);
EXTERN_C BOOL WINAPI GetPopupTipbar(HWND hWnd, BOOL fWinLogon);
EXTERN_C HRESULT WINAPI SetRegisterLangBand(BOOL bRegister);
EXTERN_C VOID WINAPI ClosePopupTipbar(VOID);
struct ITfLangBarMgr_P : ITfLangBarMgr
{
STDMETHOD(GetPrevShowFloatingStatus)(DWORD*) = 0;
};
struct ITfLangBarEventSink_P : IUnknown
{
STDMETHOD(OnLangBarUpdate)(TfLBIClick click, BOOL bFlag) = 0;
};
inline void TFUninitLib_Thread(PCIC_LIBTHREAD pLibThread)
{
if (!pLibThread)
return;
if (pLibThread->m_pCategoryMgr)
{
pLibThread->m_pCategoryMgr->Release();
pLibThread->m_pCategoryMgr = NULL;
}
if (pLibThread->m_pDisplayAttrMgr)
{
pLibThread->m_pDisplayAttrMgr->Release();
pLibThread->m_pDisplayAttrMgr = NULL;
}
}

View file

@ -1,6 +0,0 @@
#pragma once
#include <windows.h>
#include <unknwn.h>
#include <stddef.h>
#include <stdlib.h>