private string InfoToString(FuserFileHandler hFile)
        {
            string tmp = "";

            if (hFile.fileHandle != null)
            {
                tmp = hFile.fileHandle.ToString();
            }

            return(tmp + "Context: " + tmp +
                   "hID:" + 0);    // + ", PID:" + hFile.ProcessId + "," + getStrBool("Dir", hFile.IsDirectory) + "," + getStrBool("Delete", hFile.DeleteOnClose) + ","
            //+ getStrBool("Paging", hFile.PagingIo) + "," + getStrBool("Sync", hFile.SynchronousIo) + "," + getStrBool("EndOfFile", hFile.WriteToEndOfFile) + ",InternalContext:" + hFile.FuserContext;
        }
        public Win32Returncode OpenDirectory(FuserFileHandler hFile)
        {
            string funcname = "OpenDirectory";
            string param    = "";

            try {
                //param = ;
                Win32Returncode r = sourceSystem.OpenDirectory(hFile);

                LogEvent(funcname, r, param, hFile);
                return(r);
            } catch (Exception e) {
                LogEvent(funcname, Win32Returncode.DEFAULT_UNKNOWN_ERROR, param, hFile);
                LogException(funcname, e);
                return(Win32Returncode.DEFAULT_UNKNOWN_ERROR);
            }
        }
        public Win32Returncode CreateFile(FuserFileHandler hFile, FuserFileAccess access, FileShare share, FileMode mode, FileOptions options, FileAttributes attribut)
        {
            string funcname = "CreateFile";
            string param    = "";

            try {
                param = access + ";" + share + ";" + mode + ";" + options + " Attribute: " + attribut;
                Win32Returncode r = sourceSystem.CreateFile(hFile, access, share, mode, options, attribut);

                LogEvent(funcname, r, param, hFile);
                return(r);
            } catch (Exception e) {
                LogEvent(funcname, Win32Returncode.DEFAULT_UNKNOWN_ERROR, param, hFile);
                LogException(funcname, e);
                return(Win32Returncode.DEFAULT_UNKNOWN_ERROR);
            }
        }
        public Win32Returncode SetAllocationSize(FuserFileHandler hFile, long length)
        {
            string funcname = "SetAllocationSize";
            string param    = "";

            try {
                param = length.ToString();
                Win32Returncode r = sourceSystem.SetAllocationSize(hFile, length);

                LogEvent(funcname, r, param, hFile);
                return(r);
            } catch (Exception e) {
                LogEvent(funcname, Win32Returncode.DEFAULT_UNKNOWN_ERROR, param, hFile);
                LogException(funcname, e);
                return(Win32Returncode.DEFAULT_UNKNOWN_ERROR);
            }
        }
        public Win32Returncode SetFileAttributes(FuserFileHandler hFile, FileAttributes attr)
        {
            string funcname = "SetFileAttributes";
            string param    = "";

            try {
                //param = ;
                Win32Returncode r = sourceSystem.SetFileAttributes(hFile, attr);

                LogEvent(funcname, r, param, hFile);
                return(r);
            } catch (Exception e) {
                LogEvent(funcname, Win32Returncode.DEFAULT_UNKNOWN_ERROR, param, hFile);
                LogException(funcname, e);
                return(Win32Returncode.DEFAULT_UNKNOWN_ERROR);
            }
        }
        public Win32Returncode SetFileTime(FuserFileHandler hFile, DateTime CreationTime, DateTime LastAccessTime, DateTime LastWriteTime)
        {
            string funcname = "SetFileTime";
            string param    = "";

            try {
                param = CreationTime + ";" + LastAccessTime + ";" + LastWriteTime;
                Win32Returncode r = sourceSystem.SetFileTime(hFile, CreationTime, LastAccessTime, LastWriteTime);

                LogEvent(funcname, r, param, hFile);
                return(r);
            } catch (Exception e) {
                LogEvent(funcname, Win32Returncode.DEFAULT_UNKNOWN_ERROR, param, hFile);
                LogException(funcname, e);
                return(Win32Returncode.DEFAULT_UNKNOWN_ERROR);
            }
        }
        public Win32Returncode GetFileInformation(FuserFileHandler hFile, FuserFileInformation fileinfo)
        {
            string funcname = "GetFileInformation";
            string param    = "";

            try {
                //param = ;
                Win32Returncode r = sourceSystem.GetFileInformation(hFile, fileinfo);

                LogEvent(funcname, r, param, hFile);
                return(r);
            } catch (Exception e) {
                LogEvent(funcname, Win32Returncode.DEFAULT_UNKNOWN_ERROR, param, hFile);
                LogException(funcname, e);
                return(Win32Returncode.DEFAULT_UNKNOWN_ERROR);
            }
        }
        public Win32Returncode FindFiles(FuserFileHandler hFile, List <FuserFileInformation> files)
        {
            string funcname = "FindFiles";
            string param    = "";

            try {
                //param = ;
                Win32Returncode r = sourceSystem.FindFiles(hFile, files);

                LogEvent(funcname, r, param, hFile);
                return(r);
            } catch (Exception e) {
                LogEvent(funcname, Win32Returncode.DEFAULT_UNKNOWN_ERROR, param, hFile);
                LogException(funcname, e);
                return(Win32Returncode.DEFAULT_UNKNOWN_ERROR);
            }
        }
        public Win32Returncode UnlockFile(FuserFileHandler hFile, long offset, long length)
        {
            string funcname = "UnlockFile";
            string param    = "";

            try {
                //param = ;
                Win32Returncode r = sourceSystem.UnlockFile(hFile, offset, length);

                LogEvent(funcname, r, param, hFile);
                return(r);
            } catch (Exception e) {
                LogEvent(funcname, Win32Returncode.DEFAULT_UNKNOWN_ERROR, param, hFile);
                LogException(funcname, e);
                return(Win32Returncode.DEFAULT_UNKNOWN_ERROR);
            }
        }
        public Win32Returncode WriteFile(FuserFileHandler hFile, byte[] buffer, ref uint writtenBytes, long offset)
        {
            string funcname = "WriteFile";
            string param    = "";

            try {
                param = buffer.Length + ";" + writtenBytes + ";" + offset;
                Win32Returncode r = sourceSystem.WriteFile(hFile, buffer, ref writtenBytes, offset);

                LogEvent(funcname, r, param, hFile);
                return(r);
            } catch (Exception e) {
                LogEvent(funcname, Win32Returncode.DEFAULT_UNKNOWN_ERROR, param, hFile);
                LogException(funcname, e);
                return(Win32Returncode.DEFAULT_UNKNOWN_ERROR);
            }
        }
        public Win32Returncode MoveFile(FuserFileHandler hFile, string newFilename, bool replace)
        {
            string funcname = "MoveFile";
            string param    = "";

            try {
                param = newFilename + ";" + replace;
                Win32Returncode r = sourceSystem.MoveFile(hFile, newFilename, replace);

                LogEvent(funcname, r, param, hFile);
                return(r);
            } catch (Exception e) {
                LogEvent(funcname, Win32Returncode.DEFAULT_UNKNOWN_ERROR, param, hFile);
                LogException(funcname, e);
                return(Win32Returncode.DEFAULT_UNKNOWN_ERROR);
            }
        }
        private void LogEvent(string funcName, Win32Returncode returnValue, string Param, FuserFileHandler hFile)
        {
            string filename;

            if (hFile == null)
            {
                filename = "";
            }
            else
            {
                filename = hFile.filename;
            }

            LogMessage(funcName + "[" + (returnValue.ToString() + " " + Param).Trim() + "]: " + filename);

            //if (filename == @"\test") {
            //    LogMessage(funcName + "[" + (returnValue + " " + Param).Trim() + "]: " + filename);
            //}

            //LogMessage(funcName + ": " + InfoToString(info));
        }
Пример #13
0
 public Win32Returncode UnlockFile(FuserFileHandler hFile, long offset, long length)
 {
     lock (this) { return(this.sourceSystem.UnlockFile(hFile, offset, length)); }
 }
Пример #14
0
 public Win32Returncode MoveFile(FuserFileHandler hFile, string newFilename, bool replace)
 {
     lock (this) {
         return(this.sourceSystem.MoveFile(hFile, newFilename, replace));
     }
 }
Пример #15
0
 public Win32Returncode DeleteDirectory(FuserFileHandler hFile)
 {
     lock (this) {
         return(this.sourceSystem.DeleteDirectory(hFile));
     }
 }
Пример #16
0
 public Win32Returncode FlushFileBuffers(FuserFileHandler hFile)
 {
     lock (this) {
         return(this.sourceSystem.FlushFileBuffers(hFile));
     }
 }
Пример #17
0
 public Win32Returncode CloseFile(FuserFileHandler hFile)
 {
     lock (this) {
         return(this.sourceSystem.CloseFile(hFile));
     }
 }
Пример #18
0
 public Win32Returncode CreateFile(FuserFileHandler hFile, FuserFileAccess access, FileShare share, FileMode mode, FileOptions options, FileAttributes attribut)
 {
     lock (this) {
         return(this.sourceSystem.CreateFile(hFile, access, share, mode, options, attribut));
     }
 }
Пример #19
0
 public Win32Returncode SetFileAttributes(FuserFileHandler hFile, FileAttributes attr)
 {
     lock (this) {
         return(this.sourceSystem.SetFileAttributes(hFile, attr));
     }
 }
Пример #20
0
 public Win32Returncode GetFileInformation(FuserFileHandler hFile, FuserFileInformation fileinfo)
 {
     lock (this) {
         return(this.sourceSystem.GetFileInformation(hFile, fileinfo));
     }
 }
Пример #21
0
 public Win32Returncode SetFileTime(FuserFileHandler hFile, DateTime CreationTime, DateTime LastAccessTime, DateTime LastWriteTime)
 {
     lock (this) {
         return(this.sourceSystem.SetFileTime(hFile, CreationTime, LastAccessTime, LastWriteTime));
     }
 }
Пример #22
0
 public Win32Returncode SetEndOfFile(FuserFileHandler hFile, long length)
 {
     lock (this) {
         return(this.sourceSystem.SetEndOfFile(hFile, length));
     }
 }
Пример #23
0
 public Win32Returncode FindFiles(FuserFileHandler hFile, List <FuserFileInformation> files)
 {
     lock (this) {
         return(this.sourceSystem.FindFiles(hFile, files));
     }
 }
Пример #24
0
 public Win32Returncode ReadFile(FuserFileHandler hFile, byte[] buffer, ref uint readBytes, long offset)
 {
     lock (this) {
         return(this.sourceSystem.ReadFile(hFile, buffer, ref readBytes, offset));
     }
 }
Пример #25
0
 public Win32Returncode WriteFile(FuserFileHandler hFile, byte[] buffer, ref uint writtenBytes, long offset)
 {
     lock (this) {
         return(this.sourceSystem.WriteFile(hFile, buffer, ref writtenBytes, offset));
     }
 }