Just made a strange discovery. The code below works perfectly. However, try...
start: .if EXIST(addr FindMe)
... instead of ...
start:
.if EXIST(addr FindMe)
Is this a known bug?
.nolist
include \masm32\include\masm32rt.inc
EXIST MACRO fname:REQ, DiscardHandle:=<1>
invoke FindFirstFile, reparg(<fname>), addr wfd
.if eax==INVALID_HANDLE_VALUE
xor eax, eax
.elseif DiscardHandle
invoke FindClose, eax
.endif
EXITM <eax>
ENDM
.data?
wfd WIN32_FIND_DATA <?>
.data
FindMe db "\masm32\OllyDbg\OLLYDBG.EXE", 0
FileEx db "The file exists:", 0
NoFile db "The file does NOT exist:", 0
.code
start:
.if EXIST(addr FindMe)
invoke MessageBox, 0, addr FindMe, addr FileEx, MB_OK
.else
invoke MessageBox, 0, addr FindMe, addr NoFile, MB_OK
.endif
invoke ExitProcess, 0
end start
[attachment deleted by admin]
hi,
i don't think this is a bug. The code in EXIST()-macro will be created before the entrypoint. The reason for this is that masm expand macros before the current line.
regards qword
Good to know, thanks a lot!