News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

cmd$() macro bug

Started by qWord, June 21, 2011, 09:23:47 PM

Previous topic - Next topic

qWord

hi,
it is currently not possible to call the cmd$()-macro more than one time, because the equate cmdflag is global while the buffer is named using the local label argbuffer:
      cmd$ MACRO argnum
        LOCAL argbuffer
        IFNDEF cmdflag
        .data?
          argbuffer db MAX_PATH dup (?)
        .code
        cmdflag equ 1
        ENDIF
        invoke GetCL,argnum, ADDR argbuffer
        mov ecx, eax
        mov eax, OFFSET argbuffer
        EXITM <eax>
      ENDM

my suggestion:
      cmd$ MACRO argnum
        IFNDEF cmd$_argbuffer
            .data?
                cmd$_argbuffer db MAX_PATH dup (?)
            .code
        ENDIF
        invoke GetCL,argnum, ADDR cmd$_argbuffer
        mov ecx, eax
        mov eax, OFFSET cmd$_argbuffer
        EXITM <eax>
      ENDM

qWord
FPU in a trice: SmplMath
It's that simple!