api: add pre-compiled header support

...for super-fast compilation.

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2020-07-21 16:57:36 +02:00 committed by Jason A. Donenfeld
parent a283add85b
commit 0a986ce9fc
9 changed files with 40 additions and 14 deletions

View File

@ -3,7 +3,7 @@
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
*/
#include "api.h"
#include "pch.h"
HINSTANCE ResourceModule;

View File

@ -115,6 +115,8 @@
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\$(WintunPlatform)\$(Configuration);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -156,12 +158,16 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="api.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="api.c" />
<ClCompile Include="devmgmt.c" />
<ClCompile Include="namespace.c" />
<ClCompile Include="nci.c" />
<ClCompile Include="pch.c">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="registry.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -28,6 +28,9 @@
<ClInclude Include="api.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="api.c">
@ -45,5 +48,8 @@
<ClCompile Include="registry.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="pch.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -3,12 +3,7 @@
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
*/
#include "api.h"
#include <cfgmgr32.h>
#include <iphlpapi.h>
#include <objbase.h>
#include <SetupAPI.h>
#include <wchar.h>
#include "pch.h"
#define WINTUN_HWID L"Wintun"
#define WAIT_FOR_REGISTRY_TIMEOUT 10000 /* ms */

View File

@ -3,9 +3,7 @@
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
*/
#include "api.h"
#include <bcrypt.h>
#include <sddl.h>
#include "pch.h"
static SECURITY_ATTRIBUTES SecurityAttributes = { .nLength = sizeof(SECURITY_ATTRIBUTES) };
static BOOL HasInitialized = FALSE;

View File

@ -3,7 +3,7 @@
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
*/
#include "api.h"
#include "pch.h"
static HMODULE NciModule;

6
api/pch.c Normal file
View File

@ -0,0 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
*/
#include "pch.h"

17
api/pch.h Normal file
View File

@ -0,0 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
*/
#pragma once
#include "api.h"
#include <bcrypt.h>
#include <cfgmgr32.h>
#include <iphlpapi.h>
#include <objbase.h>
#include <sddl.h>
#include <SetupAPI.h>
#include <string.h>
#include <wchar.h>

View File

@ -3,9 +3,7 @@
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
*/
#include "api.h"
#include <string.h>
#include <wchar.h>
#include "pch.h"
static WINTUN_STATUS
OpenKeyWait(_In_ HKEY Key, _Inout_z_ LPWSTR Path, _In_ DWORD Access, _In_ ULONGLONG Deadline, _Out_ HKEY *KeyOut)