PDA

View Full Version : Reading Registry/Hex Values



Tux
02-09-2004, 11:00 PM
I'm currently having a small though annoying problem dealing with reading a dword value from the registry. The value I'm changing deals with "Windows File Protection". The dword value can take on 4 values

1 - disabled, prompt at boot to re-enable
2 - disabled at next boot only, no prompt to re-enable
4 - enabled, with popups disabled
ffffff9d - for completely disabled

The problem I'm having is with the fourth value (ffffff9d). I read in another post that I can't use the hex value to change the reg value but must use decimal instead. So I have inserted the decimal value (4294967197). Everything is fine except when after changing the dword value to (4294967197), without the paranthesis of course, I then display the registry value in a Dialog.Message, though the value that is returned is -99.

Here is an example of my code:

-- Set the data "Saved Value" in the user's Registry.
Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", "SFCDisable", "4294967197", REG_DWORD);

-- Read the previously written value.
SFCRegValue = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", "SFCDisable", true);

-- Display the value read from the Registry in a dialog.
Dialog.Message("Registry Data", "The value read from the Registry is "..SFCRegValue..".");

-------------------------------------------

I need the return value to be accurate for the completion of my project.

Thanx a bunch for your time.:D

--------------------------------------------
SUGESTION--

Alow for the insertion of hexidecimal values into the registry.

Brett
02-10-2004, 06:25 AM
Tux,

We will look into that problem in the source code and get back to you.

Mark
02-10-2004, 01:51 PM
Hey Tux,

I have looked into this issue and have found that there is a bug in AutoPlay 5.0.0.3. This bug has been fixed and the fix will be available in version 5.0.0.4.

The value is written to the registry properly, but is being returned improperly from the registry.

In the mean time you might consider writing the value out to the registry as a REG_SZ and then converting it to a number using the String.ToNumber() action if necessary.

Tux
02-10-2004, 04:06 PM
Thanks for the reply. I will be looking foward to the new release.