News:

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

Main Menu

GNU Assembler 64-bit dialog box example

Started by Vortex, August 23, 2017, 05:36:32 AM

Previous topic - Next topic

Vortex

Here is a quick example :

.intel_syntax noprefix
.global _start

.extern EndDialog
.extern DialogBoxParamA
.extern GetModuleHandleA
.extern ExitProcess

.equ DialogBoxParam,DialogBoxParamA
.equ GetModuleHandle,GetModuleHandleA
.equ WM_CLOSE,16

.data

DlgBox:

.asciz "DLGBOX"

.text

_start:

    sub     rsp,5*8+8+8

    xor     rcx,rcx
    call    GetModuleHandle

    xor     r8,r8 
    mov     rcx,rax
    mov     rdx,OFFSET DlgBox
    mov     r9,OFFSET DlgProc
    mov     QWORD [rsp+32],r8
    call    DialogBoxParam

    xor     rcx,rcx
    call    ExitProcess

// DlgProc PROC hWnd:QWORD,uMsg:QWORD,wParam:QWORD,lParam:QWORD

DlgProc:
   
    sub     rsp,4*8+8
    cmp     rdx,WM_CLOSE
    jnz     finish

    xor     rdx,rdx
    call    EndDialog
    jmp     finish2

finish:

    xor     rax,rax
    add     rsp,4*8+8
    ret

finish2:

    mov     rax,1
    add     rsp,4*8+8
    ret

// DlgProc ENDP

hutch--

Erol,

Looks good and works fine. I confess I like GAS, close to the floorboards no garbage grunt.  :t