mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
Upstream merge
This commit is contained in:
parent
0e18200080
commit
e1b65ad81b
1 changed files with 22 additions and 27 deletions
49
src/rufus.c
49
src/rufus.c
|
@ -633,7 +633,7 @@ static BOOL GetUSBDevices(DWORD devnum)
|
||||||
// The rest are the vendor UASP drivers I know of so far - list may be incomplete!
|
// The rest are the vendor UASP drivers I know of so far - list may be incomplete!
|
||||||
const char* storage_name[] = { "USBSTOR", "UASPSTOR", "VUSBSTOR", "ETRONSTOR" };
|
const char* storage_name[] = { "USBSTOR", "UASPSTOR", "VUSBSTOR", "ETRONSTOR" };
|
||||||
const char* scsi_name = "SCSI";
|
const char* scsi_name = "SCSI";
|
||||||
const char* vhd_name[] = { "Microsoft Virtual Disk", "Msft Virtual Disk SCSI Disk Device" };
|
const char* vhd_name = "Microsoft Virtual Disk";
|
||||||
char letter_name[] = " (?:)";
|
char letter_name[] = " (?:)";
|
||||||
BOOL found = FALSE, is_SCSI, is_UASP, is_VHD;
|
BOOL found = FALSE, is_SCSI, is_UASP, is_VHD;
|
||||||
HDEVINFO dev_info = NULL;
|
HDEVINFO dev_info = NULL;
|
||||||
|
@ -713,33 +713,28 @@ static BOOL GetUSBDevices(DWORD devnum)
|
||||||
uprintf("SetupDiGetDeviceRegistryProperty (Friendly Name) failed: %s\n", WindowsErrorString());
|
uprintf("SetupDiGetDeviceRegistryProperty (Friendly Name) failed: %s\n", WindowsErrorString());
|
||||||
// We can afford a failure on this call - just replace the name with "USB Storage Device (Generic)"
|
// We can afford a failure on this call - just replace the name with "USB Storage Device (Generic)"
|
||||||
safe_strcpy(buffer, sizeof(buffer), lmprintf(MSG_045));
|
safe_strcpy(buffer, sizeof(buffer), lmprintf(MSG_045));
|
||||||
|
} else if (safe_stricmp(buffer, vhd_name) == 0) {
|
||||||
|
is_VHD = TRUE;
|
||||||
} else {
|
} else {
|
||||||
for (j = 0; j < ARRAYSIZE(vhd_name); j++) {
|
// Get the VID:PID of the device. We could avoid doing this lookup every time by keeping
|
||||||
if (safe_stricmp(buffer, vhd_name[j]) == 0) {
|
// a lookup table, but there shouldn't be that many USB storage devices connected...
|
||||||
is_VHD = TRUE;
|
for (devid = devid_list; *devid; devid += strlen(devid) + 1) {
|
||||||
}
|
if ( (CM_Locate_DevNodeA(&parent_inst, devid, 0) == 0)
|
||||||
}
|
&& (CM_Get_Child(&device_inst, parent_inst, 0) == 0)
|
||||||
if (is_VHD == FALSE) {
|
&& (device_inst == dev_info_data.DevInst) ) {
|
||||||
// Get the VID:PID of the device. We could avoid doing this lookup every time by keeping
|
BOOL post_backslash = FALSE;
|
||||||
// a lookup table, but there shouldn't be that many USB storage devices connected...
|
// If we're not dealing with the USBSTOR part of our list, then this is an UASP device
|
||||||
for (devid = devid_list; *devid; devid += strlen(devid) + 1) {
|
is_UASP = ((((uintptr_t)devid)+2) >= ((uintptr_t)devid_list)+list_size[0]);
|
||||||
if ( (CM_Locate_DevNodeA(&parent_inst, devid, 0) == 0)
|
for (j=0, k=0; (j<strlen(devid))&&(k<2); j++) {
|
||||||
&& (CM_Get_Child(&device_inst, parent_inst, 0) == 0)
|
// The ID is in the form USB_VENDOR_BUSID\VID_xxxx&PID_xxxx\...
|
||||||
&& (device_inst == dev_info_data.DevInst) ) {
|
if (devid[j] == '\\')
|
||||||
BOOL post_backslash = FALSE;
|
post_backslash = TRUE;
|
||||||
// If we're not dealing with the USBSTOR part of our list, then this is an UASP device
|
if (!post_backslash)
|
||||||
is_UASP = ((((uintptr_t)devid)+2) >= ((uintptr_t)devid_list)+list_size[0]);
|
continue;
|
||||||
for (j=0, k=0; (j<strlen(devid))&&(k<2); j++) {
|
if (devid[j] == '_') {
|
||||||
// The ID is in the form USB_VENDOR_BUSID\VID_xxxx&PID_xxxx\...
|
pid = (uint16_t)strtoul(&devid[j+1], NULL, 16);
|
||||||
if (devid[j] == '\\')
|
// We could have used a vid_pid[] table, but keeping vid/pid separate is clearer
|
||||||
post_backslash = TRUE;
|
if (k++==0) vid = pid;
|
||||||
if (!post_backslash)
|
|
||||||
continue;
|
|
||||||
if (devid[j] == '_') {
|
|
||||||
pid = (uint16_t)strtoul(&devid[j+1], NULL, 16);
|
|
||||||
// We could have used a vid_pid[] table, but keeping vid/pid separate is clearer
|
|
||||||
if (k++==0) vid = pid;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue