summaryrefslogtreecommitdiff
path: root/aoe2hd/include/native.h
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2018-07-02 01:06:39 +0200
committerToni Uhlig <matzeton@googlemail.com>2018-07-02 03:08:59 +0200
commitc2a2445897af17adb56a32dcf111312763a575d4 (patch)
treead459cdd682aff3a011d11b6f2a3c518c60dec6a /aoe2hd/include/native.h
initial commit
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'aoe2hd/include/native.h')
-rwxr-xr-xaoe2hd/include/native.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/aoe2hd/include/native.h b/aoe2hd/include/native.h
new file mode 100755
index 0000000..b599e0d
--- /dev/null
+++ b/aoe2hd/include/native.h
@@ -0,0 +1,56 @@
+#ifndef NATIVE_H_INCLUDED
+#define NATIVE_H_INCLUDED
+
+#include <windows.h>
+#include <stdbool.h>
+
+#define EXPORT __declspec(dllexport)
+
+typedef struct native_data native_data;
+
+typedef unsigned long(*alloc_mem_fn)(const native_data *nd,
+ unsigned long siz);
+typedef bool(*read_mem_fn)(const native_data *nd,
+ unsigned long addr, void *buffer,
+ unsigned long siz);
+typedef bool(*write_mem_fn)(const native_data *nd,
+ unsigned long addr, const void *buffer,
+ unsigned long siz);
+typedef bool(*suspend_proc_fn)(const native_data *nd,
+ int doResume);
+
+typedef struct win_proc
+{
+ DWORD pid;
+ HANDLE hndl;
+ unsigned long modbase;
+} win_proc;
+
+typedef struct native_data
+{
+ win_proc proc;
+ alloc_mem_fn alloc_fn;
+ read_mem_fn read_fn;
+ write_mem_fn write_fn;
+ suspend_proc_fn suspend_fn;
+} native_data;
+
+EXPORT void initNativeData(native_data *nd);
+EXPORT void cls(HANDLE hConsole);
+EXPORT bool get_module_proc(native_data *nd,
+ LPCTSTR window_name);
+EXPORT bool get_module_base(native_data *nd,
+ LPCTSTR module_name);
+
+EXPORT unsigned long mem_alloc(const native_data *nd,
+ unsigned long siz);
+EXPORT bool read_procmem(const native_data *nd,
+ unsigned long addr, void *buffer,
+ unsigned long siz);
+EXPORT bool write_procmem(const native_data *nd,
+ unsigned long addr, const void *buffer,
+ unsigned long siz);
+EXPORT bool suspendProcess(const native_data *nd,
+ int doResume);
+
+#endif // NATIVE_H_INCLUDED