diff options
-rw-r--r-- | src/common/HPM.c | 11 | ||||
-rw-r--r-- | src/plugins/HPMHooking.c | 8 | ||||
-rwxr-xr-x | tools/HPMHookGen/HPMHookGen.pl | 4 |
3 files changed, 14 insertions, 9 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c index 5a0fe16dc..cdd9bb769 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -252,6 +252,8 @@ struct hplugin *hplugin_load(const char* filename) { if( HPM->load_sub ) HPM->load_sub(plugin); + ShowStatus("HPM: Loaded plugin '"CL_WHITE"%s"CL_RESET"' (%s).\n", plugin->info->name, plugin->info->version); + return plugin; } @@ -339,11 +341,14 @@ void hplugins_config_read(void) { struct hplugin *plugin; snprintf(filename, 60, "plugins/%s%s", hooking_plugin_name, DLL_EXT); if ((plugin = HPM->load(filename))) { - bool (*func)(bool *fr); + const char * (*func)(bool *fr); bool (*addhook_sub) (enum HPluginHookType type, const char *target, void *hook, unsigned int pID); - if ((func = plugin_import(plugin->dll, "Hooked",bool (*)(bool *))) + if ((func = plugin_import(plugin->dll, "Hooked",const char * (*)(bool *))) && (addhook_sub = plugin_import(plugin->dll, "HPM_Plugin_AddHook",bool (*)(enum HPluginHookType, const char *, void *, unsigned int)))) { - if (func(&HPM->force_return)) { + const char *failed = func(&HPM->force_return); + if (failed) { + ShowError("HPM: failed to retrieve '%s' for '"CL_WHITE"%s"CL_RESET"'!\n", failed, plugin_name); + } else { HPM->hooking = true; HPM->addhook_sub = addhook_sub; } diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c index 4c15b06af..e15cc363d 100644 --- a/src/plugins/HPMHooking.c +++ b/src/plugins/HPMHooking.c @@ -134,13 +134,13 @@ HPExport void server_post_final (void) { HPM_HP_final(); } -HPExport bool Hooked (bool *fr) { +HPExport const char *Hooked (bool *fr) { HPMforce_return = fr; - DB = GET_SYMBOL("DB"); - iMalloc = GET_SYMBOL("iMalloc"); + if (!(DB = GET_SYMBOL("DB"))) return "DB"; + if (!(iMalloc = GET_SYMBOL("iMalloc"))) return "iMalloc"; #include HPM_SYMBOL_INCLUDE HPM_HP_load(); - return true; + return NULL; } diff --git a/tools/HPMHookGen/HPMHookGen.pl b/tools/HPMHookGen/HPMHookGen.pl index f97eefb84..9c0660300 100755 --- a/tools/HPMHookGen/HPMHookGen.pl +++ b/tools/HPMHookGen/HPMHookGen.pl @@ -424,7 +424,7 @@ EOF EOF $idx += 2; - $maxlen = length($key."->".$if->{name}) if( length($key."->".$if->{name}) > $maxlen ) + $maxlen = length($key."->".$if->{name}) if( length($key."->".$if->{name}) > $maxlen ); } } print FH <<"EOF"; @@ -469,7 +469,7 @@ EOF foreach my $key (@$keysref) { print FH <<"EOF"; -if( !($key = GET_SYMBOL("$exportsymbols{$key}") ) ) return false; +if( !($key = GET_SYMBOL("$exportsymbols{$key}") ) ) return "$exportsymbols{$key}"; EOF } close FH; |