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;
}