diff options
author | 2020-10-29 12:04:34 +0100 | |
---|---|---|
committer | 2020-10-31 10:41:46 +0100 | |
commit | 4a575d210a34384787d4936dfb96d6b8cb2ea48c (patch) | |
tree | 0cde3fe255d641812a1af9f741c23312b03bfe48 /api/registry.c | |
parent | api: depretiate WintunIsPacketAvailable() (diff) | |
download | wintun-4a575d210a34384787d4936dfb96d6b8cb2ea48c.tar.xz wintun-4a575d210a34384787d4936dfb96d6b8cb2ea48c.zip |
api: fallback to hard-coded version
Windows 7 doesn't have DriverMajorVersion and DriverMinorVersion
registry values yet.
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'api/registry.c')
-rw-r--r-- | api/registry.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/api/registry.c b/api/registry.c index 3975eef..45e4b21 100644 --- a/api/registry.c +++ b/api/registry.c @@ -249,12 +249,16 @@ RegistryQueryStringWait(_In_ HKEY Key, _In_opt_z_ const WCHAR *Name, _In_ DWORD } WINTUN_STATUS -RegistryQueryDWORD(_In_ HKEY Key, _In_opt_z_ const WCHAR *Name, _Out_ DWORD *Value) +RegistryQueryDWORD(_In_ HKEY Key, _In_opt_z_ const WCHAR *Name, _Out_ DWORD *Value, _In_ BOOL Log) { DWORD ValueType, Size = sizeof(DWORD); DWORD Result = RegQueryValueExW(Key, Name, NULL, &ValueType, (BYTE *)Value, &Size); if (Result != ERROR_SUCCESS) - return LOG_ERROR(L"Querying failed", Result); + { + if (Log) + LOG_ERROR(L"Querying failed", Result); + return Result; + } if (ValueType != REG_DWORD) { LOG(WINTUN_LOG_ERR, L"Value is not a DWORD"); @@ -284,7 +288,7 @@ RegistryQueryDWORDWait(_In_ HKEY Key, _In_opt_z_ const WCHAR *Name, _In_ DWORD T LOG_ERROR(L"Failed to setup notification", Result); break; } - Result = RegistryQueryDWORD(Key, Name, Value); + Result = RegistryQueryDWORD(Key, Name, Value, FALSE); if (Result != ERROR_FILE_NOT_FOUND && Result != ERROR_PATH_NOT_FOUND) break; LONGLONG TimeLeft = Deadline - GetTickCount64(); |