RegistryKey -> IntPtr

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there anyone know to the get the native registry Handle from a RegistryKey?

thanks in advance
 
public static IntPtr GetRegistryHandle(RegistryKey registryKey)
{
Type type = registryKey.GetType();
FieldInfo fieldInfo = type.GetField("hkey", BindingFlags.Instance |
BindingFlags.NonPublic);
return (IntPtr)fieldInfo.GetValue(registryKey);
}
 
Back
Top