GitHub LinkedIn Twitter

Creating small executables with Microsoft Visual Studio

Starting with an empty project, I will show you how to use Microsoft Visual Studio 2010 to compile your C code without the usual bloating that the compiler adds automatically. This article will just feature C code, I may extend this blog entry for usage with C++ at a later point. In the empty workspace, create a new file called tinyexe.c with following content: #include <windows.h> void main() { MessageBoxA(0, "Hello", "world!
Read more →

Creating small executables with Qt Creator and MingW

Starting with an empty Plain C Project in Qt Creator IDE and gcc from MinGW as compiler, I will show you how to generate small binaries that are independent from MinGW dlls. At the writing of this article the app versions that I used were Qt Creator 2.6.2 with Qt 5.0.1 and gcc 4.7.2. Replace the code of the main.c with following: #include <windows.h> void main() { MessageBoxA(0, "Hello", "world!", MB_OK); ExitProcess(0); } Switch the build configuration in menu Projects from Debug to Release and compile the project (Ctrl + B is the default shortcut for this).
Read more →

Creating the smallest possible Windows executable using assembly language

Using nasm, we can build the smallest possible native exe (without using a packer, dropper or anything like that) file that will work on all Windows versions. This is what one of the possible solution binary looks like: The code for this little cutie: IMAGEBASE equ 400000h BITS 32 ORG IMAGEBASE ; IMAGE_DOS_HEADER dw "MZ" ; e_magic dw 0 ; e_cblp ; IMAGE_NT_HEADERS - lowest possible start is at 0x4 Signature: dw 'PE',0 ; Signature ; IMAGE_FILE_HEADER dw 0x14c ; Machine = IMAGE_FILE_MACHINE_I386 dw 0 ; NumberOfSections user32.
Read more →