What does this struct really look like?

Because the XP machines in the enterprise only guarantee the existence of .Net 2.0, I took the task to create my own Pipes namespace. So I am reading MSDN online to get constant definitions and such, and I stumbled across GENERIC_READ and GENERIC_WRITE, which can be used for named pipes. Their values, however, were not listed.

So I opened WinNT.h and looked for the definition. No problem, I found it. But I also found the following struct definition, which is actually commented out of the header. It defines a struct in a way I am not familiar with. So my question is: What is the meaning of it? Specifically, I have never seen the colons part.

1
2
3
4
5
6
7
8
9
10
11
//      typedef struct _ACCESS_MASK {
//          WORD   SpecificRights;
//          BYTE  StandardRights;
//          BYTE  AccessSystemAcl : 1;
//          BYTE  Reserved : 3;
//          BYTE  GenericAll : 1;
//          BYTE  GenericExecute : 1;
//          BYTE  GenericWrite : 1;
//          BYTE  GenericRead : 1;
//      } ACCESS_MASK;
//      typedef ACCESS_MASK *PACCESS_MASK; 
That is a bit field
eg:
 
BYTE Reserved : 3;

Creates a 3 bit integer

For the specific purpose of _ACCESS_MASK try http://msdn.microsoft.com/en-us/library/aa374892%28VS.85%29.aspx
Last edited on
I see. So if I define the above struct and print sizeof(ACCESS_MASK), I get the size of a WORD, plus the size of two BYTE's (4 bytes)?
MSDN says that it has the size of a DWORD ( = size of WORD+BYTE+BYTE )
Thanks for the confirmation. I have too many VS's open and could not afford memory to open one just to test this. Besides, it is not like I am needing it anyway. Just curious.
wish i could help
compone87! What were you thinking when you posted your comment!??
wish i could help


If you can't help, why in the hell would you post to say I can't help??!!
Thought I was the one who often posted rants...
Topic archived. No new replies allowed.