smallest.c is the smallest compilable c code
small.c is the smallest compilable c code that runs
SegFault.c is the smallest c code that produces a segmentation fault
smallest.s compile using nasm on linux to create the smallest Windows exe
main(){puts();} |
main(){} |
main; |
IMAGEBASE equ 400000h | |
BITS 32 | |
ORG IMAGEBASE | |
dw "MZ" | |
dw 0 | |
dw 'PE',0 | |
dw 0x14c | |
dw 0 | |
user32.dll: | |
dd 'user' | |
db '32',0,0 | |
dd 0 | |
dw 0 | |
dw 2 | |
dw 0x10B | |
kernel32.dll: | |
db 'k' | |
db 'e' | |
dd 'rnel' | |
db '32',0,0 | |
dd 0 | |
dd Start - IMAGEBASE | |
dd 0 | |
dd 0 | |
dd IMAGEBASE | |
dd 4 | |
dd 4 | |
dw 0 | |
dw 0 | |
dw 0 | |
dw 0 | |
dw 4 | |
dw 0 | |
dd 0 | |
dd 0x40 | |
dd 0 | |
dd 0 | |
dw 2 | |
dw 0 | |
dd 0 | |
dd 0 | |
dd 0 | |
dd 0 | |
dd 0 | |
dd 2 | |
dd 0 | |
dd 0 | |
dd IMAGE_IMPORT_DESCRIPTOR - IMAGEBASE | |
Start: | |
push 0 | |
push world | |
push hello | |
push 0 | |
call [MessageBoxA] | |
push 0 | |
call [ExitProcess] | |
kernel32.dll_iat: | |
ExitProcess: | |
dd impnameExitProcess - IMAGEBASE | |
dd 0 | |
kernel32.dll_hintnames: | |
dd impnameExitProcess - IMAGEBASE | |
dw 0 | |
impnameExitProcess: | |
dw 0 | |
db 'ExitProcess' | |
impnameMessageBoxA: | |
dw 0 | |
db 'MessageBoxA', 0 | |
user32.dll_iat: | |
MessageBoxA: | |
dd impnameMessageBoxA - IMAGEBASE | |
dd 0 | |
user32.dll_hintnames: | |
dd impnameMessageBoxA - IMAGEBASE | |
dd 0 | |
IMAGE_IMPORT_DESCRIPTOR: | |
dd kernel32.dll_hintnames - IMAGEBASE | |
world: | |
db 'worl' | |
db 'd!',0,0 | |
dd kernel32.dll - IMAGEBASE | |
dd kernel32.dll_iat - IMAGEBASE | |
dd user32.dll_hintnames - IMAGEBASE | |
hello: | |
db 'Hell' | |
db 'o',0,0,0 | |
dd user32.dll - IMAGEBASE | |
dd user32.dll_iat - IMAGEBASE | |
times 7 db 0 |