From c4308d1e49c27849f5f7c960cb909d33684b032e Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Fri, 22 Dec 2023 11:52:06 +0900 Subject: [PATCH] [CTFMON][MSCTFIME][SDK] Improve cicGetOSInfo and s/OSINFO_/CIC_OSINFO/. Adapt ctfmon and msctfime to these changes. CORE-19360 --- base/applications/ctfmon/CLoaderWnd.cpp | 2 +- base/applications/ctfmon/CRegWatcher.cpp | 2 +- base/applications/ctfmon/ctfmon.cpp | 5 +-- dll/ime/msctfime/msctfime.cpp | 3 +- sdk/include/reactos/cicero/cicbase.h | 53 ++++++++++++++++-------- 5 files changed, 41 insertions(+), 24 deletions(-) diff --git a/base/applications/ctfmon/CLoaderWnd.cpp b/base/applications/ctfmon/CLoaderWnd.cpp index 400941be008..a95259dd584 100644 --- a/base/applications/ctfmon/CLoaderWnd.cpp +++ b/base/applications/ctfmon/CLoaderWnd.cpp @@ -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(); diff --git a/base/applications/ctfmon/CRegWatcher.cpp b/base/applications/ctfmon/CRegWatcher.cpp index f27ab57895c..04d3f213622 100644 --- a/base/applications/ctfmon/CRegWatcher.cpp +++ b/base/applications/ctfmon/CRegWatcher.cpp @@ -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 diff --git a/base/applications/ctfmon/ctfmon.cpp b/base/applications/ctfmon/ctfmon.cpp index 676c0657289..c0da53c4cf4 100644 --- a/base/applications/ctfmon/ctfmon.cpp +++ b/base/applications/ctfmon/ctfmon.cpp @@ -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 = diff --git a/dll/ime/msctfime/msctfime.cpp b/dll/ime/msctfime/msctfime.cpp index 36dcf4b68f3..1164df5c733 100644 --- a/dll/ime/msctfime/msctfime.cpp +++ b/dll/ime/msctfime/msctfime.cpp @@ -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 diff --git a/sdk/include/reactos/cicero/cicbase.h b/sdk/include/reactos/cicero/cicbase.h index ff18ce94f72..c3eff7f720c 100644 --- a/sdk/include/reactos/cicero/cicbase.h +++ b/sdk/include/reactos/cicero/cicbase.h @@ -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()