public static bool IsEncryptionPausedDueToBadBlocks(string deviceId, out Exception ex, out string mountPoint, out string eventXML) { mountPoint = null; eventXML = null; ManagementObject encryptableVolume = BitlockerUtil.GetEncryptableVolume(deviceId, out ex); if (encryptableVolume == null) { return(false); } bool flag = BitlockerUtil.IsVolumeEncryptionPaused(encryptableVolume, out ex); if (!flag) { return(flag); } return(BitlockerUtil.DoesVolumeHaveBadBlocks(deviceId, out mountPoint, out ex, out eventXML)); }
public static Exception IsVolumeEncryptedOrEncrypting(string deviceId, out bool isVolumeEncrypting, out bool isVolumeEncrypted) { isVolumeEncrypting = false; isVolumeEncrypted = false; Exception ex = null; Exception ex2 = null; Exception ex3 = null; if (!BitlockerUtil.IsSystemVolume(deviceId, out ex) && !BitlockerUtil.IsBootVolume(deviceId, out ex2)) { if (ex != null) { return(ex); } if (ex2 != null) { return(ex2); } ManagementObject encryptableVolume = BitlockerUtil.GetEncryptableVolume(deviceId, out ex3); if (encryptableVolume == null) { return(ex3); } int num; BitlockerUtil.BitlockerConversionState bitlockerConversionState = BitlockerUtil.GetBitlockerConversionState(encryptableVolume, out num, out ex3); if (ex3 != null) { return(ex3); } if (bitlockerConversionState != BitlockerUtil.BitlockerConversionState.FullyDecrypted && bitlockerConversionState != BitlockerUtil.BitlockerConversionState.FullyEncrypted && bitlockerConversionState != BitlockerUtil.BitlockerConversionState.EncryptionPaused && bitlockerConversionState != BitlockerUtil.BitlockerConversionState.Unknown) { isVolumeEncrypting = true; } if (bitlockerConversionState == BitlockerUtil.BitlockerConversionState.FullyEncrypted) { isVolumeEncrypted = true; } ExAssert.RetailAssert(!isVolumeEncrypting || !isVolumeEncrypted, DiskManagementStrings.VolumeCannotBeBothEncryptingAndEncrypted(deviceId)); } return(ex3); }