Last active
August 26, 2018 03:24
-
-
Save Adikso/51ae113b0e84e1fdbfe40e097b70b33b to your computer and use it in GitHub Desktop.
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
#include <iostream> | |
/* | |
* Running on Linux: | |
* LD_PRELOAD="libinjectcrypt.so" NecroDancer | |
* | |
* Running on OSX: | |
* DYLD_INSERT_LIBRARIES=libinjectcrypt.dylib NecroDancer | |
* | |
* Running on Windows: | |
* You need an external application to inject dll library | |
* e.g https://github.com/Arvanaghi/Windows-DLL-Injector or CheatEngine | |
*/ | |
void setup() { | |
printf("HOOKED INTO GAME\n"); | |
} | |
#ifdef _WIN32 // M$ Window$ | |
#include <windows.h> | |
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { | |
if (ul_reason_for_call == DLL_PROCESS_ATTACH) { | |
setup(); | |
} | |
return TRUE; | |
} | |
#else // Linux and OSX | |
#include <dlfcn.h> | |
#include <unistd.h> | |
long int strtol(const char* str, char** endptr, int base) { | |
static int (*original_strtol)(const char* str, char** endptr, int base) = nullptr; | |
if (original_strtol == nullptr) { | |
*(void **) (&original_strtol) = dlsym(RTLD_NEXT, "strtol"); | |
setup(); | |
} | |
return original_strtol(str, endptr, base); | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment