freerdp: purge old stream utils

This commit is contained in:
Marc-André Moreau 2013-05-08 16:27:21 -04:00
parent 5b92413843
commit fd230443c5
41 changed files with 179 additions and 222 deletions

View File

@ -101,7 +101,7 @@ static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, w
out = stream_new(5);
Stream_Write_UINT8(out, MSG_SNDIN_VERSION);
Stream_Write_UINT32(out, Version);
error = callback->channel->Write(callback->channel, Stream_GetPosition(s), stream_get_head(s), NULL);
error = callback->channel->Write(callback->channel, Stream_GetPosition(s), Stream_Buffer(s), NULL);
stream_free(out);
return error;
@ -146,7 +146,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
/* SoundFormats (variable) */
for (i = 0; i < NumFormats; i++)
{
stream_get_mark(s, fm);
Stream_GetPointer(s, fm);
Stream_Read_UINT16(s, format.wFormatTag);
Stream_Read_UINT16(s, format.nChannels);
Stream_Read_UINT32(s, format.nSamplesPerSec);
@ -189,7 +189,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
Stream_Write_UINT32(out, callback->formats_count); /* NumFormats (4 bytes) */
Stream_Write_UINT32(out, cbSizeFormatsPacket); /* cbSizeFormatsPacket (4 bytes) */
error = callback->channel->Write(callback->channel, cbSizeFormatsPacket, stream_get_head(out), NULL);
error = callback->channel->Write(callback->channel, cbSizeFormatsPacket, Stream_Buffer(out), NULL);
stream_free(out);
return error;
@ -204,7 +204,7 @@ static int audin_send_format_change_pdu(IWTSVirtualChannelCallback* pChannelCall
out = stream_new(5);
Stream_Write_UINT8(out, MSG_SNDIN_FORMATCHANGE);
Stream_Write_UINT32(out, NewFormat);
error = callback->channel->Write(callback->channel, 5, stream_get_head(out), NULL);
error = callback->channel->Write(callback->channel, 5, Stream_Buffer(out), NULL);
stream_free(out);
return error;
@ -219,7 +219,7 @@ static int audin_send_open_reply_pdu(IWTSVirtualChannelCallback* pChannelCallbac
out = stream_new(5);
Stream_Write_UINT8(out, MSG_SNDIN_OPEN_REPLY);
Stream_Write_UINT32(out, Result);
error = callback->channel->Write(callback->channel, 5, stream_get_head(out), NULL);
error = callback->channel->Write(callback->channel, 5, Stream_Buffer(out), NULL);
stream_free(out);
return error;
@ -239,7 +239,7 @@ static BOOL audin_receive_wave_data(BYTE* data, int size, void* user_data)
out = stream_new(size + 1);
Stream_Write_UINT8(out, MSG_SNDIN_DATA);
Stream_Write(out, data, size);
error = callback->channel->Write(callback->channel, Stream_GetPosition(out), stream_get_head(out), NULL);
error = callback->channel->Write(callback->channel, Stream_GetPosition(out), Stream_Buffer(out), NULL);
stream_free(out);
return (error == 0 ? TRUE : FALSE);

View File

@ -78,7 +78,7 @@ static void audin_server_send_version(audin_server* audin, wStream* s)
{
Stream_Write_UINT8(s, MSG_SNDIN_VERSION);
Stream_Write_UINT32(s, 1); /* Version (4 bytes) */
WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
WTSVirtualChannelWrite(audin->audin_channel, Stream_Buffer(s), Stream_GetPosition(s), NULL);
}
static BOOL audin_server_recv_version(audin_server* audin, wStream* s, UINT32 length)
@ -130,7 +130,7 @@ static void audin_server_send_formats(audin_server* audin, wStream* s)
}
}
WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
WTSVirtualChannelWrite(audin->audin_channel, Stream_Buffer(s), Stream_GetPosition(s), NULL);
}
static BOOL audin_server_recv_formats(audin_server* audin, wStream* s, UINT32 length)
@ -201,7 +201,7 @@ static void audin_server_send_open(audin_server* audin, wStream* s)
Stream_Write_UINT16(s, 16); /* wBitsPerSample */
Stream_Write_UINT16(s, 0); /* cbSize */
WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
WTSVirtualChannelWrite(audin->audin_channel, Stream_Buffer(s), Stream_GetPosition(s), NULL);
}
static BOOL audin_server_recv_open_reply(audin_server* audin, wStream* s, UINT32 length)
@ -330,7 +330,7 @@ static void* audin_server_thread_func(void* arg)
Stream_SetPosition(s, 0);
if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s),
if (WTSVirtualChannelRead(audin->audin_channel, 0, Stream_Buffer(s),
Stream_Capacity(s), &bytes_returned) == FALSE)
{
if (bytes_returned == 0)
@ -338,7 +338,7 @@ static void* audin_server_thread_func(void* arg)
Stream_EnsureRemainingCapacity(s, (int) bytes_returned);
if (WTSVirtualChannelRead(audin->audin_channel, 0, stream_get_head(s),
if (WTSVirtualChannelRead(audin->audin_channel, 0, Stream_Buffer(s),
Stream_Capacity(s), &bytes_returned) == FALSE)
break;
}

View File

@ -94,7 +94,7 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
}
s = cliprdr_packet_new(CB_FORMAT_LIST, 0, Stream_Capacity(body));
Stream_Write(s, stream_get_head(body), Stream_Capacity(body));
Stream_Write(s, Stream_Buffer(body), Stream_Capacity(body));
stream_free(body);
}
@ -160,7 +160,7 @@ void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, wStream* s, UINT3
BYTE* end_mark;
CLIPRDR_FORMAT_NAME* format_name;
stream_get_mark(s, end_mark);
Stream_GetPointer(s, end_mark);
end_mark += length;
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) malloc(sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats);

View File

@ -244,7 +244,7 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb
data_out = stream_new(pos + 4);
Stream_Write_UINT8(data_out, 0x10 | cbChId);
Stream_SetPosition(s, 1);
stream_copy(data_out, s, pos - 1);
Stream_Copy(data_out, s, pos - 1);
if (error == 0)
{

View File

@ -501,8 +501,8 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
case FileRenameInformation:
/* http://msdn.microsoft.com/en-us/library/cc232085.aspx */
Stream_Seek_BYTE(input); /* ReplaceIfExists */
Stream_Seek_BYTE(input); /* RootDirectory */
Stream_Seek_UINT8(input); /* ReplaceIfExists */
Stream_Seek_UINT8(input); /* RootDirectory */
Stream_Read_UINT32(input, FileNameLength);
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(input),
@ -665,7 +665,7 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT
Stream_Write_UINT32(output, 0); /* EaSize */
Stream_Write_UINT8(output, 0); /* ShortNameLength */
/* Reserved(1), MUST NOT be added! */
Stream_Write_zero(output, 24); /* ShortName */
Stream_Zero(output, 24); /* ShortName */
Stream_Write(output, ent_path, length);
break;

View File

@ -214,7 +214,7 @@ static void drive_process_irp_close(DRIVE_DEVICE* disk, IRP* irp)
drive_file_free(file);
}
Stream_Write_zero(irp->output, 5); /* Padding(5) */
Stream_Zero(irp->output, 5); /* Padding(5) */
irp->Complete(irp);
}

View File

@ -120,7 +120,7 @@ static void parallel_process_irp_close(PARALLEL_DEVICE* parallel, IRP* irp)
else
DEBUG_SVC("%s(%d) closed", parallel->path, parallel->id);
Stream_Write_zero(irp->output, 5); /* Padding(5) */
Stream_Zero(irp->output, 5); /* Padding(5) */
irp->Complete(irp);
}

View File

@ -103,7 +103,7 @@ static void printer_process_irp_close(PRINTER_DEVICE* printer_dev, IRP* irp)
DEBUG_SVC("printjob id %d closed.", irp->FileId);
}
Stream_Write_zero(irp->output, 4); /* Padding(4) */
Stream_Zero(irp->output, 4); /* Padding(4) */
irp->Complete(irp);
}

View File

@ -184,12 +184,12 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
for (i = 0; i < 8; i++)
{
stream_peek_BYTE(data_out, c);
Stream_Peek_UINT8(data_out, c);
if (c > 0x7F)
Stream_Write_UINT8(data_out, '_');
else
Stream_Seek_BYTE(data_out);
Stream_Seek_UINT8(data_out);
}
Stream_Write_UINT32(data_out, data_len);

View File

@ -269,7 +269,7 @@ void rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream* s)
Stream_Read_UINT16(s, wNumberOfFormats);
Stream_Read_UINT8(s, rdpsnd->cBlockNo); /* cLastBlockConfirmed */
Stream_Read_UINT16(s, wVersion); /* wVersion */
Stream_Seek_BYTE(s); /* bPad */
Stream_Seek_UINT8(s); /* bPad */
rdpsnd->NumberOfServerFormats = wNumberOfFormats;
rdpsnd->ServerFormats = (AUDIO_FORMAT*) malloc(sizeof(AUDIO_FORMAT) * wNumberOfFormats);
@ -399,9 +399,9 @@ static void rdpsnd_recv_wave_pdu(rdpsndPlugin* rdpsnd, wStream* s)
* part of the preceding Wave Info PDU.
*/
CopyMemory(stream_get_head(s), rdpsnd->waveData, 4);
CopyMemory(Stream_Buffer(s), rdpsnd->waveData, 4);
data = stream_get_head(s);
data = Stream_Buffer(s);
size = Stream_Capacity(s);
wave = (RDPSND_WAVE*) malloc(sizeof(RDPSND_WAVE));
@ -481,7 +481,7 @@ static void rdpsnd_recv_pdu(rdpSvcPlugin* plugin, wStream* s)
}
Stream_Read_UINT8(s, msgType); /* msgType */
Stream_Seek_BYTE(s); /* bPad */
Stream_Seek_UINT8(s); /* bPad */
Stream_Read_UINT16(s, BodySize);
//fprintf(stderr, "msgType %d BodySize %d\n", msgType, BodySize);

View File

@ -98,7 +98,7 @@ static BOOL rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, wStream* s)
Stream_SetPosition(s, 2);
Stream_Write_UINT16(s, pos - 4);
Stream_SetPosition(s, pos);
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, Stream_Buffer(s), Stream_GetPosition(s), NULL);
Stream_SetPosition(s, 0);
return status;
@ -112,7 +112,7 @@ static void rdpsnd_server_recv_waveconfirm(rdpsnd_server* rdpsnd, wStream* s)
BYTE confirmBlockNum = 0;
Stream_Read_UINT16(s, timestamp);
Stream_Read_UINT8(s, confirmBlockNum);
Stream_Seek_BYTE(s); // padding
Stream_Seek_UINT8(s); // padding
}
static void rdpsnd_server_recv_quality_mode(rdpsnd_server* rdpsnd, wStream* s)
@ -141,7 +141,7 @@ static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, wStream* s)
Stream_Read_UINT16(s, rdpsnd->context.num_client_formats); /* wNumberOfFormats */
Stream_Read_UINT8(s, lastblock); /* cLastBlockConfirmed */
Stream_Read_UINT16(s, version); /* wVersion */
Stream_Seek_BYTE(s); /* bPad */
Stream_Seek_UINT8(s); /* bPad */
if (rdpsnd->context.num_client_formats > 0)
{
@ -218,7 +218,7 @@ static void* rdpsnd_server_thread_func(void* arg)
Stream_SetPosition(s, 0);
if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s),
if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, Stream_Buffer(s),
Stream_Capacity(s), &bytes_returned) == FALSE)
{
if (bytes_returned == 0)
@ -226,13 +226,13 @@ static void* rdpsnd_server_thread_func(void* arg)
Stream_EnsureRemainingCapacity(s, (int) bytes_returned);
if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, stream_get_head(s),
if (WTSVirtualChannelRead(rdpsnd->rdpsnd_channel, 0, Stream_Buffer(s),
Stream_Capacity(s), &bytes_returned) == FALSE)
break;
}
Stream_Read_UINT8(s, msgType);
Stream_Seek_BYTE(s); /* bPad */
Stream_Seek_UINT8(s); /* bPad */
Stream_Read_UINT16(s, BodySize);
switch (msgType)
@ -410,7 +410,7 @@ static BOOL rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd)
Stream_Seek(s, 3); /* bPad */
Stream_Write(s, src, 4);
WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, Stream_Buffer(s), Stream_GetPosition(s), NULL);
Stream_SetPosition(s, 0);
/* Wave PDU */
@ -419,9 +419,9 @@ static BOOL rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd)
Stream_Write(s, src + 4, size - 4);
if (fill_size > 0)
Stream_Write_zero(s, fill_size);
Stream_Zero(s, fill_size);
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, Stream_Buffer(s), Stream_GetPosition(s), NULL);
Stream_SetPosition(s, 0);
rdpsnd->out_pending_frames = 0;
@ -476,7 +476,7 @@ static BOOL rdpsnd_server_set_volume(rdpsnd_server_context* context, int left, i
Stream_SetPosition(s, 2);
Stream_Write_UINT16(s, pos - 4);
Stream_SetPosition(s, pos);
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, Stream_Buffer(s), Stream_GetPosition(s), NULL);
Stream_SetPosition(s, 0);
return status;
@ -508,7 +508,7 @@ static BOOL rdpsnd_server_close(rdpsnd_server_context* context)
Stream_SetPosition(s, 2);
Stream_Write_UINT16(s, pos - 4);
Stream_SetPosition(s, pos);
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, Stream_Buffer(s), Stream_GetPosition(s), NULL);
Stream_SetPosition(s, 0);
return status;

View File

@ -70,7 +70,7 @@ static void sample_process_receive(rdpSvcPlugin* plugin, wStream* data_in)
if (bytes > 0)
{
data_out = stream_new(bytes);
stream_copy(data_out, data_in, bytes);
Stream_Copy(data_out, data_in, bytes);
/* svc_plugin_send takes ownership of data_out, that is why
we do not free it */

View File

@ -144,7 +144,7 @@ static void serial_process_irp_close(SERIAL_DEVICE* serial, IRP* irp)
serial->tty = NULL;
}
Stream_Write_zero(irp->output, 5); /* Padding(5) */
Stream_Zero(irp->output, 5); /* Padding(5) */
irp->Complete(irp);
}

View File

@ -160,7 +160,7 @@ static void wts_read_drdynvc_capabilities_response(rdpPeerChannel* channel, UINT
if (length < 3)
return;
Stream_Seek_BYTE(channel->receive_data); /* Pad (1 byte) */
Stream_Seek_UINT8(channel->receive_data); /* Pad (1 byte) */
Stream_Read_UINT16(channel->receive_data, Version);
DEBUG_DVC("Version: %d", Version);
@ -225,7 +225,7 @@ static void wts_read_drdynvc_data(rdpPeerChannel* channel, wStream* s, UINT32 le
if (Stream_GetPosition(channel->receive_data) >= (int) channel->dvc_total_length)
{
wts_queue_receive_data(channel, stream_get_head(channel->receive_data), channel->dvc_total_length);
wts_queue_receive_data(channel, Stream_Buffer(channel->receive_data), channel->dvc_total_length);
channel->dvc_total_length = 0;
}
}
@ -344,8 +344,8 @@ static void wts_write_drdynvc_header(wStream *s, BYTE Cmd, UINT32 ChannelId)
BYTE* bm;
int cbChId;
stream_get_mark(s, bm);
Stream_Seek_BYTE(s);
Stream_GetPointer(s, bm);
Stream_Seek_UINT8(s);
cbChId = wts_write_variable_uint(s, ChannelId);
*bm = ((Cmd & 0x0F) << 4) | cbChId;
}
@ -382,7 +382,7 @@ static void WTSProcessChannelData(rdpPeerChannel* channel, int channelId, BYTE*
}
else
{
wts_queue_receive_data(channel, stream_get_head(channel->receive_data), Stream_GetPosition(channel->receive_data));
wts_queue_receive_data(channel, Stream_Buffer(channel->receive_data), Stream_GetPosition(channel->receive_data));
}
Stream_SetPosition(channel->receive_data, 0);
}
@ -576,7 +576,7 @@ void* WTSVirtualChannelOpenEx(
s = stream_new(64);
wts_write_drdynvc_create_request(s, channel->channel_id, pVirtualName);
WTSVirtualChannelWrite(vcm->drdynvc_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
WTSVirtualChannelWrite(vcm->drdynvc_channel, Stream_Buffer(s), Stream_GetPosition(s), NULL);
stream_free(s);
DEBUG_DVC("ChannelId %d.%s (total %d)", channel->channel_id, pVirtualName, list_size(vcm->dvc_channel_list));
@ -784,7 +784,7 @@ BOOL WTSVirtualChannelWrite(
item->buffer = malloc(channel->client->settings->VirtualChannelChunkSize);
stream_attach(s, item->buffer, channel->client->settings->VirtualChannelChunkSize);
Stream_Seek_BYTE(s);
Stream_Seek_UINT8(s);
cbChId = wts_write_variable_uint(s, channel->channel_id);
if (first && (Length > (UINT32) Stream_GetRemainingLength(s)))
@ -847,7 +847,7 @@ BOOL WTSVirtualChannelClose(
{
s = stream_new(8);
wts_write_drdynvc_header(s, CLOSE_REQUEST_PDU, channel->channel_id);
WTSVirtualChannelWrite(vcm->drdynvc_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
WTSVirtualChannelWrite(vcm->drdynvc_channel, Stream_Buffer(s), Stream_GetPosition(s), NULL);
stream_free(s);
}
}

View File

@ -124,7 +124,7 @@ static void smartcard_output_alignment(IRP* irp, UINT32 seed)
UINT32 add = (seed - (size % seed)) % seed;
if (add > 0)
Stream_Write_zero(irp->output, add);
Stream_Zero(irp->output, add);
}
static void smartcard_output_repos(IRP* irp, UINT32 written)
@ -132,12 +132,12 @@ static void smartcard_output_repos(IRP* irp, UINT32 written)
UINT32 add = (4 - (written % 4)) % 4;
if (add > 0)
Stream_Write_zero(irp->output, add);
Stream_Zero(irp->output, add);
}
static UINT32 smartcard_output_return(IRP* irp, UINT32 status)
{
Stream_Write_zero(irp->output, 256);
Stream_Zero(irp->output, 256);
return status;
}
@ -520,7 +520,7 @@ static UINT32 handle_GetStatusChange(IRP* irp, BOOL wide)
Stream_Write_UINT32(irp->output, cur->cbAtr);
Stream_Write(irp->output, cur->rgbAtr, 32);
Stream_Write_zero(irp->output, 4);
Stream_Zero(irp->output, 4);
free((void *)cur->szReader);
}
@ -838,7 +838,7 @@ static DWORD handle_Status(IRP *irp, BOOL wide)
Stream_Write(irp->output, pbAtr, atrLen);
if (atrLen < 32)
Stream_Write_zero(irp->output, 32 - atrLen);
Stream_Zero(irp->output, 32 - atrLen);
Stream_Write_UINT32(irp->output, atrLen);
poslen2 = Stream_GetPosition(irp->output);
@ -1154,7 +1154,7 @@ static UINT32 handle_GetAttrib(IRP* irp)
if (!pbAttr)
{
Stream_Write_zero(irp->output, dwAttrLen);
Stream_Zero(irp->output, dwAttrLen);
}
else
{
@ -1317,7 +1317,7 @@ static UINT32 handle_LocateCardsByATR(IRP* irp, BOOL wide)
Stream_Write_UINT32(irp->output, cur->cbAtr);
Stream_Write(irp->output, cur->rgbAtr, 32);
Stream_Write_zero(irp->output, 4);
Stream_Zero(irp->output, 4);
free((void*) cur->szReader);
}

View File

@ -520,9 +520,9 @@ BOOL tsmf_codec_check_media_type(wStream* s)
BOOL ret;
TS_AM_MEDIA_TYPE mediatype;
stream_get_mark(s, m);
Stream_GetPointer(s, m);
ret = tsmf_codec_parse_media_type(&mediatype, s);
stream_set_mark(s, m);
Stream_SetPointer(s, m);
return ret;
}

View File

@ -62,7 +62,7 @@ int tsmf_ifman_exchange_capability_request(TSMF_IFMAN* ifman)
pos = Stream_GetPosition(ifman->output);
Stream_EnsureRemainingCapacity(ifman->output, ifman->input_size + 4);
stream_copy(ifman->output, ifman->input, ifman->input_size);
Stream_Copy(ifman->output, ifman->input, ifman->input_size);
Stream_SetPosition(ifman->output, pos);
Stream_Read_UINT32(ifman->output, numHostCapabilities);
@ -80,7 +80,7 @@ int tsmf_ifman_exchange_capability_request(TSMF_IFMAN* ifman)
DEBUG_DVC("server protocol version %d", v);
break;
case 2: /* Supported platform */
stream_peek_UINT32(ifman->output, v);
Stream_Peek_UINT32(ifman->output, v);
DEBUG_DVC("server supported platform %d", v);
/* Claim that we support both MF and DShow platforms. */
Stream_Write_UINT32(ifman->output,

View File

@ -90,7 +90,7 @@ void tsmf_playback_ack(IWTSVirtualChannelCallback* pChannelCallback,
Stream_Write_UINT64(s, data_size); /* cbData */
DEBUG_DVC("response size %d", (int) Stream_GetPosition(s));
status = callback->channel->Write(callback->channel, Stream_GetPosition(s), stream_get_head(s), NULL);
status = callback->channel->Write(callback->channel, Stream_GetPosition(s), Stream_Buffer(s), NULL);
if (status)
{
@ -323,7 +323,7 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
Stream_Write_UINT32(output, MessageId);
DEBUG_DVC("response size %d", length);
status = callback->channel->Write(callback->channel, length, stream_get_head(output), NULL);
status = callback->channel->Write(callback->channel, length, Stream_Buffer(output), NULL);
if (status)
{
DEBUG_WARN("response error %d", status);

View File

@ -947,7 +947,7 @@ static void xf_cliprdr_process_dib(clipboardContext* cb, BYTE* data, int size)
Stream_Write_UINT32(s, offset);
Stream_Write(s, data, size);
cb->data = stream_get_head(s);
cb->data = Stream_Buffer(s);
cb->data_length = Stream_GetPosition(s);
stream_detach(s);
stream_free(s);

View File

@ -366,8 +366,8 @@ void test_nsc_encode(void)
Stream_SetPosition(enc_stream, 0);
nsc_compose_message(context, enc_stream, rgb_data, 64, 64, 64 * 3);
}
/*winpr_HexDump(stream_get_head(enc_stream), Stream_GetPosition(enc_stream));*/
nsc_process_message(context, 32, 64, 64, stream_get_head(enc_stream), Stream_GetPosition(enc_stream));
/*winpr_HexDump(Stream_Buffer(enc_stream), Stream_GetPosition(enc_stream));*/
nsc_process_message(context, 32, 64, 64, Stream_Buffer(enc_stream), Stream_GetPosition(enc_stream));
/*winpr_HexDump(context->bmpdata, 64 * 64 * 4);*/
stream_free(enc_stream);

View File

@ -352,11 +352,11 @@ void test_encode(void)
//dump_buffer(context->priv->cb_g_buffer, 4096);
/*printf("*** Y ***\n");
winpr_HexDump(stream_get_head(enc_stream), y_size);
winpr_HexDump(Stream_Buffer(enc_stream), y_size);
printf("*** Cb ***\n");
winpr_HexDump(stream_get_head(enc_stream) + y_size, cb_size);
winpr_HexDump(Stream_Buffer(enc_stream) + y_size, cb_size);
printf("*** Cr ***\n");
winpr_HexDump(stream_get_head(enc_stream) + y_size + cb_size, cr_size);*/
winpr_HexDump(Stream_Buffer(enc_stream) + y_size + cb_size, cr_size);*/
Stream_SetPosition(enc_stream, 0);
rfx_decode_rgb(context, enc_stream,

View File

@ -504,7 +504,7 @@ static BOOL rfx_process_message_region(RFX_CONTEXT* context, RFX_MESSAGE* messag
return FALSE;
}
Stream_Seek_BYTE(s); /* regionFlags (1 byte) */
Stream_Seek_UINT8(s); /* regionFlags (1 byte) */
Stream_Read_UINT16(s, message->num_rects); /* numRects (2 bytes) */
if (message->num_rects < 1)
@ -621,7 +621,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
Stream_Seek_UINT16(s); /* properties (2 bytes) */
Stream_Read_UINT8(s, context->num_quants); /* numQuant (1 byte) */
Stream_Seek_BYTE(s); /* tileSize (1 byte), must be set to 0x40 */
Stream_Seek_UINT8(s); /* tileSize (1 byte), must be set to 0x40 */
if (context->num_quants < 1)
{

View File

@ -128,8 +128,8 @@ BYTE* rdp_capability_set_start(wStream* s)
{
BYTE* header;
stream_get_mark(s, header);
Stream_Write_zero(s, CAPSET_HEADER_LENGTH);
Stream_GetPointer(s, header);
Stream_Zero(s, CAPSET_HEADER_LENGTH);
return header;
}
@ -141,10 +141,10 @@ void rdp_capability_set_finish(wStream* s, BYTE* header, UINT16 type)
footer = s->pointer;
length = footer - header;
stream_set_mark(s, header);
Stream_SetPointer(s, header);
rdp_write_capability_set_header(s, length, type);
stream_set_mark(s, footer);
Stream_SetPointer(s, footer);
}
/**
@ -311,7 +311,7 @@ BOOL rdp_read_bitmap_capability_set(wStream* s, UINT16 length, rdpSettings* sett
Stream_Seek_UINT16(s); /* pad2Octets (2 bytes) */
Stream_Read_UINT16(s, desktopResizeFlag); /* desktopResizeFlag (2 bytes) */
Stream_Seek_UINT16(s); /* bitmapCompressionFlag (2 bytes) */
Stream_Seek_BYTE(s); /* highColorFlags (1 byte) */
Stream_Seek_UINT8(s); /* highColorFlags (1 byte) */
Stream_Read_UINT8(s, drawingFlags); /* drawingFlags (1 byte) */
Stream_Seek_UINT16(s); /* multipleRectangleSupport (2 bytes) */
Stream_Seek_UINT16(s); /* pad2OctetsB (2 bytes) */
@ -509,7 +509,7 @@ void rdp_write_order_capability_set(wStream* s, rdpSettings* settings)
orderFlags |= ORDER_FLAGS_EXTRA_SUPPORT;
}
Stream_Write_zero(s, 16); /* terminalDescriptor (16 bytes) */
Stream_Zero(s, 16); /* terminalDescriptor (16 bytes) */
Stream_Write_UINT32(s, 0); /* pad4OctetsA (4 bytes) */
Stream_Write_UINT16(s, 1); /* desktopSaveXGranularity (2 bytes) */
Stream_Write_UINT16(s, 20); /* desktopSaveYGranularity (2 bytes) */
@ -1217,7 +1217,7 @@ void rdp_write_input_capability_set(wStream* s, rdpSettings* settings)
Stream_Write_UINT32(s, settings->KeyboardType); /* keyboardType (4 bytes) */
Stream_Write_UINT32(s, settings->KeyboardSubType); /* keyboardSubType (4 bytes) */
Stream_Write_UINT32(s, settings->KeyboardFunctionKey); /* keyboardFunctionKeys (4 bytes) */
Stream_Write_zero(s, 64); /* imeFileName (64 bytes) */
Stream_Zero(s, 64); /* imeFileName (64 bytes) */
rdp_capability_set_finish(s, header, CAPSET_TYPE_INPUT);
}
@ -1575,7 +1575,7 @@ BOOL rdp_read_bitmap_cache_host_support_capability_set(wStream* s, UINT16 length
return FALSE;
Stream_Read_UINT8(s, cacheVersion); /* cacheVersion (1 byte) */
Stream_Seek_BYTE(s); /* pad1 (1 byte) */
Stream_Seek_UINT8(s); /* pad1 (1 byte) */
Stream_Seek_UINT16(s); /* pad2 (2 bytes) */
if (cacheVersion & BITMAP_CACHE_V2)
@ -1668,8 +1668,8 @@ BOOL rdp_read_bitmap_cache_v2_capability_set(wStream* s, UINT16 length, rdpSetti
return FALSE;
Stream_Seek_UINT16(s); /* cacheFlags (2 bytes) */
Stream_Seek_BYTE(s); /* pad2 (1 byte) */
Stream_Seek_BYTE(s); /* numCellCaches (1 byte) */
Stream_Seek_UINT8(s); /* pad2 (1 byte) */
Stream_Seek_UINT8(s); /* numCellCaches (1 byte) */
Stream_Seek(s, 4); /* bitmapCache0CellInfo (4 bytes) */
Stream_Seek(s, 4); /* bitmapCache1CellInfo (4 bytes) */
Stream_Seek(s, 4); /* bitmapCache2CellInfo (4 bytes) */
@ -1707,7 +1707,7 @@ void rdp_write_bitmap_cache_v2_capability_set(wStream* s, rdpSettings* settings)
rdp_write_bitmap_cache_cell_info(s, &settings->BitmapCacheV2CellInfo[2]); /* bitmapCache2CellInfo (4 bytes) */
rdp_write_bitmap_cache_cell_info(s, &settings->BitmapCacheV2CellInfo[3]); /* bitmapCache3CellInfo (4 bytes) */
rdp_write_bitmap_cache_cell_info(s, &settings->BitmapCacheV2CellInfo[4]); /* bitmapCache4CellInfo (4 bytes) */
Stream_Write_zero(s, 12); /* pad3 (12 bytes) */
Stream_Zero(s, 12); /* pad3 (12 bytes) */
rdp_capability_set_finish(s, header, CAPSET_TYPE_BITMAP_CACHE_V2);
}
@ -2074,7 +2074,7 @@ BOOL rdp_read_window_list_capability_set(wStream* s, UINT16 length, rdpSettings*
return FALSE;
Stream_Seek_UINT32(s); /* wndSupportLevel (4 bytes) */
Stream_Seek_BYTE(s); /* numIconCaches (1 byte) */
Stream_Seek_UINT8(s); /* numIconCaches (1 byte) */
Stream_Seek_UINT16(s); /* numIconCacheEntries (2 bytes) */
return TRUE;
@ -2472,12 +2472,12 @@ BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSetting
}
else
{
Stream_Seek_BYTE(s); /* codecID (1 byte) */
Stream_Seek_UINT8(s); /* codecID (1 byte) */
}
}
else
{
Stream_Seek_BYTE(s); /* codecID (1 byte) */
Stream_Seek_UINT8(s); /* codecID (1 byte) */
}
Stream_Read_UINT16(s, codecPropertiesLength); /* codecPropertiesLength (2 bytes) */
@ -2858,7 +2858,7 @@ BOOL rdp_print_capability_sets(wStream* s, UINT16 numberCapabilities, BOOL recei
while (numberCapabilities > 0)
{
stream_get_mark(s, bm);
Stream_GetPointer(s, bm);
rdp_read_capability_set_header(s, &length, &type);
@ -3030,7 +3030,7 @@ BOOL rdp_print_capability_sets(wStream* s, UINT16 numberCapabilities, BOOL recei
type, (int) (s->pointer - bm), (int) (em - bm));
}
stream_set_mark(s, em);
Stream_SetPointer(s, em);
numberCapabilities--;
}
@ -3045,12 +3045,12 @@ BOOL rdp_read_capability_sets(wStream* s, rdpSettings* settings, UINT16 numberCa
UINT16 length;
BYTE *bm, *em;
stream_get_mark(s, mark);
Stream_GetPointer(s, mark);
count = numberCapabilities;
while (numberCapabilities > 0)
{
stream_get_mark(s, bm);
Stream_GetPointer(s, bm);
rdp_read_capability_set_header(s, &length, &type);
@ -3221,16 +3221,16 @@ BOOL rdp_read_capability_sets(wStream* s, rdpSettings* settings, UINT16 numberCa
type, (int) (s->pointer - bm), (int) (em - bm));
}
stream_set_mark(s, em);
Stream_SetPointer(s, em);
numberCapabilities--;
}
#ifdef WITH_DEBUG_CAPABILITIES
stream_get_mark(s, em);
stream_set_mark(s, mark);
Stream_GetPointer(s, em);
Stream_SetPointer(s, mark);
numberCapabilities = count;
rdp_print_capability_sets(s, numberCapabilities, TRUE);
stream_set_mark(s, em);
Stream_SetPointer(s, em);
#endif
return TRUE;
@ -3335,11 +3335,11 @@ void rdp_write_demand_active(wStream* s, rdpSettings* settings)
Stream_Write_UINT32(s, settings->ShareId); /* shareId (4 bytes) */
Stream_Write_UINT16(s, 4); /* lengthSourceDescriptor (2 bytes) */
stream_get_mark(s, lm);
Stream_GetPointer(s, lm);
Stream_Seek_UINT16(s); /* lengthCombinedCapabilities (2 bytes) */
Stream_Write(s, "RDP", 4); /* sourceDescriptor */
stream_get_mark(s, bm);
Stream_GetPointer(s, bm);
Stream_Seek_UINT16(s); /* numberCapabilities (2 bytes) */
Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */
@ -3365,23 +3365,23 @@ void rdp_write_demand_active(wStream* s, rdpSettings* settings)
rdp_write_bitmap_cache_host_support_capability_set(s, settings);
}
stream_get_mark(s, em);
Stream_GetPointer(s, em);
stream_set_mark(s, lm); /* go back to lengthCombinedCapabilities */
Stream_SetPointer(s, lm); /* go back to lengthCombinedCapabilities */
lengthCombinedCapabilities = (em - bm);
Stream_Write_UINT16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */
stream_set_mark(s, bm); /* go back to numberCapabilities */
Stream_SetPointer(s, bm); /* go back to numberCapabilities */
Stream_Write_UINT16(s, numberCapabilities); /* numberCapabilities (2 bytes) */
#ifdef WITH_DEBUG_CAPABILITIES
Stream_Seek_UINT16(s);
rdp_print_capability_sets(s, numberCapabilities, FALSE);
stream_set_mark(s, bm);
Stream_SetPointer(s, bm);
Stream_Seek_UINT16(s);
#endif
stream_set_mark(s, em);
Stream_SetPointer(s, em);
Stream_Write_UINT32(s, 0); /* sessionId */
}
@ -3451,11 +3451,11 @@ void rdp_write_confirm_active(wStream* s, rdpSettings* settings)
Stream_Write_UINT16(s, 0x03EA); /* originatorId (2 bytes) */
Stream_Write_UINT16(s, lengthSourceDescriptor);/* lengthSourceDescriptor (2 bytes) */
stream_get_mark(s, lm);
Stream_GetPointer(s, lm);
Stream_Seek_UINT16(s); /* lengthCombinedCapabilities (2 bytes) */
Stream_Write(s, SOURCE_DESCRIPTOR, lengthSourceDescriptor); /* sourceDescriptor */
stream_get_mark(s, bm);
Stream_GetPointer(s, bm);
Stream_Seek_UINT16(s); /* numberCapabilities (2 bytes) */
Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */
@ -3550,23 +3550,23 @@ void rdp_write_confirm_active(wStream* s, rdpSettings* settings)
}
}
stream_get_mark(s, em);
Stream_GetPointer(s, em);
stream_set_mark(s, lm); /* go back to lengthCombinedCapabilities */
Stream_SetPointer(s, lm); /* go back to lengthCombinedCapabilities */
lengthCombinedCapabilities = (em - bm);
Stream_Write_UINT16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */
stream_set_mark(s, bm); /* go back to numberCapabilities */
Stream_SetPointer(s, bm); /* go back to numberCapabilities */
Stream_Write_UINT16(s, numberCapabilities); /* numberCapabilities (2 bytes) */
#ifdef WITH_DEBUG_CAPABILITIES
Stream_Seek_UINT16(s);
rdp_print_capability_sets(s, numberCapabilities, FALSE);
stream_set_mark(s, bm);
Stream_SetPointer(s, bm);
Stream_Seek_UINT16(s);
#endif
stream_set_mark(s, em);
Stream_SetPointer(s, em);
}
BOOL rdp_send_confirm_active(rdpRdp* rdp)

View File

@ -234,7 +234,7 @@ BOOL certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info)
{
if(Stream_GetRemainingLength(s) < 1)
goto error1;
stream_peek_BYTE(s, padding);
Stream_Peek_UINT8(s, padding);
if (padding == 0)
{

View File

@ -528,12 +528,12 @@ BOOL rdp_client_connect_demand_active(rdpRdp* rdp, wStream* s)
width = rdp->settings->DesktopWidth;
height = rdp->settings->DesktopHeight;
stream_get_mark(s, mark);
Stream_GetPointer(s, mark);
if (!rdp_recv_demand_active(rdp, s))
{
UINT16 channelId;
stream_set_mark(s, mark);
Stream_SetPointer(s, mark);
rdp_recv_get_active_header(rdp, s, &channelId);
/* Was Stream_Seek(s, RDP_PACKET_HEADER_MAX_LENGTH);
* but the headers aren't always that length,

View File

@ -76,7 +76,7 @@ UINT16 fastpath_header_length(wStream* s)
{
BYTE length1;
Stream_Seek_BYTE(s);
Stream_Seek_UINT8(s);
Stream_Read_UINT8(s, length1);
Stream_Rewind(s, 2);
@ -823,7 +823,7 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
for (fragment = 0; (totalLength > 0) || (fragment == 0); fragment++)
{
stream_get_mark(s, holdp);
Stream_GetPointer(s, holdp);
ls = s;
dlen = MIN(maxLength, totalLength);
cflags = 0;
@ -860,7 +860,7 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
else
fragmentation = (fragment == 0) ? FASTPATH_FRAGMENT_FIRST : FASTPATH_FRAGMENT_NEXT;
stream_get_mark(ls, bm);
Stream_GetPointer(ls, bm);
header = 0;
if (sec_bytes > 0)
@ -912,7 +912,7 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
}
/* Reserve 6 + sec_bytes bytes for the next fragment header, if any. */
stream_set_mark(s, holdp + dlen);
Stream_SetPointer(s, holdp + dlen);
}
stream_detach(update);

View File

@ -582,7 +582,7 @@ BOOL gcc_read_client_core_data(wStream* s, rdpSettings* settings, UINT16 blockLe
if (blockLength < 1)
break;
Stream_Seek_BYTE(s); /* pad1octet */
Stream_Seek_UINT8(s); /* pad1octet */
blockLength -= 1;
if (blockLength < 4)
@ -692,14 +692,14 @@ void gcc_write_client_core_data(wStream* s, rdpSettings* settings)
}
Stream_Write(s, clientName, (clientNameLength * 2));
Stream_Write_zero(s, 32 - (clientNameLength * 2));
Stream_Zero(s, 32 - (clientNameLength * 2));
free(clientName);
Stream_Write_UINT32(s, settings->KeyboardType); /* KeyboardType */
Stream_Write_UINT32(s, settings->KeyboardSubType); /* KeyboardSubType */
Stream_Write_UINT32(s, settings->KeyboardFunctionKey); /* KeyboardFunctionKey */
Stream_Write_zero(s, 64); /* imeFileName */
Stream_Zero(s, 64); /* imeFileName */
Stream_Write_UINT16(s, RNS_UD_COLOR_8BPP); /* postBeta2ColorDepth */
Stream_Write_UINT16(s, 1); /* clientProductID */
@ -739,7 +739,7 @@ void gcc_write_client_core_data(wStream* s, rdpSettings* settings)
clientDigProductId[clientDigProductIdLength-1] = 0;
}
Stream_Write(s, clientDigProductId, (clientDigProductIdLength * 2) );
Stream_Write_zero(s, 64 - (clientDigProductIdLength * 2) );
Stream_Zero(s, 64 - (clientDigProductIdLength * 2) );
free(clientDigProductId);
Stream_Write_UINT8(s, connectionType); /* connectionType */
@ -1031,7 +1031,7 @@ void gcc_write_server_security_data(wStream* s, rdpSettings* settings)
Stream_Write(s, settings->RdpServerRsaKey->exponent, expLen);
Stream_Write(s, settings->RdpServerRsaKey->Modulus, keyLen);
Stream_Write_zero(s, 8);
Stream_Zero(s, 8);
sigDataLen = Stream_Pointer(s) - sigData;
@ -1048,7 +1048,7 @@ void gcc_write_server_security_data(wStream* s, rdpSettings* settings)
tssk_modulus, tssk_privateExponent, encryptedSignature);
Stream_Write(s, encryptedSignature, sizeof(encryptedSignature));
Stream_Write_zero(s, 8);
Stream_Zero(s, 8);
}
/**

View File

@ -602,7 +602,7 @@ void license_write_encrypted_premaster_secret_blob(wStream* s, LICENSE_BLOB* blo
if (blob->length > 0)
Stream_Write(s, blob->data, blob->length); /* blobData */
Stream_Write_zero(s, length - blob->length);
Stream_Zero(s, length - blob->length);
}
/**

View File

@ -296,7 +296,7 @@ void mcs_write_domain_parameters(wStream* s, DomainParameters* domainParameters)
length = Stream_GetPosition(tmps);
ber_write_sequence_tag(s, length);
Stream_Write(s, stream_get_head(tmps), length);
Stream_Write(s, Stream_Buffer(tmps), length);
stream_free(tmps);
}
@ -414,7 +414,7 @@ void mcs_write_connect_initial(wStream* s, rdpMcs* mcs, wStream* user_data)
length = Stream_GetPosition(tmps);
/* Connect-Initial (APPLICATION 101, IMPLICIT SEQUENCE) */
ber_write_application_tag(s, MCS_TYPE_CONNECT_INITIAL, length);
Stream_Write(s, stream_get_head(tmps), length);
Stream_Write(s, Stream_Buffer(tmps), length);
stream_free(tmps);
}
@ -441,7 +441,7 @@ void mcs_write_connect_response(wStream* s, rdpMcs* mcs, wStream* user_data)
length = Stream_GetPosition(tmps);
ber_write_application_tag(s, MCS_TYPE_CONNECT_RESPONSE, length);
Stream_Write(s, stream_get_head(tmps), length);
Stream_Write(s, Stream_Buffer(tmps), length);
stream_free(tmps);
}
@ -468,17 +468,17 @@ BOOL mcs_send_connect_initial(rdpMcs* mcs)
length = Stream_GetPosition(gcc_CCrq) + 7;
s = transport_send_stream_init(mcs->transport, 1024);
stream_get_mark(s, bm);
Stream_GetPointer(s, bm);
Stream_Seek(s, 7);
mcs_write_connect_initial(s, mcs, gcc_CCrq);
stream_get_mark(s, em);
Stream_GetPointer(s, em);
length = (em - bm);
stream_set_mark(s, bm);
Stream_SetPointer(s, bm);
tpkt_write_header(s, length);
tpdu_write_data(s);
stream_set_mark(s, em);
Stream_SetPointer(s, em);
status = transport_write(mcs->transport, s);
@ -547,17 +547,17 @@ BOOL mcs_send_connect_response(rdpMcs* mcs)
length = Stream_GetPosition(gcc_CCrsp) + 7;
s = transport_send_stream_init(mcs->transport, 1024);
stream_get_mark(s, bm);
Stream_GetPointer(s, bm);
Stream_Seek(s, 7);
mcs_write_connect_response(s, mcs, gcc_CCrsp);
stream_get_mark(s, em);
Stream_GetPointer(s, em);
length = (em - bm);
stream_set_mark(s, bm);
Stream_SetPointer(s, bm);
tpkt_write_header(s, length);
tpdu_write_data(s);
stream_set_mark(s, em);
Stream_SetPointer(s, em);
ret = transport_write(mcs->transport, s);

View File

@ -583,12 +583,12 @@ BOOL nego_read_request(rdpNego* nego, wStream* s)
if (c != '\x0D')
continue;
stream_peek_BYTE(s, c);
Stream_Peek_UINT8(s, c);
if (c != '\x0A')
continue;
Stream_Seek_BYTE(s);
Stream_Seek_UINT8(s);
break;
}
}
@ -646,7 +646,7 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
s = transport_send_stream_init(nego->transport, 256);
length = TPDU_CONNECTION_REQUEST_LENGTH;
stream_get_mark(s, bm);
Stream_GetPointer(s, bm);
Stream_Seek(s, length);
if (nego->RoutingToken)
@ -682,11 +682,11 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
length += 8;
}
stream_get_mark(s, em);
stream_set_mark(s, bm);
Stream_GetPointer(s, em);
Stream_SetPointer(s, bm);
tpkt_write_header(s, length);
tpdu_write_connection_request(s, length - 5);
stream_set_mark(s, em);
Stream_SetPointer(s, em);
if (transport_write(nego->transport, s) < 0)
return FALSE;
@ -810,7 +810,7 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
s = transport_send_stream_init(nego->transport, 256);
length = TPDU_CONNECTION_CONFIRM_LENGTH;
stream_get_mark(s, bm);
Stream_GetPointer(s, bm);
Stream_Seek(s, length);
if (nego->selected_protocol > PROTOCOL_RDP)
@ -837,11 +837,11 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
status = FALSE;
}
stream_get_mark(s, em);
stream_set_mark(s, bm);
Stream_GetPointer(s, em);
Stream_SetPointer(s, bm);
tpkt_write_header(s, length);
tpdu_write_connection_confirm(s, length - 5);
stream_set_mark(s, em);
Stream_SetPointer(s, em);
if (transport_write(nego->transport, s) < 0)
return FALSE;

View File

@ -236,7 +236,7 @@ static INLINE void update_read_colorref(wStream* s, UINT32* color)
*color |= (byte << 8);
Stream_Read_UINT8(s, byte);
*color |= (byte << 16);
Stream_Seek_BYTE(s);
Stream_Seek_UINT8(s);
}
static INLINE void update_read_color_quad(wStream* s, UINT32* color)
@ -249,7 +249,7 @@ static INLINE void update_read_color_quad(wStream* s, UINT32* color)
*color |= (byte << 8);
Stream_Read_UINT8(s, byte);
*color |= byte;
Stream_Seek_BYTE(s);
Stream_Seek_UINT8(s);
}
static INLINE BOOL update_read_2byte_unsigned(wStream* s, UINT32* value)
@ -504,7 +504,7 @@ static INLINE void update_seek_glyph_delta(wStream* s)
Stream_Read_UINT8(s, byte);
if (byte & 0x80)
Stream_Seek_BYTE(s);
Stream_Seek_UINT8(s);
}
static INLINE BOOL update_read_brush(wStream* s, rdpBrush* brush, BYTE fieldFlags)
@ -632,7 +632,7 @@ static INLINE BOOL update_read_delta_rects(wStream* s, DELTA_RECT* rectangles, i
if (Stream_GetRemainingLength(s) < zeroBitsSize)
return FALSE;
stream_get_mark(s, zeroBits);
Stream_GetPointer(s, zeroBits);
Stream_Seek(s, zeroBitsSize);
memset(rectangles, 0, sizeof(DELTA_RECT) * (number + 1));
@ -683,7 +683,7 @@ static INLINE BOOL update_read_delta_points(wStream* s, DELTA_POINT* points, int
if (Stream_GetRemainingLength(s) < zeroBitsSize)
return FALSE;
stream_get_mark(s, zeroBits);
Stream_GetPointer(s, zeroBits);
Stream_Seek(s, zeroBitsSize);
memset(points, 0, sizeof(DELTA_POINT) * number);
@ -1511,7 +1511,7 @@ BOOL update_read_cache_bitmap_order(wStream* s, CACHE_BITMAP_ORDER* cache_bitmap
return FALSE;
Stream_Read_UINT8(s, cache_bitmap_order->cacheId); /* cacheId (1 byte) */
Stream_Seek_BYTE(s); /* pad1Octet (1 byte) */
Stream_Seek_UINT8(s); /* pad1Octet (1 byte) */
Stream_Read_UINT8(s, cache_bitmap_order->bitmapWidth); /* bitmapWidth (1 byte) */
Stream_Read_UINT8(s, cache_bitmap_order->bitmapHeight); /* bitmapHeight (1 byte) */
Stream_Read_UINT8(s, cache_bitmap_order->bitmapBpp); /* bitmapBpp (1 byte) */
@ -1534,7 +1534,7 @@ BOOL update_read_cache_bitmap_order(wStream* s, CACHE_BITMAP_ORDER* cache_bitmap
if (Stream_GetRemainingLength(s) < cache_bitmap_order->bitmapLength)
return FALSE;
stream_get_mark(s, cache_bitmap_order->bitmapDataStream);
Stream_GetPointer(s, cache_bitmap_order->bitmapDataStream);
Stream_Seek(s, cache_bitmap_order->bitmapLength);
}
else
@ -1542,7 +1542,7 @@ BOOL update_read_cache_bitmap_order(wStream* s, CACHE_BITMAP_ORDER* cache_bitmap
if (Stream_GetRemainingLength(s) < cache_bitmap_order->bitmapLength)
return FALSE;
stream_get_mark(s, cache_bitmap_order->bitmapDataStream);
Stream_GetPointer(s, cache_bitmap_order->bitmapDataStream);
Stream_Seek(s, cache_bitmap_order->bitmapLength); /* bitmapDataStream */
}
@ -1608,7 +1608,7 @@ BOOL update_read_cache_bitmap_v2_order(wStream* s, CACHE_BITMAP_V2_ORDER* cache_
if (Stream_GetRemainingLength(s) < cache_bitmap_v2->bitmapLength)
return FALSE;
stream_get_mark(s, cache_bitmap_v2->bitmapDataStream);
Stream_GetPointer(s, cache_bitmap_v2->bitmapDataStream);
Stream_Seek(s, cache_bitmap_v2->bitmapLength);
}
else
@ -1616,7 +1616,7 @@ BOOL update_read_cache_bitmap_v2_order(wStream* s, CACHE_BITMAP_V2_ORDER* cache_
if (Stream_GetRemainingLength(s) < cache_bitmap_v2->bitmapLength)
return FALSE;
stream_get_mark(s, cache_bitmap_v2->bitmapDataStream);
Stream_GetPointer(s, cache_bitmap_v2->bitmapDataStream);
Stream_Seek(s, cache_bitmap_v2->bitmapLength);
}
@ -1702,8 +1702,8 @@ BOOL update_read_cache_bitmap_v3_order(wStream* s, CACHE_BITMAP_V3_ORDER* cache_
bitmapData = &cache_bitmap_v3_order->bitmapData;
Stream_Read_UINT8(s, bitmapData->bpp);
Stream_Seek_BYTE(s); /* reserved1 (1 byte) */
Stream_Seek_BYTE(s); /* reserved2 (1 byte) */
Stream_Seek_UINT8(s); /* reserved1 (1 byte) */
Stream_Seek_UINT8(s); /* reserved2 (1 byte) */
Stream_Read_UINT8(s, bitmapData->codecID); /* codecID (1 byte) */
Stream_Read_UINT16(s, bitmapData->width); /* width (2 bytes) */
Stream_Read_UINT16(s, bitmapData->height); /* height (2 bytes) */
@ -2139,7 +2139,7 @@ BOOL update_read_draw_gdiplus_first_order(wStream* s, DRAW_GDIPLUS_FIRST_ORDER*
{
if (Stream_GetRemainingLength(s) < 11)
return FALSE;
Stream_Seek_BYTE(s); /* pad1Octet (1 byte) */
Stream_Seek_UINT8(s); /* pad1Octet (1 byte) */
Stream_Read_UINT16(s, draw_gdiplus_first->cbSize); /* cbSize (2 bytes) */
Stream_Read_UINT32(s, draw_gdiplus_first->cbTotalSize); /* cbTotalSize (4 bytes) */
Stream_Read_UINT32(s, draw_gdiplus_first->cbTotalEmfSize); /* cbTotalEmfSize (4 bytes) */
@ -2151,7 +2151,7 @@ BOOL update_read_draw_gdiplus_next_order(wStream* s, DRAW_GDIPLUS_NEXT_ORDER* dr
{
if (Stream_GetRemainingLength(s) < 3)
return FALSE;
Stream_Seek_BYTE(s); /* pad1Octet (1 byte) */
Stream_Seek_UINT8(s); /* pad1Octet (1 byte) */
FIELD_SKIP_BUFFER16(s, draw_gdiplus_next->cbSize); /* cbSize(2 bytes) + emfRecords */
return TRUE;
}
@ -2160,7 +2160,7 @@ BOOL update_read_draw_gdiplus_end_order(wStream* s, DRAW_GDIPLUS_END_ORDER* draw
{
if (Stream_GetRemainingLength(s) < 11)
return FALSE;
Stream_Seek_BYTE(s); /* pad1Octet (1 byte) */
Stream_Seek_UINT8(s); /* pad1Octet (1 byte) */
Stream_Read_UINT16(s, draw_gdiplus_end->cbSize); /* cbSize (2 bytes) */
Stream_Read_UINT32(s, draw_gdiplus_end->cbTotalSize); /* cbTotalSize (4 bytes) */
Stream_Read_UINT32(s, draw_gdiplus_end->cbTotalEmfSize); /* cbTotalEmfSize (4 bytes) */

View File

@ -141,8 +141,8 @@ BOOL rdp_read_share_data_header(wStream* s, UINT16* length, BYTE* type, UINT32*
/* Share Data Header */
Stream_Read_UINT32(s, *share_id); /* shareId (4 bytes) */
Stream_Seek_BYTE(s); /* pad1 (1 byte) */
Stream_Seek_BYTE(s); /* streamId (1 byte) */
Stream_Seek_UINT8(s); /* pad1 (1 byte) */
Stream_Seek_UINT8(s); /* streamId (1 byte) */
Stream_Read_UINT16(s, *length); /* uncompressedLength (2 bytes) */
Stream_Read_UINT8(s, *type); /* pduType2, Data PDU Type (1 byte) */
Stream_Read_UINT8(s, *compressed_type); /* compressedType (1 byte) */
@ -807,7 +807,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
{
while (Stream_GetRemainingLength(s) > 3)
{
stream_get_mark(s, nextp);
Stream_GetPointer(s, nextp);
if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource))
return -1;
@ -840,7 +840,7 @@ static int rdp_recv_tpkt_pdu(rdpRdp* rdp, wStream* s)
fprintf(stderr, "incorrect PDU type: 0x%04X\n", pduType);
break;
}
stream_set_mark(s, nextp);
Stream_SetPointer(s, nextp);
}
}

View File

@ -99,7 +99,7 @@ int update_recv_surfcmds(rdpUpdate* update, UINT32 size, wStream* s)
while (size > 2)
{
stream_get_mark(s, mark);
Stream_GetPointer(s, mark);
Stream_Read_UINT16(s, cmdType);
size -= 2;

View File

@ -140,7 +140,7 @@ void rdp_write_client_time_zone(wStream* s, rdpSettings* settings)
/* standardName (64 bytes) */
Stream_Write(s, standardName, standardNameLength);
Stream_Write_zero(s, 64 - standardNameLength);
Stream_Zero(s, 64 - standardNameLength);
/* StandardDate */
rdp_write_system_time(s, &clientTimeZone->standardDate);
@ -154,7 +154,7 @@ void rdp_write_client_time_zone(wStream* s, rdpSettings* settings)
/* daylightName (64 bytes) */
Stream_Write(s, daylightName, daylightNameLength);
Stream_Write_zero(s, 64 - daylightNameLength);
Stream_Zero(s, 64 - daylightNameLength);
/* DaylightDate */
rdp_write_system_time(s, &clientTimeZone->daylightDate);

View File

@ -67,7 +67,7 @@ BOOL tpkt_verify_header(wStream* s)
{
BYTE version;
stream_peek_BYTE(s, version);
Stream_Peek_UINT8(s, version);
if (version == 3)
return TRUE;
@ -86,7 +86,7 @@ UINT16 tpkt_read_header(wStream* s)
BYTE version;
UINT16 length;
stream_peek_BYTE(s, version);
Stream_Peek_UINT8(s, version);
if (version == 3)
{

View File

@ -717,7 +717,7 @@ int transport_check_fds(rdpTransport** ptransport)
if (length == 0)
{
fprintf(stderr, "transport_check_fds: protocol error, not a TPKT or Fast Path header.\n");
winpr_HexDump(stream_get_head(transport->ReceiveBuffer), pos);
winpr_HexDump(Stream_Buffer(transport->ReceiveBuffer), pos);
return -1;
}

View File

@ -94,7 +94,7 @@ BOOL update_read_bitmap_data(wStream* s, BITMAP_DATA* bitmap_data)
}
bitmap_data->compressed = TRUE;
stream_get_mark(s, bitmap_data->bitmapDataStream);
Stream_GetPointer(s, bitmap_data->bitmapDataStream);
Stream_Seek(s, bitmap_data->bitmapLength);
}
else
@ -102,7 +102,7 @@ BOOL update_read_bitmap_data(wStream* s, BITMAP_DATA* bitmap_data)
if (Stream_GetRemainingLength(s) < bitmap_data->bitmapLength)
return FALSE;
bitmap_data->compressed = FALSE;
stream_get_mark(s, bitmap_data->bitmapDataStream);
Stream_GetPointer(s, bitmap_data->bitmapDataStream);
Stream_Seek(s, bitmap_data->bitmapLength);
}
return TRUE;
@ -270,7 +270,7 @@ BOOL update_read_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color)
}
if (Stream_GetRemainingLength(s) > 0)
Stream_Seek_BYTE(s); /* pad (1 byte) */
Stream_Seek_UINT8(s); /* pad (1 byte) */
return TRUE;
}
@ -516,7 +516,7 @@ static void update_send_surface_command(rdpContext* context, wStream* s)
update = fastpath_update_pdu_init(rdp->fastpath);
Stream_EnsureRemainingCapacity(update, Stream_GetPosition(s));
Stream_Write(update, stream_get_head(s), Stream_GetPosition(s));
Stream_Write(update, Stream_Buffer(s), Stream_GetPosition(s));
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, update);
}
@ -561,7 +561,7 @@ static void update_send_synchronize(rdpContext* context)
rdpRdp* rdp = context->rdp;
s = fastpath_update_pdu_init(rdp->fastpath);
Stream_Write_zero(s, 2); /* pad2Octets (2 bytes) */
Stream_Zero(s, 2); /* pad2Octets (2 bytes) */
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SYNCHRONIZE, s);
}

View File

@ -161,7 +161,7 @@ void mf_peer_rfx_update(freerdp_peer* client)
cmd->width = rect.width;
cmd->height = rect.height;
cmd->bitmapDataLength = Stream_GetPosition(s);
cmd->bitmapData = stream_get_head(s);
cmd->bitmapData = Stream_Buffer(s);
//send

View File

@ -180,7 +180,7 @@ static void test_peer_draw_background(freerdp_peer* client)
cmd->width = rect.width;
cmd->height = rect.height;
cmd->bitmapDataLength = Stream_GetPosition(s);
cmd->bitmapData = stream_get_head(s);
cmd->bitmapData = Stream_Buffer(s);
update->SurfaceBits(update->context, cmd);
free(rgb_data);
@ -279,7 +279,7 @@ static void test_peer_draw_icon(freerdp_peer* client, int x, int y)
cmd->width = context->icon_width;
cmd->height = context->icon_height;
cmd->bitmapDataLength = Stream_GetPosition(s);
cmd->bitmapData = stream_get_head(s);
cmd->bitmapData = Stream_Buffer(s);
update->SurfaceBits(update->context, cmd);
}
@ -306,7 +306,7 @@ static void test_peer_draw_icon(freerdp_peer* client, int x, int y)
cmd->width = context->icon_width;
cmd->height = context->icon_height;
cmd->bitmapDataLength = Stream_GetPosition(s);
cmd->bitmapData = stream_get_head(s);
cmd->bitmapData = Stream_Buffer(s);
update->SurfaceBits(update->context, cmd);
context->icon_x = x;
@ -419,7 +419,7 @@ static void* tf_debug_channel_thread_func(void* arg)
Stream_SetPosition(s, 0);
if (WTSVirtualChannelRead(context->debug_channel, 0, stream_get_head(s),
if (WTSVirtualChannelRead(context->debug_channel, 0, Stream_Buffer(s),
Stream_Capacity(s), &bytes_returned) == FALSE)
{
if (bytes_returned == 0)
@ -427,7 +427,7 @@ static void* tf_debug_channel_thread_func(void* arg)
Stream_EnsureRemainingCapacity(s, bytes_returned);
if (WTSVirtualChannelRead(context->debug_channel, 0, stream_get_head(s),
if (WTSVirtualChannelRead(context->debug_channel, 0, Stream_Buffer(s),
Stream_Capacity(s), &bytes_returned) == FALSE)
{
/* should not happen */

View File

@ -150,7 +150,7 @@ void wf_update_encode(wfInfo* wfi)
cmd->width = width;
cmd->height = height;
cmd->bitmapDataLength = Stream_GetPosition(wfi->s);
cmd->bitmapData = stream_get_head(wfi->s);
cmd->bitmapData = Stream_Buffer(wfi->s);
}
void wf_update_peer_send(wfInfo* wfi, wfPeerContext* context)

View File

@ -195,6 +195,9 @@ WINPR_API void Stream_Free(wStream* s, BOOL bFreeBuffer);
#define Stream_GetPosition(_s) (_s->pointer - _s->buffer)
#define Stream_SetPosition(_s, _p) _s->pointer = _s->buffer + (_p)
#define Stream_GetPointer(_s, _p) _p = _s->pointer
#define Stream_SetPointer(_s, _p) _s->pointer = _p
#define Stream_SealLength(_s) _s->length = (_s->pointer - _s->buffer)
#define Stream_GetRemainingLength(_s) (_s->length - (_s->pointer - _s->buffer))
@ -214,52 +217,6 @@ WINPR_API void stream_free(wStream* stream);
WINPR_API void stream_extend(wStream* stream, int request_size);
#define stream_get_mark(_s,_mark) _mark = _s->pointer
#define stream_set_mark(_s,_mark) _s->pointer = _mark
#define stream_get_head(_s) _s->buffer
#define Stream_Write_zero(_s, _n) do { \
memset(_s->pointer, '\0', (_n)); \
_s->pointer += (_n); \
} while (0)
#define stream_set_byte(_s, _v, _n) do { \
memset(_s->pointer, _v, (_n)); \
_s->pointer += (_n); \
} while (0)
#define stream_peek_BYTE(_s, _v) do { _v = *_s->pointer; } while (0)
#define stream_peek_UINT16(_s, _v) do { _v = \
(UINT16)(*_s->pointer) + \
(((UINT16)(*(_s->pointer + 1))) << 8); \
} while (0)
#define stream_peek_UINT32(_s, _v) do { _v = \
(UINT32)(*_s->pointer) + \
(((UINT32)(*(_s->pointer + 1))) << 8) + \
(((UINT32)(*(_s->pointer + 2))) << 16) + \
(((UINT32)(*(_s->pointer + 3))) << 24); \
} while (0)
#define stream_peek_UINT64(_s, _v) do { _v = \
(UINT64)(*_s->pointer) + \
(((UINT64)(*(_s->pointer + 1))) << 8) + \
(((UINT64)(*(_s->pointer + 2))) << 16) + \
(((UINT64)(*(_s->pointer + 3))) << 24) + \
(((UINT64)(*(_s->pointer + 4))) << 32) + \
(((UINT64)(*(_s->pointer + 5))) << 40) + \
(((UINT64)(*(_s->pointer + 6))) << 48) + \
(((UINT64)(*(_s->pointer + 7))) << 56); \
} while (0)
#define Stream_Seek_BYTE(_s) Stream_Seek(_s, 1)
#define Stream_Seek_UINT16(_s) Stream_Seek(_s, 2)
#define Stream_Seek_UINT32(_s) Stream_Seek(_s, 4)
#define Stream_Seek_UINT64(_s) Stream_Seek(_s, 8)
#define stream_copy(_dst, _src, _n) do { \
memcpy(_dst->pointer, _src->pointer, _n); \
_dst->pointer += _n; \
_src->pointer += _n; \
} while (0)
static INLINE BOOL stream_skip(wStream* s, size_t sz) {
if (Stream_GetRemainingLength(s) < sz)
return FALSE;