Cleaned up vtable_scanner code a bit to diagnose l4d crashes

This commit is contained in:
Matt Woodrow 2008-12-15 18:45:33 +13:00
parent 321443450a
commit b7477fc321

View File

@ -18,7 +18,6 @@ int main(int argc, char **argv)
{
void *handle;
void **pVtable;
handle = dlopen(argv[1], RTLD_NOW);
VOffset offsets;
char *params = NULL;
@ -30,6 +29,8 @@ int main(int argc, char **argv)
return -1;
}
handle = dlopen(argv[1], RTLD_NOW);
if (handle == NULL)
{
fprintf(stderr, "Failed to open server image, error [%s]\n", dlerror());
@ -41,6 +42,7 @@ int main(int argc, char **argv)
if (pVtable == NULL)
{
fprintf(stderr, "Invalid vtable symbol \"%s\"\n", argv[2]);
dlclose(handle);
return -1;
}
@ -86,10 +88,12 @@ int main(int argc, char **argv)
printf("%s - Win: %i Linux : %i\n", argv[3], offsets.windows_offset, offsets.linux_offset);
}
dlclose(handle);
return 0;
}
fprintf(stderr, "Failed to find function!");
dlclose(handle);
return -1;
}
@ -175,8 +179,6 @@ static bool FindVFunc(void *handle, void **vtable, const char* vtable_end, const
windows_offset = (overloads-location) + start_offset;
dlclose(handle);
offsets->linux_offset = linux_offset - 2;
offsets->windows_offset = windows_offset - 2;