diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-11-06 22:45:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-11-14 06:00:50 +0300 |
commit | 77b72c7b82a1af205a58225b09e917b4593d770a (patch) | |
tree | 17b5877cb02ce6fff42b3e39f2586f5335b1f41f /src | |
parent | 25abd43600a693a47acd755b5713b342de86a7ca (diff) | |
download | hercules-77b72c7b82a1af205a58225b09e917b4593d770a.tar.gz hercules-77b72c7b82a1af205a58225b09e917b4593d770a.tar.bz2 hercules-77b72c7b82a1af205a58225b09e917b4593d770a.tar.xz hercules-77b72c7b82a1af205a58225b09e917b4593d770a.zip |
Update HPM hooks.
Diffstat (limited to 'src')
11 files changed, 115 insertions, 21 deletions
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; |