Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .text
- extern GetStdHandle
- extern WriteFile
- ;extern ExitProcess
- global hw
- hw:
- push rbp ; Align stack back on 16 byte boundary
- mov rbp, rsp
- sub rsp, 32+8+8 ; Allocate space on stack for maximum number
- ; of stack based variables used to call Windows functions
- ; which is 1 argument in this case (total 8 bytes).
- ; Subtract 32 bytes for the shadow space. Subtract additional
- ; 8 bytes to maintain 16 byte alignment
- mov rcx,-11
- call GetStdHandle
- mov rcx,rax ; No need to use R12 and if we had we would have to preserve it
- ; as it is a nonvolatile register
- lea rdx,[rel msg]
- mov r8,16
- mov r9,rsp
- mov qword [rsp+32], 0 ; RSP+0 to RSP+31 are the shadow space.
- ; First stack based parameter (5th argument to WriteFile) is at RSP+32
- call WriteFile
- leave
- ret
- section .data
- msg: db "hello"
- msglen: equ $-msg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement