Esempio n. 1
0
        private void CanFileBeDeleted(CallbackFileSystem Sender, CbFsFileInfo fileInfo, CbFsHandleInfo HandleInfo, ref bool CanBeDeleted)
        {
            bool canBeDeleted = false;

            CBFSWinUtil.Invoke("CanFileBeDeleted", () => canBeDeleted = CanFileBeDeleted(fileInfo, HandleInfo));
            CanBeDeleted = canBeDeleted;
        }
Esempio n. 2
0
        private void IsDirectoryEmpty(CallbackFileSystem Sender, CbFsFileInfo directoryInfo, string DirectoryName,
                                      ref bool IsEmpty)
        {
            bool isEmpty = false;

            CBFSWinUtil.Invoke("IsDirectoryEmpty", () => isEmpty = IsDirectoryEmpty(directoryInfo, DirectoryName));
            IsEmpty = isEmpty;
        }
Esempio n. 3
0
 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));
 }
Esempio n. 4
0
        /// <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");
            }
        }
Esempio n. 5
0
 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");
     }
 }
Esempio n. 6
0
 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");
     }
 }
Esempio n. 7
0
 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");
     }
 }
Esempio n. 8
0
        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");
            }
        }
Esempio n. 9
0
        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");
            }
        }
Esempio n. 10
0
 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");
     }
 }
Esempio n. 11
0
 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");
     }
 }
Esempio n. 12
0
 private void RenameOrMoveFile(CallbackFileSystem Sender, CbFsFileInfo fileInfo, string NewFileName)
 {
     CBFSWinUtil.Invoke("RenameOrMoveFile", () => RenameOrMoveFile(fileInfo, NewFileName));
 }
Esempio n. 13
0
 private void DeleteFile(CallbackFileSystem Sender, CbFsFileInfo fileInfo)
 {
     CBFSWinUtil.Invoke("DeleteFile", () => DeleteFile(fileInfo));
 }
Esempio n. 14
0
 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));
 }
Esempio n. 15
0
 private void CloseFile(CallbackFileSystem Sender, CbFsFileInfo fileInfo, CbFsHandleInfo userContextInfo)
 {
     CBFSWinUtil.Invoke("CloseFile", () => CloseFile(fileInfo, userContextInfo));
 }
Esempio n. 16
0
 public void UnmountMedia()
 {
     CBFSWinUtil.Invoke("UnmountMedia", () => CbFs.UnmountMedia());
 }
Esempio n. 17
0
 private void SetAllocationSize(CallbackFileSystem Sender, CbFsFileInfo fileInfo, long AllocationSize)
 {
     CBFSWinUtil.Invoke("SetAllocationSize", () => SetAllocationSize(fileInfo, AllocationSize));
 }
Esempio n. 18
0
 private void FlushFile(CallbackFileSystem sender, CbFsFileInfo fileInfo)
 {
     CBFSWinUtil.Invoke("FlushFile", () => FlushFile(fileInfo));
 }
Esempio n. 19
0
 public void MountMedia(int apiTimeout)
 {
     CBFSWinUtil.Invoke("MountMedia", () => CbFs.MountMedia(apiTimeout));
 }
Esempio n. 20
0
 private void SetEndOfFile(CallbackFileSystem Sender, CbFsFileInfo fileInfo, long EndOfFile)
 {
     CBFSWinUtil.Invoke("SetEndOfFile", () => SetEndOfFile(fileInfo, EndOfFile));
 }
Esempio n. 21
0
 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));
 }
Esempio n. 22
0
 public void DeleteMountingPoint()
 {
     CBFSWinUtil.Invoke("DeleteMountingPoint", () => CbFs.DeleteMountingPoint(mountingPoint, flags, null));
 }
Esempio n. 23
0
 private void CloseDirectoryEnumeration(CallbackFileSystem Sender, CbFsFileInfo directoryInfo, CbFsDirectoryEnumerationInfo directoryEnumerationInfo)
 {
     CBFSWinUtil.Invoke("CloseDirectoryEnumeration", () => CloseDirectoryEnumeration(directoryInfo, directoryEnumerationInfo));
 }
Esempio n. 24
0
 public void DeleteStorage(bool forceUnmount)
 {
     CBFSWinUtil.Invoke("DeleteStorage", () => CbFs.DeleteStorage(forceUnmount));
 }
Esempio n. 25
0
 private void UnMount(CallbackFileSystem Sender)
 {
     CBFSWinUtil.Invoke("UnMount", UnMount);
 }