[CTFMON][MSCTFIME][SDK] Improve cicGetOSInfo

and s/OSINFO_/CIC_OSINFO/.
Adapt ctfmon and msctfime to these changes.
CORE-19360
This commit is contained in:
Katayama Hirofumi MZ 2023-12-22 11:52:06 +09:00
parent 96d525959b
commit c4308d1e49
5 changed files with 41 additions and 24 deletions

View File

@ -55,7 +55,7 @@ CLoaderWnd::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_QUERYENDSESSION:
// NOTE: We don't support Win95/98/Me
#ifdef SUPPORT_WIN9X
if (!(g_dwOsInfo & OSINFO_NT) && (!g_fWinLogon || (lParam & ENDSESSION_LOGOFF)))
if (!(g_dwOsInfo & CIC_OSINFO_NT) && (!g_fWinLogon || (lParam & ENDSESSION_LOGOFF)))
{
ClosePopupTipbar();
TF_UninitSystem();

View File

@ -41,7 +41,7 @@ CRegWatcher::Init()
{
// NOTE: We don't support Win95/98/Me
#ifdef SUPPORT_WIN9X
if (!(g_dwOsInfo & OSINFO_NT))
if (!(g_dwOsInfo & CIC_OSINFO_NT))
s_WatchEntries[WI_RUN].hRootKey = HKEY_LOCAL_MACHINE;
#endif

View File

@ -177,9 +177,8 @@ InitApp(
{
g_hInst = hInstance; // Save the instance handle
g_uACP = ::GetACP(); // Save the active codepage
g_bOnWow64 = cicIsWow64(); // Is the current process on WoW64?
g_dwOsInfo = cicGetOSInfo(); // Get OS info
cicGetOSInfo(&g_uACP, &g_dwOsInfo); // Get OS info
// Create a mutex for Cicero
g_hCicMutex = TF_CreateCicLoadMutex(&g_fWinLogon);
@ -190,7 +189,7 @@ InitApp(
WriteRegRun();
// Call SetProcessShutdownParameters if possible
if (g_dwOsInfo & OSINFO_NT)
if (g_dwOsInfo & CIC_OSINFO_NT)
{
g_hKernel32 = cicGetSystemModuleHandle(L"kernel32.dll", FALSE);
g_fnSetProcessShutdownParameters =

View File

@ -11,6 +11,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msctfime);
HINSTANCE g_hInst = NULL; /* The instance of this module */
BOOL g_bWinLogon = FALSE;
UINT g_uACP = CP_ACP;
DWORD g_dwOSInfo = 0;
BOOL gfTFInitLib = FALSE;
CRITICAL_SECTION g_csLock;
@ -2841,7 +2842,7 @@ BOOL ProcessAttach(HINSTANCE hinstDLL)
if (!TLS::Initialize())
return FALSE;
g_dwOSInfo = cicGetOSInfo();
cicGetOSInfo(&g_uACP, &g_dwOSInfo);
// FIXME

View File

@ -60,47 +60,64 @@ static inline void GetPopupTipbar(HWND hwnd, BOOL fWinLogon)
}
/* The flags of cicGetOSInfo() */
#define OSINFO_NT 0x01
#define OSINFO_CJK 0x10
#define OSINFO_IMM 0x20
#define OSINFO_DBCS 0x40
#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
static inline DWORD
cicGetOSInfo(VOID)
static inline void
cicGetOSInfo(LPUINT puACP, LPDWORD pdwOSInfo)
{
DWORD dwOsInfo = 0;
*pdwOSInfo = 0;
/* Check OS version info */
OSVERSIONINFOW VerInfo = { sizeof(VerInfo) };
OSVERSIONINFOW VerInfo;
VerInfo.dwOSVersionInfoSize = sizeof(VerInfo);
GetVersionExW(&VerInfo);
if (VerInfo.dwPlatformId == DLLVER_PLATFORM_NT)
dwOsInfo |= OSINFO_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 */
switch (GetACP())
*puACP = GetACP();
switch (*puACP)
{
case 932: /* Japanese (Japan) */
case 936: /* Chinese (PRC, Singapore) */
case 949: /* Korean (Korea) */
case 950: /* Chinese (Taiwan, Hong Kong) */
dwOsInfo |= OSINFO_CJK;
*pdwOSInfo |= CIC_OSINFO_CJK;
break;
}
if (GetSystemMetrics(SM_IMMENABLED))
dwOsInfo |= OSINFO_IMM;
*pdwOSInfo |= CIC_OSINFO_IMM;
if (GetSystemMetrics(SM_DBCSENABLED))
dwOsInfo |= OSINFO_DBCS;
/* I'm not interested in other flags */
return dwOsInfo;
*pdwOSInfo |= CIC_OSINFO_DBCS;
}
struct CicSystemModulePath
{
WCHAR m_szPath[MAX_PATH];
WCHAR m_szPath[MAX_PATH + 2];
SIZE_T m_cchPath;
CicSystemModulePath()