From cb2efce1a4fe9c89c5fef63b3aca63f3e63983fc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 26 Aug 2019 13:41:45 +0300 Subject: obsolete services removed from core & replaced with functions --- copylibapp.cmd | 4 +- include/m_core.h | 6 +- include/m_system.h | 55 +---------- libs/win32/mir_app.lib | Bin 192646 -> 193122 bytes libs/win32/mir_core.lib | Bin 455456 -> 455690 bytes libs/win64/mir_app.lib | Bin 188456 -> 188896 bytes libs/win64/mir_core.lib | Bin 460128 -> 460346 bytes plugins/BossKeyPlus/src/BossKeyIdle.cpp | 3 +- plugins/CrashDumper/src/dumper.cpp | 6 +- protocols/Discord/src/gateway.cpp | 6 +- protocols/JabberG/src/jabber_caps.cpp | 9 +- protocols/JabberG/src/jabber_iq_handlers.cpp | 8 +- src/core/stdautoaway/src/idle.cpp | 3 +- src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + src/mir_app/src/miranda.cpp | 17 +--- src/mir_core/src/mir_core.def | 3 +- src/mir_core/src/mir_core64.def | 3 +- src/mir_core/src/winver.cpp | 142 ++++++++++++++------------- 19 files changed, 114 insertions(+), 153 deletions(-) diff --git a/copylibapp.cmd b/copylibapp.cmd index 219c116bed..ad89dd4b43 100644 --- a/copylibapp.cmd +++ b/copylibapp.cmd @@ -1,3 +1,3 @@ @echo off -copy /Y .\Bin16\Debug\Obj\mir_app\mir_app.lib .\libs\win32 -copy /Y .\Bin16\Debug64\Obj\mir_app\mir_app.lib .\libs\win64 +copy /Y .\Bin15\Debug\Obj\mir_app\mir_app.lib .\libs\win32 +copy /Y .\Bin15\Debug64\Obj\mir_app\mir_app.lib .\libs\win64 diff --git a/include/m_core.h b/include/m_core.h index 086b78cbb7..eafe6a4083 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -533,7 +533,11 @@ MIR_CORE_DLL(BOOL) IsWorkstationLocked(); MIR_CORE_DLL(BOOL) IsScreenSaverRunning(); MIR_CORE_DLL(BOOL) IsTerminalDisconnected(); -MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize); +// returns OS version in version of Windows NT xx.xx +MIR_CORE_DLL(BOOL) OS_GetShortString(char *buf, size_t bufSize); + +// returns full OS version +MIR_CORE_DLL(BOOL) OS_GetDisplayString(char *buf, size_t bufSize); /////////////////////////////////////////////////////////////////////////////// diff --git a/include/m_system.h b/include/m_system.h index 761daf613a..26f964a9f6 100644 --- a/include/m_system.h +++ b/include/m_system.h @@ -116,58 +116,13 @@ EXTERN_C MIR_APP_DLL(bool) Miranda_OkToExit(void); // Waits for a permission to exit and destroys contact list EXTERN_C MIR_APP_DLL(void) Miranda_Close(void); -/* - wParam : 0 - lParam : (address) void (__cdecl *callback) (void) - Affect : Setup a function pointer to be called after main loop iterations, it allows for - idle processing, See notes - Returns: 1 on success, 0 on failure - - Notes : This service will only allow one function to be registered, if one is registered, 0 will be returned - Remember that this uses __cdecl. - Version: Added during 0.3.4+ - -*/ -#define MS_SYSTEM_SETIDLECALLBACK "Miranda/SetIdleCallback" - -/* - wParam : 0 - lParam : &tick - Affect : return the last window tick where a monitored event was seen, currently WM_CHAR/WM_MOUSEMOVE - Returns: Always returns 0 - Version: Added during 0.3.4+ (2004/09/12) -*/ -#define MS_SYSTEM_GETIDLE "Miranda/GetIdle" - -/* - wParam: cchMax (max length of buffer) - lParam: pointer to buffer to fill - Affect: Returns the build timestamp of the core, as a string of YYYYMMDDhhmmss, this service might - not exist and therefore the build is before 2004-09-30 - Returns: zero on success, non zero on failure - Version: 0.3.4a+ (2004/09/30) - DEFUNCT: This service was removed on 0.3.4.3+ (2004/11/19) use APILEVEL -*/ -#define MS_SYSTEM_GETBUILDSTRING "Miranda/GetBuildString" - -/* Missing service catcher -Is being called when one calls the non-existent service. -All parameters are stored in the special structure - -The event handler takes 0 as wParam and TMissingServiceParams* as lParam. - -0.4.3+ addition (2006/03/27) -*/ +// Sets up a function pointer to be called after main loop iterations, suitable for idle processing +EXTERN_C MIR_APP_DLL(void) Miranda_SetIdleCallback(void(__cdecl *pfnCallback)(void)); -typedef struct -{ - const char* name; - WPARAM wParam; - LPARAM lParam; -} - MISSING_SERVICE_PARAMS; +// returns the last window tick where a monitored event was seen, currently WM_CHAR/WM_MOUSEMOVE +EXTERN_C MIR_APP_DLL(DWORD) Miranda_GetIdle(void); -#define ME_SYSTEM_MISSINGSERVICE "System/MissingService" +///////////////////////////////////////////////////////////////////////////////////////// #if defined(__cplusplus) #include diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 170f3057e1..2a12a5df85 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib index 4e7b6831d7..c139086f45 100644 Binary files a/libs/win32/mir_core.lib and b/libs/win32/mir_core.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 949c6338e3..b191c493f2 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib index f8e6b076ae..768b5f0831 100644 Binary files a/libs/win64/mir_core.lib and b/libs/win64/mir_core.lib differ diff --git a/plugins/BossKeyPlus/src/BossKeyIdle.cpp b/plugins/BossKeyPlus/src/BossKeyIdle.cpp index 20d5163410..be04729ef5 100644 --- a/plugins/BossKeyPlus/src/BossKeyIdle.cpp +++ b/plugins/BossKeyPlus/src/BossKeyIdle.cpp @@ -32,9 +32,8 @@ VOID CALLBACK IdleTimer(HWND hwnd, UINT umsg, UINT idEvent, DWORD dwTime); static bool IsUserIdle() { - DWORD dwTick; if (g_wMaskAdv & OPT_HIDEIFMIRIDLE) { - CallService(MS_SYSTEM_GETIDLE, 0, (LPARAM)&dwTick); + DWORD dwTick = Miranda_GetIdle(); return GetTickCount() - dwTick > (minutes * 60 * 1000); } diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 86e5433a79..8e89470c5b 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -391,9 +391,9 @@ void PrintVersionInfo(CMStringW& buffer, unsigned flags) GetFreeMemoryString(buffer); buffer.Append(L"\r\n"); - wchar_t tszOsVer[200]; - GetOSDisplayString(tszOsVer, _countof(tszOsVer)); - buffer.Append(tszOsVer); + char szOsVer[200]; + OS_GetDisplayString(szOsVer, _countof(szOsVer)); + buffer.Append(_A2T(szOsVer)); buffer.Append(L"\r\n"); GetInternetExplorerVersion(buffer); diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp index fc760cb980..8d17a8ad5b 100644 --- a/protocols/Discord/src/gateway.cpp +++ b/protocols/Discord/src/gateway.cpp @@ -364,14 +364,14 @@ void CDiscordProto::GatewaySendIdentify() return; } - wchar_t wszOs[256]; - GetOSDisplayString(wszOs, _countof(wszOs)); + char szOs[256]; + OS_GetDisplayString(szOs, _countof(szOs)); char szVersion[256]; Miranda_GetVersionText(szVersion, _countof(szVersion)); JSONNode props; props.set_name("properties"); - props << WCHAR_PARAM("os", wszOs) << CHAR_PARAM("browser", "Chrome") << CHAR_PARAM("device", szVersion) + props << CHAR_PARAM("os", szOs) << CHAR_PARAM("browser", "Chrome") << CHAR_PARAM("device", szVersion) << CHAR_PARAM("referrer", "https://miranda-ng.org") << CHAR_PARAM("referring_domain", "miranda-ng.org"); JSONNode payload; payload.set_name("d"); diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 5a6114e426..f23ddbd213 100755 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -112,12 +112,12 @@ void CJabberProto::AddDefaultCaps() if (it.Valid()) myCaps |= it.jcbCap; - wchar_t szOsBuffer[256]; szOsBuffer[0] = 0; - GetOSDisplayString(szOsBuffer, _countof(szOsBuffer)); + char szOsBuffer[256]; + OS_GetDisplayString(szOsBuffer, _countof(szOsBuffer)); CJabberClientPartialCaps *pCaps = m_clientCapsManager.SetOwnCaps(JABBER_CAPS_MIRANDA_NODE, __VERSION_STRING_DOTS, myCaps); pCaps->m_szOs = mir_strdup("Microsoft Windows"); - pCaps->m_szOsVer = mir_utf8encodeW(szOsBuffer); + pCaps->m_szOsVer = mir_strdup(szOsBuffer); pCaps->m_szSoft = mir_strdup("Miranda NG Jabber Protocol"); pCaps->m_szSoftMir = mir_strdup(szCoreVersion); } @@ -497,9 +497,6 @@ void CJabberClientCapsManager::UpdateFeatHash() feat_buf.AppendChar('<'); } - wchar_t szOsBuffer[256]; szOsBuffer[0] = 0; - GetOSDisplayString(szOsBuffer, _countof(szOsBuffer)); - feat_buf.Append("software_version"); feat_buf.AppendChar('<'); feat_buf.Append(__VERSION_STRING_DOTS); feat_buf.AppendChar('<'); diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index d443d4fdc9..ed0ace2ff0 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -42,10 +42,10 @@ BOOL CJabberProto::OnIqRequestVersion(const TiXmlElement*, CJabberIqInfo *pInfo) query << XCHILD("version", szCoreVersion); if (m_bShowOSVersion) { - wchar_t os[256] = { 0 }; - if (!GetOSDisplayString(os, _countof(os))) - mir_wstrncpy(os, L"Microsoft Windows", _countof(os)); - query << XCHILD("os", T2Utf(os)); + char os[256]; + if (!OS_GetDisplayString(os, _countof(os))) + mir_strncpy(os, "Microsoft Windows", _countof(os)); + query << XCHILD("os", os); } m_ThreadInfo->send(iq); diff --git a/src/core/stdautoaway/src/idle.cpp b/src/core/stdautoaway/src/idle.cpp index 16dc7a1723..b378329686 100644 --- a/src/core/stdautoaway/src/idle.cpp +++ b/src/core/stdautoaway/src/idle.cpp @@ -31,8 +31,7 @@ int IdleOptInit(WPARAM wParam, LPARAM); static int IdleObject_IsUserIdle() { if (g_plugin.bIdleMethod) { - DWORD dwTick; - CallService(MS_SYSTEM_GETIDLE, 0, (LPARAM)&dwTick); + DWORD dwTick = Miranda_GetIdle(); return GetTickCount() - dwTick > (g_plugin.iIdleTime1st * 60 * 1000); } diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 2820883800..b44be34fa0 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -3,6 +3,7 @@ LIBRARY mir_app.mir EXPORTS Miranda_Close @1 NONAME CallProtoService @2 +Miranda_SetIdleCallback @3 NONAME Skin_LoadProtoIcon @4 Skin_LoadIcon @5 Button_FreeIcon_IcoLib @6 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 6ed7f2a46a..a41e448502 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -3,6 +3,7 @@ LIBRARY mir_app.mir EXPORTS Miranda_Close @1 NONAME CallProtoService @2 +Miranda_SetIdleCallback @3 NONAME Skin_LoadProtoIcon @4 Skin_LoadIcon @5 Button_FreeIcon_IcoLib @6 diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp index 214a196012..8441e0ceea 100644 --- a/src/mir_app/src/miranda.cpp +++ b/src/mir_app/src/miranda.cpp @@ -173,15 +173,11 @@ static void __cdecl compactHeapsThread(void*) } } -void(*SetIdleCallback) (void) = nullptr; +void (*SetIdleCallback)(void) = nullptr; -static INT_PTR SystemSetIdleCallback(WPARAM, LPARAM lParam) +MIR_APP_DLL(void) Miranda_SetIdleCallback(void(__cdecl *pfnCallback)(void)) { - if (lParam && SetIdleCallback == nullptr) { - SetIdleCallback = (void(*)(void))lParam; - return 1; - } - return 0; + SetIdleCallback = pfnCallback; } static DWORD dwEventTime = 0; @@ -195,10 +191,9 @@ void checkIdle(MSG * msg) } } -static INT_PTR SystemGetIdle(WPARAM, LPARAM lParam) +MIR_APP_DLL(DWORD) Miranda_GetIdle() { - if (lParam) *(DWORD*)lParam = dwEventTime; - return 0; + return dwEventTime; } static int SystemShutdownProc(WPARAM, LPARAM) @@ -346,8 +341,6 @@ int WINAPI mir_main(LPTSTR cmdLine) HookEvent(ME_SYSTEM_SHUTDOWN, SystemShutdownProc); mir_forkthread(compactHeapsThread); - CreateServiceFunction(MS_SYSTEM_SETIDLECALLBACK, SystemSetIdleCallback); - CreateServiceFunction(MS_SYSTEM_GETIDLE, SystemGetIdle); dwEventTime = GetTickCount(); DWORD myPid = GetCurrentProcessId(); diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 5adff0f533..242519a0da 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -906,6 +906,7 @@ WindowList_Remove @1108 Utils_AssertInsideScreen @1110 Utils_RestoreWindowPosition @1111 Utils_SaveWindowPosition @1112 +OS_GetShortString @1113 TimeZone_CreateByContact @1114 TimeZone_CreateByName @1115 TimeZone_GetDescription @1116 @@ -926,7 +927,7 @@ Utils_ResizeDialog @1130 Utils_GetRandom @1131 Utils_OpenUrl @1132 Utils_OpenUrlW @1133 -GetOSDisplayString @1134 +OS_GetDisplayString @1134 IsWinVer10Plus @1135 IsWinVer81Plus @1136 IsWinVer8Plus @1137 diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 4ff6e8e65f..8a75cfea10 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -906,6 +906,7 @@ WindowList_Remove @1108 Utils_AssertInsideScreen @1110 Utils_RestoreWindowPosition @1111 Utils_SaveWindowPosition @1112 +OS_GetShortString @1113 TimeZone_CreateByContact @1114 TimeZone_CreateByName @1115 TimeZone_GetDescription @1116 @@ -926,7 +927,7 @@ Utils_ResizeDialog @1130 Utils_GetRandom @1131 Utils_OpenUrl @1132 Utils_OpenUrlW @1133 -GetOSDisplayString @1134 +OS_GetDisplayString @1134 IsWinVer10Plus @1135 IsWinVer81Plus @1136 IsWinVer8Plus @1137 diff --git a/src/mir_core/src/winver.cpp b/src/mir_core/src/winver.cpp index 3ca4636057..72e01468d9 100644 --- a/src/mir_core/src/winver.cpp +++ b/src/mir_core/src/winver.cpp @@ -124,6 +124,17 @@ MIR_CORE_DLL(BOOL) IsScreenSaverRunning(void) ////////////////////////////////////////////////////////////////////////////////////////////////////// +MIR_CORE_DLL(BOOL) OS_GetShortString(char *buf, size_t bufSize) +{ + if (buf == nullptr || bufSize == 0) + return false; + + mir_snprintf(buf, bufSize, "Windows NT %d.%d", HIBYTE(dwWinVer), LOBYTE(dwWinVer)); + return true; +} + +////////////////////////////////////////////////////////////////////////////////////////////////////// + #ifndef PRODUCT_CORE_N // Win8 #define PRODUCT_CORE_SINGLELANGUAGE 0x00000064 #define PRODUCT_PROFESSIONAL_WMC 0x00000067 @@ -132,7 +143,7 @@ MIR_CORE_DLL(BOOL) IsScreenSaverRunning(void) typedef BOOL(WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); typedef LPCSTR(WINAPI *WGV)(void); -MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize) +MIR_CORE_DLL(BOOL) OS_GetDisplayString(char *buf, size_t bufSize) { if (buf == nullptr || bufSize == 0) return 0; @@ -145,52 +156,52 @@ MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize) if (!bOsVersionInfoEx) { osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!GetVersionEx((OSVERSIONINFO*)&osvi)) - return FALSE; + return false; } if (VER_PLATFORM_WIN32_NT != osvi.dwPlatformId || osvi.dwMajorVersion <= 4) - return FALSE; + return false; SYSTEM_INFO sysInfo = { 0 }; GetNativeSystemInfo(&sysInfo); - CMStringW ret(L"Microsoft "); + CMStringA ret("Microsoft "); // Test for the specific product. if (osvi.dwMajorVersion >= 6) { if (osvi.dwMajorVersion == 10) { if (osvi.wProductType == VER_NT_WORKSTATION) - ret.Append(L"Windows 10 "); + ret.Append("Windows 10 "); else - ret.Append(L"Windows Server 10 "); + ret.Append("Windows Server 10 "); } else switch (osvi.dwMinorVersion) { case 0: if (osvi.wProductType == VER_NT_WORKSTATION) - ret.Append(L"Windows Vista "); + ret.Append("Windows Vista "); else - ret.Append(L"Windows Server 2008 "); + ret.Append("Windows Server 2008 "); break; case 1: if (osvi.wProductType == VER_NT_WORKSTATION) - ret.Append(L"Windows 7 "); + ret.Append("Windows 7 "); else - ret.Append(L"Windows Server 2008 R2 "); + ret.Append("Windows Server 2008 R2 "); break; case 2: if (osvi.wProductType == VER_NT_WORKSTATION) - ret.Append(L"Windows 8 "); + ret.Append("Windows 8 "); else - ret.Append(L"Windows Server 2012 "); + ret.Append("Windows Server 2012 "); break; case 3: if (osvi.wProductType == VER_NT_WORKSTATION) - ret.Append(L"Windows 8.1 "); + ret.Append("Windows 8.1 "); else - ret.Append(L"Windows Server 2012 R2 "); + ret.Append("Windows Server 2012 R2 "); break; } @@ -202,149 +213,148 @@ MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize) switch (dwType) { case PRODUCT_ULTIMATE: - ret.Append(L"Ultimate Edition"); + ret.Append("Ultimate Edition"); break; case PRODUCT_PROFESSIONAL: - ret.Append(L"Professional Edition"); + ret.Append("Professional Edition"); break; case PRODUCT_PROFESSIONAL_WMC: - ret.Append(L"Professional Edition with Media Center"); + ret.Append("Professional Edition with Media Center"); break; case PRODUCT_HOME_PREMIUM: - ret.Append(L"Home Premium Edition"); + ret.Append("Home Premium Edition"); break; case PRODUCT_HOME_BASIC: - ret.Append(L"Home Basic Edition"); + ret.Append("Home Basic Edition"); break; case PRODUCT_ENTERPRISE: - ret.Append(L"Enterprise Edition"); + ret.Append("Enterprise Edition"); break; case PRODUCT_BUSINESS: - ret.Append(L"Business Edition"); + ret.Append("Business Edition"); break; case PRODUCT_STARTER: - ret.Append(L"Starter Edition"); + ret.Append("Starter Edition"); break; case PRODUCT_CLUSTER_SERVER: - ret.Append(L"Cluster Server Edition"); + ret.Append("Cluster Server Edition"); break; case PRODUCT_DATACENTER_SERVER: - ret.Append(L"Datacenter Edition"); + ret.Append("Datacenter Edition"); break; case PRODUCT_DATACENTER_SERVER_CORE: - ret.Append(L"Datacenter Edition (core installation)"); + ret.Append("Datacenter Edition (core installation)"); break; case PRODUCT_ENTERPRISE_SERVER: - ret.Append(L"Enterprise Edition"); + ret.Append("Enterprise Edition"); break; case PRODUCT_ENTERPRISE_SERVER_CORE: - ret.Append(L"Enterprise Edition (core installation)"); + ret.Append("Enterprise Edition (core installation)"); break; case PRODUCT_ENTERPRISE_SERVER_IA64: - ret.Append(L"Enterprise Edition for Itanium-based Systems"); + ret.Append("Enterprise Edition for Itanium-based Systems"); break; case PRODUCT_SMALLBUSINESS_SERVER: - ret.Append(L"Small Business Server"); + ret.Append("Small Business Server"); break; case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: - ret.Append(L"Small Business Server Premium Edition"); + ret.Append("Small Business Server Premium Edition"); break; case PRODUCT_STANDARD_SERVER: - ret.Append(L"Standard Edition"); + ret.Append("Standard Edition"); break; case PRODUCT_STANDARD_SERVER_CORE: - ret.Append(L"Standard Edition (core installation)"); + ret.Append("Standard Edition (core installation)"); break; case PRODUCT_WEB_SERVER: - ret.Append(L"Web Server Edition"); + ret.Append("Web Server Edition"); break; case PRODUCT_CORE_SINGLELANGUAGE: - ret.Append(L"Home Single Language"); + ret.Append("Home Single Language"); break; } if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - ret.Append(L", 64-bit"); + ret.Append(", 64-bit"); else if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) - ret.Append(L", 32-bit"); + ret.Append(", 32-bit"); } if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) { if (GetSystemMetrics(SM_SERVERR2)) - ret.Append(L"Windows Server 2003 R2, "); + ret.Append("Windows Server 2003 R2, "); else if (osvi.wSuiteMask == VER_SUITE_STORAGE_SERVER) - ret.Append(L"Windows Storage Server 2003"); + ret.Append("Windows Storage Server 2003"); else if (osvi.wSuiteMask == VER_SUITE_WH_SERVER) - ret.Append(L"Windows Home Server"); + ret.Append("Windows Home Server"); else if (osvi.wProductType == VER_NT_WORKSTATION && sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) - ret.Append(L"Windows XP Professional x64 Edition"); + ret.Append("Windows XP Professional x64 Edition"); else - ret.Append(L"Windows Server 2003, "); + ret.Append("Windows Server 2003, "); // Test for the server type. if (osvi.wProductType != VER_NT_WORKSTATION) { if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64) { if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - ret.Append(L"Datacenter Edition for Itanium-based Systems"); + ret.Append("Datacenter Edition for Itanium-based Systems"); else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - ret.Append(L"Enterprise Edition for Itanium-based Systems"); + ret.Append("Enterprise Edition for Itanium-based Systems"); } else if (sysInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - ret.Append(L"Datacenter x64 Edition"); + ret.Append("Datacenter x64 Edition"); else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - ret.Append(L"Enterprise x64 Edition"); - else ret.Append(L"Standard x64 Edition"); + ret.Append("Enterprise x64 Edition"); + else ret.Append("Standard x64 Edition"); } else { if (osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER) - ret.Append(L"Compute Cluster Edition"); + ret.Append("Compute Cluster Edition"); else if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - ret.Append(L"Datacenter Edition"); + ret.Append("Datacenter Edition"); else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - ret.Append(L"Enterprise Edition"); + ret.Append("Enterprise Edition"); else if (osvi.wSuiteMask & VER_SUITE_BLADE) - ret.Append(L"Web Edition"); - else ret.Append(L"Standard Edition"); + ret.Append("Web Edition"); + else ret.Append("Standard Edition"); } } } if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) { - ret.Append(L"Windows XP "); + ret.Append("Windows XP "); if (osvi.wSuiteMask & VER_SUITE_PERSONAL) - ret.Append(L"Home Edition"); - else ret.Append(L"Professional"); + ret.Append("Home Edition"); + else ret.Append("Professional"); } if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0) { - ret.Append(L"Windows 2000 "); + ret.Append("Windows 2000 "); if (osvi.wProductType == VER_NT_WORKSTATION) - ret.Append(L"Professional"); + ret.Append("Professional"); else { if (osvi.wSuiteMask & VER_SUITE_DATACENTER) - ret.Append(L"Datacenter Server"); + ret.Append("Datacenter Server"); else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - ret.Append(L"Advanced Server"); - else ret.Append(L"Server"); + ret.Append("Advanced Server"); + else ret.Append("Server"); } } // Include service pack (if any) and build number. - if (mir_wstrlen(osvi.szCSDVersion) > 0) { - ret.Append(L" "); - ret.Append(osvi.szCSDVersion); + ret.Append(" "); + ret.Append(_T2A(osvi.szCSDVersion)); } - ret.AppendFormat(L" (build %d)", osvi.dwBuildNumber); + ret.AppendFormat(" (build %d)", osvi.dwBuildNumber); HMODULE hNtDll = GetModuleHandleA("ntdll.dll"); if (WGV wine_get_version = (WGV)GetProcAddress(hNtDll, "wine_get_version")) { - ret.AppendFormat(L" (Wine %S)", wine_get_version()); + ret.AppendFormat(" (Wine %s)", wine_get_version()); } - mir_wstrncpy(buf, ret, bufSize); - return TRUE; + mir_strncpy(buf, ret, bufSize); + return true; } -- cgit v1.2.3