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

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

@ -1,3 +1,13 @@
#pragma once
#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 <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);
}
#include "ClassDemo.hpp"
ObfuscateRoutine
extern "C" int ModuleEntry()
@ -26,4 +6,10 @@ extern "C" int ModuleEntry()
MessageBoxA(0, "Demo", "Hello From Obfuscated Routine!", 0);
UsermodeMutateDemo();
UsermodeNoObfuscation();
VirtualFuncDemo DemoInstance = Demo();
DemoInstance.PrintTest();
VirtualFuncDemo Demo2Instance = Demo2();
Demo2Instance.PrintTest();
}
Loading…
Cancel
Save