News:

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

Main Menu

How to program GUI applications using MASM but without MASM-SDK?

Started by Mayuresh Kathe, September 12, 2019, 02:26:06 PM

Previous topic - Next topic

nidud

deleted

hutch--

You can make local prototypes as they are matched against the "proc" line of a procedure but it does not work with external API function calls. I bothered to make a macro that manages the prototype from the TYPEDEF and got it to work (IE:not show an error) but the prototype done this way still does not work in terms of argument count. While this example below runs correctly, you can add a series of extra arguments which show up in the dis-assembly and no error is reported. It still runs but the extra arguments are ignored.

The only method I have got to work is with the commented out macro as the pre-processor checks the argument count.

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    include \masm32\include64\masm64rt.inc

  ; ************************************************

    PPROTO MACRO func_addr:REQ,arglist:VARARG
      LOCAL var
      .const
      var TYPEDEF PROTO arglist
      EXITM <equ <(TYPE QWORD PTR var) PTR func_addr>>
    ENDM

    msgbox PPROTO(__imp_MessageBoxA,:QWORD,:QWORD,:QWORD,:QWORD)

;     msgbox MACRO a1,a2,a3,a4
;       rcall __imp_MessageBoxA,a1,a2,a3,a4
;     ENDM

    .code

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

entry_point proc

    rcall msgbox,0,"Text Message","Title",MB_OK

    .exit

entry_point endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    end

; .text:0000000140001008 48C7C100000000             mov rcx, 0x0
; .text:000000014000100f 488B1557100000             mov rdx, qword ptr [0x14000206d]
; .text:0000000140001016 4C8B0569100000             mov r8, qword ptr [0x140002086]
; .text:000000014000101d 49C7C100000000             mov r9, 0x0
; .text:0000000140001024 FF15D2100000               call qword ptr [MessageBoxA]