Hello, where are the sturcture defines, like DLGTEMPLATE,DLGITEMTEMPLATE,PROPSHEETHEADERA ...
I can't find them .
Give this tool a blast, there will always be extra structures, this tool does most of the work and you may need to manually tweak some bits of the result.
http://masm32.com/board/index.php?topic=5546.0
GOOD!
But, itt looks not simple, ha ha. :biggrin:
hutch--, thank you very much. :t
Most probably, the versions in \Masm32\include\Windows.inc will work just fine. Extract them and put them in an extra inc file.
jj2007, thanks.
Yes, may be OK.
But, the problem is that, some vars in the struct should still keep 32bit, some should be changed to 64bit. So, it's a manually work that need more patient.
Quote from: seasea on March 31, 2018, 02:45:33 PMthe problem is that, some vars in the struct should still keep 32bit, some should be changed to 64bit
Only in PROPSHEETHEADER, and it's a handful of fields that are either handles or start with "p".
Quote from: jj2007 on March 31, 2018, 03:11:56 PM
Only in PROPSHEETHEADER, and it's a handful of fields that are either handles or start with "p".
Yes, I know. So, the problem is that, there is no Micosoft's "offical" masm64 API manual.
You can always code a simple example in Micros??t Visual C, build it in 32- and 64-bit mode, and compare the structure's offsets. But trust me, handles are 32/64, and everything that starts with a "p", too.
Give the struct conversion tool a blast. It gets most of this stuff right. You will sometimes need to edit a data type manually before you hit the convert button, the problem being the VC headers use local #define statements that are hard to track down with a conversion tool.
Quote from: jj2007 on April 01, 2018, 02:24:23 AM
You can always code a simple example in Micros??t Visual C, build it in 32- and 64-bit mode, and compare the structure's offsets. But trust me, handles are 32/64, and everything that starts with a "p", too.
:t, Yes, thanks.
Quote from: hutch-- on April 01, 2018, 02:32:41 AM
Give the struct conversion tool a blast. It gets most of this stuff right. You will sometimes need to edit a data type manually before you hit the convert button, the problem being the VC headers use local #define statements that are hard to track down with a conversion tool.
OK, hutch--, Thanks, you are warmhearted.
Hi, seasea!
asm-file
; GUI #
include win64a.inc
IDM_SAYHELLO equ 0
IDM_GETTEXT equ 1
IDM_CLEAR equ 2
IDM_EXIT equ 3
IDC_EDIT equ 0
IDC_BUTTON equ 1
IDC_EXIT equ 2
IDC_MENU equ 100
IDC_DIALOG equ 200
;-----------------------------------------
.code
WinMain proc
local hMem:QWORD
invoke GlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT,1024 ; memory buffer size
mov hMem,rax; hDialogTemplate
mov edi,eax
mov esi,offset temp
mov ecx,len/8
rep movsq
;mov [rsp+20h],rcx; dwInitParam=0
mov r9d,offset DialogFunc
invoke DialogBoxIndirectParam,IMAGE_BASE,eax,0,,0
invoke GlobalFree,hMem
leave
retn
WinMain endp
DialogFunc proc hDlg:QWORD,uMsg:QWORD,wParam:QWORD,lParam:QWORD
size_of_buffer equ 96
local buffer[size_of_buffer]:BYTE
cmp edx,WM_CLOSE
je wmCLOSE
cmp edx,WM_INITDIALOG
je wmINITDIALOG
cmp edx,WM_COMMAND
jne wmBYE
wmCOMMAND:movzx eax,r8w ;movzx eax,word ptr wParam
or r9,r9 ;cmp lParam,0
jnz @f
jmp [menu_handlers+rax*8]
@@: dec eax ;cmp eax,IDC_BUTTON=1
jne @f
SAYHELLO:mov r8d,offset expTxt
jmp @0
@@: dec eax ;cmp eax,IDC_EXIT=2
jne wmBYE
invoke SendMessage,,WM_CLOSE,0,0
jmp wmBYE
wmINITDIALOG:invoke GetDlgItem,,0
invoke SetFocus,eax
jmp wmBYE
CLEAR:xor r8d,r8d
@0: invoke SetDlgItemText,,0
jmp wmBYE
GETTEXT:lea r8d,buffer
invoke GetDlgItemText,,0,,size_of_buffer
mov r8d,offset AppName
lea edx,buffer
invoke MessageBox,0,,,MB_OK
jmp wmBYE
wmCLOSE:invoke EndDialog,,0
wmBYE:xor eax,eax
leave
retn
menu_handlers dq SAYHELLO,GETTEXT,CLEAR,wmCLOSE
DialogFunc endp
.data
expTxt db "Wow! I'm in an edit box now",0
AppName db 'Our First Dialog Box',0
align 16
temp:
dd DS_CENTER or WS_CAPTION or WS_MINIMIZEBOX or WS_SYSMENU \
or WS_VISIBLE or WS_OVERLAPPED or DS_MODALFRAME or DS_3DLOOK,0
dw 3,10,10,205,60,-1,IDC_MENU,0
du <Tutorial 10g: DialogBoxIndirectParam+DlgProc>
dw 0
dd WS_VISIBLE or WS_CHILD or ES_LEFT or ES_AUTOHSCROLL or WS_BORDER or WS_TABSTOP,0
dw 15,17,111,13,IDC_EDIT, -1,81h
dw 0,0,0
dd WS_VISIBLE or WS_CHILD or WS_TABSTOP or BS_DEFPUSHBUTTON,0
dw 141,10,52,13,IDC_BUTTON,-1,80h
du <Say Hello>
dw 0
dd WS_VISIBLE or WS_CHILD or WS_TABSTOP,0
dw 141,26,52,13,IDC_EXIT, -1,80h
du <E&xit>
dw 0
len = $ - temp
end
rc-file#include "resource.h"
#define IDM_SAYHELLO 0
#define IDM_GETTEXT 1
#define IDM_CLEAR 2
#define IDM_EXIT 3
#define IDC_EDIT 0
#define IDC_BUTTON 1
#define IDC_EXIT 2
#define IDC_MENU 100
#define IDC_DIALOG 200
IDC_MENU MENU
BEGIN
POPUP "Test Controls"
BEGIN
MENUITEM "Say Hello",IDM_SAYHELLO
MENUITEM "Get Text",IDM_GETTEXT
MENUITEM "Clear Edit Box",IDM_CLEAR
MENUITEM SEPARATOR
MENUITEM "E&xit",IDM_EXIT
END
END
Quote from: Mikl__ on April 02, 2018, 09:17:17 PM
Hi, seasea!
asm-file
; GUI #
.......
.......
temp:
dd DS_CENTER or WS_CAPTION or WS_MINIMIZEBOX or WS_SYSMENU \
or WS_VISIBLE or WS_OVERLAPPED or DS_MODALFRAME or DS_3DLOOK,0
dw 3,10,10,205,60,-1,IDC_MENU,0
du <Tutorial 10g: DialogBoxIndirectParam+DlgProc>
dw 0
dd WS_VISIBLE or WS_CHILD or ES_LEFT or ES_AUTOHSCROLL or WS_BORDER or WS_TABSTOP,0
dw 15,17,111,13,IDC_EDIT, -1,81h
dw 0,0,0
dd WS_VISIBLE or WS_CHILD or WS_TABSTOP or BS_DEFPUSHBUTTON,0
dw 141,10,52,13,IDC_BUTTON,-1,80h
du <Say Hello>
dw 0
dd WS_VISIBLE or WS_CHILD or WS_TABSTOP,0
dw 141,26,52,13,IDC_EXIT, -1,80h
du <E&xit>
dw 0
len = $ - temp
end
......
......
Yep, that's pretty clear :t
Thank you, Mikl__.
And, one small question, what's the meaning "du", I didn't know it, and I had never used it. :redface:
Quotewhat's the meaning "du",
Hi,
seasea!
It is macro for create unicode-strings, my native language is russian, for cyrillic letters are 0400—04FF, for latin letters are 0041-007A
du macro string
local bslash
bslash = 0
irpc c,<string>
if bslash eq 0
if '&c' eq "/"
bslash = 1
elseif '&c'gt 127
db ('&c'- 0B0h),4
else
dw '&c'
endif
else
bslash = 0
if '&c' eq "n"
DW 0Dh,0Ah
elseif '&c' eq "/"
dw '/'
elseif '&c' eq "r"
dw 0Dh
elseif '&c' eq "l"
dw 0Ah
elseif '&c' eq "s"
dw 20h
elseif '&c' eq "c"
dw 3Bh
elseif '&c' eq "t"
dw 9
endif
endif
endm
dw 0
endm
Quote from: Mikl__ on April 04, 2018, 01:35:25 AM
Quotewhat's the meaning "du",
Hi, seasea!
It is macro for create unicode-strings, my native language is russian, for cyrillic letters are 0400—04FF, for latin letters are 0041-007A
OK, that's pretty good. :t :icon14: