forgive me for dumb questions I'm trying to understand the code...
Why erase first 14 bytes of src function? Just for safety since it will not be called anymore?
Is there a reason to steal the first 16 bytes? Could be for example 32 or put the jump in the middle of the func?
This is not a inline hook on the original func address (so you erased it), u are replacing the address of the funk on the IAT, right?
Anyone knows how to access the data returned at systemInformation without use the struct. I tried pCurr + 0x04 or (char *)pCurr + 0x04 to see the number of threads but no way to make it works. If anyone have examples manipulating the data like this is very welcome.
C++:
// nop any stolen bytes in src
for (int i = 14; i < len; i++)
{
*(BYTE*)((uintptr_t)src + i) = 0x90;
}
C++:
oNtQuerySystemInfo = (tNtQuerySystemInfo)TrampHook64((BYTE*)oNtQuerySystemInfo, (BYTE*)hkNtQuerySystemInfo, 16);
This is not a inline hook on the original func address (so you erased it), u are replacing the address of the funk on the IAT, right?
C++:
NTSTATUS status = oNtQuerySystemInfo(SystemInformationClass,
SystemInformation,
SystemInformationLength,
ReturnLength);
if (SystemProcessInformation == SystemInformationClass && STATUS_SUCCESS == status)
{
// Loop through the list of processes
_SYSTEM_PROCESS_INFORMATION* pCurrent = nullptr;
_SYSTEM_PROCESS_INFORMATION* pNext = (_SYSTEM_PROCESS_INFORMATION*)SystemInformation;