// Token: 0x060015A7 RID: 5543 RVA: 0x00055C2C File Offset: 0x00053E2C public static ExchangeVolume GetInstance(MountedFolderPath volumeName, string exchangeVolumesRootPath, string databasesRootPath, int numDbsPerVolume) { ExchangeVolume exchangeVolume = new ExchangeVolume(volumeName, exchangeVolumesRootPath, databasesRootPath, numDbsPerVolume); exchangeVolume.Refresh(); return(exchangeVolume); }
// Token: 0x060015A6 RID: 5542 RVA: 0x00055C04 File Offset: 0x00053E04 private ExchangeVolume(MountedFolderPath volumeName, string exchangeVolumesRootPath, string databasesRootPath, int numDbsPerVolume) { this.m_volumeName = volumeName; this.m_exchangeVolumesRootPath = exchangeVolumesRootPath; this.m_databasesRootPath = databasesRootPath; this.m_numDbsPerVolume = numDbsPerVolume; }
// Token: 0x060015AB RID: 5547 RVA: 0x00056414 File Offset: 0x00054614 public MountedFolderPath GetMostAppropriateMountPoint() { if (this.IsExchangeVolume && !MountedFolderPath.IsNullOrEmpty(this.ExchangeVolumeMountPoint)) { return(this.ExchangeVolumeMountPoint); } if (this.MountPoints == null || this.MountPoints.Length == 0) { return(MountedFolderPath.Empty); } return(this.MountPoints[0]); }
public static Exception SetVolumeLabel(MountedFolderPath volumeMountPoint, string volumeLabel) { MountPointUtil.Tracer.TraceDebug <MountedFolderPath, string>(0L, "SetVolumeLabel(): Entering... [ volumeMountPoint= {0}, volumeLabel= {1} ]", volumeMountPoint, volumeLabel); if (!NativeMethods.SetVolumeLabel(volumeMountPoint.Path, volumeLabel)) { Exception ex = new Win32Exception(); MountPointUtil.Tracer.TraceError <MountedFolderPath, Exception>(0L, "SetVolumeLabel() for path '{0}' failed with error: {1}", volumeMountPoint, ex); return(ex); } MountPointUtil.Tracer.TraceDebug <MountedFolderPath, string>(0L, "SetVolumeLabel(): Associated volume '{0}' with label {1}", volumeMountPoint, volumeLabel); return(null); }
public static Exception SetVolumeMountPoint(MountedFolderPath volumeMountPoint, MountedFolderPath volumeName) { MountPointUtil.Tracer.TraceDebug <MountedFolderPath, MountedFolderPath>(0L, "SetVolumeMountPoint(): Entering... [ volumeMountPoint= {0}, volumeName= {1} ]", volumeMountPoint, volumeName); if (!NativeMethods.SetVolumeMountPoint(volumeMountPoint.Path, volumeName.Path)) { Exception ex = new Win32Exception(); MountPointUtil.Tracer.TraceError <MountedFolderPath, Exception>(0L, "SetVolumeMountPoint() for path '{0}' failed with error: {1}", volumeMountPoint, ex); return(ex); } MountPointUtil.Tracer.TraceDebug <MountedFolderPath, MountedFolderPath>(0L, "SetVolumeMountPoint(): Associated mount point '{0}' with volume {1}", volumeMountPoint, volumeName); return(null); }
public static string GetVolumeLabel(MountedFolderPath volumeName, out Exception exception) { MountPointUtil.Tracer.TraceDebug <string>(0L, "GetVolumeLabel(): Entering... [ volumeName= {0} ]", volumeName.Path); exception = null; int volumeNameSize = 1024; StringBuilder stringBuilder; exception = MountPointUtil.GetVolumeInformation(volumeName.Path, out stringBuilder, volumeNameSize); if (exception != null) { MountPointUtil.Tracer.TraceError <string, Exception>(0L, "GetVolumeLabel() for volumeName '{0}' failed with error: {1}", volumeName.Path, exception); return(null); } return(stringBuilder.ToString()); }
public static Exception DeleteVolumeMountPoint(MountedFolderPath volumeMountPoint) { MountPointUtil.Tracer.TraceDebug <MountedFolderPath>(0L, "DeleteVolumeMountPoint(): Entering... [ volumeMountPoint= {0} ]", volumeMountPoint); if (!NativeMethods.DeleteVolumeMountPoint(volumeMountPoint.Path)) { int lastWin32Error = Marshal.GetLastWin32Error(); if (lastWin32Error != 4390) { Exception ex = new Win32Exception(lastWin32Error); MountPointUtil.Tracer.TraceError <MountedFolderPath, Exception>(0L, "DeleteVolumeMountPoint() for path '{0}' failed with error: {1}", volumeMountPoint, ex); return(ex); } MountPointUtil.Tracer.TraceDebug <MountedFolderPath, int>(0L, "DeleteVolumeMountPoint() for path '{0}' returned ERROR_NOT_A_REPARSE_POINT ({1}).", volumeMountPoint, lastWin32Error); } MountPointUtil.Tracer.TraceDebug <MountedFolderPath>(0L, "DeleteVolumeMountPoint(): Deleted mount point at '{0}'", volumeMountPoint); return(null); }
// Token: 0x0600158D RID: 5517 RVA: 0x00055A40 File Offset: 0x00053C40 public override int Compare(ExchangeVolume x, ExchangeVolume y) { if (!x.IsExchangeVolume && !y.IsExchangeVolume) { MountedFolderPath mostAppropriateMountPoint = x.GetMostAppropriateMountPoint(); MountedFolderPath mostAppropriateMountPoint2 = y.GetMostAppropriateMountPoint(); if (MountedFolderPath.IsNullOrEmpty(mostAppropriateMountPoint) && !MountedFolderPath.IsNullOrEmpty(mostAppropriateMountPoint2)) { return(-1); } if (!MountedFolderPath.IsNullOrEmpty(mostAppropriateMountPoint) && MountedFolderPath.IsNullOrEmpty(mostAppropriateMountPoint2)) { return(1); } if (MountedFolderPath.IsNullOrEmpty(mostAppropriateMountPoint) && MountedFolderPath.IsNullOrEmpty(mostAppropriateMountPoint2)) { return(x.VolumeName.CompareTo(y.VolumeName)); } return(mostAppropriateMountPoint.CompareTo(mostAppropriateMountPoint2)); } else if (x.IsExchangeVolume && y.IsExchangeVolume) { if (x.IsDatabaseMountPointsNullOrEmpty() && !y.IsDatabaseMountPointsNullOrEmpty()) { return(-1); } if (!x.IsDatabaseMountPointsNullOrEmpty() && y.IsDatabaseMountPointsNullOrEmpty()) { return(1); } if (x.IsDatabaseMountPointsNullOrEmpty() && y.IsDatabaseMountPointsNullOrEmpty()) { return(x.ExchangeVolumeMountPoint.CompareTo(y.ExchangeVolumeMountPoint)); } return(x.DatabaseMountPoints[0].CompareTo(y.DatabaseMountPoints[0])); } else { if (!x.IsExchangeVolume && y.IsExchangeVolume) { return(-1); } return(1); } }
internal static MountedFolderPath GetVolumeNameForVolumeMountPoint(MountedFolderPath volumeMountPoint, out Exception exception) { MountPointUtil.Tracer.TraceDebug <MountedFolderPath>(0L, "GetVolumeNameForVolumeMountPoint(): Entering... [ volumeMountPoint= {0} ]", volumeMountPoint); int num = 50; StringBuilder stringBuilder = new StringBuilder(num); exception = null; if (!NativeMethods.GetVolumeNameForVolumeMountPoint(volumeMountPoint.Path, stringBuilder, (uint)num)) { exception = new Win32Exception(); MountPointUtil.Tracer.TraceError <MountedFolderPath, Exception>(0L, "GetVolumeNameForVolumeMountPoint() for mount point '{0}' failed with error: {1}", volumeMountPoint, exception); return(null); } string mountedFolderPath = stringBuilder.ToString(); MountedFolderPath mountedFolderPath2 = new MountedFolderPath(mountedFolderPath); MountPointUtil.Tracer.TraceDebug <MountedFolderPath, MountedFolderPath>(0L, "GetVolumeNameForVolumeMountPoint() for mount point '{0}' returning volume name '{1}'", volumeMountPoint, mountedFolderPath2); return(mountedFolderPath2); }
internal static MountedFolderPath GetVolumePathName(string pathName, out Exception exception) { MountPointUtil.Tracer.TraceDebug <string>(0L, "GetVolumePathName(): Entering... [ pathName= {0} ]", pathName); int num = pathName.Length + 1; StringBuilder stringBuilder = new StringBuilder(num); exception = null; if (!NativeMethods.GetVolumePathName(pathName, stringBuilder, (uint)num)) { exception = new Win32Exception(); MountPointUtil.Tracer.TraceError <string, Exception>(0L, "GetVolumePathName() for path '{0}' failed with error: {1}", pathName, exception); return(null); } string mountedFolderPath = stringBuilder.ToString(); MountedFolderPath mountedFolderPath2 = new MountedFolderPath(mountedFolderPath); MountPointUtil.Tracer.TraceDebug <string, MountedFolderPath>(0L, "GetVolumePathName() for path '{0}' returning mount point '{1}'", pathName, mountedFolderPath2); return(mountedFolderPath2); }
internal static MountedFolderPath[] GetVolumePathNamesForVolumeName(MountedFolderPath volumeName, out Exception exception) { MountPointUtil.Tracer.TraceDebug <MountedFolderPath>(0L, "GetVolumePathNamesForVolumeName(): Entering... [ volumeName= {0} ]", volumeName); exception = null; uint num = 4U; uint num2 = 0U; string text = new string(new char[num]); string[] source = new string[0]; MountedFolderPath[] result = new MountedFolderPath[0]; bool volumePathNamesForVolumeName = NativeMethods.GetVolumePathNamesForVolumeName(volumeName.Path, text, num, ref num2); if (!volumePathNamesForVolumeName) { int lastWin32Error = Marshal.GetLastWin32Error(); if (lastWin32Error != 234) { exception = new Win32Exception(lastWin32Error); MountPointUtil.Tracer.TraceError <MountedFolderPath, Exception>(0L, "GetVolumePathNamesForVolumeName() for volumeName '{0}' failed with error: {1}", volumeName, exception); return(result); } num = num2; text = new string(new char[num]); volumePathNamesForVolumeName = NativeMethods.GetVolumePathNamesForVolumeName(volumeName.Path, text, num, ref num2); } if (!volumePathNamesForVolumeName) { exception = new Win32Exception(); MountPointUtil.Tracer.TraceError <MountedFolderPath, Exception>(0L, "GetVolumePathNamesForVolumeName() for volumeName '{0}' failed a second time with error: {1}", volumeName, exception); return(result); } string text2 = text; char[] separator = new char[1]; source = text2.Split(separator, StringSplitOptions.RemoveEmptyEntries); return((from mp in source select new MountedFolderPath(mp)).ToArray <MountedFolderPath>()); }
// Token: 0x060015A9 RID: 5545 RVA: 0x0005610C File Offset: 0x0005430C public VolumeSpareStatus GetSpareStatus(out Exception exception) { exception = null; ExchangeVolume.Tracer.TraceDebug <MountedFolderPath>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Computing status of volume '{0}'.", this.VolumeName); if (!this.IsValid) { ExchangeVolume.Tracer.TraceError <DatabaseVolumeInfoException>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Error because the ExchangeVolume instance is invalid. Error: {0}", this.LastException); exception = this.LastException; return(VolumeSpareStatus.Error); } if (!this.IsExchangeVolume || !this.IsAvailableAsSpare || this.DatabaseMountPoints.Length != 0) { ExchangeVolume.Tracer.TraceDebug <MountedFolderPath>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Volume '{0}' is NotUsableAsSpare.", this.VolumeName); return(VolumeSpareStatus.NotUsableAsSpare); } ExchangeVolume.Tracer.TraceDebug((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Found a potential spare volume..."); MountedFolderPath exchangeVolumeMountPoint = this.ExchangeVolumeMountPoint; if (MountPointUtil.IsDirectoryNonExistentOrEmpty(exchangeVolumeMountPoint.Path, out exception)) { ExchangeVolume.Tracer.TraceDebug <MountedFolderPath>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Volume '{0}' is EmptySpare.", this.VolumeName); bool flag = BitlockerUtil.IsVolumeMountedOnVirtualDisk(this.VolumeName.Path, out exception); if (exception != null) { ExchangeVolume.Tracer.TraceDebug <MountedFolderPath, Exception>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Exception finding whether Volume '{0}' is mounted on a virtual disk or not. Reason {1}", this.VolumeName, exception); } if (!flag) { bool flag2 = false; bool flag3 = false; exception = BitlockerUtil.IsVolumeEncryptedOrEncrypting(this.VolumeName.Path, out flag2, out flag3); if (exception != null) { ExchangeVolume.Tracer.TraceDebug <MountedFolderPath, Exception>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Exception finding whether Volume '{0}' is encrypting or not. Reason {1}", this.VolumeName, exception); } else { if (flag2) { return(VolumeSpareStatus.EncryptingEmptySpare); } if (flag3) { return(VolumeSpareStatus.EncryptedEmptySpare); } string arg; string arg2; bool flag4 = BitlockerUtil.IsEncryptionPausedDueToBadBlocks(this.VolumeName.Path, out exception, out arg, out arg2); if (exception != null) { ExchangeVolume.Tracer.TraceDebug <MountedFolderPath, Exception>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Exception finding whether Volume '{0}' has encryption paused due to bad blocks. Reason {1}", this.VolumeName, exception); return(VolumeSpareStatus.Error); } if (flag4) { ExchangeVolume.Tracer.TraceDebug <MountedFolderPath, string, string>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Volume '{0}' is Qurantined due to encryption paused due to bad blocks. Mount point {1}. Event Xml {2}", this.VolumeName, arg, arg2); return(VolumeSpareStatus.Quarantined); } } } else { ExchangeVolume.Tracer.TraceDebug <MountedFolderPath>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Volume mounted on virtual disk. Not attempting to find bitlocker spare status", this.VolumeName); } return(VolumeSpareStatus.UnEncryptedEmptySpare); } int num = 0; if (exception == null || FileOperations.IsCorruptedIOException((IOException)exception, out num)) { ExchangeVolume.Tracer.TraceDebug <MountedFolderPath, string>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Volume '{0}' is Quarantined because it has some files/directories under mountPath '{1}'.", this.VolumeName, exchangeVolumeMountPoint.Path); return(VolumeSpareStatus.Quarantined); } ExchangeVolume.Tracer.TraceError <string, Exception>((long)this.GetHashCode(), "ExchangeVolume.GetSpareStatus(): Returning Error because IsDirectoryNonExistentOrEmpty() returned exception for mountPath '{0}'. Exception: {1}", exchangeVolumeMountPoint.Path, exception); return(VolumeSpareStatus.Error); }
// Token: 0x06001589 RID: 5513 RVA: 0x00055818 File Offset: 0x00053A18 public static DatabaseVolumeInfo GetInstance(string edbPath, string logPath, string databaseName, string autoDagVolumesRootFolderPath, string autoDagDatabasesRootFolderPath, int autoDagDatabaseCopiesPerVolume) { Exception ex = null; DatabaseVolumeInfo databaseVolumeInfo = new DatabaseVolumeInfo(); MountedFolderPath volumePathName = MountPointUtil.GetVolumePathName(edbPath, out ex); if (ex != null) { DatabaseVolumeInfo.Tracer.TraceError <string, string, Exception>(0L, "DatabaseVolumeInfo.GetInstance( {0} ): GetVolumePathName() for EDB path '{1}' failed with error: {2}", databaseName, edbPath, ex); databaseVolumeInfo.LastException = new DatabaseVolumeInfoInitException(databaseName, ex.Message, ex); return(databaseVolumeInfo); } databaseVolumeInfo.DatabaseVolumeMountPoint = volumePathName; MountedFolderPath volumeNameForVolumeMountPoint = MountPointUtil.GetVolumeNameForVolumeMountPoint(volumePathName, out ex); if (ex != null) { DatabaseVolumeInfo.Tracer.TraceError <string, MountedFolderPath, Exception>(0L, "DatabaseVolumeInfo.GetInstance( {0} ): GetVolumeNameForVolumeMountPoint() for EDB mount point '{1}' failed with error: {2}", databaseName, volumePathName, ex); databaseVolumeInfo.LastException = new DatabaseVolumeInfoInitException(databaseName, ex.Message, ex); return(databaseVolumeInfo); } databaseVolumeInfo.DatabaseVolumeName = volumeNameForVolumeMountPoint; bool isDatabasePathOnMountedFolder = MountPointUtil.IsDirectoryMountPoint(volumePathName.Path, out ex); if (ex != null) { DatabaseVolumeInfo.Tracer.TraceError <string, MountedFolderPath, Exception>(0L, "DatabaseVolumeInfo.GetInstance( {0} ): IsDirectoryMountPoint() for EDB mount point '{1}' failed with error: {2}", databaseName, volumePathName, ex); databaseVolumeInfo.LastException = new DatabaseVolumeInfoInitException(databaseName, ex.Message, ex); return(databaseVolumeInfo); } databaseVolumeInfo.IsDatabasePathOnMountedFolder = isDatabasePathOnMountedFolder; MountedFolderPath volumePathName2 = MountPointUtil.GetVolumePathName(logPath, out ex); if (ex != null) { DatabaseVolumeInfo.Tracer.TraceError <string, string, Exception>(0L, "DatabaseVolumeInfo.GetInstance( {0} ): GetVolumePathName() for LOG path '{1}' failed with error: {2}", databaseName, logPath, ex); databaseVolumeInfo.LastException = new DatabaseVolumeInfoInitException(databaseName, ex.Message, ex); return(databaseVolumeInfo); } databaseVolumeInfo.LogVolumeMountPoint = volumePathName2; MountedFolderPath volumeNameForVolumeMountPoint2 = MountPointUtil.GetVolumeNameForVolumeMountPoint(volumePathName2, out ex); if (ex != null) { DatabaseVolumeInfo.Tracer.TraceError <string, MountedFolderPath, Exception>(0L, "DatabaseVolumeInfo.GetInstance( {0} ): GetVolumeNameForVolumeMountPoint() for LOG mount point '{1}' failed with error: {2}", databaseName, volumePathName2, ex); databaseVolumeInfo.LastException = new DatabaseVolumeInfoInitException(databaseName, ex.Message, ex); return(databaseVolumeInfo); } databaseVolumeInfo.LogVolumeName = volumeNameForVolumeMountPoint2; bool isLogPathOnMountedFolder = MountPointUtil.IsDirectoryMountPoint(volumePathName2.Path, out ex); if (ex != null) { DatabaseVolumeInfo.Tracer.TraceError <string, MountedFolderPath, Exception>(0L, "DatabaseVolumeInfo.GetInstance( {0} ): IsDirectoryMountPoint() for LOG mount point '{1}' failed with error: {2}", databaseName, volumePathName2, ex); databaseVolumeInfo.LastException = new DatabaseVolumeInfoInitException(databaseName, ex.Message, ex); return(databaseVolumeInfo); } databaseVolumeInfo.IsLogPathOnMountedFolder = isLogPathOnMountedFolder; if (!string.IsNullOrEmpty(autoDagVolumesRootFolderPath) && !string.IsNullOrEmpty(autoDagDatabasesRootFolderPath)) { ExchangeVolume instance = ExchangeVolume.GetInstance(volumeNameForVolumeMountPoint, autoDagVolumesRootFolderPath, autoDagDatabasesRootFolderPath, autoDagDatabaseCopiesPerVolume); if (instance.IsValid) { databaseVolumeInfo.ExchangeVolumeMountPoint = (instance.ExchangeVolumeMountPoint ?? MountedFolderPath.Empty); databaseVolumeInfo.IsExchangeVolumeMountPointValid = !MountedFolderPath.IsNullOrEmpty(databaseVolumeInfo.ExchangeVolumeMountPoint); } } databaseVolumeInfo.IsValid = true; return(databaseVolumeInfo); }
public DatabaseSpareInfo(string dbName, MountedFolderPath dbMountPoint) { this.DbName = dbName; this.DatabaseMountPoint = dbMountPoint; }