MinGW is not only available on Kali, of course, but also on Windows. Compiling a DLL is very similar.
MinGW is installed in folder C:\msys64 on my machine.
To compile 64-bit executables, you need to start the 64-bit shell first: launch C:\msys64\mingw64.exe
Then you can compile the DLL:
gcc -shared -o DemoDll-x64.dll DemoDll.cpp
For 32-bit executables, it’s the 32-bit shell: launch C:\msys64\mingw32.exe
Then you can compile the DLL:
gcc -shared -o DemoDll-x86.dll DemoDll.cpp
It’s also possible to start the shell and compile from a BAT file:
call C:\msys64\msys2_shell.cmd -mingw64 -here -c "gcc -shared -o DemoDll-x64.dll DemoDll.cpp" call C:\msys64\msys2_shell.cmd -mingw32 -here -c "gcc -shared -o DemoDll-x86.dll DemoDll.cpp"
[…] Quickpost: Compiling DLLs with MinGW on Windows […]
Pingback by Overview of Content Published in August | Didier Stevens — Wednesday 5 September 2018 @ 0:00
hey what about sources like “program.cpp” and “program.h” there’s a some config?
Thanks in advance.
Comment by Fabian — Saturday 29 October 2022 @ 3:40
This is a series of blog posts. If you follow the links to the previous blog posts, you’ll find the source code: https://blog.didierstevens.com/2017/09/08/quickpost-dlldemo/
Comment by Didier Stevens — Tuesday 1 November 2022 @ 8:50