mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[core] fix Microsoft's inconsistent casing for device IDs
* Microsoft inconsistently lists similar Device IDs with either upper or lower case values. e.g. USB\VID_1908&PID_0226\5&23CE17BD&0&3 vs. USB\VID_1908&PID_0226\5&23ce17bd&0&3 * Of course this creates issues when using a case sensitive hash table... * We now convert all Device IDs to uppercase before hashing them.
This commit is contained in:
parent
659f2fae34
commit
c021b7bfd8
2 changed files with 16 additions and 5 deletions
11
src/dev.c
11
src/dev.c
|
@ -151,6 +151,13 @@ static __inline BOOL IsRemovable(const char* buffer)
|
|||
}
|
||||
}
|
||||
|
||||
static __inline void ToUpper(char* str)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < safe_strlen(str); i++)
|
||||
str[i] = toupper(str[i]);
|
||||
}
|
||||
|
||||
BOOL GetOpticalMedia(IMG_SAVE* img_save)
|
||||
{
|
||||
static char str[MAX_PATH];
|
||||
|
@ -349,6 +356,7 @@ BOOL GetDevices(DWORD devnum)
|
|||
s = StrArrayAdd(&dev_if_path, devint_detail_data->DevicePath, TRUE);
|
||||
uuprintf(" Hub[%d] = '%s'", s, devint_detail_data->DevicePath);
|
||||
if ((s>= 0) && (CM_Get_Device_IDA(device_inst, device_id, MAX_PATH, 0) == CR_SUCCESS)) {
|
||||
ToUpper(device_id);
|
||||
if ((k = htab_hash(device_id, &htab_devid)) != 0) {
|
||||
htab_devid.table[k].data = (void*)(uintptr_t)s;
|
||||
}
|
||||
|
@ -356,6 +364,7 @@ BOOL GetDevices(DWORD devnum)
|
|||
while (CM_Get_Sibling(&device_inst, device_inst, 0) == CR_SUCCESS) {
|
||||
device_id[0] = 0;
|
||||
if (CM_Get_Device_IDA(device_inst, device_id, MAX_PATH, 0) == CR_SUCCESS) {
|
||||
ToUpper(device_id);
|
||||
if ((k = htab_hash(device_id, &htab_devid)) != 0) {
|
||||
htab_devid.table[k].data = (void*)(uintptr_t)s;
|
||||
}
|
||||
|
@ -529,6 +538,7 @@ BOOL GetDevices(DWORD devnum)
|
|||
// If we're not dealing with the USBSTOR part of our list, then this is an UASP device
|
||||
props.is_UASP = ((((uintptr_t)device_id)+2) >= ((uintptr_t)devid_list)+list_start[uasp_start]);
|
||||
// Now get the properties of the device, and its Device ID, which we need to populate the properties
|
||||
ToUpper(device_id);
|
||||
j = htab_hash(device_id, &htab_devid);
|
||||
uuprintf(" Matched with ID[%03d]: %s", j, device_id);
|
||||
|
||||
|
@ -558,6 +568,7 @@ BOOL GetDevices(DWORD devnum)
|
|||
&& (CM_Get_Device_IDA(grandparent_inst, str, MAX_PATH, 0) == CR_SUCCESS) ) {
|
||||
device_id = str;
|
||||
method_str = "[GP]";
|
||||
ToUpper(device_id);
|
||||
j = htab_hash(device_id, &htab_devid);
|
||||
uuprintf(" Matched with (GP) ID[%03d]: %s", j, device_id);
|
||||
}
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 2.13.1065"
|
||||
CAPTION "Rufus 2.13.1066"
|
||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
||||
|
@ -334,8 +334,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,13,1065,0
|
||||
PRODUCTVERSION 2,13,1065,0
|
||||
FILEVERSION 2,13,1066,0
|
||||
PRODUCTVERSION 2,13,1066,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -352,13 +352,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "2.13.1065"
|
||||
VALUE "FileVersion", "2.13.1066"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "2.13.1065"
|
||||
VALUE "ProductVersion", "2.13.1066"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in a new issue