The smallest imaginable complete Windows application.
From the section "Hello, Assembly! Retrocoding the World's Smallest Windows App successful x86 ASM" connected Dave's Garage:
And the follow-up section "C vs ASM: Making the World's SMALLEST Windows App":
Code successful the repository:
- Optimized type of the original codification is successful the files "TinyOriginal"
- Version applying ammunition coding strategies is successful the files "Lasse"
- Version utilizing a manually written PE header is successful the files "Theron"
- QRCode is dormant code, was the exe embedded into a QRCode, kept conscionable for posterity
The extremity of this task is to make the smallest imaginable application, without compression, that has the pursuing features:
- Runs a Windows connection loop
- Has a title bar, minimize, maximize, and adjacent buttons, which each activity arsenic expected
- Has a strategy paper pinch the same
- Paints the inheritance and immoderate matter centered successful the middle, adjacent to aliases larger than "Dave's Tiny App"
Please support it readable and explicate what you're doing successful the comments! And the smaller, the better!
The optimizations embedded successful the existent codification successful the Lasse directory, and those applied by Crinkler successful wide (if used) are alternatively aggressive, and look to lucifer strategies applied by definite types of malware. Because of this, your microorganism scanner whitethorn emblem the executables you build retired of the root codification arsenic "suspected malware". That tin make it intolerable to commencement them, aliases your microorganism scanner tin moreover put them successful quarantine. Depending connected the antivirus solution you use, you whitethorn beryllium capable to whitelist/exclude the executables to reconstruct them and get them to activity (this is known to hap pinch F-Secure SAFE). It's besides imaginable that you person to temporarily disable your microorganism scanner altogether (which has been observed pinch Microsoft Defender).
Please note:
- It is wholly your work to determine if you want to disable your microorganism scanner aliases not.
- If you do temporarily disable your microorganism scanner, we powerfully urge you re-enable it instantly aft you trial the executables you build retired of this repository's code.
- Although we do committedness that this repository does not incorporate immoderate malicious code, we cannot guarantee that this is existent for immoderate codification aliases executables (like expected builds of this repository's applications) that you get from different sources.
If your microorganism scanner intervenes erstwhile you effort to tally the executables that travel retired of this repository's root code, and you don't consciousness comfortable pinch (partly) disabling your microorganism scanner, past don't do it. We do understand and we really won't clasp it against you. :)
The codification successful the Lasse directory tin beryllium built pinch plain MASM32 11.0, which tin beryllium obtained from a number of sources. Build instructions utilizing it are:
The executable will beryllium named LittleWindows.exe.
Crinkler is simply a compressing linker for Windows, specifically targeted towards executables pinch a size of conscionable a fewer kilobytes. A transcript of the instrumentality is included successful this repository successful the Crinkler directory. It tin besides beryllium acquired from its GitHub repository.
Crinkler requires the Windows SDK to beryllium installed. Best (i.e. smallest) results person been achieved pinch type 10.0.20348.0 of the Windows 10 SDK. It, and different versions tin beryllium downloaded from the Windows SDK archive page connected the Microsoft website.
After installing it, the build instructions for the applications that tin beryllium built utilizing it are:
-
Code successful the Lasse directory:
ml /c /coff LittleWindows.asm crinkler.exe /NODEFAULTLIB /ENTRY:start /SUBSYSTEM:WINDOWS /TINYHEADER /NOINITIALIZERS /UNSAFEIMPORT /ORDERTRIES:1000 /TINYIMPORT /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.20348.0\um\x86" kernel32.lib LittleWindows.objThe executable will beryllium named out.exe.
-
Code successful the TinyOriginal directory:
ml /c /coff /IC:\masm32\include Tiny.asm crinkler.exe /ENTRY:MainEntry /SUBSYSTEM:WINDOWS /TINYHEADER /NOINITIALIZERS /UNSAFEIMPORT /ORDERTRIES:2000 /TINYIMPORT /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.20348.0\um\x86" kernel32.lib user32.lib gdi32.lib Tiny.obj /OUT:tiny.exeThe executable will beryllium named tiny.exe.
The codification successful the Theron directory has to beryllium built pinch Yasm, which is simply a rewrite of the NASM assembler nether the "new" BSD license. It tin beryllium acquired from the Yasm task download page; take the type "for wide use". The assembler is assumed to beryllium renamed to yasm.exe. Build instructions utilizing it are:
The executable will beryllium named HelloWindows.exe.
Current smallest known moving executable sizes arsenic of 03/11/2023 are arsenic follows:
| Lasse\LittleWindows.asm | MASM32 | 1104 |
| Lasse\LittleWindows.asm | Crinkler | 818 |
| Theron\HelloWindows.asm | Yasm | 383 |
| TinyOriginal\Tiny.asm | Crinkler | 540 |


English (US) ·
Indonesian (ID) ·