1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[misc] add S Mode detection to Windows version reporting

* With thanks to @Wack0
This commit is contained in:
Pete Batard 2023-08-18 17:37:16 +01:00
parent c5ad16fdeb
commit 5b6574d6f6
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
3 changed files with 39 additions and 7 deletions

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Drive access function calls
* Copyright © 2011-2022 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2023 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -57,7 +57,7 @@
#define VDS_RESCAN_REFRESH 0x00000001
#define VDS_RESCAN_REENUMERATE 0x00000002
#define VDS_SET_ERROR(hr) do { if (hr != S_OK) { SetLastError(hr); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_GEN_FAILURE; } } while(0)
#define VDS_SET_ERROR(hr) do { if (hr != S_OK) { SetLastError((DWORD)hr); FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_GEN_FAILURE; } } while(0)
#if !defined(__MINGW32__)
typedef enum _FSINFOCLASS {

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 4.3.2075"
CAPTION "Rufus 4.3.2076"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -392,8 +392,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,3,2075,0
PRODUCTVERSION 4,3,2075,0
FILEVERSION 4,3,2076,0
PRODUCTVERSION 4,3,2076,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -411,13 +411,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "4.3.2075"
VALUE "FileVersion", "4.3.2076"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-4.3.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "4.3.2075"
VALUE "ProductVersion", "4.3.2076"
END
END
BLOCK "VarFileInfo"

View file

@ -35,6 +35,15 @@
#include "settings.h"
// MinGW doesn't yet know these (from wldp.h)
typedef enum WLDP_WINDOWS_LOCKDOWN_MODE
{
WLDP_WINDOWS_LOCKDOWN_MODE_UNLOCKED = 0,
WLDP_WINDOWS_LOCKDOWN_MODE_TRIAL,
WLDP_WINDOWS_LOCKDOWN_MODE_LOCKED,
WLDP_WINDOWS_LOCKDOWN_MODE_MAX,
} WLDP_WINDOWS_LOCKDOWN_MODE, * PWLDP_WINDOWS_LOCKDOWN_MODE;
windows_version_t WindowsVersion = { 0 };
/*
@ -304,6 +313,25 @@ static const char* GetEdition(DWORD ProductType)
}
}
PF_TYPE_DECL(WINAPI, HRESULT, WldpQueryWindowsLockdownMode, (PWLDP_WINDOWS_LOCKDOWN_MODE));
BOOL isSMode(void)
{
BOOL r = FALSE;
WLDP_WINDOWS_LOCKDOWN_MODE mode;
PF_INIT_OR_OUT(WldpQueryWindowsLockdownMode, Wldp);
HRESULT hr = pfWldpQueryWindowsLockdownMode(&mode);
if (hr != S_OK) {
SetLastError((DWORD)hr);
uprintf("Could not detect S Mode: %s", WindowsErrorString());
} else {
r = (mode != WLDP_WINDOWS_LOCKDOWN_MODE_UNLOCKED);
}
out:
return r;
}
/*
* Modified from smartmontools' os_win32.cpp
*/
@ -451,6 +479,10 @@ void GetWindowsVersion(windows_version_t* windows_version)
safe_sprintf(vptr, vlen, " (Build %lu.%lu)", windows_version->BuildNumber, windows_version->Ubr);
else
safe_sprintf(vptr, vlen, " (Build %lu)", windows_version->BuildNumber);
vptr = &windows_version->VersionStr[safe_strlen(windows_version->VersionStr)];
vlen = sizeof(windows_version->VersionStr) - safe_strlen(windows_version->VersionStr) - 1;
if (isSMode())
safe_sprintf(vptr, vlen, " in S Mode");
}
/*