Beispiel #1
0
 public override byte[] GetBytes()
 {
     byte[] buffer = new byte[Length];
     SMBHelper.WriteFileTime(buffer, 0, CreationTime);
     SMBHelper.WriteFileTime(buffer, 8, LastAccessTime);
     SMBHelper.WriteFileTime(buffer, 16, LastWriteTime);
     SMBHelper.WriteFileTime(buffer, 24, LastChangeTime);
     LittleEndianWriter.WriteUInt32(buffer, 32, (uint)ExtFileAttributes);
     LittleEndianWriter.WriteUInt32(buffer, 36, Reserved);
     return(buffer);
 }
        public override byte[] GetBytes(bool isUnicode)
        {
            uint volumeLabelSize = (uint)(VolumeLabel.Length * 2);

            byte[] buffer = new byte[FixedLength + volumeLabelSize];
            SMBHelper.WriteFileTime(buffer, 0, VolumeCreationTime);
            LittleEndianWriter.WriteUInt32(buffer, 8, SerialNumber);
            LittleEndianWriter.WriteUInt32(buffer, 12, volumeLabelSize);
            LittleEndianWriter.WriteUInt16(buffer, 16, Reserved);
            ByteWriter.WriteUnicodeString(buffer, 18, VolumeLabel);
            return(buffer);
        }
        public override byte[] GetBytes()
        {
            byte[] buffer = new byte[Length];
            int    offset = 0;

            SMBHelper.WriteFileTime(buffer, ref offset, CreationDateTime);
            SMBHelper.WriteFileTime(buffer, ref offset, LastAccessDateTime);
            SMBHelper.WriteFileTime(buffer, ref offset, LastWriteDateTime);
            SMBHelper.WriteFileTime(buffer, ref offset, LastChangeTime);
            LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes);
            LittleEndianWriter.WriteUInt32(buffer, ref offset, Reserved);
            return(buffer);
        }
Beispiel #4
0
        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);
            SMBHelper.WriteFileTime(buffer, ref offset, CreationTime);
            SMBHelper.WriteFileTime(buffer, ref offset, LastAccessTime);
            SMBHelper.WriteFileTime(buffer, ref offset, LastWriteTime);
            SMBHelper.WriteFileTime(buffer, ref offset, LastAttrChangeTime);
            LittleEndianWriter.WriteUInt64(buffer, ref offset, EndOfFile);
            LittleEndianWriter.WriteUInt64(buffer, ref offset, AllocationSize);
            LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes);
            LittleEndianWriter.WriteUInt32(buffer, ref offset, fileNameLength);
            SMBHelper.WriteSMBString(buffer, ref offset, isUnicode, FileName);
        }
Beispiel #5
0
        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);
            SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, CreateTime);
            SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastAccessTime);
            SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastWriteTime);
            SMBHelper.WriteFileTime(this.SMBParameters, ref parametersOffset, LastChangeTime);
            LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, (uint)ExtFileAttributes);
            LittleEndianWriter.WriteUInt64(this.SMBParameters, ref parametersOffset, AllocationSize);
            LittleEndianWriter.WriteUInt64(this.SMBParameters, ref parametersOffset, EndOfFile);
            LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)ResourceType);
            NMPipeStatus.WriteBytes(this.SMBParameters, ref parametersOffset);
            ByteWriter.WriteByte(this.SMBParameters, ref parametersOffset, Convert.ToByte(Directory));
            return(base.GetBytes(isUnicode));
        }
        public override byte[] GetBytes()
        {
            uint fileNameLength = (uint)(FileName.Length * 2);

            byte[] buffer = new byte[FixedLength + fileNameLength];
            int    offset = 0;

            SMBHelper.WriteFileTime(buffer, ref offset, CreationDateTime);
            SMBHelper.WriteFileTime(buffer, ref offset, LastAccessDateTime);
            SMBHelper.WriteFileTime(buffer, ref offset, LastWriteDateTime);
            SMBHelper.WriteFileTime(buffer, ref offset, LastChangeTime);
            LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)ExtFileAttributes);
            LittleEndianWriter.WriteUInt32(buffer, ref offset, Reserved1);
            LittleEndianWriter.WriteUInt64(buffer, ref offset, AllocationSize);
            LittleEndianWriter.WriteUInt64(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.WriteUnicodeString(buffer, ref offset, FileName);
            return(buffer);
        }