summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorQuentin LADEVIE <qladevie@wanadev.fr>2025-04-30 00:17:19 +0200
committerQuentin LADEVIE <qladevie@wanadev.fr>2025-04-30 00:17:19 +0200
commit0ad788465c7505bdadff64c2f3af3ad5edf71cc3 (patch)
tree96bbcf64de7bd2ee7c99ad9a133182ea62a1db0e /include
parentf8c92cfa9eeb82a608d409cac70d9d2533ab79d8 (diff)
Compiles files one by one
Diffstat (limited to 'include')
-rw-r--r--include/hashmap.h26
-rw-r--r--include/module.h22
-rw-r--r--include/pdb.h6
-rw-r--r--include/stack_walk.h3
-rw-r--r--include/types.h2
5 files changed, 58 insertions, 1 deletions
diff --git a/include/hashmap.h b/include/hashmap.h
new file mode 100644
index 0000000..88490e7
--- /dev/null
+++ b/include/hashmap.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "types.h"
+
+struct element {
+ u64 name;
+ u32 start;
+ u32 end;
+ u32 unwind_offset;
+ u32 psl;
+};
+
+struct hashmap {
+ u32 capacity;
+ u32 size;
+
+ struct element* arr;
+};
+
+extern struct hashmap create_unordered_flat();
+
+extern struct element* insert_elem(struct hashmap* map, u32 start, u32 end, u64 name);
+
+extern struct element* find_elem(struct hashmap* map, u32 start);
+
+extern void iterate(struct hashmap* map);
diff --git a/include/module.h b/include/module.h
index 8a1858f..e94e156 100644
--- a/include/module.h
+++ b/include/module.h
@@ -3,17 +3,39 @@
#include <Windows.h>
#include "types.h"
+#include "hashmap.h"
struct module {
void* base_addr;
+ u8** functions_name;
+ u32* functions_start;
+ u32* functions_end;
+ u32* functions_unwind;
+ u32 functions_count;
+ u32 functions_capacity;
+ // u32 functions_name_capacity;
+ // u32 function_start_capacity;
+ // u32 function_end_capacity;
+ // u32 function_unwind_capacity;
+
IMAGE_DOS_HEADER dos_header;
IMAGE_NT_HEADERS64 nt_header;
+#ifdef HASHMAP
+ struct hashmap symbols;
+#endif
u8 name[256U];
};
+
extern struct module modules[64U];
extern u64 modules_list;
extern u8 add_module();
extern void remove_module(u8 index);
+
+#ifdef HASHMAP
+extern struct element* find_function(struct module* module, u32 rip_offset);
+#else
+extern u32 find_function(struct module* module, u64 rip_offset);
+#endif // HASHMAP
diff --git a/include/pdb.h b/include/pdb.h
index eee19ae..965ccc3 100644
--- a/include/pdb.h
+++ b/include/pdb.h
@@ -1 +1,5 @@
-extern void open_pdb(const char* pdb_path);
+#pragma once
+
+#include "module.h"
+
+extern void open_pdb(const char* pdb_path, struct module* module);
diff --git a/include/stack_walk.h b/include/stack_walk.h
new file mode 100644
index 0000000..783cbb9
--- /dev/null
+++ b/include/stack_walk.h
@@ -0,0 +1,3 @@
+#pragma once
+
+extern void walk_stack(void* ctx);
diff --git a/include/types.h b/include/types.h
index a3b0942..463b73f 100644
--- a/include/types.h
+++ b/include/types.h
@@ -1,3 +1,5 @@
+#pragma once
+
#include <stdint.h>
typedef uint8_t u8;