mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Revert "OS (Windows): restores compatibility with WINE"
Seems WINE now has winbrand.dll
This reverts commit 554184ec72.
This commit is contained in:
+2
-1
@@ -1053,7 +1053,7 @@ elseif(WIN32)
|
||||
src/detection/physicalmemory/physicalmemory_linux.c
|
||||
src/detection/netio/netio_windows.c
|
||||
src/detection/opengl/opengl_windows.c
|
||||
src/detection/os/os_windows.cpp
|
||||
src/detection/os/os_windows.c
|
||||
src/detection/packages/packages_windows.c
|
||||
src/detection/poweradapter/poweradapter_nosupport.c
|
||||
src/detection/processes/processes_windows.c
|
||||
@@ -1727,6 +1727,7 @@ elseif(WIN32)
|
||||
PRIVATE "wtsapi32"
|
||||
PRIVATE "imagehlp"
|
||||
PRIVATE "cfgmgr32"
|
||||
PRIVATE "winbrand"
|
||||
PRIVATE "propsys"
|
||||
PRIVATE "secur32"
|
||||
PRIVATE "wintrust"
|
||||
|
||||
@@ -1,31 +1,10 @@
|
||||
extern "C" {
|
||||
#include "os.h"
|
||||
#include "common/library.h"
|
||||
#include "common/stringUtils.h"
|
||||
#include "common/windows/registry.h"
|
||||
}
|
||||
#include "common/windows/unicode.hpp"
|
||||
#include "common/windows/wmi.hpp"
|
||||
#include "common/windows/unicode.h"
|
||||
|
||||
static const char* getOsNameByWmi(FFstrbuf* osName)
|
||||
{
|
||||
FFWmiQuery query(L"SELECT Caption FROM Win32_OperatingSystem");
|
||||
if(!query)
|
||||
return "Query WMI service failed";
|
||||
|
||||
if(FFWmiRecord record = query.next())
|
||||
{
|
||||
if(auto vtCaption = record.get(L"Caption"))
|
||||
{
|
||||
ffStrbufSetWSV(osName, vtCaption.get<std::wstring_view>());
|
||||
ffStrbufTrimRight(osName, ' ');
|
||||
return NULL;
|
||||
}
|
||||
return "Get Caption failed";
|
||||
}
|
||||
|
||||
return "No WMI result returned";
|
||||
}
|
||||
#include <windows.h>
|
||||
|
||||
PWSTR WINAPI BrandingFormatString(PCWSTR format);
|
||||
|
||||
@@ -45,24 +24,13 @@ static bool getCodeName(FFOSResult* os)
|
||||
return true;
|
||||
}
|
||||
|
||||
static const char* getOsNameByWinbrand(FFstrbuf* osName)
|
||||
{
|
||||
//https://dennisbabkin.com/blog/?t=how-to-tell-the-real-version-of-windows-your-app-is-running-on#ver_string
|
||||
FF_LIBRARY_LOAD_MESSAGE(winbrand, "winbrand" FF_LIBRARY_EXTENSION, 1);
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(winbrand, BrandingFormatString);
|
||||
|
||||
const wchar_t* rawName = ffBrandingFormatString(L"%WINDOWS_LONG%");
|
||||
ffStrbufSetWS(osName, rawName);
|
||||
GlobalFree((HGLOBAL)rawName);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void ffDetectOSImpl(FFOSResult* os)
|
||||
{
|
||||
if(getOsNameByWinbrand(&os->variant) && getOsNameByWmi(&os->variant))
|
||||
return;
|
||||
|
||||
//https://dennisbabkin.com/blog/?t=how-to-tell-the-real-version-of-windows-your-app-is-running-on#ver_string
|
||||
const wchar_t* rawName = BrandingFormatString(L"%WINDOWS_LONG%");
|
||||
ffStrbufSetWS(&os->variant, rawName);
|
||||
GlobalFree((HGLOBAL)rawName);
|
||||
ffStrbufSet(&os->prettyName, &os->variant);
|
||||
ffStrbufTrimRight(&os->variant, ' ');
|
||||
|
||||
//WMI returns the "Microsoft" prefix while BrandingFormatString doesn't. Make them consistent.
|
||||
Reference in New Issue
Block a user