I am using MASM in x64 Windows operating system. I wanted to call Windows APIs and then output some strings to the screen.
I am learning x64 assembly programming in Windows operating system. Today I wanted to print some result to the console. However, unlike linux operating system, in windows we can use syscalls directly without any pain. I've written the following program to print a hello world message to the console but it doesn't show anything. I couldn't figure out what is wrong with this code.
GetStdHandle PROTO
ExitProcess PROTO
WriteConsoleA PROTO
.data
message DB "Hello World",0
message_size DW SIZEOF message
.code
main PROC
SUB RSP, 5 * 8
MOV RCX, -11
CALL GetStdHandle
MOV RCX, RAX
LEA RDX, message
MOV R8, SIZEOF message - 1
LEA R9, message_size
MOV QWORD PTR [RSP + 4 * SIZEOF QWORD], 0
CALL WriteConsoleA
MOV RCX, 0
CALL ExitProcess
main ENDP
END