Merged PR 4083483: Add tests for EbpfApi
Add tests for EbpfApi
This commit is contained in:
Родитель
ec1eba0da5
Коммит
100f4445c3
|
@ -0,0 +1,10 @@
|
|||
LIBRARY
|
||||
EXPORTS
|
||||
EbpfApiInit
|
||||
EbpfApiTerminate
|
||||
EbpfLoadProgram
|
||||
EbpfFreeErrorMessage
|
||||
EbpfUnloadProgram
|
||||
EbpfAttachProgram
|
||||
EbpfDetachProgram
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020, Microsoft Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(EBPF_API)
|
||||
#define DLL __declspec(dllexport)
|
||||
#else
|
||||
#define DLL __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#define EBPF_HOOK_POINT_XDP 1
|
||||
|
||||
DLL DWORD EbpfApiInit();
|
||||
|
||||
DLL void EbpfApiTerminate();
|
||||
|
||||
DLL DWORD EbpfLoadProgram(const char* file, const char* section_name, HANDLE* handle, char ** error_message);
|
||||
DLL void EbpfFreeErrorMessage(char* error_message);
|
||||
DLL void EbpfUnloadProgram(HANDLE handle);
|
||||
|
||||
DLL DWORD EbpfAttachProgram(HANDLE handle, DWORD hook_point);
|
||||
DLL DWORD EbpfDetachProgram(HANDLE handle, DWORD hook_point);
|
|
@ -22,3 +22,57 @@ BOOL APIENTRY DllMain( HMODULE hModule,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
namespace Platform {
|
||||
BOOL
|
||||
DeviceIoControl(
|
||||
_In_ HANDLE hDevice,
|
||||
_In_ DWORD dwIoControlCode,
|
||||
_In_reads_bytes_opt_(nInBufferSize) LPVOID lpInBuffer,
|
||||
_In_ DWORD nInBufferSize,
|
||||
_Out_writes_bytes_to_opt_(nOutBufferSize, *lpBytesReturned) LPVOID lpOutBuffer,
|
||||
_In_ DWORD nOutBufferSize,
|
||||
_Out_opt_ LPDWORD lpBytesReturned,
|
||||
_Inout_opt_ LPOVERLAPPED lpOverlapped
|
||||
)
|
||||
{
|
||||
return ::DeviceIoControl(
|
||||
hDevice,
|
||||
dwIoControlCode,
|
||||
lpInBuffer,
|
||||
nInBufferSize,
|
||||
lpOutBuffer,
|
||||
nOutBufferSize,
|
||||
lpBytesReturned,
|
||||
lpOverlapped);
|
||||
}
|
||||
|
||||
HANDLE
|
||||
CreateFileW(
|
||||
_In_ LPCWSTR lpFileName,
|
||||
_In_ DWORD dwDesiredAccess,
|
||||
_In_ DWORD dwShareMode,
|
||||
_In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
_In_ DWORD dwCreationDisposition,
|
||||
_In_ DWORD dwFlagsAndAttributes,
|
||||
_In_opt_ HANDLE hTemplateFile
|
||||
)
|
||||
{
|
||||
return ::CreateFileW(
|
||||
lpFileName,
|
||||
dwDesiredAccess,
|
||||
dwShareMode,
|
||||
lpSecurityAttributes,
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
hTemplateFile);
|
||||
}
|
||||
BOOL
|
||||
CloseHandle(
|
||||
_In_ _Post_ptr_invalid_ HANDLE hObject
|
||||
)
|
||||
{
|
||||
return ::CloseHandle(hObject);
|
||||
}
|
||||
|
||||
}
|
|
@ -3,12 +3,16 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30907.101
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ebpfapi", "ebpfapi.vcxproj", "{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dll", "EbpfApi.vcxproj", "{75FE223A-3E45-4B0E-A2E8-04285E52E440}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "api", "..\libs\api\api.vcxproj", "{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EbpfJitterDemoLib", "..\libs\EbpfJitterDemoLib\EbpfJitterDemoLib.vcxproj", "{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ebpfverifier", "..\..\..\external\ebpf-verifier\build\ebpfverifier.vcxproj", "{939A079D-A1E8-35D9-950F-11B1894D342E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "..\libs\api\test\test.vcxproj", "{4C10AC76-384C-4539-B884-38E998749FB2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
|
@ -21,14 +25,30 @@ Global
|
|||
RelWithDebInfo|x86 = RelWithDebInfo|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.Debug|x64.Build.0 = Debug|x64
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.Debug|x86.Build.0 = Debug|Win32
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.MinSizeRel|x64.ActiveCfg = Release|x64
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.MinSizeRel|x64.Build.0 = Release|x64
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.MinSizeRel|x86.ActiveCfg = Release|Win32
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.MinSizeRel|x86.Build.0 = Release|Win32
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.Release|x64.ActiveCfg = Release|x64
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.Release|x64.Build.0 = Release|x64
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.Release|x86.ActiveCfg = Release|Win32
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.Release|x86.Build.0 = Release|Win32
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.RelWithDebInfo|x64.ActiveCfg = Release|x64
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.RelWithDebInfo|x64.Build.0 = Release|x64
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
|
||||
{75FE223A-3E45-4B0E-A2E8-04285E52E440}.RelWithDebInfo|x86.Build.0 = Release|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Debug|x64.Build.0 = Debug|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x64.ActiveCfg = Release|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x64.Build.0 = Release|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x86.ActiveCfg = Release|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x86.Build.0 = Release|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x64.ActiveCfg = Debug|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x64.Build.0 = Debug|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x86.ActiveCfg = Debug|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x86.Build.0 = Debug|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Release|x64.ActiveCfg = Release|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Release|x64.Build.0 = Release|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Release|x86.ActiveCfg = Release|Win32
|
||||
|
@ -41,10 +61,10 @@ Global
|
|||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Debug|x64.Build.0 = Debug|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Debug|x86.Build.0 = Debug|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x64.ActiveCfg = Release|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x64.Build.0 = Release|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x86.ActiveCfg = Release|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x86.Build.0 = Release|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x64.ActiveCfg = Debug|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x64.Build.0 = Debug|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x86.ActiveCfg = Debug|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x86.Build.0 = Debug|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Release|x64.ActiveCfg = Release|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Release|x64.Build.0 = Release|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Release|x86.ActiveCfg = Release|Win32
|
||||
|
@ -65,11 +85,27 @@ Global
|
|||
{939A079D-A1E8-35D9-950F-11B1894D342E}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Debug|x64.Build.0 = Debug|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Debug|x86.Build.0 = Debug|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.MinSizeRel|x64.ActiveCfg = Debug|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.MinSizeRel|x64.Build.0 = Debug|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.MinSizeRel|x86.ActiveCfg = Debug|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.MinSizeRel|x86.Build.0 = Debug|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Release|x64.ActiveCfg = Release|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Release|x64.Build.0 = Release|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Release|x86.ActiveCfg = Release|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Release|x86.Build.0 = Release|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.RelWithDebInfo|x64.ActiveCfg = Release|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.RelWithDebInfo|x64.Build.0 = Release|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.RelWithDebInfo|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {9DEA0F2A-7674-46AA-9E15-BC880EF5895D}
|
||||
SolutionGuid = {24EA473A-CDF1-4A87-9E6C-57149BE1EAC0}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{c8bf60c3-40a9-43ad-891a-8aa34f1c3a68}</ProjectGuid>
|
||||
<RootNamespace>ebpfapi</RootNamespace>
|
||||
<ProjectGuid>{75fe223a-3e45-4b0e-a2e8-04285e52e440}</ProjectGuid>
|
||||
<RootNamespace>EbpfApi</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<PrevailDir>$(ProjectDir)../../../external/ebpf-verifier/</PrevailDir>
|
||||
<ProjectName>dll</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
|
@ -79,9 +79,11 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>EbpfApi</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>EbpfApi</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
@ -96,6 +98,7 @@
|
|||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
@ -115,6 +118,7 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -125,13 +129,12 @@
|
|||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(PrevailDir)src;..\..\..\external\ubpf\vm\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -144,8 +147,7 @@
|
|||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(PrevailDir)src;..\..\..\external\ubpf\vm\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>..\libs\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
|
@ -153,17 +155,14 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="api.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="protocol.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="UnwindHelper.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="api.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
|
@ -171,29 +170,22 @@
|
|||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Verifier.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\external\ebpf-verifier\build\ebpfverifier.vcxproj">
|
||||
<Project>{939a079d-a1e8-35d9-950f-11b1894d342e}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\libs\api\api.vcxproj">
|
||||
<Project>{c8bf60c3-40a9-43ad-891a-8aa34f1c3a68}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\libs\EbpfJitterDemoLib\EbpfJitterDemoLib.vcxproj">
|
||||
<Project>{245f0ec7-1ebc-4d68-8b1f-f758ea9196ae}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Source.def" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\packages\boost.1.72.0.0\build\boost.targets" Condition="Exists('..\..\..\packages\boost.1.72.0.0\build\boost.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\packages\boost.1.72.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\boost.1.72.0.0\build\boost.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -21,15 +21,6 @@
|
|||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protocol.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UnwindHelper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="api.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
|
@ -38,14 +29,10 @@
|
|||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="api.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Verifier.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Source.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,18 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020, Microsoft Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/*
|
||||
* Copyright (C) 2020, Microsoft Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
// pch.h: This is a precompiled header file.
|
||||
// Files listed below are compiled only once, improving build performance for future builds.
|
||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
|
|
@ -22,6 +22,15 @@ int get_file_size(char* filename, size_t* byte_code_size)
|
|||
return result;
|
||||
}
|
||||
|
||||
static char * allocate_error_string(const std::string& str)
|
||||
{
|
||||
char* retval;
|
||||
size_t error_message_length = str.size() + 1;
|
||||
retval = (char*)malloc(error_message_length);
|
||||
strcpy_s(retval, error_message_length, str.c_str());
|
||||
return retval; // Error;
|
||||
}
|
||||
|
||||
static int analyze(raw_program& raw_prog, char ** error_message)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
@ -29,15 +38,15 @@ static int analyze(raw_program& raw_prog, char ** error_message)
|
|||
|
||||
std::variant<InstructionSeq, std::string> prog_or_error = unmarshal(raw_prog, platform);
|
||||
if (!std::holds_alternative<InstructionSeq>(prog_or_error)) {
|
||||
*error_message = allocate_error_string(std::get<std::string>(prog_or_error));
|
||||
return 1; // Error;
|
||||
}
|
||||
auto& prog = std::get<InstructionSeq>(prog_or_error);
|
||||
cfg_t cfg = prepare_cfg(prog, raw_prog.info, true);
|
||||
bool res = run_ebpf_analysis(oss, cfg, raw_prog.info, nullptr);
|
||||
ebpf_verifier_options_t options{ true, false, true };
|
||||
bool res = run_ebpf_analysis(oss, cfg, raw_prog.info, &options);
|
||||
if (!res) {
|
||||
size_t error_message_length = oss.str().size() + 1;
|
||||
*error_message = (char*)malloc(error_message_length);
|
||||
strcpy_s(*error_message, error_message_length, oss.str().c_str());
|
||||
*error_message = allocate_error_string(oss.str());
|
||||
return 1; // Error;
|
||||
}
|
||||
return 0; // Success.
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "platform.h"
|
||||
#define EBPF_API
|
||||
extern "C"
|
||||
{
|
||||
|
@ -14,6 +15,7 @@ extern "C"
|
|||
#include "protocol.h"
|
||||
#include "UnwindHelper.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include "Verifier.h"
|
||||
|
||||
#define MAX_CODE_SIZE (32 * 1024) // 32 KB
|
||||
|
@ -66,7 +68,7 @@ static DWORD invoke_ioctl(HANDLE handle, request_t request, reply_t reply)
|
|||
reply_ptr = reply;
|
||||
}
|
||||
|
||||
auto result = DeviceIoControl(
|
||||
auto result = Platform::DeviceIoControl(
|
||||
handle,
|
||||
(DWORD)IOCTL_EBPFCTL_METHOD_BUFFERED,
|
||||
request_ptr,
|
||||
|
@ -76,12 +78,17 @@ static DWORD invoke_ioctl(HANDLE handle, request_t request, reply_t reply)
|
|||
&actual_reply_size,
|
||||
nullptr);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
return GetLastError();
|
||||
}
|
||||
|
||||
if (actual_reply_size != reply_size)
|
||||
{
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return result;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
DWORD EbpfApiInit()
|
||||
|
@ -93,7 +100,7 @@ DWORD EbpfApiInit()
|
|||
return ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
||||
device_handle = CreateFile(ebpfDeviceName,
|
||||
device_handle = Platform::CreateFile(ebpfDeviceName,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
0,
|
||||
NULL,
|
||||
|
@ -113,7 +120,7 @@ void EbpfApiTerminate()
|
|||
{
|
||||
if (device_handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle(device_handle);
|
||||
Platform::CloseHandle(device_handle);
|
||||
device_handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
}
|
||||
|
@ -175,9 +182,23 @@ DLL DWORD EbpfLoadProgram(const char* file_name, const char* section_name, HANDL
|
|||
|
||||
DWORD result;
|
||||
|
||||
// Verify code.
|
||||
if (verify(file_name, section_name, byte_code.data(), &byte_code_size, error_message) != 0)
|
||||
try
|
||||
{
|
||||
// Verify code.
|
||||
if (verify(file_name, section_name, byte_code.data(), &byte_code_size, error_message) != 0)
|
||||
{
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
catch (std::runtime_error & err)
|
||||
{
|
||||
auto message = err.what();
|
||||
auto message_length = strlen(message) + 1;
|
||||
*error_message = reinterpret_cast<char*>(calloc(message_length + 1, sizeof(char)));
|
||||
if (*error_message)
|
||||
{
|
||||
strcpy_s(*error_message, message_length, message);
|
||||
}
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@ -187,11 +208,7 @@ DLL DWORD EbpfLoadProgram(const char* file_name, const char* section_name, HANDL
|
|||
{
|
||||
return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
if (ubpf_load(vm, byte_code.data(), static_cast<uint32_t>(byte_code.size()), error_message) < 0)
|
||||
{
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
byte_code.resize(byte_code_size);
|
||||
|
||||
if (ubpf_register_map_resolver(vm, device_handle, map_resolver) < 0)
|
||||
{
|
||||
|
@ -203,6 +220,11 @@ DLL DWORD EbpfLoadProgram(const char* file_name, const char* section_name, HANDL
|
|||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (ubpf_load(vm, byte_code.data(), static_cast<uint32_t>(byte_code.size()), error_message) < 0)
|
||||
{
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (ubpf_translate(vm, machine_code.data(), &machine_code_size, error_message))
|
||||
{
|
||||
return ERROR_INVALID_PARAMETER;
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (C) 2020, Microsoft Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(EBPF_API)
|
||||
#define DLL __declspec(dllexport)
|
||||
#else
|
||||
#define DLL __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#define EBPF_HOOK_POINT_XDP 1
|
||||
|
||||
DLL DWORD EbpfApiInit();
|
||||
|
||||
DLL void EbpfApiTerminate();
|
||||
|
||||
DLL DWORD EbpfLoadProgram(const char* file, const char* section_name, HANDLE* handle, char** error_message);
|
||||
DLL void EbpfFreeErrorMessage(char* error_message);
|
||||
DLL void EbpfUnloadProgram(HANDLE handle);
|
||||
|
||||
DLL DWORD EbpfAttachProgram(HANDLE handle, DWORD hook_point);
|
||||
DLL DWORD EbpfDetachProgram(HANDLE handle, DWORD hook_point);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,191 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</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>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{c8bf60c3-40a9-43ad-891a-8aa34f1c3a68}</ProjectGuid>
|
||||
<RootNamespace>ebpfapi</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<PrevailDir>$(ProjectDir)../../../../external/ebpf-verifier/</PrevailDir>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</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" />
|
||||
</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" />
|
||||
</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" />
|
||||
</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" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;EBPFAPI_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;EBPFAPI_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;EBPFAPI_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(PrevailDir)src;..\..\..\..\external\ubpf\vm\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;EBPFAPI_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(PrevailDir)src;..\..\..\..\external\ubpf\vm\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="api.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="platform.h" />
|
||||
<ClInclude Include="protocol.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="UnwindHelper.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="api.cpp" />
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Verifier.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\..\..\packages\boost.1.72.0.0\build\boost.targets" Condition="Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\..\packages\boost.1.72.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\boost.1.72.0.0\build\boost.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,93 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30907.101
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ebpfapi", "ebpfapi.vcxproj", "{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EbpfJitterDemoLib", "..\EbpfJitterDemoLib\EbpfJitterDemoLib.vcxproj", "{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ebpfverifier", "..\..\..\..\external\ebpf-verifier\build\ebpfverifier.vcxproj", "{939A079D-A1E8-35D9-950F-11B1894D342E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcxproj", "{4C10AC76-384C-4539-B884-38E998749FB2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
MinSizeRel|x64 = MinSizeRel|x64
|
||||
MinSizeRel|x86 = MinSizeRel|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
RelWithDebInfo|x64 = RelWithDebInfo|x64
|
||||
RelWithDebInfo|x86 = RelWithDebInfo|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Debug|x64.Build.0 = Debug|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Debug|x86.Build.0 = Debug|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x64.ActiveCfg = Release|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x64.Build.0 = Release|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x86.ActiveCfg = Release|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.MinSizeRel|x86.Build.0 = Release|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Release|x64.ActiveCfg = Release|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Release|x64.Build.0 = Release|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Release|x86.ActiveCfg = Release|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.Release|x86.Build.0 = Release|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.RelWithDebInfo|x64.ActiveCfg = Release|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.RelWithDebInfo|x64.Build.0 = Release|x64
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
|
||||
{C8BF60C3-40A9-43AD-891A-8AA34F1C3A68}.RelWithDebInfo|x86.Build.0 = Release|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Debug|x64.Build.0 = Debug|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Debug|x86.Build.0 = Debug|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x64.ActiveCfg = Debug|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x64.Build.0 = Debug|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x86.ActiveCfg = Debug|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.MinSizeRel|x86.Build.0 = Debug|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Release|x64.ActiveCfg = Release|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Release|x64.Build.0 = Release|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Release|x86.ActiveCfg = Release|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.Release|x86.Build.0 = Release|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.RelWithDebInfo|x64.ActiveCfg = Release|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.RelWithDebInfo|x64.Build.0 = Release|x64
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
|
||||
{245F0EC7-1EBC-4D68-8B1F-F758EA9196AE}.RelWithDebInfo|x86.Build.0 = Release|Win32
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.Debug|x64.Build.0 = Debug|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.Debug|x86.ActiveCfg = Debug|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.MinSizeRel|x64.Build.0 = MinSizeRel|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.MinSizeRel|x86.ActiveCfg = MinSizeRel|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.Release|x64.ActiveCfg = Release|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.Release|x64.Build.0 = Release|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.Release|x86.ActiveCfg = Release|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
|
||||
{939A079D-A1E8-35D9-950F-11B1894D342E}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Debug|x64.Build.0 = Debug|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Debug|x86.Build.0 = Debug|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.MinSizeRel|x64.ActiveCfg = Debug|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.MinSizeRel|x64.Build.0 = Debug|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.MinSizeRel|x86.ActiveCfg = Debug|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.MinSizeRel|x86.Build.0 = Debug|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Release|x64.ActiveCfg = Release|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Release|x64.Build.0 = Release|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Release|x86.ActiveCfg = Release|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.Release|x86.Build.0 = Release|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.RelWithDebInfo|x64.ActiveCfg = Release|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.RelWithDebInfo|x64.Build.0 = Release|x64
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
|
||||
{4C10AC76-384C-4539-B884-38E998749FB2}.RelWithDebInfo|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {9DEA0F2A-7674-46AA-9E15-BC880EF5895D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="protocol.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UnwindHelper.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="api.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="platform.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="api.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Verifier.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (C) 2020, Microsoft Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
// pch.cpp: source file corresponding to the pre-compiled header
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright (C) 2020, Microsoft Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
// add headers that you want to pre-compile here
|
||||
#include "framework.h"
|
||||
|
||||
#endif //PCH_H
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
/*
|
||||
* Copyright (C) 2020, Microsoft Corporation, All Rights Reserved
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
namespace Platform
|
||||
{
|
||||
BOOL
|
||||
DeviceIoControl(
|
||||
_In_ HANDLE hDevice,
|
||||
_In_ DWORD dwIoControlCode,
|
||||
_In_reads_bytes_opt_(nInBufferSize) LPVOID lpInBuffer,
|
||||
_In_ DWORD nInBufferSize,
|
||||
_Out_writes_bytes_to_opt_(nOutBufferSize, *lpBytesReturned) LPVOID lpOutBuffer,
|
||||
_In_ DWORD nOutBufferSize,
|
||||
_Out_opt_ LPDWORD lpBytesReturned,
|
||||
_Inout_opt_ LPOVERLAPPED lpOverlapped
|
||||
);
|
||||
|
||||
HANDLE
|
||||
CreateFileW(
|
||||
_In_ LPCWSTR lpFileName,
|
||||
_In_ DWORD dwDesiredAccess,
|
||||
_In_ DWORD dwShareMode,
|
||||
_In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
_In_ DWORD dwCreationDisposition,
|
||||
_In_ DWORD dwFlagsAndAttributes,
|
||||
_In_opt_ HANDLE hTemplateFile
|
||||
);
|
||||
|
||||
BOOL
|
||||
CloseHandle(
|
||||
_In_ _Post_ptr_invalid_ HANDLE hObject
|
||||
);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#pragma clang section text="xdp_prog"
|
||||
int func()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
Двоичный файл не отображается.
|
@ -0,0 +1,21 @@
|
|||
#pragma clang section text="xdp_prog"
|
||||
|
||||
typedef int (*bpf_helper)(int a, int b, int c, int d);
|
||||
|
||||
#define ebpf_map_lookup_elem ((bpf_helper)0)
|
||||
#define ebpf_map_update_elem ((bpf_helper)1)
|
||||
#define ebpf_map_delete_elem ((bpf_helper)2)
|
||||
#define ebpf_get_tick_count ((bpf_helper)3)
|
||||
|
||||
typedef struct xdp_md
|
||||
{
|
||||
unsigned char* data;
|
||||
unsigned char* data_end;
|
||||
unsigned char* data_meta;
|
||||
} xdp_md;
|
||||
|
||||
int func(xdp_md * ctx)
|
||||
{
|
||||
return ebpf_get_tick_count(ctx, 0, 0, 0);
|
||||
}
|
||||
|
Двоичный файл не отображается.
|
@ -0,0 +1,58 @@
|
|||
#include "mock.h"
|
||||
std::function<decltype(CreateFileW)> create_file_handler;
|
||||
std::function<decltype(DeviceIoControl)> device_io_control_handler;
|
||||
std::function<decltype(CloseHandle)> close_handle_handler;
|
||||
|
||||
namespace Platform {
|
||||
BOOL
|
||||
DeviceIoControl(
|
||||
_In_ HANDLE hDevice,
|
||||
_In_ DWORD dwIoControlCode,
|
||||
_In_reads_bytes_opt_(nInBufferSize) LPVOID lpInBuffer,
|
||||
_In_ DWORD nInBufferSize,
|
||||
_Out_writes_bytes_to_opt_(nOutBufferSize, *lpBytesReturned) LPVOID lpOutBuffer,
|
||||
_In_ DWORD nOutBufferSize,
|
||||
_Out_opt_ LPDWORD lpBytesReturned,
|
||||
_Inout_opt_ LPOVERLAPPED lpOverlapped
|
||||
)
|
||||
{
|
||||
return device_io_control_handler(
|
||||
hDevice,
|
||||
dwIoControlCode,
|
||||
lpInBuffer,
|
||||
nInBufferSize,
|
||||
lpOutBuffer,
|
||||
nOutBufferSize,
|
||||
lpBytesReturned,
|
||||
lpOverlapped);
|
||||
}
|
||||
|
||||
HANDLE
|
||||
CreateFileW(
|
||||
_In_ LPCWSTR lpFileName,
|
||||
_In_ DWORD dwDesiredAccess,
|
||||
_In_ DWORD dwShareMode,
|
||||
_In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
_In_ DWORD dwCreationDisposition,
|
||||
_In_ DWORD dwFlagsAndAttributes,
|
||||
_In_opt_ HANDLE hTemplateFile
|
||||
)
|
||||
{
|
||||
return create_file_handler(
|
||||
lpFileName,
|
||||
dwDesiredAccess,
|
||||
dwShareMode,
|
||||
lpSecurityAttributes,
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
hTemplateFile);
|
||||
}
|
||||
BOOL
|
||||
CloseHandle(
|
||||
_In_ _Post_ptr_invalid_ HANDLE hObject
|
||||
)
|
||||
{
|
||||
return close_handle_handler(hObject);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
#include <functional>
|
||||
#include <Windows.h>
|
||||
|
||||
extern std::function<decltype(CreateFileW)> create_file_handler;
|
||||
extern std::function<decltype(DeviceIoControl)> device_io_control_handler;
|
||||
extern std::function<decltype(CloseHandle)> close_handle_handler;
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="CatchOrg.Catch" version="2.2.0" targetFramework="native" />
|
||||
</packages>
|
|
@ -0,0 +1,14 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by test.rc
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
Двоичный файл не отображается.
|
@ -0,0 +1,259 @@
|
|||
// test.cpp : This file contains the 'main' function. Program execution begins and ends there.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <random>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
|
||||
#define EBPF_API
|
||||
#include "../api.h"
|
||||
#include "mock.h"
|
||||
#include "../protocol.h"
|
||||
|
||||
uint8_t h = 0;
|
||||
auto success_create_file_handler = [&](_In_ LPCWSTR lpFileName,
|
||||
_In_ DWORD dwDesiredAccess,
|
||||
_In_ DWORD dwShareMode,
|
||||
_In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
_In_ DWORD dwCreationDisposition,
|
||||
_In_ DWORD dwFlagsAndAttributes,
|
||||
_In_opt_ HANDLE hTemplateFile) -> HANDLE
|
||||
{
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
return reinterpret_cast<HANDLE>(&h);
|
||||
};
|
||||
auto success_close_handle_handler = [&](_In_ HANDLE hObject) -> BOOL
|
||||
{
|
||||
if (hObject != &h)
|
||||
{
|
||||
throw std::exception("Test failed - closing wrong handle");
|
||||
}
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
std::list<std::vector<uint8_t>> request_messages;
|
||||
std::list<std::vector<uint8_t>> reply_messages;
|
||||
|
||||
auto success_ioctl = [&](_In_ HANDLE hDevice,
|
||||
_In_ DWORD dwIoControlCode,
|
||||
_In_reads_bytes_opt_(nInBufferSize) LPVOID lpInBuffer,
|
||||
_In_ DWORD nInBufferSize,
|
||||
_Out_writes_bytes_to_opt_(nOutBufferSize, *lpBytesReturned) LPVOID lpOutBuffer,
|
||||
_In_ DWORD nOutBufferSize,
|
||||
_Out_opt_ LPDWORD lpBytesReturned,
|
||||
_Inout_opt_ LPOVERLAPPED lpOverlapped
|
||||
) -> BOOL
|
||||
{
|
||||
if (hDevice != &h)
|
||||
{
|
||||
throw std::exception("Test failed - using wrong handle");
|
||||
}
|
||||
|
||||
if (reply_messages.empty())
|
||||
{
|
||||
throw std::exception("Test failed - no reply message queue");
|
||||
}
|
||||
|
||||
auto in_begin = reinterpret_cast<uint8_t*>(lpInBuffer);
|
||||
auto in_end = in_begin + nInBufferSize;
|
||||
auto out_begin = reinterpret_cast<uint8_t*>(lpOutBuffer);
|
||||
auto out_end = out_begin + nOutBufferSize;
|
||||
|
||||
std::vector<uint8_t> request;
|
||||
std::vector<uint8_t>& reply = reply_messages.front();
|
||||
if (reply.size() > nOutBufferSize)
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*lpBytesReturned = static_cast<DWORD>(reply.size());
|
||||
|
||||
request.resize(nInBufferSize);
|
||||
std::copy(in_begin, in_end, request.begin());
|
||||
std::copy(reply.begin(), reply.end(), out_begin);
|
||||
|
||||
reply_messages.pop_front();
|
||||
request_messages.emplace_back(std::move(request));
|
||||
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
void push_back_reply_message(EbpfOpHeader* header)
|
||||
{
|
||||
std::vector<uint8_t> reply(header->length);
|
||||
|
||||
std::copy(reinterpret_cast<uint8_t*>(header), reinterpret_cast<uint8_t*>(header) + header->length, reply.begin());
|
||||
reply_messages.emplace_back(std::move(reply));
|
||||
}
|
||||
|
||||
template <typename request_message_t>
|
||||
request_message_t* front_request_message()
|
||||
{
|
||||
auto message = reinterpret_cast<request_message_t*>(request_messages.front().data());
|
||||
size_t expected_size = 0;
|
||||
EbpfOperation expected_id = (EbpfOperation)-1;
|
||||
if constexpr (std::is_same<request_message_t, EbpfOpEvidenceRequest>::value) {
|
||||
expected_size = sizeof(EbpfOpEvidenceRequest);
|
||||
expected_id = EbpfOperation::evidence;
|
||||
}
|
||||
else if constexpr (std::is_same<request_message_t, EbpfOpResolveHelperRequest>::value) {
|
||||
expected_size = sizeof(EbpfOpResolveHelperRequest);
|
||||
expected_id = EbpfOperation::resolve_helper;
|
||||
}
|
||||
else if constexpr (std::is_same<request_message_t, EbpfOpResolveMapRequest>::value) {
|
||||
expected_size = sizeof(EbpfOpResolveMapRequest);
|
||||
expected_id = EbpfOperation::resolve_map;
|
||||
}
|
||||
else if constexpr (std::is_same<request_message_t, EbpfOpLoadRequest>::value) {
|
||||
expected_id = EbpfOperation::load_code;
|
||||
}
|
||||
else if constexpr (std::is_same<request_message_t, EbpfOpAttachDetachRequest>::value) {
|
||||
expected_size = sizeof(EbpfOpAttachDetachRequest);
|
||||
switch (message->header.id) {
|
||||
case EbpfOperation::attach:
|
||||
case EbpfOperation::detach:
|
||||
break;
|
||||
default:
|
||||
REQUIRE(message->header.id == EbpfOperation::attach);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (expected_id != (EbpfOperation)-1)
|
||||
REQUIRE(expected_id == message->header.id);
|
||||
|
||||
if (expected_size > 0)
|
||||
REQUIRE(expected_size == message->header.length);
|
||||
return message;
|
||||
}
|
||||
|
||||
TEST_CASE("Open failed", "[open_fail]") {
|
||||
create_file_handler = [](_In_ LPCWSTR lpFileName,
|
||||
_In_ DWORD dwDesiredAccess,
|
||||
_In_ DWORD dwShareMode,
|
||||
_In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
_In_ DWORD dwCreationDisposition,
|
||||
_In_ DWORD dwFlagsAndAttributes,
|
||||
_In_opt_ HANDLE hTemplateFile) -> HANDLE {
|
||||
SetLastError(ERROR_FILE_NOT_FOUND);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
};
|
||||
|
||||
close_handle_handler = [](_In_ HANDLE hObject) -> BOOL {
|
||||
throw std::exception("Test failed - closing handle not opened");
|
||||
};
|
||||
|
||||
REQUIRE(EbpfApiInit() == ERROR_FILE_NOT_FOUND);
|
||||
EbpfApiTerminate();
|
||||
}
|
||||
|
||||
TEST_CASE("Open success", "[open_success]") {
|
||||
create_file_handler = success_create_file_handler;
|
||||
close_handle_handler = success_close_handle_handler;
|
||||
|
||||
REQUIRE(EbpfApiInit() == ERROR_SUCCESS);
|
||||
EbpfApiTerminate();
|
||||
}
|
||||
|
||||
TEST_CASE("Load program fail - file not found", "[load_fail_not_found]") {
|
||||
create_file_handler = success_create_file_handler;
|
||||
close_handle_handler = success_close_handle_handler;
|
||||
|
||||
HANDLE handle;
|
||||
char* error_message = nullptr;
|
||||
const char* fake_file_name = "not_a_real_file.elf";
|
||||
|
||||
REQUIRE(EbpfApiInit() == ERROR_SUCCESS);
|
||||
|
||||
REQUIRE(EbpfLoadProgram(fake_file_name, "xdp_fake", &handle, &error_message) == ERROR_INVALID_PARAMETER);
|
||||
REQUIRE_THAT(error_message, Catch::Matchers::Contains(fake_file_name));
|
||||
EbpfFreeErrorMessage(error_message);
|
||||
EbpfApiTerminate();
|
||||
}
|
||||
|
||||
TEST_CASE("Load program fail - malformed", "[load_fail_bad_file]") {
|
||||
create_file_handler = success_create_file_handler;
|
||||
close_handle_handler = success_close_handle_handler;
|
||||
|
||||
char temp_file_name[MAX_PATH];
|
||||
REQUIRE(GetTempFileNameA(".", "bad_elf", 0, temp_file_name) != 0);
|
||||
|
||||
HANDLE handle;
|
||||
char* error_message = nullptr;
|
||||
|
||||
std::fstream out_file(temp_file_name, std::ios_base::out | std::ios_base::trunc);
|
||||
std::default_random_engine generator;
|
||||
std::uniform_int_distribution<uint16_t> distribution(0, 255);
|
||||
|
||||
for (size_t i = 0; i < 4096; i++)
|
||||
{
|
||||
out_file.put(static_cast<char>(distribution(generator)));
|
||||
}
|
||||
out_file.flush();
|
||||
out_file.close();
|
||||
|
||||
REQUIRE(EbpfApiInit() == ERROR_SUCCESS);
|
||||
|
||||
REQUIRE(EbpfLoadProgram(temp_file_name, "xdp_fake", &handle, &error_message) == ERROR_INVALID_PARAMETER);
|
||||
REQUIRE_THAT(error_message, Catch::Matchers::Contains(temp_file_name));
|
||||
EbpfFreeErrorMessage(error_message);
|
||||
EbpfApiTerminate();
|
||||
|
||||
DeleteFileA(temp_file_name);
|
||||
}
|
||||
|
||||
TEST_CASE("Load program success", "[load_success]") {
|
||||
create_file_handler = success_create_file_handler;
|
||||
close_handle_handler = success_close_handle_handler;
|
||||
device_io_control_handler = success_ioctl;
|
||||
|
||||
HANDLE handle;
|
||||
char* error_message = nullptr;
|
||||
|
||||
EbpfOpLoadReply load_reply{ sizeof(EbpfOpLoadReply), EbpfOperation::load_code, reinterpret_cast<uint64_t>(&h) };
|
||||
push_back_reply_message(&load_reply.header);
|
||||
|
||||
REQUIRE(EbpfApiInit() == ERROR_SUCCESS);
|
||||
|
||||
REQUIRE(EbpfLoadProgram("bpf.o", "xdp_prog", &handle, &error_message) == ERROR_SUCCESS);
|
||||
|
||||
auto load_request = front_request_message<EbpfOpLoadRequest>();
|
||||
|
||||
request_messages.clear();
|
||||
|
||||
EbpfFreeErrorMessage(error_message);
|
||||
EbpfApiTerminate();
|
||||
}
|
||||
|
||||
TEST_CASE("Load program success - resolve helper", "[load_success - resolve helper]") {
|
||||
create_file_handler = success_create_file_handler;
|
||||
close_handle_handler = success_close_handle_handler;
|
||||
device_io_control_handler = success_ioctl;
|
||||
|
||||
HANDLE handle;
|
||||
char* error_message = nullptr;
|
||||
|
||||
EbpfOpResolveHelperReply helper_reply{ sizeof(EbpfOpResolveHelperReply), EbpfOperation::resolve_helper, reinterpret_cast<uint64_t>(&GetTickCount) };
|
||||
push_back_reply_message(&helper_reply.header);
|
||||
|
||||
EbpfOpLoadReply load_reply{ sizeof(EbpfOpLoadReply), EbpfOperation::load_code, reinterpret_cast<uint64_t>(&h) };
|
||||
push_back_reply_message(&load_reply.header);
|
||||
|
||||
REQUIRE(EbpfApiInit() == ERROR_SUCCESS);
|
||||
|
||||
REQUIRE(EbpfLoadProgram("bpf_call.o", "xdp_prog", &handle, &error_message) == 0);
|
||||
|
||||
auto resolve_request = front_request_message<EbpfOpResolveHelperRequest>();
|
||||
REQUIRE(resolve_request->helper_id[0] == 3);
|
||||
request_messages.pop_front();
|
||||
|
||||
auto load_request = front_request_message<EbpfOpLoadRequest>();
|
||||
request_messages.pop_front();
|
||||
|
||||
EbpfFreeErrorMessage(error_message);
|
||||
EbpfApiTerminate();
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE 9, 1
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
|
@ -0,0 +1,177 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\..\..\..\packages\CatchOrg.Catch.2.2.0\build\native\CatchOrg.Catch.props" Condition="Exists('..\..\..\..\..\packages\CatchOrg.Catch.2.2.0\build\native\CatchOrg.Catch.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</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>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{4c10ac76-384c-4539-b884-38e998749fb2}</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)'=='Release|Win32'" 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)'=='Release|x64'" 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" />
|
||||
</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" />
|
||||
</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" />
|
||||
</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" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="mock.cpp" />
|
||||
<ClCompile Include="test.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\..\external\ebpf-verifier\build\ebpfverifier.vcxproj">
|
||||
<Project>{939a079d-a1e8-35d9-950f-11b1894d342e}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\EbpfJitterDemoLib\EbpfJitterDemoLib.vcxproj">
|
||||
<Project>{245f0ec7-1ebc-4d68-8b1f-f758ea9196ae}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\api.vcxproj">
|
||||
<Project>{c8bf60c3-40a9-43ad-891a-8aa34f1c3a68}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="mock.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="test.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\..\..\..\packages\CatchOrg.Catch.2.2.0\build\native\CatchOrg.Catch.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\..\packages\CatchOrg.Catch.2.2.0\build\native\CatchOrg.Catch.props'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="test.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="mock.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="mock.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="test.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
Загрузка…
Ссылка в новой задаче