From 41ae8235236fb89080db40f847e8dbb956cd1822 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 14 Aug 2026 18:49:41 +0000 Subject: [PATCH] Delete RetSpoof.hpp --- RetSpoof.hpp | 146 --------------------------------------------------- 1 file changed, 146 deletions(-) delete mode 100644 RetSpoof.hpp diff --git a/RetSpoof.hpp b/RetSpoof.hpp deleted file mode 100644 index 0a6e08e..0000000 --- a/RetSpoof.hpp +++ /dev/null @@ -1,146 +0,0 @@ -#pragma once - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - - ULONG32 NTAPI MyZwProtectVirtualMemory( - HANDLE ProcessHandle, - PVOID* BaseAddress, - PULONG RegionSize, - ULONG NewProtect, - PULONG OldProtect - ); - -#ifdef __cplusplus -} -#endif - -namespace detail -{ - extern "C" void* _spoofer_stub(); - - template - static inline auto shellcode_stub_helper( - const void* shell, - Args... args - ) -> Ret - { - auto fn = (Ret(*)(Args...))(shell); - return fn(args...); - } - - template - struct argument_remapper - { - template< - typename Ret, - typename First, - typename Second, - typename Third, - typename Fourth, - typename... Pack - > - static auto do_call( - const void* shell, - void* shell_param, - First first, - Second second, - Third third, - Fourth fourth, - Pack... pack - ) -> Ret - { - return shellcode_stub_helper< - Ret, - First, - Second, - Third, - Fourth, - void*, - void*, - Pack... - >( - shell, - first, - second, - third, - fourth, - shell_param, - nullptr, - pack... - ); - } - }; - - template - struct argument_remapper> - { - template< - typename Ret, - typename First = void*, - typename Second = void*, - typename Third = void*, - typename Fourth = void* - > - static auto do_call( - const void* shell, - void* shell_param, - First first = First{}, - Second second = Second{}, - Third third = Third{}, - Fourth fourth = Fourth{} - ) -> Ret - { - return shellcode_stub_helper< - Ret, - First, - Second, - Third, - Fourth, - void*, - void* - >( - shell, - first, - second, - third, - fourth, - shell_param, - nullptr - ); - } - }; -} - - -template -static inline auto spoof_call( - const void* trampoline, - Ret(*fn)(Args...), - Args... args -) -> Ret -{ - struct shell_params - { - const void* trampoline; - void* function; - void* rbx; - }; - - shell_params p{ trampoline, reinterpret_cast(fn) }; - using mapper = detail::argument_remapper; - return mapper::template do_call((const void*)&detail::_spoofer_stub, &p, args...); -} - -extern "C" LONG NtProtectVirtualMemory( - HANDLE ProcessHandle, - PVOID* BaseAddress, - PULONG NumberOfBytesToProtect, - ULONG NewAccessProtection, - PULONG OldAccessProtection -);