api: unify hardware ID string
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
parent
2727d14438
commit
a3d9431e70
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
#define WINTUN_HWID L"Wintun"
|
|
||||||
#define WAIT_FOR_REGISTRY_TIMEOUT 10000 /* ms */
|
#define WAIT_FOR_REGISTRY_TIMEOUT 10000 /* ms */
|
||||||
#define MAX_POOL_DEVICE_TYPE (MAX_POOL + 8) /* Should accommodate a pool name with " Tunnel" appended */
|
#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;
|
const static DWORD EnableDeadGWDetect = 0;
|
||||||
Result = RegSetKeyValueW(
|
Result = RegSetKeyValueW(
|
||||||
TcpipInterfaceRegKey,
|
TcpipInterfaceRegKey, NULL, L"EnableDeadGWDetect", REG_DWORD, &EnableDeadGWDetect, sizeof(EnableDeadGWDetect));
|
||||||
NULL,
|
|
||||||
L"EnableDeadGWDetect",
|
|
||||||
REG_DWORD,
|
|
||||||
&EnableDeadGWDetect,
|
|
||||||
sizeof(EnableDeadGWDetect));
|
|
||||||
if (Result != ERROR_SUCCESS)
|
if (Result != ERROR_SUCCESS)
|
||||||
WINTUN_LOGGER_ERROR(L"Failed to set EnableDeadGWDetect", Result);
|
WINTUN_LOGGER_ERROR(L"Failed to set EnableDeadGWDetect", Result);
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ InstallDriver(_In_ BOOL UpdateExisting)
|
|||||||
BOOL RebootRequired = FALSE;
|
BOOL RebootRequired = FALSE;
|
||||||
if (UpdateExisting &&
|
if (UpdateExisting &&
|
||||||
!UpdateDriverForPlugAndPlayDevicesW(
|
!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");
|
WINTUN_LOGGER_LAST_ERROR(L"Could not update existing adapters");
|
||||||
if (RebootRequired)
|
if (RebootRequired)
|
||||||
WINTUN_LOGGER(WINTUN_LOG_WARN, L"A reboot might be required, which really should not be the case");
|
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);
|
SP_DRVINFO_DETAIL_DATA_W *DrvInfoDetailData = DriverGetDrvInfoDetail(DevInfo, NULL, &DrvInfoData);
|
||||||
if (!DrvInfoDetailData)
|
if (!DrvInfoDetailData)
|
||||||
continue;
|
continue;
|
||||||
if (!_wcsicmp(DrvInfoDetailData->HardwareID, L"wintun"))
|
if (!_wcsicmp(DrvInfoDetailData->HardwareID, WINTUN_HWID))
|
||||||
{
|
{
|
||||||
PathStripPathW(DrvInfoDetailData->InfFileName);
|
PathStripPathW(DrvInfoDetailData->InfFileName);
|
||||||
WINTUN_LOGGER(WINTUN_LOG_INFO, L"Removing existing driver");
|
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);
|
SP_DRVINFO_DETAIL_DATA_W *DrvInfoDetailData = DriverGetDrvInfoDetail(DevInfo, DevInfoData, &DrvInfoData);
|
||||||
if (!DrvInfoDetailData)
|
if (!DrvInfoDetailData)
|
||||||
continue;
|
continue;
|
||||||
Found = !_wcsicmp(DrvInfoDetailData->HardwareID, L"wintun");
|
Found = !_wcsicmp(DrvInfoDetailData->HardwareID, WINTUN_HWID);
|
||||||
HeapFree(Heap, 0, DrvInfoDetailData);
|
HeapFree(Heap, 0, DrvInfoDetailData);
|
||||||
}
|
}
|
||||||
SetupDiDestroyDriverInfoList(DevInfo, DevInfoData, SPDIT_COMPATDRIVER);
|
SetupDiDestroyDriverInfoList(DevInfo, DevInfoData, SPDIT_COMPATDRIVER);
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <SetupAPI.h>
|
#include <SetupAPI.h>
|
||||||
|
|
||||||
|
#define WINTUN_HWID L"Wintun"
|
||||||
|
|
||||||
_Return_type_success_(return != NULL) SP_DRVINFO_DETAIL_DATA_W *DriverGetDrvInfoDetail(
|
_Return_type_success_(return != NULL) SP_DRVINFO_DETAIL_DATA_W *DriverGetDrvInfoDetail(
|
||||||
_In_ HDEVINFO DevInfo,
|
_In_ HDEVINFO DevInfo,
|
||||||
_In_opt_ SP_DEVINFO_DATA *DevInfoData,
|
_In_opt_ SP_DEVINFO_DATA *DevInfoData,
|
||||||
|
Loading…
Reference in New Issue
Block a user