Skip to content

Instantly share code, notes, and snippets.

@KrzaQ
Forked from anonymous/DLL
Created April 17, 2012 23:30
Show Gist options
  • Save KrzaQ/2409891 to your computer and use it in GitHub Desktop.
Save KrzaQ/2409891 to your computer and use it in GitHub Desktop.
DLL
// dllmain.cpp : Defines the entry point for the DLL application.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
HINSTANCE g_hInstance = NULL;
//Game.exe+113F0 - 55 - push ebp
// int __cdecl sub_4113F0(LPCSTR lpText)
int (__cdecl *CallMe )( char * szMessage) = (int (__cdecl *)(char *)) (reinterpret_cast<DWORD_PTR>(GetModuleHandleA(0)+0x113F0));
void Init()
{
CallMe("Hello Word");
FreeLibraryAndExitThread(g_hInstance, 0);
}
BOOL WINAPI DllMain(HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
{
DisableThreadLibraryCalls(hDll);
g_hInstance=hDll;
CreateThread(NULL, NULL, ( LPTHREAD_START_ROUTINE ) Init, NULL, NULL, NULL);
}
break;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment