示例#1
0
        /// <summary>
        /// Find the full path to a mapped drive.
        /// </summary>
        /// <param name="drive"></param>
        /// <returns></returns>
        private static string GetDriveConnection(DriveInfo drive)
        {
            int bufferLength = 200;
            var driveName    = new StringBuilder(bufferLength);
            var returnCode   = NetworkApi.WNetGetConnection(drive.Name.Substring(0, 2), driveName, ref bufferLength);

            if (returnCode == 0)
            {
                return(driveName.ToString());
            }
            return(null);
        }