Jump to content
Sign in to follow this  

Creating A 45bits Struct

Recommended Posts


I want do call to SHGetSettings and it need a pointer to a struct SHELLSTATE

typedef struct {
    BOOL fShowAllObjects:1;
    BOOL fShowExtensions:1;
    BOOL fNoConfirmRecycle:1;
    BOOL fShowSysFiles:1;
    BOOL fShowCompColor:1;
    BOOL fDoubleClickInWebView:1;
    BOOL fDesktopHTML:1;
    BOOL fWin95Classic:1;
    BOOL fDontPrettyPath:1;
    BOOL fShowAttribCol:1;
    BOOL fMapNetDrvBtn:1;
    BOOL fShowInfoTip:1;
    BOOL fHideIcons:1;
    UINT fRestFlags:3;

the struct has 45bits... i can't create it with DllStructCreate

or there is away around that i don't know?

Edited by raca

Share this post

Link to post
Share on other sites


thanks a lot

this what i have done, a script do disable activedesktop on winxp

DllStructSetData ($shellstate,1,0)
ControlSend("Program Manager","",1,"{F5}")

it gave me a loooot of work.... to make it work on 4 lines lol


Share this post

Link to post
Share on other sites

Actually, you're all wrong. The structure as defined is 16 bits, however, C++'s sizeof operator says it's 4 bytes (32 bits). All the BOOL values are stored in a single bit each. The unsigned integer is stored in 3 bits. This makes a total of 16 bits. You can safely store that structure in a single int. However, you have to use BitAnd() to check each of the fields since each field is a single bit. This is called (oddly enough) a bit-field. You don't need DllStruct for this at all, in fact. Use the basic int type of DllCall() and the BitAnd/BitOR functions to retrieve/set the fields. However, I don't know which 16 bits are used (the upper or lower). I also don't know why the length is padded to 32-bits when only 16 are needed.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.