diff --git a/api/devmgmt.c b/api/devmgmt.c index 390ec20..01e96a2 100644 --- a/api/devmgmt.c +++ b/api/devmgmt.c @@ -5,7 +5,6 @@ #include "pch.h" -#define WINTUN_HWID L"Wintun" #define WAIT_FOR_REGISTRY_TIMEOUT 10000 /* ms */ #define MAX_POOL_DEVICE_TYPE (MAX_POOL + 8) /* Should accommodate a pool name with " Tunnel" appended */ @@ -1024,12 +1023,7 @@ WintunCreateAdapter( const static DWORD EnableDeadGWDetect = 0; Result = RegSetKeyValueW( - TcpipInterfaceRegKey, - NULL, - L"EnableDeadGWDetect", - REG_DWORD, - &EnableDeadGWDetect, - sizeof(EnableDeadGWDetect)); + TcpipInterfaceRegKey, NULL, L"EnableDeadGWDetect", REG_DWORD, &EnableDeadGWDetect, sizeof(EnableDeadGWDetect)); if (Result != ERROR_SUCCESS) WINTUN_LOGGER_ERROR(L"Failed to set EnableDeadGWDetect", Result); diff --git a/api/driver.c b/api/driver.c index df10ace..0a4c2ca 100644 --- a/api/driver.c +++ b/api/driver.c @@ -302,7 +302,7 @@ InstallDriver(_In_ BOOL UpdateExisting) BOOL RebootRequired = FALSE; if (UpdateExisting && !UpdateDriverForPlugAndPlayDevicesW( - NULL, L"Wintun", InfPath, INSTALLFLAG_FORCE | INSTALLFLAG_NONINTERACTIVE, &RebootRequired)) + NULL, WINTUN_HWID, InfPath, INSTALLFLAG_FORCE | INSTALLFLAG_NONINTERACTIVE, &RebootRequired)) WINTUN_LOGGER_LAST_ERROR(L"Could not update existing adapters"); if (RebootRequired) WINTUN_LOGGER(WINTUN_LOG_WARN, L"A reboot might be required, which really should not be the case"); @@ -346,7 +346,7 @@ static WINTUN_STATUS RemoveDriver(VOID) SP_DRVINFO_DETAIL_DATA_W *DrvInfoDetailData = DriverGetDrvInfoDetail(DevInfo, NULL, &DrvInfoData); if (!DrvInfoDetailData) continue; - if (!_wcsicmp(DrvInfoDetailData->HardwareID, L"wintun")) + if (!_wcsicmp(DrvInfoDetailData->HardwareID, WINTUN_HWID)) { PathStripPathW(DrvInfoDetailData->InfFileName); WINTUN_LOGGER(WINTUN_LOG_INFO, L"Removing existing driver"); @@ -396,7 +396,7 @@ DriverIsWintunAdapter(_In_ HDEVINFO DevInfo, _In_opt_ SP_DEVINFO_DATA *DevInfoDa SP_DRVINFO_DETAIL_DATA_W *DrvInfoDetailData = DriverGetDrvInfoDetail(DevInfo, DevInfoData, &DrvInfoData); if (!DrvInfoDetailData) continue; - Found = !_wcsicmp(DrvInfoDetailData->HardwareID, L"wintun"); + Found = !_wcsicmp(DrvInfoDetailData->HardwareID, WINTUN_HWID); HeapFree(Heap, 0, DrvInfoDetailData); } SetupDiDestroyDriverInfoList(DevInfo, DevInfoData, SPDIT_COMPATDRIVER); diff --git a/api/driver.h b/api/driver.h index 5d30878..e8514df 100644 --- a/api/driver.h +++ b/api/driver.h @@ -9,6 +9,8 @@ #include #include +#define WINTUN_HWID L"Wintun" + _Return_type_success_(return != NULL) SP_DRVINFO_DETAIL_DATA_W *DriverGetDrvInfoDetail( _In_ HDEVINFO DevInfo, _In_opt_ SP_DEVINFO_DATA *DevInfoData,