News:

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

Main Menu

Problems translation of Iczelion tutorial from x86 to 64

Started by Mikl__, June 19, 2015, 03:41:41 PM

Previous topic - Next topic

Mikl__

Alone transfer the lessons of Iczelion I can't cope. Please help me!
Tutorial #27: Tooltip Control
a program is written exactly as a program for x86, except for passing parameters to procedures, but do not show tooltips. Why?
original text of tutorial #27.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\comctl32.inc
includelib \masm32\lib\comctl32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
DlgProc proto :DWORD,:DWORD,:DWORD,:DWORD
EnumChild proto :DWORD,:DWORD
SetDlgToolArea proto :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
.const
IDD_MAINDIALOG equ 101
.data
ToolTipsClassName db "Tooltips_class32",0
MainDialogText1 db "This is the upper left area of the dialog",0
MainDialogText2 db "This is the upper right area of the dialog",0
MainDialogText3 db "This is the lower left area of the dialog",0
MainDialogText4 db "This is the lower right area of the dialog",0
.data?
hwndTool dd ?
hInstance dd ?
.code
start:
    invoke GetModuleHandle,NULL
    mov hInstance,eax
    invoke DialogBoxParam,hInstance,IDD_MAINDIALOG,NULL,addr DlgProc,NULL
    invoke ExitProcess,eax
DlgProc proc hDlg:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
    LOCAL ti:TOOLINFO
    LOCAL id:DWORD
    LOCAL rect:RECT
    .if uMsg==WM_INITDIALOG
        invoke InitCommonControls
        invoke CreateWindowEx,NULL,ADDR ToolTipsClassName,NULL,\
            TTS_ALWAYSTIP,CW_USEDEFAULT,\
            CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,\
            hInstance,NULL
        mov hwndTool,eax
        mov id,0
        mov ti.cbSize,sizeof TOOLINFO
        mov ti.uFlags,TTF_SUBCLASS
        push hDlg
        pop ti.hWnd
        invoke GetWindowRect,hDlg,addr rect
        invoke SetDlgToolArea,hDlg,addr ti,addr MainDialogText1,id,addr rect
        inc id
        invoke SetDlgToolArea,hDlg,addr ti,addr MainDialogText2,id,addr rect
        inc id
        invoke SetDlgToolArea,hDlg,addr ti,addr MainDialogText3,id,addr rect
        inc id
        invoke SetDlgToolArea,hDlg,addr ti,addr MainDialogText4,id,addr rect
        invoke EnumChildWindows,hDlg,addr EnumChild,addr ti
    .elseif uMsg==WM_CLOSE
        invoke EndDialog,hDlg,NULL
    .else
        mov eax,FALSE
        ret
    .endif
    mov eax,TRUE
    ret
DlgProc endp

EnumChild proc uses edi hwndChild:DWORD,lParam:DWORD
    LOCAL buffer[256]:BYTE
    mov edi,lParam
    assume edi:ptr TOOLINFO
    push hwndChild
    pop [edi].uId
    or [edi].uFlags,TTF_IDISHWND
    invoke GetWindowText,hwndChild,addr buffer,255
    lea eax,buffer
    mov [edi].lpszText,eax
    invoke SendMessage,hwndTool,TTM_ADDTOOL,NULL,edi
    assume edi:nothing
    ret
EnumChild endp

SetDlgToolArea proc uses edi esi hDlg:DWORD,lpti:DWORD,lpText:DWORD,id:DWORD,lprect:DWORD
    mov edi,lpti
    mov esi,lprect
    assume esi:ptr RECT
    assume edi:ptr TOOLINFO
    .if id==0
        mov [edi].rect.left,0
        mov [edi].rect.top,0
        mov eax,[esi].right
        sub eax,[esi].left
        shr eax,1
        mov [edi].rect.right,eax
        mov eax,[esi].bottom
        sub eax,[esi].top
        shr eax,1
        mov [edi].rect.bottom,eax
    .elseif id==1
        mov eax,[esi].right
        sub eax,[esi].left
        shr eax,1
        inc eax
        mov [edi].rect.left,eax
        mov [edi].rect.top,0
        mov eax,[esi].right
        sub eax,[esi].left
        mov [edi].rect.right,eax
        mov eax,[esi].bottom
        sub eax,[esi].top
        mov [edi].rect.bottom,eax
    .elseif id==2
        mov [edi].rect.left,0
        mov eax,[esi].bottom
        sub eax,[esi].top
        shr eax,1
        inc eax
        mov [edi].rect.top,eax
        mov eax,[esi].right
        sub eax,[esi].left
        shr eax,1
        mov [edi].rect.right,eax
        mov eax,[esi].bottom
        sub eax,[esi].top
        mov [edi].rect.bottom,eax
    .else
        mov eax,[esi].right
        sub eax,[esi].left
        shr eax,1
        inc eax
        mov [edi].rect.left,eax
        mov eax,[esi].bottom
        sub eax,[esi].top
        shr eax,1
        inc eax
        mov [edi].rect.top,eax
        mov eax,[esi].right
        sub eax,[esi].left
        mov [edi].rect.right,eax
        mov eax,[esi].bottom
        sub eax,[esi].top
        mov [edi].rect.bottom,eax
    .endif
    push lpText
    pop [edi].lpszText
    invoke SendMessage,hwndTool,TTM_ADDTOOL,NULL,lpti
    assume edi:nothing
    assume esi:nothing
    ret
SetDlgToolArea endp
end start
Win x64 Tutorial #27OPTION DOTNAME
include temphls.inc
include win64.inc
include kernel32.inc
includelib kernel32.lib
include user32.inc
includelib user32.lib
include comctl32.inc
includelib comctl32.lib

OPTION PROLOGUE:none
OPTION EPILOGUE:none
IMAGE_BASE equ 400000h
IDD_MAINDIALOG equ 101

.code
WinMain proc
xor ebx,ebx
push rbx
mov r9d,offset DlgProc
mov r8,rbx
mov edx,IDD_MAINDIALOG
mov ecx,IMAGE_BASE
sub esp,20h
call DialogBoxParam
xor ecx,ecx
call ExitProcess
WinMain endp
DlgProc proc hDlg:QWORD,uMsg:QWORD,wParam:QWORD,lParam:QWORD
LOCAL ti:TOOLINFO
LOCAL id:QWORD
LOCAL rect:RECT
push rbp
mov ebp,esp
sub esp,(20h+sizeof RECT+sizeof TOOLINFO+8+15)and(-16)
mov hDlg,rcx
mov wParam,r8
mov lParam,r9

cmp edx,WM_INITDIALOG
je wmINITDIALOG
cmp edx,WM_CLOSE
je wmCLOSE
xor eax,eax;mov eax,FALSE
leave
retn
wmINITDIALOG:call InitCommonControls
push rbx
mov eax,IMAGE_BASE
push rax
push rbx
push rbx
shl eax,9
push rax;CW_USEDEFAULT
push rax;CW_USEDEFAULT
push rax;CW_USEDEFAULT
push rax;CW_USEDEFAULT
mov r9d,TTS_ALWAYSTIP
mov r8,rbx
mov edx,offset ToolTipsClassName
xor ecx,ecx
sub esp,20h
call CreateWindowEx            
mov hwndTool,rax
mov id,rbx
mov ti.cbSize,sizeof TOOLINFO
mov ti.uFlags,TTF_SUBCLASS
mov rcx,hDlg
mov ti.hwnd,rcx
lea edx,rect
call GetWindowRect
lea eax,rect
mov [esp+20h],rax
mov r9,id
mov r8d,offset MainDialogText1
lea edx,ti
mov rcx,hDlg
call SetDlgToolArea
inc id
lea eax,rect
mov [esp+20h],rax
mov r9,id
mov r8d,offset MainDialogText2
lea edx,ti
mov rcx,hDlg
call SetDlgToolArea
inc id
lea eax,rect
mov [esp+20h],rax
mov r9,id
mov r8d,offset MainDialogText3
lea edx,ti
mov rcx,hDlg
call SetDlgToolArea
inc id
lea eax,rect
mov [esp+20h],rax
mov r9,id
mov r8d,offset MainDialogText4
lea edx,ti
mov rcx,hDlg
call SetDlgToolArea
lea r8,ti
mov edx,offset EnumChild
mov rcx,hDlg
call EnumChildWindows
jmp wmBYE
wmCLOSE:xor edx,edx
;mov rcx,hDlg
call EndDialog
wmBYE:  leave
mov eax,TRUE
retn
DlgProc endp
EnumChild proc hwndChild:QWORD,lParam:QWORD
LOCAL buffer[256]:BYTE
local old_rdi:QWORD
push rbp
mov ebp,esp
sub esp,(20h+256+8+15)and(-16)

mov hwndChild,rcx
mov lParam,rdx
mov old_rdi,rdi
mov edi,edx;lParam
mov [rdi+TOOLINFO.uId],ecx
or [rdi+TOOLINFO.uFlags],TTF_IDISHWND
mov r8d,255
lea edx,buffer
;mov rcx,hwndChild
call GetWindowText
lea eax,buffer
mov [rdi+TOOLINFO.lpszText],rax
mov r9,rdi
mov r8,rbx;NULL
mov edx,TTM_ADDTOOL
mov rcx,hwndTool
call SendMessage
mov rdi,old_rdi
leave
retn
EnumChild endp
SetDlgToolArea proc hDlg:QWORD,lpti:QWORD,lpText:QWORD,id:QWORD,lprect:QWORD
local old_rdi:qword
local old_rsi:qword

push rbp
mov ebp,esp
sub esp,20h+16

mov old_rdi,rdi
mov old_rsi,rsi

mov hDlg,rcx
mov lpti,rdx
mov lpText,r8
mov id,r9

mov edi,edx;lpti
mov rsi,lprect

cmp id,rbx;.if id==0
jnz @f
mov [rdi+TOOLINFO.Rect.left],0
mov [rdi+TOOLINFO.Rect.top],0
mov eax,[rsi+RECT.right]
sub eax,[rsi+RECT.left]
shr eax,1
mov [rdi+TOOLINFO.Rect.right],eax
mov eax,[rsi+RECT.bottom]
sub eax,[rsi+RECT.top]
shr eax,1
mov [rdi+TOOLINFO.Rect.bottom],eax
jmp wmBYE
@@: cmp id,1
jnz @f
mov eax,[rsi+RECT.right]
sub eax,[rsi+RECT.left]
shr eax,1
inc eax
mov [rdi+TOOLINFO.Rect.left],eax
mov [rdi+TOOLINFO.Rect.top],0
mov eax,[rsi+RECT.right]
sub eax,[rsi+RECT.left]
mov [rdi+TOOLINFO.Rect.right],eax
mov eax,[rsi+RECT.bottom]
sub eax,[rsi+RECT.top]
mov [rdi+TOOLINFO.Rect.bottom],eax
jmp wmBYE
@@: cmp id,2
jnz @f
mov [rdi+TOOLINFO.Rect.left],0
mov eax,[rsi+RECT.bottom]
sub eax,[rsi+RECT.top]
shr eax,1
inc eax
mov [rdi+TOOLINFO.Rect.top],eax
mov eax,[rsi+RECT.right]
sub eax,[rsi+RECT.left]
shr eax,1
mov [rdi+TOOLINFO.Rect.right],eax
mov eax,[rsi+RECT.bottom]
sub eax,[rsi+RECT.top]
mov [rdi+TOOLINFO.Rect.bottom],eax
jmp wmBYE
@@: mov eax,[rsi+RECT.right]
sub eax,[rsi+RECT.left]
shr eax,1
inc eax
mov [rdi+TOOLINFO.Rect.left],eax
mov eax,[rsi+RECT.bottom]
sub eax,[rsi+RECT.top]
shr eax,1
inc eax
mov [rdi+TOOLINFO.Rect.top],eax
mov eax,[rsi+RECT.right]
sub eax,[rsi+RECT.left]
mov [rdi+TOOLINFO.Rect.right],eax
mov eax,[rsi+RECT.bottom]
sub eax,[rsi+RECT.top]
mov [rdi+TOOLINFO.Rect.bottom],eax
wmBYE: mov rax,lpText
mov [rdi+TOOLINFO.lpszText],rax
mov r9,lpti
mov r8,rbx
mov edx,TTM_ADDTOOL
mov rcx,hwndTool
call SendMessage
mov rdi,old_rdi
mov rsi,old_rsi
leave
retn
SetDlgToolArea endp
;----------------------------------------------------------------
ToolTipsClassName db "Tooltips_class32",0
MainDialogText1 db "This is the upper left area of the dialog",0
MainDialogText2 db "This is the upper right area of the dialog",0
MainDialogText3 db "This is the lower left area of the dialog",0
MainDialogText4 db "This is the lower right area of the dialog",0
hwndTool dq ?
end
rc-file#include "resource.h"
#define IDD_MAINDIALOG                  101
#define IDC_OK                          1000
#define IDC_EXIT                        1001
IDD_MAINDIALOG DIALOG DISCARDABLE  0, 0, 229, 96
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION |
    WS_SYSMENU | DS_CENTER
CAPTION "Tooltip Example"
FONT 8, "MS Sans Serif"
BEGIN
    PUSHBUTTON      "OK",IDC_OK,55,68,50,14
    PUSHBUTTON      "E&xit",IDC_EXIT,123,68,50,14
END

jj2007


rrr314159

Couldn't find

comctl32.inc
comclt32.lib

looked thru all your previous postings

Went to this site:

On the site http://dsmhelp.narod.ru/environment.htm you can find a set of lib- and inc-files

Couldn't find it, maybe since it's not in English

Tried Japheth's COMMCTRL.INC and ComCtl32.lib but not compatible

Tried using only Japheth's incs and libs (starting with kernel32 etc), but too many incompatibilities. They do work with JWasm. Considered using that instead of ml64 but instead, assumed something would go wrong, and

gave up

So please post those two files or tell where to get them
I am NaN ;)

Mikl__

QuoteCheck the value of rbx after wmINITDIALOG:
Hi, jj2007!
rbx=0
Hi, rrr314159!
zip-file for you...

rrr314159

thanks miki! I don't care what they say, you're alright :biggrin:
I am NaN ;)

jj2007

Quote from: Mikl__ on June 20, 2015, 10:30:35 AM
QuoteCheck the value of rbx after wmINITDIALOG:
Hi, jj2007!
rbx=0

I'm not an expert for x64, and I can't even build your code, but in x86 ebx=1 at that point - independently of what you put into it in WinMain. DlgProc is a callback, the protected registers can have any value... so that was my best guess. What does GetLastError return?


rrr314159

To get the code to run, I needed to do 2 things,

just after

wmINITDIALOG:call InitCommonControls

put

xor rbx, rbx

and, just in front of

hwndTool dq ?

put

align 8

I also removed the "IMAGE_BASE equ 400000h" together with the associated link options, because I couldn't get it to run that way. The linker complained there was something wrong with stubby.exe header, "build with /KNOWEAS 16-bit"; and, "/ALIGN specified without /DRIVER". No doubt it would work if I was familiar with that technique, but ...

So I just used GetModuleHandle to find hInstance, and made appropriate mods.

Now it works, brings up window with the 2 buttons, but no #$%^&*( tooltips!

Time to take a break ...

If jj or anyone else wants my modified code, which is probably more familiar to most people, let me know.
I am NaN ;)

rrr314159

Well I got the tool tips working, but only by using JWasm and Japheth's includes and libs, and my own invoke macro. The includes are very different from yours, Miki, but I suppose the libs are the same? Anyway if anyone wants to see it let me know. I wasn't able to get it working with those include files, or ML64, or the invoke macro included in temphls.inc, although no doubt it can be done.
I am NaN ;)

Mikl__

QuoteWell I got the tool tips working, but only by using JWasm and Japheth's includes and libs, and my own invoke macro. The includes are very different from yours, Miki, but I suppose the libs are the same? Anyway if anyone wants to see it let me know. I wasn't able to get it working with those include files, or ML64, or the invoke macro included in temphls.inc, although no doubt it can be done.
rrr314159, may you attach working exe and asm/rc-files with tooltips for x64?

rrr314159

Hi Miki,

The 4 tooltips for the window areas work (e.g., "This is the upper left area of the dialog"). But I checked the 32-bit example and found there are tooltips for the buttons also - they don't work. Another peculiarity, you have to move the window before the close button (upper left corner) works. Of course these can both be fixed by intercepting messages in DlgProc but that's not the point of the example. BTW I tried it with JWasm invoke; it's a lot more trouble and doesn't fix the button tooltips.

Anyway as I said the main tooltips work. I changed iczelion's 32-bit example as follows:

change ti.hWnd to ti.hwnd - for some reason Japheth spells it that way

use edx instead of uMsg in comparisons (e.g. edx==WM_CLOSE)

In all "assume" statements change esi and edi to rsi and rdi

Change the 3 proc defn's as follows (4 DWORD's => QWORD's, and uses rdi rsi):

DlgProc proc hDlg:QWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
EnumChild proc uses rdi hwndChild:QWORD,lParam:DWORD
SetDlgToolArea proc uses rdi rsi hDlg:QWORD, lpti:DWORD, lpText:QWORD, id:DWORD, lprect:DWORD

... and either change the 3 proto's to match, or else simply remove them

make this dq instead of dd:

hwndTool dd ?

and make this rax instead of eax:

mov [edi].lpszText,eax

You need 3 new includes from Japheth, (change path as appropriate), but can use your existing lib's:

include  \inc\windows.inc
include  \inc\winuser.inc
include \inc\CommCtrl.inc

Finally add this include:

include invoke_macros.asm

The first zip contains:

tut_27_64.asm: iczelion's example modified as above
tut_27_64.exe
invoke_macros.asm: invoke replacement (works with ML64 also)
tut_27.rc: no changes needed
Resource.h: no changes
dotut_27_64.bat: make file

and the second zip has the 3 include files
I am NaN ;)

six_L

hi,rrr314159
the tut_27_64.exe can't exit from windows7 64 p sp1.
Say you, Say me, Say the codes together for ever.

rrr314159

#11
Hi six_L,

Did u move the window first? As I mentioned, the exit button (in top right corner) works only after u move the window. Don't know why. Mikl__ asked about the tooltips so once I got that working I left it at that, there was one other small problem (see my first para above). IF you mean it still won't exit even after u move the window - it must be related to the same problem. Hadn't intended to try to fix it; I might look at it; if u figure it out let us know!

It's worth noting, I've converted dozens of windows progs from 32-bit successfully with this technique. This is first time I dealt with Common Controls, though. Maybe one more argument needs to be changed from dword to qword (that's done automatically by my invoke macro, but sometimes a conversion detail must be dealt with "by hand"). If you use JWasm invoke instead, it will reveal such arguments, because it checks the proto statement; alternatively, u can study the proto in the include file. But in this case, I did so (required quite a few changes to finally get JWasm invoke to work) but it still didn't fix the problem.

I don't doubt, if u mess around with it, it's fixable.

BTW if people want me to fix it I'll do so, but since Mikl__ didn't respond I figured he had done it himself
I am NaN ;)

Mikl__

Hi, rrr314159!
I'm sorry, that did not answer right away, but I have Windows 7 Prof x64 and your tut_27_64 not shows tooltips

rrr314159

Looks like you're right. It works on my Windows 8, though. I'll take a look at it ...

[edit] No good, tried it with your include files, and also with JWasm invoke, still doesn't work on 7. It works on Windows 8 using Japheth's includes, not with yours. So, recommend you try your version with the includes I provided; they define TOOLINFO differently, that might have something to do with it. Apart from that, I give up for now
I am NaN ;)

Mikl__

problem solved
asm-fileinclude win64a.inc
IMAGE_BASE equ 400000h
IDD_MAINDIALOG equ 101
.code
WinMain proc
sub esp,38h
xor r8d,r8d
mov [rsp+20h],r8
mov r9d,offset dialog_procedure
mov edx,IDD_MAINDIALOG
mov ecx,IMAGE_BASE
call DialogBoxParam
xor ecx,ecx
call ExitProcess
        call InitCommonControls
WinMain endp
dialog_procedure proc hDlg:QWORD,uMsg:QWORD,wParam:QWORD,lParam:QWORD
local ti:TOOLINFO
local rect:RECT
push rbp
mov ebp,esp
sub esp,(20h+sizeof TOOLINFO+sizeof RECT+15)and(-16)
mov hDlg,rcx

cmp edx,WM_INITDIALOG
je wmINITDIALOG
cmp edx,WM_CLOSE
je wmCLOSE
xor eax,eax
jmp wmBYE

wmINITDIALOG:xor ecx,ecx
mov esi,IMAGE_BASE
push rcx
push rsi
push rcx
push rcx
shl esi,9
push rsi
push rsi
push rsi
push rsi
mov r9d,TTS_ALWAYSTIP
xor r8d,r8d
mov edx,offset ToolTipsClassName
sub esp,20h
call CreateWindowEx
mov hwndTool,rax
mov ti.cbSize,sizeof TOOLINFO
mov ti.uFlags,TTF_SUBCLASS
mov rcx,hDlg
mov ti.hwnd,rcx
lea edx,rect
call GetWindowRect
mov ebx,3
@@: lea ecx,rect
mov r9d,ebx
mov r8,handle[rbx*8]
lea edx,ti
call SetDlgToolArea
dec ebx
jns @b

lea r8d,ti
mov edx,offset EnumChild
mov rcx,hDlg
call EnumChildWindows
jmp wmBYE
wmCLOSE:xor edx,edx
;mov rcx,hDlg
call EndDialog
wmBYE: leave
ret
dialog_procedure endp
EnumChild proc hwndChild:QWORD,lParam:QWORD
local buffer[256]:BYTE
push rbp
mov ebp,esp
sub esp,(20h+256+15)and(-16)
mov lParam,rdx
mov [rdx+TOOLINFO.uId],rcx;rcx=hwndChild
or [rdx+TOOLINFO.uFlags],TTF_IDISHWND
mov r8d,255
lea edx,buffer
;mov rcx,hwndChild
invoke GetWindowText
lea eax,buffer
mov r9,lParam
mov [r9+TOOLINFO.lpszText],rax
xor r8d,r8d
mov edx,TTM_ADDTOOL
mov rcx,hwndTool
call SendMessage
leave
retn
EnumChild endp
SetDlgToolArea proc lprect:QWORD,lpti:QWORD,lpText:QWORD,id:QWORD
push rbp
mov ebp,esp
sub esp,20h

jmp [handels+r9*8]
id_0: mov [rdx+TOOLINFO.Rect.left],0
mov [rdx+TOOLINFO.Rect.top],0
mov eax,[rcx+RECT.right]
sub eax,[rcx+RECT.left]
shr eax,1
mov [rdx+TOOLINFO.Rect.right],eax
mov eax,[rcx+RECT.bottom]
sub eax,[rcx+RECT.top]
shr eax,1
jmp wmBYE
id_1: mov eax,[rcx+RECT.right]
sub eax,[rcx+RECT.left]
shr eax,1
inc eax
mov [rdx+TOOLINFO.Rect.left],eax
mov [rdx+TOOLINFO.Rect.top],0
mov eax,[rcx+RECT.right]
sub eax,[rcx+RECT.left]
jmp a1
id_2: mov [rdx+TOOLINFO.Rect.left],0
mov eax,[rcx+RECT.bottom]
sub eax,[rcx+RECT.top]
shr eax,1
inc eax
mov [rdx+TOOLINFO.Rect.top],eax
mov eax,[rcx+RECT.right]
sub eax,[rcx+RECT.left]
shr eax,1
jmp a1
id_3: mov eax,[rcx+RECT.right]
sub eax,[rcx+RECT.left]
shr eax,1
inc eax
mov [rdx+TOOLINFO.Rect.left],eax
mov eax,[rcx+RECT.bottom]
sub eax,[rcx+RECT.top]
shr eax,1
inc eax
mov [rdx+TOOLINFO.Rect.top],eax
mov eax,[rcx+RECT.right]
sub eax,[rcx+RECT.left]
a1: mov [rdx+TOOLINFO.Rect.right],eax
mov eax,[rcx+RECT.bottom]
sub eax,[rcx+RECT.top]
wmBYE: mov [rdx+TOOLINFO.Rect.bottom],eax
mov [rdx+TOOLINFO.lpszText],r8;lpText
mov r9d,edx;lpti
xor r8d,r8d;NULL
mov edx,TTM_ADDTOOL
mov rcx,hwndTool
call SendMessage
leave
ret
handels dq id_0, id_1, id_2, id_3
SetDlgToolArea endp
;---------------------------------------------------------
ToolTipsClassName db "Tooltips_class32",0
MainDialogText1 db "This is the upper left area of the dialog",0
MainDialogText2 db "This is the upper right area of the dialog",0
MainDialogText3 db "This is the lower left area of the dialog",0
MainDialogText4 db "This is the lower right area of the dialog",0
handle dq MainDialogText1,MainDialogText2,MainDialogText3,MainDialogText4
hwndTool dq ?
end
rc-file#include "resource.h"
#define IDD_MAINDIALOG                  101
#define IDC_OK                          1000
#define IDC_EXIT                        1001
IDD_MAINDIALOG DIALOG DISCARDABLE  0, 0, 229, 96
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION |
    WS_SYSMENU | DS_CENTER
CAPTION "Tooltip Example"
FONT 8, "MS Sans Serif"
BEGIN
    PUSHBUTTON      "",  -1,0,  -4,115,51,WS_VISIBLE+BS_GROUPBOX
    PUSHBUTTON      "",  -1,114,43,115,53,WS_VISIBLE+BS_GROUPBOX
    PUSHBUTTON      "OK",IDC_OK,55,68,50,14
    PUSHBUTTON      "E&xit",IDC_EXIT,123,68,50,14
END
the mistake was in the structureTOOLINFO STRUCT
  cbSize   DWORD ?
  uFlags   DWORD ?
  hwnd    QWORD ?
  uId    QWORD ? <-- There was DWORD
  Rect    RECT <>
           ;DWORD ? <-- commented out
  hInst    QWORD ?
  lpszText QWORD ?
TOOLINFO ENDS
there are folder with include-files, asm-/rc-/exe-files in attachment