api: get rid of pch and make headers sane
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
c5b05150c6
commit
937eb44727
@ -3,7 +3,28 @@
|
||||
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "adapter.h"
|
||||
#include "elevate.h"
|
||||
#include "entry.h"
|
||||
#include "logger.h"
|
||||
#include "namespace.h"
|
||||
#include "nci.h"
|
||||
#include "ntldr.h"
|
||||
#include "registry.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#include <winternl.h>
|
||||
#define _NTDEF_ //TODO: figure out how to include ntsecapi and winternal together without requiring this
|
||||
#include <cfgmgr32.h>
|
||||
#include <devguid.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <ndisguid.h>
|
||||
#include <newdev.h>
|
||||
#include <NTSecAPI.h>
|
||||
#include <SetupAPI.h>
|
||||
#include <Shlwapi.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#pragma warning(disable : 4221) /* nonstandard: address of automatic in initializer */
|
||||
|
||||
|
@ -6,7 +6,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "wintun.h"
|
||||
#include <IPExport.h>
|
||||
#include <SetupAPI.h>
|
||||
#include <Windows.h>
|
||||
|
||||
#define MAX_INSTANCE_ID MAX_PATH /* TODO: Is MAX_PATH always enough? */
|
||||
#define WINTUN_HWID L"Wintun"
|
||||
|
@ -104,8 +104,6 @@
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="Exists('$(OutDir)whql\')">HAVE_WHQL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalOptions>/volatile:iso %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
@ -153,28 +151,24 @@
|
||||
<None Include="exports.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="api.h" />
|
||||
<ClInclude Include="entry.h" />
|
||||
<ClInclude Include="adapter.h" />
|
||||
<ClInclude Include="elevate.h" />
|
||||
<ClInclude Include="logger.h" />
|
||||
<ClInclude Include="namespace.h" />
|
||||
<ClInclude Include="nci.h" />
|
||||
<ClInclude Include="ntldr.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="registry.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="wintun.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="api.c" />
|
||||
<ClCompile Include="entry.c" />
|
||||
<ClCompile Include="adapter.c" />
|
||||
<ClCompile Include="elevate.c" />
|
||||
<ClCompile Include="logger.c" />
|
||||
<ClCompile Include="namespace.c" />
|
||||
<ClCompile Include="nci.c" />
|
||||
<ClCompile Include="pch.c">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="registry.c" />
|
||||
<ClCompile Include="resource.c" />
|
||||
<ClCompile Include="session.c" />
|
||||
@ -197,4 +191,4 @@
|
||||
<Target Name="CleanSignTarget">
|
||||
<Delete Files="$(IntermediateOutputPath)$(TargetName).sign" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
@ -25,12 +25,6 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="api.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="nci.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@ -58,11 +52,11 @@
|
||||
<ClInclude Include="elevate.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="entry.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="api.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="namespace.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -75,9 +69,6 @@
|
||||
<ClCompile Include="registry.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="logger.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -93,5 +84,8 @@
|
||||
<ClCompile Include="elevate.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="entry.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -3,7 +3,10 @@
|
||||
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "elevate.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#include <TlHelp32.h>
|
||||
|
||||
BOOL
|
||||
ElevateToSystem(void)
|
||||
|
@ -5,5 +5,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
BOOL
|
||||
ElevateToSystem(void);
|
||||
|
@ -3,7 +3,21 @@
|
||||
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "adapter.h"
|
||||
#include "entry.h"
|
||||
#include "logger.h"
|
||||
#include "registry.h"
|
||||
#include "namespace.h"
|
||||
#include "nci.h"
|
||||
#include "wintun.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4201)
|
||||
/* nonstandard extension used: nameless struct/union */
|
||||
#include <delayimp.h>
|
||||
#pragma warning(pop)
|
||||
#include <sddl.h>
|
||||
|
||||
HINSTANCE ResourceModule;
|
||||
HANDLE ModuleHeap;
|
@ -3,7 +3,8 @@
|
||||
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "logger.h"
|
||||
#include <Windows.h>
|
||||
|
||||
static BOOL CALLBACK
|
||||
NopLogger(_In_ WINTUN_LOGGER_LEVEL Level, _In_z_ const WCHAR *LogLine)
|
||||
|
@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "wintun.h"
|
||||
#include <Windows.h>
|
||||
|
||||
extern WINTUN_LOGGER_FUNC Logger;
|
||||
|
||||
|
@ -3,7 +3,12 @@
|
||||
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "entry.h"
|
||||
#include "logger.h"
|
||||
#include "namespace.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#include <bcrypt.h>
|
||||
|
||||
static BOOL HasInitialized = FALSE;
|
||||
static CRITICAL_SECTION Initializing;
|
||||
|
@ -3,7 +3,8 @@
|
||||
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "nci.h"
|
||||
#include <Windows.h>
|
||||
|
||||
static HMODULE NciModule;
|
||||
|
||||
|
@ -31,3 +31,6 @@ typedef struct _RTL_PROCESS_MODULES
|
||||
ULONG NumberOfModules;
|
||||
RTL_PROCESS_MODULE_INFORMATION Modules[1];
|
||||
} RTL_PROCESS_MODULES, *PRTL_PROCESS_MODULES;
|
||||
|
||||
|
||||
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L) //TODO: #include <ntstatus.h> instead of this
|
||||
|
43
api/pch.h
43
api/pch.h
@ -1,43 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
*
|
||||
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "adapter.h"
|
||||
#include "api.h"
|
||||
#include "elevate.h"
|
||||
#include "logger.h"
|
||||
#include "namespace.h"
|
||||
#include "nci.h"
|
||||
#include "ntldr.h"
|
||||
#include "registry.h"
|
||||
#include "resource.h"
|
||||
#include "wintun.h"
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4201) /* nonstandard extension used: nameless struct/union */
|
||||
#include <bcrypt.h>
|
||||
#include <cfgmgr32.h>
|
||||
#include <delayimp.h>
|
||||
#include <devguid.h>
|
||||
#include <IPExport.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <locale.h>
|
||||
#include <ndisguid.h>
|
||||
#include <newdev.h>
|
||||
#include <objbase.h>
|
||||
#include <Psapi.h>
|
||||
#include <sddl.h>
|
||||
#include <SetupAPI.h>
|
||||
#include <Shlwapi.h>
|
||||
#include <string.h>
|
||||
#include <TlHelp32.h>
|
||||
#include <wchar.h>
|
||||
#include <Windows.h>
|
||||
#include <winternl.h>
|
||||
#define _NTDEF_ //TODO: find a better way to include both ntsecapi.h and winternl.h or include ntdef.h for real somehow
|
||||
#include <NTSecAPI.h>
|
||||
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L) //TODO: #include <ntstatus.h> instead of this
|
||||
#pragma warning(pop)
|
@ -3,7 +3,11 @@
|
||||
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "entry.h"
|
||||
#include "logger.h"
|
||||
#include "registry.h"
|
||||
#include <Windows.h>
|
||||
#include <wchar.h>
|
||||
|
||||
static WINTUN_STATUS
|
||||
OpenKeyWait(_In_ HKEY Key, _Inout_z_ WCHAR *Path, _In_ DWORD Access, _In_ ULONGLONG Deadline, _Out_ HKEY *KeyOut)
|
||||
|
@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "wintun.h"
|
||||
#include <Windows.h>
|
||||
|
||||
#define MAX_REG_PATH \
|
||||
256 /* Maximum registry path length \
|
||||
|
@ -3,7 +3,10 @@
|
||||
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "entry.h"
|
||||
#include "logger.h"
|
||||
#include "resource.h"
|
||||
#include <Windows.h>
|
||||
|
||||
WINTUN_STATUS
|
||||
ResourceGetAddress(_In_z_ const WCHAR *ResourceName, _Out_ const void **Address, _Out_ DWORD *Size)
|
||||
|
@ -3,7 +3,11 @@
|
||||
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "adapter.h"
|
||||
#include "logger.h"
|
||||
#include "wintun.h"
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#define EXPORT comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__)
|
||||
|
||||
|
@ -3,7 +3,12 @@
|
||||
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "adapter.h"
|
||||
#include "elevate.h"
|
||||
#include "entry.h"
|
||||
#include "logger.h"
|
||||
#include "wintun.h"
|
||||
#include <Windows.h>
|
||||
|
||||
#pragma warning(disable : 4200) /* nonstandard: zero-sized array in struct/union */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user