aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-07-23 18:19:00 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2021-07-23 20:20:43 +0200
commit899e085a913fe114c72929a91338629128f517a2 (patch)
tree44f0c89fbfb6dbcebd3ded9ebb4a1acc2354e9d9
parentapi: remove unused pch file (diff)
downloadwintun-899e085a913fe114c72929a91338629128f517a2.tar.xz
wintun-899e085a913fe114c72929a91338629128f517a2.zip
api: build with WDK
Makes builds more reproducable, as we can do our next release using the EWDK, an all-in-one ISO of build tools from Microsoft. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--api/adapter.c5
-rw-r--r--api/api.vcxproj17
-rw-r--r--api/entry.c2
-rw-r--r--api/logger.c1
-rw-r--r--api/namespace.c2
-rw-r--r--api/ntdll.h6
-rw-r--r--api/registry.c1
-rw-r--r--api/rundll32.c1
-rw-r--r--api/session.c2
9 files changed, 33 insertions, 4 deletions
diff --git a/api/adapter.c b/api/adapter.c
index 3c65bb2..348441a 100644
--- a/api/adapter.c
+++ b/api/adapter.c
@@ -6,18 +6,19 @@
#include <WinSock2.h>
#include <Windows.h>
#include <winternl.h>
-#define _NTDEF_ /* TODO: figure out how to include ntsecapi and winternal together without requiring this */
+#include <wincrypt.h>
#include <cfgmgr32.h>
#include <devguid.h>
#include <ws2tcpip.h>
#include <iphlpapi.h>
#include <ndisguid.h>
-#include <NTSecAPI.h>
#include <SetupAPI.h>
#include <Shlwapi.h>
+#include <shellapi.h>
#include <wchar.h>
#include <initguid.h> /* Keep these two at bottom in this order, so that we only generate extra GUIDs for devpkey. The other keys we'll get from uuid.lib like usual. */
#include <devpkey.h>
+#include <devioctl.h>
#include "adapter.h"
#include "entry.h"
diff --git a/api/api.vcxproj b/api/api.vcxproj
index 79a9932..5aeedc1 100644
--- a/api/api.vcxproj
+++ b/api/api.vcxproj
@@ -39,15 +39,16 @@
<ProjectGuid>{897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>api</RootNamespace>
- <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
<ProjectName>api</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v142</PlatformToolset>
+ <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
<SpectreMitigation>false</SpectreMitigation>
+ <Driver_SpectreMitigation>false</Driver_SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
@@ -55,6 +56,18 @@
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)'=='Win32'" Label="Configuration">
+ <TargetVersion>Windows7</TargetVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)'=='ARM'" Label="Configuration">
+ <TargetVersion>Windows8</TargetVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)'=='x64'" Label="Configuration">
+ <TargetVersion>Windows7</TargetVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Platform)'=='ARM64'" Label="Configuration">
+ <TargetVersion>Windows10</TargetVersion>
+ </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
diff --git a/api/entry.c b/api/entry.c
index 7402f5c..c74cffe 100644
--- a/api/entry.c
+++ b/api/entry.c
@@ -17,6 +17,8 @@
#include <delayimp.h>
#pragma warning(pop)
#include <sddl.h>
+#include <winefs.h>
+#include <stdlib.h>
HINSTANCE ResourceModule;
HANDLE ModuleHeap;
diff --git a/api/logger.c b/api/logger.c
index 8afcd3f..253d525 100644
--- a/api/logger.c
+++ b/api/logger.c
@@ -8,6 +8,7 @@
#include <Windows.h>
#include <winternl.h>
#include <wchar.h>
+#include <stdlib.h>
static BOOL CALLBACK
NopLogger(_In_ WINTUN_LOGGER_LEVEL Level, _In_z_ const WCHAR *LogLine)
diff --git a/api/namespace.c b/api/namespace.c
index 735e585..aa8ffb4 100644
--- a/api/namespace.c
+++ b/api/namespace.c
@@ -10,7 +10,9 @@
#include <Windows.h>
#include <winternl.h>
#include <bcrypt.h>
+#include <winefs.h>
#include <wchar.h>
+#include <stdlib.h>
static HANDLE PrivateNamespace = NULL;
static HANDLE BoundaryDescriptor = NULL;
diff --git a/api/ntdll.h b/api/ntdll.h
index 93b32a6..825119b 100644
--- a/api/ntdll.h
+++ b/api/ntdll.h
@@ -61,3 +61,9 @@ NtQueryKey(
_Out_bytecap_post_bytecount_(Length, *ResultLength) PVOID KeyInformation,
_In_ ULONG Length,
_Out_ PULONG ResultLength);
+
+/* This is documented in NTSecAPI.h, which we can't include, due to header conflicts. It actually lives in advapi32.dll. */
+#define RtlGenRandom SystemFunction036
+BOOLEAN
+NTAPI
+RtlGenRandom(_Out_writes_bytes_all_(RandomBufferLength) PVOID RandomBuffer, _In_ ULONG RandomBufferLength); \ No newline at end of file
diff --git a/api/registry.c b/api/registry.c
index 7cb7cf2..bf012e2 100644
--- a/api/registry.c
+++ b/api/registry.c
@@ -8,6 +8,7 @@
#include "registry.h"
#include <Windows.h>
#include <wchar.h>
+#include <stdlib.h>
#include <strsafe.h>
static _Return_type_success_(return != NULL) HKEY
diff --git a/api/rundll32.c b/api/rundll32.c
index ca77b7f..80ada15 100644
--- a/api/rundll32.c
+++ b/api/rundll32.c
@@ -4,6 +4,7 @@
*/
#include "entry.h"
+#include <shellapi.h>
#if ACCEPT_WOW64 == 1
diff --git a/api/session.c b/api/session.c
index 7c408d5..41c623f 100644
--- a/api/session.c
+++ b/api/session.c
@@ -8,6 +8,8 @@
#include "logger.h"
#include "wintun.h"
#include <Windows.h>
+#include <devioctl.h>
+#include <stdlib.h>
#pragma warning(disable : 4200) /* nonstandard: zero-sized array in struct/union */