Advertisement
DarkAtom77

Hello world Assembly x64 (WinAPI)

May 27th, 2020
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Hello world program
  2. ; Language: x86-64 (AMD64) Assembly
  3. ; Library: Windows API 64-bit
  4.  
  5. global _start
  6.  
  7. extern GetStdHandle
  8. extern WriteFile
  9.  
  10. section .text
  11. _start:
  12.     mov rcx, -11
  13.     sub rsp, 8
  14.     mov rbx, rsp
  15.     sub rsp, 32
  16.     call GetStdHandle
  17.     add rsp, 32
  18.     push dword 0
  19.     mov r9, rbx
  20.     mov r8, message_length
  21.     mov rdx, message
  22.     mov rcx, rax
  23.     sub rsp, 40
  24.     call WriteFile
  25.     add rsp, 56
  26.     xor rax, rax
  27.     ret
  28.  
  29. section .data
  30.     message db 'Hello world!', 0xD, 0xA
  31.     message_length equ $ - message
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement