api: rename test to example and update a few things

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-11-01 06:01:04 +01:00 committed by Simon Rozman
parent b5836e9fb9
commit 14a8da7ffa
5 changed files with 375 additions and 439 deletions

View File

@ -1,260 +1,260 @@
/* SPDX-License-Identifier: GPL-2.0 /* SPDX-License-Identifier: GPL-2.0
* *
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved. * Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
*/ */
#include "../api/wintun.h" #include "../api/wintun.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
static WINTUN_GET_VERSION_FUNC WintunGetVersion; static WINTUN_GET_VERSION_FUNC WintunGetVersion;
static WINTUN_SET_LOGGER_FUNC WintunSetLogger; static WINTUN_SET_LOGGER_FUNC WintunSetLogger;
static WINTUN_CREATE_ADAPTER_FUNC WintunCreateAdapter; static WINTUN_CREATE_ADAPTER_FUNC WintunCreateAdapter;
static WINTUN_DELETE_ADAPTER_FUNC WintunDeleteAdapter; static WINTUN_DELETE_ADAPTER_FUNC WintunDeleteAdapter;
static WINTUN_START_SESSION_FUNC WintunStartSession; static WINTUN_START_SESSION_FUNC WintunStartSession;
static WINTUN_END_SESSION_FUNC WintunEndSession; static WINTUN_END_SESSION_FUNC WintunEndSession;
static WINTUN_RECEIVE_PACKETS_FUNC WintunReceivePacket; static WINTUN_RECEIVE_PACKET_FUNC WintunReceivePacket;
static WINTUN_RECEIVE_RELEASE_FUNC WintunReceiveRelease; static WINTUN_RECEIVE_RELEASE_FUNC WintunReceiveRelease;
static WINTUN_ALLOCATE_SEND_PACKET_FUNC WintunAllocateSendPacket; static WINTUN_ALLOCATE_SEND_PACKET_FUNC WintunAllocateSendPacket;
static WINTUN_SEND_PACKET_FUNC WintunSendPacket; static WINTUN_SEND_PACKET_FUNC WintunSendPacket;
static HANDLE Quit; static HANDLE QuitEvent;
static WCHAR Pool[WINTUN_MAX_POOL]; static volatile BOOL HaveQuit;
static BOOL CALLBACK static BOOL CALLBACK
ConsoleLogger(_In_ WINTUN_LOGGER_LEVEL Level, _In_z_ const WCHAR *LogLine) ConsoleLogger(_In_ WINTUN_LOGGER_LEVEL Level, _In_z_ const WCHAR *LogLine)
{ {
FILETIME Timestamp; FILETIME Timestamp;
GetSystemTimePreciseAsFileTime(&Timestamp); GetSystemTimePreciseAsFileTime(&Timestamp);
SYSTEMTIME SystemTime; SYSTEMTIME SystemTime;
FileTimeToSystemTime(&Timestamp, &SystemTime); FileTimeToSystemTime(&Timestamp, &SystemTime);
WCHAR LevelMarker; WCHAR LevelMarker;
switch (Level) switch (Level)
{ {
case WINTUN_LOG_INFO: case WINTUN_LOG_INFO:
LevelMarker = L'+'; LevelMarker = L'+';
break; break;
case WINTUN_LOG_WARN: case WINTUN_LOG_WARN:
LevelMarker = L'-'; LevelMarker = L'-';
break; break;
case WINTUN_LOG_ERR: case WINTUN_LOG_ERR:
LevelMarker = L'!'; LevelMarker = L'!';
break; break;
default: default:
return FALSE; return FALSE;
} }
fwprintf( fwprintf(
stderr, stderr,
L"%04d-%02d-%02d %02d:%02d:%02d.%04d [%c] %s\n", L"%04d-%02d-%02d %02d:%02d:%02d.%04d [%c] %s\n",
SystemTime.wYear, SystemTime.wYear,
SystemTime.wMonth, SystemTime.wMonth,
SystemTime.wDay, SystemTime.wDay,
SystemTime.wHour, SystemTime.wHour,
SystemTime.wMinute, SystemTime.wMinute,
SystemTime.wSecond, SystemTime.wSecond,
SystemTime.wMilliseconds, SystemTime.wMilliseconds,
LevelMarker, LevelMarker,
LogLine); LogLine);
return TRUE; return TRUE;
} }
static DWORD static DWORD
LogLastError(_In_z_ const WCHAR *Prefix) LogLastError(_In_z_ const WCHAR *Prefix)
{ {
DWORD Error = GetLastError(); DWORD Error = GetLastError();
WCHAR *SystemMessage = NULL, *FormattedMessage = NULL; WCHAR *SystemMessage = NULL, *FormattedMessage = NULL;
FormatMessageW( FormatMessageW(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_MAX_WIDTH_MASK, FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_MAX_WIDTH_MASK,
NULL, NULL,
HRESULT_FROM_SETUPAPI(Error), HRESULT_FROM_SETUPAPI(Error),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(void *)&SystemMessage, (void *)&SystemMessage,
0, 0,
NULL); NULL);
FormatMessageW( FormatMessageW(
FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ARGUMENT_ARRAY |
FORMAT_MESSAGE_MAX_WIDTH_MASK, FORMAT_MESSAGE_MAX_WIDTH_MASK,
SystemMessage ? L"%1: %3(Code 0x%2!08X!)" : L"%1: Code 0x%2!08X!", SystemMessage ? L"%1: %3(Code 0x%2!08X!)" : L"%1: Code 0x%2!08X!",
0, 0,
0, 0,
(void *)&FormattedMessage, (void *)&FormattedMessage,
0, 0,
(va_list *)(DWORD_PTR[]){ (DWORD_PTR)Prefix, (DWORD_PTR)Error, (DWORD_PTR)SystemMessage }); (va_list *)(DWORD_PTR[]){ (DWORD_PTR)Prefix, (DWORD_PTR)Error, (DWORD_PTR)SystemMessage });
if (FormattedMessage) if (FormattedMessage)
ConsoleLogger(WINTUN_LOG_ERR, FormattedMessage); ConsoleLogger(WINTUN_LOG_ERR, FormattedMessage);
LocalFree(FormattedMessage); LocalFree(FormattedMessage);
LocalFree(SystemMessage); LocalFree(SystemMessage);
SetLastError(Error); SetLastError(Error);
return Error; return Error;
} }
static void static void
Log(_In_ WINTUN_LOGGER_LEVEL Level, _In_z_ const WCHAR *Format, ...) Log(_In_ WINTUN_LOGGER_LEVEL Level, _In_z_ const WCHAR *Format, ...)
{ {
WCHAR LogLine[0x200]; WCHAR LogLine[0x200];
va_list args; va_list args;
va_start(args, Format); va_start(args, Format);
_vsnwprintf_s(LogLine, _countof(LogLine), _TRUNCATE, Format, args); _vsnwprintf_s(LogLine, _countof(LogLine), _TRUNCATE, Format, args);
va_end(args); va_end(args);
ConsoleLogger(Level, LogLine); ConsoleLogger(Level, LogLine);
} }
static BOOL WINAPI static BOOL WINAPI
CtrlHandler(DWORD CtrlType) CtrlHandler(DWORD CtrlType)
{ {
switch (CtrlType) switch (CtrlType)
{ {
case CTRL_C_EVENT: case CTRL_C_EVENT:
case CTRL_BREAK_EVENT: case CTRL_BREAK_EVENT:
case CTRL_CLOSE_EVENT: case CTRL_CLOSE_EVENT:
case CTRL_LOGOFF_EVENT: case CTRL_LOGOFF_EVENT:
case CTRL_SHUTDOWN_EVENT: case CTRL_SHUTDOWN_EVENT:
SetEvent(Quit); HaveQuit = TRUE;
return TRUE; SetEvent(QuitEvent);
} return TRUE;
return FALSE; }
} return FALSE;
}
static DWORD WINAPI
TestAdapter(_Inout_ DWORD_PTR Index) static DWORD WINAPI
{ TestAdapter(_Inout_ DWORD_PTR Index)
/* Create adapter. */ {
WCHAR AdapterName[MAX_ADAPTER_NAME]; /* Create adapter. */
_snwprintf_s( WCHAR AdapterName[MAX_ADAPTER_NAME];
AdapterName, _snwprintf_s(
_countof(AdapterName), AdapterName,
_TRUNCATE, _countof(AdapterName),
L"test-%d.%d-%zu", _TRUNCATE,
WINTUN_VERSION_MAJ, L"test-%d.%d-%zu",
WINTUN_VERSION_MIN, WINTUN_VERSION_MAJ,
Index); WINTUN_VERSION_MIN,
const GUID AdapterGuid = { 0xeef7ebf, Index);
WINTUN_VERSION_MAJ, const GUID AdapterGuid = { 0xeef7ebf,
WINTUN_VERSION_MIN, WINTUN_VERSION_MAJ,
{ (BYTE)Index & 0xff, 0xa, 0x33, 0xbf, 0x5c, 0x8, 0x4a, 0xc6 } }; WINTUN_VERSION_MIN,
while (WaitForSingleObject(Quit, 0) == WAIT_TIMEOUT) { (BYTE)Index & 0xff, 0xa, 0x33, 0xbf, 0x5c, 0x8, 0x4a, 0xc6 } };
{ while (!HaveQuit)
WINTUN_ADAPTER_HANDLE Adapter; {
BOOL RebootRequired = FALSE; WINTUN_ADAPTER_HANDLE Adapter;
DWORD Result = WintunCreateAdapter(Pool, AdapterName, &AdapterGuid, &Adapter, &RebootRequired); BOOL RebootRequired = FALSE;
if (Result != ERROR_SUCCESS) DWORD Result = WintunCreateAdapter(L"Example", AdapterName, &AdapterGuid, &Adapter, &RebootRequired);
{ if (Result != ERROR_SUCCESS)
Log(WINTUN_LOG_ERR, L"%s adapter creation failed.\n", AdapterName); {
return Result; Log(WINTUN_LOG_ERR, L"%s adapter creation failed.\n", AdapterName);
} return Result;
}
/* Report version. */
DWORD DriverVersionMaj, DriverVersionMin, NdisVersionMaj, NdisVersionMin; DWORDLONG WintunVersion = WintunGetVersion();
WintunGetVersion(&DriverVersionMaj, &DriverVersionMin, &NdisVersionMaj, &NdisVersionMin); Log(WINTUN_LOG_INFO,
Log(WINTUN_LOG_INFO, L"%s adapter created (Wintun %d.%d.%d.%d, reboot: %d).\n",
L"%s adapter created (Wintun %d.%d, NDIS %d.%d, reboot: %d).\n", AdapterName,
AdapterName, (WintunVersion >> 48) & 0xffff,
WINTUN_VERSION_MAJ, (WintunVersion >> 32) & 0xffff,
WINTUN_VERSION_MIN, (WintunVersion >> 16) & 0xffff,
NdisVersionMaj, (WintunVersion >> 0) & 0xffff,
NdisVersionMin, RebootRequired ? 1 : 0);
RebootRequired ? 1 : 0);
WINTUN_SESSION_HANDLE Session;
WINTUN_SESSION_HANDLE Session; HANDLE WaitHandles[2] = { NULL, QuitEvent };
HANDLE WaitHandles[2] = { NULL, Quit }; Result = WintunStartSession(Adapter, 0x100000, &Session, &WaitHandles[0]);
Result = WintunStartSession(Adapter, 0x100000, &Session, &WaitHandles[0]); if (Result != ERROR_SUCCESS)
if (Result != ERROR_SUCCESS) {
{ Log(WINTUN_LOG_ERR, L"%s session creation failed.\n", AdapterName);
Log(WINTUN_LOG_ERR, L"%s session creation failed.\n", AdapterName); goto cleanupAdapter;
goto cleanupAdapter; }
} while (!HaveQuit)
for (;;) {
{ BYTE *Packet;
BYTE *Packet; DWORD PacketSize;
DWORD PacketSize; Result = WintunReceivePacket(Session, &Packet, &PacketSize);
Result = WintunReceivePacket(Session, &Packet, &PacketSize); switch (Result)
switch (Result) {
{ case ERROR_SUCCESS:
case ERROR_SUCCESS: // TODO: Process packet.
// TODO: Process packet. WintunReceiveRelease(Session, Packet);
WintunReceiveRelease(Session, Packet); continue;
continue; case ERROR_NO_MORE_ITEMS:
case ERROR_NO_MORE_ITEMS: if (WaitForMultipleObjects(_countof(WaitHandles), WaitHandles, FALSE, INFINITE) == WAIT_OBJECT_0)
if (WaitForMultipleObjects(_countof(WaitHandles), WaitHandles, FALSE, INFINITE) == WAIT_OBJECT_0) continue;
continue; goto cleanupSession;
goto cleanupSession; }
} Log(WINTUN_LOG_ERR, L"%s packet read failed (Code 0x%08X).\n", AdapterName, Result);
Log(WINTUN_LOG_ERR, L"%s packet read failed (Code 0x%08X).\n", AdapterName, Result); goto cleanupSession;
goto cleanupSession; }
} cleanupSession:
cleanupSession: WintunEndSession(Session);
WintunEndSession(Session); cleanupAdapter:
cleanupAdapter: WintunDeleteAdapter(Adapter, TRUE, &RebootRequired);
WintunDeleteAdapter(Adapter, TRUE, &RebootRequired); }
} return ERROR_SUCCESS;
return ERROR_SUCCESS; }
}
int
int main(void)
main() {
{ Log(WINTUN_LOG_INFO, L"Wintun Test v%d.%d\n", WINTUN_VERSION_MAJ, WINTUN_VERSION_MIN);
Log(WINTUN_LOG_INFO, L"Wintun Test v%d.%d\n", WINTUN_VERSION_MAJ, WINTUN_VERSION_MIN);
HMODULE Wintun =
HMODULE Wintun = LoadLibraryExW(L"wintun.dll", NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);
LoadLibraryExW(L"wintun.dll", NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); if (!Wintun)
if (!Wintun) return LogLastError(L"Failed to load wintun.dll");
return LogLastError(L"Failed to load wintun.dll"); DWORD Result;
DWORD Result; if ((WintunGetVersion = (WINTUN_GET_VERSION_FUNC)GetProcAddress(Wintun, "WintunGetVersion")) == NULL ||
if ((WintunGetVersion = (WINTUN_GET_VERSION_FUNC)GetProcAddress(Wintun, "WintunGetVersion")) == NULL || (WintunSetLogger = (WINTUN_SET_LOGGER_FUNC)GetProcAddress(Wintun, "WintunSetLogger")) == NULL ||
(WintunSetLogger = (WINTUN_SET_LOGGER_FUNC)GetProcAddress(Wintun, "WintunSetLogger")) == NULL || (WintunCreateAdapter = (WINTUN_CREATE_ADAPTER_FUNC)GetProcAddress(Wintun, "WintunCreateAdapter")) == NULL ||
(WintunCreateAdapter = (WINTUN_CREATE_ADAPTER_FUNC)GetProcAddress(Wintun, "WintunCreateAdapter")) == NULL || (WintunDeleteAdapter = (WINTUN_DELETE_ADAPTER_FUNC)GetProcAddress(Wintun, "WintunDeleteAdapter")) == NULL ||
(WintunDeleteAdapter = (WINTUN_DELETE_ADAPTER_FUNC)GetProcAddress(Wintun, "WintunDeleteAdapter")) == NULL || (WintunStartSession = (WINTUN_START_SESSION_FUNC)GetProcAddress(Wintun, "WintunStartSession")) == NULL ||
(WintunStartSession = (WINTUN_START_SESSION_FUNC)GetProcAddress(Wintun, "WintunStartSession")) == NULL || (WintunEndSession = (WINTUN_END_SESSION_FUNC)GetProcAddress(Wintun, "WintunEndSession")) == NULL ||
(WintunEndSession = (WINTUN_END_SESSION_FUNC)GetProcAddress(Wintun, "WintunEndSession")) == NULL || (WintunReceivePacket = (WINTUN_RECEIVE_PACKET_FUNC)GetProcAddress(Wintun, "WintunReceivePacket")) == NULL ||
(WintunReceivePacket = (WINTUN_RECEIVE_PACKETS_FUNC)GetProcAddress(Wintun, "WintunReceivePacket")) == NULL || (WintunReceiveRelease = (WINTUN_RECEIVE_RELEASE_FUNC)GetProcAddress(Wintun, "WintunReceiveRelease")) == NULL ||
(WintunReceiveRelease = (WINTUN_RECEIVE_RELEASE_FUNC)GetProcAddress(Wintun, "WintunReceiveRelease")) == NULL || (WintunAllocateSendPacket =
(WintunAllocateSendPacket = (WINTUN_ALLOCATE_SEND_PACKET_FUNC)GetProcAddress(Wintun, "WintunAllocateSendPacket")) == NULL ||
(WINTUN_ALLOCATE_SEND_PACKET_FUNC)GetProcAddress(Wintun, "WintunAllocateSendPacket")) == NULL || (WintunSendPacket = (WINTUN_SEND_PACKET_FUNC)GetProcAddress(Wintun, "WintunSendPacket")) == NULL)
(WintunSendPacket = (WINTUN_SEND_PACKET_FUNC)GetProcAddress(Wintun, "WintunSendPacket")) == NULL) {
{ Result = LogLastError(L"Failed to get wintun.dll entries");
Result = LogLastError(L"Failed to get wintun.dll entries"); goto cleanupWintun;
goto cleanupWintun; }
}
HaveQuit = FALSE;
Quit = CreateEventW(NULL, TRUE, FALSE, NULL); QuitEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
if (!Quit) if (!QuitEvent)
{ {
Result = LogLastError(L"Failed to create event"); Result = LogLastError(L"Failed to create event");
goto cleanupWintun; goto cleanupWintun;
} }
WintunSetLogger(ConsoleLogger); WintunSetLogger(ConsoleLogger);
if (!SetConsoleCtrlHandler(CtrlHandler, TRUE)) if (!SetConsoleCtrlHandler(CtrlHandler, TRUE))
{ {
Result = LogLastError(L"Failed to set console handler"); Result = LogLastError(L"Failed to set console handler");
goto cleanupQuit; goto cleanupQuit;
} }
_snwprintf_s(Pool, _countof(Pool), _TRUNCATE, L"net.wintun-%d.%d", WINTUN_VERSION_MAJ, WINTUN_VERSION_MIN);
HANDLE Workers[MAXIMUM_WAIT_OBJECTS] = { 0 };
HANDLE Workers[MAXIMUM_WAIT_OBJECTS] = { 0 }; for (size_t i = 0; i < _countof(Workers); ++i)
for (size_t i = 0; i < _countof(Workers); ++i) if (!Workers[i])
if (!Workers[i]) {
{ Workers[i] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)TestAdapter, (LPVOID)i, 0, NULL);
Workers[i] = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)TestAdapter, (LPVOID)i, 0, NULL); if (!Workers[i])
if (!Workers[i]) {
{ Result = LogLastError(L"Failed to create thread");
Result = LogLastError(L"Failed to create thread"); goto cleanupWorkers;
goto cleanupWorkers; }
} }
} WaitForMultipleObjectsEx(_countof(Workers), Workers, TRUE, INFINITE, TRUE);
WaitForMultipleObjectsEx(_countof(Workers), Workers, TRUE, INFINITE, TRUE); Result = ERROR_SUCCESS;
Result = ERROR_SUCCESS; cleanupWorkers:
cleanupWorkers: HaveQuit = TRUE;
SetEvent(Quit); SetEvent(QuitEvent);
for (size_t i = 0; i < _countof(Workers); ++i) for (size_t i = 0; i < _countof(Workers); ++i)
if (Workers[i]) if (Workers[i])
{ {
WaitForSingleObject(Workers[i], INFINITE); WaitForSingleObject(Workers[i], INFINITE);
CloseHandle(Workers[i]); CloseHandle(Workers[i]);
} }
SetConsoleCtrlHandler(CtrlHandler, FALSE); SetConsoleCtrlHandler(CtrlHandler, FALSE);
cleanupQuit: cleanupQuit:
CloseHandle(Quit); CloseHandle(QuitEvent);
cleanupWintun: cleanupWintun:
FreeLibrary(Wintun); FreeLibrary(Wintun);
return Result; return Result;
} }

113
example/example.vcxproj Normal file
View File

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="example.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\api\api.vcxproj">
<Project>{897f02e3-3eaa-40af-a6dc-17eb2376edaf}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{2abac503-245d-4f53-85c5-0f844def738b}</ProjectGuid>
<RootNamespace>example</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>example</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<SpectreMitigation>false</SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<SpectreMitigation>false</SpectreMitigation>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\wintun.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>..\$(Configuration)\$(WintunPlatform)\</OutDir>
<IntDir>..\$(Configuration)\$(WintunPlatform)\$(ProjectName)-intermediate\</IntDir>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -15,7 +15,7 @@
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="test.c"> <ClCompile Include="example.c">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>

View File

@ -1,177 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="test.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\api\api.vcxproj">
<Project>{897f02e3-3eaa-40af-a6dc-17eb2376edaf}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{2abac503-245d-4f53-85c5-0f844def738b}</ProjectGuid>
<RootNamespace>test</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\wintun.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\wintun.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\wintun.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\wintun.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\wintun.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\wintun.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\wintun.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\wintun.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>..\$(Configuration)\$(WintunPlatform)\</OutDir>
<IntDir>..\$(Configuration)\$(WintunPlatform)\$(ProjectName)-intermediate\</IntDir>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -17,7 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
wintun.props = wintun.props wintun.props = wintun.props
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcxproj", "{2ABAC503-245D-4F53-85C5-0F844DEF738B}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example\example.vcxproj", "{2ABAC503-245D-4F53-85C5-0F844DEF738B}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution