/// <summary> /// Determines metadata of network shares /// </summary> /// <param name="rootPath">Share to check</param> /// <returns><see cref="QuickIODiskInformation"/></returns> public static QuickIODiskInformation GetDiskInformation(String rootPath) { Contract.Requires(!String.IsNullOrWhiteSpace(rootPath)); Contract.Ensures(Contract.Result <QuickIODiskInformation>() != null); UInt64 freeBytes; UInt64 totalBytes; UInt64 totalFreeBytes; /* PInvoke request */ if (!Win32SafeNativeMethods.GetDiskFreeSpaceEx(rootPath, out freeBytes, out totalBytes, out totalFreeBytes)) { Win32ErrorCodes.NativeExceptionMapping(rootPath, Marshal.GetLastWin32Error()); } return(new QuickIODiskInformation(freeBytes, totalBytes, totalFreeBytes)); }