Search code examples
c#windowswinapicomregistry

HKEY_CLASSES_ROOT\CLSID Not all subkeys are retrieved. Can't find my CLASSID


I've registered COM component (shell extension). I've opened regedit and found registered CLSID on it. I need to check if key was registered in registry programmatically. So I've tried to found it from code: retrieved all subkeys from HKEY_CLASSES_ROOT\CLSID. And I got the set of ubkeys. But I can't see subkey with my CLSID on it ! Here is my code.

       var res2 = RegistryKey.OpenBaseKey(RegistryHive.ClassesRoot, RegistryView.Registry32)
                .OpenSubKey("CLSID")
                .GetSubKeyNames()
                .ToList();


        res2.ForEach(e => Console.WriteLine(e));

On image regedit vs my code results

I've tried to do smilar action on C++/WinAPI and have the same problem. Tried to run it "as admin" and on other PC with no success. So how could I get this subkey programmatically ?


Solution

  • So, Yes need to change RegistryView.Registry32 => RegistryView.Registry64 Very stupid and silly mistake. Thank You all !