aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2020-10-13 19:55:41 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2020-10-30 16:50:59 +0100
commita3d9431e70d0ffc9f36c0e12f2e2125e1f773104 (patch)
treeb8c2031c76222186350b6e238f85e446a0dfd0f4
parentapi: unify callback function type names (diff)
downloadwintun-a3d9431e70d0ffc9f36c0e12f2e2125e1f773104.tar.xz
wintun-a3d9431e70d0ffc9f36c0e12f2e2125e1f773104.zip
api: unify hardware ID string
Signed-off-by: Simon Rozman <simon@rozman.si>
-rw-r--r--api/devmgmt.c8
-rw-r--r--api/driver.c6
-rw-r--r--api/driver.h2
3 files changed, 6 insertions, 10 deletions
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 <Windows.h>
#include <SetupAPI.h>
+#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,