diff --git a/src/rufus.c b/src/rufus.c index 467c3f26..dca7875f 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -2101,7 +2101,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine } input[i].type = INPUT_KEYBOARD; input[i].ki.wVk = VK_RETURN; -// SetWindowPos(GetConsoleWindow(), HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); SendInput(i+1, input, sizeof(INPUT)); safe_free(input); } @@ -2390,9 +2389,11 @@ relaunch: } out: - // Destroy our commandline hogger first, so that we can delete the app - ReleaseMutex(hogmutex); - safe_closehandle(hogmutex); + // Destroy the hogger mutex first, so that the cmdline app can exit and we can delete it + if (attached_console) { + ReleaseMutex(hogmutex); + safe_closehandle(hogmutex); + } if ((!external_loc_file) && (loc_file[0] != 0)) DeleteFileU(loc_file); DestroyAllTooltips(); diff --git a/src/rufus.rc b/src/rufus.rc index 9cf4c1d3..35202b4a 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 329 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Rufus 1.4.8.496" +CAPTION "Rufus 1.4.8.497" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 @@ -165,7 +165,7 @@ END RTL_IDD_DIALOG DIALOGEX 12, 12, 206, 329 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL -CAPTION "Rufus 1.4.8.496" +CAPTION "Rufus 1.4.8.497" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 @@ -428,8 +428,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,4,8,496 - PRODUCTVERSION 1,4,8,496 + FILEVERSION 1,4,8,497 + PRODUCTVERSION 1,4,8,497 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -446,13 +446,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.4.8.496" + VALUE "FileVersion", "1.4.8.497" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.4.8.496" + VALUE "ProductVersion", "1.4.8.497" END END BLOCK "VarFileInfo" diff --git a/src/usb.c b/src/usb.c index f7698390..060275be 100644 --- a/src/usb.c +++ b/src/usb.c @@ -68,7 +68,7 @@ static void GetUSBProperties(char* parent_path, char* device_id, usb_device_prop handle = CreateFileA(parent_path, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if (handle == INVALID_HANDLE_VALUE) { - uprintf("could not open hub %s: %s", parent_path, WindowsErrorString()); + uprintf("Could not open hub %s: %s", parent_path, WindowsErrorString()); goto out; } memset(&conn_info, 0, sizeof(conn_info)); @@ -76,7 +76,7 @@ static void GetUSBProperties(char* parent_path, char* device_id, usb_device_prop conn_info.ConnectionIndex = (ULONG)props->port; // coverity[tainted_data_argument] if (!DeviceIoControl(handle, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, &conn_info, size, &conn_info, size, &size, NULL)) { - uprintf("could not get node connection information for device '%s': %s", device_id, WindowsErrorString()); + uprintf("Could not get node connection information for '%s': %s", device_id, WindowsErrorString()); goto out; } @@ -92,7 +92,7 @@ static void GetUSBProperties(char* parent_path, char* device_id, usb_device_prop conn_info_v2.Length = size; conn_info_v2.SupportedUsbProtocols.Usb300 = 1; if (!DeviceIoControl(handle, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX_V2, &conn_info_v2, size, &conn_info_v2, size, &size, NULL)) { - uprintf("could not get node connection information (V2) for device '%s': %s", device_id, WindowsErrorString()); + uprintf("Could not get node connection information (V2) for device '%s': %s", device_id, WindowsErrorString()); } else if (conn_info_v2.Flags.DeviceIsOperatingAtSuperSpeedOrHigher) { props->speed = USB_SPEED_SUPER_OR_LATER; } else if (conn_info_v2.Flags.DeviceIsSuperSpeedCapableOrHigher) { @@ -262,6 +262,25 @@ BOOL GetUSBDevices(DWORD devnum) if (j > 0) { GetUSBProperties(dev_if_path.String[(uint32_t)htab_devid.table[j].data], device_id, &props); } + + // If the previous calls didn't succeed in getting the VID:PID, try from the device_id + // (This is for the case for USB media player devices, for instance) + if ((props.vid == 0) && (props.pid == 0)) { + BOOL post_backslash = FALSE; + for (j=0, k=0; (j