include \masm32\include\masm32rt.inc
NTQUERYINFORMATIONPROCESS typedef proto stdcall :HANDLE,:UINT,:PVOID,:ULONG,:PULONG
PNTQUERYINFORMATIONPROCESS typedef ptr NTQUERYINFORMATIONPROCESS
CheckProcessDebugFlags macro
fn GetProcAddress,rv(GetModuleHandle,"ntdll.dll"),"NtQueryInformationProcess"
push eax
invoke GetCurrentProcess
mov ecx,esp
mov edx,[esp]
invoke PNTQUERYINFORMATIONPROCESS ptr edx,eax,1fh,ecx,4,NULL
pop edx
.if eax != 0
xor eax,eax
.elseif !edx
mov eax,-1
.endif
EXITM <eax>
endm
.code
start:
.if CheckProcessDebugFlags()
fn MessageBox,0,0,0,0
.endif
invoke ExitProcess,0
end start