c# - Can't Read Registry Key -
Let the code given below, tap the string returns after all, though, if I use the regedit to see this key I am then data in it Is Log On OnSmauser a Restricted Key?
public static string end logon () {string enduser; RegistryKey.OpenBaseKey (RegistryHive.LocalMachine, RegistryView.Registry64); Registry Registry = Registry. OpenSubby (@ "Software Microsoft Windows Onwards / Authentication \ LogonUI", false); If (registryKey! = Null) {enduser = (string) registry. Gate value ("Lastlogged Onuserver"); } And final = "unknown user"; Return (final); }
2 possible problems:
- you are Trying to read
logon on user key, there is a lot of probability which means you will be LastLoggedOnSAMUser . - If you have 32-bit registry entry 32-bit applications, change your platform target to x64 and try again. If not possible, then you may have to use the Registry API directly. Expect distance from a nudge in the right direction:
Comments
Post a Comment