mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[vds] enable device cycling when using VDS
* Hopefully using DICS_FLAG_CONFIGSPECIFIC instead of DICS_FLAG_GLOBAL is all that was needed to get device disabling/re-enabling work without creating zombie devices, because we sure need to force Windows' hand when it comes to detecting logical volumes...
This commit is contained in:
parent
4ee90a9546
commit
761953fdbf
3 changed files with 13 additions and 14 deletions
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Rufus: The Reliable USB Formatting Utility
|
* Rufus: The Reliable USB Formatting Utility
|
||||||
* Device detection and enumeration
|
* Device detection and enumeration
|
||||||
* Copyright © 2014-2019 Pete Batard <pete@akeo.ie>
|
* Copyright © 2014-2020 Pete Batard <pete@akeo.ie>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -181,7 +181,7 @@ out:
|
||||||
/*
|
/*
|
||||||
* Forces a refresh by disabling and then re-enabling the device using SetupAPI.
|
* Forces a refresh by disabling and then re-enabling the device using SetupAPI.
|
||||||
* Returns the Windows error code from the operation.
|
* Returns the Windows error code from the operation.
|
||||||
* Note: Currently, this may leave the device disabled after re-plug or reboot...
|
* Note: In some circumstances, this may leave the device disabled after re-plug or reboot...
|
||||||
*/
|
*/
|
||||||
int CycleDevice(int index)
|
int CycleDevice(int index)
|
||||||
{
|
{
|
||||||
|
@ -226,7 +226,7 @@ int CycleDevice(int index)
|
||||||
memset(&propchange_params, 0, sizeof(propchange_params));
|
memset(&propchange_params, 0, sizeof(propchange_params));
|
||||||
propchange_params.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
|
propchange_params.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
|
||||||
propchange_params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
|
propchange_params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
|
||||||
propchange_params.Scope = DICS_FLAG_GLOBAL;
|
propchange_params.Scope = DICS_FLAG_CONFIGSPECIFIC;
|
||||||
propchange_params.StateChange = DICS_DISABLE;
|
propchange_params.StateChange = DICS_DISABLE;
|
||||||
|
|
||||||
if (!SetupDiSetClassInstallParams(dev_info, &dev_info_data,
|
if (!SetupDiSetClassInstallParams(dev_info, &dev_info_data,
|
||||||
|
@ -247,7 +247,7 @@ int CycleDevice(int index)
|
||||||
memset(&propchange_params, 0, sizeof(propchange_params));
|
memset(&propchange_params, 0, sizeof(propchange_params));
|
||||||
propchange_params.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
|
propchange_params.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
|
||||||
propchange_params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
|
propchange_params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
|
||||||
propchange_params.Scope = DICS_FLAG_GLOBAL;
|
propchange_params.Scope = DICS_FLAG_CONFIGSPECIFIC;
|
||||||
propchange_params.StateChange = DICS_ENABLE;
|
propchange_params.StateChange = DICS_ENABLE;
|
||||||
if (!SetupDiSetClassInstallParams(dev_info, &dev_info_data,
|
if (!SetupDiSetClassInstallParams(dev_info, &dev_info_data,
|
||||||
(SP_CLASSINSTALL_HEADER*)&propchange_params, sizeof(propchange_params))) {
|
(SP_CLASSINSTALL_HEADER*)&propchange_params, sizeof(propchange_params))) {
|
||||||
|
|
|
@ -1680,7 +1680,7 @@ DWORD WINAPI FormatThread(void* param)
|
||||||
{
|
{
|
||||||
int i, r;
|
int i, r;
|
||||||
BOOL ret, use_large_fat32, windows_to_go, actual_lock_drive = lock_drive;
|
BOOL ret, use_large_fat32, windows_to_go, actual_lock_drive = lock_drive;
|
||||||
DWORD DriveIndex = (DWORD)(uintptr_t)param, ClusterSize, Flags;
|
DWORD cr, DriveIndex = (DWORD)(uintptr_t)param, ClusterSize, Flags;
|
||||||
HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE;
|
HANDLE hPhysicalDrive = INVALID_HANDLE_VALUE;
|
||||||
HANDLE hLogicalVolume = INVALID_HANDLE_VALUE;
|
HANDLE hLogicalVolume = INVALID_HANDLE_VALUE;
|
||||||
HANDLE hSourceImage = INVALID_HANDLE_VALUE;
|
HANDLE hSourceImage = INVALID_HANDLE_VALUE;
|
||||||
|
@ -1932,9 +1932,9 @@ DWORD WINAPI FormatThread(void* param)
|
||||||
if (use_vds) {
|
if (use_vds) {
|
||||||
safe_unlockclose(hPhysicalDrive);
|
safe_unlockclose(hPhysicalDrive);
|
||||||
uprintf("Refreshing drive layout...");
|
uprintf("Refreshing drive layout...");
|
||||||
#if 0
|
// Note: This may leave the device disabled on re-plug or reboot
|
||||||
// **DON'T USE** This may leave the device disabled on re-plug or reboot
|
// so only do this for the experimental VDS path for now...
|
||||||
DWORD cr = CycleDevice(ComboBox_GetCurSel(hDeviceList));
|
cr = CycleDevice(ComboBox_GetCurSel(hDeviceList));
|
||||||
if (cr == ERROR_DEVICE_REINITIALIZATION_NEEDED) {
|
if (cr == ERROR_DEVICE_REINITIALIZATION_NEEDED) {
|
||||||
uprintf("Zombie device detected, trying again...");
|
uprintf("Zombie device detected, trying again...");
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
|
@ -1944,7 +1944,6 @@ DWORD WINAPI FormatThread(void* param)
|
||||||
uprintf("Successfully cycled device");
|
uprintf("Successfully cycled device");
|
||||||
else
|
else
|
||||||
uprintf("Cycling device failed!");
|
uprintf("Cycling device failed!");
|
||||||
#endif
|
|
||||||
RefreshLayout(DriveIndex);
|
RefreshLayout(DriveIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -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.9.1612"
|
CAPTION "Rufus 3.9.1613"
|
||||||
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
|
||||||
|
@ -394,8 +394,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 3,9,1612,0
|
FILEVERSION 3,9,1613,0
|
||||||
PRODUCTVERSION 3,9,1612,0
|
PRODUCTVERSION 3,9,1613,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -413,13 +413,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.9.1612"
|
VALUE "FileVersion", "3.9.1613"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2020 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.9.exe"
|
VALUE "OriginalFilename", "rufus-3.9.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "3.9.1612"
|
VALUE "ProductVersion", "3.9.1613"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Reference in a new issue