Example #1
0
        /// <summary>
        /// As with <see cref="FlushBuffers(string, LVFSContextInfo)"/>, but for the predecessor source.
        /// </summary>
        /// <param name="path">The path to the file whose buffers to flush</param>
        /// <param name="info">Information concerning the context for the operation</param>
        /// <returns><see cref="DokanResult.Success"/> if all buffers were flushed, If not, an appropriate error status.</returns>
        protected NtStatus PredecessorFlushBuffers(string path, LVFSContextInfo info)
        {
            WritableSource predecessor = mPredecessor as WritableSource;

            if (predecessor != null)
            {
                return(predecessor.FlushBuffers(path, info));
            }
            else
            {
                return(DokanResult.Success);
            }
        }
Example #2
0
        /// <summary>
        /// As with <see cref="CheckFileDeletable(string)"/>, but for the predecessor source.
        /// </summary>
        /// <param name="path">The path to the file to check</param>
        /// <returns>The result for the predecessor if it supports the operation, or a suitable error status if not.</returns>
        protected NtStatus PredecessorCheckFileDeletable(string path)
        {
            WritableSource predecessor = mPredecessor as WritableSource;

            if (predecessor != null)
            {
                return(predecessor.CheckFileDeletable(path));
            }
            else
            {
                return(PredecessorHasFile(path) ? DokanResult.AccessDenied : DokanResult.FileNotFound);
            }
        }
Example #3
0
        /// <summary>
        /// As with <see cref="SetFileAttributes(string, FileAttributes)"/>, but for the predecessor source.
        /// </summary>
        ///<param name="path">The path to the file</param>
        /// <param name="attributes">The attributes to set</param>
        /// <returns><see cref="DokanResult.Success"/> if the operation was successful. If not, an appropriate error status.</returns>
        protected NtStatus PredecessorSetFileAttributes(string path, FileAttributes attributes)
        {
            WritableSource predecessor = mPredecessor as WritableSource;

            if (predecessor != null)
            {
                return(predecessor.SetFileAttributes(path, attributes));
            }
            else
            {
                return(PredecessorHasFile(path) ? DokanResult.AccessDenied : DokanResult.FileNotFound);
            }
        }
Example #4
0
        /// <summary>
        /// As with <see cref="SetFileTimes(string, DateTime?, DateTime?, DateTime?)"/>, but for the predecessor source.
        /// </summary>
        /// <param name="path">The path to the file</param>
        /// <param name="creationTime">The new creation time for the file, or <c>null</c> if it is not to be changed.</param>
        /// <param name="lastAccessTime">The new last access time for the file, or <c>null</c> if it is not to be changed.</param>
        /// <param name="lastWriteTime">The new last write time for the file, or <c>null</c> if it is not to be changed.</param>
        /// <returns><see cref="DokanResult.Success"/> if the operation was successful. If not, an appropriate error status.</returns>
        protected NtStatus PredecessorSetFileTimes(string path, DateTime?creationTime, DateTime?lastAccessTime, DateTime?lastWriteTime)
        {
            WritableSource predecessor = mPredecessor as WritableSource;

            if (predecessor != null)
            {
                return(predecessor.SetFileTimes(path, creationTime, lastAccessTime, lastWriteTime));
            }
            else
            {
                return(PredecessorHasFile(path) ? DokanResult.AccessDenied : DokanResult.FileNotFound);
            }
        }
Example #5
0
        /// <summary>
        /// As with <see cref="SetFileSecurity(string, FileSystemSecurity, AccessControlSections, LVFSContextInfo)"/>, but for the predecessor source.
        /// </summary>
        /// <param name="path">The path to the file</param>
        /// <param name="security">The security to set</param>
        /// <param name="sections">The access control sections to change</param>
        /// <param name="info">Information concerning the context of this operation</param>
        /// <returns><see cref="DokanResult.Success"/> if the operation was successful. If not, an appropriate error status.</returns>
        protected NtStatus PredecessorSetFileSecurity(string path, FileSystemSecurity security, AccessControlSections sections, LVFSContextInfo info)
        {
            WritableSource predecessor = mPredecessor as WritableSource;

            if (predecessor != null)
            {
                return(predecessor.SetFileSecurity(path, security, sections, info));
            }
            else
            {
                return(PredecessorHasFile(path) ? DokanResult.AccessDenied : DokanResult.FileNotFound);
            }
        }
Example #6
0
        /// <summary>
        /// As with <see cref="SetLength(string, long, LVFSContextInfo)"/>, but for the predecessor source.
        /// </summary>
        /// <param name="path">The path to the file</param>
        /// <param name="length">The new length of the file</param>
        /// <param name="info">Information concerning the context of this operation</param>
        /// <returns><see cref="DokanResult.Success"/> if the requested length is now the length of the file. If not, an appropriate error status.</returns>
        protected NtStatus PredecessorSetLength(string path, long length, LVFSContextInfo info)
        {
            WritableSource predecessor = mPredecessor as WritableSource;

            if (predecessor != null)
            {
                return(predecessor.SetLength(path, length, info));
            }
            else
            {
                return(PredecessorHasFile(path) ? DokanResult.AccessDenied : DokanResult.FileNotFound);
            }
        }
Example #7
0
        /// <summary>
        /// As with <see cref="MoveFile(string, string, bool, LVFSContextInfo)"/>, but for the predecessor source.
        /// </summary>
        /// <param name="currentPath">The current path of the file/directory</param>
        /// <param name="newPath">The new path of the file/directory</param>
        /// <param name="replace">Whether to replace any existing file occupying the new path</param>
        /// <param name="info">Information concerning the context for this operation.</param>
        /// <returns><see cref="DokanResult.Success"/> if the file was moved. Otherwise, an appropriate error status.</returns>
        protected NtStatus PredecessorMoveFile(string currentPath, string newPath, bool replace, LVFSContextInfo info)
        {
            WritableSource predecessor = mPredecessor as WritableSource;

            if (predecessor != null)
            {
                return(predecessor.MoveFile(currentPath, newPath, replace, info));
            }
            else
            {
                return(PredecessorHasFile(currentPath) ? DokanResult.AccessDenied : DokanResult.FileNotFound);
            }
        }
Example #8
0
        /// <summary>
        /// As with <see cref="WriteFile(string, byte[], out int, long, LVFSContextInfo)"/>, but for the predecessor source.
        /// </summary>
        /// <param name="path">The path to the file</param>
        /// <param name="buffer">A buffer containing the data to write</param>
        /// <param name="bytesWritten">The number of bytes transferred from the buffer to the file</param>
        /// <param name="offset">The offset at which to start the write</param>
        /// <param name="info">Information concerning the context of this operation.</param>
        /// <returns><see cref="DokanResult.Success"/> if the operation was successful. If not, an appropriate error status.</returns>
        protected NtStatus PredecessorWriteFile(string path, byte[] buffer, out int bytesWritten, long offset, LVFSContextInfo info)
        {
            WritableSource predecessor = mPredecessor as WritableSource;

            if (predecessor != null)
            {
                return(predecessor.WriteFile(path, buffer, out bytesWritten, offset, info));
            }
            else
            {
                bytesWritten = 0;
                return(PredecessorHasFile(path) ? DokanResult.AccessDenied : DokanResult.FileNotFound);
            }
        }