break;
}
- if (WTSVirtualChannelRead(context->priv->ChannelHandle, 0,
- (PCHAR) Stream_Buffer(s), Stream_Capacity(s), &BytesReturned))
+ WTSVirtualChannelRead(context->priv->ChannelHandle, 0, NULL, 0, &BytesReturned);
+ if (BytesReturned < 1)
+ continue;
+ Stream_EnsureRemainingCapacity(s, BytesReturned);
+ if (!WTSVirtualChannelRead(context->priv->ChannelHandle, 0,
+ (PCHAR) Stream_Buffer(s), Stream_Capacity(s), &BytesReturned))
{
- if (BytesReturned)
- Stream_Seek(s, BytesReturned);
- }
- else
- {
- Stream_EnsureRemainingCapacity(s, BytesReturned);
+ break;
}
- if (0)
+ if (Stream_GetPosition(s) >= ENCOMSP_ORDER_HEADER_SIZE)
{
- encomsp_server_receive_pdu(context, s);
+ header = (ENCOMSP_ORDER_HEADER*) Stream_Buffer(s);
+
+ if (header->Length >= Stream_GetPosition(s))
+ {
+ Stream_SealLength(s);
+ Stream_SetPosition(s, 0);
+ encomsp_server_receive_pdu(context, s);
+ Stream_SetPosition(s, 0);
+ }
}
}