3
0
mirror of https://github.com/CrazyRedMachine/popnhax.git synced 2024-11-27 23:40:50 +01:00
popnhax/util/patch.h

38 lines
1.6 KiB
C
Raw Normal View History

2023-02-10 20:29:11 +01:00
#ifndef __PATCH_H__
#define __PATCH_H__
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
2024-10-02 21:17:09 +02:00
#include "minhook/hde32.h"
#include "minhook/include/MinHook.h"
2023-02-10 20:29:11 +01:00
typedef unsigned long DWORD;
2024-10-02 21:17:09 +02:00
typedef int(*fn_search)(char*,size_t,const char*,size_t,size_t);
typedef int(*fn_wildcard_search)(char*,size_t,const char*,size_t,size_t);
typedef MH_STATUS(*fn_MH_CreateHook)(LPVOID,LPVOID,LPVOID*) WINAPI;
extern fn_search _search;
extern fn_wildcard_search _wildcard_search;
extern fn_MH_CreateHook _MH_CreateHook;
2023-02-10 20:29:11 +01:00
char *getDllData(const char *dllFilename, DWORD *dllSize);
2023-06-30 00:56:02 +02:00
bool rva_to_offset(const char *dllFilename, uint32_t rva, uint32_t *offset);
bool offset_to_rva(const char *dllFilename, uint32_t offset, uint32_t *rva);
void patch_memory(uint64_t patch_addr, char *data, size_t len);
2024-10-02 21:17:09 +02:00
int64_t find_and_patch_hex(const char *dllFilename, const char *find, uint8_t find_size, int64_t shift, const char *replace, uint8_t replace_size);
2023-06-30 00:56:02 +02:00
void find_and_patch_string(const char *dllFilename, const char *input_string, const char *new_string);
2024-10-02 21:17:09 +02:00
int search(char *haystack, size_t haystack_size, const char *needle, size_t needle_size, size_t orig_offset);
int search_debug(char *haystack, size_t haystack_size, const char *needle, size_t needle_size, size_t orig_offset);
int wildcard_search(char *haystack, size_t haystack_size, const char *needle, size_t needle_size, size_t orig_offset);
int wildcard_search_debug(char *haystack, size_t haystack_size, const char *needle, size_t needle_size, size_t orig_offset);
void enable_extended_debug();
2023-02-10 20:29:11 +01:00
#endif