public TreeConnectAndXResponse(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)
        {
            OptionalSupport = (OptionalSupportFlags)LittleEndianConverter.ToUInt16(this.SMBParameters, 4);

            int    dataOffset    = 0;
            string serviceString = ByteReader.ReadNullTerminatedAnsiString(this.SMBData, ref dataOffset);

            NativeFileSystem = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);

            Service = TreeConnectHelper.GetServiceName(serviceString);
        }
Пример #2
0
        public TreeConnectAndXResponseExtended(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)
        {
            int parametersOffset = 4;

            OptionalSupport               = (OptionalSupportFlags)LittleEndianReader.ReadUInt16(this.SMBParameters, ref parametersOffset);
            MaximalShareAccessRights      = new AccessMask(this.SMBParameters, ref parametersOffset);
            GuestMaximalShareAccessRights = new AccessMask(this.SMBParameters, ref parametersOffset);

            int    dataOffset    = 0;
            string serviceString = ByteReader.ReadNullTerminatedAnsiString(this.SMBData, ref dataOffset);

            NativeFileSystem = SMBHelper.ReadSMBString(this.SMBData, ref dataOffset, isUnicode);

            Service = TreeConnectHelper.GetServiceName(serviceString);
        }
Пример #3
0
        private static TreeConnectAndXResponse CreateTreeConnectResponse(ServiceName serviceName, OptionalSupportFlags supportFlags)
        {
            TreeConnectAndXResponse response = new TreeConnectAndXResponse();

            response.OptionalSupport  = supportFlags;
            response.NativeFileSystem = String.Empty;
            response.Service          = serviceName;
            return(response);
        }
Пример #4
0
        private static TreeConnectAndXResponseExtended CreateTreeConnectResponseExtended(ServiceName serviceName, OptionalSupportFlags supportFlags)
        {
            TreeConnectAndXResponseExtended response = new TreeConnectAndXResponseExtended();

            response.OptionalSupport          = supportFlags;
            response.MaximalShareAccessRights = (AccessMask)(FileAccessMask.FILE_READ_DATA | FileAccessMask.FILE_WRITE_DATA | FileAccessMask.FILE_APPEND_DATA |
                                                             FileAccessMask.FILE_READ_EA | FileAccessMask.FILE_WRITE_EA |
                                                             FileAccessMask.FILE_EXECUTE |
                                                             FileAccessMask.FILE_READ_ATTRIBUTES | FileAccessMask.FILE_WRITE_ATTRIBUTES) |
                                                AccessMask.DELETE | AccessMask.READ_CONTROL | AccessMask.WRITE_DAC | AccessMask.WRITE_OWNER | AccessMask.SYNCHRONIZE;
            response.GuestMaximalShareAccessRights = (AccessMask)(FileAccessMask.FILE_READ_DATA | FileAccessMask.FILE_WRITE_DATA |
                                                                  FileAccessMask.FILE_READ_EA | FileAccessMask.FILE_WRITE_EA |
                                                                  FileAccessMask.FILE_READ_ATTRIBUTES | FileAccessMask.FILE_WRITE_ATTRIBUTES) |
                                                     AccessMask.READ_CONTROL | AccessMask.SYNCHRONIZE;
            response.NativeFileSystem = String.Empty;
            response.Service          = serviceName;
            return(response);
        }