added class inheritance example + multiple objects demo

2.0
_xeroxz 4 years ago
parent 787376101b
commit 7cef008c4b

@ -0,0 +1,13 @@
#include "Theodosius.h"
void UsermodeNoObfuscation()
{
for (auto idx = 0u; idx < 5; ++idx)
MessageBoxA(0, "Demo", "Hello From Non-Obfuscated Routine!", 0);
}
MutateRoutine
void UsermodeMutateDemo()
{
MessageBoxA(0, "Demo", "Hello From Mutated Routine!", 0);
}

@ -0,0 +1,46 @@
#include "ClassDemo.hpp"
VirtualFuncDemo::VirtualFuncDemo()
{
MessageBoxA(0, "VirtualFuncDemo (Base Class)", "Virtual Func Demo!", 0);
}
VirtualFuncDemo::~VirtualFuncDemo()
{
MessageBoxA(0, "VirtualFuncDemo (Base Class)", "Virtual Destructor Demo!", 0);
}
void VirtualFuncDemo::PrintTest()
{
MessageBoxA(0, "VirtualFuncDemo (Base Class)", "Virtual Func Demo!", 0);
}
Demo::Demo()
{
MessageBoxA(0, "Demo", "Virtual Func Demo!", 0);
}
Demo::~Demo()
{
MessageBoxA(0, "Demo", "Virtual Destructor Demo!", 0);
}
void Demo::PrintTest()
{
MessageBoxA(0, "PrintTest", "Hello World!", 0);
}
Demo2::Demo2()
{
MessageBoxA(0, "Demo2", "Virtual Func Demo!", 0);
}
Demo2::~Demo2()
{
MessageBoxA(0, "Demo2", "Virtual Destructor Demo!", 0);
}
void Demo2::PrintTest()
{
MessageBoxA(0, "PrintTest2", "Hello World!", 0);
}

@ -0,0 +1,29 @@
#pragma once
#include "Theodosius.h"
class VirtualFuncDemo
{
public:
MutateRoutine
explicit VirtualFuncDemo();
virtual ~VirtualFuncDemo();
virtual void PrintTest();
};
class Demo : public VirtualFuncDemo
{
public:
MutateRoutine
explicit Demo();
~Demo() override;
void PrintTest() override;
};
class Demo2 : public VirtualFuncDemo
{
public:
MutateRoutine
explicit Demo2();
~Demo2() override;
void PrintTest() override;
};

@ -82,7 +82,7 @@
<ControlFlowGuard>false</ControlFlowGuard> <ControlFlowGuard>false</ControlFlowGuard>
<AdditionalOptions>-mcmodel=large %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>-mcmodel=large %(AdditionalOptions)</AdditionalOptions>
<ExceptionHandling>false</ExceptionHandling> <ExceptionHandling>false</ExceptionHandling>
<RuntimeTypeInfo>true</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>
<FunctionLevelLinking>false</FunctionLevelLinking> <FunctionLevelLinking>false</FunctionLevelLinking>
<LanguageStandard_C>Default</LanguageStandard_C> <LanguageStandard_C>Default</LanguageStandard_C>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
@ -98,9 +98,12 @@
<FilesToPackage Include="$(TargetPath)" /> <FilesToPackage Include="$(TargetPath)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="ClassDemo.hpp" />
<ClInclude Include="Theodosius.h" /> <ClInclude Include="Theodosius.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="AnotherObj.cpp" />
<ClCompile Include="ClassDemo.cpp" />
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

@ -13,10 +13,19 @@
<ClInclude Include="Theodosius.h"> <ClInclude Include="Theodosius.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="ClassDemo.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp"> <ClCompile Include="main.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="AnotherObj.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ClassDemo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -1,3 +1,13 @@
#pragma once #pragma once
#define ObfuscateRoutine __declspec(code_seg(".theo"), noinline) #define ObfuscateRoutine __declspec(code_seg(".theo"), noinline)
#define MutateRoutine __declspec(code_seg(".theo1"), noinline) #define MutateRoutine __declspec(code_seg(".theo1"), noinline)
extern "C" int MessageBoxA(
unsigned hWnd,
char* lpText,
char* lpCaption,
unsigned uType
);
void UsermodeNoObfuscation();
void UsermodeMutateDemo();

@ -1,24 +1,4 @@
#include "Theodosius.h" #include "ClassDemo.hpp"
#include <intrin.h>
extern "C" int MessageBoxA(
unsigned hWnd,
char* lpText,
char* lpCaption,
unsigned uType
);
void UsermodeNoObfuscation()
{
for (auto idx = 0u; idx < 5; ++idx)
MessageBoxA(0, "Demo", "Hello From Non-Obfuscated Routine!", 0);
}
MutateRoutine
void UsermodeMutateDemo()
{
MessageBoxA(0, "Demo", "Hello From Mutated Routine!", 0);
}
ObfuscateRoutine ObfuscateRoutine
extern "C" int ModuleEntry() extern "C" int ModuleEntry()
@ -26,4 +6,10 @@ extern "C" int ModuleEntry()
MessageBoxA(0, "Demo", "Hello From Obfuscated Routine!", 0); MessageBoxA(0, "Demo", "Hello From Obfuscated Routine!", 0);
UsermodeMutateDemo(); UsermodeMutateDemo();
UsermodeNoObfuscation(); UsermodeNoObfuscation();
VirtualFuncDemo DemoInstance = Demo();
DemoInstance.PrintTest();
VirtualFuncDemo Demo2Instance = Demo2();
Demo2Instance.PrintTest();
} }
Loading…
Cancel
Save