api: do not call UpdateDriverForPlugAndPlayDevicesW
This seems to reset a number of device properties, and our update flow seems to update old adapters without needing to call this. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
8ec14e5f6d
commit
0d214d7254
@ -21,7 +21,6 @@
|
|||||||
#include <devguid.h>
|
#include <devguid.h>
|
||||||
#include <iphlpapi.h>
|
#include <iphlpapi.h>
|
||||||
#include <ndisguid.h>
|
#include <ndisguid.h>
|
||||||
#include <newdev.h>
|
|
||||||
#include <NTSecAPI.h>
|
#include <NTSecAPI.h>
|
||||||
#include <SetupAPI.h>
|
#include <SetupAPI.h>
|
||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
@ -1146,8 +1145,7 @@ EnsureWintunUnloaded(void)
|
|||||||
static _Return_type_success_(return != FALSE) BOOL SelectDriver(
|
static _Return_type_success_(return != FALSE) BOOL SelectDriver(
|
||||||
_In_ HDEVINFO DevInfo,
|
_In_ HDEVINFO DevInfo,
|
||||||
_In_opt_ SP_DEVINFO_DATA *DevInfoData,
|
_In_opt_ SP_DEVINFO_DATA *DevInfoData,
|
||||||
_Inout_ SP_DEVINSTALL_PARAMS_W *DevInstallParams,
|
_Inout_ SP_DEVINSTALL_PARAMS_W *DevInstallParams)
|
||||||
_Inout_ BOOL *RebootRequired)
|
|
||||||
{
|
{
|
||||||
static const FILETIME OurDriverDate = WINTUN_INF_FILETIME;
|
static const FILETIME OurDriverDate = WINTUN_INF_FILETIME;
|
||||||
static const DWORDLONG OurDriverVersion = WINTUN_INF_VERSION;
|
static const DWORDLONG OurDriverVersion = WINTUN_INF_VERSION;
|
||||||
@ -1267,12 +1265,6 @@ static _Return_type_success_(return != FALSE) BOOL SelectDriver(
|
|||||||
goto cleanupDelete;
|
goto cleanupDelete;
|
||||||
}
|
}
|
||||||
_Analysis_assume_nullterminated_(InfStorePath);
|
_Analysis_assume_nullterminated_(InfStorePath);
|
||||||
BOOL UpdateRebootRequired = FALSE;
|
|
||||||
if (ExistingAdapters &&
|
|
||||||
!UpdateDriverForPlugAndPlayDevicesW(
|
|
||||||
NULL, WINTUN_HWID, InfStorePath, INSTALLFLAG_FORCE | INSTALLFLAG_NONINTERACTIVE, &UpdateRebootRequired))
|
|
||||||
LOG(WINTUN_LOG_WARN, L"Could not update existing adapters");
|
|
||||||
*RebootRequired = *RebootRequired || UpdateRebootRequired;
|
|
||||||
|
|
||||||
SetupDiDestroyDriverInfoList(DevInfo, DevInfoData, SPDIT_COMPATDRIVER);
|
SetupDiDestroyDriverInfoList(DevInfo, DevInfoData, SPDIT_COMPATDRIVER);
|
||||||
DestroyDriverInfoListOnCleanup = FALSE;
|
DestroyDriverInfoListOnCleanup = FALSE;
|
||||||
@ -1395,7 +1387,7 @@ static _Return_type_success_(return != NULL) WINTUN_ADAPTER *CreateAdapter(
|
|||||||
goto cleanupDevInfo;
|
goto cleanupDevInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SelectDriver(DevInfo, &DevInfoData, &DevInstallParams, RebootRequired))
|
if (!SelectDriver(DevInfo, &DevInfoData, &DevInstallParams))
|
||||||
{
|
{
|
||||||
LastError = LOG(WINTUN_LOG_ERR, L"Failed to select driver");
|
LastError = LOG(WINTUN_LOG_ERR, L"Failed to select driver");
|
||||||
goto cleanupDevInfo;
|
goto cleanupDevInfo;
|
||||||
|
@ -117,8 +117,8 @@
|
|||||||
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">_M_ARM64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">_M_ARM64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<DelayLoadDLLs>bcrypt.dll;cfgmgr32.dll;iphlpapi.dll;nci.dll;newdev.dll;version.dll</DelayLoadDLLs>
|
<DelayLoadDLLs>bcrypt.dll;cfgmgr32.dll;iphlpapi.dll;nci.dll;version.dll</DelayLoadDLLs>
|
||||||
<AdditionalDependencies>Bcrypt.lib;Crypt32.lib;Cfgmgr32.lib;Iphlpapi.lib;$(IntDir)nci.lib;newdev.lib;ntdll.lib;Setupapi.lib;shlwapi.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>Bcrypt.lib;Crypt32.lib;Cfgmgr32.lib;Iphlpapi.lib;$(IntDir)nci.lib;ntdll.lib;Setupapi.lib;shlwapi.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
|
<ModuleDefinitionFile>exports.def</ModuleDefinitionFile>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
</Link>
|
</Link>
|
||||||
@ -209,4 +209,4 @@
|
|||||||
<Target Name="CleanSignTarget">
|
<Target Name="CleanSignTarget">
|
||||||
<Delete Files="$(IntermediateOutputPath)$(TargetName).sign" />
|
<Delete Files="$(IntermediateOutputPath)$(TargetName).sign" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user