How do I write large uint to a registry dword value?
-
This is what I'm trying to do: Target value is 0xffffff9d, which translates to 4294967197 decimal, which is why it needs to be an unsigned int. Unfortunately whenver I attempt to do this, it spawns an overflow exception. Two lines of code that matter: RegistryKey TargetKeyNode = Registry.LocalMachine.OpenSubKey(TargetPath, true); TargetKeyNode.SetValue(TargetKeyName, TargetValue, RegistryValueKind.DWord); As a brute force method, I've tried creating the target key as a dword with a zero value and then stuffing in the needed value using RegistryValueKind.Unknown, but that simply changes the key type to a string. I also tried setting the value this way &Hffffff9dI (along with every possible variation of that) as was suggested for someone else on another website but I get an error "The name &Hffffff9dI does not exist in the current context" on build. Can anyone please help me with this? Thanks in advance for any help.
Mike Poz
-
This is what I'm trying to do: Target value is 0xffffff9d, which translates to 4294967197 decimal, which is why it needs to be an unsigned int. Unfortunately whenver I attempt to do this, it spawns an overflow exception. Two lines of code that matter: RegistryKey TargetKeyNode = Registry.LocalMachine.OpenSubKey(TargetPath, true); TargetKeyNode.SetValue(TargetKeyName, TargetValue, RegistryValueKind.DWord); As a brute force method, I've tried creating the target key as a dword with a zero value and then stuffing in the needed value using RegistryValueKind.Unknown, but that simply changes the key type to a string. I also tried setting the value this way &Hffffff9dI (along with every possible variation of that) as was suggested for someone else on another website but I get an error "The name &Hffffff9dI does not exist in the current context" on build. Can anyone please help me with this? Thanks in advance for any help.
Mike Poz
-
You can cast the uint value to int, without losing data. The int value will be negative, but having the same bit pattern.
--- b { font-weight: normal; }