コード例 #1
0
ファイル: OpenAndXRequest.cs プロジェクト: SonnyX/SMB-Client
        public override byte[] GetBytes(bool isUnicode)
        {
            SMBParameters = new byte[ParametersLength];
            int parametersOffset = 4;

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

            int padding = 0;

            if (isUnicode)
            {
                padding = 1;
                SMBData = new byte[padding + FileName.Length * 2 + 2];
            }
            else
            {
                SMBData = new byte[FileName.Length + 1];
            }
            SMB1Helper.WriteSMBString(SMBData, padding, isUnicode, FileName);

            return(base.GetBytes(isUnicode));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 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);
 }