flat assembler
Message board for the users of flat assembler.

Index > Windows > struct MENUITEMINFO

Author
Thread Post new topic Reply to topic
barmentalisk



Joined: 06 Sep 2005
Posts: 36
barmentalisk 31 May 2008, 07:18
If I am not mistaken, the structure MENUITEMINFO has been changed:
now it has 12 elements, all the same, but 12-th new element hbmpItem.
http://msdn.microsoft.com/en-us/library/ms647578.aspx

maybe that is why I can't get worked this:
Code:
        invoke  GetMenuItemInfo,[hmenu],21,0,menuinfo
        xor     [menuinfo.fState],MFS_CHECKED
        invoke  SetMenuItemInfo,[hmenu],21,0,menuinfo     

however
Code:
invoke  CheckMenuItem,[hmenu],21,MF_UNCHECKED    

works correct

if anyone will be pleased to give me an idea or a working code which changes flags of menu items?

p.s. sorry for my bad english
Post 31 May 2008, 07:18
View user's profile Send private message Reply with quote
barmentalisk



Joined: 06 Sep 2005
Posts: 36
barmentalisk 31 May 2008, 07:49
I've got an idea about the first sample.
Must fill fmask param of struct at the definition or later:

menuinfo MENUITEMINFO sizeof.MENUITEMINFO,MIIM_STATE
Post 31 May 2008, 07:49
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20340
Location: In your JS exploiting you and your system
revolution 31 May 2008, 08:55
You also have to set the cbSize parameter before calling Get/Set.
Post 31 May 2008, 08:55
View user's profile Send private message Visit poster's website Reply with quote
barmentalisk



Joined: 06 Sep 2005
Posts: 36
barmentalisk 02 Jun 2008, 07:03
But how many elements must have the structure to be correct?
11 or 12?
I've tested with 11 and 12. It works equal in that cases, but which is correct?

2revolution: thank you! I did it at the very begining of using the structure, but did not understand the usage fmask param.

Oh, sorry for my poor-poor english!
Post 02 Jun 2008, 07:03
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20340
Location: In your JS exploiting you and your system
revolution 02 Jun 2008, 07:29
Both 11 and 12 are correct. If you set the size as 11 dwords (44 bytes) then Windows will use the code for an 11 dword structure, and if you set the length to 12 dwords (48 bytes) then Windows will use the code for a 12 dword structure. That is why many structures in Windows have the cbSize parameter, it allows for the structure to be extended at a later date without causing compatibility problems for older code.

[edit]However, if you need your code to be the backward compatible then using the 11 element size would be the best option. If you can 100% guarantee that your code is always run in newer OSes then using either 11 or 12 will be okay.[/edit]
Post 02 Jun 2008, 07:29
View user's profile Send private message Visit poster's website Reply with quote
barmentalisk



Joined: 06 Sep 2005
Posts: 36
barmentalisk 02 Jun 2008, 09:58
Oh, man, how couldnt I get that =)
Thank you very much!
Post 02 Jun 2008, 09:58
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.