News:

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

Main Menu

Passing argument in a structure works OK.

Started by hutch--, July 11, 2016, 10:31:50 PM

Previous topic - Next topic

hutch--


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

    include \masm64\include\masm64rt.inc

    MBSTRUCT STRUCT QWORD
      whndl dq ?
      wtxtm dq ?
      wttlm dq ?
      wstyl dq ?
    MBSTRUCT ENDS

    .code

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

entry_point proc

    .stack

    LOCAL mbs:MBSTRUCT

    mov r10, chr$("Pass arguments in a structure test")
    mov r11, chr$("Title")

    mov mbs.whndl, 0
    mov mbs.wtxtm, r10
    mov mbs.wttlm, r11
    mov mbs.wstyl, MB_OK

    lea rcx, mbs
    call mbox

    void(ExitProcess,0)

    ret

entry_point endp

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

mbox proc

    .stack

    mov rax, rcx

    mov rcx, (MBSTRUCT PTR [rax]).whndl
    mov rdx, (MBSTRUCT PTR [rax]).wtxtm
    mov r8,  (MBSTRUCT PTR [rax]).wttlm
    mov r9,  (MBSTRUCT PTR [rax]).wstyl

    call MessageBox

    ret

mbox endp

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

    end