public void SMBDRead(uint treeId, FILEID fileId, Channel_Values channel, out byte[] buffer, uint offset, uint length, RDMAEndian endian)
        {
            NtStatus status;
            SmbdBufferDescriptorV1 descriptor;


            status = smbdClient.RegisterBuffer(
                (uint)length,
                SmbdBufferReadWrite.RDMA_WRITE_PERMISSION_FOR_READ_FILE,
                endianMap[endian],
                out descriptor
                );

            if (status != NtStatus.STATUS_SUCCESS)
            {
                throw new InvalidOperationException("SMBD register buffer failed!");
            }


            byte[] channelInfo = TypeMarshal.ToBytes(descriptor);

            Packet_Header packetHeader;
            READ_Response response;

            status = (NtStatus)Read(
                0,
                RequestAndConsumeCredit(),
                signingRequired ? Packet_Header_Flags_Values.FLAGS_SIGNED : Packet_Header_Flags_Values.NONE,
                GetMessageId(),
                sessionId,
                treeId,
                length,
                offset,
                fileId,
                length,
                channel,
                0,
                channelInfo,
                out buffer,
                out packetHeader,
                out response
                );

            UpdateCredit(packetHeader);

            if (status != NtStatus.STATUS_SUCCESS)
            {
                throw new InvalidOperationException("Read through SMBD failed!");
            }

            buffer = new byte[length];

            status = smbdClient.ReadRegisteredBuffer(buffer, descriptor);

            if (status != NtStatus.STATUS_SUCCESS)
            {
                throw new InvalidOperationException("SMBD write buffer failed!");
            }
        }
Beispiel #2
0
 public NtStatus SmbdReadRegisteredBuffer(byte[] data, SmbdBufferDescriptorV1 bufferDescriptor)
 {
     return(smbdClient.ReadRegisteredBuffer(data, bufferDescriptor));
 }