From 3ba9b1013c494f5c0a8b490336d60f0f4dabbd4a Mon Sep 17 00:00:00 2001 From: shennetsind Date: Wed, 16 Oct 2013 20:04:40 -0300 Subject: Modified HPM Hook Caching Dropped hard-coded indexes, will make updates of the file in the future be smaller and much more clear in content. Made Possible Thanks to Haruna <3 Signed-off-by: shennetsind --- src/plugins/HPMHooking.c | 8 +++++--- tools/HPMHookGen/HPMHookGen.pl | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c index 8b4f06ae0..1ca5b5f3c 100644 --- a/src/plugins/HPMHooking.c +++ b/src/plugins/HPMHooking.c @@ -53,8 +53,7 @@ HPExport struct hplugin_info pinfo = { HPM_VERSION, // HPM Version (don't change, macro is automatically updated) }; -#define HP_POP(x) #x , (void**)(&x) -#define HP_POP2(x) (void*)x +#define HP_POP(x,y) #x , (void**)(&x) , (void*)y , 0 DBMap *hp_db;/* hooking points db -- for quick lookup */ struct HookingPointData { @@ -150,7 +149,7 @@ void HPM_HP_final(void) { void HPM_HP_load(void) { #include "../plugins/HPMHooking/HPMHooking.HookingPoints.inc" - int i, len = ARRAYLENGTH(HookingPoints); + int i, len = ARRAYLENGTH(HookingPoints), idx = 0; memset(&HPMHooks,0,sizeof(struct HPMHooksCore)); @@ -163,6 +162,9 @@ void HPM_HP_load(void) { memcpy(hpd, &HookingPoints[i], sizeof(struct HookingPointData)); + hpd->idx = idx; + idx += 2; + strdb_put(hp_db, HookingPoints[i].name, hpd); HPMHooks.data.total++; diff --git a/tools/HPMHookGen/HPMHookGen.pl b/tools/HPMHookGen/HPMHookGen.pl index 5333f3f03..cf50a9e77 100755 --- a/tools/HPMHookGen/HPMHookGen.pl +++ b/tools/HPMHookGen/HPMHookGen.pl @@ -392,7 +392,7 @@ foreach my $key (@keys) { foreach my $if (@{ $ifs{$key} }) { print FH <<"EOF"; - { HP_POP($key\->$if->{name}), HP_POP2($if->{hname}), $idx }, + { HP_POP($key\->$if->{name}, $if->{hname}) }, EOF $idx += 2; -- cgit v1.2.3-60-g2f50