2#include "detours\detours.h"
4#pragma region Hooked Functions
22 SIZE_T NumberOfBytesToWrite,
23 PSIZE_T NumberOfBytesWritten
53 _In_ HANDLE ProcessHandle,
54 _Inout_ _At_(*BaseAddress, _Readable_bytes_(*ViewSize) _Writable_bytes_(*ViewSize) _Post_readable_byte_size_(*ViewSize)) PVOID* BaseAddress,
55 _Inout_opt_ PLARGE_INTEGER SectionOffset,
56 _Inout_ PSIZE_T ViewSize,
57 _In_ ULONG AllocationType,
58 _In_ ULONG PageProtection,
59 _Inout_updates_opt_(ExtendedParameterCount) PMEM_EXTENDED_PARAMETER ExtendedParameters,
60 _In_ ULONG ExtendedParameterCount)
63 SectionOffset, ViewSize, AllocationType,PageProtection,ExtendedParameters,
64 ExtendedParameterCount);
73 DetourTransactionBegin();
74 DetourUpdateThread(GetCurrentThread());
92 DetourTransactionCommit();
98 DetourTransactionBegin();
99 DetourUpdateThread(GetCurrentThread());
113 DetourTransactionCommit();
NTSTATUS(NTAPI * pNtWriteVirtualMemory)(HANDLE ProcessHandle, PVOID BaseAddress, PVOID Buffer, SIZE_T NumberOfBytesToWrite, PSIZE_T NumberOfBytesWritten)
The NtWriteVirtualMemory function writes memory to a specified process.
NTSTATUS(NTAPI * pNtModifyBootEntry)(PBOOT_ENTRY BootEntry)
The NtModifyBootEntry function modifies a boot entry in the boot configuration database.
NTSTATUS(NTAPI * pNtMapViewOfSectionEx)(_In_ HANDLE SectionHandle, _In_ HANDLE ProcessHandle, _Inout_ _At_(*BaseAddress, _Readable_bytes_(*ViewSize) _Writable_bytes_(*ViewSize) _Post_readable_byte_size_(*ViewSize)) PVOID *BaseAddress, _Inout_opt_ PLARGE_INTEGER SectionOffset, _Inout_ PSIZE_T ViewSize, _In_ ULONG AllocationType, _In_ ULONG PageProtection, _Inout_updates_opt_(ExtendedParameterCount) PMEM_EXTENDED_PARAMETER ExtendedParameters, _In_ ULONG ExtendedParameterCount)
The NtMapViewOfSectionEx function maps a view of a section into the address space of a process.
pNtModifyBootEntry pOriginal_NtModifyBootEntry
VOID UnHook()
The UnHook function removes the trampoline hooks from the NTDLL functions.
NTSTATUS NTAPI Hooked_NtWriteVirtualMemory(HANDLE ProcessHandle, PVOID BaseAddress, PVOID Buffer, SIZE_T NumberOfBytesToWrite, PSIZE_T NumberOfBytesWritten)
The Hooked_NtWriteVirtualMemory function is a function that hooks the NtWriteVirtualMemory function.
NTSTATUS Hooked_NtModifyBootEntry(PBOOT_ENTRY BootEntry)
The Hooked_NtModifyBootEntry function is a function that hooks the NtModifyBootEntry function.
VOID PlaceHooks()
The PlaceHooks function places the trampoline hooks on several NTDLL functions.
NTSTATUS Hooked_NtMapViewOfSectionEx(_In_ HANDLE SectionHandle, _In_ HANDLE ProcessHandle, _Inout_ _At_(*BaseAddress, _Readable_bytes_(*ViewSize) _Writable_bytes_(*ViewSize) _Post_readable_byte_size_(*ViewSize)) PVOID *BaseAddress, _Inout_opt_ PLARGE_INTEGER SectionOffset, _Inout_ PSIZE_T ViewSize, _In_ ULONG AllocationType, _In_ ULONG PageProtection, _Inout_updates_opt_(ExtendedParameterCount) PMEM_EXTENDED_PARAMETER ExtendedParameters, _In_ ULONG ExtendedParameterCount)
The Hooked_NtMapViewOfSectionEx function is a function that hooks the NtMapViewOfSectionEx function.
pNtMapViewOfSectionEx pOriginal_NtMapViewOfSectionEx
pNtWriteVirtualMemory pOriginal_NtWriteVirtualMemory
The BOOT_ENTRY structure represents a boot entry in the boot configuration database....