Created
November 5, 2018 17:18
-
-
Save stek29/65c7184cf6c1dd4b64a311023f25720b to your computer and use it in GitHub Desktop.
cross-build 32bit rundll32'able DLL with mingw
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
#undef UNICODE | |
#define UNICODE | |
#include <windows.h> | |
#include <stdio.h> | |
// i686-w64-mingw32-g++ -shared -o ExampleDll.dll example_dll.cpp -Wl,--out-implib,libExampleDll.dll -static -lgcc example_dll.def | |
// | |
// example_dll.def: | |
// EXPORTS | |
// RunDllMe=RunDllMe@16 | |
// | |
// rundll32 ExampleDll.dll,RunDllMe | |
extern "C" | |
__stdcall | |
void | |
CALLBACK | |
RunDllMe(HWND, HINSTANCE, wchar_t const*, int) | |
{ | |
#if 0 | |
AllocConsole(); | |
freopen( "CONIN$", "r", stdin ); | |
freopen( "CONOUT$", "w", stdout ); | |
freopen( "CONOUT$", "w", stderr ); | |
DWORD const infoBoxOptions = MB_ICONINFORMATION | MB_SETFOREGROUND; | |
MessageBox( 0, L"Before call...", L"DLL message:", infoBoxOptions ); | |
#endif | |
for(;;) { | |
Sleep(0xffff); | |
#if 0 | |
printf("hey hey\n"); | |
#endif | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment