News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Hutch ML64 macros64.inc and UASM

Started by LiaoMi, August 30, 2018, 07:16:04 AM

Previous topic - Next topic

hutch--

Then use it without the dot prefix.

  ; --------------------------------------------------------
  ; exit macro with an optional return value for ExitProcess
  ; --------------------------------------------------------
    exit MACRO optional_return_value
      IFNDEF optional_return_value
        invoke ExitProcess, 0
      ELSE
        invoke ExitProcess,optional_return_value
      ENDIF
    ENDM

jj2007

Right. Shorter version:

exit MACRO optretval:=<0>
  invoke ExitProcess, optretval
ENDM
  ...
  exit
  exit 123


Under the hood, e.g. as 64-bit code (assembled with ML64):

0000000140001A15   | 33 C9                            | xor ecx,ecx                               |
0000000140001A17   | FF 15 EB 05 00 00                | call qword ptr ds:[<&RtlExitUserProcess>] |
0000000140001A1D   | B9 7B 00 00 00                   | mov ecx,7B                                | 7B:'{'
0000000140001A22   | FF 15 E0 05 00 00                | call qword ptr ds:[<&RtlExitUserProcess>] |

hutch--

That's the one from the macro help file for 32 bit MASM written before 2000. This is the 21st century MASM version which should build in UASM without the dot prefix.

    .exit MACRO optvar:=<0>
      invoke ExitProcess,optvar
    ENDM