Registry Editing: How to calculate DWord Hex Values

doremi picture doremi · Sep 30, 2011 · Viewed 33.3k times · Source

I'm trying to make some registry edits and I'm not sure I understand how specific dword values are calculated.

Here are two examples:

 [HKEY_CURRENT_USER\ControlPanel\Volume]
 "Volume"=dword:0xFFFFFFFF ; 0=off, 0xFFFFFFFF=maximum

 "Refresh"=dword:493E0 ; every 5 minutes

For the volume, how would I calculate what the range of options are if 0xFFFFFFFF is the max? And for "Refresh", if 493E0 is every 5 minutes, how do I figure out what every minute, or every day or every hour would be?

This is a Motorola Symbol MK4000 WinCE 5.0 device.

Answer

ctacke picture ctacke · Sep 30, 2011

Volume is splt in 2. The low word is left and the high word is right. 0xffff on a channel corresponds to 100% or "max". 50% is 0x7fff and so on. Remember that is also rarely linear, so 50% volume doesn't mean 50% as loud.

EDIT

To clarify a bit further, the volume is split into two channels. I'll assume that you want the same volume on each.

The general formula is [left value] | ([right value << 16])

Here are examples:

For 100%, a value of 0xFFFF on both channels is what you want.
Value = 0xFFFFFFFF == 0xFFFF | (0xFFFF << 16)

For 50%, a value of 0x7FFF on both channels (0xffff / 2) is what you want.
Value = 0x7FFF7FFF == 0x7FFF | (0x7FFF << 16)

For 25%, a value of 0x3FFF on both channels (0x7fff / 2) is what you want.
Value = 0x3FFF3FFF == 0x3FFF | (0x3FFF << 16)