Skip to content

Commit 899e085

Browse files
committed
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 <[email protected]>
1 parent af83574 commit 899e085

File tree

9 files changed

+33
-4
lines changed

9 files changed

+33
-4
lines changed

api/adapter.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@
66
#include <WinSock2.h>
77
#include <Windows.h>
88
#include <winternl.h>
9-
#define _NTDEF_ /* TODO: figure out how to include ntsecapi and winternal together without requiring this */
9+
#include <wincrypt.h>
1010
#include <cfgmgr32.h>
1111
#include <devguid.h>
1212
#include <ws2tcpip.h>
1313
#include <iphlpapi.h>
1414
#include <ndisguid.h>
15-
#include <NTSecAPI.h>
1615
#include <SetupAPI.h>
1716
#include <Shlwapi.h>
17+
#include <shellapi.h>
1818
#include <wchar.h>
1919
#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. */
2020
#include <devpkey.h>
21+
#include <devioctl.h>
2122

2223
#include "adapter.h"
2324
#include "entry.h"

api/api.vcxproj

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,35 @@
3939
<ProjectGuid>{897F02E3-3EAA-40AF-A6DC-17EB2376EDAF}</ProjectGuid>
4040
<Keyword>Win32Proj</Keyword>
4141
<RootNamespace>api</RootNamespace>
42-
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
42+
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
4343
<ProjectName>api</ProjectName>
4444
</PropertyGroup>
4545
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
4646
<PropertyGroup Label="Configuration">
4747
<ConfigurationType>DynamicLibrary</ConfigurationType>
4848
<CharacterSet>Unicode</CharacterSet>
49-
<PlatformToolset>v142</PlatformToolset>
49+
<PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset>
5050
<SpectreMitigation>false</SpectreMitigation>
51+
<Driver_SpectreMitigation>false</Driver_SpectreMitigation>
5152
</PropertyGroup>
5253
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
5354
<UseDebugLibraries>true</UseDebugLibraries>
5455
</PropertyGroup>
5556
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
5657
<WholeProgramOptimization>true</WholeProgramOptimization>
5758
</PropertyGroup>
59+
<PropertyGroup Condition="'$(Platform)'=='Win32'" Label="Configuration">
60+
<TargetVersion>Windows7</TargetVersion>
61+
</PropertyGroup>
62+
<PropertyGroup Condition="'$(Platform)'=='ARM'" Label="Configuration">
63+
<TargetVersion>Windows8</TargetVersion>
64+
</PropertyGroup>
65+
<PropertyGroup Condition="'$(Platform)'=='x64'" Label="Configuration">
66+
<TargetVersion>Windows7</TargetVersion>
67+
</PropertyGroup>
68+
<PropertyGroup Condition="'$(Platform)'=='ARM64'" Label="Configuration">
69+
<TargetVersion>Windows10</TargetVersion>
70+
</PropertyGroup>
5871
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
5972
<ImportGroup Label="ExtensionSettings">
6073
</ImportGroup>

api/entry.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <delayimp.h>
1818
#pragma warning(pop)
1919
#include <sddl.h>
20+
#include <winefs.h>
21+
#include <stdlib.h>
2022

2123
HINSTANCE ResourceModule;
2224
HANDLE ModuleHeap;

api/logger.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <Windows.h>
99
#include <winternl.h>
1010
#include <wchar.h>
11+
#include <stdlib.h>
1112

1213
static BOOL CALLBACK
1314
NopLogger(_In_ WINTUN_LOGGER_LEVEL Level, _In_z_ const WCHAR *LogLine)

api/namespace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#include <Windows.h>
1111
#include <winternl.h>
1212
#include <bcrypt.h>
13+
#include <winefs.h>
1314
#include <wchar.h>
15+
#include <stdlib.h>
1416

1517
static HANDLE PrivateNamespace = NULL;
1618
static HANDLE BoundaryDescriptor = NULL;

api/ntdll.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@ NtQueryKey(
6161
_Out_bytecap_post_bytecount_(Length, *ResultLength) PVOID KeyInformation,
6262
_In_ ULONG Length,
6363
_Out_ PULONG ResultLength);
64+
65+
/* This is documented in NTSecAPI.h, which we can't include, due to header conflicts. It actually lives in advapi32.dll. */
66+
#define RtlGenRandom SystemFunction036
67+
BOOLEAN
68+
NTAPI
69+
RtlGenRandom(_Out_writes_bytes_all_(RandomBufferLength) PVOID RandomBuffer, _In_ ULONG RandomBufferLength);

api/registry.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "registry.h"
99
#include <Windows.h>
1010
#include <wchar.h>
11+
#include <stdlib.h>
1112
#include <strsafe.h>
1213

1314
static _Return_type_success_(return != NULL) HKEY

api/rundll32.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
#include "entry.h"
7+
#include <shellapi.h>
78

89
#if ACCEPT_WOW64 == 1
910

api/session.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "logger.h"
99
#include "wintun.h"
1010
#include <Windows.h>
11+
#include <devioctl.h>
12+
#include <stdlib.h>
1113

1214
#pragma warning(disable : 4200) /* nonstandard: zero-sized array in struct/union */
1315

0 commit comments

Comments
 (0)