I looked at the code I had made as a reply to an old post, and I decided to try and shrink the exe size as much as possible.... I've got it down to 1.5k, but I was wondering, how small can I get it? Anyway, here's the code I got:

.386
.model flat, stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\advapi32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\advapi32.lib

.CONST
MaxNameSize equ 256

.code
data:
MsgCaption  db "User Info:",0
MsgBoxText  db "The current user logged in is: "
Nme         db MaxNameSize dup(0)

start:
  lea edx, 
  mov eax, offset start
  push NULL
  sub eax, offset data

  invoke VirtualProtect, addr data, eax, PAGE_READWRITE, edx
  pop eax

  lea eax, 
  push MaxNameSize
  invoke GetUserName, addr Nme, eax
  pop eax

  invoke MessageBox, NULL, addr MsgBoxText, addr MsgCaption, MB_OK

  invoke ExitProcess, NULL
end start
Mirno
Posted on 2001-04-17 06:33:00 by Mirno
Mirno, try this link line, it merges 2 sections and usually drops the size by 512 bytes. \masm32\bin\Link /SUBSYSTEM:WINDOWS /MERGE:.rdata=.text minimum.obj > nul hutch@pbq.com.au
Posted on 2001-04-17 07:18:00 by hutch--
I saw an example for nasm sometime, that was *really* dirty. No MZ header (windows doesn't really need it), everything PE- related was hand constructed, very very dirty. And very very small. I'll try to find the source and paste it here, just because it's interesting :).
Posted on 2001-04-17 07:25:00 by f0dder
i think there is an article on Hugi 21 (hugi.de) about makeing very small exes... 512/768 bytes is the smallest i belive because of the PE headers
Posted on 2001-04-17 18:31:00 by BogdanOntanu
This was an issue contest sometime ago in _mammon's (et al) APJ. Check the article here: http://asmjournal.freeservers.com/issues/apj_2.txt It's the last item in the .txt. Bye! Latigo
Posted on 2001-05-08 09:44:00 by latigo
I believe this is the source the fodder mentioned: Smallest PE EXE (WinNT+Win95)
Posted on 2001-05-08 15:33:00 by bitRAKE