Contains internal volume helpers that are shared between many projects.
Exemple #1
0
        private static unsafe void ThrowExceptionEncryptDecryptFail(string fullPath)
        {
            int errorCode = Marshal.GetLastWin32Error();

            if (errorCode == Interop.Errors.ERROR_ACCESS_DENIED)
            {
                // Check to see if the file system support the Encrypted File System (EFS)
                string name = DriveInfoInternal.NormalizeDriveName(Path.GetPathRoot(fullPath));

                using (DisableMediaInsertionPrompt.Create())
                {
                    if (!Interop.Kernel32.GetVolumeInformation(name, null, 0, null, null, out int fileSystemFlags, null, 0))
                    {
                        errorCode = Marshal.GetLastWin32Error();
                        throw Win32Marshal.GetExceptionForWin32Error(errorCode, name);
                    }

                    if ((fileSystemFlags & Interop.Kernel32.FILE_SUPPORTS_ENCRYPTION) == 0)
                    {
                        throw new NotSupportedException(SR.PlatformNotSupported_FileEncryption);
                    }
                }
            }
            throw Win32Marshal.GetExceptionForWin32Error(errorCode, fullPath);
        }
 public static DriveInfo[] GetDrives()
 {
     string[]    drives = DriveInfoInternal.GetLogicalDrives();
     DriveInfo[] result = new DriveInfo[drives.Length];
     for (int i = 0; i < drives.Length; i++)
     {
         result[i] = new DriveInfo(drives[i]);
     }
     return(result);
 }
Exemple #3
0
 public static string[] GetLogicalDrives()
 {
     return(DriveInfoInternal.GetLogicalDrives());
 }
 private static string NormalizeDriveName(string driveName)
 {
     return(DriveInfoInternal.NormalizeDriveName(driveName));
 }
Exemple #5
0
 public override string[] GetLogicalDrives()
 {
     return(DriveInfoInternal.GetLogicalDrives());
 }
Exemple #6
0
 public static string[] GetLogicalDrives()
 => DriveInfoInternal.GetLogicalDrives();