Jump to content
Welcome, welcome! Come in and register, and have some developer coffee. 👨‍💻 ×

Create your "Hello World" console app


Recommended Posts

It is just 1024 bytes:

F.PNG.68dbfb3e7c0f52076b590a82678a7bae.PNG

 

format PE console

include 'win32a.inc'

; no section defined - fasm will automatically create .flat section for both
; code and data, and set entry point at the beginning of this section

        invoke  GetStdHandle, -11
        invoke  WriteConsole, eax, _message,_len,_dummy, 0
        invoke  ExitProcess,0

_message db 'Welcome to kaki.GG',13,10,0
_len     = $-_message
_dummy   dd ?

; import data in the same section

data import

 library kernel32,'KERNEL32.DLL'

 import kernel32,\
        GetStdHandle, 'GetStdHandle', \
        WriteConsole, 'WriteConsoleA', \
        ExitProcess,'ExitProcess'

end data                 

It calls several Win32 APIs:

https://docs.microsoft.com/en-us/windows/console/getstdhandle

https://docs.microsoft.com/en-us/windows/console/writeconsole

https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-exitprocess

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...