Name: Anonymous 2012-05-26 16:58
Trying to get this to work. Just a "my first" program to help me make the transition mentally to x64, but it crashes if printf is invoked - why? Commenting out printf makes it not crash, and the stack pointer is the same at the start of the program as it is before the ret.
Yes, Windows.
Yes, Windows.
include 'win64a.inc'
format PE64 Console 4.0
entry main
section '.text' code data readable executable
main:
mov rdx, rsp
mov rcx, text
call [printf]
xor rax,rax
ret
text db "It's 5 AM. Do you know where your stack pointer is? (%016x)", 10, 0
align 16
data import
library msvc,'msvcrt.dll'
import msvc,printf,'printf'
end data