Author Topic: GNU Assembler 64-bit dialog box example  (Read 172 times)

Vortex

  • Member
  • *****
  • Posts: 1691
GNU Assembler 64-bit dialog box example
« on: August 23, 2017, 05:36:32 AM »
Here is a quick example :

Code: [Select]
.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--

  • Administrator
  • Member
  • ******
  • Posts: 4752
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: GNU Assembler 64-bit dialog box example
« Reply #1 on: August 23, 2017, 12:20:09 PM »
Erol,

Looks good and works fine. I confess I like GAS, close to the floorboards no garbage grunt.  :t
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin: