private void CanFileBeDeleted(CallbackFileSystem Sender, CbFsFileInfo fileInfo, CbFsHandleInfo HandleInfo, ref bool CanBeDeleted) { bool canBeDeleted = false; CBFSWinUtil.Invoke("CanFileBeDeleted", () => canBeDeleted = CanFileBeDeleted(fileInfo, HandleInfo)); CanBeDeleted = canBeDeleted; }
private void IsDirectoryEmpty(CallbackFileSystem Sender, CbFsFileInfo directoryInfo, string DirectoryName, ref bool IsEmpty) { bool isEmpty = false; CBFSWinUtil.Invoke("IsDirectoryEmpty", () => isEmpty = IsDirectoryEmpty(directoryInfo, DirectoryName)); IsEmpty = isEmpty; }
public void AddMountingPoint(string driveLetter, uint mountingType, CbFsNetworkSymLinkFlags networkSymLinkFlags) { flags = mountingType + (uint)networkSymLinkFlags; if (driveLetter.Length == 1) { driveLetter = driveLetter.ToUpper() + ":"; } mountingPoint = driveLetter; CBFSWinUtil.Invoke("AddMountingPoint", () => CbFs.AddMountingPoint(driveLetter, flags, null)); }
/// <summary> /// Redirect and massaging /// </summary> /// <param name="storageType">https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_storagetype.html</param> /// <param name="threadPoolSize"></param> /// <param name="useInternalCaches"></param> /// <param name="iconRef"></param> public void CreateStorage(CbFsStorageType storageType, uint threadPoolSize, bool useInternalCaches, string iconRef = null) { Log.Trace("CreateStorage IN"); try { // Must set StorageType before mounting !! CbFs.StorageType = storageType; // Must set ThreadPoolSize before mounting !! CbFs.MinWorkerThreadCount = 1; CbFs.MaxWorkerThreadCount = threadPoolSize; CbFs.NonexistentFilesCacheEnabled = useInternalCaches; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_nonexistentfilescacheenabled.html CbFs.MetaDataCacheEnabled = useInternalCaches; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_metadatacacheenabled.html CbFs.FileCacheEnabled = useInternalCaches; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_filecacheenabled.html CbFs.ShortFileNameSupport = false; CbFs.ClusterSize = 0;// The value must be a multiple of sector size. Default value of 0 tells the driver to have cluster size equal to sector size. CbFs.SectorSize = 4096; // Make this a local style disk CbFs.StorageCharacteristics = 0; // https://www.eldos.com/forum/read.php?FID=13&TID=3681 // the CallAllOpenCloseCallbacks is going to be forced to be true in the next version, so ensure stuff work here with it. CbFs.CallAllOpenCloseCallbacks = true; // https://www.eldos.com/forum/read.php?FID=13&TID=479 // Pass the creation around, This can then be used to determine which of the already opened flags can be decremented to finally release the handle. CbFs.UseFileCreationFlags = true; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_usefilecreationflags.html CbFs.SerializeCallbacks = true; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_serializecallbacks.html CbFs.ParallelProcessingAllowed = false; // https://www.eldos.com/documentation/cbfs/ref_cl_cbfs_prp_parallelprocessingallowed.html CbFs.FileSystemName = "NTFS"; // Go create stuff CbFs.CreateStorage(); if (!string.IsNullOrWhiteSpace(iconRef)) { if (!CbFs.IconInstalled(iconRef)) { Log.ErrorException("!IconInstalled", new MissingSatelliteAssemblyException("Requested Icon ref is not installed: " + iconRef)); } else { CbFs.SetIcon(iconRef); } } CbFs.NotifyDirectoryChange("\"", CbFsNotifyFileAction.fanAdded, false); } catch (Exception ex) { CBFSWinUtil.BestAttemptToECBFSError(ex); } finally { Log.Trace("CreateStorage OUT"); } }
private void GetVolumeSize(CallbackFileSystem Sender, ref long TotalNumberOfSectors, ref long NumberOfFreeSectors) { Log.Trace("GetVolumeSize IN"); try { GetVolumeSize(out TotalNumberOfSectors, out NumberOfFreeSectors); } catch (Exception ex) { CBFSWinUtil.BestAttemptToECBFSError(ex); } finally { Log.Trace("GetVolumeSize OUT"); } }
private void SetVolumeLabel(CallbackFileSystem Sender, string volumeLabel) { Log.Trace("SetVolumeLabel IN"); try { VolumeLabel = volumeLabel; } catch (Exception ex) { CBFSWinUtil.BestAttemptToECBFSError(ex); } finally { Log.Trace("SetVolumeLabel OUT"); } }
private void GetVolumeId(CallbackFileSystem Sender, ref uint volumeID) { Log.Trace("GetVolumeId IN"); try { volumeID = VolumeId; } catch (Exception ex) { CBFSWinUtil.BestAttemptToECBFSError(ex); } finally { Log.Trace("GetVolumeId OUT"); } }
private void WriteFile(CallbackFileSystem Sender, CbFsFileInfo fileInfo, long Position, byte[] Buffer, int BytesToWrite, ref int bytesWritten) { Log.Trace("WriteFile IN"); uint written = 0; try { WriteFile(fileInfo, Position, Buffer, (uint)BytesToWrite, out written); } catch (Exception ex) { CBFSWinUtil.BestAttemptToECBFSError(ex); } finally { bytesWritten = (int)written; Log.Trace("WriteFile OUT"); } }
private void ReadFile(CallbackFileSystem Sender, CbFsFileInfo fileInfo, long Position, byte[] Buffer, int BytesToRead, ref int bytesRead) { Log.Trace("ReadFile IN"); uint read = 0; try { ReadFile(fileInfo, Position, Buffer, (uint)BytesToRead, out read); } catch (Exception ex) { CBFSWinUtil.BestAttemptToECBFSError(ex); } finally { bytesRead = (int)read; Log.Trace("ReadFile OUT"); } }
private void GetFileInfo(CallbackFileSystem Sender, string FileName, ref bool FileExists, ref DateTime CreationTime, ref DateTime LastAccessTime, ref DateTime LastWriteTime, ref long lengthOfFile, ref long AllocationSize, ref CBFS_LARGE_INTEGER FileId, ref uint FileAttributes, ref string ShortFileName, ref string RealFileName) { Log.Trace("GetFileInfo IN"); try { GetFileInfo(FileName, ref FileExists, ref CreationTime, ref LastAccessTime, ref LastWriteTime, ref lengthOfFile, ref AllocationSize, ref FileId, ref FileAttributes, ref ShortFileName, ref RealFileName); } catch (Exception ex) { CBFSWinUtil.BestAttemptToECBFSError(ex); } finally { Log.Trace("GetFileInfo OUT"); } }
private void EnumerateDirectory(CallbackFileSystem Sender, CbFsFileInfo directoryInfo, CbFsHandleInfo HandleInfo, CbFsDirectoryEnumerationInfo DirectoryEnumerationInfo, string Mask, int Index, [MarshalAs(UnmanagedType.U1)] bool Restart, ref bool FileFound, ref string FileName, ref string ShortFileName, ref DateTime CreationTime, ref DateTime LastAccessTime, ref DateTime LastWriteTime, ref long lengthOfFile, ref long AllocationSize, ref CBFS_LARGE_INTEGER FileId, ref uint FileAttributes) { Log.Trace("EnumerateDirectory IN"); try { EnumerateDirectory(directoryInfo, HandleInfo, DirectoryEnumerationInfo, Mask, Restart, ref FileFound, ref FileName, ref ShortFileName, ref CreationTime, ref LastAccessTime, ref LastWriteTime, ref lengthOfFile, ref AllocationSize, ref FileId, ref FileAttributes); } catch (Exception ex) { CBFSWinUtil.BestAttemptToECBFSError(ex); } finally { Log.Trace("EnumerateDirectory OUT"); } }
private void RenameOrMoveFile(CallbackFileSystem Sender, CbFsFileInfo fileInfo, string NewFileName) { CBFSWinUtil.Invoke("RenameOrMoveFile", () => RenameOrMoveFile(fileInfo, NewFileName)); }
private void DeleteFile(CallbackFileSystem Sender, CbFsFileInfo fileInfo) { CBFSWinUtil.Invoke("DeleteFile", () => DeleteFile(fileInfo)); }
private void SetFileAttributes(CallbackFileSystem Sender, CbFsFileInfo fileInfo, CbFsHandleInfo userContextInfo, DateTime CreationTime, DateTime LastAccessTime, DateTime LastWriteTime, uint FileAttributes) { CBFSWinUtil.Invoke("SetFileAttributes", () => SetFileAttributes(fileInfo, userContextInfo, CreationTime, LastAccessTime, LastWriteTime, FileAttributes)); }
private void CloseFile(CallbackFileSystem Sender, CbFsFileInfo fileInfo, CbFsHandleInfo userContextInfo) { CBFSWinUtil.Invoke("CloseFile", () => CloseFile(fileInfo, userContextInfo)); }
public void UnmountMedia() { CBFSWinUtil.Invoke("UnmountMedia", () => CbFs.UnmountMedia()); }
private void SetAllocationSize(CallbackFileSystem Sender, CbFsFileInfo fileInfo, long AllocationSize) { CBFSWinUtil.Invoke("SetAllocationSize", () => SetAllocationSize(fileInfo, AllocationSize)); }
private void FlushFile(CallbackFileSystem sender, CbFsFileInfo fileInfo) { CBFSWinUtil.Invoke("FlushFile", () => FlushFile(fileInfo)); }
public void MountMedia(int apiTimeout) { CBFSWinUtil.Invoke("MountMedia", () => CbFs.MountMedia(apiTimeout)); }
private void SetEndOfFile(CallbackFileSystem Sender, CbFsFileInfo fileInfo, long EndOfFile) { CBFSWinUtil.Invoke("SetEndOfFile", () => SetEndOfFile(fileInfo, EndOfFile)); }
private void OpenFile(CallbackFileSystem Sender, string FileName, uint DesiredAccess, uint fileAttributes, uint ShareMode, CbFsFileInfo fileInfo, CbFsHandleInfo userContextInfo) { CBFSWinUtil.Invoke("OpenFile", () => OpenFile(FileName, DesiredAccess, fileAttributes, ShareMode, fileInfo, userContextInfo)); }
public void DeleteMountingPoint() { CBFSWinUtil.Invoke("DeleteMountingPoint", () => CbFs.DeleteMountingPoint(mountingPoint, flags, null)); }
private void CloseDirectoryEnumeration(CallbackFileSystem Sender, CbFsFileInfo directoryInfo, CbFsDirectoryEnumerationInfo directoryEnumerationInfo) { CBFSWinUtil.Invoke("CloseDirectoryEnumeration", () => CloseDirectoryEnumeration(directoryInfo, directoryEnumerationInfo)); }
public void DeleteStorage(bool forceUnmount) { CBFSWinUtil.Invoke("DeleteStorage", () => CbFs.DeleteStorage(forceUnmount)); }
private void UnMount(CallbackFileSystem Sender) { CBFSWinUtil.Invoke("UnMount", UnMount); }