mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2026-09-30 10:46:23 -05:00
WIP: bemanitools 6
highly WIP, what’s “working”: - iidxhook 9 to 24 - launcher - inject
This commit is contained in:
0
btsdk/example/hook/config.c
Normal file
0
btsdk/example/hook/config.c
Normal file
74
btsdk/example/hook/dllmain copy.c
Normal file
74
btsdk/example/hook/dllmain copy.c
Normal file
@@ -0,0 +1,74 @@
|
||||
#define LOG_MODULE "procmon-dllmain"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "core/log-bt-ext.h"
|
||||
#include "core/log-bt.h"
|
||||
#include "core/thread-crt-ext.h"
|
||||
#include "launcher/property-util.h"
|
||||
|
||||
#include "procmon/config.h"
|
||||
#include "procmon/procmon.h"
|
||||
|
||||
#include "util/fs.h"
|
||||
|
||||
// TODO move this to a separate "standalone dllmain bootstrap" module in sdk
|
||||
|
||||
BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
|
||||
{
|
||||
struct property *property;
|
||||
struct property_node *root_node;
|
||||
struct procmon_config config;
|
||||
|
||||
// TODO provide compatibility mode here? ctx set to...something?
|
||||
// to figure out if this is loaded/run by any bemanitools loader
|
||||
// or not.
|
||||
|
||||
if (reason == DLL_PROCESS_ATTACH) {
|
||||
core_thread_crt_ext_impl_set();
|
||||
core_log_bt_ext_init_with_stderr();
|
||||
|
||||
// TODO make this somehow configurable?
|
||||
// have additional stuff on procmon configuration xml
|
||||
// <dllmain>
|
||||
// <log>
|
||||
// have the same log stuff here as with launcher like file, level, rotation etc
|
||||
// </log>
|
||||
// <procmon>
|
||||
// ....
|
||||
// </procmon>
|
||||
// </dllmain>
|
||||
core_log_bt_level_set(CORE_LOG_BT_LOG_LEVEL_INFO);
|
||||
|
||||
log_info("DLL_PROCESS_ATTACH");
|
||||
|
||||
if (path_exists("procmon-config.xml")) {
|
||||
property = property_util_load("procmon-config.xml");
|
||||
|
||||
root_node = property_search(NULL, "hook/procmon");
|
||||
|
||||
if (!root_node) {
|
||||
// TODO error handling
|
||||
}
|
||||
|
||||
procmon_config_init(&config);
|
||||
procmon_config_load(root_node, &config);
|
||||
|
||||
procmon_init(&config);
|
||||
} else {
|
||||
log_warning("No configuration file found, defaulting");
|
||||
|
||||
procmon_config_init(&config);
|
||||
|
||||
procmon_init(&config);
|
||||
}
|
||||
|
||||
} else if (reason == DLL_PROCESS_DETACH) {
|
||||
log_info("DLL_PROCESS_DETACH");
|
||||
|
||||
procmon_fini();
|
||||
core_log_bt_fini();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
15
btsdk/example/hook/dllmain-bootstrap.c
Normal file
15
btsdk/example/hook/dllmain-bootstrap.c
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
void btsdk_dllmain_bootstrap_process_attach()
|
||||
{
|
||||
// TODO have the whole stuff to bootstrap independently of hook API
|
||||
// with logging setup etc.
|
||||
// provide stuff via recovering from command line args or env vars?
|
||||
}
|
||||
|
||||
void btsdk_dllmain_bootstrap_process_detach()
|
||||
{
|
||||
// TODO cleanup
|
||||
|
||||
core_log_bt_fini();
|
||||
}
|
||||
12
btsdk/example/hook/dllmain-bootstrap.h
Normal file
12
btsdk/example/hook/dllmain-bootstrap.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef DLLMAIN_BOOTSTRAP_H
|
||||
#define DLLMAIN_BOOTSTRAP_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "imports/avs.h"
|
||||
|
||||
void btsdk_dllmain_bootstrap_process_attach();
|
||||
|
||||
void btsdk_dllmain_bootstrap_process_detach();
|
||||
|
||||
#endif
|
||||
0
btsdk/example/hook/log.c
Normal file
0
btsdk/example/hook/log.c
Normal file
21
btsdk/example/hook/thread.c
Normal file
21
btsdk/example/hook/thread.c
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
|
||||
void btapi_thread_impl_set()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int btapi_thread_create(int (*proc)(void *), void *ctx, uint32_t stack_sz, unsigned int priority)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void btapi_thread_join(int thread_id, int *result)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void btapi_thread_destroy(int thread_id)
|
||||
{
|
||||
|
||||
}
|
||||
3
btsdk/example/hook/thread.h
Normal file
3
btsdk/example/hook/thread.h
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
void btapi_thread_impl_set();
|
||||
Reference in New Issue
Block a user