[core] add support for additional VHD drivers

* Closes #407
This commit is contained in:
Pete Batard 2014-11-27 23:36:28 +00:00
parent 5863db3ef3
commit 79ea0b2b94
2 changed files with 27 additions and 11 deletions

View file

@ -104,6 +104,24 @@ out:
safe_closehandle(handle);
}
static __inline BOOL IsVHD(const char* buffer)
{
int i;
// List of the Friendly Names of the VHD devices we know
const char* vhd_name[] = {
"Arsenal Virtual SCSI Disk Device",
"Kernsafe Virtual SCSI Disk Device",
"Microsoft Virtual Disk",
"MS Virtual Server SCSI Disk Device",
"Msft Virtual Disk"
};
for (i = 0; i < ARRAYSIZE(vhd_name); i++)
if (safe_stricmp(buffer, vhd_name[i]) == 0)
return TRUE;
return FALSE;
}
/*
* Refresh the list of USB devices
*/
@ -113,8 +131,6 @@ BOOL GetUSBDevices(DWORD devnum)
// 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* scsi_name = "SCSI";
const char* win8_vhd_name = "Microsoft Virtual Disk";
const char* win7_vhd_name = "Msft Virtual Disk";
const char* usb_speed_name[USB_SPEED_MAX] = { "USB", "USB 1.0", "USB 1.1", "USB 2.0", "USB 3.0" };
// Hash table and String Array used to match a Device ID with the parent hub's Device Interface Path
htab_table htab_devid = HTAB_EMPTY;
@ -249,7 +265,7 @@ BOOL GetUSBDevices(DWORD devnum)
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)"
safe_strcpy(buffer, sizeof(buffer), lmprintf(MSG_045));
} else if ((safe_strstr(buffer, win7_vhd_name) != NULL) || (safe_strstr(buffer, win8_vhd_name) != NULL)) {
} else if (IsVHD(buffer)) {
props.is_VHD = TRUE;
} else if (devid_list != NULL) {
// Get the properties of the device. We could avoid doing this lookup every time by keeping