Created
July 18, 2013 00:43
-
-
Save attilaolah/6025843 to your computer and use it in GitHub Desktop.
LD_PRELOAD example for the closed-source fglrx driver.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE 1 | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <dlfcn.h> | |
long PP_Initialize(void) { | |
fp = fopen("/dev/stderr", "a"); | |
fprintf(fp, "DEBUG: entering PP_Initialize.\n"); | |
close(fp); | |
// Call the original function but return a different value: | |
long (*orig)(void) = dlsym(RTLD_NEXT, "PP_Initialize"); | |
orig(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment