flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Windows > Executable size with WinAPI?

Author
Thread Post new topic Reply to topic
jazz



Joined: 16 Jul 2016
Posts: 42
Executable size with WinAPI?
I noticed that a basic Hello World using WriteConsole instead of printf (linked with Microsoft's link.exe) is already taking up 2 KiB on my Windows 10 system. Is that expected or am I doing it wrong?

_________________
invoke Beer
Post 10 Jan 2017, 17:12
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1382
Location: Toronto, Canada
It is expected.
By default the EXE file is made of sections.
Section size is a multiple of say 512 bytes, so 4 sections will make 2Kb,
even if each section has few useful bytes inside.
You can reduce the EXE size by combining sections.
Search the forum - you will find the details.
Post 10 Jan 2017, 22:29
View user's profile Send private message Send e-mail Reply with quote
jazz



Joined: 16 Jul 2016
Posts: 42
Ah, OK. Thank you!
Post 10 Jan 2017, 22:33
View user's profile Send private message Reply with quote
Mikl___



Joined: 30 Dec 2014
Posts: 54
jazz,

Code:
format PE GUI
include 'win32ax.inc'
; import, code, data in the same section
   invoke MessageBox,NULL,wText,wTitle,MB_OK
   retn
wTitle   db   'Iczelion Tutorial #2:MessageBox',0
wText     db   'Win32 Assembly with FASM is Great!',0
data import
 library user32,'USER32.DLL'
 import user32,\
MessageBox,'MessageBoxA'
end data



Code:
PE-header|codedataimport|  zeros  |size of exe
---------+------------------+---------+----------
512 bytes|     169 bytes    |343 bytes1024 byte



Description:
Download
Filename: tut_02.zip
Filesize: 811 Bytes
Downloaded: 23 Time(s)

Post 11 Jan 2017, 00:59
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.