/// <summary> /// Returns whether the specified handle is predefined for a hive. /// </summary> /// <param name="hKey">The handle to check.</param> /// <param name="hiveName">The name of the hive matching the handle.</param> /// <returns>True if <paramref name="hKey"/> is a predefined handle.</returns> public static bool IsHiveHandle(uint hKey, out string hiveName) { var id = HiveMap.GetIdFor(hKey); if (HiveMap.IsLegalId(id)) { hiveName = HiveMap.GetNameById(id); return(true); } hiveName = null; return(false); }
/// <summary> /// Returns the full name of the root key associated with the current <see cref="RegistryHive"/>. /// </summary> /// <param name="registryHive">Indicator of the registry hive which full name must be returned.</param> /// <returns>The full name of the root key matching the <see cref="RegistryHive"/>.</returns> public static string AsRegistryHiveName(this RegistryHive registryHive) { return(HiveMap.GetNameById(HiveMap.GetIdFor(registryHive))); }