mirror of
https://github.com/waryas/WaryasSWHE.git
synced 2025-12-13 13:23:08 +08:00
95 lines
2.5 KiB
C++
95 lines
2.5 KiB
C++
#pragma once
|
|
#include <Windows.h>
|
|
#include <cstdint>
|
|
|
|
|
|
#define OBFUSCATE __attribute__((annotate("obfuscate")))
|
|
|
|
|
|
|
|
#define BAD_READ_VALUE 0xBACABACABACABACA
|
|
|
|
class CProcess
|
|
{
|
|
public:
|
|
DWORD ThreadID{};
|
|
DWORD ProcessID{};
|
|
HWND ProcessHwnd{};
|
|
uintptr_t peb{};
|
|
uintptr_t discord_base{};
|
|
uintptr_t discord_framebuffer{};
|
|
|
|
uintptr_t base{};
|
|
char* exe_name{};
|
|
char* discord_path{};
|
|
uintptr_t pmw_tramp_offset{};
|
|
uintptr_t pma_tramp_offset{};
|
|
uintptr_t gmw_tramp_offset{};
|
|
uintptr_t present_tramp_offset{};
|
|
uintptr_t spoofcall_offset{};
|
|
uintptr_t grid_offset{};
|
|
uintptr_t disable_input_offset{};
|
|
|
|
/// @brief Initializes the hwnd and process ID elements of the class
|
|
/// @param WindowName
|
|
/// @param ClassName
|
|
/// @param exe_name
|
|
/// @return Whether the initialization was successful
|
|
bool Initialize(const wchar_t* WindowName, const wchar_t* ClassName = nullptr, char* exe_name = (char*)"game.exe", HWND target_window = nullptr);
|
|
};
|
|
|
|
typedef struct ModuleListNode
|
|
{
|
|
char* moduleName;
|
|
uint64_t baseAddress;
|
|
struct ModuleListNode* next;
|
|
} ModuleListNode;
|
|
|
|
|
|
class CExploit
|
|
{
|
|
public:
|
|
OBFUSCATE uint64_t ReadU64(uint64_t Address);
|
|
OBFUSCATE void ReadData(uint64_t Address, BYTE* Data, size_t Size);
|
|
OBFUSCATE void WriteU64(uint64_t Address, uint64_t Value);
|
|
OBFUSCATE void WriteData(uint64_t Address, BYTE* Data, size_t Size);
|
|
OBFUSCATE uint64_t AllocateRX(BYTE* data, size_t size);
|
|
OBFUSCATE uint64_t MapPEHeader(uint64_t Address);
|
|
OBFUSCATE void ChangeProtection(uint64_t Address, size_t size, DWORD protection);
|
|
OBFUSCATE bool Initialize(CProcess* Proc);
|
|
OBFUSCATE uint64_t get_LocalSharedMemory();
|
|
OBFUSCATE uint64_t get_RemoteSharedMemory();
|
|
OBFUSCATE uint64_t get_RemoteBase();
|
|
private:
|
|
OBFUSCATE bool FindSharedMemory(HANDLE hProcess, uint64_t* MemoryOut, uint64_t* SharedCountOut, char* exe_name);
|
|
OBFUSCATE std::uint8_t* PatternScan(void* module, const char* signature);
|
|
OBFUSCATE void SetupRW();
|
|
private:
|
|
CProcess* ProcessData{};
|
|
|
|
uint64_t SharedCount{};
|
|
|
|
uint64_t LocalSharedMemory{};
|
|
uint64_t RemoteSharedMemory{};
|
|
uint64_t RemoteProcessBase{};
|
|
|
|
uintptr_t set_protect{};
|
|
|
|
uintptr_t mr_data_addr_ptr{};
|
|
uintptr_t mr_data_size_ptr{};
|
|
uintptr_t mr_data_addr_orig{};
|
|
uintptr_t mr_data_size_orig{};
|
|
uintptr_t set_mrprot{};
|
|
|
|
uintptr_t r{};
|
|
uintptr_t t{};
|
|
uintptr_t w{};
|
|
|
|
uint64_t read_fn{};
|
|
uint64_t write_fn{};
|
|
|
|
HMODULE nt{};
|
|
HMODULE sh{};
|
|
HMODULE ddll{};
|
|
|
|
}; |