mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Added dlsym handler
This commit is contained in:
parent
3c037270a6
commit
6b9c8ac1ea
BIN
plugins/dlsym
Executable file
BIN
plugins/dlsym
Executable file
Binary file not shown.
40
plugins/dlsym.c
Executable file
40
plugins/dlsym.c
Executable file
@ -0,0 +1,40 @@
|
||||
/* by David "BAILOPAN" Anderson
|
||||
* No warranties of any kind
|
||||
* License: I hereby grant this work to the public domain and make no copyright claims.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *file=NULL;
|
||||
void *dl= NULL;
|
||||
FILE *fp = NULL;
|
||||
if (argc != 2)
|
||||
{
|
||||
printf("Usage: dlsym <file>\n");
|
||||
exit(0);
|
||||
}
|
||||
file = argv[1];
|
||||
fp = fopen(file, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
printf("File not found.");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
dl = dlopen(file, RTLD_NOW);
|
||||
|
||||
if (dl)
|
||||
{
|
||||
printf("Shared module loaded. Handle: %p\n", dl);
|
||||
dlclose(dl);
|
||||
dl = NULL;
|
||||
} else {
|
||||
printf("Shared module failed to load: %s\n", dlerror());
|
||||
}
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user