diff --git a/client/LoginServer.cpp b/client/LoginServer.cpp index 79fb650..4c885c6 100644 --- a/client/LoginServer.cpp +++ b/client/LoginServer.cpp @@ -5,6 +5,24 @@ #include #include #include +#include + +// by ChatGPT +bool IsWindows11() { + typedef NTSTATUS(WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW); + RTL_OSVERSIONINFOW rovi = { 0 }; + rovi.dwOSVersionInfoSize = sizeof(rovi); + + HMODULE hMod = GetModuleHandleW(L"ntdll.dll"); + if (hMod) { + RtlGetVersionPtr rtlGetVersion = (RtlGetVersionPtr)GetProcAddress(hMod, "RtlGetVersion"); + if (rtlGetVersion) { + rtlGetVersion(&rovi); + return (rovi.dwMajorVersion == 10 && rovi.dwMinorVersion == 0 && rovi.dwBuildNumber >= 22000); + } + } + return false; +} /************************************************************************ --------------------- @@ -24,6 +42,11 @@ std::string getSystemName() { return vname; } + if (IsWindows11()) { + vname = "Windows 11"; + printf_s("此电脑的版本为:%s\n", vname.c_str()); + return vname; + } DWORD dwMajor, dwMinor, dwBuildNumber; NTPROC proc = (NTPROC)GetProcAddress(hinst, "RtlGetNtVersionNumbers"); if (proc==NULL)