Here is a modified test piece.
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
include \masm64\include64\masm64rt.inc
crapin MACRO
.data?
hInstance dq ?
hMem dq ?
hLib dq ?
pbuf dq ?
buff dq 260 dup(?)
.code
mov pbuf, ptr$(buff) ; |
mov hInstance, rvcall(GetModuleHandle,0) ; |
rcall GetModuleFileName,hInstance,pbuf,260 ; |
rcall LoadLibrary,"kernel32.dll" ; |
mov hLib, rax ; | USELESS JUNK TO AVOID FALSE POSITIVES
invoke MessageBox,0,pbuf,"GetModuleFileName",MB_OK ; |
rcall GlobalAlloc,GMEM_FIXED,1024*1024 ; |
mov hMem, rax ; |
ENDM
crapout MACRO
rcall GlobalFree,hMem ; | USELESS JUNK TO AVOID FALSE POSITIVES
rcall FreeLibrary,hLib
ENDM
.code
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
entry_point proc
crapin ; reduce AV false positives
; --------------------------------------------------------
; the test code
; --------------------------------------------------------
rcall SendMessage,0,WM_COMMAND,50,0 ; missing window handle
rcall MessageBox,0,LastError$(),"Forced Error",MB_OK ; display the last error
; --------------------------------------------------------
crapout ; reduce AV false positives
invoke ExitProcess,0
ret
entry_point endp
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
end