api: cleanup driver selection logic

With all the platforms (including ARM) having at least one driver now,
the dead-code removal #ifdef-s are no longer required.

Suggested-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2020-10-30 08:17:33 +01:00
parent 77459a130a
commit 4b0470210d
2 changed files with 5 additions and 21 deletions

View File

@ -776,8 +776,6 @@ WintunGetAdapterDeviceObject(_In_ const WINTUN_ADAPTER *Adapter, _Out_ HANDLE *H
return GetDeviceObject(Adapter->DevInstanceID, Handle);
}
#if defined(HAVE_EV) || defined(HAVE_WHQL)
/* We can't use RtlGetVersion, because appcompat's aclayers.dll shims it to report Vista
* when run from legacy contexts. So, we instead use the undocumented RtlGetNtVersionNumbers.
*
@ -796,10 +794,10 @@ HaveWHQL(void)
DWORD MajorVersion;
RtlGetNtVersionNumbers(&MajorVersion, NULL, NULL);
return MajorVersion >= 10;
# elif defined(HAVE_EV)
return FALSE;
#elif defined(HAVE_WHQL)
return TRUE;
#else
return FALSE;
#endif
}
@ -871,10 +869,6 @@ cleanupQueriedStore:
return Result;
}
#endif
#if defined(HAVE_EV) || defined(HAVE_WHQL)
static BOOL
IsNewer(_In_ const SP_DRVINFO_DATA_W *DrvInfoData, _In_ const FILETIME *DriverDate, _In_ DWORDLONG DriverVersion)
{
@ -1238,8 +1232,6 @@ cleanupMutex:
return Result;
}
#endif
static WINTUN_STATUS
CreateTemporaryDirectory(_Out_cap_c_(MAX_PATH) WCHAR *RandomTempSubDirectory)
{
@ -1559,7 +1551,6 @@ WintunCreateAdapter(
return CreateAdapterNatively(Pool, Name, RequestedGUID, Adapter, RebootRequired);
#endif
#if defined(HAVE_EV) || defined(HAVE_WHQL)
DWORD Result = ERROR_SUCCESS;
WCHAR RandomTempSubDirectory[MAX_PATH];
if ((Result = CreateTemporaryDirectory(RandomTempSubDirectory)) != ERROR_SUCCESS)
@ -1605,9 +1596,6 @@ cleanupDelete:
cleanupDirectory:
RemoveDirectoryW(RandomTempSubDirectory);
return Result;
#else
return ERROR_NOT_SUPPORTED;
#endif
}
#if defined(_M_IX86) || defined(_M_ARM)

View File

@ -24,8 +24,6 @@ DriverIsOurDrvInfoDetail(_In_ const SP_DRVINFO_DETAIL_DATA_W *DrvInfoDetailData)
DriverIsOurHardwareID(DrvInfoDetailData->HardwareID + DrvInfoDetailData->CompatIDsOffset);
}
#if defined(HAVE_EV) || defined(HAVE_WHQL)
WINTUN_STATUS
DriverRemoveAllOurs(void)
{
@ -72,5 +70,3 @@ cleanupDeviceInfoSet:
SetupDiDestroyDeviceInfoList(DevInfo);
return Result;
}
#endif