I have a simple Windows program in NASM 64 (my first Windows API program in x64 -- I'm migrating from 32-bit MASM). I need windows.h to assemble this. I'm using Windows 7.
Windows has windows.h in a lot of different folders, all under C:\Program Files (x86). For this example, I used the windows.h file in C:\Program Files (x86)\Windows Kits\8.1\Include\um. However, the x86 folder is for 32-bit programs, but there is no windows.h file in the Program Files folder (for 64-bit).
When I assemble this with NASM, it outputs a long list of errors in the windows.h file. If I don't include windows.h, it will not recognize the externs (no surprise).
I thought NASM could only include a .inc file, but apparently there is no windows.inc.
Here is the source code:
%include "windows.h"
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
Any ideas are most appreciated. Thanks.