Hi, Vortex!
batcls
set pelleasm=\poasm_new
set filename=%1
if exist %filename%.exe del if exist %filename%.exe
%pelleasm%\bin\poasm /I%pelleasm%\include /AAMD64 /Gr %filename%.asm
if exist %filename%.rc (
%pelleasm%\bin\porc /I%pelleasm%\include %filename%.rc
%pelleasm%\bin\polink /SUBSYSTEM:WINDOWS /ALIGN:16 /MERGE:.data=.text ^
/LARGEADDRESSAWARE:NO /LIBPATH:%pelleasm%\lib /BASE:0x400000 ^
/STUB:%pelleasm%\bin\stubby.exe %filename%.obj %filename%.res
del %filename%.res
) else (
%pelleasm%\bin\polink /SUBSYSTEM:WINDOWS /ALIGN:16 /MERGE:.data=.text ^
/LARGEADDRESSAWARE:NO /LIBPATH:%pelleasm%\lib /BASE:0x400000 ^
/STUB:%pelleasm%\bin\stubby.exe %filename%.obj
)
del %filename%.obj
ColorDlginclude win64a.inc
IDM_ABOUT equ 11
IDM_EXIT equ 12
IDC_ABOUT equ 110
IDC_EXIT equ 120
extern __imp_ExitProcess:qword
extern __imp_DialogBoxParamA:qword
extern __imp_CreateSolidBrush:qword
extern __imp_SendMessageA:qword
extern __imp_MessageBoxA:qword
extern __imp_DeleteObject:qword
extern __imp_EndDialog:qword
.code
start: enter 30h,0
xor r8,r8
mov [rbp+20h],r8
db 41h,0B9h
dd DlgProc ;mov r9d,offset DlgProc
db 0BAh
dd Resource ;mov edx,offset Resource
mov ecx,IMAGE_BASE
call __imp_DialogBoxParamA
xor ecx,ecx
call __imp_ExitProcess
DlgProc:
hDlg equ [rbp+10h]
enter 40h,0
mov hDlg,rcx
cmp edx,WM_CLOSE
je wmCLOSE
cmp edx,WM_CTLCOLORDLG
je wmCTLCOLORDLG
cmp edx,WM_COMMAND
jne wmBYE
wmCOMMAND:movzx eax,r8w
or r9,r9 ;lParam == 0?
jnz @f
cmp ax,IDM_ABOUT ;wParam == IDM_ABOUT ?
jnz a1
db 0BAh
dd msg ;mov edx,offset msg
db 41h,0B8h
dd title1 ;mov r8d,offset title1
xor ecx,ecx
xor r9,r9
call __imp_MessageBoxA
jmp wmBYE
a1: mov ecx,[rip+brush]
call __imp_DeleteObject
xor edx,edx
mov rcx,hDlg
call __imp_EndDialog
jmp wmBYE
@@: mov rdx,r8
shr edx,16 ;cmp dx,BN_CLICKED
jnz wmBYE
xor r9,r9
mov edx,WM_COMMAND
cmp al,IDC_ABOUT
jnz @f
mov r8d,IDM_ABOUT
jmp a2
@@: mov r8d,IDM_EXIT
a2: call __imp_SendMessageA
jmp wmBYE
wmCTLCOLORDLG:mov ecx,Blue
call __imp_CreateSolidBrush
mov [rip+brush],eax
jmp a3
wmCLOSE:xor r9,r9
mov r8d,IDM_EXIT
mov edx,WM_COMMAND
call __imp_SendMessageA
wmBYE: xor eax,eax
a3: leave
retn
;------------------------------------------
Resource db 'MYDIALOG',0
msg db 'Dialog box example',0
title1 db 'About',0
brush dd ?
END start
ColorDlg.rc#include "resource.h"
LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US
MYDIALOG DIALOGEX DISCARDABLE 20, 10, 186, 94, 18481280
STYLE DS_3DLOOK|DS_CENTER|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_VISIBLE
MENU 10000
CAPTION "Dialog box"
FONT 12, "System", 700, 0, 1
{
CONTROL "&About", 110, "Button", WS_TABSTOP, 115, 22, 50, 21, 0, 1234049503
CONTROL "&Exit", 120, "Button", WS_TABSTOP, 115, 51, 50, 21, 0, 1234049503
}
10000 MENU
{
POPUP "&File"
{
MENUITEM "&About", 11
MENUITEM "&Exit", 12
}
}