Skip to content

Instantly share code, notes, and snippets.

@livz

livz/myDll.c Secret

Created July 21, 2017 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save livz/8794bf3bc3ec55d11c12fe5862da2eb8 to your computer and use it in GitHub Desktop.
Save livz/8794bf3bc3ec55d11c12fe5862da2eb8 to your computer and use it in GitHub Desktop.
Simple Dll
#include <Windows.h>
#pragma comment(lib, "User32.lib")
/*
* Compile with cl:
* cl /nologo /LD myDll.c /link /out:myDll.dll
*
* Test:
* rundll32 myDll.dll,#1
*
*/
__declspec(dllexport) BOOL APIENTRY DllMain(HMODULE hModule, DWORD reason, LPVOID lpReserved)
{
switch(reason)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
MessageBox(NULL, "DLL loaded", "DLL Main", MB_OK);
ExitProcess(1);
break;
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment