From a9caa4ea37115869eb3926ca6e4c53709e7d9337 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 5 Nov 2018 23:53:43 +0300 Subject: Update HPM hooks. --- src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc') diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 508465411..7d20a88e2 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2177,6 +2177,11 @@ struct HookingPointData HookingPoints[] = { { HP_POP(npc->secure_timeout_timer, HP_npc_secure_timeout_timer) }, /* nullpo_interface */ { HP_POP(nullpo->assert_report, HP_nullpo_assert_report) }, +/* packets_interface */ + { HP_POP(packets->init, HP_packets_init) }, + { HP_POP(packets->final, HP_packets_final) }, + { HP_POP(packets->addLens, HP_packets_addLens) }, + { HP_POP(packets->addLen, HP_packets_addLen) }, /* party_interface */ { HP_POP(party->init, HP_party_init) }, { HP_POP(party->final, HP_party_final) }, -- cgit v1.2.3-60-g2f50 From 77b72c7b82a1af205a58225b09e917b4593d770a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 6 Nov 2018 22:45:34 +0300 Subject: Update HPM hooks. --- src/common/HPMDataCheck.h | 1 - src/plugins/HPMHooking/HPMHooking.Defs.inc | 6 ++-- .../HPMHooking/HPMHooking_char.HPMHooksCore.inc | 4 +++ .../HPMHooking/HPMHooking_char.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 38 ++++++++++++++++++---- .../HPMHooking/HPMHooking_login.HPMHooksCore.inc | 4 +++ .../HPMHooking/HPMHooking_login.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking_login.Hooks.inc | 38 ++++++++++++++++++---- .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 4 +++ .../HPMHooking/HPMHooking_map.HookingPoints.inc | 1 + src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 38 ++++++++++++++++++---- 11 files changed, 115 insertions(+), 21 deletions(-) (limited to 'src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index 674e8ccc8..d92591501 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -684,7 +684,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_ZC_INVENTORY_MOVE_FAILED", sizeof(struct PACKET_ZC_INVENTORY_MOVE_FAILED), SERVER_TYPE_MAP }, { "PACKET_ZC_ITEM_ENTRY", sizeof(struct PACKET_ZC_ITEM_ENTRY), SERVER_TYPE_MAP }, { "PACKET_ZC_ITEM_PICKUP_PARTY", sizeof(struct PACKET_ZC_ITEM_PICKUP_PARTY), SERVER_TYPE_MAP }, - { "PACKET_ZC_ITEM_PREVIEW", sizeof(struct PACKET_ZC_ITEM_PREVIEW), SERVER_TYPE_MAP }, { "PACKET_ZC_MAIL_LIST", sizeof(struct PACKET_ZC_MAIL_LIST), SERVER_TYPE_MAP }, { "PACKET_ZC_MAKABLEITEMLIST", sizeof(struct PACKET_ZC_MAKABLEITEMLIST), SERVER_TYPE_MAP }, { "PACKET_ZC_MAKABLEITEMLIST_sub", sizeof(struct PACKET_ZC_MAKABLEITEMLIST_sub), SERVER_TYPE_MAP }, diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index d366c1e08..f231180d0 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -7462,12 +7462,14 @@ typedef int (*HPMHOOK_pre_sockt_realloc_fifo) (int *fd, unsigned int *rfifo_size typedef int (*HPMHOOK_post_sockt_realloc_fifo) (int retVal___, int fd, unsigned int rfifo_size, unsigned int wfifo_size); typedef int (*HPMHOOK_pre_sockt_realloc_writefifo) (int *fd, size_t *addition); typedef int (*HPMHOOK_post_sockt_realloc_writefifo) (int retVal___, int fd, size_t addition); -typedef int (*HPMHOOK_pre_sockt_wfifoset) (int *fd, size_t *len); -typedef int (*HPMHOOK_post_sockt_wfifoset) (int retVal___, int fd, size_t len); +typedef int (*HPMHOOK_pre_sockt_wfifoset) (int *fd, size_t *len, bool *validate); +typedef int (*HPMHOOK_post_sockt_wfifoset) (int retVal___, int fd, size_t len, bool validate); typedef int (*HPMHOOK_pre_sockt_rfifoskip) (int *fd, size_t *len); typedef int (*HPMHOOK_post_sockt_rfifoskip) (int retVal___, int fd, size_t len); typedef void (*HPMHOOK_pre_sockt_close) (int *fd); typedef void (*HPMHOOK_post_sockt_close) (int fd); +typedef void (*HPMHOOK_pre_sockt_validateWfifo) (int *fd, size_t *len); +typedef void (*HPMHOOK_post_sockt_validateWfifo) (int fd, size_t len); typedef bool (*HPMHOOK_pre_sockt_session_is_valid) (int *fd); typedef bool (*HPMHOOK_post_sockt_session_is_valid) (bool retVal___, int fd); typedef bool (*HPMHOOK_pre_sockt_session_is_active) (int *fd); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index 81abf7d69..839be6ebc 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -1408,6 +1408,8 @@ struct { struct HPMHookPoint *HP_sockt_rfifoskip_post; struct HPMHookPoint *HP_sockt_close_pre; struct HPMHookPoint *HP_sockt_close_post; + struct HPMHookPoint *HP_sockt_validateWfifo_pre; + struct HPMHookPoint *HP_sockt_validateWfifo_post; struct HPMHookPoint *HP_sockt_session_is_valid_pre; struct HPMHookPoint *HP_sockt_session_is_valid_post; struct HPMHookPoint *HP_sockt_session_is_active_pre; @@ -3039,6 +3041,8 @@ struct { int HP_sockt_rfifoskip_post; int HP_sockt_close_pre; int HP_sockt_close_post; + int HP_sockt_validateWfifo_pre; + int HP_sockt_validateWfifo_post; int HP_sockt_session_is_valid_pre; int HP_sockt_session_is_valid_post; int HP_sockt_session_is_active_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index b61526562..101dddd53 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -751,6 +751,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->wfifoset, HP_sockt_wfifoset) }, { HP_POP(sockt->rfifoskip, HP_sockt_rfifoskip) }, { HP_POP(sockt->close, HP_sockt_close) }, + { HP_POP(sockt->validateWfifo, HP_sockt_validateWfifo) }, { HP_POP(sockt->session_is_valid, HP_sockt_session_is_valid) }, { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index e87f6fe9c..df39880b6 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -18422,15 +18422,15 @@ int HP_sockt_realloc_writefifo(int fd, size_t addition) { } return retVal___; } -int HP_sockt_wfifoset(int fd, size_t len) { +int HP_sockt_wfifoset(int fd, size_t len, bool validate) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_sockt_wfifoset_pre > 0) { - int (*preHookFunc) (int *fd, size_t *len); + int (*preHookFunc) (int *fd, size_t *len, bool *validate); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_sockt_wfifoset_pre[hIndex].func; - retVal___ = preHookFunc(&fd, &len); + retVal___ = preHookFunc(&fd, &len, &validate); } if (*HPMforce_return) { *HPMforce_return = false; @@ -18438,13 +18438,13 @@ int HP_sockt_wfifoset(int fd, size_t len) { } } { - retVal___ = HPMHooks.source.sockt.wfifoset(fd, len); + retVal___ = HPMHooks.source.sockt.wfifoset(fd, len, validate); } if (HPMHooks.count.HP_sockt_wfifoset_post > 0) { - int (*postHookFunc) (int retVal___, int fd, size_t len); + int (*postHookFunc) (int retVal___, int fd, size_t len, bool validate); for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_post; hIndex++) { postHookFunc = HPMHooks.list.HP_sockt_wfifoset_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fd, len); + retVal___ = postHookFunc(retVal___, fd, len, validate); } } return retVal___; @@ -18502,6 +18502,32 @@ void HP_sockt_close(int fd) { } return; } +void HP_sockt_validateWfifo(int fd, size_t len) { + int hIndex = 0; + if (HPMHooks.count.HP_sockt_validateWfifo_pre > 0) { + void (*preHookFunc) (int *fd, size_t *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_validateWfifo_pre[hIndex].func; + preHookFunc(&fd, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.sockt.validateWfifo(fd, len); + } + if (HPMHooks.count.HP_sockt_validateWfifo_post > 0) { + void (*postHookFunc) (int fd, size_t len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_validateWfifo_post[hIndex].func; + postHookFunc(fd, len); + } + } + return; +} bool HP_sockt_session_is_valid(int fd) { int hIndex = 0; bool retVal___ = false; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc index f1450e2e1..89f201c09 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HPMHooksCore.inc @@ -566,6 +566,8 @@ struct { struct HPMHookPoint *HP_sockt_rfifoskip_post; struct HPMHookPoint *HP_sockt_close_pre; struct HPMHookPoint *HP_sockt_close_post; + struct HPMHookPoint *HP_sockt_validateWfifo_pre; + struct HPMHookPoint *HP_sockt_validateWfifo_post; struct HPMHookPoint *HP_sockt_session_is_valid_pre; struct HPMHookPoint *HP_sockt_session_is_valid_post; struct HPMHookPoint *HP_sockt_session_is_active_pre; @@ -1355,6 +1357,8 @@ struct { int HP_sockt_rfifoskip_post; int HP_sockt_close_pre; int HP_sockt_close_post; + int HP_sockt_validateWfifo_pre; + int HP_sockt_validateWfifo_post; int HP_sockt_session_is_valid_pre; int HP_sockt_session_is_valid_post; int HP_sockt_session_is_active_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc index a566659ff..f50b7666d 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.HookingPoints.inc @@ -317,6 +317,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->wfifoset, HP_sockt_wfifoset) }, { HP_POP(sockt->rfifoskip, HP_sockt_rfifoskip) }, { HP_POP(sockt->close, HP_sockt_close) }, + { HP_POP(sockt->validateWfifo, HP_sockt_validateWfifo) }, { HP_POP(sockt->session_is_valid, HP_sockt_session_is_valid) }, { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, diff --git a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc index 5e3d7b28d..4cf0e85ce 100644 --- a/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_login.Hooks.inc @@ -7177,15 +7177,15 @@ int HP_sockt_realloc_writefifo(int fd, size_t addition) { } return retVal___; } -int HP_sockt_wfifoset(int fd, size_t len) { +int HP_sockt_wfifoset(int fd, size_t len, bool validate) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_sockt_wfifoset_pre > 0) { - int (*preHookFunc) (int *fd, size_t *len); + int (*preHookFunc) (int *fd, size_t *len, bool *validate); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_sockt_wfifoset_pre[hIndex].func; - retVal___ = preHookFunc(&fd, &len); + retVal___ = preHookFunc(&fd, &len, &validate); } if (*HPMforce_return) { *HPMforce_return = false; @@ -7193,13 +7193,13 @@ int HP_sockt_wfifoset(int fd, size_t len) { } } { - retVal___ = HPMHooks.source.sockt.wfifoset(fd, len); + retVal___ = HPMHooks.source.sockt.wfifoset(fd, len, validate); } if (HPMHooks.count.HP_sockt_wfifoset_post > 0) { - int (*postHookFunc) (int retVal___, int fd, size_t len); + int (*postHookFunc) (int retVal___, int fd, size_t len, bool validate); for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_post; hIndex++) { postHookFunc = HPMHooks.list.HP_sockt_wfifoset_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fd, len); + retVal___ = postHookFunc(retVal___, fd, len, validate); } } return retVal___; @@ -7257,6 +7257,32 @@ void HP_sockt_close(int fd) { } return; } +void HP_sockt_validateWfifo(int fd, size_t len) { + int hIndex = 0; + if (HPMHooks.count.HP_sockt_validateWfifo_pre > 0) { + void (*preHookFunc) (int *fd, size_t *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_validateWfifo_pre[hIndex].func; + preHookFunc(&fd, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.sockt.validateWfifo(fd, len); + } + if (HPMHooks.count.HP_sockt_validateWfifo_post > 0) { + void (*postHookFunc) (int fd, size_t len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_validateWfifo_post[hIndex].func; + postHookFunc(fd, len); + } + } + return; +} bool HP_sockt_session_is_valid(int fd) { int hIndex = 0; bool retVal___ = false; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index dcbf800fe..42c2dc3a1 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -5980,6 +5980,8 @@ struct { struct HPMHookPoint *HP_sockt_rfifoskip_post; struct HPMHookPoint *HP_sockt_close_pre; struct HPMHookPoint *HP_sockt_close_post; + struct HPMHookPoint *HP_sockt_validateWfifo_pre; + struct HPMHookPoint *HP_sockt_validateWfifo_post; struct HPMHookPoint *HP_sockt_session_is_valid_pre; struct HPMHookPoint *HP_sockt_session_is_valid_post; struct HPMHookPoint *HP_sockt_session_is_active_pre; @@ -12591,6 +12593,8 @@ struct { int HP_sockt_rfifoskip_post; int HP_sockt_close_pre; int HP_sockt_close_post; + int HP_sockt_validateWfifo_pre; + int HP_sockt_validateWfifo_post; int HP_sockt_session_is_valid_pre; int HP_sockt_session_is_valid_post; int HP_sockt_session_is_active_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 7d20a88e2..092a9831b 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -3058,6 +3058,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(sockt->wfifoset, HP_sockt_wfifoset) }, { HP_POP(sockt->rfifoskip, HP_sockt_rfifoskip) }, { HP_POP(sockt->close, HP_sockt_close) }, + { HP_POP(sockt->validateWfifo, HP_sockt_validateWfifo) }, { HP_POP(sockt->session_is_valid, HP_sockt_session_is_valid) }, { HP_POP(sockt->session_is_active, HP_sockt_session_is_active) }, { HP_POP(sockt->flush, HP_sockt_flush) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 791acde83..ea53227bf 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -79918,15 +79918,15 @@ int HP_sockt_realloc_writefifo(int fd, size_t addition) { } return retVal___; } -int HP_sockt_wfifoset(int fd, size_t len) { +int HP_sockt_wfifoset(int fd, size_t len, bool validate) { int hIndex = 0; int retVal___ = 0; if (HPMHooks.count.HP_sockt_wfifoset_pre > 0) { - int (*preHookFunc) (int *fd, size_t *len); + int (*preHookFunc) (int *fd, size_t *len, bool *validate); *HPMforce_return = false; for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_pre; hIndex++) { preHookFunc = HPMHooks.list.HP_sockt_wfifoset_pre[hIndex].func; - retVal___ = preHookFunc(&fd, &len); + retVal___ = preHookFunc(&fd, &len, &validate); } if (*HPMforce_return) { *HPMforce_return = false; @@ -79934,13 +79934,13 @@ int HP_sockt_wfifoset(int fd, size_t len) { } } { - retVal___ = HPMHooks.source.sockt.wfifoset(fd, len); + retVal___ = HPMHooks.source.sockt.wfifoset(fd, len, validate); } if (HPMHooks.count.HP_sockt_wfifoset_post > 0) { - int (*postHookFunc) (int retVal___, int fd, size_t len); + int (*postHookFunc) (int retVal___, int fd, size_t len, bool validate); for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_wfifoset_post; hIndex++) { postHookFunc = HPMHooks.list.HP_sockt_wfifoset_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fd, len); + retVal___ = postHookFunc(retVal___, fd, len, validate); } } return retVal___; @@ -79998,6 +79998,32 @@ void HP_sockt_close(int fd) { } return; } +void HP_sockt_validateWfifo(int fd, size_t len) { + int hIndex = 0; + if (HPMHooks.count.HP_sockt_validateWfifo_pre > 0) { + void (*preHookFunc) (int *fd, size_t *len); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_sockt_validateWfifo_pre[hIndex].func; + preHookFunc(&fd, &len); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.sockt.validateWfifo(fd, len); + } + if (HPMHooks.count.HP_sockt_validateWfifo_post > 0) { + void (*postHookFunc) (int fd, size_t len); + for (hIndex = 0; hIndex < HPMHooks.count.HP_sockt_validateWfifo_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_sockt_validateWfifo_post[hIndex].func; + postHookFunc(fd, len); + } + } + return; +} bool HP_sockt_session_is_valid(int fd) { int hIndex = 0; bool retVal___ = false; -- cgit v1.2.3-60-g2f50