I have a simple program using GetStdHandle and WriteFile from windows.h. I downloaded the NASM-X files to get the NASM include version of windows.h.
My program is 64-bit. There is a windows.inc in the win32 folder, but when I use it ("%include "windows.inc"), I get a long list of errors. That appears to be because it's only for 32-bit and my program is 64-bit.
When I include the nasmx.inc file (%include "nasmx.inc"), I get only the error that GetStdHandle, WriteFile are not defined in the object file. GetStdHandle and WriteFile are very basic Windows API commands, so I would think they would be included.
So my question is, which include file from NASM-X should I use for 64-bit NASM? Do I need to use more than one? The docs are not clear on this point.
Here is the code:
%include "nasmx.inc"
global main
extern GetStdHandle
extern WriteFile
section .text
main:
mov rcx, 0fffffff5h
call GetStdHandle
mov rcx, rax
mov rdx, NtlpBuffer
mov r8, [NtnNBytesToWrite]
mov r9, NtlpNBytesWritten
sub rsp, 40
mov dword [rsp + 32], 00h
call WriteFile
add rsp, 40
ExitProgram:
xor eax, eax
ret
section .data
NtlpBuffer: db 'Hello, World!', 00h
NtnNBytesToWrite: dq 0eh
section .bss
NtlpNBytesWritten: resd 01h
I'm using GoLink as the linker.
Thanks for any info.