Initial commit
This commit is contained in:
8
game_payload/include/ace.h
Normal file
8
game_payload/include/ace.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
void ace_fake_driver_files();
|
||||
|
||||
HMODULE ace_load_base_module(const char *exeName);
|
||||
HMODULE ace_load_driver_module();
|
||||
24
game_payload/include/crc32.h
Normal file
24
game_payload/include/crc32.h
Normal file
@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
// Modified from https://stackoverflow.com/a/27950866
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* CRC-32C (iSCSI) polynomial in reversed bit order. */
|
||||
#define __POLY 0x82f63b78
|
||||
|
||||
static inline uint32_t crc32c(uint32_t crc, const unsigned char *buf, size_t len) {
|
||||
crc = ~crc;
|
||||
|
||||
while (len--) {
|
||||
crc ^= *buf++;
|
||||
for (int k = 0; k < 8; k++) {
|
||||
crc = crc & 1 ? (crc >> 1) ^ __POLY : crc >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ~crc;
|
||||
}
|
||||
|
||||
#undef __POLY
|
||||
6
game_payload/include/err.h
Normal file
6
game_payload/include/err.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <wchar.h>
|
||||
|
||||
void err_mb_a(const char *format, ...);
|
||||
void err_mb_w(const wchar_t *format, ...);
|
||||
20
game_payload/include/game.h
Normal file
20
game_payload/include/game.h
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
enum game_id {
|
||||
GAME_INVALID,
|
||||
|
||||
GAME_HI3_GLB
|
||||
};
|
||||
|
||||
struct game_data {
|
||||
enum game_id id; // Temporary
|
||||
const char *name;
|
||||
const char *assembly_path;
|
||||
const wchar_t *assembly_name_lwr;
|
||||
const char *tp6_section_name; // Unused for now
|
||||
const char *tvm_section_name;
|
||||
};
|
||||
|
||||
void game_detect(struct game_data *buf);
|
||||
5
game_payload/include/hi3.h
Normal file
5
game_payload/include/hi3.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <game.h>
|
||||
|
||||
void hi3_fill_data(struct game_data *buf);
|
||||
36
game_payload/include/ntdll.h
Normal file
36
game_payload/include/ntdll.h
Normal file
@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
#include <winternl.h>
|
||||
|
||||
// https://learn.microsoft.com/en-us/windows/win32/devnotes/ldrdllnotification
|
||||
typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA {
|
||||
ULONG Flags; //Reserved.
|
||||
PCUNICODE_STRING FullDllName; //The full path name of the DLL module.
|
||||
PCUNICODE_STRING BaseDllName; //The base file name of the DLL module.
|
||||
PVOID DllBase; //A pointer to the base address for the DLL in memory.
|
||||
ULONG SizeOfImage; //The size of the DLL image, in bytes.
|
||||
} LDR_DLL_LOADED_NOTIFICATION_DATA, *PLDR_DLL_LOADED_NOTIFICATION_DATA;
|
||||
|
||||
typedef struct _LDR_DLL_UNLOADED_NOTIFICATION_DATA {
|
||||
ULONG Flags; //Reserved.
|
||||
PCUNICODE_STRING FullDllName; //The full path name of the DLL module.
|
||||
PCUNICODE_STRING BaseDllName; //The base file name of the DLL module.
|
||||
PVOID DllBase; //A pointer to the base address for the DLL in memory.
|
||||
ULONG SizeOfImage; //The size of the DLL image, in bytes.
|
||||
} LDR_DLL_UNLOADED_NOTIFICATION_DATA, *PLDR_DLL_UNLOADED_NOTIFICATION_DATA;
|
||||
|
||||
typedef union _LDR_DLL_NOTIFICATION_DATA {
|
||||
LDR_DLL_LOADED_NOTIFICATION_DATA Loaded;
|
||||
LDR_DLL_UNLOADED_NOTIFICATION_DATA Unloaded;
|
||||
} LDR_DLL_NOTIFICATION_DATA, *PLDR_DLL_NOTIFICATION_DATA;
|
||||
|
||||
typedef void (*LdrDllNotification_t)(ULONG reason, const PLDR_DLL_NOTIFICATION_DATA data, void *context);
|
||||
|
||||
typedef NTSTATUS (*LdrRegisterDllNotification_t)(ULONG flags, LdrDllNotification_t notificationFunction, void *context, void **cookie);
|
||||
typedef NTSTATUS (*LdrUnregisterDllNotification_t)(void *cookie);
|
||||
|
||||
extern LdrRegisterDllNotification_t LdrRegisterDllNotification;
|
||||
extern LdrUnregisterDllNotification_t LdrUnregisterDllNotification;
|
||||
|
||||
void ntdll_link();
|
||||
6
game_payload/include/pe.h
Normal file
6
game_payload/include/pe.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
void pe_find_section(HMODULE module, const char *section, MEMORY_BASIC_INFORMATION *buf);
|
||||
void *pe_find_entry_point(HMODULE module);
|
||||
7
game_payload/include/tp6.h
Normal file
7
game_payload/include/tp6.h
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <game.h>
|
||||
|
||||
void tp6_setup_patcher(struct game_data *game, HMODULE thisModule, HMODULE baseModule);
|
||||
5
game_payload/include/utils.h
Normal file
5
game_payload/include/utils.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t utils_file_crc32c(const char *filePath);
|
||||
Reference in New Issue
Block a user