/// <summary> /// public Constructor /// </summary> /// <param name="treeConnect">The SMB tree connect associated with this open.</param> /// <param name="pathName">A variable-length string that contains the Unicode path name on which the open /// is performed.</param> /// <param name="fileId">The unique (per-connection) 16-bit FID identifying this open.</param> /// <param name="opLock">An element indicating the type of OpLock, if any, that has been granted on this open. /// This value MUST be one of None, Exclusive, Batch, or Level II.</param> /// <param name="grantedAccess">The access granted on this open.</param> /// <param name="fileGlobalId">A numeric value obtained by registration with the Server Service Remote Protocol. /// </param> /// <param name="pid">The unique (per connection) 32-bit PID provided in the client request that created this /// open.</param> public CifsServerPerOpenFile( IFileServiceServerTreeConnect treeConnect, string pathName, long fileId, uint grantedAccess, OplockLevelValue opLock, int fileGlobalId, uint pid) { this.treeConnect = treeConnect; this.pathName = pathName; this.fileId = fileId; this.fileGlobalId = fileGlobalId; this.grantedAccess = grantedAccess; this.opLock = opLock; this.pid = pid; this.locks = new Dictionary<int, object>(); }
/// <summary> /// public Constructor /// </summary> /// <param name="treeConnect">The SMB tree connect associated with this open.</param> /// <param name="pathName">A variable-length string that contains the Unicode path name on which the open /// is performed.</param> /// <param name="fileId">The unique (per-connection) 16-bit FID identifying this open.</param> /// <param name="opLock">An element indicating the type of OpLock, if any, that has been granted on this open. /// This value MUST be one of None, Exclusive, Batch, or Level II.</param> /// <param name="grantedAccess">The access granted on this open.</param> /// <param name="fileGlobalId">A numeric value obtained by registration with the Server Service Remote Protocol. /// </param> /// <param name="pid">The unique (per connection) 32-bit PID provided in the client request that created this /// open.</param> public CifsServerPerOpenFile( IFileServiceServerTreeConnect treeConnect, string pathName, long fileId, uint grantedAccess, OplockLevelValue opLock, int fileGlobalId, uint pid) { this.treeConnect = treeConnect; this.pathName = pathName; this.fileId = fileId; this.fileGlobalId = fileGlobalId; this.grantedAccess = grantedAccess; this.opLock = opLock; this.pid = pid; this.locks = new Dictionary <int, object>(); }
public SmbNtCreateAndxResponsePacket CreateNtCreateAndxResponse( CifsServerPerConnection connection, SmbNtCreateAndxRequestPacket request, OplockLevelValue opLockLevel, ulong allocationSize, ulong endOfFile, FileTypeValue resourceType, SMB_NMPIPE_STATUS nmPipeStatus, byte directory, SmbPacket andxPacket) { SmbNtCreateAndxResponsePacket response = new SmbNtCreateAndxResponsePacket(); response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request); SMB_COM_NT_CREATE_ANDX_Response_SMB_Parameters smbParameters = response.SmbParameters; smbParameters.AndXCommand = andxPacket != null ? andxPacket.SmbHeader.Command : SmbCommand.SMB_COM_NO_ANDX_COMMAND; smbParameters.AndXReserved = 0x00; smbParameters.AndXOffset = (ushort)(response.HeaderSize + Marshal.SizeOf(response.SmbParameters) + Marshal.SizeOf(response.SmbData)); smbParameters.OplockLevel = opLockLevel; smbParameters.FID = (ushort)connection.GenerateFID(); smbParameters.CreateDisposition = NtTransactCreateDisposition.FILE_CREATE; FileTime fileTime = new FileTime(); fileTime.Time = (ulong)DateTime.Now.ToFileTime(); smbParameters.CreateTime = fileTime; smbParameters.LastAccessTime = fileTime; smbParameters.LastChangeTime = fileTime; smbParameters.ExtFileAttributes = (SMB_EXT_FILE_ATTR)request.SmbParameters.ExtFileAttributes; smbParameters.AllocationSize = allocationSize; smbParameters.EndOfFile = endOfFile; smbParameters.ResourceType = resourceType; smbParameters.NMPipeStatus = nmPipeStatus; smbParameters.Directory = directory; smbParameters.WordCount = (byte)(TypeMarshal.GetBlockMemorySize(smbParameters) / 2); response.SmbParameters = smbParameters; response.AndxPacket = andxPacket; response.UpdateHeader(); return response; }