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

[dev] fix description of UAS devices

* Having Windows append "SCSI Disk Device" screws up the scoring regarding
  disks that are actually describing themselves as SCSI, so replace that
  with "UAS Device", as it should be.
* Closes #2221.
* Also fix a MinGW warning.
This commit is contained in:
Pete Batard 2023-04-19 13:38:19 +01:00
parent a6451c6fc7
commit 1a3a155e8c
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
3 changed files with 27 additions and 14 deletions

View file

@ -778,6 +778,16 @@ BOOL GetDevices(DWORD devnum)
break; break;
} }
} }
// Windows has the bad habit of appending "SCSI Disk Device" to the description
// of UAS devices, which of course screws up detection of device that actually
// describe themselves as SCSI-like disks, so replace that with "UAS Device".
if (props.is_UASP) {
const char scsi_disk_device_str[] = "SCSI Disk Device";
const char uas_device_str[] = "UAS Device";
char* marker = strstr(buffer, scsi_disk_device_str);
if (marker != NULL && marker[sizeof(scsi_disk_device_str)] == 0)
memcpy(marker, uas_device_str, sizeof(uas_device_str));
}
if (props.is_VHD) { if (props.is_VHD) {
uprintf("Found VHD device '%s'", buffer); uprintf("Found VHD device '%s'", buffer);
} else if ((props.is_CARD) && ((!props.is_USB) || ((props.vid == 0) && (props.pid == 0)))) { } else if ((props.is_CARD) && ((!props.is_USB) || ((props.vid == 0) && (props.pid == 0)))) {
@ -821,8 +831,8 @@ BOOL GetDevices(DWORD devnum)
} }
if (props.speed >= USB_SPEED_MAX) if (props.speed >= USB_SPEED_MAX)
props.speed = 0; props.speed = 0;
uprintf("Found %s%s%s device '%s' (%s) %s", props.is_UASP?"UAS (":"", uprintf("Found %s%s%s device '%s' (%s) %s", props.is_UASP ? "UAS (" : "",
usb_speed_name[props.speed], props.is_UASP?")":"", buffer, str, method_str); usb_speed_name[props.speed], props.is_UASP ? ")" : "", buffer, str, method_str);
if (props.lower_speed) if (props.lower_speed)
uprintf("NOTE: This device is a USB 3.%c device operating at lower speed...", '0' + props.lower_speed - 1); uprintf("NOTE: This device is a USB 3.%c device operating at lower speed...", '0' + props.lower_speed - 1);
} }

View file

@ -3328,7 +3328,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
FILE* fd; FILE* fd;
BOOL attached_console = FALSE, external_loc_file = FALSE, lgp_set = FALSE, automount = TRUE; BOOL attached_console = FALSE, external_loc_file = FALSE, lgp_set = FALSE, automount = TRUE;
BOOL disable_hogger = FALSE, previous_enable_HDDs = FALSE, vc = IsRegistryNode(REGKEY_HKCU, vs_reg); BOOL disable_hogger = FALSE, previous_enable_HDDs = FALSE, vc = IsRegistryNode(REGKEY_HKCU, vs_reg);
BOOL alt_pressed = FALSE, alt_command = FALSE, is_WOW64 = FALSE; BOOL alt_pressed = FALSE, alt_command = FALSE;
BYTE *loc_data; BYTE *loc_data;
DWORD loc_size, u = 0, size = sizeof(u); DWORD loc_size, u = 0, size = sizeof(u);
char tmp_path[MAX_PATH] = "", loc_file[MAX_PATH] = "", ini_path[MAX_PATH] = "", ini_flags[] = "rb"; char tmp_path[MAX_PATH] = "", loc_file[MAX_PATH] = "", ini_path[MAX_PATH] = "", ini_flags[] = "rb";
@ -3414,13 +3414,16 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
static_strcpy(sysnative_dir, system_dir); static_strcpy(sysnative_dir, system_dir);
// But if the app is 32 bit and the OS is 64 bit, Sysnative must differ from System32 // But if the app is 32 bit and the OS is 64 bit, Sysnative must differ from System32
#if (!defined(_WIN64) && !defined(BUILD64)) #if (!defined(_WIN64) && !defined(BUILD64))
IsWow64Process(GetCurrentProcess(), &is_WOW64); {
if (is_WOW64) { BOOL is_WOW64 = FALSE;
if (GetSystemWindowsDirectoryU(sysnative_dir, sizeof(sysnative_dir)) == 0) { IsWow64Process(GetCurrentProcess(), &is_WOW64);
uprintf("Could not get Windows directory: %s", WindowsErrorString()); if (is_WOW64) {
static_strcpy(sysnative_dir, "C:\\Windows"); if (GetSystemWindowsDirectoryU(sysnative_dir, sizeof(sysnative_dir)) == 0) {
uprintf("Could not get Windows directory: %s", WindowsErrorString());
static_strcpy(sysnative_dir, "C:\\Windows");
}
static_strcat(sysnative_dir, "\\Sysnative");
} }
static_strcat(sysnative_dir, "\\Sysnative");
} }
#endif #endif

View file

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