示例#1
0
        public uint GetFileInfo(WinFspFileSystem FileSystem, FileOpenContext Context, WinFspNet.FileInfo fileInfo)
        {
            var file = Context.Node.UserContext;

            if (file is RamFile)
            {
                RamFile ramFile = (file as RamFile);
                fileInfo.AllocationSize = (ulong)ramFile.FileData.Capacity;
                fileInfo.FileSize       = (ulong)ramFile.FileData.Length;
            }


            return(NtStatus.STATUS_SUCCESS);
        }
示例#2
0
        uint CreateFileObject(string path, bool isFolder, FileObject parent, out FileObject ret)
        {
            path = path.TrimEnd('\\');
            var        newName = Path.GetFileName(path);
            var        dir     = parent as RamDir;
            FileObject newFileObject;

            ret = null;
            if (dir != null)
            {
                if (isFolder)
                {
                    ret = newFileObject = new RamDir(newName);
                }
                else
                {
                    ret = newFileObject = new RamFile(newName);
                }

                if (!dir.Childeren.TryAdd(newName, newFileObject))
                {
                    return(NtStatus.STATUS_OBJECT_NAME_COLLISION);
                }
                else
                {
                    newFileObject.Info.IndexNumber = (ulong)dir.GetNextIndex();
                }
            }
            else
            {
                return(NtStatus.STATUS_INVALID_PARAMETER);
            }

            if (!_fileObjects.TryAdd(path, newFileObject))
            {
                return(NtStatus.STATUS_OBJECT_NAME_COLLISION);
            }
            ret = newFileObject;
            return(NtStatus.STATUS_SUCCESS);
        }
示例#3
0
 private void RemoveUserFSFile(String userName, RamFile fs)
 {
     UserFS ufs;
     userFSList.TryGetValue(userName, out ufs);
     ufs.files.Remove(fs);
 }