test dll changes

This commit is contained in:
Jettford
2024-12-04 18:53:04 +00:00
parent 80d3baa886
commit 983a5ec634
22 changed files with 522 additions and 9 deletions

18
thirdparty/hijackkit/include/memory.h vendored Normal file
View File

@@ -0,0 +1,18 @@
#pragma once
#include <cstdlib>
#include <functional>
namespace hijack {
namespace memory {
inline void Protect(size_t address, size_t size, std::function<void()> function);
inline void* Read(size_t address, size_t size);
inline void Patch(size_t address, size_t size, void* data);
template<class T>
inline void Patch(size_t address, T data) {
hijack::memory::Patch(address, sizeof(T), &data);
}
}
}

46
thirdparty/hijackkit/include/tricks.h vendored Normal file
View File

@@ -0,0 +1,46 @@
#pragma once
#include <Windows.h>
#include <winnt.h>
#include <ntifs.h>
#include <vector>
namespace hijack {
namespace tricks {
struct ModuleInfo {
wchar_t* m_ModuleName;
size_t m_ModuleBase;
};
template<class T>
inline T* GetVFunc(void* instance, size_t index) {
return (T*)*(size_t*)((size_t)instance + index * sizeof(size_t));
}
inline std::vector<ModuleInfo> LookupDLL() {
size_t pedAddr = __readgsqword(0x60);
size_t ldrData = *(size_t*)(pedAddr + 0x18);
size_t firstEntry = *(size_t*)(ldrData + 0x10);
size_t currentEntry = firstEntry;
std::vector<ModuleInfo> modules;
while (*(DWORD*)(currentEntry + 0x60) != NULL) {
wchar_t* dllName = (wchar_t*)(currentEntry + 0x60);
size_t dllBase = *(size_t*)(currentEntry + 0x30);
ModuleInfo info;
info.m_ModuleName = dllName;
info.m_ModuleBase = dllBase;
modules.push_back(info);
currentEntry = *(size_t*)currentEntry;
}
return modules;
}
}
}

10
thirdparty/hijackkit/include/utils.h vendored Normal file
View File

@@ -0,0 +1,10 @@
#pragma once
#include <cstdint>
namespace hjiack {
namespace utils {
uintptr_t GetModuleBaseAddress(const wchar_t* moduleName);
void AllocateConsole();
}
}