Reading Registry Value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to read the value of the registry located in
HKEY_LOCAL_MACHINE\Security\Policy\PolAdtEv because it is a binary
representation of the "audit policy" settings on the computer. If I can read
it and break into the appropriate pieces I can determine the audit settings
on a remote computer. I almost have this working. The code below will
return a '0' for the value which is the first digit of the value I am trying
to read. I am not sure how to get the rest of the values in the string
(almost 90 binary digits). Anyone have any ideas? Thanks in advance.

RegistryKey rk;

remotename = "pc0057963";
string subkey = "Security\\Policy\\PolAdtEv";

rk = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,remotename)
..OpenSubKey(subkey);

// Print the values.
listBox1.Items.Add("There are " + rk.ValueCount.ToString() +
" values for " + rk.Name.ToString() + ".");

listBox2.Items.Add(Convert.ToByte(rk.GetValue("")));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top