flat assembler
Message board for the users of flat assembler.

flat assembler > Windows > [fasmg] w64g02.asm, uses printf

Thread Post new topic Reply to topic

Joined: 19 Jan 2004
Posts: 171
Location: N 5.43564° E 100.3091°
;Program : w64g02
;Version : 0.0.1
;Author  : Yeoh HS
;Date    : 7 January 2018
;Purpose : a Win64 console program. Use printf from msvcrt.dll
;fasmg   : i17sx
include 'format/format.inc'

format PE64 Console
entry start

section '.text' code readable executable

        sub         rsp,8*5
        lea     rdx, [Message]
    lea     rcx, [FormatString]
    call    [printf]
        xor     ecx, ecx
        call    [ExitProcess]

section '.data' data readable writeable
  FormatString db '%s',0
  Message db 'With printf function, fasmg says Hello 64-bit World!',0

section '.idata' import data readable writeable

  dd 0,0,0,RVA kernel_name,RVA kernel_table
  dd 0,0,0,RVA msvcrt_name,RVA msvcrt_table
  dd 0,0,0,0,0

    ExitProcess dq RVA _ExitProcess
    dq 0
    printf         dq RVA _printf
    dq 0
  kernel_name db 'Kernel32.dll',0
  msvcrt_name db 'msvcrt.dll',0
  _ExitProcess dw 0
    db 'ExitProcess',0
  _printf dw 0
    db 'printf',0

“It’s not that we have a short time to live, but that we waste a lot of it.”
-Lucius Annaeus Seneca
Post 10 Jan 2018, 09:05
View user's profile Send private message Visit poster's website 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

Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.