flat assembler
Message board for the users of flat assembler.
Index
> Windows > Win32 Console Apps |
Author |
|
MCD 16 Dec 2004, 19:14
Well, to code Win32 applications, you should first put
Code: format PE console right at the beginning of your file. The format directive is descibed in the Fasm documentation (see doc\Fasm.txt or doc\Fasm.pdf) Furthermore, Win32 application can contain several sections (a bit like segments in MZ executables) E.g. you have at least 3 sections: The first (default) section is a .flat section, with data/code combined. The next one is at least an import section for stuff imported from dlls (there almost no interrupts under Win32, you must use dll calls or invokes) Code:
section '.idata' import data readable writeable
...
And another section should be a fixup section Code:
section '.reloc' fixups data readable discardable
This section should contain nothing, since it is automatically filled _________________ MCD - the inevitable return of the Mad Computer Doggy -||__/ .|+-~ .|| || |
|||
16 Dec 2004, 19:14 |
|
snifit 17 Dec 2004, 08:19
Here you have an example that prints a textstring to the standard output:
Code: format PE console entry start include '%fasminc%\win32a.inc' section '.data' data readable writeable output dd ? bwritten dd ? _text db 'output text',0 section '.code' code readable executable start: invoke GetStdHandle,STD_OUTPUT_HANDLE cmp eax,INVALID_HANDLE_VALUE je exit mov [output],eax invoke WriteConsole,[output],_text,12,bwritten,0 exit: xor eax,eax ret section '.idata' import data readable writeable library kernel,'KERNEL32.DLL' import kernel,\ GetStdHandle,'GetStdHandle',\ WriteConsole,'WriteConsoleA' |
|||
17 Dec 2004, 08:19 |
|
Vortex 17 Dec 2004, 18:29
Hi calpol2004,
Welcome to the forum. Here is a console example for you.
_________________ Code it... That's all... |
|||||||||||
17 Dec 2004, 18:29 |
|
Tommy 18 Dec 2004, 09:42
You can also have a look at the win32 console template in the newest fresh package... (contains an example of how to use as well)
|
|||
18 Dec 2004, 09:42 |
|
2 10 Dec 2006, 06:03
Thanks for that! I needed this info.
|
|||
10 Dec 2006, 06:03 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.