mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-07-20 14:22:00 +00:00
[host] windows: report Windows 11 OS name correctly
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled
This commit brings bc96319b9486798edc6599841dd67476feea5e43's improved logic in the IDD to the host application.
This commit is contained in:
@@ -723,7 +723,38 @@ KVMFROS os_getKVMFRType(void)
|
||||
return KVMFR_OS_WINDOWS;
|
||||
}
|
||||
|
||||
static bool getProductName(char * buffer, DWORD bufferSize)
|
||||
typedef PWSTR (WINAPI *PFN_BRANDING_FORMAT_STRING)(PCWSTR pstrFormat);
|
||||
|
||||
static bool getBrandingVersionString(char * buffer, DWORD bufferSize)
|
||||
{
|
||||
HMODULE hWinBrand = LoadLibraryExA("winbrand.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||
|
||||
if (!hWinBrand)
|
||||
return false;
|
||||
|
||||
PFN_BRANDING_FORMAT_STRING BrandingFormatString =
|
||||
(PFN_BRANDING_FORMAT_STRING) GetProcAddress(hWinBrand, "BrandingFormatString");
|
||||
|
||||
bool succeeded = false;
|
||||
|
||||
if (BrandingFormatString)
|
||||
{
|
||||
PWSTR pwstrOSName = BrandingFormatString(L"%WINDOWS_LONG%");
|
||||
|
||||
if (pwstrOSName)
|
||||
{
|
||||
if (WideCharToMultiByte(CP_UTF8, 0, pwstrOSName, -1, buffer, bufferSize, NULL, NULL))
|
||||
succeeded = true;
|
||||
|
||||
GlobalFree((HGLOBAL)pwstrOSName);
|
||||
}
|
||||
}
|
||||
|
||||
FreeLibrary(hWinBrand);
|
||||
return succeeded;
|
||||
}
|
||||
|
||||
static bool getRegistryProductName(char * buffer, DWORD bufferSize)
|
||||
{
|
||||
LSTATUS status = RegGetValueA(HKEY_LOCAL_MACHINE,
|
||||
"Software\\Microsoft\\Windows NT\\CurrentVersion", "ProductName",
|
||||
@@ -748,7 +779,8 @@ const char * os_getOSName(void)
|
||||
GetVersionExA(&osvi);
|
||||
|
||||
char productName[1024];
|
||||
if (getProductName(productName, sizeof(productName)))
|
||||
if (getBrandingVersionString(productName, sizeof(productName)) ||
|
||||
getRegistryProductName(productName, sizeof(productName)))
|
||||
{
|
||||
alloc_sprintf(
|
||||
&app.osVersion,
|
||||
|
||||
Reference in New Issue
Block a user