diff options
18 files changed, 7 insertions, 1378 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c index ff1371b14..1fad7102f 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -567,6 +567,7 @@ struct hplugin *hplugin_load(const char* filename) /* id */ plugin->hpi->pid = plugin->idx; /* core */ + plugin->hpi->memmgr = HPMiMalloc; #ifdef CONSOLE_INPUT plugin->hpi->addCPCommand = console->input->addCommand; #endif // CONSOLE_INPUT @@ -1093,8 +1094,8 @@ void hpm_init(void) HPM->off = false; - memcpy(&iMalloc_HPM, iMalloc, sizeof(struct malloc_interface)); HPMiMalloc = &iMalloc_HPM; + *HPMiMalloc = *iMalloc; HPMiMalloc->malloc = HPM_mmalloc; HPMiMalloc->calloc = HPM_calloc; HPMiMalloc->realloc = HPM_realloc; diff --git a/src/common/HPMSymbols.inc.h b/src/common/HPMSymbols.inc.h index 7ccb960de..8dd0f1cd7 100644 --- a/src/common/HPMSymbols.inc.h +++ b/src/common/HPMSymbols.inc.h @@ -155,9 +155,6 @@ struct loginif_interface *loginif; #ifdef MAP_MAIL_H /* mail */ struct mail_interface *mail; #endif // MAP_MAIL_H -#ifdef COMMON_MEMMGR_H /* iMalloc */ -struct malloc_interface *iMalloc; -#endif // COMMON_MEMMGR_H #ifdef MAP_MAP_H /* map */ struct map_interface *map; #endif // MAP_MAP_H @@ -405,9 +402,6 @@ if ((server_type&(SERVER_TYPE_CHAR)) && !HPM_SYMBOL("loginif", loginif)) return #ifdef MAP_MAIL_H /* mail */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("mail", mail)) return "mail"; #endif // MAP_MAIL_H -#ifdef COMMON_MEMMGR_H /* iMalloc */ -if ((server_type&(SERVER_TYPE_ALL)) && !HPM_SYMBOL("iMalloc", iMalloc)) return "iMalloc"; -#endif // COMMON_MEMMGR_H #ifdef MAP_MAP_H /* map */ if ((server_type&(SERVER_TYPE_MAP)) && !HPM_SYMBOL("map", map)) return "map"; #endif // MAP_MAP_H diff --git a/src/common/HPMi.h b/src/common/HPMi.h index 19b9b20a5..143c325c1 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -231,6 +231,7 @@ struct HPMi_interface { /* Hooking */ struct HPMHooking_interface *hooking; + struct malloc_interface *memmgr; }; #ifdef HERCULES_CORE #define HPM_SYMBOL(n, s) (HPM->share((s), (n)), true) diff --git a/src/common/memmgr.h b/src/common/memmgr.h index 680947466..a5b7e4e7d 100644 --- a/src/common/memmgr.h +++ b/src/common/memmgr.h @@ -101,8 +101,10 @@ struct malloc_interface { void malloc_defaults(void); void memmgr_report(int extra); -#endif // HERCULES_CORE HPShared struct malloc_interface *iMalloc; +#else +#define iMalloc HPMi->memmgr +#endif // HERCULES_CORE #endif /* COMMON_MEMMGR_H */ diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 6b88ddf43..1e4ca6425 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -3787,36 +3787,6 @@ typedef void (*HPMHOOK_post_mail_deliveryfail) (struct map_session_data *sd, str typedef bool (*HPMHOOK_pre_mail_invalid_operation) (struct map_session_data **sd); typedef bool (*HPMHOOK_post_mail_invalid_operation) (bool retVal___, struct map_session_data *sd); #endif // MAP_MAIL_H -#ifdef COMMON_MEMMGR_H /* iMalloc */ -typedef void (*HPMHOOK_pre_iMalloc_init) (void); -typedef void (*HPMHOOK_post_iMalloc_init) (void); -typedef void (*HPMHOOK_pre_iMalloc_final) (void); -typedef void (*HPMHOOK_post_iMalloc_final) (void); -typedef void* (*HPMHOOK_pre_iMalloc_malloc) (size_t *size, const char **file, int *line, const char **func); -typedef void* (*HPMHOOK_post_iMalloc_malloc) (void* retVal___, size_t size, const char *file, int line, const char *func); -typedef void* (*HPMHOOK_pre_iMalloc_calloc) (size_t *num, size_t *size, const char **file, int *line, const char **func); -typedef void* (*HPMHOOK_post_iMalloc_calloc) (void* retVal___, size_t num, size_t size, const char *file, int line, const char *func); -typedef void* (*HPMHOOK_pre_iMalloc_realloc) (void **p, size_t *size, const char **file, int *line, const char **func); -typedef void* (*HPMHOOK_post_iMalloc_realloc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); -typedef void* (*HPMHOOK_pre_iMalloc_reallocz) (void **p, size_t *size, const char **file, int *line, const char **func); -typedef void* (*HPMHOOK_post_iMalloc_reallocz) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); -typedef char* (*HPMHOOK_pre_iMalloc_astrdup) (const char **p, const char **file, int *line, const char **func); -typedef char* (*HPMHOOK_post_iMalloc_astrdup) (char* retVal___, const char *p, const char *file, int line, const char *func); -typedef char* (*HPMHOOK_pre_iMalloc_astrndup) (const char **p, size_t *size, const char **file, int *line, const char **func); -typedef char* (*HPMHOOK_post_iMalloc_astrndup) (char* retVal___, const char *p, size_t size, const char *file, int line, const char *func); -typedef void (*HPMHOOK_pre_iMalloc_free) (void **p, const char **file, int *line, const char **func); -typedef void (*HPMHOOK_post_iMalloc_free) (void *p, const char *file, int line, const char *func); -typedef void (*HPMHOOK_pre_iMalloc_memory_check) (void); -typedef void (*HPMHOOK_post_iMalloc_memory_check) (void); -typedef bool (*HPMHOOK_pre_iMalloc_verify_ptr) (void **ptr); -typedef bool (*HPMHOOK_post_iMalloc_verify_ptr) (bool retVal___, void *ptr); -typedef size_t (*HPMHOOK_pre_iMalloc_usage) (void); -typedef size_t (*HPMHOOK_post_iMalloc_usage) (size_t retVal___); -typedef void (*HPMHOOK_pre_iMalloc_post_shutdown) (void); -typedef void (*HPMHOOK_post_iMalloc_post_shutdown) (void); -typedef void (*HPMHOOK_pre_iMalloc_init_messages) (void); -typedef void (*HPMHOOK_post_iMalloc_init_messages) (void); -#endif // COMMON_MEMMGR_H #ifdef MAP_MAP_H /* map */ typedef void (*HPMHOOK_pre_map_zone_init) (void); typedef void (*HPMHOOK_post_map_zone_init) (void); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index 836e51f3f..3af236f48 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -804,34 +804,6 @@ struct { struct HPMHookPoint *HP_loginif_send_users_count_post; struct HPMHookPoint *HP_loginif_connect_to_server_pre; struct HPMHookPoint *HP_loginif_connect_to_server_post; - struct HPMHookPoint *HP_iMalloc_init_pre; - struct HPMHookPoint *HP_iMalloc_init_post; - struct HPMHookPoint *HP_iMalloc_final_pre; - struct HPMHookPoint *HP_iMalloc_final_post; - struct HPMHookPoint *HP_iMalloc_malloc_pre; - struct HPMHookPoint *HP_iMalloc_malloc_post; - struct HPMHookPoint *HP_iMalloc_calloc_pre; - struct HPMHookPoint *HP_iMalloc_calloc_post; - struct HPMHookPoint *HP_iMalloc_realloc_pre; - struct HPMHookPoint *HP_iMalloc_realloc_post; - struct HPMHookPoint *HP_iMalloc_reallocz_pre; - struct HPMHookPoint *HP_iMalloc_reallocz_post; - struct HPMHookPoint *HP_iMalloc_astrdup_pre; - struct HPMHookPoint *HP_iMalloc_astrdup_post; - struct HPMHookPoint *HP_iMalloc_astrndup_pre; - struct HPMHookPoint *HP_iMalloc_astrndup_post; - struct HPMHookPoint *HP_iMalloc_free_pre; - struct HPMHookPoint *HP_iMalloc_free_post; - struct HPMHookPoint *HP_iMalloc_memory_check_pre; - struct HPMHookPoint *HP_iMalloc_memory_check_post; - struct HPMHookPoint *HP_iMalloc_verify_ptr_pre; - struct HPMHookPoint *HP_iMalloc_verify_ptr_post; - struct HPMHookPoint *HP_iMalloc_usage_pre; - struct HPMHookPoint *HP_iMalloc_usage_post; - struct HPMHookPoint *HP_iMalloc_post_shutdown_pre; - struct HPMHookPoint *HP_iMalloc_post_shutdown_post; - struct HPMHookPoint *HP_iMalloc_init_messages_pre; - struct HPMHookPoint *HP_iMalloc_init_messages_post; struct HPMHookPoint *HP_mapif_ban_pre; struct HPMHookPoint *HP_mapif_ban_post; struct HPMHookPoint *HP_mapif_server_init_pre; @@ -2309,34 +2281,6 @@ struct { int HP_loginif_send_users_count_post; int HP_loginif_connect_to_server_pre; int HP_loginif_connect_to_server_post; - int HP_iMalloc_init_pre; - int HP_iMalloc_init_post; - int HP_iMalloc_final_pre; - int HP_iMalloc_final_post; - int HP_iMalloc_malloc_pre; - int HP_iMalloc_malloc_post; - int HP_iMalloc_calloc_pre; - int HP_iMalloc_calloc_post; - int HP_iMalloc_realloc_pre; - int HP_iMalloc_realloc_post; - int HP_iMalloc_reallocz_pre; - int HP_iMalloc_reallocz_post; - int HP_iMalloc_astrdup_pre; - int HP_iMalloc_astrdup_post; - int HP_iMalloc_astrndup_pre; - int HP_iMalloc_astrndup_post; - int HP_iMalloc_free_pre; - int HP_iMalloc_free_post; - int HP_iMalloc_memory_check_pre; - int HP_iMalloc_memory_check_post; - int HP_iMalloc_verify_ptr_pre; - int HP_iMalloc_verify_ptr_post; - int HP_iMalloc_usage_pre; - int HP_iMalloc_usage_post; - int HP_iMalloc_post_shutdown_pre; - int HP_iMalloc_post_shutdown_post; - int HP_iMalloc_init_messages_pre; - int HP_iMalloc_init_messages_post; int HP_mapif_ban_pre; int HP_mapif_ban_post; int HP_mapif_server_init_pre; @@ -3057,7 +3001,6 @@ struct { struct inter_storage_interface inter_storage; struct libconfig_interface libconfig; struct loginif_interface loginif; - struct malloc_interface iMalloc; struct mapif_interface mapif; struct mapindex_interface mapindex; struct md5_interface md5; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 047373f77..55fc347e5 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -436,21 +436,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(loginif->auth, HP_loginif_auth) }, { HP_POP(loginif->send_users_count, HP_loginif_send_users_count) }, { HP_POP(loginif->connect_to_server, HP_loginif_connect_to_server) }, -/* malloc_interface */ - { HP_POP(iMalloc->init, HP_iMalloc_init) }, - { HP_POP(iMalloc->final, HP_iMalloc_final) }, - { HP_POP(iMalloc->malloc, HP_iMalloc_malloc) }, - { HP_POP(iMalloc->calloc, HP_iMalloc_calloc) }, - { HP_POP(iMalloc->realloc, HP_iMalloc_realloc) }, - { HP_POP(iMalloc->reallocz, HP_iMalloc_reallocz) }, - { HP_POP(iMalloc->astrdup, HP_iMalloc_astrdup) }, - { HP_POP(iMalloc->astrndup, HP_iMalloc_astrndup) }, - { HP_POP(iMalloc->free, HP_iMalloc_free) }, - { HP_POP(iMalloc->memory_check, HP_iMalloc_memory_check) }, - { HP_POP(iMalloc->verify_ptr, HP_iMalloc_verify_ptr) }, - { HP_POP(iMalloc->usage, HP_iMalloc_usage) }, - { HP_POP(iMalloc->post_shutdown, HP_iMalloc_post_shutdown) }, - { HP_POP(iMalloc->init_messages, HP_iMalloc_init_messages) }, /* mapif_interface */ { HP_POP(mapif->ban, HP_mapif_ban) }, { HP_POP(mapif->server_init, HP_mapif_server_init) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 63afcab3c..89ae03319 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -10440,379 +10440,6 @@ void HP_loginif_connect_to_server(void) { } return; } -/* malloc_interface */ -void HP_iMalloc_init(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init(); - } - if( HPMHooks.count.HP_iMalloc_init_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_final(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_final_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_final_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.final(); - } - if( HPMHooks.count.HP_iMalloc_final_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_final_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void* HP_iMalloc_malloc(size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_malloc_pre ) { - void* (*preHookFunc) (size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_malloc_pre[hIndex].func; - retVal___ = preHookFunc(&size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.malloc(size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_malloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_malloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_calloc(size_t num, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_calloc_pre ) { - void* (*preHookFunc) (size_t *num, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_calloc_pre[hIndex].func; - retVal___ = preHookFunc(&num, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.calloc(num, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_calloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t num, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_calloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, num, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_realloc(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_realloc_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_realloc_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.realloc(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_realloc_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_realloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_reallocz(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_reallocz_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_reallocz_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.reallocz(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_reallocz_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_reallocz_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrdup(const char *p, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrdup_pre ) { - char* (*preHookFunc) (const char **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrdup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrdup(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrdup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrdup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrndup(const char *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrndup_pre ) { - char* (*preHookFunc) (const char **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrndup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrndup(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrndup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrndup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void HP_iMalloc_free(void *p, const char *file, int line, const char *func) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_free_pre ) { - void (*preHookFunc) (void **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_free_pre[hIndex].func; - preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.free(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_free_post ) { - void (*postHookFunc) (void *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_free_post[hIndex].func; - postHookFunc(p, file, line, func); - } - } - return; -} -void HP_iMalloc_memory_check(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_memory_check_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_memory_check_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.memory_check(); - } - if( HPMHooks.count.HP_iMalloc_memory_check_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_memory_check_post[hIndex].func; - postHookFunc(); - } - } - return; -} -bool HP_iMalloc_verify_ptr(void *ptr) { - int hIndex = 0; - bool retVal___ = false; - if( HPMHooks.count.HP_iMalloc_verify_ptr_pre ) { - bool (*preHookFunc) (void **ptr); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_pre[hIndex].func; - retVal___ = preHookFunc(&ptr); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.verify_ptr(ptr); - } - if( HPMHooks.count.HP_iMalloc_verify_ptr_post ) { - bool (*postHookFunc) (bool retVal___, void *ptr); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_post[hIndex].func; - retVal___ = postHookFunc(retVal___, ptr); - } - } - return retVal___; -} -size_t HP_iMalloc_usage(void) { - int hIndex = 0; - size_t retVal___ = 0; - if( HPMHooks.count.HP_iMalloc_usage_pre ) { - size_t (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_usage_pre[hIndex].func; - retVal___ = preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.usage(); - } - if( HPMHooks.count.HP_iMalloc_usage_post ) { - size_t (*postHookFunc) (size_t retVal___); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_usage_post[hIndex].func; - retVal___ = postHookFunc(retVal___); - } - } - return retVal___; -} -void HP_iMalloc_post_shutdown(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_post_shutdown_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.post_shutdown(); - } - if( HPMHooks.count.HP_iMalloc_post_shutdown_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_init_messages(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_messages_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_messages_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init_messages(); - } - if( HPMHooks.count.HP_iMalloc_init_messages_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_messages_post[hIndex].func; - postHookFunc(); - } - } - return; -} /* mapif_interface */ void HP_mapif_ban(int id, unsigned int flag, int status) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_char.sources.inc b/src/plugins/HPMHooking/HPMHooking_char.sources.inc index 54ae8f030..d940e379a 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.sources.inc @@ -46,7 +46,6 @@ memcpy(&HPMHooks.source.inter_quest, inter_quest, sizeof(struct inter_quest_inte memcpy(&HPMHooks.source.inter_storage, inter_storage, sizeof(struct inter_storage_interface)); memcpy(&HPMHooks.source.libconfig, libconfig, sizeof(struct libconfig_interface)); memcpy(&HPMHooks.source.loginif, loginif, sizeof(struct loginif_interface)); -memcpy(&HPMHooks.source.iMalloc, iMalloc, sizeof(struct malloc_interface)); memcpy(&HPMHooks.source.mapif, mapif, sizeof(struct mapif_interface)); memcpy(&HPMHooks.source.mapindex, mapindex, sizeof(struct mapindex_interface)); memcpy(&HPMHooks.source.md5, md5, sizeof(struct md5_interface)); diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index b97b6ea7f..1d7ac8267 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -376,34 +376,6 @@ struct { struct HPMHookPoint *HP_login_config_set_defaults_post; struct HPMHookPoint *HP_login_config_read_pre; struct HPMHookPoint *HP_login_config_read_post; - struct HPMHookPoint *HP_iMalloc_init_pre; - struct HPMHookPoint *HP_iMalloc_init_post; - struct HPMHookPoint *HP_iMalloc_final_pre; - struct HPMHookPoint *HP_iMalloc_final_post; - struct HPMHookPoint *HP_iMalloc_malloc_pre; - struct HPMHookPoint *HP_iMalloc_malloc_post; - struct HPMHookPoint *HP_iMalloc_calloc_pre; - struct HPMHookPoint *HP_iMalloc_calloc_post; - struct HPMHookPoint *HP_iMalloc_realloc_pre; - struct HPMHookPoint *HP_iMalloc_realloc_post; - struct HPMHookPoint *HP_iMalloc_reallocz_pre; - struct HPMHookPoint *HP_iMalloc_reallocz_post; - struct HPMHookPoint *HP_iMalloc_astrdup_pre; - struct HPMHookPoint *HP_iMalloc_astrdup_post; - struct HPMHookPoint *HP_iMalloc_astrndup_pre; - struct HPMHookPoint *HP_iMalloc_astrndup_post; - struct HPMHookPoint *HP_iMalloc_free_pre; - struct HPMHookPoint *HP_iMalloc_free_post; - struct HPMHookPoint *HP_iMalloc_memory_check_pre; - struct HPMHookPoint *HP_iMalloc_memory_check_post; - struct HPMHookPoint *HP_iMalloc_verify_ptr_pre; - struct HPMHookPoint *HP_iMalloc_verify_ptr_post; - struct HPMHookPoint *HP_iMalloc_usage_pre; - struct HPMHookPoint *HP_iMalloc_usage_post; - struct HPMHookPoint *HP_iMalloc_post_shutdown_pre; - struct HPMHookPoint *HP_iMalloc_post_shutdown_post; - struct HPMHookPoint *HP_iMalloc_init_messages_pre; - struct HPMHookPoint *HP_iMalloc_init_messages_post; struct HPMHookPoint *HP_md5_string_pre; struct HPMHookPoint *HP_md5_string_post; struct HPMHookPoint *HP_md5_binary_pre; @@ -1077,34 +1049,6 @@ struct { int HP_login_config_set_defaults_post; int HP_login_config_read_pre; int HP_login_config_read_post; - int HP_iMalloc_init_pre; - int HP_iMalloc_init_post; - int HP_iMalloc_final_pre; - int HP_iMalloc_final_post; - int HP_iMalloc_malloc_pre; - int HP_iMalloc_malloc_post; - int HP_iMalloc_calloc_pre; - int HP_iMalloc_calloc_post; - int HP_iMalloc_realloc_pre; - int HP_iMalloc_realloc_post; - int HP_iMalloc_reallocz_pre; - int HP_iMalloc_reallocz_post; - int HP_iMalloc_astrdup_pre; - int HP_iMalloc_astrdup_post; - int HP_iMalloc_astrndup_pre; - int HP_iMalloc_astrndup_post; - int HP_iMalloc_free_pre; - int HP_iMalloc_free_post; - int HP_iMalloc_memory_check_pre; - int HP_iMalloc_memory_check_post; - int HP_iMalloc_verify_ptr_pre; - int HP_iMalloc_verify_ptr_post; - int HP_iMalloc_usage_pre; - int HP_iMalloc_usage_post; - int HP_iMalloc_post_shutdown_pre; - int HP_iMalloc_post_shutdown_post; - int HP_iMalloc_init_messages_pre; - int HP_iMalloc_init_messages_post; int HP_md5_string_pre; int HP_md5_string_post; int HP_md5_binary_pre; @@ -1438,7 +1382,6 @@ struct { struct lclif_interface_private PRIV__lclif; struct libconfig_interface libconfig; struct login_interface login; - struct malloc_interface iMalloc; struct md5_interface md5; struct mutex_interface mutex; struct nullpo_interface nullpo; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index 2d3e37bc3..96a711af6 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -211,21 +211,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(login->parse_request_connection, HP_login_parse_request_connection) }, { HP_POP(login->config_set_defaults, HP_login_config_set_defaults) }, { HP_POP(login->config_read, HP_login_config_read) }, -/* malloc_interface */ - { HP_POP(iMalloc->init, HP_iMalloc_init) }, - { HP_POP(iMalloc->final, HP_iMalloc_final) }, - { HP_POP(iMalloc->malloc, HP_iMalloc_malloc) }, - { HP_POP(iMalloc->calloc, HP_iMalloc_calloc) }, - { HP_POP(iMalloc->realloc, HP_iMalloc_realloc) }, - { HP_POP(iMalloc->reallocz, HP_iMalloc_reallocz) }, - { HP_POP(iMalloc->astrdup, HP_iMalloc_astrdup) }, - { HP_POP(iMalloc->astrndup, HP_iMalloc_astrndup) }, - { HP_POP(iMalloc->free, HP_iMalloc_free) }, - { HP_POP(iMalloc->memory_check, HP_iMalloc_memory_check) }, - { HP_POP(iMalloc->verify_ptr, HP_iMalloc_verify_ptr) }, - { HP_POP(iMalloc->usage, HP_iMalloc_usage) }, - { HP_POP(iMalloc->post_shutdown, HP_iMalloc_post_shutdown) }, - { HP_POP(iMalloc->init_messages, HP_iMalloc_init_messages) }, /* md5_interface */ { HP_POP(md5->string, HP_md5_string) }, { HP_POP(md5->binary, HP_md5_binary) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index 290c2283a..097b4b283 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -4716,379 +4716,6 @@ bool HP_login_config_read(const char *filename, bool included) { } return retVal___; } -/* malloc_interface */ -void HP_iMalloc_init(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init(); - } - if( HPMHooks.count.HP_iMalloc_init_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_final(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_final_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_final_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.final(); - } - if( HPMHooks.count.HP_iMalloc_final_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_final_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void* HP_iMalloc_malloc(size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_malloc_pre ) { - void* (*preHookFunc) (size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_malloc_pre[hIndex].func; - retVal___ = preHookFunc(&size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.malloc(size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_malloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_malloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_calloc(size_t num, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_calloc_pre ) { - void* (*preHookFunc) (size_t *num, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_calloc_pre[hIndex].func; - retVal___ = preHookFunc(&num, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.calloc(num, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_calloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t num, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_calloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, num, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_realloc(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_realloc_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_realloc_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.realloc(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_realloc_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_realloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_reallocz(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_reallocz_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_reallocz_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.reallocz(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_reallocz_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_reallocz_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrdup(const char *p, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrdup_pre ) { - char* (*preHookFunc) (const char **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrdup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrdup(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrdup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrdup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrndup(const char *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrndup_pre ) { - char* (*preHookFunc) (const char **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrndup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrndup(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrndup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrndup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void HP_iMalloc_free(void *p, const char *file, int line, const char *func) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_free_pre ) { - void (*preHookFunc) (void **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_free_pre[hIndex].func; - preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.free(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_free_post ) { - void (*postHookFunc) (void *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_free_post[hIndex].func; - postHookFunc(p, file, line, func); - } - } - return; -} -void HP_iMalloc_memory_check(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_memory_check_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_memory_check_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.memory_check(); - } - if( HPMHooks.count.HP_iMalloc_memory_check_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_memory_check_post[hIndex].func; - postHookFunc(); - } - } - return; -} -bool HP_iMalloc_verify_ptr(void *ptr) { - int hIndex = 0; - bool retVal___ = false; - if( HPMHooks.count.HP_iMalloc_verify_ptr_pre ) { - bool (*preHookFunc) (void **ptr); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_pre[hIndex].func; - retVal___ = preHookFunc(&ptr); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.verify_ptr(ptr); - } - if( HPMHooks.count.HP_iMalloc_verify_ptr_post ) { - bool (*postHookFunc) (bool retVal___, void *ptr); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_post[hIndex].func; - retVal___ = postHookFunc(retVal___, ptr); - } - } - return retVal___; -} -size_t HP_iMalloc_usage(void) { - int hIndex = 0; - size_t retVal___ = 0; - if( HPMHooks.count.HP_iMalloc_usage_pre ) { - size_t (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_usage_pre[hIndex].func; - retVal___ = preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.usage(); - } - if( HPMHooks.count.HP_iMalloc_usage_post ) { - size_t (*postHookFunc) (size_t retVal___); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_usage_post[hIndex].func; - retVal___ = postHookFunc(retVal___); - } - } - return retVal___; -} -void HP_iMalloc_post_shutdown(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_post_shutdown_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.post_shutdown(); - } - if( HPMHooks.count.HP_iMalloc_post_shutdown_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_init_messages(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_messages_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_messages_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init_messages(); - } - if( HPMHooks.count.HP_iMalloc_init_messages_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_messages_post[hIndex].func; - postHookFunc(); - } - } - return; -} /* md5_interface */ void HP_md5_string(const char *string, char *output) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_login.sources.inc b/src/plugins/HPMHooking/HPMHooking_login.sources.inc index 6677a0c55..4bb7f5396 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.sources.inc @@ -35,7 +35,6 @@ memcpy(&HPMHooks.source.lclif, lclif, sizeof(struct lclif_interface)); memcpy(&HPMHooks.source.PRIV__lclif, lclif->p, sizeof(struct lclif_interface_private)); memcpy(&HPMHooks.source.libconfig, libconfig, sizeof(struct libconfig_interface)); memcpy(&HPMHooks.source.login, login, sizeof(struct login_interface)); -memcpy(&HPMHooks.source.iMalloc, iMalloc, sizeof(struct malloc_interface)); memcpy(&HPMHooks.source.md5, md5, sizeof(struct md5_interface)); memcpy(&HPMHooks.source.mutex, mutex, sizeof(struct mutex_interface)); memcpy(&HPMHooks.source.nullpo, nullpo, sizeof(struct nullpo_interface)); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index d71ecc52f..cbaf14715 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -2984,34 +2984,6 @@ struct { struct HPMHookPoint *HP_mail_deliveryfail_post; struct HPMHookPoint *HP_mail_invalid_operation_pre; struct HPMHookPoint *HP_mail_invalid_operation_post; - struct HPMHookPoint *HP_iMalloc_init_pre; - struct HPMHookPoint *HP_iMalloc_init_post; - struct HPMHookPoint *HP_iMalloc_final_pre; - struct HPMHookPoint *HP_iMalloc_final_post; - struct HPMHookPoint *HP_iMalloc_malloc_pre; - struct HPMHookPoint *HP_iMalloc_malloc_post; - struct HPMHookPoint *HP_iMalloc_calloc_pre; - struct HPMHookPoint *HP_iMalloc_calloc_post; - struct HPMHookPoint *HP_iMalloc_realloc_pre; - struct HPMHookPoint *HP_iMalloc_realloc_post; - struct HPMHookPoint *HP_iMalloc_reallocz_pre; - struct HPMHookPoint *HP_iMalloc_reallocz_post; - struct HPMHookPoint *HP_iMalloc_astrdup_pre; - struct HPMHookPoint *HP_iMalloc_astrdup_post; - struct HPMHookPoint *HP_iMalloc_astrndup_pre; - struct HPMHookPoint *HP_iMalloc_astrndup_post; - struct HPMHookPoint *HP_iMalloc_free_pre; - struct HPMHookPoint *HP_iMalloc_free_post; - struct HPMHookPoint *HP_iMalloc_memory_check_pre; - struct HPMHookPoint *HP_iMalloc_memory_check_post; - struct HPMHookPoint *HP_iMalloc_verify_ptr_pre; - struct HPMHookPoint *HP_iMalloc_verify_ptr_post; - struct HPMHookPoint *HP_iMalloc_usage_pre; - struct HPMHookPoint *HP_iMalloc_usage_post; - struct HPMHookPoint *HP_iMalloc_post_shutdown_pre; - struct HPMHookPoint *HP_iMalloc_post_shutdown_post; - struct HPMHookPoint *HP_iMalloc_init_messages_pre; - struct HPMHookPoint *HP_iMalloc_init_messages_post; struct HPMHookPoint *HP_map_zone_init_pre; struct HPMHookPoint *HP_map_zone_init_post; struct HPMHookPoint *HP_map_zone_remove_pre; @@ -9047,34 +9019,6 @@ struct { int HP_mail_deliveryfail_post; int HP_mail_invalid_operation_pre; int HP_mail_invalid_operation_post; - int HP_iMalloc_init_pre; - int HP_iMalloc_init_post; - int HP_iMalloc_final_pre; - int HP_iMalloc_final_post; - int HP_iMalloc_malloc_pre; - int HP_iMalloc_malloc_post; - int HP_iMalloc_calloc_pre; - int HP_iMalloc_calloc_post; - int HP_iMalloc_realloc_pre; - int HP_iMalloc_realloc_post; - int HP_iMalloc_reallocz_pre; - int HP_iMalloc_reallocz_post; - int HP_iMalloc_astrdup_pre; - int HP_iMalloc_astrdup_post; - int HP_iMalloc_astrndup_pre; - int HP_iMalloc_astrndup_post; - int HP_iMalloc_free_pre; - int HP_iMalloc_free_post; - int HP_iMalloc_memory_check_pre; - int HP_iMalloc_memory_check_post; - int HP_iMalloc_verify_ptr_pre; - int HP_iMalloc_verify_ptr_post; - int HP_iMalloc_usage_pre; - int HP_iMalloc_usage_post; - int HP_iMalloc_post_shutdown_pre; - int HP_iMalloc_post_shutdown_post; - int HP_iMalloc_init_messages_pre; - int HP_iMalloc_init_messages_post; int HP_map_zone_init_pre; int HP_map_zone_init_post; int HP_map_zone_remove_pre; @@ -12179,7 +12123,6 @@ struct { struct libconfig_interface libconfig; struct log_interface logs; struct mail_interface mail; - struct malloc_interface iMalloc; struct map_interface map; struct mapindex_interface mapindex; struct mapit_interface mapit; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index b6ee443a3..989296011 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1532,21 +1532,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(mail->openmail, HP_mail_openmail) }, { HP_POP(mail->deliveryfail, HP_mail_deliveryfail) }, { HP_POP(mail->invalid_operation, HP_mail_invalid_operation) }, -/* malloc_interface */ - { HP_POP(iMalloc->init, HP_iMalloc_init) }, - { HP_POP(iMalloc->final, HP_iMalloc_final) }, - { HP_POP(iMalloc->malloc, HP_iMalloc_malloc) }, - { HP_POP(iMalloc->calloc, HP_iMalloc_calloc) }, - { HP_POP(iMalloc->realloc, HP_iMalloc_realloc) }, - { HP_POP(iMalloc->reallocz, HP_iMalloc_reallocz) }, - { HP_POP(iMalloc->astrdup, HP_iMalloc_astrdup) }, - { HP_POP(iMalloc->astrndup, HP_iMalloc_astrndup) }, - { HP_POP(iMalloc->free, HP_iMalloc_free) }, - { HP_POP(iMalloc->memory_check, HP_iMalloc_memory_check) }, - { HP_POP(iMalloc->verify_ptr, HP_iMalloc_verify_ptr) }, - { HP_POP(iMalloc->usage, HP_iMalloc_usage) }, - { HP_POP(iMalloc->post_shutdown, HP_iMalloc_post_shutdown) }, - { HP_POP(iMalloc->init_messages, HP_iMalloc_init_messages) }, /* map_interface */ { HP_POP(map->zone_init, HP_map_zone_init) }, { HP_POP(map->zone_remove, HP_map_zone_remove) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 0c81e557f..e5712b34d 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -39298,379 +39298,6 @@ bool HP_mail_invalid_operation(struct map_session_data *sd) { } return retVal___; } -/* malloc_interface */ -void HP_iMalloc_init(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init(); - } - if( HPMHooks.count.HP_iMalloc_init_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_final(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_final_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_final_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.final(); - } - if( HPMHooks.count.HP_iMalloc_final_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_final_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_final_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void* HP_iMalloc_malloc(size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_malloc_pre ) { - void* (*preHookFunc) (size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_malloc_pre[hIndex].func; - retVal___ = preHookFunc(&size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.malloc(size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_malloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_malloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_malloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_calloc(size_t num, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_calloc_pre ) { - void* (*preHookFunc) (size_t *num, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_calloc_pre[hIndex].func; - retVal___ = preHookFunc(&num, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.calloc(num, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_calloc_post ) { - void* (*postHookFunc) (void* retVal___, size_t num, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_calloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_calloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, num, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_realloc(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_realloc_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_realloc_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.realloc(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_realloc_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_realloc_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_realloc_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void* HP_iMalloc_reallocz(void *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - void* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_reallocz_pre ) { - void* (*preHookFunc) (void **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_reallocz_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.reallocz(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_reallocz_post ) { - void* (*postHookFunc) (void* retVal___, void *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_reallocz_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_reallocz_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrdup(const char *p, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrdup_pre ) { - char* (*preHookFunc) (const char **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrdup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrdup(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrdup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrdup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrdup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, file, line, func); - } - } - return retVal___; -} -char* HP_iMalloc_astrndup(const char *p, size_t size, const char *file, int line, const char *func) { - int hIndex = 0; - char* retVal___ = NULL; - if( HPMHooks.count.HP_iMalloc_astrndup_pre ) { - char* (*preHookFunc) (const char **p, size_t *size, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_astrndup_pre[hIndex].func; - retVal___ = preHookFunc(&p, &size, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.astrndup(p, size, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_astrndup_post ) { - char* (*postHookFunc) (char* retVal___, const char *p, size_t size, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_astrndup_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_astrndup_post[hIndex].func; - retVal___ = postHookFunc(retVal___, p, size, file, line, func); - } - } - return retVal___; -} -void HP_iMalloc_free(void *p, const char *file, int line, const char *func) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_free_pre ) { - void (*preHookFunc) (void **p, const char **file, int *line, const char **func); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_free_pre[hIndex].func; - preHookFunc(&p, &file, &line, &func); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.free(p, file, line, func); - } - if( HPMHooks.count.HP_iMalloc_free_post ) { - void (*postHookFunc) (void *p, const char *file, int line, const char *func); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_free_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_free_post[hIndex].func; - postHookFunc(p, file, line, func); - } - } - return; -} -void HP_iMalloc_memory_check(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_memory_check_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_memory_check_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.memory_check(); - } - if( HPMHooks.count.HP_iMalloc_memory_check_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_memory_check_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_memory_check_post[hIndex].func; - postHookFunc(); - } - } - return; -} -bool HP_iMalloc_verify_ptr(void *ptr) { - int hIndex = 0; - bool retVal___ = false; - if( HPMHooks.count.HP_iMalloc_verify_ptr_pre ) { - bool (*preHookFunc) (void **ptr); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_pre[hIndex].func; - retVal___ = preHookFunc(&ptr); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.verify_ptr(ptr); - } - if( HPMHooks.count.HP_iMalloc_verify_ptr_post ) { - bool (*postHookFunc) (bool retVal___, void *ptr); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_verify_ptr_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_verify_ptr_post[hIndex].func; - retVal___ = postHookFunc(retVal___, ptr); - } - } - return retVal___; -} -size_t HP_iMalloc_usage(void) { - int hIndex = 0; - size_t retVal___ = 0; - if( HPMHooks.count.HP_iMalloc_usage_pre ) { - size_t (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_usage_pre[hIndex].func; - retVal___ = preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.iMalloc.usage(); - } - if( HPMHooks.count.HP_iMalloc_usage_post ) { - size_t (*postHookFunc) (size_t retVal___); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_usage_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_usage_post[hIndex].func; - retVal___ = postHookFunc(retVal___); - } - } - return retVal___; -} -void HP_iMalloc_post_shutdown(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_post_shutdown_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.post_shutdown(); - } - if( HPMHooks.count.HP_iMalloc_post_shutdown_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_post_shutdown_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_post_shutdown_post[hIndex].func; - postHookFunc(); - } - } - return; -} -void HP_iMalloc_init_messages(void) { - int hIndex = 0; - if( HPMHooks.count.HP_iMalloc_init_messages_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_iMalloc_init_messages_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.iMalloc.init_messages(); - } - if( HPMHooks.count.HP_iMalloc_init_messages_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_iMalloc_init_messages_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_iMalloc_init_messages_post[hIndex].func; - postHookFunc(); - } - } - return; -} /* map_interface */ void HP_map_zone_init(void) { int hIndex = 0; diff --git a/src/plugins/HPMHooking/HPMHooking_map.sources.inc b/src/plugins/HPMHooking/HPMHooking_map.sources.inc index 54861ed6f..0cc52b595 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.sources.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.sources.inc @@ -52,7 +52,6 @@ memcpy(&HPMHooks.source.itemdb, itemdb, sizeof(struct itemdb_interface)); memcpy(&HPMHooks.source.libconfig, libconfig, sizeof(struct libconfig_interface)); memcpy(&HPMHooks.source.logs, logs, sizeof(struct log_interface)); memcpy(&HPMHooks.source.mail, mail, sizeof(struct mail_interface)); -memcpy(&HPMHooks.source.iMalloc, iMalloc, sizeof(struct malloc_interface)); memcpy(&HPMHooks.source.map, map, sizeof(struct map_interface)); memcpy(&HPMHooks.source.mapindex, mapindex, sizeof(struct mapindex_interface)); memcpy(&HPMHooks.source.mapit, mapit, sizeof(struct mapit_interface)); diff --git a/tools/HPMHookGen/HPMHookGen.pl b/tools/HPMHookGen/HPMHookGen.pl index 3203e0b70..b8835b376 100755 --- a/tools/HPMHookGen/HPMHookGen.pl +++ b/tools/HPMHookGen/HPMHookGen.pl @@ -295,6 +295,7 @@ foreach my $file (@files) { # Loop through the xml files my $loc = $data->{compounddef}->{$filekey}->{location}->[0]; next unless $loc->{file} =~ /src\/(map|char|login|common)\//; next if $loc->{file} =~ /\/HPM.*\.h/; # Don't allow hooking into the HPM itself + next if $loc->{file} =~ /\/memmgr\.h/; # Don't allow hooking into the memory manager my $servertype = $1; my $key = $data->{compounddef}->{$filekey}->{compoundname}->[0]; my $original = $key; @@ -338,8 +339,6 @@ foreach my $file (@files) { # Loop through the xml files $key = "chr"; } elsif ($key eq "db_interface") { $key = "DB"; - } elsif ($key eq "malloc_interface") { - $key = "iMalloc"; } elsif ($key eq "socket_interface") { $key = "sockt"; } elsif ($key eq "sql_interface") { |