diff options
author | Jedzkie <jedzkie13@rocketmail.com> | 2018-04-02 01:42:56 +0800 |
---|---|---|
committer | Jedzkie <jedzkie13@rocketmail.com> | 2018-04-02 12:58:04 +0800 |
commit | 940fce6309d2b99f27b00aa6738d40fe2219d12f (patch) | |
tree | 2ecc43cf1fe1ae2465434df80e678872644c99c0 /src/plugins/HPMHooking | |
parent | d537339c5cd1aa89e512b6ccac225bdf0235ec88 (diff) | |
download | hercules-940fce6309d2b99f27b00aa6738d40fe2219d12f.tar.gz hercules-940fce6309d2b99f27b00aa6738d40fe2219d12f.tar.bz2 hercules-940fce6309d2b99f27b00aa6738d40fe2219d12f.tar.xz hercules-940fce6309d2b99f27b00aa6738d40fe2219d12f.zip |
HPMHooks Update
Diffstat (limited to 'src/plugins/HPMHooking')
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 14 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc | 28 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc | 7 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_char.Hooks.inc | 151 |
4 files changed, 183 insertions, 17 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index bd17dc7fe..b8d504e1e 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -6030,18 +6030,28 @@ typedef void (*HPMHOOK_pre_pincode_error) (int *account_id); typedef void (*HPMHOOK_post_pincode_error) (int account_id); typedef void (*HPMHOOK_pre_pincode_update) (int *account_id, char **pin); typedef void (*HPMHOOK_post_pincode_update) (int account_id, char *pin); -typedef void (*HPMHOOK_pre_pincode_sendstate) (int *fd, struct char_session_data **sd, uint16 *state); -typedef void (*HPMHOOK_post_pincode_sendstate) (int fd, struct char_session_data *sd, uint16 state); +typedef void (*HPMHOOK_pre_pincode_makestate) (int *fd, struct char_session_data **sd, enum pincode_make_response *state); +typedef void (*HPMHOOK_post_pincode_makestate) (int fd, struct char_session_data *sd, enum pincode_make_response state); +typedef void (*HPMHOOK_pre_pincode_editstate) (int *fd, struct char_session_data **sd, enum pincode_edit_response *state); +typedef void (*HPMHOOK_post_pincode_editstate) (int fd, struct char_session_data *sd, enum pincode_edit_response state); +typedef void (*HPMHOOK_pre_pincode_loginstate) (int *fd, struct char_session_data **sd, enum pincode_login_response *state); +typedef void (*HPMHOOK_post_pincode_loginstate) (int fd, struct char_session_data *sd, enum pincode_login_response state); typedef void (*HPMHOOK_pre_pincode_setnew) (int *fd, struct char_session_data **sd); typedef void (*HPMHOOK_post_pincode_setnew) (int fd, struct char_session_data *sd); typedef void (*HPMHOOK_pre_pincode_change) (int *fd, struct char_session_data **sd); typedef void (*HPMHOOK_post_pincode_change) (int fd, struct char_session_data *sd); +typedef bool (*HPMHOOK_pre_pincode_isBlacklisted) (const char **pin); +typedef bool (*HPMHOOK_post_pincode_isBlacklisted) (bool retVal___, const char *pin); typedef int (*HPMHOOK_pre_pincode_compare) (int *fd, struct char_session_data **sd, char **pin); typedef int (*HPMHOOK_post_pincode_compare) (int retVal___, int fd, struct char_session_data *sd, char *pin); typedef void (*HPMHOOK_pre_pincode_check) (int *fd, struct char_session_data **sd); typedef void (*HPMHOOK_post_pincode_check) (int fd, struct char_session_data *sd); typedef bool (*HPMHOOK_pre_pincode_config_read) (const char **filename, const struct config_t **config, bool *imported); typedef bool (*HPMHOOK_post_pincode_config_read) (bool retVal___, const char *filename, const struct config_t *config, bool imported); +typedef void (*HPMHOOK_pre_pincode_init) (void); +typedef void (*HPMHOOK_post_pincode_init) (void); +typedef void (*HPMHOOK_pre_pincode_final) (void); +typedef void (*HPMHOOK_post_pincode_final) (void); #endif // CHAR_PINCODE_H #ifdef MAP_QUEST_H /* quest */ typedef void (*HPMHOOK_pre_quest_init) (bool *minimal); diff --git a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc index d0b4ac5ce..d81709ff3 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HPMHooksCore.inc @@ -1248,18 +1248,28 @@ struct { struct HPMHookPoint *HP_pincode_error_post; struct HPMHookPoint *HP_pincode_update_pre; struct HPMHookPoint *HP_pincode_update_post; - struct HPMHookPoint *HP_pincode_sendstate_pre; - struct HPMHookPoint *HP_pincode_sendstate_post; + struct HPMHookPoint *HP_pincode_makestate_pre; + struct HPMHookPoint *HP_pincode_makestate_post; + struct HPMHookPoint *HP_pincode_editstate_pre; + struct HPMHookPoint *HP_pincode_editstate_post; + struct HPMHookPoint *HP_pincode_loginstate_pre; + struct HPMHookPoint *HP_pincode_loginstate_post; struct HPMHookPoint *HP_pincode_setnew_pre; struct HPMHookPoint *HP_pincode_setnew_post; struct HPMHookPoint *HP_pincode_change_pre; struct HPMHookPoint *HP_pincode_change_post; + struct HPMHookPoint *HP_pincode_isBlacklisted_pre; + struct HPMHookPoint *HP_pincode_isBlacklisted_post; struct HPMHookPoint *HP_pincode_compare_pre; struct HPMHookPoint *HP_pincode_compare_post; struct HPMHookPoint *HP_pincode_check_pre; struct HPMHookPoint *HP_pincode_check_post; struct HPMHookPoint *HP_pincode_config_read_pre; struct HPMHookPoint *HP_pincode_config_read_post; + struct HPMHookPoint *HP_pincode_init_pre; + struct HPMHookPoint *HP_pincode_init_post; + struct HPMHookPoint *HP_pincode_final_pre; + struct HPMHookPoint *HP_pincode_final_post; struct HPMHookPoint *HP_rnd_init_pre; struct HPMHookPoint *HP_rnd_init_post; struct HPMHookPoint *HP_rnd_final_pre; @@ -2777,18 +2787,28 @@ struct { int HP_pincode_error_post; int HP_pincode_update_pre; int HP_pincode_update_post; - int HP_pincode_sendstate_pre; - int HP_pincode_sendstate_post; + int HP_pincode_makestate_pre; + int HP_pincode_makestate_post; + int HP_pincode_editstate_pre; + int HP_pincode_editstate_post; + int HP_pincode_loginstate_pre; + int HP_pincode_loginstate_post; int HP_pincode_setnew_pre; int HP_pincode_setnew_post; int HP_pincode_change_pre; int HP_pincode_change_post; + int HP_pincode_isBlacklisted_pre; + int HP_pincode_isBlacklisted_post; int HP_pincode_compare_pre; int HP_pincode_compare_post; int HP_pincode_check_pre; int HP_pincode_check_post; int HP_pincode_config_read_pre; int HP_pincode_config_read_post; + int HP_pincode_init_pre; + int HP_pincode_init_post; + int HP_pincode_final_pre; + int HP_pincode_final_post; int HP_rnd_init_pre; int HP_rnd_init_post; int HP_rnd_final_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc index 36a115e1b..26ee54453 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.HookingPoints.inc @@ -666,12 +666,17 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pincode->decrypt, HP_pincode_decrypt) }, { HP_POP(pincode->error, HP_pincode_error) }, { HP_POP(pincode->update, HP_pincode_update) }, - { HP_POP(pincode->sendstate, HP_pincode_sendstate) }, + { HP_POP(pincode->makestate, HP_pincode_makestate) }, + { HP_POP(pincode->editstate, HP_pincode_editstate) }, + { HP_POP(pincode->loginstate, HP_pincode_loginstate) }, { HP_POP(pincode->setnew, HP_pincode_setnew) }, { HP_POP(pincode->change, HP_pincode_change) }, + { HP_POP(pincode->isBlacklisted, HP_pincode_isBlacklisted) }, { HP_POP(pincode->compare, HP_pincode_compare) }, { HP_POP(pincode->check, HP_pincode_check) }, { HP_POP(pincode->config_read, HP_pincode_config_read) }, + { HP_POP(pincode->init, HP_pincode_init) }, + { HP_POP(pincode->final, HP_pincode_final) }, /* rnd_interface */ { HP_POP(rnd->init, HP_rnd_init) }, { HP_POP(rnd->final, HP_rnd_final) }, diff --git a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc index 6ea10f78f..fdec7feea 100644 --- a/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_char.Hooks.inc @@ -16353,13 +16353,13 @@ void HP_pincode_update(int account_id, char *pin) { } return; } -void HP_pincode_sendstate(int fd, struct char_session_data *sd, uint16 state) { +void HP_pincode_makestate(int fd, struct char_session_data *sd, enum pincode_make_response state) { int hIndex = 0; - if (HPMHooks.count.HP_pincode_sendstate_pre > 0) { - void (*preHookFunc) (int *fd, struct char_session_data **sd, uint16 *state); + if (HPMHooks.count.HP_pincode_makestate_pre > 0) { + void (*preHookFunc) (int *fd, struct char_session_data **sd, enum pincode_make_response *state); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_sendstate_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_pincode_sendstate_pre[hIndex].func; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_makestate_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_makestate_pre[hIndex].func; preHookFunc(&fd, &sd, &state); } if (*HPMforce_return) { @@ -16368,12 +16368,64 @@ void HP_pincode_sendstate(int fd, struct char_session_data *sd, uint16 state) { } } { - HPMHooks.source.pincode.sendstate(fd, sd, state); + HPMHooks.source.pincode.makestate(fd, sd, state); } - if (HPMHooks.count.HP_pincode_sendstate_post > 0) { - void (*postHookFunc) (int fd, struct char_session_data *sd, uint16 state); - for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_sendstate_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_pincode_sendstate_post[hIndex].func; + if (HPMHooks.count.HP_pincode_makestate_post > 0) { + void (*postHookFunc) (int fd, struct char_session_data *sd, enum pincode_make_response state); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_makestate_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_makestate_post[hIndex].func; + postHookFunc(fd, sd, state); + } + } + return; +} +void HP_pincode_editstate(int fd, struct char_session_data *sd, enum pincode_edit_response state) { + int hIndex = 0; + if (HPMHooks.count.HP_pincode_editstate_pre > 0) { + void (*preHookFunc) (int *fd, struct char_session_data **sd, enum pincode_edit_response *state); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_editstate_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_editstate_pre[hIndex].func; + preHookFunc(&fd, &sd, &state); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pincode.editstate(fd, sd, state); + } + if (HPMHooks.count.HP_pincode_editstate_post > 0) { + void (*postHookFunc) (int fd, struct char_session_data *sd, enum pincode_edit_response state); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_editstate_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_editstate_post[hIndex].func; + postHookFunc(fd, sd, state); + } + } + return; +} +void HP_pincode_loginstate(int fd, struct char_session_data *sd, enum pincode_login_response state) { + int hIndex = 0; + if (HPMHooks.count.HP_pincode_loginstate_pre > 0) { + void (*preHookFunc) (int *fd, struct char_session_data **sd, enum pincode_login_response *state); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_loginstate_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_loginstate_pre[hIndex].func; + preHookFunc(&fd, &sd, &state); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pincode.loginstate(fd, sd, state); + } + if (HPMHooks.count.HP_pincode_loginstate_post > 0) { + void (*postHookFunc) (int fd, struct char_session_data *sd, enum pincode_login_response state); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_loginstate_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_loginstate_post[hIndex].func; postHookFunc(fd, sd, state); } } @@ -16431,6 +16483,33 @@ void HP_pincode_change(int fd, struct char_session_data *sd) { } return; } +bool HP_pincode_isBlacklisted(const char *pin) { + int hIndex = 0; + bool retVal___ = false; + if (HPMHooks.count.HP_pincode_isBlacklisted_pre > 0) { + bool (*preHookFunc) (const char **pin); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_isBlacklisted_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_isBlacklisted_pre[hIndex].func; + retVal___ = preHookFunc(&pin); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pincode.isBlacklisted(pin); + } + if (HPMHooks.count.HP_pincode_isBlacklisted_post > 0) { + bool (*postHookFunc) (bool retVal___, const char *pin); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_isBlacklisted_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_isBlacklisted_post[hIndex].func; + retVal___ = postHookFunc(retVal___, pin); + } + } + return retVal___; +} int HP_pincode_compare(int fd, struct char_session_data *sd, char *pin) { int hIndex = 0; int retVal___ = 0; @@ -16511,6 +16590,58 @@ bool HP_pincode_config_read(const char *filename, const struct config_t *config, } return retVal___; } +void HP_pincode_init(void) { + int hIndex = 0; + if (HPMHooks.count.HP_pincode_init_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_init_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_init_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pincode.init(); + } + if (HPMHooks.count.HP_pincode_init_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_init_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_init_post[hIndex].func; + postHookFunc(); + } + } + return; +} +void HP_pincode_final(void) { + int hIndex = 0; + if (HPMHooks.count.HP_pincode_final_pre > 0) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_final_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_pincode_final_pre[hIndex].func; + preHookFunc(); + } + if (*HPMforce_return) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.pincode.final(); + } + if (HPMHooks.count.HP_pincode_final_post > 0) { + void (*postHookFunc) (void); + for (hIndex = 0; hIndex < HPMHooks.count.HP_pincode_final_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_pincode_final_post[hIndex].func; + postHookFunc(); + } + } + return; +} /* rnd_interface */ void HP_rnd_init(void) { int hIndex = 0; |