Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Get 64 Bit Registry Value

$
0
0

This is my code that works fine on 32 bit computers:

        public static string GetRegistryKeyValue(string keyPath)
        {
            using (var shell = AutomationFactory.CreateObject("WScript.Shell"))
            {
                var keyValue = (string)shell.RegRead(keyPath);
                return keyValue;
            }
        }

This is the key that I need to get:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid

But, the code errors with this key on 64 bit machines. I read something about this over here. I know this something to do with that WOW64 rubbish.

http://msdn.microsoft.com/en-us/library/aa384129%28v=VS.85%29.aspx

But, I can't find an example to do this correctly. I just need to know how to get the value "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid" from the registry on 64 bit machines. Just a code sample or something would be great.


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>