below is simple code that will produce a 17 byte exe named hello.exe that when run from the console will output hello!. I wouldn't expect this to work on all windows but it works on my xp pro sp1.
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\kernel32
includelib \masm32\lib\user32
includelib \masm32\lib\masm32
.data
pName byte 'hello.exe',0
header byte 180,9,186,9,1,205,33,195,32
testmsg byte 'hello!',10,36,0
.data?
SizeWritten dd ?
hHand dd ?
.code
start:
invoke CreateFile,addr pName,GENERIC_READ or GENERIC_WRITE,FILE_SHARE_READ or FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_ARCHIVE,NULL
mov hHand,eax
.if eax!=INVALID_HANDLE_VALUE
invoke WriteFile,hHand,addr header,9,ADDR SizeWritten,NULL
invoke lstrlen,addr testmsg
mov ecx,eax
invoke WriteFile,hHand,addr testmsg,ecx,ADDR SizeWritten,NULL
invoke CloseHandle,hHand
.endif
invoke ExitProcess,0
end start
it's too fat :green2! It can be made 16-byte
header byte 180,9,186,8,1,205,33,195
testmsg byte 'hello!',10,36,0
main proc
local f1
mov f1,fopen("out.com","wb")
fwrite f1,offset header,16
fclose f1
ret
main endp
And it's basically not .exe, but a .com :)
mov ah,9
mov dx,108h
int 21
ret
db "hello!$"
15 bytes
header byte 180,9,186,8,1,205,33,195
testmsg byte 'hello!$'
No need for a LF...
Quote from: sinsi on May 13, 2007, 06:19:00 AM
15 bytes
header byte 180,9,186,8,1,205,33,195
testmsg byte 'hello!$'
No need for a LF...
with LF removed...
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\ecube>"C:\mini\hello.exe"
hello! ▲*GÇ>LG t♠┤☻ ▲*GX∙├PSRü♠║v░8â▬╝v â♠║v☼â▬╝v â&║v≡ ▲*Gü· ♦r♠╟♠
G■▼í
G3╥┴α♥â╥ ♥♠║v‼▬╝v♣ ♥â╥ ┴Γ♠┴Φ
♂╨ï≥┤ ▲*G♂└tJë▬FG┤♀ ▲*G♂└t<☺▲«v◄▬░v☺▲▓v◄▬┤v☺▲╢v◄▬╕v☺▲║v◄▬╝v╗ò ┤H═!r‼ú↑Gú→G♣
Ç ú♫Gú►G°δ☻É∙Z[X├S♠╕ C═/<ÇuF╕►C═/ë▲*Gî♠,G┤ ▲*G= ♥s♂= ☻r)ü√∟☻r#┤♣ ▲*G♂└t↓┤ ▲*GP┤
♠ ▲*G♂└Xt♂└t♥°δ☺∙[├SQRVÇ>LG t*┤♣ ▲*GW▲♠╣░8Aâß■┐3÷NÄ╞FÄ┌ⁿ≤ñ▼_┤♠ ▲*Gδ/É╛zG╣░8Aâß■ë
♀ëíFGëD
3└ëD☻ëD♦ëD♠╟DëD♫┤♂ ▲*G°δ☺∙^ZY[├SV♠Ç>LG t)┤♣ ▲*G▲WQ╣┐► 3÷NÄ╞FÄ▲↑Gⁿ≤ñY_▼┤♠ ▲*G°δXÉ
╛zG╟♦╟D☻ í↑GëíFGëD
3└ëD♦ëD♠ëD♀ëD♫┤♂ ▲*G╟♦P☺╟D☻ í♫GëíFGëD
3└ëD♦ëD♠ëD♫╟D♀░@┤♂ ▲*GÄ♠↑G┤I═!^[├j☺▲hzd▲hqvj h╖ j ──Vâ─►j ▲hzd▲hqvj☺h╧ j ──Vâ─►j
h╚ SRPQh· Ü▲'┘♫╣ h° SRPQhÜ Ü▲'┘♫╣░8ï▲╢vï▬╕vh└ RSj Qh· Ü▲'┘♫hH☺RSj Qh· Ü▲'┘♫hα R
Sj Qh· Ü▲'┘♫╣ î┌Φ↓♥h░ SRPQh≥ Ü▲'┘♫RSü┬Φtâ╙ h@☺SRPQh· Ü▲'┘♫[Zï▬0GΦΘ☻hÿ SRPQh≥ Ü▲
'┘♫╟♠2Gÿ ♠Ä♠0G&ï▬, Φ╟☻há SRPh ⌂h≥ Ü▲'┘♫ï▬¶Gï▲▬Gï♫↕GhÇ SRPQh≥ Ü▲'┘♫ï♫
G┴ß♥Iï▬║vï▲╝vh╨ SRPQh≥ Ü▲'┘♫h0☺SRPQh≥ Ü▲'┘♫╣ h¿ j☼PPQh· Ü▲'┘♫║ ♦h╕ PRPQh≥ Ü▲'┘♫
hÉ PPPQh≥ Ü▲'┘♫♠╕╖ Ä└ï▲ G──S§╕¼8-≡7╗≡7♥▲╢vï▬╕vh8☺RSj Ph· Ü▲'┘♫°_ZY[├SQRVW♠Ä♠→G╣
╣ ☺&ë§&╟E☻╟ &╞E♦ &╞E♣τ&╟E♠ â┬♣Γ▀&╟ ‼&╟♠↑ ‼&╟♠Ç ô‼&╟♠ÿ p(&╟♠¿ º¶&╟♠‼&╟☺µ♦&╟♠(☺═)
&╟♠0☺à*&╟♠@☺╕↕&╟♠Ç☺‼&╟♠ê☺▄↕&╟♠ÿ☺]§&☻‼î└╗ ──S♦╕♣ ╣╟ ║ ↕──S♣_^ZY[├PQW2└╣, ┐MG≤¬╟♠
w☺╟♠QG≡ ╟♠OGbx_YX°├££X% ☼PUï∞P▲╕@ Ä╪ïF☻⌐ ☻t↕≈♠¶♥ t☺√≡ü♫¶♥ ☻δ►≈♠¶♥ t☺·≡ü&¶♥ ²▼X
]¥£XÇΣ≡Çⁿ≡╕ ty☼☺α⌐☺ uEh ≡Uï∞P▲╕@ Ä╪ïF☻⌐ ☻t↕≈♠¶♥ t☺√≡ü♫¶♥ ☻δ►≈♠¶♥ t☺·≡ü&¶♥ ²▼X
]¥£XÇΣ≡╕☻ t,╕♥ QfSï╠âß♥+ßf£fh ♦ f¥f£f[f¥♥ßf≈├ ♦ f[Yt☺@ú.GUï∞P▲╕@ Ä╪ïF☻⌐ ☻t↕≈♠¶
♥ t☺√≡ü♫¶♥ ☻δ►≈♠¶♥ t☺·≡ü&¶♥ ²▼X]¥2 è▐└δ♦┴Γ♦├PVW▲Ä▲0GÄ▲, 3÷¼
└u√¼
t♦■┬δ÷&ê▬·d^┐Üe░☺┤)═!┐╩e░☺┤)═!▼_^├PV¼¬√NV┐√d2╥¼¬<
└u·O^X├VWè♦ΦT èα&è♣ΦL :αu
─t♦FGδτ_^├P< v4<:t0<;t,<,t(<=t
i'm going to have to disagree with you there sinsi :U
:P
The smallest COM file :
ret
sinsi's 15-byte coding works OK. You can do without the LF, but not without the string terminator.
Why not say "Hi" instead of the byte-wasting "Hello" :bdg
Tsk tsk tsk, I'm disappointed in you guys - to optimize a program, you cut down functionality and correctness of the output! :lol :P
Quote from: Ultrano on May 13, 2007, 01:35:50 PM
Tsk tsk tsk, I'm disappointed in you guys - to optimize a program, you cut down functionality and correctness of the output! :lol :P
Functionality and correctness? It's supposed to print "Hello!" to the console...and it does function correctly :P
Quote from: E^cube on May 13, 2007, 08:33:06 AM
i'm going to have to disagree with you there sinsi :U
Don't forget the "$" at the end...
Anyway, it seems a bit much to write a 12K Win32 app to write a 15 byte DOS file :lol
how boring with code the smallest Hello
I tried to make breakout that is only a single compare & neg velocity, but loops thru all possibility collisons and with help of and #1, the same compare & neg alternates between x and y
but the initalization code that draws walls and bunch of bricks bloats it
If yall are bored, maybe someone could write a program that will inject current date and time in a file opened in
Qeditor. :-)
Use TopGun, it already does that.
Thanks.
Quote from: skywalker on May 14, 2007, 09:44:10 AM
If yall are bored, maybe someone could write a program that will inject current date and time in a file opened in
Qeditor. :-)
The basics:
TimeDateString = current date/time string
eax = invoke FindWindow,"qe30_class",0
eax = invoke FindWindowEx,eax,0,"richedit",0
invoke SendMessage,eax,EM_REPLACESEL,1,offset TimeDateString
I think you are misunderstanding what I am looking for.
I have a com file that I wrote that will write date/time to a text file in DOS but can't get it to work in Qeditor.
&Time, \16bit\time2file.bat >> {b}
I hope that made sense.