コード例 #1
0
        DokanError IDokanOperations.OpenDirectory(string fileName, DokanFileInfo info)
        {
            SftpDrive drive = this.GetDriveByMountPoint(fileName, out fileName);

            LogFSActionInit("OpenDir", fileName, drive, "");

            if (drive != null)
            {
                lastActiveSubsytem = drive;

                IDokanOperations ops = GetSubSystemOperations(drive);
                if (ops == null)
                {
                    LogFSActionError("OpenDir", fileName, drive, "Cannot open, mount failed?");
                    return(DokanError.ErrorAccessDenied);
                }
                LogFSActionSuccess("OpenDir", fileName, drive, "Found, subsytem");
                return(ops.OpenDirectory(fileName, info));
            }

            lastActiveSubsytem = null;
            info.IsDirectory   = true;

            if (fileName.Length == 1) //root dir
            {
                LogFSActionSuccess("OpenDir", fileName, drive, "Found, VFS root");
                return(DokanError.ErrorSuccess);
            }

            string path = fileName.Substring(1);//cut leading \

            foreach (SftpDrive subdrive in _subsytems)
            {
                string mp = subdrive.MountPoint; //  mp1 || mp1\mp2 ...
                if (path == mp)
                {
                    info.Context = subdrive;
                    LogFSActionSuccess("OpenDir", fileName, drive, "Found, final mountpoint");
                    return(DokanError.ErrorSuccess);
                }

                if (mp.IndexOf(path + '\\') == 0)
                { //path is part of mount point
                    info.Context = subdrive;
                    LogFSActionSuccess("OpenDir", fileName, drive, "Found, part of mountpoint");
                    return(DokanError.ErrorSuccess);
                }
            }
            LogFSActionError("OpenDir", fileName, drive, "Path not found");
            return(DokanError.ErrorPathNotFound);
        }
コード例 #2
0
        ////

        public int OpenDirectoryProxy(string rawFileName,
                                      DokanFileInfo rawFileInfo)
        {
            try
            {
                return((int)_operations.OpenDirectory(rawFileName, rawFileInfo));
            }
            catch
            {
#if DEBUG
                throw;
#endif
                return(ERROR_INVALID_FUNCTION);
            }
        }
コード例 #3
0
ファイル: Cache.cs プロジェクト: ericx/dokan-sshfs
        public DokanError OpenDirectory(string filename, DokanFileInfo info)
        {
            DokanError ret = 0;

            CacheEntry entry = cache_.Lookup(filename);

            if (entry.OpenDirectoryRet == DokanError.Undefined)
            {
                ret = ope_.OpenDirectory(filename, info);
                entry.OpenDirectoryRet = ret;
            }
            else
            {
                ret = entry.OpenDirectoryRet;
            }
            return(ret);
        }
コード例 #4
0
        public int OpenDirectoryProxy(IntPtr rawFileName, ref DOKAN_FILE_INFO rawFileInfo)
        {
            try
            {
                string file = GetFileName(rawFileName);

                DokanFileInfo info = ConvertFileInfo(ref rawFileInfo);
                int           ret  = operations.OpenDirectory(file, info);
                rawFileInfo.Context     = info.refFileHandleContext;
                rawFileInfo.IsDirectory = Convert.ToByte(info.IsDirectory);
                return(ret);
            }
            catch (Exception ex)
            {
                Log.ErrorException("OpenDirectoryProxy threw:", ex);
                return(-1);
            }
        }
コード例 #5
0
        ////

        public NtStatus OpenDirectoryProxy(string rawFileName,
                                           DokanFileInfo rawFileInfo)
        {
            try
            {
                Trace("\nOpenDirectoryProxy : " + rawFileName);
                Trace("\tContext\t" + ToTrace(rawFileInfo));

                NtStatus result = operations.OpenDirectory(rawFileName, rawFileInfo);

                Trace("OpenDirectoryProxy : " + rawFileName + " Return : " + result);
                return(result);
            }
#pragma warning disable 0168
            catch (Exception ex)
#pragma warning restore 0168
            {
                Trace("OpenDirectoryProxy : " + rawFileName + " Throw : " + ex.Message);
                return(DokanResult.InvalidParameter);
            }
        }