[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:
Pete Batard 2020-02-15 14:44:34 +00:00
parent 4ee90a9546
commit 761953fdbf
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
3 changed files with 13 additions and 14 deletions

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* 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
* 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.
* 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)
{
@ -226,7 +226,7 @@ int CycleDevice(int index)
memset(&propchange_params, 0, sizeof(propchange_params));
propchange_params.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
propchange_params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
propchange_params.Scope = DICS_FLAG_GLOBAL;
propchange_params.Scope = DICS_FLAG_CONFIGSPECIFIC;
propchange_params.StateChange = DICS_DISABLE;
if (!SetupDiSetClassInstallParams(dev_info, &dev_info_data,
@ -247,7 +247,7 @@ int CycleDevice(int index)
memset(&propchange_params, 0, sizeof(propchange_params));
propchange_params.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
propchange_params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
propchange_params.Scope = DICS_FLAG_GLOBAL;
propchange_params.Scope = DICS_FLAG_CONFIGSPECIFIC;
propchange_params.StateChange = DICS_ENABLE;
if (!SetupDiSetClassInstallParams(dev_info, &dev_info_data,
(SP_CLASSINSTALL_HEADER*)&propchange_params, sizeof(propchange_params))) {