Skip to content

nchgroup/messagebox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Message Box

PE file

#include <windows.h>

int main(){
    MessageBox(NULL, "Msg test", "Test", MB_OK | MB_ICONINFORMATION);
    return 0;
}

Compile

x86_64-w64-mingw32-gcc -Os -flto -fdata-sections -ffunction-sections -Wl,--gc-sections -s -mwindows -o test.exe main-pe.c

DLL file

#include <windows.h>

extern __declspec(dllexport) void ShowMessage(){
    MessageBox(NULL, "Msg test", "Test", MB_OK | MB_ICONINFORMATION);
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved){
    switch (ul_reason_for_call) {
        case DLL_PROCESS_ATTACH:
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
            break;
    }
    return TRUE;
}

Compile

x86_64-w64-mingw32-gcc -shared -O2 -s -ffunction-sections -fdata-sections -fmerge-all-constants -static-libgcc -o test.dll main-dll.c

Run

rundll32 test.dll,ShowMessage

Dependencies

brew install mingw-w64

About

MessageBox Example

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published