private void ExpectIoctlPayload(Smb2Client client, out uint status, out byte[] payload) { if (client == null) { throw new InvalidOperationException("The transport is not connected."); } Smb2IOCtlResponsePacket response = client.ExpectPacket <Smb2IOCtlResponsePacket>(ioctlRequestMessageIds.Dequeue()); payload = null; if (response.PayLoad.OutputCount > 0) { payload = response.Buffer.Skip((int)(response.PayLoad.OutputOffset - response.BufferOffset)).Take((int)response.PayLoad.OutputCount).ToArray(); } status = response.Header.Status; }