Skip to content

Commit 1c7cafe

Browse files
committed
initial commit
0 parents  commit 1c7cafe

File tree

9 files changed

+5191
-0
lines changed

9 files changed

+5191
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.vs/
2+
*.suo
3+
*.rar
4+
Release/
5+
x64/
6+
Debug/

fake.sln

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26430.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fake", "fake\fake.vcxproj", "{C0A65A00-CA13-4658-B74E-1C018EE55F38}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{C0A65A00-CA13-4658-B74E-1C018EE55F38}.Debug|x64.ActiveCfg = Debug|x64
17+
{C0A65A00-CA13-4658-B74E-1C018EE55F38}.Debug|x64.Build.0 = Debug|x64
18+
{C0A65A00-CA13-4658-B74E-1C018EE55F38}.Debug|x86.ActiveCfg = Debug|Win32
19+
{C0A65A00-CA13-4658-B74E-1C018EE55F38}.Debug|x86.Build.0 = Debug|Win32
20+
{C0A65A00-CA13-4658-B74E-1C018EE55F38}.Release|x64.ActiveCfg = Release|x64
21+
{C0A65A00-CA13-4658-B74E-1C018EE55F38}.Release|x64.Build.0 = Release|x64
22+
{C0A65A00-CA13-4658-B74E-1C018EE55F38}.Release|x86.ActiveCfg = Release|Win32
23+
{C0A65A00-CA13-4658-B74E-1C018EE55F38}.Release|x86.Build.0 = Release|Win32
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
EndGlobal

fake/dprintf.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#pragma once
2+
3+
#include <cstdio>
4+
#include <cstdarg>
5+
#include <windows.h>
6+
7+
static void dprintf(const char* format, ...)
8+
{
9+
static char dprintf_msg[66000];
10+
va_list args;
11+
va_start(args, format);
12+
*dprintf_msg = 0;
13+
vsnprintf(dprintf_msg, sizeof(dprintf_msg), format, args);
14+
OutputDebugStringA(dprintf_msg);
15+
}
16+
17+
static void dputs(const char* text)
18+
{
19+
dprintf("%s\n", text);
20+
}

fake/fake.cpp

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#include "dprintf.h"
2+
3+
#define FAKE(x) extern "C" __declspec(dllexport) void* x() { OutputDebugStringA(#x); return nullptr; }
4+
5+
FAKE(FltCloseClientPort)
6+
FAKE(FltReleaseContext)
7+
FAKE(FltSetVolumeContext)
8+
FAKE(FltGetDiskDeviceObject)
9+
FAKE(FltGetVolumeProperties)
10+
FAKE(FltAllocateContext)
11+
FAKE(FltStartFiltering)
12+
FAKE(FltFreeSecurityDescriptor)
13+
FAKE(FltCreateCommunicationPort)
14+
FAKE(FltBuildDefaultSecurityDescriptor)
15+
FAKE(FltUnregisterFilter)
16+
FAKE(FltRegisterFilter)
17+
FAKE(FltObjectDereference)
18+
FAKE(FltCloseCommunicationPort)
19+
FAKE(FltGetVolumeFromName)
20+
FAKE(FltClose)
21+
FAKE(FltFlushBuffers)
22+
FAKE(FltQueryInformationFile)
23+
FAKE(FltCreateFileEx)
24+
FAKE(FltParseFileName)
25+
FAKE(FltReleaseFileNameInformation)
26+
FAKE(FltGetFileNameInformation)
27+
FAKE(FltSetCallbackDataDirty)
28+
FAKE(FltSetInformationFile)
29+
FAKE(FltSendMessage)
30+
FAKE(FltGetBottomInstance)
31+
FAKE(FltFreePoolAlignedWithTag)
32+
FAKE(FltDoCompletionProcessingWhenSafe)
33+
FAKE(FltReadFile)
34+
FAKE(FltGetRequestorProcess)
35+
FAKE(FltLockUserBuffer)
36+
FAKE(FltAllocatePoolAlignedWithTag)
37+
FAKE(FltGetVolumeContext)
38+
FAKE(FltGetFilterFromInstance)
39+
FAKE(FltGetVolumeFromInstance)
40+
FAKE(FltWriteFile)
41+
FAKE(FltGetTopInstance)
42+
FAKE(FltIsOperationSynchronous)
43+
FAKE(FltFsControlFile)
44+
FAKE(FltCompletePendedPreOperation)
45+
FAKE(FltCancelIo)
46+
FAKE(FltSetCancelCompletion)
47+
FAKE(FltClearCancelCompletion)
48+
FAKE(FltParseFileNameInformation)
49+
FAKE(FltGetVolumeFromFileObject)
50+
51+
#pragma optimize("", off)
52+
BOOL MmIsAddressValid_FAKE(LPCVOID addr)
53+
{
54+
__try
55+
{
56+
auto x = *(char*)addr;
57+
return TRUE;
58+
}
59+
__except(EXCEPTION_ACCESS_VIOLATION)
60+
{
61+
return FALSE;
62+
}
63+
}
64+
#pragma optimize("", on)

fake/fake.vcxproj

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>15.0</VCProjectVersion>
23+
<ProjectGuid>{C0A65A00-CA13-4658-B74E-1C018EE55F38}</ProjectGuid>
24+
<RootNamespace>fake</RootNamespace>
25+
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
26+
<ProjectName>ntoskrnl</ProjectName>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>DynamicLibrary</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v141_xp</PlatformToolset>
33+
<CharacterSet>MultiByte</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>DynamicLibrary</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v141_xp</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>MultiByte</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>DynamicLibrary</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v141_xp</PlatformToolset>
46+
<CharacterSet>MultiByte</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>DynamicLibrary</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v141_xp</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>MultiByte</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
74+
<TargetExt>.dll</TargetExt>
75+
</PropertyGroup>
76+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
77+
<TargetExt>.dll</TargetExt>
78+
</PropertyGroup>
79+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
80+
<TargetExt>.dll</TargetExt>
81+
</PropertyGroup>
82+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
83+
<TargetExt>.dll</TargetExt>
84+
</PropertyGroup>
85+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
86+
<ClCompile>
87+
<WarningLevel>Level3</WarningLevel>
88+
<Optimization>Disabled</Optimization>
89+
<SDLCheck>true</SDLCheck>
90+
</ClCompile>
91+
</ItemDefinitionGroup>
92+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
93+
<ClCompile>
94+
<WarningLevel>Level3</WarningLevel>
95+
<Optimization>Disabled</Optimization>
96+
<SDLCheck>true</SDLCheck>
97+
</ClCompile>
98+
</ItemDefinitionGroup>
99+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
100+
<ClCompile>
101+
<WarningLevel>Level3</WarningLevel>
102+
<Optimization>MaxSpeed</Optimization>
103+
<FunctionLevelLinking>true</FunctionLevelLinking>
104+
<IntrinsicFunctions>true</IntrinsicFunctions>
105+
<SDLCheck>true</SDLCheck>
106+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
107+
</ClCompile>
108+
<Link>
109+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
110+
<OptimizeReferences>true</OptimizeReferences>
111+
<SubSystem>Windows</SubSystem>
112+
<ModuleDefinitionFile>ntoskrnl.def</ModuleDefinitionFile>
113+
</Link>
114+
</ItemDefinitionGroup>
115+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
116+
<ClCompile>
117+
<WarningLevel>Level3</WarningLevel>
118+
<Optimization>MaxSpeed</Optimization>
119+
<FunctionLevelLinking>true</FunctionLevelLinking>
120+
<IntrinsicFunctions>true</IntrinsicFunctions>
121+
<SDLCheck>true</SDLCheck>
122+
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
123+
</ClCompile>
124+
<Link>
125+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
126+
<OptimizeReferences>true</OptimizeReferences>
127+
<SubSystem>Windows</SubSystem>
128+
<ModuleDefinitionFile>ntoskrnl.def</ModuleDefinitionFile>
129+
</Link>
130+
</ItemDefinitionGroup>
131+
<ItemGroup>
132+
<ClCompile Include="fake.cpp" />
133+
<ClCompile Include="ntoskrnl.cpp" />
134+
</ItemGroup>
135+
<ItemGroup>
136+
<ClInclude Include="dprintf.h" />
137+
<ClInclude Include="ntoskrnl.h" />
138+
</ItemGroup>
139+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
140+
<ImportGroup Label="ExtensionTargets">
141+
</ImportGroup>
142+
</Project>

fake/fake.vcxproj.filters

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="fake.cpp">
19+
<Filter>Source Files</Filter>
20+
</ClCompile>
21+
<ClCompile Include="ntoskrnl.cpp">
22+
<Filter>Source Files</Filter>
23+
</ClCompile>
24+
</ItemGroup>
25+
<ItemGroup>
26+
<ClInclude Include="dprintf.h">
27+
<Filter>Header Files</Filter>
28+
</ClInclude>
29+
<ClInclude Include="ntoskrnl.h">
30+
<Filter>Header Files</Filter>
31+
</ClInclude>
32+
</ItemGroup>
33+
</Project>

fake/ntoskrnl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#define DLL_EXPORT extern "C" __declspec(dllexport)
2+
#define FAKE(x) void* x() { return #x; }
3+
#include "ntoskrnl.h"

0 commit comments

Comments
 (0)