Interpreting Bitfield Properties

Some SMS object properties are implemented as bit fields, where individual binary bits of an integer (usually a uint32) are used as Boolean flags to store information. These properties can be difficult to interpret at the user interface because the bitfield is often display as a decimal number.

For instance, the Security User Class Permissions object (SMS_UserClassPermissions) contains an integer property called ClassPermissions defined as an int32 with the following bit `flags:

Bit 0 = READ
Bit 1 = MODIFY
Bit 2 = DELETE
Bit 3 = DISTRIBUTE
Bit 4 = CREATE_CHILD
Bit 5 = REMOTE_CONTROL
Bit 6 = ADVERTISE
Bit 7 = MODIFY_RESOURCE
Bit 8 = ADMINISTER
Bit 9 = DELETE_RESOURCE
Bit 10 = CREATE
Bit 11 = VIEW_COLL_FILE
Bit 12 = READ_RESOURCE

A typical value of this bit field might be 10100000111. Bit 0 is the least significant bit (on the right) and the other bits are counted right-to-left. Therefore, in this example, the available class permissions include READ, MODIFY, DELETE, ADMINISTER, and CREATE, corresponding to bit fields 0, 1, 2, 8 and 10, respectively.

The difficulty arises when the binary number 10100000111 appears as the decimal number 1287 in an SMS Administrator console display. How do you interpret the bits? The solution is to open the Windows NT Calculator application (calc.exe, in the Accessories group). Use the “scientific” view and set the calculator for decimal mode. Key in the number 1287. Use the radio buttons on the face of the calculator to convert to a binary display. The binary bitfield 10100000111 appears. You can read off the selected bit flags from this display.


Note   In a typical bitfield property, many of the bits are unused and have no defined meaning.