flat assembler
Message board for the users of flat assembler.

Index > Windows > [solved] NMHDR NMBCDROPDOWN etc

Author
Thread Post new topic Reply to topic
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
Hi
How can I declare and use this structure names if it's address unknown until windows send it by WM_NOTIFY in lParam?
I doing it brytally for now:
Code:
wm_notify:
        mov             eax,[r9+16]                ;   [StrucName.code]
        cmp             eax,BCN_DROPDOWN
        je              bcn_dropdown
        xor             rax,rax
        ret
        bcn_dropdown:
                mov             eax,[r9+8]              ;    [StrucName.idFrom]
                cmp             eax,IDC_Button
...
    

I wish to use declared names as marked in comments


Last edited by Overclick on 26 Aug 2020, 18:11; edited 1 time in total
Post 26 Aug 2020, 15:28
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3045
Location: vpcmipstrm
bitRAKE
mov [r9+NMHDR.code]

if the offsets for the structure is not defined, then:
Code:
virtual at 0
NMHDR NMHDR
end virtual    
...will define them. IIRC, the struct macro defines them. It's like they are identity mapped to a structure of their own name at zero.

_________________
¯\(°_o)/¯ unlicense.org
Post 26 Aug 2020, 16:59
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
Nice thanks
Post 26 Aug 2020, 18:10
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 815
Roman
What if struct do like this ? :
Code:
StrucName.code EQU 16
StrucName.idFrom EQU 8
    
Post 26 Aug 2020, 18:18
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
Roman, NMHDR is already in fasm includes but why not. I was looking for some universal metod to do it once for all.
Post 26 Aug 2020, 18:29
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3045
Location: vpcmipstrm
bitRAKE
Code:
virtual at r9
nmhdr NMHDR
end virtual

mov eax,[nmhdr.code]    
Is also possible, and might reduce confusion when working with several similar structures. It all depends on what you prefer to look at.

_________________
¯\(°_o)/¯ unlicense.org
Post 26 Aug 2020, 19:22
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
bitRAKE, Will it take current r9 every time? Then it is awesome!
Post 26 Aug 2020, 19:36
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17665
Location: In your JS exploiting you and your system
revolution
If I have a structure instantiation that uses a fixed register I like to show it in the name to avoid confusion and to help me six months later when I come back to the code.
Code:
virtual at r9
nmhdr@r9 NMHDR
end virtual    
Post 26 Aug 2020, 22:52
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.