Microsoft.Win32.RegistryKey.OpenBaseKeyCore C# (CSharp) Méthode

OpenBaseKeyCore() private static méthode

Retrieves a new RegistryKey that represents the requested key. Valid values are: HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_PERFORMANCE_DATA, HKEY_CURRENT_CONFIG.
private static OpenBaseKeyCore ( RegistryHive hKeyHive, RegistryView view ) : RegistryKey
hKeyHive RegistryHive HKEY_* to open.
view RegistryView
Résultat RegistryKey
        private static RegistryKey OpenBaseKeyCore(RegistryHive hKeyHive, RegistryView view)
        {
            IntPtr hKey = (IntPtr)((int)hKeyHive);

            int index = ((int)hKey) & 0x0FFFFFFF;
            Debug.Assert(index >= 0 && index < s_hkeyNames.Length, "index is out of range!");
            Debug.Assert((((int)hKey) & 0xFFFFFFF0) == 0x80000000, "Invalid hkey value!");

            bool isPerf = hKey == HKEY_PERFORMANCE_DATA;

            // only mark the SafeHandle as ownsHandle if the key is HKEY_PERFORMANCE_DATA.
            SafeRegistryHandle srh = new SafeRegistryHandle(hKey, isPerf);

            RegistryKey key = new RegistryKey(srh, true, true, false, isPerf, view);
            key._keyName = s_hkeyNames[index];
            return key;
        }