internal static NtResult <NtKey> OpenClassKey(Guid class_guid, bool installer, KeyAccessRights desired_access, CmRegDisposition disposition, bool throw_on_error) { return(DeviceNativeMethods.CM_Open_Class_KeyW(class_guid, null, desired_access, disposition, out SafeKernelObjectHandle handle, installer ? CmClassType.Installer : CmClassType.Interface).ToNtStatus().CreateResult(throw_on_error, () => NtKey.FromHandle(handle))); }
private static NtStatus ToNtStatus(this CrError error) { return(DeviceNativeMethods.CM_MapCrToWin32Err(error, Win32Error.ERROR_INVALID_PARAMETER).MapDosErrorToStatus()); }
protected override bool ReleaseHandle() { return(DeviceNativeMethods.SetupDiDestroyDeviceInfoList(handle)); }