diff --git a/Examples/DemoDll/AnotherObj.cpp b/Examples/DemoDll/AnotherObj.cpp new file mode 100644 index 0000000..9b18fa2 --- /dev/null +++ b/Examples/DemoDll/AnotherObj.cpp @@ -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); +} \ No newline at end of file diff --git a/Examples/DemoDll/ClassDemo.cpp b/Examples/DemoDll/ClassDemo.cpp new file mode 100644 index 0000000..1c051cc --- /dev/null +++ b/Examples/DemoDll/ClassDemo.cpp @@ -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); +} \ No newline at end of file diff --git a/Examples/DemoDll/ClassDemo.hpp b/Examples/DemoDll/ClassDemo.hpp new file mode 100644 index 0000000..2029682 --- /dev/null +++ b/Examples/DemoDll/ClassDemo.hpp @@ -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; +}; \ No newline at end of file diff --git a/Examples/DemoDll/DemoDll.vcxproj b/Examples/DemoDll/DemoDll.vcxproj index 45c8804..410141c 100644 --- a/Examples/DemoDll/DemoDll.vcxproj +++ b/Examples/DemoDll/DemoDll.vcxproj @@ -82,7 +82,7 @@ false -mcmodel=large %(AdditionalOptions) false - true + false false Default Default @@ -98,9 +98,12 @@ + + + diff --git a/Examples/DemoDll/DemoDll.vcxproj.filters b/Examples/DemoDll/DemoDll.vcxproj.filters index 102fcae..daf9b25 100644 --- a/Examples/DemoDll/DemoDll.vcxproj.filters +++ b/Examples/DemoDll/DemoDll.vcxproj.filters @@ -13,10 +13,19 @@ Header Files + + Header Files + Source Files + + Source Files + + + Source Files + \ No newline at end of file diff --git a/Examples/DemoDll/Theodosius.h b/Examples/DemoDll/Theodosius.h index a1d30bc..da51ea5 100644 --- a/Examples/DemoDll/Theodosius.h +++ b/Examples/DemoDll/Theodosius.h @@ -1,3 +1,13 @@ #pragma once #define ObfuscateRoutine __declspec(code_seg(".theo"), noinline) -#define MutateRoutine __declspec(code_seg(".theo1"), noinline) \ No newline at end of file +#define MutateRoutine __declspec(code_seg(".theo1"), noinline) + +extern "C" int MessageBoxA( + unsigned hWnd, + char* lpText, + char* lpCaption, + unsigned uType +); + +void UsermodeNoObfuscation(); +void UsermodeMutateDemo(); \ No newline at end of file diff --git a/Examples/DemoDll/main.cpp b/Examples/DemoDll/main.cpp index 00a9c78..1a26e0d 100644 --- a/Examples/DemoDll/main.cpp +++ b/Examples/DemoDll/main.cpp @@ -1,24 +1,4 @@ -#include "Theodosius.h" -#include - -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(); } \ No newline at end of file