public override void WriteCommandBytes(byte[] buffer, int offset) { SecurityBufferOffset = 0; SecurityBufferLength = (ushort)SecurityBuffer.Length; int paddedSecurityBufferLength = (int)Math.Ceiling((double)SecurityBufferLength / 8) * 8; if (SecurityBuffer.Length > 0) { SecurityBufferOffset = SMB2Header.Length + FixedSize; } NegotiateContextOffset = 0; NegotiateContextCount = (ushort)NegotiateContextList.Count; if (NegotiateContextList.Count > 0) { // NegotiateContextList must be 8-byte aligned NegotiateContextOffset = (uint)(SMB2Header.Length + FixedSize + paddedSecurityBufferLength); } LittleEndianWriter.WriteUInt16(buffer, offset + 0, StructureSize); LittleEndianWriter.WriteUInt16(buffer, offset + 2, (ushort)SecurityMode); LittleEndianWriter.WriteUInt16(buffer, offset + 4, (ushort)DialectRevision); LittleEndianWriter.WriteUInt16(buffer, offset + 6, NegotiateContextCount); LittleEndianWriter.WriteGuidBytes(buffer, offset + 8, ServerGuid); LittleEndianWriter.WriteUInt32(buffer, offset + 24, (uint)Capabilities); LittleEndianWriter.WriteUInt32(buffer, offset + 28, MaxTransactSize); LittleEndianWriter.WriteUInt32(buffer, offset + 32, MaxReadSize); LittleEndianWriter.WriteUInt32(buffer, offset + 36, MaxWriteSize); LittleEndianWriter.WriteInt64(buffer, offset + 40, SystemTime.ToFileTimeUtc()); LittleEndianWriter.WriteInt64(buffer, offset + 48, ServerStartTime.ToFileTimeUtc()); LittleEndianWriter.WriteUInt16(buffer, offset + 56, SecurityBufferOffset); LittleEndianWriter.WriteUInt16(buffer, offset + 58, SecurityBufferLength); LittleEndianWriter.WriteUInt32(buffer, offset + 60, NegotiateContextOffset); ByteWriter.WriteBytes(buffer, offset + FixedSize, SecurityBuffer); NegotiateContext.WriteNegotiateContextList(buffer, offset + FixedSize + paddedSecurityBufferLength, NegotiateContextList); }
public override byte[] GetBytes(bool isUnicode) { NameLength = (ushort)FileName.Length; this.SMBParameters = new byte[ParametersLength]; ByteWriter.WriteByte(this.SMBParameters, 0, (byte)AndXCommand); ByteWriter.WriteByte(this.SMBParameters, 1, AndXReserved); LittleEndianWriter.WriteUInt16(this.SMBParameters, 2, AndXOffset); ByteWriter.WriteByte(this.SMBParameters, 4, Reserved); LittleEndianWriter.WriteUInt16(this.SMBParameters, 5, NameLength); LittleEndianWriter.WriteUInt32(this.SMBParameters, 7, (uint)Flags); LittleEndianWriter.WriteUInt32(this.SMBParameters, 11, RootDirectoryFID); LittleEndianWriter.WriteUInt32(this.SMBParameters, 15, (uint)DesiredAccess); LittleEndianWriter.WriteInt64(this.SMBParameters, 19, AllocationSize); LittleEndianWriter.WriteUInt32(this.SMBParameters, 27, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt32(this.SMBParameters, 31, (uint)ShareAccess); LittleEndianWriter.WriteUInt32(this.SMBParameters, 35, (uint)CreateDisposition); LittleEndianWriter.WriteUInt32(this.SMBParameters, 39, (uint)CreateOptions); LittleEndianWriter.WriteUInt32(this.SMBParameters, 43, (uint)ImpersonationLevel); ByteWriter.WriteByte(this.SMBParameters, 47, (byte)SecurityFlags); int padding = 0; if (isUnicode) { padding = 1; this.SMBData = new byte[padding + FileName.Length * 2 + 2]; } else { this.SMBData = new byte[FileName.Length + 1]; } SMB1Helper.WriteSMBString(this.SMBData, padding, isUnicode, FileName); return(base.GetBytes(isUnicode)); }
public override void WriteBytes(byte[] buffer, int offset) { LittleEndianWriter.WriteInt64(buffer, offset + 0, TotalAllocationUnits); LittleEndianWriter.WriteInt64(buffer, offset + 8, AvailableAllocationUnits); LittleEndianWriter.WriteUInt32(buffer, offset + 16, SectorsPerAllocationUnit); LittleEndianWriter.WriteUInt32(buffer, offset + 20, BytesPerSector); }
public override byte[] GetBytes(int bytesPerCluster) { int dataRunSequenceLength = m_dataRunSequence.RecordLength; ushort mappingPairsOffset = (ushort)(HeaderLength + Name.Length * 2); uint length = this.RecordLength; byte[] buffer = new byte[length]; WriteHeader(buffer, HeaderLength); ulong allocatedLength = (ulong)(m_dataRunSequence.DataClusterCount * bytesPerCluster); ushort dataRunsOffset = (ushort)(HeaderLength + Name.Length * 2); LittleEndianWriter.WriteInt64(buffer, 0x10, LowestVCN); LittleEndianWriter.WriteInt64(buffer, 0x18, HighestVCN); LittleEndianWriter.WriteUInt16(buffer, 0x20, mappingPairsOffset); LittleEndianWriter.WriteUInt16(buffer, 0x22, CompressionUnitSize); LittleEndianWriter.WriteUInt64(buffer, 0x28, allocatedLength); LittleEndianWriter.WriteUInt64(buffer, 0x30, FileSize); LittleEndianWriter.WriteUInt64(buffer, 0x38, FileSize); int position = dataRunsOffset; foreach (DataRun run in m_dataRunSequence) { byte[] runBytes = run.GetBytes(); Array.Copy(runBytes, 0, buffer, position, runBytes.Length); position += runBytes.Length; } buffer[position] = 0; // Null termination return(buffer); }
public void WriteBytes(byte[] buffer, int offset) { StreamNameLength = (uint)(StreamName.Length * 2); LittleEndianWriter.WriteUInt32(buffer, offset + 0, NextEntryOffset); LittleEndianWriter.WriteUInt32(buffer, offset + 4, StreamNameLength); LittleEndianWriter.WriteInt64(buffer, offset + 8, StreamSize); LittleEndianWriter.WriteInt64(buffer, offset + 16, StreamAllocationSize); ByteWriter.WriteUTF16String(buffer, offset + 24, StreamName); }
public override void WriteBytes(byte[] buffer, int offset) { LittleEndianWriter.WriteInt64(buffer, offset + 0, CompressedFileSize); LittleEndianWriter.WriteUInt16(buffer, offset + 8, (ushort)CompressionFormat); ByteWriter.WriteByte(buffer, offset + 10, CompressionUnitShift); ByteWriter.WriteByte(buffer, offset + 11, ChunkShift); ByteWriter.WriteByte(buffer, offset + 12, ClusterShift); ByteWriter.WriteBytes(buffer, offset + 13, Reserved, 3); }
public override void WriteBytes(byte[] buffer, int offset) { LittleEndianWriter.WriteInt64(buffer, offset + 0, AllocationSize); LittleEndianWriter.WriteInt64(buffer, offset + 8, EndOfFile); LittleEndianWriter.WriteUInt32(buffer, offset + 16, NumberOfLinks); ByteWriter.WriteByte(buffer, offset + 20, Convert.ToByte(DeletePending)); ByteWriter.WriteByte(buffer, offset + 21, Convert.ToByte(Directory)); LittleEndianWriter.WriteUInt16(buffer, offset + 22, Reserved); }
public override byte[] GetBytes(bool isUnicode) { byte[] buffer = new byte[Length]; LittleEndianWriter.WriteInt64(buffer, 0, TotalAllocationUnits); LittleEndianWriter.WriteInt64(buffer, 8, TotalFreeAllocationUnits); LittleEndianWriter.WriteUInt32(buffer, 16, SectorsPerAllocationUnit); LittleEndianWriter.WriteUInt32(buffer, 20, BytesPerSector); return(buffer); }
public static void WriteFileTime(byte[] buffer, int offset, DateTime?time) { long span = 0; if (time.HasValue) { span = time.Value.ToFileTimeUtc(); } LittleEndianWriter.WriteInt64(buffer, offset, span); }
public override void WriteBytes(byte[] buffer, int offset) { LittleEndianWriter.WriteInt64(buffer, offset + 0, FreeSpaceStartFiltering); LittleEndianWriter.WriteInt64(buffer, offset + 8, FreeSpaceThreshold); LittleEndianWriter.WriteInt64(buffer, offset + 16, FreeSpaceStopFiltering); LittleEndianWriter.WriteUInt64(buffer, offset + 24, DefaultQuotaThreshold); LittleEndianWriter.WriteUInt64(buffer, offset + 32, DefaultQuotaLimit); LittleEndianWriter.WriteUInt32(buffer, offset + 40, (uint)FileSystemControlFlags); LittleEndianWriter.WriteUInt32(buffer, offset + 44, Padding); }
public override void WriteBytes(byte[] buffer, int offset) { FileTimeHelper.WriteFileTime(buffer, offset + 0, CreationTime); FileTimeHelper.WriteFileTime(buffer, offset + 8, LastAccessTime); FileTimeHelper.WriteFileTime(buffer, offset + 16, LastWriteTime); FileTimeHelper.WriteFileTime(buffer, offset + 24, ChangeTime); LittleEndianWriter.WriteInt64(buffer, offset + 32, AllocationSize); LittleEndianWriter.WriteInt64(buffer, offset + 40, EndOfFile); LittleEndianWriter.WriteUInt32(buffer, offset + 48, (uint)FileAttributes); LittleEndianWriter.WriteUInt32(buffer, offset + 52, Reserved); }
public override byte[] GetBytes() { byte[] buffer = new byte[Length]; int offset = 0; LittleEndianWriter.WriteInt64(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteInt64(buffer, ref offset, EndOfFile); LittleEndianWriter.WriteUInt32(buffer, ref offset, NumberOfLinks); ByteWriter.WriteByte(buffer, ref offset, Convert.ToByte(DeletePending)); ByteWriter.WriteByte(buffer, ref offset, Convert.ToByte(Directory)); return(buffer); }
public override void WriteCommandBytes(byte[] buffer, int offset) { LittleEndianWriter.WriteUInt16(buffer, offset + 0, StructureSize); LittleEndianWriter.WriteUInt16(buffer, offset + 2, (ushort)Flags); LittleEndianWriter.WriteUInt32(buffer, offset + 4, Reserved); FileTimeHelper.WriteFileTime(buffer, offset + 8, CreationTime); FileTimeHelper.WriteFileTime(buffer, offset + 16, LastAccessTime); FileTimeHelper.WriteFileTime(buffer, offset + 24, LastWriteTime); FileTimeHelper.WriteFileTime(buffer, offset + 32, ChangeTime); LittleEndianWriter.WriteInt64(buffer, offset + 40, AllocationSize); LittleEndianWriter.WriteInt64(buffer, offset + 48, EndofFile); LittleEndianWriter.WriteUInt32(buffer, offset + 56, (uint)FileAttributes); }
public override byte[] GetBytes() { byte[] buffer = new byte[Length]; int offset = 0; LittleEndianWriter.WriteInt64(buffer, ref offset, CompressedFileSize); LittleEndianWriter.WriteUInt16(buffer, ref offset, (ushort)CompressionFormat); ByteWriter.WriteByte(buffer, ref offset, CompressionUnitShift); ByteWriter.WriteByte(buffer, ref offset, ChunkShift); ByteWriter.WriteByte(buffer, ref offset, ClusterShift); ByteWriter.WriteBytes(buffer, ref offset, Reserved, 3); return(buffer); }
public override byte[] GetBytes() { uint streamNameLength = (uint)(StreamName.Length * 2); byte[] buffer = new byte[FixedLength + streamNameLength]; int offset = 0; LittleEndianWriter.WriteUInt32(buffer, ref offset, NextEntryOffset); LittleEndianWriter.WriteUInt32(buffer, ref offset, streamNameLength); LittleEndianWriter.WriteInt64(buffer, ref offset, StreamSize); LittleEndianWriter.WriteInt64(buffer, ref offset, StreamAllocationSize); ByteWriter.WriteUTF16String(buffer, ref offset, StreamName); return(buffer); }
public override void WriteBytes(byte[] buffer, int offset) { base.WriteBytes(buffer, offset); FileNameLength = (uint)(FileName.Length * 2); LittleEndianWriter.WriteInt64(buffer, offset + 8, CreationTime.ToFileTimeUtc()); LittleEndianWriter.WriteInt64(buffer, offset + 16, LastAccessTime.ToFileTimeUtc()); LittleEndianWriter.WriteInt64(buffer, offset + 24, LastWriteTime.ToFileTimeUtc()); LittleEndianWriter.WriteInt64(buffer, offset + 32, ChangeTime.ToFileTimeUtc()); LittleEndianWriter.WriteInt64(buffer, offset + 40, EndOfFile); LittleEndianWriter.WriteInt64(buffer, offset + 48, AllocationSize); LittleEndianWriter.WriteUInt32(buffer, offset + 56, (uint)FileAttributes); LittleEndianWriter.WriteUInt32(buffer, offset + 60, FileNameLength); ByteWriter.WriteUTF16String(buffer, offset + 64, FileName); }
public override void WriteCommandBytes(byte[] buffer, int offset) { LittleEndianWriter.WriteUInt16(buffer, offset + 0, StructureSize); LittleEndianWriter.WriteUInt16(buffer, offset + 2, (ushort)Dialects.Count); LittleEndianWriter.WriteUInt16(buffer, offset + 4, (ushort)SecurityMode); LittleEndianWriter.WriteUInt16(buffer, offset + 6, Reserved); LittleEndianWriter.WriteUInt32(buffer, offset + 8, (uint)Capabilities); LittleEndianWriter.WriteGuid(buffer, offset + 12, ClientGuid); LittleEndianWriter.WriteInt64(buffer, offset + 28, ClientStartTime.ToFileTimeUtc()); for (int index = 0; index < Dialects.Count; index++) { SMB2Dialect dialect = Dialects[index]; LittleEndianWriter.WriteUInt16(buffer, offset + 36 + index * 2, (ushort)dialect); } }
public override void WriteBytes(byte[] buffer, ref int offset, bool isUnicode) { uint fileNameLength = (byte)(isUnicode ? FileName.Length * 2 : FileName.Length); LittleEndianWriter.WriteUInt32(buffer, ref offset, NextEntryOffset); LittleEndianWriter.WriteUInt32(buffer, ref offset, FileIndex); FileTimeHelper.WriteFileTime(buffer, ref offset, CreationTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastAccessTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastWriteTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastAttrChangeTime); LittleEndianWriter.WriteInt64(buffer, ref offset, EndOfFile); LittleEndianWriter.WriteInt64(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt32(buffer, ref offset, fileNameLength); SMB1Helper.WriteSMBString(buffer, ref offset, isUnicode, FileName); }
public override void WriteBytes(byte[] buffer, int offset) { LittleEndianWriter.WriteUInt32(buffer, ref offset, AllocatedOrNextFree); LittleEndianWriter.WriteUInt32(buffer, ref offset, TargetAttributeOffset); LittleEndianWriter.WriteUInt32(buffer, ref offset, LengthOfTransfer); LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)LCNsForPage.Count); if (m_majorVersion == 0) { LittleEndianWriter.WriteUInt32(buffer, ref offset, Reserved); } LittleEndianWriter.WriteUInt64(buffer, ref offset, (ulong)VCN); LittleEndianWriter.WriteUInt64(buffer, ref offset, OldestLsn); for (int index = 0; index < LCNsForPage.Count; index++) { LittleEndianWriter.WriteInt64(buffer, ref offset, LCNsForPage[index]); } }
public override byte[] GetBytes(bool isUnicode) { SMBParameters = new byte[ParametersLength]; int parametersOffset = 4; ByteWriter.WriteByte(SMBParameters, ref parametersOffset, (byte)OpLockLevel); LittleEndianWriter.WriteUInt16(SMBParameters, ref parametersOffset, FID); LittleEndianWriter.WriteUInt32(SMBParameters, ref parametersOffset, (uint)CreateDisposition); FileTimeHelper.WriteFileTime(SMBParameters, ref parametersOffset, CreateTime); FileTimeHelper.WriteFileTime(SMBParameters, ref parametersOffset, LastAccessTime); FileTimeHelper.WriteFileTime(SMBParameters, ref parametersOffset, LastWriteTime); FileTimeHelper.WriteFileTime(SMBParameters, ref parametersOffset, LastChangeTime); LittleEndianWriter.WriteUInt32(SMBParameters, ref parametersOffset, (uint)ExtFileAttributes); LittleEndianWriter.WriteInt64(SMBParameters, ref parametersOffset, AllocationSize); LittleEndianWriter.WriteInt64(SMBParameters, ref parametersOffset, EndOfFile); LittleEndianWriter.WriteUInt16(SMBParameters, ref parametersOffset, (ushort)ResourceType); NMPipeStatus.WriteBytes(SMBParameters, ref parametersOffset); ByteWriter.WriteByte(SMBParameters, ref parametersOffset, Convert.ToByte(Directory)); return(base.GetBytes(isUnicode)); }
public override byte[] GetBytes() { int dataRunSequenceLength = m_dataRunSequence.RecordLength; ushort mappingPairsOffset = (ushort)(HeaderLength + Name.Length * 2); int length = this.RecordLength; byte[] buffer = new byte[length]; WriteHeader(buffer, HeaderLength); ushort dataRunsOffset = (ushort)(HeaderLength + Name.Length * 2); LittleEndianWriter.WriteInt64(buffer, 0x10, LowestVCN); LittleEndianWriter.WriteInt64(buffer, 0x18, HighestVCN); LittleEndianWriter.WriteUInt16(buffer, 0x20, mappingPairsOffset); ByteWriter.WriteByte(buffer, 0x22, CompressionUnit); LittleEndianWriter.WriteUInt64(buffer, 0x28, AllocatedLength); LittleEndianWriter.WriteUInt64(buffer, 0x30, FileSize); LittleEndianWriter.WriteUInt64(buffer, 0x38, ValidDataLength); m_dataRunSequence.WriteBytes(buffer, dataRunsOffset); return(buffer); }
public override void WriteCommandBytes(byte[] buffer, int offset) { LittleEndianWriter.WriteUInt16(buffer, offset + 0, StructureSize); ByteWriter.WriteByte(buffer, offset + 2, (byte)OplockLevel); ByteWriter.WriteByte(buffer, offset + 3, (byte)Flags); LittleEndianWriter.WriteUInt32(buffer, offset + 4, (uint)CreateAction); FileTimeHelper.WriteFileTime(buffer, offset + 8, CreationTime); FileTimeHelper.WriteFileTime(buffer, offset + 16, LastAccessTime); FileTimeHelper.WriteFileTime(buffer, offset + 24, LastWriteTime); FileTimeHelper.WriteFileTime(buffer, offset + 32, ChangeTime); LittleEndianWriter.WriteInt64(buffer, offset + 40, AllocationSize); LittleEndianWriter.WriteInt64(buffer, offset + 48, EndofFile); LittleEndianWriter.WriteUInt32(buffer, offset + 56, (uint)FileAttributes); LittleEndianWriter.WriteUInt32(buffer, offset + 60, Reserved2); FileId.WriteBytes(buffer, offset + 64); CreateContextsOffsets = 0; CreateContextsLength = (uint)CreateContext.GetCreateContextListLength(CreateContexts); if (CreateContexts.Count > 0) { CreateContextsOffsets = SMB2Header.Length + 88; CreateContext.WriteCreateContextList(buffer, 88, CreateContexts); } }
public override byte[] GetBytes(bool isUnicode) { byte challengeLength = 0; this.SMBParameters = new byte[ParametersLength]; LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, DialectIndex); ByteWriter.WriteByte(this.SMBParameters, 2, (byte)SecurityMode); LittleEndianWriter.WriteUInt16(this.SMBParameters, 3, MaxMpxCount); LittleEndianWriter.WriteUInt16(this.SMBParameters, 5, MaxNumberVcs); LittleEndianWriter.WriteUInt32(this.SMBParameters, 7, MaxBufferSize); LittleEndianWriter.WriteUInt32(this.SMBParameters, 11, MaxRawSize); LittleEndianWriter.WriteUInt32(this.SMBParameters, 15, SessionKey); LittleEndianWriter.WriteUInt32(this.SMBParameters, 19, (uint)Capabilities); LittleEndianWriter.WriteInt64(this.SMBParameters, 23, SystemTime.ToFileTimeUtc()); LittleEndianWriter.WriteInt16(this.SMBParameters, 31, ServerTimeZone); ByteWriter.WriteByte(this.SMBParameters, 33, challengeLength); this.SMBData = new byte[16 + SecurityBlob.Length]; LittleEndianWriter.WriteGuidBytes(this.SMBData, 0, ServerGuid); ByteWriter.WriteBytes(this.SMBData, 16, SecurityBlob); return(base.GetBytes(isUnicode)); }
public override byte[] GetBytes(bool isUnicode) { byte challengeLength = (byte)this.Challenge.Length; this.SMBParameters = new byte[ParametersLength]; LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, DialectIndex); ByteWriter.WriteByte(this.SMBParameters, 2, (byte)SecurityMode); LittleEndianWriter.WriteUInt16(this.SMBParameters, 3, MaxMpxCount); LittleEndianWriter.WriteUInt16(this.SMBParameters, 5, MaxNumberVcs); LittleEndianWriter.WriteUInt32(this.SMBParameters, 7, MaxBufferSize); LittleEndianWriter.WriteUInt32(this.SMBParameters, 11, MaxRawSize); LittleEndianWriter.WriteUInt32(this.SMBParameters, 15, SessionKey); LittleEndianWriter.WriteUInt32(this.SMBParameters, 19, (uint)Capabilities); LittleEndianWriter.WriteInt64(this.SMBParameters, 23, SystemTime.ToFileTimeUtc()); LittleEndianWriter.WriteInt16(this.SMBParameters, 31, ServerTimeZone); ByteWriter.WriteByte(this.SMBParameters, 33, challengeLength); int padding = 0; if (isUnicode) { padding = Challenge.Length % 2; this.SMBData = new byte[Challenge.Length + padding + DomainName.Length * 2 + ServerName.Length * 2 + 4]; } else { this.SMBData = new byte[Challenge.Length + DomainName.Length + ServerName.Length + 2]; } int offset = 0; ByteWriter.WriteBytes(this.SMBData, ref offset, Challenge); offset += padding; SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, DomainName); SMBHelper.WriteSMBString(this.SMBData, ref offset, isUnicode, ServerName); return(base.GetBytes(isUnicode)); }
public override byte[] GetBytes() { uint fileNameLength = (uint)(FileName.Length * 2); byte[] buffer = new byte[FixedLength + fileNameLength]; int offset = 0; FileTimeHelper.WriteFileTime(buffer, ref offset, CreationTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastAccessTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastWriteTime); FileTimeHelper.WriteFileTime(buffer, ref offset, LastChangeTime); LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes); LittleEndianWriter.WriteUInt32(buffer, ref offset, Reserved1); LittleEndianWriter.WriteInt64(buffer, ref offset, AllocationSize); LittleEndianWriter.WriteInt64(buffer, ref offset, EndOfFile); LittleEndianWriter.WriteUInt32(buffer, ref offset, NumberOfLinks); ByteWriter.WriteByte(buffer, ref offset, Convert.ToByte(DeletePending)); ByteWriter.WriteByte(buffer, ref offset, Convert.ToByte(Directory)); LittleEndianWriter.WriteUInt16(buffer, ref offset, Reserved2); LittleEndianWriter.WriteUInt32(buffer, ref offset, EaSize); LittleEndianWriter.WriteUInt32(buffer, ref offset, fileNameLength); ByteWriter.WriteUTF16String(buffer, ref offset, FileName); return(buffer); }
public override byte[] GetBytes(bool isUnicode) { this.SMBParameters = new byte[ParametersLength]; int parametersOffset = 4; ByteWriter.WriteByte(this.SMBParameters, ref parametersOffset, (byte)OpLockLevel); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, FID); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)CreateDisposition); FileTimeHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, CreateTime); FileTimeHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastAccessTime); FileTimeHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastWriteTime); FileTimeHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastChangeTime); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)ExtFileAttributes); LittleEndianWriter.WriteInt64(this.SMBParameters, ref parametersOffset, AllocationSize); LittleEndianWriter.WriteInt64(this.SMBParameters, ref parametersOffset, EndOfFile); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)ResourceType); LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, NMPipeStatus_or_FileStatusFlags); ByteWriter.WriteByte(this.SMBParameters, ref parametersOffset, Convert.ToByte(Directory)); LittleEndianWriter.WriteGuidBytes(this.SMBParameters, ref parametersOffset, VolumeGuid); LittleEndianWriter.WriteUInt64(this.SMBParameters, ref parametersOffset, FileID); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)MaximalAccessRights); LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)GuestMaximalAccessRights); return(base.GetBytes(isUnicode)); }
public override void WriteBytes(byte[] buffer, int offset) { LittleEndianWriter.WriteInt64(buffer, offset, AllocationSize); }
public override void WriteBytes(byte[] buffer, int offset) { LittleEndianWriter.WriteInt64(buffer, offset + 0, IndexNumber); }
public override void WriteBytes(byte[] buffer, int offset) { LittleEndianWriter.WriteInt64(buffer, offset + 0, CurrentByteOffset); }
/// <summary> /// When setting file attributes, a value of -1 indicates to the server that it MUST NOT change this attribute for all subsequent operations on the same file handle. /// </summary> public static void WriteSetFileTime(byte[] buffer, int offset, SetFileTime time) { long span = time.ToFileTimeUtc(); LittleEndianWriter.WriteInt64(buffer, offset, span); }