Source code DeskZoom
Smallest desktop zoom application ever
DeskZoom screenshot Ok, I didn't actually verify this statement but still, I got a pretty small executable: only 6144 bytes.
This is a very simple program I've written years ago and now I got this idea to try make it as small as possible (the executable that is). First of all I had to port it to Win32 since the original version was written in MFC.
Anyway, here are the techniques I used to make the .exe small:
First off all I removed dependencies on standard libraries:
  • Checked "Ignore all default libraries" in project settings and changed the application entry point from WinMain to WinMainCRTStartup.
  • Replaced all the calls to the standard LIBC functions with Win32 equivalents. Unfortunately, I couldn't find a Win32 replacement for atoi so I had to roll my own implementation (my_atoi).
  • Reduced section alignment which by default is 4096 bytes (the size of a memory page on x86 architectures). The smallest possible alignment is 512 bytes. Lowering it even more might have unexpected results on various windows flavors. You can control this option in several ways:
    • either by adding #pragma-s directly in the source code:
      #pragma linker("/ALIGN:512");
    • adding the option by hand to the project settings
  • Obviously, selected size optimizations
Things I tried and didn't do anything in this particular case:
  • Merging executable sections
Things left to do:
  • Try some optimizations over the code
  • reduce the number of used API functions to reduce import section (".idata")
  • try one of those executable packers
Warning: Tested only with Visual Studio 6

Further reading: http://msdn.microsoft.com/msdnmag/issues/01/01/hood/

Discuss this article

      DeskZoom
 
    Version: 1.0
    License: GPL
    OS:  Windows
    Development Tools:                             Microsoft Visual Studio 6
    Last Update: August 21st, 2005

   Download:
     Save Sources
     Save Executable