mirror of
https://github.com/ApfelTeeSaft/ps4-fortniteserver.git
synced 2026-08-26 19:33:25 +00:00
72 lines
2.3 KiB
C++
72 lines
2.3 KiB
C++
// OrbisHookah, Copyright @2026 apfelteesaft
|
|
|
|
#pragma once
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
namespace Hookah {
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Diagnostics
|
|
// ---------------------------------------------------------------------------
|
|
|
|
struct HookStats {
|
|
int totalHooks; // hooks successfully created
|
|
int activeHooks; // hooks currently live in target memory
|
|
int failedHooks; // hooks that failed at creation or scan time
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Module helpers
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Virtual address of the main executable (.text segment base).
|
|
uintptr_t GetBase();
|
|
|
|
// Byte-size of the main executable's text segment.
|
|
size_t GetModuleSize();
|
|
|
|
// GetBase() + offset.
|
|
uintptr_t ResolveAddress(uintptr_t offset);
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Lifecycle
|
|
// ---------------------------------------------------------------------------
|
|
|
|
bool Initialize();
|
|
bool Uninitialize();
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Hook installation
|
|
//
|
|
// Hooks are created in a disabled state. Call EnableHook() / EnableAllHooks()
|
|
// to write the JMP patch into the target.
|
|
// ---------------------------------------------------------------------------
|
|
|
|
bool Hook(void* target, void* detour, void** original);
|
|
|
|
// AOB pattern: "48 8B ?? ?? ?? 4C" — space-delimited hex, "??" = wildcard.
|
|
bool HookPattern(const char* pattern, void* detour, void** original);
|
|
|
|
// MinHook-style: raw bytes + parallel mask ('x'=match, '?'=wildcard).
|
|
bool HookPatternMask(const char* bytes, const char* mask, size_t len,
|
|
void* detour, void** original);
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Hook control
|
|
// ---------------------------------------------------------------------------
|
|
|
|
bool EnableHook(void* target);
|
|
bool DisableHook(void* target);
|
|
bool EnableAllHooks();
|
|
bool DisableAllHooks();
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Diagnostics
|
|
// ---------------------------------------------------------------------------
|
|
|
|
HookStats GetStats();
|
|
const char* GetLastError(); // nullptr if no error
|
|
|
|
} // namespace Hookah
|