public override byte[] GetParameters(bool isUnicode)
        {
            int length = 28;

            if (isUnicode)
            {
                length += FileName.Length * 2 + 2;
            }
            else
            {
                length += FileName.Length + 1;
            }

            byte[] parameters = new byte[length];
            LittleEndianWriter.WriteUInt16(parameters, 0, (ushort)Flags);
            AccessMode.WriteBytes(parameters, 2);
            LittleEndianWriter.WriteUInt16(parameters, 4, Reserved1);
            LittleEndianWriter.WriteUInt16(parameters, 6, (ushort)FileAttributes);
            UTimeHelper.WriteUTime(parameters, 8, CreationTime);
            OpenMode.WriteBytes(parameters, 12);
            LittleEndianWriter.WriteUInt32(parameters, 14, AllocationSize);
            ByteWriter.WriteBytes(parameters, 18, Reserved, 10);
            SMB1Helper.WriteSMBString(parameters, 28, isUnicode, FileName);
            return(parameters);
        }
Example #2
0
        public override byte[] GetBytes(bool isUnicode)
        {
            this.SMBParameters = new byte[ParametersLength];
            int parametersOffset = 4;

            LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)Flags);
            AccessMode.WriteBytes(this.SMBParameters, ref parametersOffset);
            LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)SearchAttrs);
            LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)FileAttrs);
            UTimeHelper.WriteUTime(this.SMBParameters, ref parametersOffset, CreationTime);
            OpenMode.WriteBytes(this.SMBParameters, ref parametersOffset);
            LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, AllocationSize);
            LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, Timeout);
            LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, Reserved);

            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));
        }
Example #3
0
 public override byte[] GetBytes(bool isUnicode)
 {
     this.SMBParameters = new byte[ParametersLength];
     LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, FID);
     UTimeHelper.WriteUTime(this.SMBParameters, 2, LastTimeModified);
     return(base.GetBytes(isUnicode));
 }
        public override byte[] GetBytes(bool isUnicode)
        {
            this.SMBParameters = new byte[ParameterLength];
            LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, (ushort)FileAttributes);
            UTimeHelper.WriteUTime(this.SMBParameters, 2, LastWriteTime);
            LittleEndianWriter.WriteUInt32(this.SMBParameters, 6, FileSize);
            ByteWriter.WriteBytes(this.SMBParameters, 10, Reserved, 10);

            return(base.GetBytes(isUnicode));
        }
 public override byte[] GetParameters(bool isUnicode)
 {
     byte[] parameters = new byte[ParametersLength];
     LittleEndianWriter.WriteUInt16(parameters, 0, FID);
     LittleEndianWriter.WriteUInt16(parameters, 2, (ushort)FileAttributes);
     UTimeHelper.WriteUTime(parameters, 4, CreationTime);
     LittleEndianWriter.WriteUInt32(parameters, 8, FileDataSize);
     AccessMode.WriteBytes(parameters, 12);
     LittleEndianWriter.WriteUInt16(parameters, 14, (ushort)ResourceType);
     NMPipeStatus.WriteBytes(parameters, 16);
     ActionTaken.WriteBytes(parameters, 18);
     LittleEndianWriter.WriteUInt32(parameters, 20, Reserved);
     LittleEndianWriter.WriteUInt16(parameters, 24, ExtendedAttributeErrorOffset);
     LittleEndianWriter.WriteUInt32(parameters, 26, ExtendedAttributeLength);
     return(parameters);
 }
Example #6
0
        public override byte[] GetBytes(bool isUnicode)
        {
            this.SMBParameters = new byte[ParametersLength];
            int parametersOffset = 4;

            LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, FID);
            LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)FileAttrs);
            UTimeHelper.WriteUTime(this.SMBParameters, ref parametersOffset, LastWriteTime);
            LittleEndianWriter.WriteUInt32(this.SMBParameters, ref parametersOffset, FileDataSize);
            LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)AccessRights);
            LittleEndianWriter.WriteUInt16(this.SMBParameters, ref parametersOffset, (ushort)ResourceType);
            NMPipeStatus.WriteBytes(this.SMBParameters, ref parametersOffset);
            OpenResults.WriteBytes(this.SMBParameters, ref parametersOffset);
            ByteWriter.WriteBytes(this.SMBParameters, ref parametersOffset, Reserved, 6);
            return(base.GetBytes(isUnicode));
        }
Example #7
0
        public override byte[] GetBytes(bool isUnicode)
        {
            this.SMBParameters = new byte[ParametersLength];
            LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, (ushort)FileAttributes);
            UTimeHelper.WriteUTime(this.SMBParameters, 2, LastWriteTime);
            ByteWriter.WriteBytes(this.SMBParameters, 6, Reserved, 10);

            int length = 1;

            if (isUnicode)
            {
                length += FileName.Length * 2 + 2;
            }
            else
            {
                length += FileName.Length + 1;
            }
            this.SMBData = new byte[length];
            ByteWriter.WriteByte(this.SMBData, 0, BufferFormat);
            SMB1Helper.WriteSMBString(this.SMBData, 1, isUnicode, FileName);

            return(base.GetBytes(isUnicode));
        }