It works:include \Masm32\MasmBasic\Res\JBasic.inc ; ## builds in 32- or 64-bit mode with ML64, Uasm etc
OldProtection dd ?
jd@150 equ KernelBase ; a little hack for a missing WinAPI,
j@VirtualProtectFromApp equ jbNextApi/150:s1111 ; may be refined in the near future
Init ; OPT_64 1 ; put 0 for 32 bit, 1 for 64 bit assembly
PrintLine Chr$("This code was assembled with ", @AsmUsed$(1), " in ", jbit$, "-bit format")
mov rbx, rv(VirtualAlloc, 0, 4096, MEM_RESERVE or MEM_COMMIT, PAGE_NOACCESS)
usedeb=1
deb 4, "VirtualAlloc:", x:rbx
jinvoke VirtualProtectFromApp, rbx, 1024, PAGE_EXECUTE_READWRITE, addr OldProtection
deb 4, "VirtualProtectFromApp:", rax, OldProtection
PrintLine Err$()
Inkey Chr$(jbit$, "-bit assembly is easy, it seems...")
EndOfCode
This code was assembled with HJWasm32 in 64-bit format
VirtualAlloc: x:rbx 1b0000h
VirtualProtectFromApp:
rax 1
OldProtection 1
Can't find the key etc.
The error message is irrelevant, since rax is non-zero.
Same for the 32-bit version. This is Windows version 10.0, build 15063.