private void InitFsp() { Fsp = new WinFsp(Config, this, null, null); FsVolumeInfo = new VolInfo(); FsVolumeInfo.FreeSize = (ulong)1024 * 1024 * 1024 * 10; FsVolumeInfo.TotalSize = (ulong)1024 * 1024 * 1024 * 10; FsVolumeInfo.VolumeLable = "InfyCloud"; rootDirectory = new RamDir("\\"); _fileObjects.TryAdd("\\", rootDirectory); _fileObjects.TryAdd("", rootDirectory); }
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); }