Esempio n. 1
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));
        }
        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);
        }
 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);
 }