Skip to content

Instantly share code, notes, and snippets.

@PinkPandaKatie
Created April 28, 2016 05:16
Show Gist options
  • Save PinkPandaKatie/68d48fc4f2cd9fa5265eca94d06f9d09 to your computer and use it in GitHub Desktop.
Save PinkPandaKatie/68d48fc4f2cd9fa5265eca94d06f9d09 to your computer and use it in GitHub Desktop.
/*
* Simple LD_PRELOAD library to dummy out getifaddrs() and return 0 results when it is called
*
* Compiling:
* gcc -m32 -fPIC -shared dummy_getifaddrs.c -o dummy_getifaddrs.so -Wall
*
* Copy dummy_getifaddrs.so to Tomb Raider dir (.../SteamApps/common/Tomb Raider/bin) then
* change steam launch options for Tomb Raider to:
*
* env LD_PRELOAD=./dummy_getifaddrs.so %command%
*
*/
#include <stdio.h>
#define __USE_GNU
#include <errno.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <ifaddrs.h>
int getifaddrs(struct ifaddrs **ifap) {
fprintf(stderr, "\n\n\n---------------- dummied out getifaddrs()!\n\n\n");
*ifap = NULL;
return 0;
}
void freeifaddrs(struct ifaddrs *ifap) {
/* do nothing */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment