Delen via


DCM and Two's Complement

My mathematics and computer science lesson for the day came when creating a Desired Configuration Management (DCM) configuration item (CI) setting for the TCP/IP v6 DisabledComponents registry value. (See Microsoft Support Article ID: 929852, How to disable certain Internet Protocol version 6 [IPv6] components in Windows Vista, Windows 7, and Windows Server 2008 for more information.)  With the appropriate group policy settings applied to the target Windows 7 workstations, HKLM\SYSTEM\CurrentControlSet\Services\TCPIPv6\Parameters\DisabledComponents was set to REG_DWORD 0xffffffff, which the Registry Editor so kindly translated to the decimal value 4294967295.

In the DCM CI I created a new registry setting with the validation for this value.  With the data type set to Integer, entering this large value resulted in the text validation error (red exclamation point next to the field), "Invalid integer value."  So I changed the data type to Floating Point, which allowed it to accept 4294967295. 

However, when I tested this against a target system it evaluated non-compliant.  The current value of the setting showed to be -1, which obviously is not equal to 4294967295.  I modified the CI setting to validate the registry value as an Integer data type, value -1, and the client then evaluated this as compliant.

Perplexed, I sought the reason behind why the REG_DWORD value 0xffffffff is interpreted as -1.  I discovered the computer arithmetic concept of two's complement.  Pulling up the Windows 7 Calculator in Programmer mode, I switched to Hex and Dword, typed FFFF FFFF, and then switched to Dec mode, which translates to -1.

While the mathematics behind this is still a bit over my head (a math major friend from college commented, "Two's complement rears its elegant ugly head") I thought I would share this for the fun (albeit dorky) lesson and yet another interesting quirk with DCM.