Remove dll link stub
This commit is contained in:
parent
891277f15d
commit
325219104a
|
@ -2,20 +2,16 @@
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <DbgHelp.h>
|
#include <DbgHelp.h>
|
||||||
|
#include <memoryapi.h>
|
||||||
|
|
||||||
#define GH_BASE_ADDR 0x00400000
|
#define GH_BASE_ADDR 0x00400000
|
||||||
|
|
||||||
static uintptr_t g_gh_translationOffset{};
|
static uintptr_t g_gh_translationOffset{};
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
cdecl void CDAPFN0506_CDAPFN0506_X_IPT_fn_vResetInputEntry();
|
|
||||||
}
|
|
||||||
|
|
||||||
struct R3Bin {
|
struct R3Bin {
|
||||||
R3Bin() { loadOriginal(); }
|
R3Bin() { loadOriginal(); }
|
||||||
|
|
||||||
void loadOriginal() {
|
void loadOriginal() {
|
||||||
void* ptr = (void*)&CDAPFN0506_CDAPFN0506_X_IPT_fn_vResetInputEntry;
|
|
||||||
SPDLOG_DEBUG("Loading original binary");
|
SPDLOG_DEBUG("Loading original binary");
|
||||||
|
|
||||||
auto &config = getDefaultConfig();
|
auto &config = getDefaultConfig();
|
||||||
|
@ -34,16 +30,16 @@ struct R3Bin {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void relocate(HMODULE module, void* from, void* to, void* check) {
|
inline void relocate(HMODULE module, void* from, void* to, void* check) {
|
||||||
auto relocated_addr = uintptr_t(from) + translationOffset;
|
void* relocated_addr = (void*)(uintptr_t(from) + translationOffset);
|
||||||
auto relocated_to = uintptr_t(to) + translationOffset;
|
void* relocated_to = (void*)(uintptr_t(to) + translationOffset);
|
||||||
void *checkRead{};
|
void *checkRead{};
|
||||||
size_t numRead{};
|
SIZE_T numRead{};
|
||||||
ReadProcessMemory(GetCurrentProcess(), relocated_addr, &checkRead, sizeof(checkRead), &numRead);
|
ReadProcessMemory(GetCurrentProcess(), relocated_addr, &checkRead, sizeof(checkRead), &numRead);
|
||||||
WriteProcessMemory(GetCurrentProcess(), relocated_addr, relocated_to, sizeof(relocated_to), NULL);
|
WriteProcessMemory(GetCurrentProcess(), relocated_addr, relocated_to, sizeof(relocated_to), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void relocateModule(HMODULE module) {
|
void relocateModule(HMODULE module) {
|
||||||
#define REL(from, to, original) relocate(module, (void*)(from), (void*)(to), (void*)(original))
|
#define REL(from, to, original) relocate(module, (void*)(from), (void*)(to), (void*)(original));
|
||||||
#include "relocations.def"
|
#include "relocations.def"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue