Skip to content

Instantly share code, notes, and snippets.

@livz

livz/myDll.c Secret

Created Jul 21, 2017
Embed
What would you like to do?
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