freerdp: purge deprecated stream utils
This commit is contained in:
parent
64df210a1d
commit
5b92413843
@ -94,13 +94,13 @@ static int audin_process_version(IWTSVirtualChannelCallback* pChannelCallback, w
|
||||
UINT32 Version;
|
||||
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
|
||||
stream_read_UINT32(s, Version);
|
||||
Stream_Read_UINT32(s, Version);
|
||||
|
||||
DEBUG_DVC("Version=%d", Version);
|
||||
|
||||
out = stream_new(5);
|
||||
stream_write_BYTE(out, MSG_SNDIN_VERSION);
|
||||
stream_write_UINT32(out, Version);
|
||||
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);
|
||||
stream_free(out);
|
||||
|
||||
@ -128,7 +128,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
|
||||
audinFormat format;
|
||||
UINT32 cbSizeFormatsPacket;
|
||||
|
||||
stream_read_UINT32(s, NumFormats);
|
||||
Stream_Read_UINT32(s, NumFormats);
|
||||
DEBUG_DVC("NumFormats %d", NumFormats);
|
||||
if ((NumFormats < 1) || (NumFormats > 1000))
|
||||
{
|
||||
@ -147,13 +147,13 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
|
||||
for (i = 0; i < NumFormats; i++)
|
||||
{
|
||||
stream_get_mark(s, fm);
|
||||
stream_read_UINT16(s, format.wFormatTag);
|
||||
stream_read_UINT16(s, format.nChannels);
|
||||
stream_read_UINT32(s, format.nSamplesPerSec);
|
||||
Stream_Read_UINT16(s, format.wFormatTag);
|
||||
Stream_Read_UINT16(s, format.nChannels);
|
||||
Stream_Read_UINT32(s, format.nSamplesPerSec);
|
||||
Stream_Seek_UINT32(s); /* nAvgBytesPerSec */
|
||||
stream_read_UINT16(s, format.nBlockAlign);
|
||||
stream_read_UINT16(s, format.wBitsPerSample);
|
||||
stream_read_UINT16(s, format.cbSize);
|
||||
Stream_Read_UINT16(s, format.nBlockAlign);
|
||||
Stream_Read_UINT16(s, format.wBitsPerSample);
|
||||
Stream_Read_UINT16(s, format.cbSize);
|
||||
format.data = Stream_Pointer(s);
|
||||
Stream_Seek(s, format.cbSize);
|
||||
|
||||
@ -176,7 +176,7 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
|
||||
callback->formats[callback->formats_count++] = format;
|
||||
/* Put the format to output buffer */
|
||||
Stream_EnsureRemainingCapacity(out, 18 + format.cbSize);
|
||||
stream_write(out, fm, 18 + format.cbSize);
|
||||
Stream_Write(out, fm, 18 + format.cbSize);
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,9 +185,9 @@ static int audin_process_formats(IWTSVirtualChannelCallback* pChannelCallback, w
|
||||
cbSizeFormatsPacket = Stream_GetPosition(out);
|
||||
Stream_SetPosition(out, 0);
|
||||
|
||||
stream_write_BYTE(out, MSG_SNDIN_FORMATS); /* Header (1 byte) */
|
||||
stream_write_UINT32(out, callback->formats_count); /* NumFormats (4 bytes) */
|
||||
stream_write_UINT32(out, cbSizeFormatsPacket); /* cbSizeFormatsPacket (4 bytes) */
|
||||
Stream_Write_UINT8(out, MSG_SNDIN_FORMATS); /* Header (1 byte) */
|
||||
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);
|
||||
stream_free(out);
|
||||
@ -202,8 +202,8 @@ static int audin_send_format_change_pdu(IWTSVirtualChannelCallback* pChannelCall
|
||||
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
|
||||
out = stream_new(5);
|
||||
stream_write_BYTE(out, MSG_SNDIN_FORMATCHANGE);
|
||||
stream_write_UINT32(out, NewFormat);
|
||||
Stream_Write_UINT8(out, MSG_SNDIN_FORMATCHANGE);
|
||||
Stream_Write_UINT32(out, NewFormat);
|
||||
error = callback->channel->Write(callback->channel, 5, stream_get_head(out), NULL);
|
||||
stream_free(out);
|
||||
|
||||
@ -217,8 +217,8 @@ static int audin_send_open_reply_pdu(IWTSVirtualChannelCallback* pChannelCallbac
|
||||
AUDIN_CHANNEL_CALLBACK* callback = (AUDIN_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
|
||||
out = stream_new(5);
|
||||
stream_write_BYTE(out, MSG_SNDIN_OPEN_REPLY);
|
||||
stream_write_UINT32(out, Result);
|
||||
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);
|
||||
stream_free(out);
|
||||
|
||||
@ -237,8 +237,8 @@ static BOOL audin_receive_wave_data(BYTE* data, int size, void* user_data)
|
||||
return FALSE;
|
||||
|
||||
out = stream_new(size + 1);
|
||||
stream_write_BYTE(out, MSG_SNDIN_DATA);
|
||||
stream_write(out, data, size);
|
||||
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);
|
||||
stream_free(out);
|
||||
|
||||
@ -253,8 +253,8 @@ static int audin_process_open(IWTSVirtualChannelCallback* pChannelCallback, wStr
|
||||
UINT32 initialFormat;
|
||||
UINT32 FramesPerPacket;
|
||||
|
||||
stream_read_UINT32(s, FramesPerPacket);
|
||||
stream_read_UINT32(s, initialFormat);
|
||||
Stream_Read_UINT32(s, FramesPerPacket);
|
||||
Stream_Read_UINT32(s, initialFormat);
|
||||
|
||||
DEBUG_DVC("FramesPerPacket=%d initialFormat=%d",
|
||||
FramesPerPacket, initialFormat);
|
||||
@ -286,7 +286,7 @@ static int audin_process_format_change(IWTSVirtualChannelCallback* pChannelCallb
|
||||
UINT32 NewFormat;
|
||||
audinFormat* format;
|
||||
|
||||
stream_read_UINT32(s, NewFormat);
|
||||
Stream_Read_UINT32(s, NewFormat);
|
||||
|
||||
DEBUG_DVC("NewFormat=%d", NewFormat);
|
||||
|
||||
@ -320,7 +320,7 @@ static int audin_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
|
||||
s = stream_new(0);
|
||||
stream_attach(s, pBuffer, cbSize);
|
||||
|
||||
stream_read_BYTE(s, MessageId);
|
||||
Stream_Read_UINT8(s, MessageId);
|
||||
|
||||
DEBUG_DVC("MessageId=0x%x", MessageId);
|
||||
|
||||
|
@ -76,8 +76,8 @@ static void audin_server_select_format(audin_server_context* context, int client
|
||||
|
||||
static void audin_server_send_version(audin_server* audin, wStream* s)
|
||||
{
|
||||
stream_write_BYTE(s, MSG_SNDIN_VERSION);
|
||||
stream_write_UINT32(s, 1); /* Version (4 bytes) */
|
||||
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);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ static BOOL audin_server_recv_version(audin_server* audin, wStream* s, UINT32 le
|
||||
if (length < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, Version);
|
||||
Stream_Read_UINT32(s, Version);
|
||||
|
||||
if (Version < 1)
|
||||
return FALSE;
|
||||
@ -102,9 +102,9 @@ static void audin_server_send_formats(audin_server* audin, wStream* s)
|
||||
UINT32 nAvgBytesPerSec;
|
||||
|
||||
Stream_SetPosition(s, 0);
|
||||
stream_write_BYTE(s, MSG_SNDIN_FORMATS);
|
||||
stream_write_UINT32(s, audin->context.num_server_formats); /* NumFormats (4 bytes) */
|
||||
stream_write_UINT32(s, 0); /* cbSizeFormatsPacket (4 bytes), client-to-server only */
|
||||
Stream_Write_UINT8(s, MSG_SNDIN_FORMATS);
|
||||
Stream_Write_UINT32(s, audin->context.num_server_formats); /* NumFormats (4 bytes) */
|
||||
Stream_Write_UINT32(s, 0); /* cbSizeFormatsPacket (4 bytes), client-to-server only */
|
||||
|
||||
for (i = 0; i < audin->context.num_server_formats; i++)
|
||||
{
|
||||
@ -114,18 +114,18 @@ static void audin_server_send_formats(audin_server* audin, wStream* s)
|
||||
|
||||
Stream_EnsureRemainingCapacity(s, 18);
|
||||
|
||||
stream_write_UINT16(s, audin->context.server_formats[i].wFormatTag);
|
||||
stream_write_UINT16(s, audin->context.server_formats[i].nChannels);
|
||||
stream_write_UINT32(s, audin->context.server_formats[i].nSamplesPerSec);
|
||||
stream_write_UINT32(s, nAvgBytesPerSec);
|
||||
stream_write_UINT16(s, audin->context.server_formats[i].nBlockAlign);
|
||||
stream_write_UINT16(s, audin->context.server_formats[i].wBitsPerSample);
|
||||
stream_write_UINT16(s, audin->context.server_formats[i].cbSize);
|
||||
Stream_Write_UINT16(s, audin->context.server_formats[i].wFormatTag);
|
||||
Stream_Write_UINT16(s, audin->context.server_formats[i].nChannels);
|
||||
Stream_Write_UINT32(s, audin->context.server_formats[i].nSamplesPerSec);
|
||||
Stream_Write_UINT32(s, nAvgBytesPerSec);
|
||||
Stream_Write_UINT16(s, audin->context.server_formats[i].nBlockAlign);
|
||||
Stream_Write_UINT16(s, audin->context.server_formats[i].wBitsPerSample);
|
||||
Stream_Write_UINT16(s, audin->context.server_formats[i].cbSize);
|
||||
|
||||
if (audin->context.server_formats[i].cbSize)
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(s, audin->context.server_formats[i].cbSize);
|
||||
stream_write(s, audin->context.server_formats[i].data,
|
||||
Stream_Write(s, audin->context.server_formats[i].data,
|
||||
audin->context.server_formats[i].cbSize);
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ static BOOL audin_server_recv_formats(audin_server* audin, wStream* s, UINT32 le
|
||||
if (length < 8)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, audin->context.num_client_formats); /* NumFormats (4 bytes) */
|
||||
Stream_Read_UINT32(s, audin->context.num_client_formats); /* NumFormats (4 bytes) */
|
||||
Stream_Seek_UINT32(s); /* cbSizeFormatsPacket (4 bytes) */
|
||||
length -= 8;
|
||||
|
||||
@ -159,13 +159,13 @@ static BOOL audin_server_recv_formats(audin_server* audin, wStream* s, UINT32 le
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_UINT16(s, audin->context.client_formats[i].wFormatTag);
|
||||
stream_read_UINT16(s, audin->context.client_formats[i].nChannels);
|
||||
stream_read_UINT32(s, audin->context.client_formats[i].nSamplesPerSec);
|
||||
Stream_Read_UINT16(s, audin->context.client_formats[i].wFormatTag);
|
||||
Stream_Read_UINT16(s, audin->context.client_formats[i].nChannels);
|
||||
Stream_Read_UINT32(s, audin->context.client_formats[i].nSamplesPerSec);
|
||||
Stream_Seek_UINT32(s); /* nAvgBytesPerSec */
|
||||
stream_read_UINT16(s, audin->context.client_formats[i].nBlockAlign);
|
||||
stream_read_UINT16(s, audin->context.client_formats[i].wBitsPerSample);
|
||||
stream_read_UINT16(s, audin->context.client_formats[i].cbSize);
|
||||
Stream_Read_UINT16(s, audin->context.client_formats[i].nBlockAlign);
|
||||
Stream_Read_UINT16(s, audin->context.client_formats[i].wBitsPerSample);
|
||||
Stream_Read_UINT16(s, audin->context.client_formats[i].cbSize);
|
||||
if (audin->context.client_formats[i].cbSize > 0)
|
||||
{
|
||||
Stream_Seek(s, audin->context.client_formats[i].cbSize);
|
||||
@ -185,21 +185,21 @@ static void audin_server_send_open(audin_server* audin, wStream* s)
|
||||
audin->opened = TRUE;
|
||||
|
||||
Stream_SetPosition(s, 0);
|
||||
stream_write_BYTE(s, MSG_SNDIN_OPEN);
|
||||
stream_write_UINT32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */
|
||||
stream_write_UINT32(s, audin->context.selected_client_format); /* initialFormat (4 bytes) */
|
||||
Stream_Write_UINT8(s, MSG_SNDIN_OPEN);
|
||||
Stream_Write_UINT32(s, audin->context.frames_per_packet); /* FramesPerPacket (4 bytes) */
|
||||
Stream_Write_UINT32(s, audin->context.selected_client_format); /* initialFormat (4 bytes) */
|
||||
/*
|
||||
* [MS-RDPEAI] 3.2.5.1.6
|
||||
* The second format specify the format that SHOULD be used to capture data from
|
||||
* the actual audio input device.
|
||||
*/
|
||||
stream_write_UINT16(s, 1); /* wFormatTag = PCM */
|
||||
stream_write_UINT16(s, 2); /* nChannels */
|
||||
stream_write_UINT32(s, 44100); /* nSamplesPerSec */
|
||||
stream_write_UINT32(s, 44100 * 2 * 2); /* nAvgBytesPerSec */
|
||||
stream_write_UINT16(s, 4); /* nBlockAlign */
|
||||
stream_write_UINT16(s, 16); /* wBitsPerSample */
|
||||
stream_write_UINT16(s, 0); /* cbSize */
|
||||
Stream_Write_UINT16(s, 1); /* wFormatTag = PCM */
|
||||
Stream_Write_UINT16(s, 2); /* nChannels */
|
||||
Stream_Write_UINT32(s, 44100); /* nSamplesPerSec */
|
||||
Stream_Write_UINT32(s, 44100 * 2 * 2); /* nAvgBytesPerSec */
|
||||
Stream_Write_UINT16(s, 4); /* nBlockAlign */
|
||||
Stream_Write_UINT16(s, 16); /* wBitsPerSample */
|
||||
Stream_Write_UINT16(s, 0); /* cbSize */
|
||||
|
||||
WTSVirtualChannelWrite(audin->audin_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
|
||||
}
|
||||
@ -211,7 +211,7 @@ static BOOL audin_server_recv_open_reply(audin_server* audin, wStream* s, UINT32
|
||||
if (length < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, Result);
|
||||
Stream_Read_UINT32(s, Result);
|
||||
|
||||
IFCALL(audin->context.OpenResult, &audin->context, Result);
|
||||
|
||||
@ -346,7 +346,7 @@ static void* audin_server_thread_func(void* arg)
|
||||
if (bytes_returned < 1)
|
||||
continue;
|
||||
|
||||
stream_read_BYTE(s, MessageId);
|
||||
Stream_Read_UINT8(s, MessageId);
|
||||
bytes_returned--;
|
||||
|
||||
switch (MessageId)
|
||||
|
@ -53,7 +53,7 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
|
||||
if (cb_event->raw_format_data)
|
||||
{
|
||||
s = cliprdr_packet_new(CB_FORMAT_LIST, 0, cb_event->raw_format_data_size);
|
||||
stream_write(s, cb_event->raw_format_data, cb_event->raw_format_data_size);
|
||||
Stream_Write(s, cb_event->raw_format_data, cb_event->raw_format_data_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -89,12 +89,12 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
|
||||
|
||||
Stream_EnsureRemainingCapacity(body, Stream_Capacity(body) + 4 + name_length);
|
||||
|
||||
stream_write_UINT32(body, cb_event->formats[i]);
|
||||
stream_write(body, name, name_length);
|
||||
Stream_Write_UINT32(body, cb_event->formats[i]);
|
||||
Stream_Write(body, name, name_length);
|
||||
}
|
||||
|
||||
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_get_head(body), Stream_Capacity(body));
|
||||
stream_free(body);
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, wStream* s, UINT
|
||||
{
|
||||
format_name = &cliprdr->format_names[i];
|
||||
|
||||
stream_read_UINT32(s, format_name->id);
|
||||
Stream_Read_UINT32(s, format_name->id);
|
||||
|
||||
if (ascii)
|
||||
{
|
||||
@ -179,7 +179,7 @@ void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, wStream* s, UINT3
|
||||
}
|
||||
|
||||
format_name = &cliprdr->format_names[cliprdr->num_format_names++];
|
||||
stream_read_UINT32(s, format_name->id);
|
||||
Stream_Read_UINT32(s, format_name->id);
|
||||
|
||||
format_name->name = NULL;
|
||||
format_name->length = 0;
|
||||
@ -309,7 +309,7 @@ void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, wStream* s, UIN
|
||||
cb_event = (RDP_CB_DATA_REQUEST_EVENT*) freerdp_event_new(CliprdrChannel_Class,
|
||||
CliprdrChannel_DataRequest, NULL, NULL);
|
||||
|
||||
stream_read_UINT32(s, cb_event->format);
|
||||
Stream_Read_UINT32(s, cb_event->format);
|
||||
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, (wMessage*) cb_event);
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ void cliprdr_process_format_data_response_event(cliprdrPlugin* cliprdr, RDP_CB_D
|
||||
if (cb_event->size > 0)
|
||||
{
|
||||
s = cliprdr_packet_new(CB_FORMAT_DATA_RESPONSE, CB_RESPONSE_OK, cb_event->size);
|
||||
stream_write(s, cb_event->data, cb_event->size);
|
||||
Stream_Write(s, cb_event->data, cb_event->size);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -339,7 +339,7 @@ void cliprdr_process_format_data_request_event(cliprdrPlugin* cliprdr, RDP_CB_DA
|
||||
DEBUG_CLIPRDR("Sending Format Data Request");
|
||||
|
||||
s = cliprdr_packet_new(CB_FORMAT_DATA_REQUEST, 0, 4);
|
||||
stream_write_UINT32(s, cb_event->format);
|
||||
Stream_Write_UINT32(s, cb_event->format);
|
||||
cliprdr_packet_send(cliprdr, s);
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,8 @@ wStream* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen)
|
||||
wStream* s;
|
||||
|
||||
s = stream_new(dataLen + 8);
|
||||
stream_write_UINT16(s, msgType);
|
||||
stream_write_UINT16(s, msgFlags);
|
||||
Stream_Write_UINT16(s, msgType);
|
||||
Stream_Write_UINT16(s, msgFlags);
|
||||
/* Write actual length after the entire packet has been constructed. */
|
||||
Stream_Seek(s, 4);
|
||||
|
||||
@ -74,7 +74,7 @@ void cliprdr_packet_send(cliprdrPlugin* cliprdr, wStream* s)
|
||||
pos = Stream_GetPosition(s);
|
||||
dataLen = pos - 8;
|
||||
Stream_SetPosition(s, 4);
|
||||
stream_write_UINT32(s, dataLen);
|
||||
Stream_Write_UINT32(s, dataLen);
|
||||
Stream_SetPosition(s, pos);
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*) cliprdr, s);
|
||||
@ -106,8 +106,8 @@ static void cliprdr_process_general_capability(cliprdrPlugin* cliprdr, wStream*
|
||||
UINT32 version;
|
||||
UINT32 generalFlags;
|
||||
|
||||
stream_read_UINT32(s, version); /* version (4 bytes) */
|
||||
stream_read_UINT32(s, generalFlags); /* generalFlags (4 bytes) */
|
||||
Stream_Read_UINT32(s, version); /* version (4 bytes) */
|
||||
Stream_Read_UINT32(s, generalFlags); /* generalFlags (4 bytes) */
|
||||
|
||||
DEBUG_CLIPRDR("Version: %d", version);
|
||||
|
||||
@ -137,15 +137,15 @@ static void cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, wStream* s, UINT16
|
||||
UINT16 cCapabilitiesSets;
|
||||
UINT16 capabilitySetType;
|
||||
|
||||
stream_read_UINT16(s, cCapabilitiesSets); /* cCapabilitiesSets (2 bytes) */
|
||||
Stream_Read_UINT16(s, cCapabilitiesSets); /* cCapabilitiesSets (2 bytes) */
|
||||
Stream_Seek_UINT16(s); /* pad1 (2 bytes) */
|
||||
|
||||
DEBUG_CLIPRDR("cCapabilitiesSets %d", cCapabilitiesSets);
|
||||
|
||||
for (i = 0; i < cCapabilitiesSets; i++)
|
||||
{
|
||||
stream_read_UINT16(s, capabilitySetType); /* capabilitySetType (2 bytes) */
|
||||
stream_read_UINT16(s, lengthCapability); /* lengthCapability (2 bytes) */
|
||||
Stream_Read_UINT16(s, capabilitySetType); /* capabilitySetType (2 bytes) */
|
||||
Stream_Read_UINT16(s, lengthCapability); /* lengthCapability (2 bytes) */
|
||||
|
||||
switch (capabilitySetType)
|
||||
{
|
||||
@ -171,12 +171,12 @@ static void cliprdr_send_clip_caps(cliprdrPlugin* cliprdr)
|
||||
|
||||
flags = CB_USE_LONG_FORMAT_NAMES;
|
||||
|
||||
stream_write_UINT16(s, 1); /* cCapabilitiesSets */
|
||||
stream_write_UINT16(s, 0); /* pad1 */
|
||||
stream_write_UINT16(s, CB_CAPSTYPE_GENERAL); /* capabilitySetType */
|
||||
stream_write_UINT16(s, CB_CAPSTYPE_GENERAL_LEN); /* lengthCapability */
|
||||
stream_write_UINT32(s, CB_CAPS_VERSION_2); /* version */
|
||||
stream_write_UINT32(s, flags); /* generalFlags */
|
||||
Stream_Write_UINT16(s, 1); /* cCapabilitiesSets */
|
||||
Stream_Write_UINT16(s, 0); /* pad1 */
|
||||
Stream_Write_UINT16(s, CB_CAPSTYPE_GENERAL); /* capabilitySetType */
|
||||
Stream_Write_UINT16(s, CB_CAPSTYPE_GENERAL_LEN); /* lengthCapability */
|
||||
Stream_Write_UINT32(s, CB_CAPS_VERSION_2); /* version */
|
||||
Stream_Write_UINT32(s, flags); /* generalFlags */
|
||||
|
||||
cliprdr_packet_send(cliprdr, s);
|
||||
}
|
||||
@ -200,9 +200,9 @@ static void cliprdr_process_receive(rdpSvcPlugin* plugin, wStream* s)
|
||||
UINT32 dataLen;
|
||||
cliprdrPlugin* cliprdr = (cliprdrPlugin*) plugin;
|
||||
|
||||
stream_read_UINT16(s, msgType);
|
||||
stream_read_UINT16(s, msgFlags);
|
||||
stream_read_UINT32(s, dataLen);
|
||||
Stream_Read_UINT16(s, msgType);
|
||||
Stream_Read_UINT16(s, msgFlags);
|
||||
Stream_Read_UINT32(s, dataLen);
|
||||
|
||||
DEBUG_CLIPRDR("msgType: %s (%d), msgFlags: %d dataLen: %d",
|
||||
CB_MSG_TYPE_STRINGS[msgType], msgType, msgFlags, dataLen);
|
||||
|
@ -62,17 +62,17 @@ static int drdynvc_write_variable_uint(wStream* stream, UINT32 val)
|
||||
if (val <= 0xFF)
|
||||
{
|
||||
cb = 0;
|
||||
stream_write_BYTE(stream, val);
|
||||
Stream_Write_UINT8(stream, val);
|
||||
}
|
||||
else if (val <= 0xFFFF)
|
||||
{
|
||||
cb = 1;
|
||||
stream_write_UINT16(stream, val);
|
||||
Stream_Write_UINT16(stream, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
cb = 2;
|
||||
stream_write_UINT32(stream, val);
|
||||
Stream_Write_UINT32(stream, val);
|
||||
}
|
||||
|
||||
return cb;
|
||||
@ -100,7 +100,7 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UIN
|
||||
{
|
||||
pos = Stream_GetPosition(data_out);
|
||||
Stream_SetPosition(data_out, 0);
|
||||
stream_write_BYTE(data_out, 0x40 | cbChId);
|
||||
Stream_Write_UINT8(data_out, 0x40 | cbChId);
|
||||
Stream_SetPosition(data_out, pos);
|
||||
error = svc_plugin_send((rdpSvcPlugin*) drdynvc, data_out);
|
||||
}
|
||||
@ -108,9 +108,9 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UIN
|
||||
{
|
||||
pos = Stream_GetPosition(data_out);
|
||||
Stream_SetPosition(data_out, 0);
|
||||
stream_write_BYTE(data_out, 0x30 | cbChId);
|
||||
Stream_Write_UINT8(data_out, 0x30 | cbChId);
|
||||
Stream_SetPosition(data_out, pos);
|
||||
stream_write(data_out, data, data_size);
|
||||
Stream_Write(data_out, data, data_size);
|
||||
error = svc_plugin_send((rdpSvcPlugin*) drdynvc, data_out);
|
||||
}
|
||||
else
|
||||
@ -119,10 +119,10 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UIN
|
||||
cbLen = drdynvc_write_variable_uint(data_out, data_size);
|
||||
pos = Stream_GetPosition(data_out);
|
||||
Stream_SetPosition(data_out, 0);
|
||||
stream_write_BYTE(data_out, 0x20 | cbChId | (cbLen << 2));
|
||||
Stream_Write_UINT8(data_out, 0x20 | cbChId | (cbLen << 2));
|
||||
Stream_SetPosition(data_out, pos);
|
||||
chunk_len = CHANNEL_CHUNK_LENGTH - pos;
|
||||
stream_write(data_out, data, chunk_len);
|
||||
Stream_Write(data_out, data, chunk_len);
|
||||
data += chunk_len;
|
||||
data_size -= chunk_len;
|
||||
error = svc_plugin_send((rdpSvcPlugin*) drdynvc, data_out);
|
||||
@ -135,13 +135,13 @@ int drdynvc_write_data(drdynvcPlugin* drdynvc, UINT32 ChannelId, BYTE* data, UIN
|
||||
|
||||
pos = Stream_GetPosition(data_out);
|
||||
Stream_SetPosition(data_out, 0);
|
||||
stream_write_BYTE(data_out, 0x30 | cbChId);
|
||||
Stream_Write_UINT8(data_out, 0x30 | cbChId);
|
||||
Stream_SetPosition(data_out, pos);
|
||||
|
||||
chunk_len = data_size;
|
||||
if (chunk_len > CHANNEL_CHUNK_LENGTH - pos)
|
||||
chunk_len = CHANNEL_CHUNK_LENGTH - pos;
|
||||
stream_write(data_out, data, chunk_len);
|
||||
Stream_Write(data_out, data, chunk_len);
|
||||
data += chunk_len;
|
||||
data_size -= chunk_len;
|
||||
error = svc_plugin_send((rdpSvcPlugin*)drdynvc, data_out);
|
||||
@ -180,19 +180,19 @@ static int drdynvc_process_capability_request(drdynvcPlugin* drdynvc, int Sp, in
|
||||
|
||||
DEBUG_DVC("Sp=%d cbChId=%d", Sp, cbChId);
|
||||
Stream_Seek(s, 1); /* pad */
|
||||
stream_read_UINT16(s, drdynvc->version);
|
||||
Stream_Read_UINT16(s, drdynvc->version);
|
||||
|
||||
if (drdynvc->version == 2)
|
||||
{
|
||||
stream_read_UINT16(s, drdynvc->PriorityCharge0);
|
||||
stream_read_UINT16(s, drdynvc->PriorityCharge1);
|
||||
stream_read_UINT16(s, drdynvc->PriorityCharge2);
|
||||
stream_read_UINT16(s, drdynvc->PriorityCharge3);
|
||||
Stream_Read_UINT16(s, drdynvc->PriorityCharge0);
|
||||
Stream_Read_UINT16(s, drdynvc->PriorityCharge1);
|
||||
Stream_Read_UINT16(s, drdynvc->PriorityCharge2);
|
||||
Stream_Read_UINT16(s, drdynvc->PriorityCharge3);
|
||||
}
|
||||
|
||||
data_out = stream_new(4);
|
||||
stream_write_UINT16(data_out, 0x0050); /* Cmd+Sp+cbChId+Pad. Note: MSTSC sends 0x005c */
|
||||
stream_write_UINT16(data_out, drdynvc->version);
|
||||
Stream_Write_UINT16(data_out, 0x0050); /* Cmd+Sp+cbChId+Pad. Note: MSTSC sends 0x005c */
|
||||
Stream_Write_UINT16(data_out, drdynvc->version);
|
||||
error = svc_plugin_send((rdpSvcPlugin*) drdynvc, data_out);
|
||||
|
||||
if (error != CHANNEL_RC_OK)
|
||||
@ -213,15 +213,15 @@ static UINT32 drdynvc_read_variable_uint(wStream* stream, int cbLen)
|
||||
switch (cbLen)
|
||||
{
|
||||
case 0:
|
||||
stream_read_BYTE(stream, val);
|
||||
Stream_Read_UINT8(stream, val);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
stream_read_UINT16(stream, val);
|
||||
Stream_Read_UINT16(stream, val);
|
||||
break;
|
||||
|
||||
default:
|
||||
stream_read_UINT32(stream, val);
|
||||
Stream_Read_UINT32(stream, val);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -242,19 +242,19 @@ static int drdynvc_process_create_request(drdynvcPlugin* drdynvc, int Sp, int cb
|
||||
error = dvcman_create_channel(drdynvc->channel_mgr, ChannelId, (char*) Stream_Pointer(s));
|
||||
|
||||
data_out = stream_new(pos + 4);
|
||||
stream_write_BYTE(data_out, 0x10 | cbChId);
|
||||
Stream_Write_UINT8(data_out, 0x10 | cbChId);
|
||||
Stream_SetPosition(s, 1);
|
||||
stream_copy(data_out, s, pos - 1);
|
||||
|
||||
if (error == 0)
|
||||
{
|
||||
DEBUG_DVC("channel created");
|
||||
stream_write_UINT32(data_out, 0);
|
||||
Stream_Write_UINT32(data_out, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUG_DVC("no listener");
|
||||
stream_write_UINT32(data_out, (UINT32)(-1));
|
||||
Stream_Write_UINT32(data_out, (UINT32)(-1));
|
||||
}
|
||||
|
||||
error = svc_plugin_send((rdpSvcPlugin*) drdynvc, data_out);
|
||||
@ -317,7 +317,7 @@ static void drdynvc_process_receive(rdpSvcPlugin* plugin, wStream* s)
|
||||
int cbChId;
|
||||
drdynvcPlugin* drdynvc = (drdynvcPlugin*) plugin;
|
||||
|
||||
stream_read_BYTE(s, value);
|
||||
Stream_Read_UINT8(s, value);
|
||||
Cmd = (value & 0xf0) >> 4;
|
||||
Sp = (value & 0x0c) >> 2;
|
||||
cbChId = (value & 0x03) >> 0;
|
||||
|
@ -453,7 +453,7 @@ int dvcman_receive_channel_data(IWTSVirtualChannelManager* pChannelMgr, UINT32 C
|
||||
return 1;
|
||||
}
|
||||
|
||||
stream_write(channel->dvc_data, data, data_size);
|
||||
Stream_Write(channel->dvc_data, data, data_size);
|
||||
|
||||
if (Stream_GetPosition(channel->dvc_data) >= Stream_Capacity(channel->dvc_data))
|
||||
{
|
||||
|
@ -382,7 +382,7 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, w
|
||||
|
||||
if (STAT(file->fullpath, &st) != 0)
|
||||
{
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* Length */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -390,38 +390,38 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, w
|
||||
{
|
||||
case FileBasicInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232094.aspx */
|
||||
stream_write_UINT32(output, 36); /* Length */
|
||||
Stream_Write_UINT32(output, 36); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 36);
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
Stream_Write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
/* Reserved(4), MUST NOT be added! */
|
||||
break;
|
||||
|
||||
case FileStandardInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232088.aspx */
|
||||
stream_write_UINT32(output, 22); /* Length */
|
||||
Stream_Write_UINT32(output, 22); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 22);
|
||||
stream_write_UINT64(output, st.st_size); /* AllocationSize */
|
||||
stream_write_UINT64(output, st.st_size); /* EndOfFile */
|
||||
stream_write_UINT32(output, st.st_nlink); /* NumberOfLinks */
|
||||
stream_write_BYTE(output, file->delete_pending ? 1 : 0); /* DeletePending */
|
||||
stream_write_BYTE(output, file->is_dir ? 1 : 0); /* Directory */
|
||||
Stream_Write_UINT64(output, st.st_size); /* AllocationSize */
|
||||
Stream_Write_UINT64(output, st.st_size); /* EndOfFile */
|
||||
Stream_Write_UINT32(output, st.st_nlink); /* NumberOfLinks */
|
||||
Stream_Write_UINT8(output, file->delete_pending ? 1 : 0); /* DeletePending */
|
||||
Stream_Write_UINT8(output, file->is_dir ? 1 : 0); /* Directory */
|
||||
/* Reserved(2), MUST NOT be added! */
|
||||
break;
|
||||
|
||||
case FileAttributeTagInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232093.aspx */
|
||||
stream_write_UINT32(output, 8); /* Length */
|
||||
Stream_Write_UINT32(output, 8); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 8);
|
||||
stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
stream_write_UINT32(output, 0); /* ReparseTag */
|
||||
Stream_Write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
Stream_Write_UINT32(output, 0); /* ReparseTag */
|
||||
break;
|
||||
|
||||
default:
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* Length */
|
||||
DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass);
|
||||
return FALSE;
|
||||
}
|
||||
@ -449,9 +449,9 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232094.aspx */
|
||||
Stream_Seek_UINT64(input); /* CreationTime */
|
||||
Stream_Seek_UINT64(input); /* LastAccessTime */
|
||||
stream_read_UINT64(input, LastWriteTime);
|
||||
Stream_Read_UINT64(input, LastWriteTime);
|
||||
Stream_Seek_UINT64(input); /* ChangeTime */
|
||||
stream_read_UINT32(input, FileAttributes);
|
||||
Stream_Read_UINT32(input, FileAttributes);
|
||||
|
||||
if (FSTAT(file->fd, &st) != 0)
|
||||
return FALSE;
|
||||
@ -485,7 +485,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232067.aspx */
|
||||
case FileAllocationInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232076.aspx */
|
||||
stream_read_UINT64(input, size);
|
||||
Stream_Read_UINT64(input, size);
|
||||
if (ftruncate(file->fd, size) != 0)
|
||||
return FALSE;
|
||||
break;
|
||||
@ -494,7 +494,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232098.aspx */
|
||||
/* http://msdn.microsoft.com/en-us/library/cc241371.aspx */
|
||||
if (Length)
|
||||
stream_read_BYTE(input, file->delete_pending);
|
||||
Stream_Read_UINT8(input, file->delete_pending);
|
||||
else
|
||||
file->delete_pending = 1;
|
||||
break;
|
||||
@ -503,7 +503,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232085.aspx */
|
||||
Stream_Seek_BYTE(input); /* ReplaceIfExists */
|
||||
Stream_Seek_BYTE(input); /* RootDirectory */
|
||||
stream_read_UINT32(input, FileNameLength);
|
||||
Stream_Read_UINT32(input, FileNameLength);
|
||||
|
||||
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(input),
|
||||
FileNameLength / 2, &s, 0, NULL, NULL);
|
||||
@ -550,8 +550,8 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT
|
||||
|
||||
if (!file->dir)
|
||||
{
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
stream_write_BYTE(output, 0); /* Padding */
|
||||
Stream_Write_UINT32(output, 0); /* Length */
|
||||
Stream_Write_UINT8(output, 0); /* Padding */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -589,8 +589,8 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT
|
||||
if (ent == NULL)
|
||||
{
|
||||
DEBUG_SVC(" pattern %s not found.", file->pattern);
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
stream_write_BYTE(output, 0); /* Padding */
|
||||
Stream_Write_UINT32(output, 0); /* Length */
|
||||
Stream_Write_UINT8(output, 0); /* Padding */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -615,73 +615,73 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT
|
||||
{
|
||||
case FileDirectoryInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232097.aspx */
|
||||
stream_write_UINT32(output, 64 + length); /* Length */
|
||||
Stream_Write_UINT32(output, 64 + length); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 64 + length);
|
||||
stream_write_UINT32(output, 0); /* NextEntryOffset */
|
||||
stream_write_UINT32(output, 0); /* FileIndex */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
stream_write_UINT64(output, st.st_size); /* EndOfFile */
|
||||
stream_write_UINT64(output, st.st_size); /* AllocationSize */
|
||||
stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
stream_write_UINT32(output, length); /* FileNameLength */
|
||||
stream_write(output, ent_path, length);
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
Stream_Write_UINT64(output, st.st_size); /* EndOfFile */
|
||||
Stream_Write_UINT64(output, st.st_size); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
Stream_Write_UINT32(output, length); /* FileNameLength */
|
||||
Stream_Write(output, ent_path, length);
|
||||
break;
|
||||
|
||||
case FileFullDirectoryInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232068.aspx */
|
||||
stream_write_UINT32(output, 68 + length); /* Length */
|
||||
Stream_Write_UINT32(output, 68 + length); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 68 + length);
|
||||
stream_write_UINT32(output, 0); /* NextEntryOffset */
|
||||
stream_write_UINT32(output, 0); /* FileIndex */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
stream_write_UINT64(output, st.st_size); /* EndOfFile */
|
||||
stream_write_UINT64(output, st.st_size); /* AllocationSize */
|
||||
stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
stream_write_UINT32(output, length); /* FileNameLength */
|
||||
stream_write_UINT32(output, 0); /* EaSize */
|
||||
stream_write(output, ent_path, length);
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
Stream_Write_UINT64(output, st.st_size); /* EndOfFile */
|
||||
Stream_Write_UINT64(output, st.st_size); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
Stream_Write_UINT32(output, length); /* FileNameLength */
|
||||
Stream_Write_UINT32(output, 0); /* EaSize */
|
||||
Stream_Write(output, ent_path, length);
|
||||
break;
|
||||
|
||||
case FileBothDirectoryInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232095.aspx */
|
||||
stream_write_UINT32(output, 93 + length); /* Length */
|
||||
Stream_Write_UINT32(output, 93 + length); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 93 + length);
|
||||
stream_write_UINT32(output, 0); /* NextEntryOffset */
|
||||
stream_write_UINT32(output, 0); /* FileIndex */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
stream_write_UINT64(output, st.st_size); /* EndOfFile */
|
||||
stream_write_UINT64(output, st.st_size); /* AllocationSize */
|
||||
stream_write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
stream_write_UINT32(output, length); /* FileNameLength */
|
||||
stream_write_UINT32(output, 0); /* EaSize */
|
||||
stream_write_BYTE(output, 0); /* ShortNameLength */
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* CreationTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_atime)); /* LastAccessTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_mtime)); /* LastWriteTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* ChangeTime */
|
||||
Stream_Write_UINT64(output, st.st_size); /* EndOfFile */
|
||||
Stream_Write_UINT64(output, st.st_size); /* AllocationSize */
|
||||
Stream_Write_UINT32(output, FILE_ATTR_SYSTEM_TO_RDP(file, st)); /* FileAttributes */
|
||||
Stream_Write_UINT32(output, length); /* FileNameLength */
|
||||
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_write(output, ent_path, length);
|
||||
Stream_Write_zero(output, 24); /* ShortName */
|
||||
Stream_Write(output, ent_path, length);
|
||||
break;
|
||||
|
||||
case FileNamesInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232077.aspx */
|
||||
stream_write_UINT32(output, 12 + length); /* Length */
|
||||
Stream_Write_UINT32(output, 12 + length); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 12 + length);
|
||||
stream_write_UINT32(output, 0); /* NextEntryOffset */
|
||||
stream_write_UINT32(output, 0); /* FileIndex */
|
||||
stream_write_UINT32(output, length); /* FileNameLength */
|
||||
stream_write(output, ent_path, length);
|
||||
Stream_Write_UINT32(output, 0); /* NextEntryOffset */
|
||||
Stream_Write_UINT32(output, 0); /* FileIndex */
|
||||
Stream_Write_UINT32(output, length); /* FileNameLength */
|
||||
Stream_Write(output, ent_path, length);
|
||||
break;
|
||||
|
||||
default:
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
stream_write_BYTE(output, 0); /* Padding */
|
||||
Stream_Write_UINT32(output, 0); /* Length */
|
||||
Stream_Write_UINT8(output, 0); /* Padding */
|
||||
DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass);
|
||||
ret = FALSE;
|
||||
break;
|
||||
|
@ -127,11 +127,11 @@ static void drive_process_irp_create(DRIVE_DEVICE* disk, IRP* irp)
|
||||
UINT32 CreateOptions;
|
||||
UINT32 PathLength;
|
||||
|
||||
stream_read_UINT32(irp->input, DesiredAccess);
|
||||
Stream_Read_UINT32(irp->input, DesiredAccess);
|
||||
Stream_Seek(irp->input, 16); /* AllocationSize(8), FileAttributes(4), SharedAccess(4) */
|
||||
stream_read_UINT32(irp->input, CreateDisposition);
|
||||
stream_read_UINT32(irp->input, CreateOptions);
|
||||
stream_read_UINT32(irp->input, PathLength);
|
||||
Stream_Read_UINT32(irp->input, CreateDisposition);
|
||||
Stream_Read_UINT32(irp->input, CreateOptions);
|
||||
Stream_Read_UINT32(irp->input, PathLength);
|
||||
|
||||
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(irp->input),
|
||||
PathLength / 2, &path, 0, NULL, NULL);
|
||||
@ -186,8 +186,8 @@ static void drive_process_irp_create(DRIVE_DEVICE* disk, IRP* irp)
|
||||
DEBUG_SVC("%s(%d) created.", file->fullpath, file->id);
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, FileId);
|
||||
stream_write_BYTE(irp->output, Information);
|
||||
Stream_Write_UINT32(irp->output, FileId);
|
||||
Stream_Write_UINT8(irp->output, Information);
|
||||
|
||||
free(path);
|
||||
|
||||
@ -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_Write_zero(irp->output, 5); /* Padding(5) */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -226,8 +226,8 @@ static void drive_process_irp_read(DRIVE_DEVICE* disk, IRP* irp)
|
||||
UINT64 Offset;
|
||||
BYTE* buffer = NULL;
|
||||
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
Stream_Read_UINT32(irp->input, Length);
|
||||
Stream_Read_UINT64(irp->input, Offset);
|
||||
|
||||
file = drive_get_file_by_id(disk, irp->FileId);
|
||||
|
||||
@ -263,12 +263,12 @@ static void drive_process_irp_read(DRIVE_DEVICE* disk, IRP* irp)
|
||||
}
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
Stream_Write_UINT32(irp->output, Length);
|
||||
|
||||
if (Length > 0)
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(irp->output, (int) Length);
|
||||
stream_write(irp->output, buffer, Length);
|
||||
Stream_Write(irp->output, buffer, Length);
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
@ -282,8 +282,8 @@ static void drive_process_irp_write(DRIVE_DEVICE* disk, IRP* irp)
|
||||
UINT32 Length;
|
||||
UINT64 Offset;
|
||||
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
Stream_Read_UINT32(irp->input, Length);
|
||||
Stream_Read_UINT64(irp->input, Offset);
|
||||
Stream_Seek(irp->input, 20); /* Padding */
|
||||
|
||||
file = drive_get_file_by_id(disk, irp->FileId);
|
||||
@ -314,8 +314,8 @@ static void drive_process_irp_write(DRIVE_DEVICE* disk, IRP* irp)
|
||||
DEBUG_SVC("write %llu-%llu to %s(%d).", Offset, Offset + Length, file->fullpath, file->id);
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
stream_write_BYTE(irp->output, 0); /* Padding */
|
||||
Stream_Write_UINT32(irp->output, Length);
|
||||
Stream_Write_UINT8(irp->output, 0); /* Padding */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -325,7 +325,7 @@ static void drive_process_irp_query_information(DRIVE_DEVICE* disk, IRP* irp)
|
||||
DRIVE_FILE* file;
|
||||
UINT32 FsInformationClass;
|
||||
|
||||
stream_read_UINT32(irp->input, FsInformationClass);
|
||||
Stream_Read_UINT32(irp->input, FsInformationClass);
|
||||
|
||||
file = drive_get_file_by_id(disk, irp->FileId);
|
||||
|
||||
@ -355,8 +355,8 @@ static void drive_process_irp_set_information(DRIVE_DEVICE* disk, IRP* irp)
|
||||
UINT32 FsInformationClass;
|
||||
UINT32 Length;
|
||||
|
||||
stream_read_UINT32(irp->input, FsInformationClass);
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
Stream_Read_UINT32(irp->input, FsInformationClass);
|
||||
Stream_Read_UINT32(irp->input, Length);
|
||||
Stream_Seek(irp->input, 24); /* Padding */
|
||||
|
||||
file = drive_get_file_by_id(disk, irp->FileId);
|
||||
@ -378,7 +378,7 @@ static void drive_process_irp_set_information(DRIVE_DEVICE* disk, IRP* irp)
|
||||
DEBUG_SVC("FsInformationClass %d on %s(%d) ok.", FsInformationClass, file->fullpath, file->id);
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
Stream_Write_UINT32(irp->output, Length);
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -394,7 +394,7 @@ static void drive_process_irp_query_volume_information(DRIVE_DEVICE* disk, IRP*
|
||||
WCHAR* outStr = NULL;
|
||||
int length;
|
||||
|
||||
stream_read_UINT32(irp->input, FsInformationClass);
|
||||
Stream_Read_UINT32(irp->input, FsInformationClass);
|
||||
|
||||
STATVFS(disk->path, &svfst);
|
||||
STAT(disk->path, &st);
|
||||
@ -404,72 +404,72 @@ static void drive_process_irp_query_volume_information(DRIVE_DEVICE* disk, IRP*
|
||||
case FileFsVolumeInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232108.aspx */
|
||||
length = ConvertToUnicode(CP_UTF8, 0, volumeLabel, -1, &outStr, 0) * 2;
|
||||
stream_write_UINT32(output, 17 + length); /* Length */
|
||||
Stream_Write_UINT32(output, 17 + length); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 17 + length);
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* VolumeCreationTime */
|
||||
Stream_Write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* VolumeCreationTime */
|
||||
#ifdef ANDROID
|
||||
stream_write_UINT32(output, svfst.f_fsid.__val[0]); /* VolumeSerialNumber */
|
||||
Stream_Write_UINT32(output, svfst.f_fsid.__val[0]); /* VolumeSerialNumber */
|
||||
#else
|
||||
stream_write_UINT32(output, svfst.f_fsid); /* VolumeSerialNumber */
|
||||
Stream_Write_UINT32(output, svfst.f_fsid); /* VolumeSerialNumber */
|
||||
#endif
|
||||
stream_write_UINT32(output, length); /* VolumeLabelLength */
|
||||
stream_write_BYTE(output, 0); /* SupportsObjects */
|
||||
Stream_Write_UINT32(output, length); /* VolumeLabelLength */
|
||||
Stream_Write_UINT8(output, 0); /* SupportsObjects */
|
||||
/* Reserved(1), MUST NOT be added! */
|
||||
stream_write(output, outStr, length); /* VolumeLabel (Unicode) */
|
||||
Stream_Write(output, outStr, length); /* VolumeLabel (Unicode) */
|
||||
free(outStr);
|
||||
break;
|
||||
|
||||
case FileFsSizeInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232107.aspx */
|
||||
stream_write_UINT32(output, 24); /* Length */
|
||||
Stream_Write_UINT32(output, 24); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 24);
|
||||
stream_write_UINT64(output, svfst.f_blocks); /* TotalAllocationUnits */
|
||||
stream_write_UINT64(output, svfst.f_bavail); /* AvailableAllocationUnits */
|
||||
stream_write_UINT32(output, 1); /* SectorsPerAllocationUnit */
|
||||
stream_write_UINT32(output, svfst.f_bsize); /* BytesPerSector */
|
||||
Stream_Write_UINT64(output, svfst.f_blocks); /* TotalAllocationUnits */
|
||||
Stream_Write_UINT64(output, svfst.f_bavail); /* AvailableAllocationUnits */
|
||||
Stream_Write_UINT32(output, 1); /* SectorsPerAllocationUnit */
|
||||
Stream_Write_UINT32(output, svfst.f_bsize); /* BytesPerSector */
|
||||
break;
|
||||
|
||||
case FileFsAttributeInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232101.aspx */
|
||||
length = ConvertToUnicode(CP_UTF8, 0, diskType, -1, &outStr, 0) * 2;
|
||||
stream_write_UINT32(output, 12 + length); /* Length */
|
||||
Stream_Write_UINT32(output, 12 + length); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 12 + length);
|
||||
stream_write_UINT32(output,
|
||||
Stream_Write_UINT32(output,
|
||||
FILE_CASE_SENSITIVE_SEARCH |
|
||||
FILE_CASE_PRESERVED_NAMES |
|
||||
FILE_UNICODE_ON_DISK); /* FileSystemAttributes */
|
||||
#ifdef ANDROID
|
||||
stream_write_UINT32(output, 255); /* MaximumComponentNameLength */
|
||||
Stream_Write_UINT32(output, 255); /* MaximumComponentNameLength */
|
||||
#else
|
||||
stream_write_UINT32(output, svfst.f_namemax/*510*/); /* MaximumComponentNameLength */
|
||||
Stream_Write_UINT32(output, svfst.f_namemax/*510*/); /* MaximumComponentNameLength */
|
||||
#endif
|
||||
stream_write_UINT32(output, length); /* FileSystemNameLength */
|
||||
stream_write(output, outStr, length); /* FileSystemName (Unicode) */
|
||||
Stream_Write_UINT32(output, length); /* FileSystemNameLength */
|
||||
Stream_Write(output, outStr, length); /* FileSystemName (Unicode) */
|
||||
free(outStr);
|
||||
break;
|
||||
|
||||
case FileFsFullSizeInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232104.aspx */
|
||||
stream_write_UINT32(output, 32); /* Length */
|
||||
Stream_Write_UINT32(output, 32); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 32);
|
||||
stream_write_UINT64(output, svfst.f_blocks); /* TotalAllocationUnits */
|
||||
stream_write_UINT64(output, svfst.f_bavail); /* CallerAvailableAllocationUnits */
|
||||
stream_write_UINT64(output, svfst.f_bfree); /* AvailableAllocationUnits */
|
||||
stream_write_UINT32(output, 1); /* SectorsPerAllocationUnit */
|
||||
stream_write_UINT32(output, svfst.f_bsize); /* BytesPerSector */
|
||||
Stream_Write_UINT64(output, svfst.f_blocks); /* TotalAllocationUnits */
|
||||
Stream_Write_UINT64(output, svfst.f_bavail); /* CallerAvailableAllocationUnits */
|
||||
Stream_Write_UINT64(output, svfst.f_bfree); /* AvailableAllocationUnits */
|
||||
Stream_Write_UINT32(output, 1); /* SectorsPerAllocationUnit */
|
||||
Stream_Write_UINT32(output, svfst.f_bsize); /* BytesPerSector */
|
||||
break;
|
||||
|
||||
case FileFsDeviceInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232109.aspx */
|
||||
stream_write_UINT32(output, 8); /* Length */
|
||||
Stream_Write_UINT32(output, 8); /* Length */
|
||||
Stream_EnsureRemainingCapacity(output, 8);
|
||||
stream_write_UINT32(output, FILE_DEVICE_DISK); /* DeviceType */
|
||||
stream_write_UINT32(output, 0); /* Characteristics */
|
||||
Stream_Write_UINT32(output, FILE_DEVICE_DISK); /* DeviceType */
|
||||
Stream_Write_UINT32(output, 0); /* Characteristics */
|
||||
break;
|
||||
|
||||
default:
|
||||
irp->IoStatus = STATUS_UNSUCCESSFUL;
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* Length */
|
||||
DEBUG_WARN("invalid FsInformationClass %d", FsInformationClass);
|
||||
break;
|
||||
}
|
||||
@ -484,10 +484,10 @@ static void drive_process_irp_silent_ignore(DRIVE_DEVICE* disk, IRP* irp)
|
||||
UINT32 FsInformationClass;
|
||||
wStream* output = irp->output;
|
||||
|
||||
stream_read_UINT32(irp->input, FsInformationClass);
|
||||
Stream_Read_UINT32(irp->input, FsInformationClass);
|
||||
|
||||
DEBUG_SVC("FsInformationClass %d in drive_process_irp_silent_ignore", FsInformationClass);
|
||||
stream_write_UINT32(output, 0); /* Length */
|
||||
Stream_Write_UINT32(output, 0); /* Length */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -501,9 +501,9 @@ static void drive_process_irp_query_directory(DRIVE_DEVICE* disk, IRP* irp)
|
||||
UINT32 PathLength;
|
||||
UINT32 FsInformationClass;
|
||||
|
||||
stream_read_UINT32(irp->input, FsInformationClass);
|
||||
stream_read_BYTE(irp->input, InitialQuery);
|
||||
stream_read_UINT32(irp->input, PathLength);
|
||||
Stream_Read_UINT32(irp->input, FsInformationClass);
|
||||
Stream_Read_UINT8(irp->input, InitialQuery);
|
||||
Stream_Read_UINT32(irp->input, PathLength);
|
||||
Stream_Seek(irp->input, 23); /* Padding */
|
||||
|
||||
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(irp->input),
|
||||
@ -517,7 +517,7 @@ static void drive_process_irp_query_directory(DRIVE_DEVICE* disk, IRP* irp)
|
||||
if (file == NULL)
|
||||
{
|
||||
irp->IoStatus = STATUS_UNSUCCESSFUL;
|
||||
stream_write_UINT32(irp->output, 0); /* Length */
|
||||
Stream_Write_UINT32(irp->output, 0); /* Length */
|
||||
DEBUG_WARN("FileId %d not valid.", irp->FileId);
|
||||
}
|
||||
else if (!drive_file_query_directory(file, FsInformationClass, InitialQuery, path, irp->output))
|
||||
@ -545,7 +545,7 @@ static void drive_process_irp_directory_control(DRIVE_DEVICE* disk, IRP* irp)
|
||||
default:
|
||||
DEBUG_WARN("MinorFunction 0x%X not supported", irp->MinorFunction);
|
||||
irp->IoStatus = STATUS_NOT_SUPPORTED;
|
||||
stream_write_UINT32(irp->output, 0); /* Length */
|
||||
Stream_Write_UINT32(irp->output, 0); /* Length */
|
||||
irp->Complete(irp);
|
||||
break;
|
||||
}
|
||||
@ -553,7 +553,7 @@ static void drive_process_irp_directory_control(DRIVE_DEVICE* disk, IRP* irp)
|
||||
|
||||
static void drive_process_irp_device_control(DRIVE_DEVICE* disk, IRP* irp)
|
||||
{
|
||||
stream_write_UINT32(irp->output, 0); /* OutputBufferLength */
|
||||
Stream_Write_UINT32(irp->output, 0); /* OutputBufferLength */
|
||||
irp->Complete(irp);
|
||||
}
|
||||
|
||||
@ -713,7 +713,7 @@ void drive_register_drive_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char*
|
||||
disk->device.data = stream_new(length + 1);
|
||||
|
||||
for (i = 0; i <= length; i++)
|
||||
stream_write_BYTE(disk->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
Stream_Write_UINT8(disk->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
|
||||
disk->path = path;
|
||||
disk->files = list_new();
|
||||
|
@ -78,7 +78,7 @@ static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
Stream_Seek(irp->input, 28);
|
||||
/* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */
|
||||
/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */
|
||||
stream_read_UINT32(irp->input, PathLength);
|
||||
Stream_Read_UINT32(irp->input, PathLength);
|
||||
|
||||
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(irp->input),
|
||||
PathLength / 2, &path, 0, NULL, NULL);
|
||||
@ -105,8 +105,8 @@ static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
DEBUG_SVC("%s(%d) created", parallel->path, parallel->file);
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, parallel->id);
|
||||
stream_write_BYTE(irp->output, 0);
|
||||
Stream_Write_UINT32(irp->output, parallel->id);
|
||||
Stream_Write_UINT8(irp->output, 0);
|
||||
|
||||
free(path);
|
||||
|
||||
@ -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_Write_zero(irp->output, 5); /* Padding(5) */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -132,8 +132,8 @@ static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
ssize_t status;
|
||||
BYTE* buffer = NULL;
|
||||
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
Stream_Read_UINT32(irp->input, Length);
|
||||
Stream_Read_UINT64(irp->input, Offset);
|
||||
|
||||
buffer = (BYTE*) malloc(Length);
|
||||
|
||||
@ -153,12 +153,12 @@ static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
DEBUG_SVC("read %llu-%llu from %d", Offset, Offset + Length, parallel->id);
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
Stream_Write_UINT32(irp->output, Length);
|
||||
|
||||
if (Length > 0)
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(irp->output, Length);
|
||||
stream_write(irp->output, buffer, Length);
|
||||
Stream_Write(irp->output, buffer, Length);
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
@ -173,8 +173,8 @@ static void parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
UINT64 Offset;
|
||||
ssize_t status;
|
||||
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
Stream_Read_UINT32(irp->input, Length);
|
||||
Stream_Read_UINT64(irp->input, Offset);
|
||||
Stream_Seek(irp->input, 20); /* Padding */
|
||||
|
||||
DEBUG_SVC("Length %u Offset %llu", Length, Offset);
|
||||
@ -198,8 +198,8 @@ static void parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
len -= status;
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
stream_write_BYTE(irp->output, 0); /* Padding */
|
||||
Stream_Write_UINT32(irp->output, Length);
|
||||
Stream_Write_UINT8(irp->output, 0); /* Padding */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -207,7 +207,7 @@ static void parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
static void parallel_process_irp_device_control(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||
{
|
||||
DEBUG_SVC("in");
|
||||
stream_write_UINT32(irp->output, 0); /* OutputBufferLength */
|
||||
Stream_Write_UINT32(irp->output, 0); /* OutputBufferLength */
|
||||
irp->Complete(irp);
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
parallel->device.data = stream_new(length + 1);
|
||||
|
||||
for (i = 0; i <= length; i++)
|
||||
stream_write_BYTE(parallel->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
Stream_Write_UINT8(parallel->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
|
||||
parallel->path = path;
|
||||
|
||||
|
@ -68,13 +68,13 @@ static void printer_process_irp_create(PRINTER_DEVICE* printer_dev, IRP* irp)
|
||||
|
||||
if (printjob)
|
||||
{
|
||||
stream_write_UINT32(irp->output, printjob->id); /* FileId */
|
||||
Stream_Write_UINT32(irp->output, printjob->id); /* FileId */
|
||||
|
||||
DEBUG_SVC("printjob id: %d", printjob->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_write_UINT32(irp->output, 0); /* FileId */
|
||||
Stream_Write_UINT32(irp->output, 0); /* FileId */
|
||||
irp->IoStatus = STATUS_PRINT_QUEUE_FULL;
|
||||
|
||||
DEBUG_WARN("error creating print job.");
|
||||
@ -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_Write_zero(irp->output, 4); /* Padding(4) */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -114,8 +114,8 @@ static void printer_process_irp_write(PRINTER_DEVICE* printer_dev, IRP* irp)
|
||||
UINT64 Offset;
|
||||
rdpPrintJob* printjob = NULL;
|
||||
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
Stream_Read_UINT32(irp->input, Length);
|
||||
Stream_Read_UINT64(irp->input, Offset);
|
||||
Stream_Seek(irp->input, 20); /* Padding */
|
||||
|
||||
if (printer_dev->printer)
|
||||
@ -135,8 +135,8 @@ static void printer_process_irp_write(PRINTER_DEVICE* printer_dev, IRP* irp)
|
||||
DEBUG_SVC("printjob id %d written %d bytes.", irp->FileId, Length);
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
stream_write_BYTE(irp->output, 0); /* Padding */
|
||||
Stream_Write_UINT32(irp->output, Length);
|
||||
Stream_Write_UINT8(irp->output, 0); /* Padding */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -261,20 +261,20 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri
|
||||
|
||||
printer_dev->device.data = stream_new(28 + DriverNameLen + PrintNameLen + CachedFieldsLen);
|
||||
|
||||
stream_write_UINT32(printer_dev->device.data, Flags);
|
||||
stream_write_UINT32(printer_dev->device.data, 0); /* CodePage, reserved */
|
||||
stream_write_UINT32(printer_dev->device.data, 0); /* PnPNameLen */
|
||||
stream_write_UINT32(printer_dev->device.data, DriverNameLen + 2);
|
||||
stream_write_UINT32(printer_dev->device.data, PrintNameLen + 2);
|
||||
stream_write_UINT32(printer_dev->device.data, CachedFieldsLen);
|
||||
stream_write(printer_dev->device.data, DriverName, DriverNameLen);
|
||||
stream_write_UINT16(printer_dev->device.data, 0);
|
||||
stream_write(printer_dev->device.data, PrintName, PrintNameLen);
|
||||
stream_write_UINT16(printer_dev->device.data, 0);
|
||||
Stream_Write_UINT32(printer_dev->device.data, Flags);
|
||||
Stream_Write_UINT32(printer_dev->device.data, 0); /* CodePage, reserved */
|
||||
Stream_Write_UINT32(printer_dev->device.data, 0); /* PnPNameLen */
|
||||
Stream_Write_UINT32(printer_dev->device.data, DriverNameLen + 2);
|
||||
Stream_Write_UINT32(printer_dev->device.data, PrintNameLen + 2);
|
||||
Stream_Write_UINT32(printer_dev->device.data, CachedFieldsLen);
|
||||
Stream_Write(printer_dev->device.data, DriverName, DriverNameLen);
|
||||
Stream_Write_UINT16(printer_dev->device.data, 0);
|
||||
Stream_Write(printer_dev->device.data, PrintName, PrintNameLen);
|
||||
Stream_Write_UINT16(printer_dev->device.data, 0);
|
||||
|
||||
if (CachedFieldsLen > 0)
|
||||
{
|
||||
stream_write(printer_dev->device.data, CachedPrinterConfigData, CachedFieldsLen);
|
||||
Stream_Write(printer_dev->device.data, CachedPrinterConfigData, CachedFieldsLen);
|
||||
}
|
||||
|
||||
free(DriverName);
|
||||
|
@ -44,7 +44,7 @@ void rail_send_channel_data(void* rail_object, void* data, size_t length)
|
||||
railPlugin* plugin = (railPlugin*) rail_object;
|
||||
|
||||
s = stream_new(length);
|
||||
stream_write(s, data, length);
|
||||
Stream_Write(s, data, length);
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*) plugin, s);
|
||||
}
|
||||
|
@ -92,15 +92,15 @@ BOOL rail_read_pdu_header(wStream* s, UINT16* orderType, UINT16* orderLength)
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, *orderType); /* orderType (2 bytes) */
|
||||
stream_read_UINT16(s, *orderLength); /* orderLength (2 bytes) */
|
||||
Stream_Read_UINT16(s, *orderType); /* orderType (2 bytes) */
|
||||
Stream_Read_UINT16(s, *orderLength); /* orderLength (2 bytes) */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void rail_write_pdu_header(wStream* s, UINT16 orderType, UINT16 orderLength)
|
||||
{
|
||||
stream_write_UINT16(s, orderType); /* orderType (2 bytes) */
|
||||
stream_write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
||||
Stream_Write_UINT16(s, orderType); /* orderType (2 bytes) */
|
||||
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
||||
}
|
||||
|
||||
wStream* rail_pdu_init(int length)
|
||||
@ -131,8 +131,8 @@ void rail_send_pdu(rdpRailOrder* rail_order, wStream* s, UINT16 orderType)
|
||||
void rail_write_high_contrast(wStream* s, HIGH_CONTRAST* high_contrast)
|
||||
{
|
||||
high_contrast->colorSchemeLength = high_contrast->colorScheme.length + 2;
|
||||
stream_write_UINT32(s, high_contrast->flags); /* flags (4 bytes) */
|
||||
stream_write_UINT32(s, high_contrast->colorSchemeLength); /* colorSchemeLength (4 bytes) */
|
||||
Stream_Write_UINT32(s, high_contrast->flags); /* flags (4 bytes) */
|
||||
Stream_Write_UINT32(s, high_contrast->colorSchemeLength); /* colorSchemeLength (4 bytes) */
|
||||
rail_write_unicode_string(s, &high_contrast->colorScheme); /* colorScheme */
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ BOOL rail_read_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake)
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
||||
Stream_Read_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -148,9 +148,9 @@ BOOL rail_read_server_exec_result_order(wStream* s, RAIL_EXEC_RESULT_ORDER* exec
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, exec_result->flags); /* flags (2 bytes) */
|
||||
stream_read_UINT16(s, exec_result->execResult); /* execResult (2 bytes) */
|
||||
stream_read_UINT32(s, exec_result->rawResult); /* rawResult (4 bytes) */
|
||||
Stream_Read_UINT16(s, exec_result->flags); /* flags (2 bytes) */
|
||||
Stream_Read_UINT16(s, exec_result->execResult); /* execResult (2 bytes) */
|
||||
Stream_Read_UINT32(s, exec_result->rawResult); /* rawResult (4 bytes) */
|
||||
Stream_Seek_UINT16(s); /* padding (2 bytes) */
|
||||
return rail_read_unicode_string(s, &exec_result->exeOrFile); /* exeOrFile */
|
||||
}
|
||||
@ -161,8 +161,8 @@ BOOL rail_read_server_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam)
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 5)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, sysparam->param); /* systemParam (4 bytes) */
|
||||
stream_read_BYTE(s, body); /* body (1 byte) */
|
||||
Stream_Read_UINT32(s, sysparam->param); /* systemParam (4 bytes) */
|
||||
Stream_Read_UINT8(s, body); /* body (1 byte) */
|
||||
|
||||
switch (sysparam->param)
|
||||
{
|
||||
@ -184,15 +184,15 @@ BOOL rail_read_server_minmaxinfo_order(wStream* s, RAIL_MINMAXINFO_ORDER* minmax
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 20)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, minmaxinfo->windowId); /* windowId (4 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxWidth); /* maxWidth (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxHeight); /* maxHeight (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxPosX); /* maxPosX (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxPosY); /* maxPosY (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->minTrackWidth); /* minTrackWidth (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->minTrackHeight); /* minTrackHeight (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxTrackWidth); /* maxTrackWidth (2 bytes) */
|
||||
stream_read_UINT16(s, minmaxinfo->maxTrackHeight); /* maxTrackHeight (2 bytes) */
|
||||
Stream_Read_UINT32(s, minmaxinfo->windowId); /* windowId (4 bytes) */
|
||||
Stream_Read_UINT16(s, minmaxinfo->maxWidth); /* maxWidth (2 bytes) */
|
||||
Stream_Read_UINT16(s, minmaxinfo->maxHeight); /* maxHeight (2 bytes) */
|
||||
Stream_Read_UINT16(s, minmaxinfo->maxPosX); /* maxPosX (2 bytes) */
|
||||
Stream_Read_UINT16(s, minmaxinfo->maxPosY); /* maxPosY (2 bytes) */
|
||||
Stream_Read_UINT16(s, minmaxinfo->minTrackWidth); /* minTrackWidth (2 bytes) */
|
||||
Stream_Read_UINT16(s, minmaxinfo->minTrackHeight); /* minTrackHeight (2 bytes) */
|
||||
Stream_Read_UINT16(s, minmaxinfo->maxTrackWidth); /* maxTrackWidth (2 bytes) */
|
||||
Stream_Read_UINT16(s, minmaxinfo->maxTrackHeight); /* maxTrackHeight (2 bytes) */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -201,14 +201,14 @@ BOOL rail_read_server_localmovesize_order(wStream* s, RAIL_LOCALMOVESIZE_ORDER*
|
||||
UINT16 isMoveSizeStart;
|
||||
if (Stream_GetRemainingLength(s) < 12)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, localmovesize->windowId); /* windowId (4 bytes) */
|
||||
Stream_Read_UINT32(s, localmovesize->windowId); /* windowId (4 bytes) */
|
||||
|
||||
stream_read_UINT16(s, isMoveSizeStart); /* isMoveSizeStart (2 bytes) */
|
||||
Stream_Read_UINT16(s, isMoveSizeStart); /* isMoveSizeStart (2 bytes) */
|
||||
localmovesize->isMoveSizeStart = (isMoveSizeStart != 0) ? TRUE : FALSE;
|
||||
|
||||
stream_read_UINT16(s, localmovesize->moveSizeType); /* moveSizeType (2 bytes) */
|
||||
stream_read_UINT16(s, localmovesize->posX); /* posX (2 bytes) */
|
||||
stream_read_UINT16(s, localmovesize->posY); /* posY (2 bytes) */
|
||||
Stream_Read_UINT16(s, localmovesize->moveSizeType); /* moveSizeType (2 bytes) */
|
||||
Stream_Read_UINT16(s, localmovesize->posX); /* posX (2 bytes) */
|
||||
Stream_Read_UINT16(s, localmovesize->posY); /* posY (2 bytes) */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -216,8 +216,8 @@ BOOL rail_read_server_get_appid_resp_order(wStream* s, RAIL_GET_APPID_RESP_ORDER
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 516)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, get_appid_resp->windowId); /* windowId (4 bytes) */
|
||||
stream_read(s, &get_appid_resp->applicationIdBuffer[0], 512); /* applicationId (256 UNICODE chars) */
|
||||
Stream_Read_UINT32(s, get_appid_resp->windowId); /* windowId (4 bytes) */
|
||||
Stream_Read(s, &get_appid_resp->applicationIdBuffer[0], 512); /* applicationId (256 UNICODE chars) */
|
||||
|
||||
get_appid_resp->applicationId.length = 512;
|
||||
get_appid_resp->applicationId.string = &get_appid_resp->applicationIdBuffer[0];
|
||||
@ -228,26 +228,26 @@ BOOL rail_read_langbar_info_order(wStream* s, RAIL_LANGBAR_INFO_ORDER* langbar_i
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
|
||||
Stream_Read_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void rail_write_handshake_order(wStream* s, RAIL_HANDSHAKE_ORDER* handshake)
|
||||
{
|
||||
stream_write_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
||||
Stream_Write_UINT32(s, handshake->buildNumber); /* buildNumber (4 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_status_order(wStream* s, RAIL_CLIENT_STATUS_ORDER* client_status)
|
||||
{
|
||||
stream_write_UINT32(s, client_status->flags); /* flags (4 bytes) */
|
||||
Stream_Write_UINT32(s, client_status->flags); /* flags (4 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_exec_order(wStream* s, RAIL_EXEC_ORDER* exec)
|
||||
{
|
||||
stream_write_UINT16(s, exec->flags); /* flags (2 bytes) */
|
||||
stream_write_UINT16(s, exec->exeOrFile.length); /* exeOrFileLength (2 bytes) */
|
||||
stream_write_UINT16(s, exec->workingDir.length); /* workingDirLength (2 bytes) */
|
||||
stream_write_UINT16(s, exec->arguments.length); /* argumentsLength (2 bytes) */
|
||||
Stream_Write_UINT16(s, exec->flags); /* flags (2 bytes) */
|
||||
Stream_Write_UINT16(s, exec->exeOrFile.length); /* exeOrFileLength (2 bytes) */
|
||||
Stream_Write_UINT16(s, exec->workingDir.length); /* workingDirLength (2 bytes) */
|
||||
Stream_Write_UINT16(s, exec->arguments.length); /* argumentsLength (2 bytes) */
|
||||
rail_write_unicode_string_value(s, &exec->exeOrFile); /* exeOrFile */
|
||||
rail_write_unicode_string_value(s, &exec->workingDir); /* workingDir */
|
||||
rail_write_unicode_string_value(s, &exec->arguments); /* arguments */
|
||||
@ -256,49 +256,49 @@ void rail_write_client_exec_order(wStream* s, RAIL_EXEC_ORDER* exec)
|
||||
void rail_write_client_sysparam_order(wStream* s, RAIL_SYSPARAM_ORDER* sysparam)
|
||||
{
|
||||
BYTE body;
|
||||
stream_write_UINT32(s, sysparam->param); /* systemParam (4 bytes) */
|
||||
Stream_Write_UINT32(s, sysparam->param); /* systemParam (4 bytes) */
|
||||
|
||||
switch (sysparam->param)
|
||||
{
|
||||
case SPI_SET_DRAG_FULL_WINDOWS:
|
||||
body = sysparam->dragFullWindows;
|
||||
stream_write_BYTE(s, body);
|
||||
Stream_Write_UINT8(s, body);
|
||||
break;
|
||||
|
||||
case SPI_SET_KEYBOARD_CUES:
|
||||
body = sysparam->keyboardCues;
|
||||
stream_write_BYTE(s, body);
|
||||
Stream_Write_UINT8(s, body);
|
||||
break;
|
||||
|
||||
case SPI_SET_KEYBOARD_PREF:
|
||||
body = sysparam->keyboardPref;
|
||||
stream_write_BYTE(s, body);
|
||||
Stream_Write_UINT8(s, body);
|
||||
break;
|
||||
|
||||
case SPI_SET_MOUSE_BUTTON_SWAP:
|
||||
body = sysparam->mouseButtonSwap;
|
||||
stream_write_BYTE(s, body);
|
||||
Stream_Write_UINT8(s, body);
|
||||
break;
|
||||
|
||||
case SPI_SET_WORK_AREA:
|
||||
stream_write_UINT16(s, sysparam->workArea.left); /* left (2 bytes) */
|
||||
stream_write_UINT16(s, sysparam->workArea.top); /* top (2 bytes) */
|
||||
stream_write_UINT16(s, sysparam->workArea.right); /* right (2 bytes) */
|
||||
stream_write_UINT16(s, sysparam->workArea.bottom); /* bottom (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->workArea.left); /* left (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->workArea.top); /* top (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->workArea.right); /* right (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->workArea.bottom); /* bottom (2 bytes) */
|
||||
break;
|
||||
|
||||
case SPI_DISPLAY_CHANGE:
|
||||
stream_write_UINT16(s, sysparam->displayChange.left); /* left (2 bytes) */
|
||||
stream_write_UINT16(s, sysparam->displayChange.top); /* top (2 bytes) */
|
||||
stream_write_UINT16(s, sysparam->displayChange.right); /* right (2 bytes) */
|
||||
stream_write_UINT16(s, sysparam->displayChange.bottom); /* bottom (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->displayChange.left); /* left (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->displayChange.top); /* top (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->displayChange.right); /* right (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->displayChange.bottom); /* bottom (2 bytes) */
|
||||
break;
|
||||
|
||||
case SPI_TASKBAR_POS:
|
||||
stream_write_UINT16(s, sysparam->taskbarPos.left); /* left (2 bytes) */
|
||||
stream_write_UINT16(s, sysparam->taskbarPos.top); /* top (2 bytes) */
|
||||
stream_write_UINT16(s, sysparam->taskbarPos.right); /* right (2 bytes) */
|
||||
stream_write_UINT16(s, sysparam->taskbarPos.bottom); /* bottom (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->taskbarPos.left); /* left (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->taskbarPos.top); /* top (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->taskbarPos.right); /* right (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysparam->taskbarPos.bottom); /* bottom (2 bytes) */
|
||||
break;
|
||||
|
||||
case SPI_SET_HIGH_CONTRAST:
|
||||
@ -311,49 +311,49 @@ void rail_write_client_activate_order(wStream* s, RAIL_ACTIVATE_ORDER* activate)
|
||||
{
|
||||
BYTE enabled;
|
||||
|
||||
stream_write_UINT32(s, activate->windowId); /* windowId (4 bytes) */
|
||||
Stream_Write_UINT32(s, activate->windowId); /* windowId (4 bytes) */
|
||||
|
||||
enabled = activate->enabled;
|
||||
stream_write_BYTE(s, enabled); /* enabled (1 byte) */
|
||||
Stream_Write_UINT8(s, enabled); /* enabled (1 byte) */
|
||||
}
|
||||
|
||||
void rail_write_client_sysmenu_order(wStream* s, RAIL_SYSMENU_ORDER* sysmenu)
|
||||
{
|
||||
stream_write_UINT32(s, sysmenu->windowId); /* windowId (4 bytes) */
|
||||
stream_write_UINT16(s, sysmenu->left); /* left (2 bytes) */
|
||||
stream_write_UINT16(s, sysmenu->top); /* top (2 bytes) */
|
||||
Stream_Write_UINT32(s, sysmenu->windowId); /* windowId (4 bytes) */
|
||||
Stream_Write_UINT16(s, sysmenu->left); /* left (2 bytes) */
|
||||
Stream_Write_UINT16(s, sysmenu->top); /* top (2 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_syscommand_order(wStream* s, RAIL_SYSCOMMAND_ORDER* syscommand)
|
||||
{
|
||||
stream_write_UINT32(s, syscommand->windowId); /* windowId (4 bytes) */
|
||||
stream_write_UINT16(s, syscommand->command); /* command (2 bytes) */
|
||||
Stream_Write_UINT32(s, syscommand->windowId); /* windowId (4 bytes) */
|
||||
Stream_Write_UINT16(s, syscommand->command); /* command (2 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_notify_event_order(wStream* s, RAIL_NOTIFY_EVENT_ORDER* notify_event)
|
||||
{
|
||||
stream_write_UINT32(s, notify_event->windowId); /* windowId (4 bytes) */
|
||||
stream_write_UINT32(s, notify_event->notifyIconId); /* notifyIconId (4 bytes) */
|
||||
stream_write_UINT32(s, notify_event->message); /* notifyIconId (4 bytes) */
|
||||
Stream_Write_UINT32(s, notify_event->windowId); /* windowId (4 bytes) */
|
||||
Stream_Write_UINT32(s, notify_event->notifyIconId); /* notifyIconId (4 bytes) */
|
||||
Stream_Write_UINT32(s, notify_event->message); /* notifyIconId (4 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_window_move_order(wStream* s, RAIL_WINDOW_MOVE_ORDER* window_move)
|
||||
{
|
||||
stream_write_UINT32(s, window_move->windowId); /* windowId (4 bytes) */
|
||||
stream_write_UINT16(s, window_move->left); /* left (2 bytes) */
|
||||
stream_write_UINT16(s, window_move->top); /* top (2 bytes) */
|
||||
stream_write_UINT16(s, window_move->right); /* right (2 bytes) */
|
||||
stream_write_UINT16(s, window_move->bottom); /* bottom (2 bytes) */
|
||||
Stream_Write_UINT32(s, window_move->windowId); /* windowId (4 bytes) */
|
||||
Stream_Write_UINT16(s, window_move->left); /* left (2 bytes) */
|
||||
Stream_Write_UINT16(s, window_move->top); /* top (2 bytes) */
|
||||
Stream_Write_UINT16(s, window_move->right); /* right (2 bytes) */
|
||||
Stream_Write_UINT16(s, window_move->bottom); /* bottom (2 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_client_get_appid_req_order(wStream* s, RAIL_GET_APPID_REQ_ORDER* get_appid_req)
|
||||
{
|
||||
stream_write_UINT32(s, get_appid_req->windowId); /* windowId (4 bytes) */
|
||||
Stream_Write_UINT32(s, get_appid_req->windowId); /* windowId (4 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_langbar_info_order(wStream* s, RAIL_LANGBAR_INFO_ORDER* langbar_info)
|
||||
{
|
||||
stream_write_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
|
||||
Stream_Write_UINT32(s, langbar_info->languageBarStatus); /* languageBarStatus (4 bytes) */
|
||||
}
|
||||
|
||||
BOOL rail_recv_handshake_order(rdpRailOrder* rail_order, wStream* s)
|
||||
|
@ -53,7 +53,7 @@ static void irp_complete(IRP* irp)
|
||||
|
||||
pos = Stream_GetPosition(irp->output);
|
||||
Stream_SetPosition(irp->output, 12);
|
||||
stream_write_UINT32(irp->output, irp->IoStatus);
|
||||
Stream_Write_UINT32(irp->output, irp->IoStatus);
|
||||
Stream_SetPosition(irp->output, pos);
|
||||
|
||||
svc_plugin_send(irp->devman->plugin, irp->output);
|
||||
@ -68,7 +68,7 @@ IRP* irp_new(DEVMAN* devman, wStream* data_in)
|
||||
UINT32 DeviceId;
|
||||
DEVICE* device;
|
||||
|
||||
stream_read_UINT32(data_in, DeviceId);
|
||||
Stream_Read_UINT32(data_in, DeviceId);
|
||||
device = devman_get_device_by_id(devman, DeviceId);
|
||||
|
||||
if (device == NULL)
|
||||
@ -82,17 +82,17 @@ IRP* irp_new(DEVMAN* devman, wStream* data_in)
|
||||
|
||||
irp->device = device;
|
||||
irp->devman = devman;
|
||||
stream_read_UINT32(data_in, irp->FileId);
|
||||
stream_read_UINT32(data_in, irp->CompletionId);
|
||||
stream_read_UINT32(data_in, irp->MajorFunction);
|
||||
stream_read_UINT32(data_in, irp->MinorFunction);
|
||||
Stream_Read_UINT32(data_in, irp->FileId);
|
||||
Stream_Read_UINT32(data_in, irp->CompletionId);
|
||||
Stream_Read_UINT32(data_in, irp->MajorFunction);
|
||||
Stream_Read_UINT32(data_in, irp->MinorFunction);
|
||||
irp->input = data_in;
|
||||
|
||||
irp->output = stream_new(256);
|
||||
stream_write_UINT16(irp->output, RDPDR_CTYP_CORE);
|
||||
stream_write_UINT16(irp->output, PAKID_CORE_DEVICE_IOCOMPLETION);
|
||||
stream_write_UINT32(irp->output, DeviceId);
|
||||
stream_write_UINT32(irp->output, irp->CompletionId);
|
||||
Stream_Write_UINT16(irp->output, RDPDR_CTYP_CORE);
|
||||
Stream_Write_UINT16(irp->output, PAKID_CORE_DEVICE_IOCOMPLETION);
|
||||
Stream_Write_UINT32(irp->output, DeviceId);
|
||||
Stream_Write_UINT32(irp->output, irp->CompletionId);
|
||||
Stream_Seek_UINT32(irp->output); /* IoStatus */
|
||||
|
||||
irp->Complete = irp_complete;
|
||||
|
@ -35,9 +35,9 @@
|
||||
/* Output device redirection capability set header */
|
||||
static void rdpdr_write_capset_header(wStream* data_out, UINT16 capabilityType, UINT16 capabilityLength, UINT32 version)
|
||||
{
|
||||
stream_write_UINT16(data_out, capabilityType);
|
||||
stream_write_UINT16(data_out, capabilityLength);
|
||||
stream_write_UINT32(data_out, version);
|
||||
Stream_Write_UINT16(data_out, capabilityType);
|
||||
Stream_Write_UINT16(data_out, capabilityLength);
|
||||
Stream_Write_UINT32(data_out, version);
|
||||
}
|
||||
|
||||
/* Output device direction general capability set */
|
||||
@ -45,16 +45,16 @@ static void rdpdr_write_general_capset(rdpdrPlugin* rdpdr, wStream* data_out)
|
||||
{
|
||||
rdpdr_write_capset_header(data_out, CAP_GENERAL_TYPE, 44, GENERAL_CAPABILITY_VERSION_02);
|
||||
|
||||
stream_write_UINT32(data_out, 0); /* osType, ignored on receipt */
|
||||
stream_write_UINT32(data_out, 0); /* osVersion, unused and must be set to zero */
|
||||
stream_write_UINT16(data_out, 1); /* protocolMajorVersion, must be set to 1 */
|
||||
stream_write_UINT16(data_out, RDPDR_MINOR_RDP_VERSION_5_2); /* protocolMinorVersion */
|
||||
stream_write_UINT32(data_out, 0x0000FFFF); /* ioCode1 */
|
||||
stream_write_UINT32(data_out, 0); /* ioCode2, must be set to zero, reserved for future use */
|
||||
stream_write_UINT32(data_out, RDPDR_DEVICE_REMOVE_PDUS | RDPDR_CLIENT_DISPLAY_NAME_PDU | RDPDR_USER_LOGGEDON_PDU); /* extendedPDU */
|
||||
stream_write_UINT32(data_out, ENABLE_ASYNCIO); /* extraFlags1 */
|
||||
stream_write_UINT32(data_out, 0); /* extraFlags2, must be set to zero, reserved for future use */
|
||||
stream_write_UINT32(data_out, 0); /* SpecialTypeDeviceCap, number of special devices to be redirected before logon */
|
||||
Stream_Write_UINT32(data_out, 0); /* osType, ignored on receipt */
|
||||
Stream_Write_UINT32(data_out, 0); /* osVersion, unused and must be set to zero */
|
||||
Stream_Write_UINT16(data_out, 1); /* protocolMajorVersion, must be set to 1 */
|
||||
Stream_Write_UINT16(data_out, RDPDR_MINOR_RDP_VERSION_5_2); /* protocolMinorVersion */
|
||||
Stream_Write_UINT32(data_out, 0x0000FFFF); /* ioCode1 */
|
||||
Stream_Write_UINT32(data_out, 0); /* ioCode2, must be set to zero, reserved for future use */
|
||||
Stream_Write_UINT32(data_out, RDPDR_DEVICE_REMOVE_PDUS | RDPDR_CLIENT_DISPLAY_NAME_PDU | RDPDR_USER_LOGGEDON_PDU); /* extendedPDU */
|
||||
Stream_Write_UINT32(data_out, ENABLE_ASYNCIO); /* extraFlags1 */
|
||||
Stream_Write_UINT32(data_out, 0); /* extraFlags2, must be set to zero, reserved for future use */
|
||||
Stream_Write_UINT32(data_out, 0); /* SpecialTypeDeviceCap, number of special devices to be redirected before logon */
|
||||
}
|
||||
|
||||
/* Process device direction general capability set */
|
||||
@ -62,7 +62,7 @@ static void rdpdr_process_general_capset(rdpdrPlugin* rdpdr, wStream* data_in)
|
||||
{
|
||||
UINT16 capabilityLength;
|
||||
|
||||
stream_read_UINT16(data_in, capabilityLength);
|
||||
Stream_Read_UINT16(data_in, capabilityLength);
|
||||
Stream_Seek(data_in, capabilityLength - 4);
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ static void rdpdr_process_printer_capset(rdpdrPlugin* rdpdr, wStream* data_in)
|
||||
{
|
||||
UINT16 capabilityLength;
|
||||
|
||||
stream_read_UINT16(data_in, capabilityLength);
|
||||
Stream_Read_UINT16(data_in, capabilityLength);
|
||||
Stream_Seek(data_in, capabilityLength - 4);
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ static void rdpdr_process_port_capset(rdpdrPlugin* rdpdr, wStream* data_in)
|
||||
{
|
||||
UINT16 capabilityLength;
|
||||
|
||||
stream_read_UINT16(data_in, capabilityLength);
|
||||
Stream_Read_UINT16(data_in, capabilityLength);
|
||||
Stream_Seek(data_in, capabilityLength - 4);
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ static void rdpdr_process_drive_capset(rdpdrPlugin* rdpdr, wStream* data_in)
|
||||
{
|
||||
UINT16 capabilityLength;
|
||||
|
||||
stream_read_UINT16(data_in, capabilityLength);
|
||||
Stream_Read_UINT16(data_in, capabilityLength);
|
||||
Stream_Seek(data_in, capabilityLength - 4);
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ static void rdpdr_process_smartcard_capset(rdpdrPlugin* rdpdr, wStream* data_in)
|
||||
{
|
||||
UINT16 capabilityLength;
|
||||
|
||||
stream_read_UINT16(data_in, capabilityLength);
|
||||
Stream_Read_UINT16(data_in, capabilityLength);
|
||||
Stream_Seek(data_in, capabilityLength - 4);
|
||||
}
|
||||
|
||||
@ -132,12 +132,12 @@ void rdpdr_process_capability_request(rdpdrPlugin* rdpdr, wStream* data_in)
|
||||
UINT16 numCapabilities;
|
||||
UINT16 capabilityType;
|
||||
|
||||
stream_read_UINT16(data_in, numCapabilities);
|
||||
Stream_Read_UINT16(data_in, numCapabilities);
|
||||
Stream_Seek(data_in, 2); /* pad (2 bytes) */
|
||||
|
||||
for(i = 0; i < numCapabilities; i++)
|
||||
{
|
||||
stream_read_UINT16(data_in, capabilityType);
|
||||
Stream_Read_UINT16(data_in, capabilityType);
|
||||
|
||||
switch (capabilityType)
|
||||
{
|
||||
@ -174,11 +174,11 @@ void rdpdr_send_capability_response(rdpdrPlugin* rdpdr)
|
||||
|
||||
data_out = stream_new(256);
|
||||
|
||||
stream_write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_UINT16(data_out, PAKID_CORE_CLIENT_CAPABILITY);
|
||||
Stream_Write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
Stream_Write_UINT16(data_out, PAKID_CORE_CLIENT_CAPABILITY);
|
||||
|
||||
stream_write_UINT16(data_out, 5); /* numCapabilities */
|
||||
stream_write_UINT16(data_out, 0); /* pad */
|
||||
Stream_Write_UINT16(data_out, 5); /* numCapabilities */
|
||||
Stream_Write_UINT16(data_out, 0); /* pad */
|
||||
|
||||
rdpdr_write_general_capset(rdpdr, data_out);
|
||||
rdpdr_write_printer_capset(rdpdr, data_out);
|
||||
|
@ -66,9 +66,9 @@ static void rdpdr_process_connect(rdpSvcPlugin* plugin)
|
||||
|
||||
static void rdpdr_process_server_announce_request(rdpdrPlugin* rdpdr, wStream* data_in)
|
||||
{
|
||||
stream_read_UINT16(data_in, rdpdr->versionMajor);
|
||||
stream_read_UINT16(data_in, rdpdr->versionMinor);
|
||||
stream_read_UINT32(data_in, rdpdr->clientID);
|
||||
Stream_Read_UINT16(data_in, rdpdr->versionMajor);
|
||||
Stream_Read_UINT16(data_in, rdpdr->versionMinor);
|
||||
Stream_Read_UINT32(data_in, rdpdr->clientID);
|
||||
|
||||
DEBUG_SVC("version %d.%d clientID %d", rdpdr->versionMajor, rdpdr->versionMinor, rdpdr->clientID);
|
||||
}
|
||||
@ -79,12 +79,12 @@ static void rdpdr_send_client_announce_reply(rdpdrPlugin* rdpdr)
|
||||
|
||||
data_out = stream_new(12);
|
||||
|
||||
stream_write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_UINT16(data_out, PAKID_CORE_CLIENTID_CONFIRM);
|
||||
Stream_Write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
Stream_Write_UINT16(data_out, PAKID_CORE_CLIENTID_CONFIRM);
|
||||
|
||||
stream_write_UINT16(data_out, rdpdr->versionMajor);
|
||||
stream_write_UINT16(data_out, rdpdr->versionMinor);
|
||||
stream_write_UINT32(data_out, (UINT32) rdpdr->clientID);
|
||||
Stream_Write_UINT16(data_out, rdpdr->versionMajor);
|
||||
Stream_Write_UINT16(data_out, rdpdr->versionMinor);
|
||||
Stream_Write_UINT32(data_out, (UINT32) rdpdr->clientID);
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out);
|
||||
}
|
||||
@ -102,14 +102,14 @@ static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr)
|
||||
|
||||
data_out = stream_new(16 + computerNameLenW + 2);
|
||||
|
||||
stream_write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_UINT16(data_out, PAKID_CORE_CLIENT_NAME);
|
||||
Stream_Write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
Stream_Write_UINT16(data_out, PAKID_CORE_CLIENT_NAME);
|
||||
|
||||
stream_write_UINT32(data_out, 1); /* unicodeFlag, 0 for ASCII and 1 for Unicode */
|
||||
stream_write_UINT32(data_out, 0); /* codePage, must be set to zero */
|
||||
stream_write_UINT32(data_out, computerNameLenW + 2); /* computerNameLen, including null terminator */
|
||||
stream_write(data_out, computerNameW, computerNameLenW);
|
||||
stream_write_UINT16(data_out, 0); /* null terminator */
|
||||
Stream_Write_UINT32(data_out, 1); /* unicodeFlag, 0 for ASCII and 1 for Unicode */
|
||||
Stream_Write_UINT32(data_out, 0); /* codePage, must be set to zero */
|
||||
Stream_Write_UINT32(data_out, computerNameLenW + 2); /* computerNameLen, including null terminator */
|
||||
Stream_Write(data_out, computerNameW, computerNameLenW);
|
||||
Stream_Write_UINT16(data_out, 0); /* null terminator */
|
||||
|
||||
free(computerNameW);
|
||||
|
||||
@ -122,9 +122,9 @@ static void rdpdr_process_server_clientid_confirm(rdpdrPlugin* rdpdr, wStream* d
|
||||
UINT16 versionMinor;
|
||||
UINT32 clientID;
|
||||
|
||||
stream_read_UINT16(data_in, versionMajor);
|
||||
stream_read_UINT16(data_in, versionMinor);
|
||||
stream_read_UINT32(data_in, clientID);
|
||||
Stream_Read_UINT16(data_in, versionMajor);
|
||||
Stream_Read_UINT16(data_in, versionMinor);
|
||||
Stream_Read_UINT32(data_in, clientID);
|
||||
|
||||
if (versionMajor != rdpdr->versionMajor || versionMinor != rdpdr->versionMinor)
|
||||
{
|
||||
@ -154,8 +154,8 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
|
||||
|
||||
data_out = stream_new(256);
|
||||
|
||||
stream_write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
stream_write_UINT16(data_out, PAKID_CORE_DEVICELIST_ANNOUNCE);
|
||||
Stream_Write_UINT16(data_out, RDPDR_CTYP_CORE);
|
||||
Stream_Write_UINT16(data_out, PAKID_CORE_DEVICELIST_ANNOUNCE);
|
||||
|
||||
count_pos = Stream_GetPosition(data_out);
|
||||
count = 0;
|
||||
@ -178,8 +178,8 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
|
||||
data_len = (device->data == NULL ? 0 : Stream_GetPosition(device->data));
|
||||
Stream_EnsureRemainingCapacity(data_out, 20 + data_len);
|
||||
|
||||
stream_write_UINT32(data_out, device->type); /* deviceType */
|
||||
stream_write_UINT32(data_out, device->id); /* deviceID */
|
||||
Stream_Write_UINT32(data_out, device->type); /* deviceType */
|
||||
Stream_Write_UINT32(data_out, device->id); /* deviceID */
|
||||
strncpy((char*) Stream_Pointer(data_out), device->name, 8);
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
@ -187,15 +187,15 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
|
||||
stream_peek_BYTE(data_out, c);
|
||||
|
||||
if (c > 0x7F)
|
||||
stream_write_BYTE(data_out, '_');
|
||||
Stream_Write_UINT8(data_out, '_');
|
||||
else
|
||||
Stream_Seek_BYTE(data_out);
|
||||
}
|
||||
|
||||
stream_write_UINT32(data_out, data_len);
|
||||
Stream_Write_UINT32(data_out, data_len);
|
||||
|
||||
if (data_len > 0)
|
||||
stream_write(data_out, Stream_Buffer(device->data), data_len);
|
||||
Stream_Write(data_out, Stream_Buffer(device->data), data_len);
|
||||
|
||||
count++;
|
||||
|
||||
@ -206,7 +206,7 @@ static void rdpdr_send_device_list_announce_request(rdpdrPlugin* rdpdr, BOOL use
|
||||
|
||||
pos = Stream_GetPosition(data_out);
|
||||
Stream_SetPosition(data_out, count_pos);
|
||||
stream_write_UINT32(data_out, count);
|
||||
Stream_Write_UINT32(data_out, count);
|
||||
Stream_SetPosition(data_out, pos);
|
||||
Stream_SealLength(data_out);
|
||||
|
||||
@ -235,8 +235,8 @@ static void rdpdr_process_receive(rdpSvcPlugin* plugin, wStream* data_in)
|
||||
UINT32 status;
|
||||
rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin;
|
||||
|
||||
stream_read_UINT16(data_in, component);
|
||||
stream_read_UINT16(data_in, packetID);
|
||||
Stream_Read_UINT16(data_in, component);
|
||||
Stream_Read_UINT16(data_in, packetID);
|
||||
|
||||
if (component == RDPDR_CTYP_CORE)
|
||||
{
|
||||
@ -268,8 +268,8 @@ static void rdpdr_process_receive(rdpSvcPlugin* plugin, wStream* data_in)
|
||||
|
||||
case PAKID_CORE_DEVICE_REPLY:
|
||||
/* connect to a specific resource */
|
||||
stream_read_UINT32(data_in, deviceID);
|
||||
stream_read_UINT32(data_in, status);
|
||||
Stream_Read_UINT32(data_in, deviceID);
|
||||
Stream_Read_UINT32(data_in, status);
|
||||
DEBUG_SVC("RDPDR_CTYP_CORE / PAKID_CORE_DEVICE_REPLY (deviceID=%d status=0x%08X)", deviceID, status);
|
||||
break;
|
||||
|
||||
|
@ -127,11 +127,11 @@ void rdpsnd_send_quality_mode_pdu(rdpsndPlugin* rdpsnd)
|
||||
wStream* pdu;
|
||||
|
||||
pdu = stream_new(8);
|
||||
stream_write_BYTE(pdu, SNDC_QUALITYMODE); /* msgType */
|
||||
stream_write_BYTE(pdu, 0); /* bPad */
|
||||
stream_write_UINT16(pdu, 4); /* BodySize */
|
||||
stream_write_UINT16(pdu, HIGH_QUALITY); /* wQualityMode */
|
||||
stream_write_UINT16(pdu, 0); /* Reserved */
|
||||
Stream_Write_UINT8(pdu, SNDC_QUALITYMODE); /* msgType */
|
||||
Stream_Write_UINT8(pdu, 0); /* bPad */
|
||||
Stream_Write_UINT16(pdu, 4); /* BodySize */
|
||||
Stream_Write_UINT16(pdu, HIGH_QUALITY); /* wQualityMode */
|
||||
Stream_Write_UINT16(pdu, 0); /* Reserved */
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
|
||||
}
|
||||
@ -219,33 +219,33 @@ void rdpsnd_send_client_audio_formats(rdpsndPlugin* rdpsnd)
|
||||
|
||||
pdu = stream_new(length);
|
||||
|
||||
stream_write_BYTE(pdu, SNDC_FORMATS); /* msgType */
|
||||
stream_write_BYTE(pdu, 0); /* bPad */
|
||||
stream_write_UINT16(pdu, length - 4); /* BodySize */
|
||||
Stream_Write_UINT8(pdu, SNDC_FORMATS); /* msgType */
|
||||
Stream_Write_UINT8(pdu, 0); /* bPad */
|
||||
Stream_Write_UINT16(pdu, length - 4); /* BodySize */
|
||||
|
||||
stream_write_UINT32(pdu, TSSNDCAPS_ALIVE | TSSNDCAPS_VOLUME); /* dwFlags */
|
||||
stream_write_UINT32(pdu, dwVolume); /* dwVolume */
|
||||
stream_write_UINT32(pdu, 0); /* dwPitch */
|
||||
stream_write_UINT16(pdu, 0); /* wDGramPort */
|
||||
stream_write_UINT16(pdu, wNumberOfFormats); /* wNumberOfFormats */
|
||||
stream_write_BYTE(pdu, 0); /* cLastBlockConfirmed */
|
||||
stream_write_UINT16(pdu, 6); /* wVersion */
|
||||
stream_write_BYTE(pdu, 0); /* bPad */
|
||||
Stream_Write_UINT32(pdu, TSSNDCAPS_ALIVE | TSSNDCAPS_VOLUME); /* dwFlags */
|
||||
Stream_Write_UINT32(pdu, dwVolume); /* dwVolume */
|
||||
Stream_Write_UINT32(pdu, 0); /* dwPitch */
|
||||
Stream_Write_UINT16(pdu, 0); /* wDGramPort */
|
||||
Stream_Write_UINT16(pdu, wNumberOfFormats); /* wNumberOfFormats */
|
||||
Stream_Write_UINT8(pdu, 0); /* cLastBlockConfirmed */
|
||||
Stream_Write_UINT16(pdu, 6); /* wVersion */
|
||||
Stream_Write_UINT8(pdu, 0); /* bPad */
|
||||
|
||||
for (index = 0; index < (int) wNumberOfFormats; index++)
|
||||
{
|
||||
clientFormat = &rdpsnd->ClientFormats[index];
|
||||
|
||||
stream_write_UINT16(pdu, clientFormat->wFormatTag);
|
||||
stream_write_UINT16(pdu, clientFormat->nChannels);
|
||||
stream_write_UINT32(pdu, clientFormat->nSamplesPerSec);
|
||||
stream_write_UINT32(pdu, clientFormat->nAvgBytesPerSec);
|
||||
stream_write_UINT16(pdu, clientFormat->nBlockAlign);
|
||||
stream_write_UINT16(pdu, clientFormat->wBitsPerSample);
|
||||
stream_write_UINT16(pdu, clientFormat->cbSize);
|
||||
Stream_Write_UINT16(pdu, clientFormat->wFormatTag);
|
||||
Stream_Write_UINT16(pdu, clientFormat->nChannels);
|
||||
Stream_Write_UINT32(pdu, clientFormat->nSamplesPerSec);
|
||||
Stream_Write_UINT32(pdu, clientFormat->nAvgBytesPerSec);
|
||||
Stream_Write_UINT16(pdu, clientFormat->nBlockAlign);
|
||||
Stream_Write_UINT16(pdu, clientFormat->wBitsPerSample);
|
||||
Stream_Write_UINT16(pdu, clientFormat->cbSize);
|
||||
|
||||
if (clientFormat->cbSize > 0)
|
||||
stream_write(pdu, clientFormat->data, clientFormat->cbSize);
|
||||
Stream_Write(pdu, clientFormat->data, clientFormat->cbSize);
|
||||
}
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
|
||||
@ -266,9 +266,9 @@ void rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream* s)
|
||||
Stream_Seek_UINT32(s); /* dwVolume */
|
||||
Stream_Seek_UINT32(s); /* dwPitch */
|
||||
Stream_Seek_UINT16(s); /* wDGramPort */
|
||||
stream_read_UINT16(s, wNumberOfFormats);
|
||||
stream_read_BYTE(s, rdpsnd->cBlockNo); /* cLastBlockConfirmed */
|
||||
stream_read_UINT16(s, wVersion); /* wVersion */
|
||||
Stream_Read_UINT16(s, wNumberOfFormats);
|
||||
Stream_Read_UINT8(s, rdpsnd->cBlockNo); /* cLastBlockConfirmed */
|
||||
Stream_Read_UINT16(s, wVersion); /* wVersion */
|
||||
Stream_Seek_BYTE(s); /* bPad */
|
||||
|
||||
rdpsnd->NumberOfServerFormats = wNumberOfFormats;
|
||||
@ -278,16 +278,16 @@ void rdpsnd_recv_server_audio_formats_pdu(rdpsndPlugin* rdpsnd, wStream* s)
|
||||
{
|
||||
format = &rdpsnd->ServerFormats[index];
|
||||
|
||||
stream_read_UINT16(s, format->wFormatTag); /* wFormatTag */
|
||||
stream_read_UINT16(s, format->nChannels); /* nChannels */
|
||||
stream_read_UINT32(s, format->nSamplesPerSec); /* nSamplesPerSec */
|
||||
stream_read_UINT32(s, format->nAvgBytesPerSec); /* nAvgBytesPerSec */
|
||||
stream_read_UINT16(s, format->nBlockAlign); /* nBlockAlign */
|
||||
stream_read_UINT16(s, format->wBitsPerSample); /* wBitsPerSample */
|
||||
stream_read_UINT16(s, format->cbSize); /* cbSize */
|
||||
Stream_Read_UINT16(s, format->wFormatTag); /* wFormatTag */
|
||||
Stream_Read_UINT16(s, format->nChannels); /* nChannels */
|
||||
Stream_Read_UINT32(s, format->nSamplesPerSec); /* nSamplesPerSec */
|
||||
Stream_Read_UINT32(s, format->nAvgBytesPerSec); /* nAvgBytesPerSec */
|
||||
Stream_Read_UINT16(s, format->nBlockAlign); /* nBlockAlign */
|
||||
Stream_Read_UINT16(s, format->wBitsPerSample); /* wBitsPerSample */
|
||||
Stream_Read_UINT16(s, format->cbSize); /* cbSize */
|
||||
|
||||
format->data = (BYTE*) malloc(format->cbSize);
|
||||
stream_read(s, format->data, format->cbSize);
|
||||
Stream_Read(s, format->data, format->cbSize);
|
||||
}
|
||||
|
||||
rdpsnd_select_supported_audio_formats(rdpsnd);
|
||||
@ -303,11 +303,11 @@ void rdpsnd_send_training_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, U
|
||||
wStream* pdu;
|
||||
|
||||
pdu = stream_new(8);
|
||||
stream_write_BYTE(pdu, SNDC_TRAINING); /* msgType */
|
||||
stream_write_BYTE(pdu, 0); /* bPad */
|
||||
stream_write_UINT16(pdu, 4); /* BodySize */
|
||||
stream_write_UINT16(pdu, wTimeStamp);
|
||||
stream_write_UINT16(pdu, wPackSize);
|
||||
Stream_Write_UINT8(pdu, SNDC_TRAINING); /* msgType */
|
||||
Stream_Write_UINT8(pdu, 0); /* bPad */
|
||||
Stream_Write_UINT16(pdu, 4); /* BodySize */
|
||||
Stream_Write_UINT16(pdu, wTimeStamp);
|
||||
Stream_Write_UINT16(pdu, wPackSize);
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
|
||||
}
|
||||
@ -317,8 +317,8 @@ static void rdpsnd_recv_training_pdu(rdpsndPlugin* rdpsnd, wStream* s)
|
||||
UINT16 wTimeStamp;
|
||||
UINT16 wPackSize;
|
||||
|
||||
stream_read_UINT16(s, wTimeStamp);
|
||||
stream_read_UINT16(s, wPackSize);
|
||||
Stream_Read_UINT16(s, wTimeStamp);
|
||||
Stream_Read_UINT16(s, wPackSize);
|
||||
|
||||
rdpsnd_send_training_confirm_pdu(rdpsnd, wTimeStamp, wPackSize);
|
||||
}
|
||||
@ -330,11 +330,11 @@ static void rdpsnd_recv_wave_info_pdu(rdpsndPlugin* rdpsnd, wStream* s, UINT16 B
|
||||
|
||||
rdpsnd->expectingWave = TRUE;
|
||||
|
||||
stream_read_UINT16(s, rdpsnd->wTimeStamp);
|
||||
stream_read_UINT16(s, wFormatNo);
|
||||
stream_read_BYTE(s, rdpsnd->cBlockNo);
|
||||
Stream_Read_UINT16(s, rdpsnd->wTimeStamp);
|
||||
Stream_Read_UINT16(s, wFormatNo);
|
||||
Stream_Read_UINT8(s, rdpsnd->cBlockNo);
|
||||
Stream_Seek(s, 3); /* bPad */
|
||||
stream_read(s, rdpsnd->waveData, 4);
|
||||
Stream_Read(s, rdpsnd->waveData, 4);
|
||||
|
||||
rdpsnd->waveDataSize = BodySize - 8;
|
||||
|
||||
@ -368,12 +368,12 @@ void rdpsnd_send_wave_confirm_pdu(rdpsndPlugin* rdpsnd, UINT16 wTimeStamp, BYTE
|
||||
wStream* pdu;
|
||||
|
||||
pdu = stream_new(8);
|
||||
stream_write_BYTE(pdu, SNDC_WAVECONFIRM);
|
||||
stream_write_BYTE(pdu, 0);
|
||||
stream_write_UINT16(pdu, 4);
|
||||
stream_write_UINT16(pdu, wTimeStamp);
|
||||
stream_write_BYTE(pdu, cConfirmedBlockNo); /* cConfirmedBlockNo */
|
||||
stream_write_BYTE(pdu, 0); /* bPad */
|
||||
Stream_Write_UINT8(pdu, SNDC_WAVECONFIRM);
|
||||
Stream_Write_UINT8(pdu, 0);
|
||||
Stream_Write_UINT16(pdu, 4);
|
||||
Stream_Write_UINT16(pdu, wTimeStamp);
|
||||
Stream_Write_UINT8(pdu, cConfirmedBlockNo); /* cConfirmedBlockNo */
|
||||
Stream_Write_UINT8(pdu, 0); /* bPad */
|
||||
|
||||
svc_plugin_send((rdpSvcPlugin*) rdpsnd, pdu);
|
||||
}
|
||||
@ -458,7 +458,7 @@ static void rdpsnd_recv_volume_pdu(rdpsndPlugin* rdpsnd, wStream* s)
|
||||
{
|
||||
UINT32 dwVolume;
|
||||
|
||||
stream_read_UINT32(s, dwVolume);
|
||||
Stream_Read_UINT32(s, dwVolume);
|
||||
DEBUG_SVC("dwVolume 0x%X", dwVolume);
|
||||
|
||||
if (rdpsnd->device)
|
||||
@ -480,9 +480,9 @@ static void rdpsnd_recv_pdu(rdpSvcPlugin* plugin, wStream* s)
|
||||
return;
|
||||
}
|
||||
|
||||
stream_read_BYTE(s, msgType); /* msgType */
|
||||
Stream_Read_UINT8(s, msgType); /* msgType */
|
||||
Stream_Seek_BYTE(s); /* bPad */
|
||||
stream_read_UINT16(s, BodySize);
|
||||
Stream_Read_UINT16(s, BodySize);
|
||||
|
||||
//fprintf(stderr, "msgType %d BodySize %d\n", msgType, BodySize);
|
||||
|
||||
|
@ -61,42 +61,42 @@ static BOOL rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, wStream* s)
|
||||
UINT16 i;
|
||||
BOOL status;
|
||||
|
||||
stream_write_BYTE(s, SNDC_FORMATS);
|
||||
stream_write_BYTE(s, 0);
|
||||
Stream_Write_UINT8(s, SNDC_FORMATS);
|
||||
Stream_Write_UINT8(s, 0);
|
||||
Stream_Seek_UINT16(s);
|
||||
|
||||
stream_write_UINT32(s, 0); /* dwFlags */
|
||||
stream_write_UINT32(s, 0); /* dwVolume */
|
||||
stream_write_UINT32(s, 0); /* dwPitch */
|
||||
stream_write_UINT16(s, 0); /* wDGramPort */
|
||||
stream_write_UINT16(s, rdpsnd->context.num_server_formats); /* wNumberOfFormats */
|
||||
stream_write_BYTE(s, rdpsnd->context.block_no); /* cLastBlockConfirmed */
|
||||
stream_write_UINT16(s, 0x06); /* wVersion */
|
||||
stream_write_BYTE(s, 0); /* bPad */
|
||||
Stream_Write_UINT32(s, 0); /* dwFlags */
|
||||
Stream_Write_UINT32(s, 0); /* dwVolume */
|
||||
Stream_Write_UINT32(s, 0); /* dwPitch */
|
||||
Stream_Write_UINT16(s, 0); /* wDGramPort */
|
||||
Stream_Write_UINT16(s, rdpsnd->context.num_server_formats); /* wNumberOfFormats */
|
||||
Stream_Write_UINT8(s, rdpsnd->context.block_no); /* cLastBlockConfirmed */
|
||||
Stream_Write_UINT16(s, 0x06); /* wVersion */
|
||||
Stream_Write_UINT8(s, 0); /* bPad */
|
||||
|
||||
for (i = 0; i < rdpsnd->context.num_server_formats; i++)
|
||||
{
|
||||
stream_write_UINT16(s, rdpsnd->context.server_formats[i].wFormatTag); /* wFormatTag (WAVE_FORMAT_PCM) */
|
||||
stream_write_UINT16(s, rdpsnd->context.server_formats[i].nChannels); /* nChannels */
|
||||
stream_write_UINT32(s, rdpsnd->context.server_formats[i].nSamplesPerSec); /* nSamplesPerSec */
|
||||
Stream_Write_UINT16(s, rdpsnd->context.server_formats[i].wFormatTag); /* wFormatTag (WAVE_FORMAT_PCM) */
|
||||
Stream_Write_UINT16(s, rdpsnd->context.server_formats[i].nChannels); /* nChannels */
|
||||
Stream_Write_UINT32(s, rdpsnd->context.server_formats[i].nSamplesPerSec); /* nSamplesPerSec */
|
||||
|
||||
stream_write_UINT32(s, rdpsnd->context.server_formats[i].nSamplesPerSec *
|
||||
Stream_Write_UINT32(s, rdpsnd->context.server_formats[i].nSamplesPerSec *
|
||||
rdpsnd->context.server_formats[i].nChannels *
|
||||
rdpsnd->context.server_formats[i].wBitsPerSample / 8); /* nAvgBytesPerSec */
|
||||
|
||||
stream_write_UINT16(s, rdpsnd->context.server_formats[i].nBlockAlign); /* nBlockAlign */
|
||||
stream_write_UINT16(s, rdpsnd->context.server_formats[i].wBitsPerSample); /* wBitsPerSample */
|
||||
stream_write_UINT16(s, rdpsnd->context.server_formats[i].cbSize); /* cbSize */
|
||||
Stream_Write_UINT16(s, rdpsnd->context.server_formats[i].nBlockAlign); /* nBlockAlign */
|
||||
Stream_Write_UINT16(s, rdpsnd->context.server_formats[i].wBitsPerSample); /* wBitsPerSample */
|
||||
Stream_Write_UINT16(s, rdpsnd->context.server_formats[i].cbSize); /* cbSize */
|
||||
|
||||
if (rdpsnd->context.server_formats[i].cbSize > 0)
|
||||
{
|
||||
stream_write(s, rdpsnd->context.server_formats[i].data, rdpsnd->context.server_formats[i].cbSize);
|
||||
Stream_Write(s, rdpsnd->context.server_formats[i].data, rdpsnd->context.server_formats[i].cbSize);
|
||||
}
|
||||
}
|
||||
|
||||
pos = Stream_GetPosition(s);
|
||||
Stream_SetPosition(s, 2);
|
||||
stream_write_UINT16(s, pos - 4);
|
||||
Stream_Write_UINT16(s, pos - 4);
|
||||
Stream_SetPosition(s, pos);
|
||||
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
|
||||
Stream_SetPosition(s, 0);
|
||||
@ -110,8 +110,8 @@ static void rdpsnd_server_recv_waveconfirm(rdpsnd_server* rdpsnd, wStream* s)
|
||||
|
||||
UINT16 timestamp = 0;
|
||||
BYTE confirmBlockNum = 0;
|
||||
stream_read_UINT16(s, timestamp);
|
||||
stream_read_BYTE(s, confirmBlockNum);
|
||||
Stream_Read_UINT16(s, timestamp);
|
||||
Stream_Read_UINT8(s, confirmBlockNum);
|
||||
Stream_Seek_BYTE(s); // padding
|
||||
}
|
||||
|
||||
@ -120,7 +120,7 @@ static void rdpsnd_server_recv_quality_mode(rdpsnd_server* rdpsnd, wStream* s)
|
||||
//unhandled for now
|
||||
UINT16 quality;
|
||||
|
||||
stream_read_UINT16(s, quality);
|
||||
Stream_Read_UINT16(s, quality);
|
||||
Stream_Seek_UINT16(s); // reserved
|
||||
|
||||
fprintf(stderr, "Client requested sound quality: %#0X\n", quality);
|
||||
@ -134,13 +134,13 @@ static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, wStream* s)
|
||||
BYTE lastblock;
|
||||
|
||||
|
||||
stream_read_UINT32(s, flags); /* dwFlags */
|
||||
stream_read_UINT32(s, vol); /* dwVolume */
|
||||
stream_read_UINT32(s, pitch); /* dwPitch */
|
||||
stream_read_UINT16(s, udpPort); /* wDGramPort */
|
||||
stream_read_UINT16(s, rdpsnd->context.num_client_formats); /* wNumberOfFormats */
|
||||
stream_read_BYTE(s, lastblock); /* cLastBlockConfirmed */
|
||||
stream_read_UINT16(s, version); /* wVersion */
|
||||
Stream_Read_UINT32(s, flags); /* dwFlags */
|
||||
Stream_Read_UINT32(s, vol); /* dwVolume */
|
||||
Stream_Read_UINT32(s, pitch); /* dwPitch */
|
||||
Stream_Read_UINT16(s, udpPort); /* wDGramPort */
|
||||
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 */
|
||||
|
||||
if (rdpsnd->context.num_client_formats > 0)
|
||||
@ -150,13 +150,13 @@ static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, wStream* s)
|
||||
|
||||
for (i = 0; i < rdpsnd->context.num_client_formats; i++)
|
||||
{
|
||||
stream_read_UINT16(s, rdpsnd->context.client_formats[i].wFormatTag);
|
||||
stream_read_UINT16(s, rdpsnd->context.client_formats[i].nChannels);
|
||||
stream_read_UINT32(s, rdpsnd->context.client_formats[i].nSamplesPerSec);
|
||||
stream_read_UINT32(s, rdpsnd->context.client_formats[i].nAvgBytesPerSec);
|
||||
stream_read_UINT16(s, rdpsnd->context.client_formats[i].nBlockAlign);
|
||||
stream_read_UINT16(s, rdpsnd->context.client_formats[i].wBitsPerSample);
|
||||
stream_read_UINT16(s, rdpsnd->context.client_formats[i].cbSize);
|
||||
Stream_Read_UINT16(s, rdpsnd->context.client_formats[i].wFormatTag);
|
||||
Stream_Read_UINT16(s, rdpsnd->context.client_formats[i].nChannels);
|
||||
Stream_Read_UINT32(s, rdpsnd->context.client_formats[i].nSamplesPerSec);
|
||||
Stream_Read_UINT32(s, rdpsnd->context.client_formats[i].nAvgBytesPerSec);
|
||||
Stream_Read_UINT16(s, rdpsnd->context.client_formats[i].nBlockAlign);
|
||||
Stream_Read_UINT16(s, rdpsnd->context.client_formats[i].wBitsPerSample);
|
||||
Stream_Read_UINT16(s, rdpsnd->context.client_formats[i].cbSize);
|
||||
|
||||
if (rdpsnd->context.client_formats[i].cbSize > 0)
|
||||
{
|
||||
@ -231,9 +231,9 @@ static void* rdpsnd_server_thread_func(void* arg)
|
||||
break;
|
||||
}
|
||||
|
||||
stream_read_BYTE(s, msgType);
|
||||
Stream_Read_UINT8(s, msgType);
|
||||
Stream_Seek_BYTE(s); /* bPad */
|
||||
stream_read_UINT16(s, BodySize);
|
||||
Stream_Read_UINT16(s, BodySize);
|
||||
|
||||
switch (msgType)
|
||||
{
|
||||
@ -400,26 +400,26 @@ static BOOL rdpsnd_server_send_audio_pdu(rdpsnd_server* rdpsnd)
|
||||
|
||||
/* WaveInfo PDU */
|
||||
Stream_SetPosition(s, 0);
|
||||
stream_write_BYTE(s, SNDC_WAVE); /* msgType */
|
||||
stream_write_BYTE(s, 0); /* bPad */
|
||||
stream_write_UINT16(s, size + fill_size + 8); /* BodySize */
|
||||
Stream_Write_UINT8(s, SNDC_WAVE); /* msgType */
|
||||
Stream_Write_UINT8(s, 0); /* bPad */
|
||||
Stream_Write_UINT16(s, size + fill_size + 8); /* BodySize */
|
||||
|
||||
stream_write_UINT16(s, 0); /* wTimeStamp */
|
||||
stream_write_UINT16(s, rdpsnd->context.selected_client_format); /* wFormatNo */
|
||||
stream_write_BYTE(s, rdpsnd->context.block_no); /* cBlockNo */
|
||||
Stream_Write_UINT16(s, 0); /* wTimeStamp */
|
||||
Stream_Write_UINT16(s, rdpsnd->context.selected_client_format); /* wFormatNo */
|
||||
Stream_Write_UINT8(s, rdpsnd->context.block_no); /* cBlockNo */
|
||||
Stream_Seek(s, 3); /* bPad */
|
||||
stream_write(s, src, 4);
|
||||
Stream_Write(s, src, 4);
|
||||
|
||||
WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
|
||||
Stream_SetPosition(s, 0);
|
||||
|
||||
/* Wave PDU */
|
||||
Stream_EnsureRemainingCapacity(s, size + fill_size);
|
||||
stream_write_UINT32(s, 0); /* bPad */
|
||||
stream_write(s, src + 4, size - 4);
|
||||
Stream_Write_UINT32(s, 0); /* bPad */
|
||||
Stream_Write(s, src + 4, size - 4);
|
||||
|
||||
if (fill_size > 0)
|
||||
stream_write_zero(s, fill_size);
|
||||
Stream_Write_zero(s, fill_size);
|
||||
|
||||
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
|
||||
Stream_SetPosition(s, 0);
|
||||
@ -465,16 +465,16 @@ static BOOL rdpsnd_server_set_volume(rdpsnd_server_context* context, int left, i
|
||||
rdpsnd_server* rdpsnd = (rdpsnd_server*) context;
|
||||
wStream* s = rdpsnd->rdpsnd_pdu;
|
||||
|
||||
stream_write_BYTE(s, SNDC_SETVOLUME);
|
||||
stream_write_BYTE(s, 0);
|
||||
Stream_Write_UINT8(s, SNDC_SETVOLUME);
|
||||
Stream_Write_UINT8(s, 0);
|
||||
Stream_Seek_UINT16(s);
|
||||
|
||||
stream_write_UINT16(s, left);
|
||||
stream_write_UINT16(s, right);
|
||||
Stream_Write_UINT16(s, left);
|
||||
Stream_Write_UINT16(s, right);
|
||||
|
||||
pos = Stream_GetPosition(s);
|
||||
Stream_SetPosition(s, 2);
|
||||
stream_write_UINT16(s, pos - 4);
|
||||
Stream_Write_UINT16(s, pos - 4);
|
||||
Stream_SetPosition(s, pos);
|
||||
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
|
||||
Stream_SetPosition(s, 0);
|
||||
@ -500,13 +500,13 @@ static BOOL rdpsnd_server_close(rdpsnd_server_context* context)
|
||||
|
||||
rdpsnd->context.selected_client_format = -1;
|
||||
|
||||
stream_write_BYTE(s, SNDC_CLOSE);
|
||||
stream_write_BYTE(s, 0);
|
||||
Stream_Write_UINT8(s, SNDC_CLOSE);
|
||||
Stream_Write_UINT8(s, 0);
|
||||
Stream_Seek_UINT16(s);
|
||||
|
||||
pos = Stream_GetPosition(s);
|
||||
Stream_SetPosition(s, 2);
|
||||
stream_write_UINT16(s, pos - 4);
|
||||
Stream_Write_UINT16(s, pos - 4);
|
||||
Stream_SetPosition(s, pos);
|
||||
status = WTSVirtualChannelWrite(rdpsnd->rdpsnd_channel, stream_get_head(s), Stream_GetPosition(s), NULL);
|
||||
Stream_SetPosition(s, 0);
|
||||
|
@ -92,7 +92,7 @@ static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
|
||||
|
||||
Stream_Seek(irp->input, 28); /* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */
|
||||
/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */
|
||||
stream_read_UINT32(irp->input, PathLength);
|
||||
Stream_Read_UINT32(irp->input, PathLength);
|
||||
|
||||
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(irp->input),
|
||||
PathLength / 2, &path, 0, NULL, NULL);
|
||||
@ -117,8 +117,8 @@ static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
|
||||
DEBUG_SVC("%s(%d) created.", serial->path, FileId);
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, FileId);
|
||||
stream_write_BYTE(irp->output, 0);
|
||||
Stream_Write_UINT32(irp->output, FileId);
|
||||
Stream_Write_UINT8(irp->output, 0);
|
||||
|
||||
free(path);
|
||||
|
||||
@ -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_Write_zero(irp->output, 5); /* Padding(5) */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -156,8 +156,8 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp)
|
||||
UINT64 Offset;
|
||||
BYTE* buffer = NULL;
|
||||
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
Stream_Read_UINT32(irp->input, Length);
|
||||
Stream_Read_UINT64(irp->input, Offset);
|
||||
|
||||
DEBUG_SVC("length %u offset %llu", Length, Offset);
|
||||
|
||||
@ -189,12 +189,12 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp)
|
||||
}
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
Stream_Write_UINT32(irp->output, Length);
|
||||
|
||||
if (Length > 0)
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(irp->output, Length);
|
||||
stream_write(irp->output, buffer, Length);
|
||||
Stream_Write(irp->output, buffer, Length);
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
@ -208,8 +208,8 @@ static void serial_process_irp_write(SERIAL_DEVICE* serial, IRP* irp)
|
||||
UINT32 Length;
|
||||
UINT64 Offset;
|
||||
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
stream_read_UINT64(irp->input, Offset);
|
||||
Stream_Read_UINT32(irp->input, Length);
|
||||
Stream_Read_UINT64(irp->input, Offset);
|
||||
Stream_Seek(irp->input, 20); /* Padding */
|
||||
|
||||
DEBUG_SVC("length %u offset %llu", Length, Offset);
|
||||
@ -235,8 +235,8 @@ static void serial_process_irp_write(SERIAL_DEVICE* serial, IRP* irp)
|
||||
DEBUG_SVC("write %llu-%llu to %s(%d).", Offset, Offset + Length, serial->path, tty->id);
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, Length);
|
||||
stream_write_BYTE(irp->output, 0); /* Padding */
|
||||
Stream_Write_UINT32(irp->output, Length);
|
||||
Stream_Write_UINT8(irp->output, 0); /* Padding */
|
||||
|
||||
irp->Complete(irp);
|
||||
}
|
||||
@ -251,9 +251,9 @@ static void serial_process_irp_device_control(SERIAL_DEVICE* serial, IRP* irp)
|
||||
|
||||
DEBUG_SVC("[in] pending size %d", list_size(serial->pending_irps));
|
||||
|
||||
stream_read_UINT32(irp->input, InputBufferLength);
|
||||
stream_read_UINT32(irp->input, OutputBufferLength);
|
||||
stream_read_UINT32(irp->input, IoControlCode);
|
||||
Stream_Read_UINT32(irp->input, InputBufferLength);
|
||||
Stream_Read_UINT32(irp->input, OutputBufferLength);
|
||||
Stream_Read_UINT32(irp->input, IoControlCode);
|
||||
Stream_Seek(irp->input, 20); /* Padding */
|
||||
|
||||
tty = serial->tty;
|
||||
@ -420,7 +420,7 @@ static void serial_abort_single_io(SERIAL_DEVICE* serial, UINT32 file_id, UINT32
|
||||
/* Process a SINGLE FileId and MajorFunction */
|
||||
list_remove(serial->pending_irps, irp);
|
||||
irp->IoStatus = io_status;
|
||||
stream_write_UINT32(irp->output, 0);
|
||||
Stream_Write_UINT32(irp->output, 0);
|
||||
irp->Complete(irp);
|
||||
|
||||
SetEvent(serial->in_event);
|
||||
@ -454,7 +454,7 @@ static void serial_check_for_events(SERIAL_DEVICE* serial)
|
||||
DEBUG_SVC("got event result %u", result);
|
||||
|
||||
irp->IoStatus = STATUS_SUCCESS;
|
||||
stream_write_UINT32(irp->output, result);
|
||||
Stream_Write_UINT32(irp->output, result);
|
||||
irp->Complete(irp);
|
||||
|
||||
prev = irp;
|
||||
@ -479,7 +479,7 @@ void serial_get_timeouts(SERIAL_DEVICE* serial, IRP* irp, UINT32* timeout, UINT3
|
||||
UINT32 pos;
|
||||
|
||||
pos = Stream_GetPosition(irp->input);
|
||||
stream_read_UINT32(irp->input, Length);
|
||||
Stream_Read_UINT32(irp->input, Length);
|
||||
Stream_SetPosition(irp->input, pos);
|
||||
|
||||
DEBUG_SVC("length read %u", Length);
|
||||
@ -584,7 +584,7 @@ static void __serial_check_fds(SERIAL_DEVICE* serial)
|
||||
DEBUG_SVC("got event result %u", result);
|
||||
|
||||
irp->IoStatus = STATUS_SUCCESS;
|
||||
stream_write_UINT32(irp->output, result);
|
||||
Stream_Write_UINT32(irp->output, result);
|
||||
irp->Complete(irp);
|
||||
irp_completed = TRUE;
|
||||
}
|
||||
@ -706,7 +706,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
serial->device.data = stream_new(len + 1);
|
||||
|
||||
for (i = 0; i <= len; i++)
|
||||
stream_write_BYTE(serial->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
Stream_Write_UINT8(serial->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
|
||||
serial->path = path;
|
||||
serial->queue = Queue_New(TRUE, -1, -1);
|
||||
|
@ -95,27 +95,27 @@ UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, wStream* input,
|
||||
switch (IoControlCode)
|
||||
{
|
||||
case IOCTL_SERIAL_SET_BAUD_RATE:
|
||||
stream_read_UINT32(input, tty->baud_rate);
|
||||
Stream_Read_UINT32(input, tty->baud_rate);
|
||||
tty_set_termios(tty);
|
||||
DEBUG_SVC("SERIAL_SET_BAUD_RATE %d", tty->baud_rate);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_GET_BAUD_RATE:
|
||||
length = 4;
|
||||
stream_write_UINT32(output, tty->baud_rate);
|
||||
Stream_Write_UINT32(output, tty->baud_rate);
|
||||
DEBUG_SVC("SERIAL_GET_BAUD_RATE %d", tty->baud_rate);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_SET_QUEUE_SIZE:
|
||||
stream_read_UINT32(input, tty->queue_in_size);
|
||||
stream_read_UINT32(input, tty->queue_out_size);
|
||||
Stream_Read_UINT32(input, tty->queue_in_size);
|
||||
Stream_Read_UINT32(input, tty->queue_out_size);
|
||||
DEBUG_SVC("SERIAL_SET_QUEUE_SIZE in %d out %d", tty->queue_in_size, tty->queue_out_size);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_SET_LINE_CONTROL:
|
||||
stream_read_BYTE(input, tty->stop_bits);
|
||||
stream_read_BYTE(input, tty->parity);
|
||||
stream_read_BYTE(input, tty->word_length);
|
||||
Stream_Read_UINT8(input, tty->stop_bits);
|
||||
Stream_Read_UINT8(input, tty->parity);
|
||||
Stream_Read_UINT8(input, tty->word_length);
|
||||
tty_set_termios(tty);
|
||||
DEBUG_SVC("SERIAL_SET_LINE_CONTROL stop %d parity %d word %d",
|
||||
tty->stop_bits, tty->parity, tty->word_length);
|
||||
@ -124,62 +124,62 @@ UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, wStream* input,
|
||||
case IOCTL_SERIAL_GET_LINE_CONTROL:
|
||||
DEBUG_SVC("SERIAL_GET_LINE_CONTROL");
|
||||
length = 3;
|
||||
stream_write_BYTE(output, tty->stop_bits);
|
||||
stream_write_BYTE(output, tty->parity);
|
||||
stream_write_BYTE(output, tty->word_length);
|
||||
Stream_Write_UINT8(output, tty->stop_bits);
|
||||
Stream_Write_UINT8(output, tty->parity);
|
||||
Stream_Write_UINT8(output, tty->word_length);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_IMMEDIATE_CHAR:
|
||||
DEBUG_SVC("SERIAL_IMMEDIATE_CHAR");
|
||||
stream_read_BYTE(input, immediate);
|
||||
Stream_Read_UINT8(input, immediate);
|
||||
tty_write_data(tty, &immediate, 1);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_CONFIG_SIZE:
|
||||
DEBUG_SVC("SERIAL_CONFIG_SIZE");
|
||||
length = 4;
|
||||
stream_write_UINT32(output, 0);
|
||||
Stream_Write_UINT32(output, 0);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_GET_CHARS:
|
||||
DEBUG_SVC("SERIAL_GET_CHARS");
|
||||
length = 6;
|
||||
stream_write(output, tty->chars, 6);
|
||||
Stream_Write(output, tty->chars, 6);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_SET_CHARS:
|
||||
DEBUG_SVC("SERIAL_SET_CHARS");
|
||||
stream_read(input, tty->chars, 6);
|
||||
Stream_Read(input, tty->chars, 6);
|
||||
tty_set_termios(tty);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_GET_HANDFLOW:
|
||||
length = 16;
|
||||
tty_get_termios(tty);
|
||||
stream_write_UINT32(output, tty->control);
|
||||
stream_write_UINT32(output, tty->xonoff);
|
||||
stream_write_UINT32(output, tty->onlimit);
|
||||
stream_write_UINT32(output, tty->offlimit);
|
||||
Stream_Write_UINT32(output, tty->control);
|
||||
Stream_Write_UINT32(output, tty->xonoff);
|
||||
Stream_Write_UINT32(output, tty->onlimit);
|
||||
Stream_Write_UINT32(output, tty->offlimit);
|
||||
DEBUG_SVC("IOCTL_SERIAL_GET_HANDFLOW %X %X %X %X",
|
||||
tty->control, tty->xonoff, tty->onlimit, tty->offlimit);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_SET_HANDFLOW:
|
||||
stream_read_UINT32(input, tty->control);
|
||||
stream_read_UINT32(input, tty->xonoff);
|
||||
stream_read_UINT32(input, tty->onlimit);
|
||||
stream_read_UINT32(input, tty->offlimit);
|
||||
Stream_Read_UINT32(input, tty->control);
|
||||
Stream_Read_UINT32(input, tty->xonoff);
|
||||
Stream_Read_UINT32(input, tty->onlimit);
|
||||
Stream_Read_UINT32(input, tty->offlimit);
|
||||
DEBUG_SVC("IOCTL_SERIAL_SET_HANDFLOW %X %X %X %X",
|
||||
tty->control, tty->xonoff, tty->onlimit, tty->offlimit);
|
||||
tty_set_termios(tty);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_SET_TIMEOUTS:
|
||||
stream_read_UINT32(input, tty->read_interval_timeout);
|
||||
stream_read_UINT32(input, tty->read_total_timeout_multiplier);
|
||||
stream_read_UINT32(input, tty->read_total_timeout_constant);
|
||||
stream_read_UINT32(input, tty->write_total_timeout_multiplier);
|
||||
stream_read_UINT32(input, tty->write_total_timeout_constant);
|
||||
Stream_Read_UINT32(input, tty->read_interval_timeout);
|
||||
Stream_Read_UINT32(input, tty->read_total_timeout_multiplier);
|
||||
Stream_Read_UINT32(input, tty->read_total_timeout_constant);
|
||||
Stream_Read_UINT32(input, tty->write_total_timeout_multiplier);
|
||||
Stream_Read_UINT32(input, tty->write_total_timeout_constant);
|
||||
|
||||
/* http://www.codeproject.com/KB/system/chaiyasit_t.aspx, see 'ReadIntervalTimeout' section
|
||||
http://msdn.microsoft.com/en-us/library/ms885171.aspx */
|
||||
@ -201,21 +201,21 @@ UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, wStream* input,
|
||||
tty->read_total_timeout_multiplier,
|
||||
tty->read_total_timeout_constant);
|
||||
length = 20;
|
||||
stream_write_UINT32(output, tty->read_interval_timeout);
|
||||
stream_write_UINT32(output, tty->read_total_timeout_multiplier);
|
||||
stream_write_UINT32(output, tty->read_total_timeout_constant);
|
||||
stream_write_UINT32(output, tty->write_total_timeout_multiplier);
|
||||
stream_write_UINT32(output, tty->write_total_timeout_constant);
|
||||
Stream_Write_UINT32(output, tty->read_interval_timeout);
|
||||
Stream_Write_UINT32(output, tty->read_total_timeout_multiplier);
|
||||
Stream_Write_UINT32(output, tty->read_total_timeout_constant);
|
||||
Stream_Write_UINT32(output, tty->write_total_timeout_multiplier);
|
||||
Stream_Write_UINT32(output, tty->write_total_timeout_constant);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_GET_WAIT_MASK:
|
||||
DEBUG_SVC("SERIAL_GET_WAIT_MASK %X", tty->wait_mask);
|
||||
length = 4;
|
||||
stream_write_UINT32(output, tty->wait_mask);
|
||||
Stream_Write_UINT32(output, tty->wait_mask);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_SET_WAIT_MASK:
|
||||
stream_read_UINT32(input, tty->wait_mask);
|
||||
Stream_Read_UINT32(input, tty->wait_mask);
|
||||
DEBUG_SVC("SERIAL_SET_WAIT_MASK %X", tty->wait_mask);
|
||||
break;
|
||||
|
||||
@ -270,19 +270,19 @@ UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, wStream* input,
|
||||
#endif
|
||||
DEBUG_SVC("SERIAL_GET_MODEMSTATUS %X", modemstate);
|
||||
length = 4;
|
||||
stream_write_UINT32(output, modemstate);
|
||||
Stream_Write_UINT32(output, modemstate);
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_GET_COMMSTATUS:
|
||||
length = 18;
|
||||
stream_write_UINT32(output, 0); /* Errors */
|
||||
stream_write_UINT32(output, 0); /* Hold reasons */
|
||||
Stream_Write_UINT32(output, 0); /* Errors */
|
||||
Stream_Write_UINT32(output, 0); /* Hold reasons */
|
||||
|
||||
result = 0;
|
||||
#ifdef TIOCINQ
|
||||
ioctl(tty->fd, TIOCINQ, &result);
|
||||
#endif
|
||||
stream_write_UINT32(output, result); /* Amount in in queue */
|
||||
Stream_Write_UINT32(output, result); /* Amount in in queue */
|
||||
if (result)
|
||||
DEBUG_SVC("SERIAL_GET_COMMSTATUS in queue %d", result);
|
||||
|
||||
@ -290,15 +290,15 @@ UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, wStream* input,
|
||||
#ifdef TIOCOUTQ
|
||||
ioctl(tty->fd, TIOCOUTQ, &result);
|
||||
#endif
|
||||
stream_write_UINT32(output, result); /* Amount in out queue */
|
||||
Stream_Write_UINT32(output, result); /* Amount in out queue */
|
||||
DEBUG_SVC("SERIAL_GET_COMMSTATUS out queue %d", result);
|
||||
|
||||
stream_write_BYTE(output, 0); /* EofReceived */
|
||||
stream_write_BYTE(output, 0); /* WaitForImmediate */
|
||||
Stream_Write_UINT8(output, 0); /* EofReceived */
|
||||
Stream_Write_UINT8(output, 0); /* WaitForImmediate */
|
||||
break;
|
||||
|
||||
case IOCTL_SERIAL_PURGE:
|
||||
stream_read_UINT32(input, purge_mask);
|
||||
Stream_Read_UINT32(input, purge_mask);
|
||||
DEBUG_SVC("SERIAL_PURGE purge_mask %X", purge_mask);
|
||||
|
||||
/* See http://msdn.microsoft.com/en-us/library/ms901431.aspx
|
||||
@ -327,7 +327,7 @@ UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, wStream* input,
|
||||
if (serial_tty_get_event(tty, &result))
|
||||
{
|
||||
DEBUG_SVC("WAIT end event = %X", result);
|
||||
stream_write_UINT32(output, result);
|
||||
Stream_Write_UINT32(output, result);
|
||||
break;
|
||||
}
|
||||
ret = STATUS_PENDING;
|
||||
@ -363,7 +363,7 @@ UINT32 serial_tty_control(SERIAL_TTY* tty, UINT32 IoControlCode, wStream* input,
|
||||
/* Write OutputBufferLength */
|
||||
pos = Stream_GetPosition(output);
|
||||
Stream_SetPosition(output, 16);
|
||||
stream_write_UINT32(output, length);
|
||||
Stream_Write_UINT32(output, length);
|
||||
Stream_SetPosition(output, pos);
|
||||
|
||||
return ret;
|
||||
|
@ -136,19 +136,19 @@ static int wts_read_variable_uint(wStream* s, int cbLen, UINT32* val)
|
||||
case 0:
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
return 0;
|
||||
stream_read_BYTE(s, *val);
|
||||
Stream_Read_UINT8(s, *val);
|
||||
return 1;
|
||||
|
||||
case 1:
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return 0;
|
||||
stream_read_UINT16(s, *val);
|
||||
Stream_Read_UINT16(s, *val);
|
||||
return 2;
|
||||
|
||||
default:
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return 0;
|
||||
stream_read_UINT32(s, *val);
|
||||
Stream_Read_UINT32(s, *val);
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
@ -161,7 +161,7 @@ static void wts_read_drdynvc_capabilities_response(rdpPeerChannel* channel, UINT
|
||||
return;
|
||||
|
||||
Stream_Seek_BYTE(channel->receive_data); /* Pad (1 byte) */
|
||||
stream_read_UINT16(channel->receive_data, Version);
|
||||
Stream_Read_UINT16(channel->receive_data, Version);
|
||||
|
||||
DEBUG_DVC("Version: %d", Version);
|
||||
|
||||
@ -175,7 +175,7 @@ static void wts_read_drdynvc_create_response(rdpPeerChannel* channel, wStream* s
|
||||
if (length < 4)
|
||||
return;
|
||||
|
||||
stream_read_UINT32(s, CreationStatus);
|
||||
Stream_Read_UINT32(s, CreationStatus);
|
||||
|
||||
if ((INT32) CreationStatus < 0)
|
||||
{
|
||||
@ -207,7 +207,7 @@ static void wts_read_drdynvc_data_first(rdpPeerChannel* channel, wStream* s, int
|
||||
|
||||
Stream_SetPosition(channel->receive_data, 0);
|
||||
Stream_EnsureRemainingCapacity(channel->receive_data, (int) channel->dvc_total_length);
|
||||
stream_write(channel->receive_data, Stream_Pointer(s), length);
|
||||
Stream_Write(channel->receive_data, Stream_Pointer(s), length);
|
||||
}
|
||||
|
||||
static void wts_read_drdynvc_data(rdpPeerChannel* channel, wStream* s, UINT32 length)
|
||||
@ -221,7 +221,7 @@ static void wts_read_drdynvc_data(rdpPeerChannel* channel, wStream* s, UINT32 le
|
||||
return;
|
||||
}
|
||||
|
||||
stream_write(channel->receive_data, Stream_Pointer(s), length);
|
||||
Stream_Write(channel->receive_data, Stream_Pointer(s), length);
|
||||
|
||||
if (Stream_GetPosition(channel->receive_data) >= (int) channel->dvc_total_length)
|
||||
{
|
||||
@ -257,7 +257,7 @@ static void wts_read_drdynvc_pdu(rdpPeerChannel* channel)
|
||||
return;
|
||||
|
||||
Stream_SetPosition(channel->receive_data, 0);
|
||||
stream_read_BYTE(channel->receive_data, value);
|
||||
Stream_Read_UINT8(channel->receive_data, value);
|
||||
|
||||
length--;
|
||||
Cmd = (value & 0xf0) >> 4;
|
||||
@ -323,17 +323,17 @@ static int wts_write_variable_uint(wStream* stream, UINT32 val)
|
||||
if (val <= 0xFF)
|
||||
{
|
||||
cb = 0;
|
||||
stream_write_BYTE(stream, val);
|
||||
Stream_Write_UINT8(stream, val);
|
||||
}
|
||||
else if (val <= 0xFFFF)
|
||||
{
|
||||
cb = 1;
|
||||
stream_write_UINT16(stream, val);
|
||||
Stream_Write_UINT16(stream, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
cb = 3;
|
||||
stream_write_UINT32(stream, val);
|
||||
Stream_Write_UINT32(stream, val);
|
||||
}
|
||||
|
||||
return cb;
|
||||
@ -357,7 +357,7 @@ static void wts_write_drdynvc_create_request(wStream *s, UINT32 ChannelId, const
|
||||
wts_write_drdynvc_header(s, CREATE_REQUEST_PDU, ChannelId);
|
||||
len = strlen(ChannelName) + 1;
|
||||
Stream_EnsureRemainingCapacity(s, (int) len);
|
||||
stream_write(s, ChannelName, len);
|
||||
Stream_Write(s, ChannelName, len);
|
||||
}
|
||||
|
||||
static void WTSProcessChannelData(rdpPeerChannel* channel, int channelId, BYTE* data, int size, int flags, int total_size)
|
||||
@ -368,7 +368,7 @@ static void WTSProcessChannelData(rdpPeerChannel* channel, int channelId, BYTE*
|
||||
}
|
||||
|
||||
Stream_EnsureRemainingCapacity(channel->receive_data, size);
|
||||
stream_write(channel->receive_data, data, size);
|
||||
Stream_Write(channel->receive_data, data, size);
|
||||
|
||||
if (flags & CHANNEL_FLAG_LAST)
|
||||
{
|
||||
@ -803,7 +803,7 @@ BOOL WTSVirtualChannelWrite(
|
||||
if (written > Length)
|
||||
written = Length;
|
||||
|
||||
stream_write(s, Buffer, written);
|
||||
Stream_Write(s, Buffer, written);
|
||||
item->length = Stream_GetPosition(s);
|
||||
stream_detach(s);
|
||||
Length -= written;
|
||||
|
@ -222,7 +222,7 @@ static void smartcard_irp_complete(IRP* irp)
|
||||
|
||||
pos = Stream_GetPosition(irp->output);
|
||||
Stream_SetPosition(irp->output, 12);
|
||||
stream_write_UINT32(irp->output, irp->IoStatus);
|
||||
Stream_Write_UINT32(irp->output, irp->IoStatus);
|
||||
Stream_SetPosition(irp->output, pos);
|
||||
|
||||
/* Begin TS Client defect workaround. */
|
||||
@ -328,7 +328,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
||||
smartcard->device.data = stream_new(length + 1);
|
||||
|
||||
for (i = 0; i <= length; i++)
|
||||
stream_write_BYTE(smartcard->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
Stream_Write_UINT8(smartcard->device.data, name[i] < 0 ? '_' : name[i]);
|
||||
|
||||
smartcard->path = path;
|
||||
|
||||
|
@ -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_Write_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_Write_zero(irp->output, add);
|
||||
}
|
||||
|
||||
static UINT32 smartcard_output_return(IRP* irp, UINT32 status)
|
||||
{
|
||||
stream_write_zero(irp->output, 256);
|
||||
Stream_Write_zero(irp->output, 256);
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -145,18 +145,18 @@ static void smartcard_output_buffer_limit(IRP* irp, char* buffer, unsigned int l
|
||||
{
|
||||
int header = (length < 0) ? (0) : ((length > highLimit) ? (highLimit) : (length));
|
||||
|
||||
stream_write_UINT32(irp->output, header);
|
||||
Stream_Write_UINT32(irp->output, header);
|
||||
|
||||
if (length <= 0)
|
||||
{
|
||||
stream_write_UINT32(irp->output, 0);
|
||||
Stream_Write_UINT32(irp->output, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (header < length)
|
||||
length = header;
|
||||
|
||||
stream_write(irp->output, buffer, length);
|
||||
Stream_Write(irp->output, buffer, length);
|
||||
smartcard_output_repos(irp, length);
|
||||
}
|
||||
}
|
||||
@ -170,8 +170,8 @@ static void smartcard_output_buffer_start_limit(IRP* irp, int length, int highLi
|
||||
{
|
||||
int header = (length < 0) ? (0) : ((length > highLimit) ? (highLimit) : (length));
|
||||
|
||||
stream_write_UINT32(irp->output, header);
|
||||
stream_write_UINT32(irp->output, 0x00000001); /* Magic DWORD - any non zero */
|
||||
Stream_Write_UINT32(irp->output, header);
|
||||
Stream_Write_UINT32(irp->output, 0x00000001); /* Magic DWORD - any non zero */
|
||||
}
|
||||
|
||||
static void smartcard_output_buffer_start(IRP* irp, int length)
|
||||
@ -187,7 +187,7 @@ static UINT32 smartcard_input_string(IRP* irp, char** dest, UINT32 dataLength, B
|
||||
bufferSize = wide ? (2 * dataLength) : dataLength;
|
||||
buffer = malloc(bufferSize + 2); /* reserve 2 bytes for the '\0' */
|
||||
|
||||
stream_read(irp->input, buffer, bufferSize);
|
||||
Stream_Read(irp->input, buffer, bufferSize);
|
||||
|
||||
if (wide)
|
||||
{
|
||||
@ -220,7 +220,7 @@ static void smartcard_input_reader_name(IRP* irp, char** dest, BOOL wide)
|
||||
UINT32 dataLength;
|
||||
|
||||
Stream_Seek(irp->input, 8);
|
||||
stream_read_UINT32(irp->input, dataLength);
|
||||
Stream_Read_UINT32(irp->input, dataLength);
|
||||
|
||||
DEBUG_SCARD("datalength %d", dataLength);
|
||||
smartcard_input_repos(irp, smartcard_input_string(irp, dest, dataLength, wide));
|
||||
@ -229,7 +229,7 @@ static void smartcard_input_reader_name(IRP* irp, char** dest, BOOL wide)
|
||||
static void smartcard_input_skip_linked(IRP* irp)
|
||||
{
|
||||
UINT32 len;
|
||||
stream_read_UINT32(irp->input, len);
|
||||
Stream_Read_UINT32(irp->input, len);
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
@ -268,21 +268,21 @@ static UINT32 handle_EstablishContext(IRP* irp)
|
||||
SCARDCONTEXT hContext = -1;
|
||||
|
||||
Stream_Seek(irp->input, 8);
|
||||
stream_read_UINT32(irp->input, len);
|
||||
Stream_Read_UINT32(irp->input, len);
|
||||
|
||||
if (len != 8)
|
||||
return SCARD_F_INTERNAL_ERROR;
|
||||
|
||||
Stream_Seek_UINT32(irp->input);
|
||||
stream_read_UINT32(irp->input, scope);
|
||||
Stream_Read_UINT32(irp->input, scope);
|
||||
|
||||
status = SCardEstablishContext(scope, NULL, NULL, &hContext);
|
||||
|
||||
stream_write_UINT32(irp->output, 4); // cbContext
|
||||
stream_write_UINT32(irp->output, -1); // ReferentID
|
||||
Stream_Write_UINT32(irp->output, 4); // cbContext
|
||||
Stream_Write_UINT32(irp->output, -1); // ReferentID
|
||||
|
||||
stream_write_UINT32(irp->output, 4);
|
||||
stream_write_UINT32(irp->output, hContext);
|
||||
Stream_Write_UINT32(irp->output, 4);
|
||||
Stream_Write_UINT32(irp->output, hContext);
|
||||
|
||||
/* TODO: store hContext in allowed context list */
|
||||
|
||||
@ -296,10 +296,10 @@ static UINT32 handle_ReleaseContext(IRP* irp)
|
||||
SCARDCONTEXT hContext = -1;
|
||||
|
||||
Stream_Seek(irp->input, 8);
|
||||
stream_read_UINT32(irp->input, len);
|
||||
Stream_Read_UINT32(irp->input, len);
|
||||
|
||||
Stream_Seek(irp->input, 0x10);
|
||||
stream_read_UINT32(irp->input, hContext);
|
||||
Stream_Read_UINT32(irp->input, hContext);
|
||||
|
||||
status = SCardReleaseContext(hContext);
|
||||
|
||||
@ -319,7 +319,7 @@ static UINT32 handle_IsValidContext(IRP* irp)
|
||||
SCARDCONTEXT hContext;
|
||||
|
||||
Stream_Seek(irp->input, 0x1C);
|
||||
stream_read_UINT32(irp->input, hContext);
|
||||
Stream_Read_UINT32(irp->input, hContext);
|
||||
|
||||
status = SCardIsValidContext(hContext);
|
||||
|
||||
@ -343,15 +343,15 @@ static UINT32 handle_ListReaders(IRP* irp, BOOL wide)
|
||||
int pos, poslen1, poslen2;
|
||||
|
||||
Stream_Seek(irp->input, 8);
|
||||
stream_read_UINT32(irp->input, len);
|
||||
Stream_Read_UINT32(irp->input, len);
|
||||
|
||||
Stream_Seek(irp->input, 0x1c);
|
||||
stream_read_UINT32(irp->input, len);
|
||||
Stream_Read_UINT32(irp->input, len);
|
||||
|
||||
if (len != 4)
|
||||
return SCARD_F_INTERNAL_ERROR;
|
||||
|
||||
stream_read_UINT32(irp->input, hContext);
|
||||
Stream_Read_UINT32(irp->input, hContext);
|
||||
|
||||
/* ignore rest of [MS-RDPESC] 2.2.2.4 ListReaders_Call */
|
||||
|
||||
@ -376,7 +376,7 @@ static UINT32 handle_ListReaders(IRP* irp, BOOL wide)
|
||||
poslen1 = Stream_GetPosition(irp->output);
|
||||
Stream_Seek_UINT32(irp->output);
|
||||
|
||||
stream_write_UINT32(irp->output, 0x01760650);
|
||||
Stream_Write_UINT32(irp->output, 0x01760650);
|
||||
|
||||
poslen2 = Stream_GetPosition(irp->output);
|
||||
Stream_Seek_UINT32(irp->output);
|
||||
@ -400,9 +400,9 @@ static UINT32 handle_ListReaders(IRP* irp, BOOL wide)
|
||||
pos = Stream_GetPosition(irp->output);
|
||||
|
||||
Stream_SetPosition(irp->output, poslen1);
|
||||
stream_write_UINT32(irp->output, dataLength);
|
||||
Stream_Write_UINT32(irp->output, dataLength);
|
||||
Stream_SetPosition(irp->output, poslen2);
|
||||
stream_write_UINT32(irp->output, dataLength);
|
||||
Stream_Write_UINT32(irp->output, dataLength);
|
||||
|
||||
Stream_SetPosition(irp->output, pos);
|
||||
|
||||
@ -428,12 +428,12 @@ static UINT32 handle_GetStatusChange(IRP* irp, BOOL wide)
|
||||
SCARD_READERSTATE *readerStates, *cur;
|
||||
|
||||
Stream_Seek(irp->input, 0x18);
|
||||
stream_read_UINT32(irp->input, dwTimeout);
|
||||
stream_read_UINT32(irp->input, readerCount);
|
||||
Stream_Read_UINT32(irp->input, dwTimeout);
|
||||
Stream_Read_UINT32(irp->input, readerCount);
|
||||
|
||||
Stream_Seek(irp->input, 8);
|
||||
|
||||
stream_read_UINT32(irp->input, hContext);
|
||||
Stream_Read_UINT32(irp->input, hContext);
|
||||
|
||||
Stream_Seek(irp->input, 4);
|
||||
|
||||
@ -459,10 +459,10 @@ static UINT32 handle_GetStatusChange(IRP* irp, BOOL wide)
|
||||
* convert to host endian or fix the headers to
|
||||
* request the order we want
|
||||
*/
|
||||
stream_read_UINT32(irp->input, cur->dwCurrentState);
|
||||
stream_read_UINT32(irp->input, cur->dwEventState);
|
||||
stream_read_UINT32(irp->input, cur->cbAtr);
|
||||
stream_read(irp->input, cur->rgbAtr, 32);
|
||||
Stream_Read_UINT32(irp->input, cur->dwCurrentState);
|
||||
Stream_Read_UINT32(irp->input, cur->dwEventState);
|
||||
Stream_Read_UINT32(irp->input, cur->cbAtr);
|
||||
Stream_Read(irp->input, cur->rgbAtr, 32);
|
||||
|
||||
Stream_Seek(irp->input, 4);
|
||||
|
||||
@ -477,7 +477,7 @@ static UINT32 handle_GetStatusChange(IRP* irp, BOOL wide)
|
||||
UINT32 dataLength;
|
||||
|
||||
Stream_Seek(irp->input, 8);
|
||||
stream_read_UINT32(irp->input, dataLength);
|
||||
Stream_Read_UINT32(irp->input, dataLength);
|
||||
smartcard_input_repos(irp, smartcard_input_string(irp, (char **) &cur->szReader, dataLength, wide));
|
||||
|
||||
DEBUG_SCARD(" \"%s\"", cur->szReader ? cur->szReader : "NULL");
|
||||
@ -501,9 +501,9 @@ static UINT32 handle_GetStatusChange(IRP* irp, BOOL wide)
|
||||
else
|
||||
DEBUG_SCARD("Success");
|
||||
|
||||
stream_write_UINT32(irp->output, readerCount);
|
||||
stream_write_UINT32(irp->output, 0x00084dd8);
|
||||
stream_write_UINT32(irp->output, readerCount);
|
||||
Stream_Write_UINT32(irp->output, readerCount);
|
||||
Stream_Write_UINT32(irp->output, 0x00084dd8);
|
||||
Stream_Write_UINT32(irp->output, readerCount);
|
||||
|
||||
for (i = 0; i < readerCount; i++)
|
||||
{
|
||||
@ -515,12 +515,12 @@ static UINT32 handle_GetStatusChange(IRP* irp, BOOL wide)
|
||||
(unsigned) cur->dwEventState);
|
||||
|
||||
/* TODO: do byte conversions if necessary */
|
||||
stream_write_UINT32(irp->output, cur->dwCurrentState);
|
||||
stream_write_UINT32(irp->output, cur->dwEventState);
|
||||
stream_write_UINT32(irp->output, cur->cbAtr);
|
||||
stream_write(irp->output, cur->rgbAtr, 32);
|
||||
Stream_Write_UINT32(irp->output, cur->dwCurrentState);
|
||||
Stream_Write_UINT32(irp->output, cur->dwEventState);
|
||||
Stream_Write_UINT32(irp->output, cur->cbAtr);
|
||||
Stream_Write(irp->output, cur->rgbAtr, 32);
|
||||
|
||||
stream_write_zero(irp->output, 4);
|
||||
Stream_Write_zero(irp->output, 4);
|
||||
|
||||
free((void *)cur->szReader);
|
||||
}
|
||||
@ -537,7 +537,7 @@ static UINT32 handle_Cancel(IRP *irp)
|
||||
SCARDCONTEXT hContext;
|
||||
|
||||
Stream_Seek(irp->input, 0x1C);
|
||||
stream_read_UINT32(irp->input, hContext);
|
||||
Stream_Read_UINT32(irp->input, hContext);
|
||||
|
||||
status = SCardCancel(hContext);
|
||||
|
||||
@ -562,13 +562,13 @@ static UINT32 handle_Connect(IRP* irp, BOOL wide)
|
||||
SCARDHANDLE hCard;
|
||||
|
||||
Stream_Seek(irp->input, 0x1c);
|
||||
stream_read_UINT32(irp->input, dwShareMode);
|
||||
stream_read_UINT32(irp->input, dwPreferredProtocol);
|
||||
Stream_Read_UINT32(irp->input, dwShareMode);
|
||||
Stream_Read_UINT32(irp->input, dwPreferredProtocol);
|
||||
|
||||
smartcard_input_reader_name(irp, &readerName, wide);
|
||||
|
||||
Stream_Seek(irp->input, 4);
|
||||
stream_read_UINT32(irp->input, hContext);
|
||||
Stream_Read_UINT32(irp->input, hContext);
|
||||
|
||||
DEBUG_SCARD("(context: 0x%08x, share: 0x%08x, proto: 0x%08x, reader: \"%s\")",
|
||||
(unsigned) hContext, (unsigned) dwShareMode,
|
||||
@ -582,13 +582,13 @@ static UINT32 handle_Connect(IRP* irp, BOOL wide)
|
||||
else
|
||||
DEBUG_SCARD("Success 0x%08x", (unsigned) hCard);
|
||||
|
||||
stream_write_UINT32(irp->output, 0x00000000);
|
||||
stream_write_UINT32(irp->output, 0x00000000);
|
||||
stream_write_UINT32(irp->output, 0x00000004);
|
||||
stream_write_UINT32(irp->output, 0x016Cff34);
|
||||
stream_write_UINT32(irp->output, dwActiveProtocol);
|
||||
stream_write_UINT32(irp->output, 0x00000004);
|
||||
stream_write_UINT32(irp->output, hCard);
|
||||
Stream_Write_UINT32(irp->output, 0x00000000);
|
||||
Stream_Write_UINT32(irp->output, 0x00000000);
|
||||
Stream_Write_UINT32(irp->output, 0x00000004);
|
||||
Stream_Write_UINT32(irp->output, 0x016Cff34);
|
||||
Stream_Write_UINT32(irp->output, dwActiveProtocol);
|
||||
Stream_Write_UINT32(irp->output, 0x00000004);
|
||||
Stream_Write_UINT32(irp->output, hCard);
|
||||
|
||||
smartcard_output_alignment(irp, 8);
|
||||
|
||||
@ -607,14 +607,14 @@ static UINT32 handle_Reconnect(IRP* irp)
|
||||
DWORD dwActiveProtocol = 0;
|
||||
|
||||
Stream_Seek(irp->input, 0x20);
|
||||
stream_read_UINT32(irp->input, dwShareMode);
|
||||
stream_read_UINT32(irp->input, dwPreferredProtocol);
|
||||
stream_read_UINT32(irp->input, dwInitialization);
|
||||
Stream_Read_UINT32(irp->input, dwShareMode);
|
||||
Stream_Read_UINT32(irp->input, dwPreferredProtocol);
|
||||
Stream_Read_UINT32(irp->input, dwInitialization);
|
||||
|
||||
Stream_Seek(irp->input, 0x4);
|
||||
stream_read_UINT32(irp->input, hContext);
|
||||
Stream_Read_UINT32(irp->input, hContext);
|
||||
Stream_Seek(irp->input, 0x4);
|
||||
stream_read_UINT32(irp->input, hCard);
|
||||
Stream_Read_UINT32(irp->input, hCard);
|
||||
|
||||
DEBUG_SCARD("(context: 0x%08x, hcard: 0x%08x, share: 0x%08x, proto: 0x%08x, init: 0x%08x)",
|
||||
(unsigned) hContext, (unsigned) hCard,
|
||||
@ -628,7 +628,7 @@ static UINT32 handle_Reconnect(IRP* irp)
|
||||
else
|
||||
DEBUG_SCARD("Success (proto: 0x%08x)", (unsigned) dwActiveProtocol);
|
||||
|
||||
stream_write_UINT32(irp->output, dwActiveProtocol);
|
||||
Stream_Write_UINT32(irp->output, dwActiveProtocol);
|
||||
smartcard_output_alignment(irp, 8);
|
||||
|
||||
return status;
|
||||
@ -642,11 +642,11 @@ static UINT32 handle_Disconnect(IRP* irp)
|
||||
DWORD dwDisposition = 0;
|
||||
|
||||
Stream_Seek(irp->input, 0x20);
|
||||
stream_read_UINT32(irp->input, dwDisposition);
|
||||
Stream_Read_UINT32(irp->input, dwDisposition);
|
||||
Stream_Seek(irp->input, 4);
|
||||
stream_read_UINT32(irp->input, hContext);
|
||||
Stream_Read_UINT32(irp->input, hContext);
|
||||
Stream_Seek(irp->input, 4);
|
||||
stream_read_UINT32(irp->input, hCard);
|
||||
Stream_Read_UINT32(irp->input, hCard);
|
||||
|
||||
DEBUG_SCARD("(context: 0x%08x, hcard: 0x%08x, disposition: 0x%08x)",
|
||||
(unsigned) hContext, (unsigned) hCard, (unsigned) dwDisposition);
|
||||
@ -669,7 +669,7 @@ static UINT32 handle_BeginTransaction(IRP* irp)
|
||||
SCARDCONTEXT hCard;
|
||||
|
||||
Stream_Seek(irp->input, 0x30);
|
||||
stream_read_UINT32(irp->input, hCard);
|
||||
Stream_Read_UINT32(irp->input, hCard);
|
||||
|
||||
status = SCardBeginTransaction(hCard);
|
||||
|
||||
@ -690,10 +690,10 @@ static UINT32 handle_EndTransaction(IRP* irp)
|
||||
DWORD dwDisposition = 0;
|
||||
|
||||
Stream_Seek(irp->input, 0x20);
|
||||
stream_read_UINT32(irp->input, dwDisposition);
|
||||
Stream_Read_UINT32(irp->input, dwDisposition);
|
||||
|
||||
Stream_Seek(irp->input, 0x0C);
|
||||
stream_read_UINT32(irp->input, hCard);
|
||||
Stream_Read_UINT32(irp->input, hCard);
|
||||
|
||||
status = SCardEndTransaction(hCard, dwDisposition);
|
||||
|
||||
@ -725,7 +725,7 @@ static UINT32 handle_State(IRP* irp)
|
||||
Stream_Seek_UINT32(irp->input); /* atrLen */
|
||||
|
||||
Stream_Seek(irp->input, 0x0c);
|
||||
stream_read_UINT32(irp->input, hCard);
|
||||
Stream_Read_UINT32(irp->input, hCard);
|
||||
Stream_Seek(irp->input, 0x04);
|
||||
|
||||
#ifdef SCARD_AUTOALLOCATE
|
||||
@ -757,12 +757,12 @@ static UINT32 handle_State(IRP* irp)
|
||||
|
||||
state = smartcard_map_state(state);
|
||||
|
||||
stream_write_UINT32(irp->output, state);
|
||||
stream_write_UINT32(irp->output, protocol);
|
||||
stream_write_UINT32(irp->output, atrLen);
|
||||
stream_write_UINT32(irp->output, 0x00000001);
|
||||
stream_write_UINT32(irp->output, atrLen);
|
||||
stream_write(irp->output, pbAtr, atrLen);
|
||||
Stream_Write_UINT32(irp->output, state);
|
||||
Stream_Write_UINT32(irp->output, protocol);
|
||||
Stream_Write_UINT32(irp->output, atrLen);
|
||||
Stream_Write_UINT32(irp->output, 0x00000001);
|
||||
Stream_Write_UINT32(irp->output, atrLen);
|
||||
Stream_Write(irp->output, pbAtr, atrLen);
|
||||
|
||||
smartcard_output_repos(irp, atrLen);
|
||||
smartcard_output_alignment(irp, 8);
|
||||
@ -793,10 +793,10 @@ static DWORD handle_Status(IRP *irp, BOOL wide)
|
||||
#endif
|
||||
|
||||
Stream_Seek(irp->input, 0x24);
|
||||
stream_read_UINT32(irp->input, readerLen);
|
||||
stream_read_UINT32(irp->input, atrLen);
|
||||
Stream_Read_UINT32(irp->input, readerLen);
|
||||
Stream_Read_UINT32(irp->input, atrLen);
|
||||
Stream_Seek(irp->input, 0x0c);
|
||||
stream_read_UINT32(irp->input, hCard);
|
||||
Stream_Read_UINT32(irp->input, hCard);
|
||||
Stream_Seek(irp->input, 0x4);
|
||||
|
||||
atrLen = MAX_ATR_SIZE;
|
||||
@ -831,18 +831,18 @@ static DWORD handle_Status(IRP *irp, BOOL wide)
|
||||
state = smartcard_map_state(state);
|
||||
|
||||
poslen1 = Stream_GetPosition(irp->output);
|
||||
stream_write_UINT32(irp->output, readerLen);
|
||||
stream_write_UINT32(irp->output, 0x00020000);
|
||||
stream_write_UINT32(irp->output, state);
|
||||
stream_write_UINT32(irp->output, protocol);
|
||||
stream_write(irp->output, pbAtr, atrLen);
|
||||
Stream_Write_UINT32(irp->output, readerLen);
|
||||
Stream_Write_UINT32(irp->output, 0x00020000);
|
||||
Stream_Write_UINT32(irp->output, state);
|
||||
Stream_Write_UINT32(irp->output, protocol);
|
||||
Stream_Write(irp->output, pbAtr, atrLen);
|
||||
|
||||
if (atrLen < 32)
|
||||
stream_write_zero(irp->output, 32 - atrLen);
|
||||
stream_write_UINT32(irp->output, atrLen);
|
||||
Stream_Write_zero(irp->output, 32 - atrLen);
|
||||
Stream_Write_UINT32(irp->output, atrLen);
|
||||
|
||||
poslen2 = Stream_GetPosition(irp->output);
|
||||
stream_write_UINT32(irp->output, readerLen);
|
||||
Stream_Write_UINT32(irp->output, readerLen);
|
||||
|
||||
dataLength = smartcard_output_string(irp, readerName, wide);
|
||||
dataLength += smartcard_output_string(irp, "\0", wide);
|
||||
@ -850,9 +850,9 @@ static DWORD handle_Status(IRP *irp, BOOL wide)
|
||||
|
||||
pos = Stream_GetPosition(irp->output);
|
||||
Stream_SetPosition(irp->output, poslen1);
|
||||
stream_write_UINT32(irp->output,dataLength);
|
||||
Stream_Write_UINT32(irp->output,dataLength);
|
||||
Stream_SetPosition(irp->output, poslen2);
|
||||
stream_write_UINT32(irp->output,dataLength);
|
||||
Stream_Write_UINT32(irp->output,dataLength);
|
||||
Stream_SetPosition(irp->output, pos);
|
||||
|
||||
smartcard_output_alignment(irp, 8);
|
||||
@ -877,32 +877,32 @@ static UINT32 handle_Transmit(IRP* irp)
|
||||
BYTE *sendBuf = NULL, *recvBuf = NULL;
|
||||
|
||||
Stream_Seek(irp->input, 0x14);
|
||||
stream_read_UINT32(irp->input, map[0]);
|
||||
Stream_Read_UINT32(irp->input, map[0]);
|
||||
Stream_Seek(irp->input, 0x4);
|
||||
stream_read_UINT32(irp->input, map[1]);
|
||||
Stream_Read_UINT32(irp->input, map[1]);
|
||||
|
||||
stream_read_UINT32(irp->input, pioSendPci.dwProtocol);
|
||||
stream_read_UINT32(irp->input, pioSendPci.cbPciLength);
|
||||
Stream_Read_UINT32(irp->input, pioSendPci.dwProtocol);
|
||||
Stream_Read_UINT32(irp->input, pioSendPci.cbPciLength);
|
||||
|
||||
stream_read_UINT32(irp->input, map[2]);
|
||||
stream_read_UINT32(irp->input, cbSendLength);
|
||||
stream_read_UINT32(irp->input, map[3]);
|
||||
stream_read_UINT32(irp->input, map[4]);
|
||||
stream_read_UINT32(irp->input, map[5]);
|
||||
stream_read_UINT32(irp->input, cbRecvLength);
|
||||
Stream_Read_UINT32(irp->input, map[2]);
|
||||
Stream_Read_UINT32(irp->input, cbSendLength);
|
||||
Stream_Read_UINT32(irp->input, map[3]);
|
||||
Stream_Read_UINT32(irp->input, map[4]);
|
||||
Stream_Read_UINT32(irp->input, map[5]);
|
||||
Stream_Read_UINT32(irp->input, cbRecvLength);
|
||||
|
||||
if (map[0] & SCARD_INPUT_LINKED)
|
||||
smartcard_input_skip_linked(irp);
|
||||
|
||||
Stream_Seek(irp->input, 4);
|
||||
stream_read_UINT32(irp->input, hCard);
|
||||
Stream_Read_UINT32(irp->input, hCard);
|
||||
|
||||
if (map[2] & SCARD_INPUT_LINKED)
|
||||
{
|
||||
/* sendPci */
|
||||
stream_read_UINT32(irp->input, linkedLen);
|
||||
Stream_Read_UINT32(irp->input, linkedLen);
|
||||
|
||||
stream_read_UINT32(irp->input, pioSendPci.dwProtocol);
|
||||
Stream_Read_UINT32(irp->input, pioSendPci.dwProtocol);
|
||||
Stream_Seek(irp->input, linkedLen - 4);
|
||||
|
||||
smartcard_input_repos(irp, linkedLen);
|
||||
@ -912,10 +912,10 @@ static UINT32 handle_Transmit(IRP* irp)
|
||||
if (map[3] & SCARD_INPUT_LINKED)
|
||||
{
|
||||
/* send buffer */
|
||||
stream_read_UINT32(irp->input, linkedLen);
|
||||
Stream_Read_UINT32(irp->input, linkedLen);
|
||||
|
||||
sendBuf = malloc(linkedLen);
|
||||
stream_read(irp->input, sendBuf, linkedLen);
|
||||
Stream_Read(irp->input, sendBuf, linkedLen);
|
||||
smartcard_input_repos(irp, linkedLen);
|
||||
}
|
||||
|
||||
@ -925,18 +925,18 @@ static UINT32 handle_Transmit(IRP* irp)
|
||||
if (map[4] & SCARD_INPUT_LINKED)
|
||||
{
|
||||
/* recvPci */
|
||||
stream_read_UINT32(irp->input, linkedLen);
|
||||
Stream_Read_UINT32(irp->input, linkedLen);
|
||||
|
||||
stream_read_UINT32(irp->input, pioRecvPci.dwProtocol);
|
||||
Stream_Read_UINT32(irp->input, pioRecvPci.dwProtocol);
|
||||
Stream_Seek(irp->input, linkedLen - 4);
|
||||
|
||||
smartcard_input_repos(irp, linkedLen);
|
||||
|
||||
stream_read_UINT32(irp->input, map[6]);
|
||||
Stream_Read_UINT32(irp->input, map[6]);
|
||||
if (map[6] & SCARD_INPUT_LINKED)
|
||||
{
|
||||
/* not sure what this is */
|
||||
stream_read_UINT32(irp->input, linkedLen);
|
||||
Stream_Read_UINT32(irp->input, linkedLen);
|
||||
Stream_Seek(irp->input, linkedLen);
|
||||
|
||||
smartcard_input_repos(irp, linkedLen);
|
||||
@ -964,7 +964,7 @@ static UINT32 handle_Transmit(IRP* irp)
|
||||
{
|
||||
DEBUG_SCARD("Success (%d bytes)", (int) cbRecvLength);
|
||||
|
||||
stream_write_UINT32(irp->output, 0); /* pioRecvPci 0x00; */
|
||||
Stream_Write_UINT32(irp->output, 0); /* pioRecvPci 0x00; */
|
||||
|
||||
smartcard_output_buffer_start(irp, cbRecvLength); /* start of recvBuf output */
|
||||
|
||||
@ -994,18 +994,18 @@ static UINT32 handle_Control(IRP* irp)
|
||||
DWORD outBufferSize;
|
||||
|
||||
Stream_Seek(irp->input, 0x14);
|
||||
stream_read_UINT32(irp->input, map[0]);
|
||||
Stream_Read_UINT32(irp->input, map[0]);
|
||||
Stream_Seek(irp->input, 0x4);
|
||||
stream_read_UINT32(irp->input, map[1]);
|
||||
stream_read_UINT32(irp->input, controlCode);
|
||||
stream_read_UINT32(irp->input, recvLength);
|
||||
stream_read_UINT32(irp->input, map[2]);
|
||||
Stream_Read_UINT32(irp->input, map[1]);
|
||||
Stream_Read_UINT32(irp->input, controlCode);
|
||||
Stream_Read_UINT32(irp->input, recvLength);
|
||||
Stream_Read_UINT32(irp->input, map[2]);
|
||||
Stream_Seek(irp->input, 0x4);
|
||||
stream_read_UINT32(irp->input, outBufferSize);
|
||||
Stream_Read_UINT32(irp->input, outBufferSize);
|
||||
Stream_Seek(irp->input, 0x4);
|
||||
stream_read_UINT32(irp->input, hContext);
|
||||
Stream_Read_UINT32(irp->input, hContext);
|
||||
Stream_Seek(irp->input, 0x4);
|
||||
stream_read_UINT32(irp->input, hCard);
|
||||
Stream_Read_UINT32(irp->input, hCard);
|
||||
|
||||
/* Translate Windows SCARD_CTL_CODE's to corresponding local code */
|
||||
if (WIN_CTL_DEVICE_TYPE(controlCode) == WIN_FILE_DEVICE_SMARTCARD)
|
||||
@ -1018,14 +1018,14 @@ static UINT32 handle_Control(IRP* irp)
|
||||
if (map[2] & SCARD_INPUT_LINKED)
|
||||
{
|
||||
/* read real input size */
|
||||
stream_read_UINT32(irp->input, recvLength);
|
||||
Stream_Read_UINT32(irp->input, recvLength);
|
||||
|
||||
recvBuffer = malloc(recvLength);
|
||||
|
||||
if (!recvBuffer)
|
||||
return smartcard_output_return(irp, SCARD_E_NO_MEMORY);
|
||||
|
||||
stream_read(irp->input, recvBuffer, recvLength);
|
||||
Stream_Read(irp->input, recvBuffer, recvLength);
|
||||
}
|
||||
|
||||
nBytesReturned = outBufferSize;
|
||||
@ -1042,13 +1042,13 @@ static UINT32 handle_Control(IRP* irp)
|
||||
else
|
||||
DEBUG_SCARD("Success (out: %u bytes)", (unsigned) nBytesReturned);
|
||||
|
||||
stream_write_UINT32(irp->output, (UINT32) nBytesReturned);
|
||||
stream_write_UINT32(irp->output, 0x00000004);
|
||||
stream_write_UINT32(irp->output, nBytesReturned);
|
||||
Stream_Write_UINT32(irp->output, (UINT32) nBytesReturned);
|
||||
Stream_Write_UINT32(irp->output, 0x00000004);
|
||||
Stream_Write_UINT32(irp->output, nBytesReturned);
|
||||
|
||||
if (nBytesReturned > 0)
|
||||
{
|
||||
stream_write(irp->output, sendBuffer, nBytesReturned);
|
||||
Stream_Write(irp->output, sendBuffer, nBytesReturned);
|
||||
smartcard_output_repos(irp, nBytesReturned);
|
||||
}
|
||||
|
||||
@ -1070,11 +1070,11 @@ static UINT32 handle_GetAttrib(IRP* irp)
|
||||
BYTE* pbAttr = NULL;
|
||||
|
||||
Stream_Seek(irp->input, 0x20);
|
||||
stream_read_UINT32(irp->input, dwAttrId);
|
||||
Stream_Read_UINT32(irp->input, dwAttrId);
|
||||
Stream_Seek(irp->input, 0x4);
|
||||
stream_read_UINT32(irp->input, dwAttrLen);
|
||||
Stream_Read_UINT32(irp->input, dwAttrLen);
|
||||
Stream_Seek(irp->input, 0xC);
|
||||
stream_read_UINT32(irp->input, hCard);
|
||||
Stream_Read_UINT32(irp->input, hCard);
|
||||
|
||||
DEBUG_SCARD("hcard: 0x%08x, attrib: 0x%08x (%d bytes)",
|
||||
(unsigned) hCard, (unsigned) dwAttrId, (int) dwAttrLen);
|
||||
@ -1148,21 +1148,21 @@ static UINT32 handle_GetAttrib(IRP* irp)
|
||||
{
|
||||
DEBUG_SCARD("Success (%d bytes)", (int) dwAttrLen);
|
||||
|
||||
stream_write_UINT32(irp->output, dwAttrLen);
|
||||
stream_write_UINT32(irp->output, 0x00000200);
|
||||
stream_write_UINT32(irp->output, dwAttrLen);
|
||||
Stream_Write_UINT32(irp->output, dwAttrLen);
|
||||
Stream_Write_UINT32(irp->output, 0x00000200);
|
||||
Stream_Write_UINT32(irp->output, dwAttrLen);
|
||||
|
||||
if (!pbAttr)
|
||||
{
|
||||
stream_write_zero(irp->output, dwAttrLen);
|
||||
Stream_Write_zero(irp->output, dwAttrLen);
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_write(irp->output, pbAttr, dwAttrLen);
|
||||
Stream_Write(irp->output, pbAttr, dwAttrLen);
|
||||
}
|
||||
smartcard_output_repos(irp, dwAttrLen);
|
||||
/* align to multiple of 4 */
|
||||
stream_write_UINT32(irp->output, 0);
|
||||
Stream_Write_UINT32(irp->output, 0);
|
||||
}
|
||||
smartcard_output_alignment(irp, 8);
|
||||
|
||||
@ -1210,8 +1210,8 @@ static UINT32 handle_LocateCardsByATR(IRP* irp, BOOL wide)
|
||||
SERVER_SCARD_ATRMASK* pAtrMasks = NULL;
|
||||
|
||||
Stream_Seek(irp->input, 0x2C);
|
||||
stream_read_UINT32(irp->input, hContext);
|
||||
stream_read_UINT32(irp->input, atrMaskCount);
|
||||
Stream_Read_UINT32(irp->input, hContext);
|
||||
Stream_Read_UINT32(irp->input, atrMaskCount);
|
||||
|
||||
pAtrMasks = malloc(atrMaskCount * sizeof(SERVER_SCARD_ATRMASK));
|
||||
|
||||
@ -1220,12 +1220,12 @@ static UINT32 handle_LocateCardsByATR(IRP* irp, BOOL wide)
|
||||
|
||||
for (i = 0; i < atrMaskCount; i++)
|
||||
{
|
||||
stream_read_UINT32(irp->input, pAtrMasks[i].cbAtr);
|
||||
stream_read(irp->input, pAtrMasks[i].rgbAtr, 36);
|
||||
stream_read(irp->input, pAtrMasks[i].rgbMask, 36);
|
||||
Stream_Read_UINT32(irp->input, pAtrMasks[i].cbAtr);
|
||||
Stream_Read(irp->input, pAtrMasks[i].rgbAtr, 36);
|
||||
Stream_Read(irp->input, pAtrMasks[i].rgbMask, 36);
|
||||
}
|
||||
|
||||
stream_read_UINT32(irp->input, readerCount);
|
||||
Stream_Read_UINT32(irp->input, readerCount);
|
||||
|
||||
readerStates = malloc(readerCount * sizeof(SCARD_READERSTATE));
|
||||
ZeroMemory(readerStates, readerCount * sizeof(SCARD_READERSTATE));
|
||||
@ -1244,10 +1244,10 @@ static UINT32 handle_LocateCardsByATR(IRP* irp, BOOL wide)
|
||||
* convert to host endian or fix the headers to
|
||||
* request the order we want
|
||||
*/
|
||||
stream_read_UINT32(irp->input, cur->dwCurrentState);
|
||||
stream_read_UINT32(irp->input, cur->dwEventState);
|
||||
stream_read_UINT32(irp->input, cur->cbAtr);
|
||||
stream_read(irp->input, cur->rgbAtr, 32);
|
||||
Stream_Read_UINT32(irp->input, cur->dwCurrentState);
|
||||
Stream_Read_UINT32(irp->input, cur->dwEventState);
|
||||
Stream_Read_UINT32(irp->input, cur->cbAtr);
|
||||
Stream_Read(irp->input, cur->rgbAtr, 32);
|
||||
|
||||
Stream_Seek(irp->input, 4);
|
||||
|
||||
@ -1263,7 +1263,7 @@ static UINT32 handle_LocateCardsByATR(IRP* irp, BOOL wide)
|
||||
UINT32 dataLength;
|
||||
|
||||
Stream_Seek(irp->input, 8);
|
||||
stream_read_UINT32(irp->input, dataLength);
|
||||
Stream_Read_UINT32(irp->input, dataLength);
|
||||
smartcard_input_repos(irp, smartcard_input_string(irp, (char **) &cur->szReader, dataLength, wide));
|
||||
|
||||
DEBUG_SCARD(" \"%s\"", cur->szReader ? cur->szReader : "NULL");
|
||||
@ -1306,18 +1306,18 @@ static UINT32 handle_LocateCardsByATR(IRP* irp, BOOL wide)
|
||||
}
|
||||
}
|
||||
|
||||
stream_write_UINT32(irp->output, readerCount);
|
||||
stream_write_UINT32(irp->output, 0x00084dd8);
|
||||
stream_write_UINT32(irp->output, readerCount);
|
||||
Stream_Write_UINT32(irp->output, readerCount);
|
||||
Stream_Write_UINT32(irp->output, 0x00084dd8);
|
||||
Stream_Write_UINT32(irp->output, readerCount);
|
||||
|
||||
for (i = 0, rsCur = readerStates; i < readerCount; i++, rsCur++)
|
||||
{
|
||||
stream_write_UINT32(irp->output, cur->dwCurrentState);
|
||||
stream_write_UINT32(irp->output, cur->dwEventState);
|
||||
stream_write_UINT32(irp->output, cur->cbAtr);
|
||||
stream_write(irp->output, cur->rgbAtr, 32);
|
||||
Stream_Write_UINT32(irp->output, cur->dwCurrentState);
|
||||
Stream_Write_UINT32(irp->output, cur->dwEventState);
|
||||
Stream_Write_UINT32(irp->output, cur->cbAtr);
|
||||
Stream_Write(irp->output, cur->rgbAtr, 32);
|
||||
|
||||
stream_write_zero(irp->output, 4);
|
||||
Stream_Write_zero(irp->output, 4);
|
||||
|
||||
free((void*) cur->szReader);
|
||||
}
|
||||
@ -1335,7 +1335,7 @@ BOOL smartcard_async_op(IRP* irp)
|
||||
|
||||
/* peek ahead */
|
||||
Stream_Seek(irp->input, 8);
|
||||
stream_read_UINT32(irp->input, ioctl_code);
|
||||
Stream_Read_UINT32(irp->input, ioctl_code);
|
||||
Stream_Rewind(irp->input, 12);
|
||||
|
||||
switch (ioctl_code)
|
||||
@ -1384,9 +1384,9 @@ void smartcard_device_control(SMARTCARD_DEVICE* scard, IRP* irp)
|
||||
|
||||
/* MS-RPCE, Sections 2.2.6.1 and 2.2.6.2. */
|
||||
|
||||
stream_read_UINT32(irp->input, output_len);
|
||||
stream_read_UINT32(irp->input, input_len);
|
||||
stream_read_UINT32(irp->input, ioctl_code);
|
||||
Stream_Read_UINT32(irp->input, output_len);
|
||||
Stream_Read_UINT32(irp->input, input_len);
|
||||
Stream_Read_UINT32(irp->input, ioctl_code);
|
||||
|
||||
Stream_Seek(irp->input, 20); /* padding */
|
||||
|
||||
@ -1399,20 +1399,20 @@ void smartcard_device_control(SMARTCARD_DEVICE* scard, IRP* irp)
|
||||
|
||||
irp_result_pos = Stream_GetPosition(irp->output);
|
||||
|
||||
stream_write_UINT32(irp->output, 0x00000000); /* MS-RDPEFS
|
||||
Stream_Write_UINT32(irp->output, 0x00000000); /* MS-RDPEFS
|
||||
* OutputBufferLength
|
||||
* will be updated
|
||||
* later in this
|
||||
* function.
|
||||
*/
|
||||
/* [MS-RPCE] 2.2.6.1 */
|
||||
stream_write_UINT32(irp->output, 0x00081001); /* len 8, LE, v1 */
|
||||
stream_write_UINT32(irp->output, 0xcccccccc); /* filler */
|
||||
Stream_Write_UINT32(irp->output, 0x00081001); /* len 8, LE, v1 */
|
||||
Stream_Write_UINT32(irp->output, 0xcccccccc); /* filler */
|
||||
|
||||
output_len_pos = Stream_GetPosition(irp->output);
|
||||
Stream_Seek(irp->output, 4); /* size */
|
||||
|
||||
stream_write_UINT32(irp->output, 0x0); /* filler */
|
||||
Stream_Write_UINT32(irp->output, 0x0); /* filler */
|
||||
|
||||
result_pos = Stream_GetPosition(irp->output);
|
||||
Stream_Seek(irp->output, 4); /* result */
|
||||
@ -1532,16 +1532,16 @@ void smartcard_device_control(SMARTCARD_DEVICE* scard, IRP* irp)
|
||||
pos = Stream_GetPosition(irp->output);
|
||||
stream_len = pos - irp_result_pos - 4; /* Value of OutputBufferLength */
|
||||
Stream_SetPosition(irp->output, irp_result_pos);
|
||||
stream_write_UINT32(irp->output, stream_len);
|
||||
Stream_Write_UINT32(irp->output, stream_len);
|
||||
|
||||
Stream_SetPosition(irp->output, output_len_pos);
|
||||
/* Remove the effect of the MS-RPCE Common Type Header and Private
|
||||
* Header (Sections 2.2.6.1 and 2.2.6.2).
|
||||
*/
|
||||
stream_write_UINT32(irp->output, stream_len - header_lengths);
|
||||
Stream_Write_UINT32(irp->output, stream_len - header_lengths);
|
||||
|
||||
Stream_SetPosition(irp->output, result_pos);
|
||||
stream_write_UINT32(irp->output, result);
|
||||
Stream_Write_UINT32(irp->output, result);
|
||||
|
||||
Stream_SetPosition(irp->output, pos);
|
||||
|
||||
|
@ -290,9 +290,9 @@ static UINT32 tsmf_codec_parse_BITMAPINFOHEADER(TS_AM_MEDIA_TYPE* mediatype, wSt
|
||||
UINT32 biWidth;
|
||||
UINT32 biHeight;
|
||||
|
||||
stream_read_UINT32(s, biSize);
|
||||
stream_read_UINT32(s, biWidth);
|
||||
stream_read_UINT32(s, biHeight);
|
||||
Stream_Read_UINT32(s, biSize);
|
||||
Stream_Read_UINT32(s, biWidth);
|
||||
Stream_Read_UINT32(s, biHeight);
|
||||
Stream_Seek(s, 28);
|
||||
|
||||
if (mediatype->Width == 0)
|
||||
@ -315,16 +315,16 @@ static UINT32 tsmf_codec_parse_VIDEOINFOHEADER2(TS_AM_MEDIA_TYPE* mediatype, wSt
|
||||
/* VIDEOINFOHEADER2.rcSource, RECT(LONG left, LONG top, LONG right, LONG bottom) */
|
||||
Stream_Seek_UINT32(s);
|
||||
Stream_Seek_UINT32(s);
|
||||
stream_read_UINT32(s, mediatype->Width);
|
||||
stream_read_UINT32(s, mediatype->Height);
|
||||
Stream_Read_UINT32(s, mediatype->Width);
|
||||
Stream_Read_UINT32(s, mediatype->Height);
|
||||
/* VIDEOINFOHEADER2.rcTarget */
|
||||
Stream_Seek(s, 16);
|
||||
/* VIDEOINFOHEADER2.dwBitRate */
|
||||
stream_read_UINT32(s, mediatype->BitRate);
|
||||
Stream_Read_UINT32(s, mediatype->BitRate);
|
||||
/* VIDEOINFOHEADER2.dwBitErrorRate */
|
||||
Stream_Seek_UINT32(s);
|
||||
/* VIDEOINFOHEADER2.AvgTimePerFrame */
|
||||
stream_read_UINT64(s, AvgTimePerFrame);
|
||||
Stream_Read_UINT64(s, AvgTimePerFrame);
|
||||
mediatype->SamplesPerSecond.Numerator = 1000000;
|
||||
mediatype->SamplesPerSecond.Denominator = (int)(AvgTimePerFrame / 10LL);
|
||||
/* Remaining fields before bmiHeader */
|
||||
@ -351,16 +351,16 @@ typedef struct tagVIDEOINFOHEADER {
|
||||
/* VIDEOINFOHEADER.rcSource, RECT(LONG left, LONG top, LONG right, LONG bottom) */
|
||||
Stream_Seek_UINT32(s);
|
||||
Stream_Seek_UINT32(s);
|
||||
stream_read_UINT32(s, mediatype->Width);
|
||||
stream_read_UINT32(s, mediatype->Height);
|
||||
Stream_Read_UINT32(s, mediatype->Width);
|
||||
Stream_Read_UINT32(s, mediatype->Height);
|
||||
/* VIDEOINFOHEADER.rcTarget */
|
||||
Stream_Seek(s, 16);
|
||||
/* VIDEOINFOHEADER.dwBitRate */
|
||||
stream_read_UINT32(s, mediatype->BitRate);
|
||||
Stream_Read_UINT32(s, mediatype->BitRate);
|
||||
/* VIDEOINFOHEADER.dwBitErrorRate */
|
||||
Stream_Seek_UINT32(s);
|
||||
/* VIDEOINFOHEADER.AvgTimePerFrame */
|
||||
stream_read_UINT64(s, AvgTimePerFrame);
|
||||
Stream_Read_UINT64(s, AvgTimePerFrame);
|
||||
mediatype->SamplesPerSecond.Numerator = 1000000;
|
||||
mediatype->SamplesPerSecond.Denominator = (int)(AvgTimePerFrame / 10LL);
|
||||
|
||||
@ -421,7 +421,7 @@ BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s)
|
||||
Stream_Seek(s, 16);
|
||||
|
||||
/* cbFormat */
|
||||
stream_read_UINT32(s, cbFormat);
|
||||
Stream_Read_UINT32(s, cbFormat);
|
||||
DEBUG_DVC("cbFormat %d", cbFormat);
|
||||
|
||||
#ifdef WITH_DEBUG_DVC
|
||||
@ -434,14 +434,14 @@ BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s)
|
||||
/* http://msdn.microsoft.com/en-us/library/aa473808.aspx */
|
||||
|
||||
Stream_Seek(s, 8); /* dwSize and ? */
|
||||
stream_read_UINT32(s, mediatype->Width); /* videoInfo.dwWidth */
|
||||
stream_read_UINT32(s, mediatype->Height); /* videoInfo.dwHeight */
|
||||
Stream_Read_UINT32(s, mediatype->Width); /* videoInfo.dwWidth */
|
||||
Stream_Read_UINT32(s, mediatype->Height); /* videoInfo.dwHeight */
|
||||
Stream_Seek(s, 32);
|
||||
/* videoInfo.FramesPerSecond */
|
||||
stream_read_UINT32(s, mediatype->SamplesPerSecond.Numerator);
|
||||
stream_read_UINT32(s, mediatype->SamplesPerSecond.Denominator);
|
||||
Stream_Read_UINT32(s, mediatype->SamplesPerSecond.Numerator);
|
||||
Stream_Read_UINT32(s, mediatype->SamplesPerSecond.Denominator);
|
||||
Stream_Seek(s, 80);
|
||||
stream_read_UINT32(s, mediatype->BitRate); /* compressedInfo.AvgBitrate */
|
||||
Stream_Read_UINT32(s, mediatype->BitRate); /* compressedInfo.AvgBitrate */
|
||||
Stream_Seek(s, 36);
|
||||
|
||||
if (cbFormat > 176)
|
||||
@ -455,14 +455,14 @@ BOOL tsmf_codec_parse_media_type(TS_AM_MEDIA_TYPE* mediatype, wStream* s)
|
||||
/* http://msdn.microsoft.com/en-us/library/dd757720.aspx */
|
||||
|
||||
Stream_Seek_UINT16(s);
|
||||
stream_read_UINT16(s, mediatype->Channels);
|
||||
stream_read_UINT32(s, mediatype->SamplesPerSecond.Numerator);
|
||||
Stream_Read_UINT16(s, mediatype->Channels);
|
||||
Stream_Read_UINT32(s, mediatype->SamplesPerSecond.Numerator);
|
||||
mediatype->SamplesPerSecond.Denominator = 1;
|
||||
stream_read_UINT32(s, mediatype->BitRate);
|
||||
Stream_Read_UINT32(s, mediatype->BitRate);
|
||||
mediatype->BitRate *= 8;
|
||||
stream_read_UINT16(s, mediatype->BlockAlign);
|
||||
stream_read_UINT16(s, mediatype->BitsPerSample);
|
||||
stream_read_UINT16(s, mediatype->ExtraDataSize);
|
||||
Stream_Read_UINT16(s, mediatype->BlockAlign);
|
||||
Stream_Read_UINT16(s, mediatype->BitsPerSample);
|
||||
Stream_Read_UINT16(s, mediatype->ExtraDataSize);
|
||||
if (mediatype->ExtraDataSize > 0)
|
||||
mediatype->ExtraData = Stream_Pointer(s);
|
||||
|
||||
|
@ -41,12 +41,12 @@ int tsmf_ifman_rim_exchange_capability_request(TSMF_IFMAN* ifman)
|
||||
{
|
||||
UINT32 CapabilityValue;
|
||||
|
||||
stream_read_UINT32(ifman->input, CapabilityValue);
|
||||
Stream_Read_UINT32(ifman->input, CapabilityValue);
|
||||
DEBUG_DVC("server CapabilityValue %d", CapabilityValue);
|
||||
|
||||
Stream_EnsureRemainingCapacity(ifman->output, 8);
|
||||
stream_write_UINT32(ifman->output, 1); /* CapabilityValue */
|
||||
stream_write_UINT32(ifman->output, 0); /* Result */
|
||||
Stream_Write_UINT32(ifman->output, 1); /* CapabilityValue */
|
||||
Stream_Write_UINT32(ifman->output, 0); /* Result */
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -65,25 +65,25 @@ int tsmf_ifman_exchange_capability_request(TSMF_IFMAN* ifman)
|
||||
stream_copy(ifman->output, ifman->input, ifman->input_size);
|
||||
|
||||
Stream_SetPosition(ifman->output, pos);
|
||||
stream_read_UINT32(ifman->output, numHostCapabilities);
|
||||
Stream_Read_UINT32(ifman->output, numHostCapabilities);
|
||||
|
||||
for (i = 0; i < numHostCapabilities; i++)
|
||||
{
|
||||
stream_read_UINT32(ifman->output, CapabilityType);
|
||||
stream_read_UINT32(ifman->output, cbCapabilityLength);
|
||||
Stream_Read_UINT32(ifman->output, CapabilityType);
|
||||
Stream_Read_UINT32(ifman->output, cbCapabilityLength);
|
||||
pos = Stream_GetPosition(ifman->output);
|
||||
|
||||
switch (CapabilityType)
|
||||
{
|
||||
case 1: /* Protocol version request */
|
||||
stream_read_UINT32(ifman->output, v);
|
||||
Stream_Read_UINT32(ifman->output, v);
|
||||
DEBUG_DVC("server protocol version %d", v);
|
||||
break;
|
||||
case 2: /* Supported platform */
|
||||
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,
|
||||
Stream_Write_UINT32(ifman->output,
|
||||
MMREDIR_CAPABILITY_PLATFORM_MF | MMREDIR_CAPABILITY_PLATFORM_DSHOW);
|
||||
break;
|
||||
default:
|
||||
@ -92,7 +92,7 @@ int tsmf_ifman_exchange_capability_request(TSMF_IFMAN* ifman)
|
||||
}
|
||||
Stream_SetPosition(ifman->output, pos + cbCapabilityLength);
|
||||
}
|
||||
stream_write_UINT32(ifman->output, 0); /* Result */
|
||||
Stream_Write_UINT32(ifman->output, 0); /* Result */
|
||||
|
||||
ifman->output_interface_id = TSMF_INTERFACE_DEFAULT | STREAM_ID_STUB;
|
||||
|
||||
@ -105,9 +105,9 @@ int tsmf_ifman_check_format_support_request(TSMF_IFMAN* ifman)
|
||||
UINT32 PlatformCookie;
|
||||
UINT32 FormatSupported = 1;
|
||||
|
||||
stream_read_UINT32(ifman->input, PlatformCookie);
|
||||
Stream_Read_UINT32(ifman->input, PlatformCookie);
|
||||
Stream_Seek_UINT32(ifman->input); /* NoRolloverFlags (4 bytes) */
|
||||
stream_read_UINT32(ifman->input, numMediaType);
|
||||
Stream_Read_UINT32(ifman->input, numMediaType);
|
||||
|
||||
DEBUG_DVC("PlatformCookie %d numMediaType %d", PlatformCookie, numMediaType);
|
||||
|
||||
@ -118,9 +118,9 @@ int tsmf_ifman_check_format_support_request(TSMF_IFMAN* ifman)
|
||||
DEBUG_DVC("format ok.");
|
||||
|
||||
Stream_EnsureRemainingCapacity(ifman->output, 12);
|
||||
stream_write_UINT32(ifman->output, FormatSupported);
|
||||
stream_write_UINT32(ifman->output, PlatformCookie);
|
||||
stream_write_UINT32(ifman->output, 0); /* Result */
|
||||
Stream_Write_UINT32(ifman->output, FormatSupported);
|
||||
Stream_Write_UINT32(ifman->output, PlatformCookie);
|
||||
Stream_Write_UINT32(ifman->output, 0); /* Result */
|
||||
|
||||
ifman->output_interface_id = TSMF_INTERFACE_DEFAULT | STREAM_ID_STUB;
|
||||
|
||||
@ -174,7 +174,7 @@ int tsmf_ifman_add_stream(TSMF_IFMAN* ifman)
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_read_UINT32(ifman->input, StreamId);
|
||||
Stream_Read_UINT32(ifman->input, StreamId);
|
||||
Stream_Seek_UINT32(ifman->input); /* numMediaType */
|
||||
stream = tsmf_stream_new(presentation, StreamId);
|
||||
|
||||
@ -192,8 +192,8 @@ int tsmf_ifman_set_topology_request(TSMF_IFMAN* ifman)
|
||||
DEBUG_DVC("");
|
||||
|
||||
Stream_EnsureRemainingCapacity(ifman->output, 8);
|
||||
stream_write_UINT32(ifman->output, 1); /* TopologyReady */
|
||||
stream_write_UINT32(ifman->output, 0); /* Result */
|
||||
Stream_Write_UINT32(ifman->output, 1); /* TopologyReady */
|
||||
Stream_Write_UINT32(ifman->output, 0); /* Result */
|
||||
ifman->output_interface_id = TSMF_INTERFACE_DEFAULT | STREAM_ID_STUB;
|
||||
|
||||
return 0;
|
||||
@ -217,7 +217,7 @@ int tsmf_ifman_remove_stream(TSMF_IFMAN* ifman)
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_read_UINT32(ifman->input, StreamId);
|
||||
Stream_Read_UINT32(ifman->input, StreamId);
|
||||
stream = tsmf_stream_find_by_id(presentation, StreamId);
|
||||
if (stream)
|
||||
tsmf_stream_free(stream);
|
||||
@ -244,7 +244,7 @@ int tsmf_ifman_shutdown_presentation(TSMF_IFMAN* ifman)
|
||||
pexisted = 0;
|
||||
|
||||
Stream_EnsureRemainingCapacity(ifman->output, 4);
|
||||
stream_write_UINT32(ifman->output, 0); /* Result */
|
||||
Stream_Write_UINT32(ifman->output, 0); /* Result */
|
||||
ifman->output_interface_id = TSMF_INTERFACE_DEFAULT | STREAM_ID_STUB;
|
||||
|
||||
return 0;
|
||||
@ -264,9 +264,9 @@ int tsmf_ifman_on_stream_volume(TSMF_IFMAN* ifman)
|
||||
UINT32 muted;
|
||||
|
||||
Stream_Seek(ifman->input, 16);
|
||||
stream_read_UINT32(ifman->input, newVolume);
|
||||
Stream_Read_UINT32(ifman->input, newVolume);
|
||||
DEBUG_DVC("on stream volume: new volume=[%d]", newVolume);
|
||||
stream_read_UINT32(ifman->input, muted);
|
||||
Stream_Read_UINT32(ifman->input, muted);
|
||||
DEBUG_DVC("on stream volume: muted=[%d]", muted);
|
||||
tsmf_presentation_volume_changed(presentation, newVolume, muted);
|
||||
}
|
||||
@ -294,9 +294,9 @@ int tsmf_ifman_on_channel_volume(TSMF_IFMAN* ifman)
|
||||
UINT32 changedChannel;
|
||||
|
||||
Stream_Seek(ifman->input, 16);
|
||||
stream_read_UINT32(ifman->input, channelVolume);
|
||||
Stream_Read_UINT32(ifman->input, channelVolume);
|
||||
DEBUG_DVC("on channel volume: channel volume=[%d]", channelVolume);
|
||||
stream_read_UINT32(ifman->input, changedChannel);
|
||||
Stream_Read_UINT32(ifman->input, changedChannel);
|
||||
DEBUG_DVC("on stream volume: changed channel=[%d]", changedChannel);
|
||||
}
|
||||
|
||||
@ -330,17 +330,17 @@ int tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman)
|
||||
presentation = tsmf_presentation_find_by_id(Stream_Pointer(ifman->input));
|
||||
Stream_Seek(ifman->input, 16);
|
||||
|
||||
stream_read_UINT32(ifman->input, numGeometryInfo);
|
||||
Stream_Read_UINT32(ifman->input, numGeometryInfo);
|
||||
pos = Stream_GetPosition(ifman->input);
|
||||
|
||||
Stream_Seek(ifman->input, 12); /* VideoWindowId (8 bytes), VideoWindowState (4 bytes) */
|
||||
stream_read_UINT32(ifman->input, Width);
|
||||
stream_read_UINT32(ifman->input, Height);
|
||||
stream_read_UINT32(ifman->input, Left);
|
||||
stream_read_UINT32(ifman->input, Top);
|
||||
Stream_Read_UINT32(ifman->input, Width);
|
||||
Stream_Read_UINT32(ifman->input, Height);
|
||||
Stream_Read_UINT32(ifman->input, Left);
|
||||
Stream_Read_UINT32(ifman->input, Top);
|
||||
|
||||
Stream_SetPosition(ifman->input, pos + numGeometryInfo);
|
||||
stream_read_UINT32(ifman->input, cbVisibleRect);
|
||||
Stream_Read_UINT32(ifman->input, cbVisibleRect);
|
||||
num_rects = cbVisibleRect / 16;
|
||||
|
||||
DEBUG_DVC("numGeometryInfo %d Width %d Height %d Left %d Top %d cbVisibleRect %d num_rects %d",
|
||||
@ -359,13 +359,13 @@ int tsmf_ifman_update_geometry_info(TSMF_IFMAN* ifman)
|
||||
|
||||
for (i = 0; i < num_rects; i++)
|
||||
{
|
||||
stream_read_UINT16(ifman->input, rects[i].y); /* Top */
|
||||
Stream_Read_UINT16(ifman->input, rects[i].y); /* Top */
|
||||
Stream_Seek_UINT16(ifman->input);
|
||||
stream_read_UINT16(ifman->input, rects[i].x); /* Left */
|
||||
Stream_Read_UINT16(ifman->input, rects[i].x); /* Left */
|
||||
Stream_Seek_UINT16(ifman->input);
|
||||
stream_read_UINT16(ifman->input, rects[i].height); /* Bottom */
|
||||
Stream_Read_UINT16(ifman->input, rects[i].height); /* Bottom */
|
||||
Stream_Seek_UINT16(ifman->input);
|
||||
stream_read_UINT16(ifman->input, rects[i].width); /* Right */
|
||||
Stream_Read_UINT16(ifman->input, rects[i].width); /* Right */
|
||||
Stream_Seek_UINT16(ifman->input);
|
||||
rects[i].width -= rects[i].x;
|
||||
rects[i].height -= rects[i].y;
|
||||
@ -408,14 +408,14 @@ int tsmf_ifman_on_sample(TSMF_IFMAN* ifman)
|
||||
UINT32 cbData;
|
||||
|
||||
Stream_Seek(ifman->input, 16);
|
||||
stream_read_UINT32(ifman->input, StreamId);
|
||||
Stream_Read_UINT32(ifman->input, StreamId);
|
||||
Stream_Seek_UINT32(ifman->input); /* numSample */
|
||||
stream_read_UINT64(ifman->input, SampleStartTime);
|
||||
stream_read_UINT64(ifman->input, SampleEndTime);
|
||||
stream_read_UINT64(ifman->input, ThrottleDuration);
|
||||
Stream_Read_UINT64(ifman->input, SampleStartTime);
|
||||
Stream_Read_UINT64(ifman->input, SampleEndTime);
|
||||
Stream_Read_UINT64(ifman->input, ThrottleDuration);
|
||||
Stream_Seek_UINT32(ifman->input); /* SampleFlags */
|
||||
stream_read_UINT32(ifman->input, SampleExtensions);
|
||||
stream_read_UINT32(ifman->input, cbData);
|
||||
Stream_Read_UINT32(ifman->input, SampleExtensions);
|
||||
Stream_Read_UINT32(ifman->input, cbData);
|
||||
|
||||
DEBUG_DVC("MessageId %d StreamId %d SampleStartTime %d SampleEndTime %d "
|
||||
"ThrottleDuration %d SampleExtensions %d cbData %d",
|
||||
@ -453,7 +453,7 @@ int tsmf_ifman_on_flush(TSMF_IFMAN* ifman)
|
||||
TSMF_PRESENTATION* presentation;
|
||||
|
||||
Stream_Seek(ifman->input, 16);
|
||||
stream_read_UINT32(ifman->input, StreamId);
|
||||
Stream_Read_UINT32(ifman->input, StreamId);
|
||||
DEBUG_DVC("StreamId %d", StreamId);
|
||||
|
||||
presentation = tsmf_presentation_find_by_id(ifman->presentation_id);
|
||||
@ -479,7 +479,7 @@ int tsmf_ifman_on_end_of_stream(TSMF_IFMAN* ifman)
|
||||
|
||||
presentation = tsmf_presentation_find_by_id(Stream_Pointer(ifman->input));
|
||||
Stream_Seek(ifman->input, 16);
|
||||
stream_read_UINT32(ifman->input, StreamId);
|
||||
Stream_Read_UINT32(ifman->input, StreamId);
|
||||
|
||||
if (presentation)
|
||||
{
|
||||
@ -490,10 +490,10 @@ int tsmf_ifman_on_end_of_stream(TSMF_IFMAN* ifman)
|
||||
DEBUG_DVC("StreamId %d", StreamId);
|
||||
|
||||
Stream_EnsureRemainingCapacity(ifman->output, 16);
|
||||
stream_write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */
|
||||
stream_write_UINT32(ifman->output, StreamId); /* StreamId */
|
||||
stream_write_UINT32(ifman->output, TSMM_CLIENT_EVENT_ENDOFSTREAM); /* EventId */
|
||||
stream_write_UINT32(ifman->output, 0); /* cbData */
|
||||
Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */
|
||||
Stream_Write_UINT32(ifman->output, StreamId); /* StreamId */
|
||||
Stream_Write_UINT32(ifman->output, TSMM_CLIENT_EVENT_ENDOFSTREAM); /* EventId */
|
||||
Stream_Write_UINT32(ifman->output, 0); /* cbData */
|
||||
ifman->output_interface_id = TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY;
|
||||
|
||||
return 0;
|
||||
@ -513,10 +513,10 @@ int tsmf_ifman_on_playback_started(TSMF_IFMAN* ifman)
|
||||
DEBUG_WARN("unknown presentation id");
|
||||
|
||||
Stream_EnsureRemainingCapacity(ifman->output, 16);
|
||||
stream_write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */
|
||||
stream_write_UINT32(ifman->output, 0); /* StreamId */
|
||||
stream_write_UINT32(ifman->output, TSMM_CLIENT_EVENT_START_COMPLETED); /* EventId */
|
||||
stream_write_UINT32(ifman->output, 0); /* cbData */
|
||||
Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */
|
||||
Stream_Write_UINT32(ifman->output, 0); /* StreamId */
|
||||
Stream_Write_UINT32(ifman->output, TSMM_CLIENT_EVENT_START_COMPLETED); /* EventId */
|
||||
Stream_Write_UINT32(ifman->output, 0); /* cbData */
|
||||
ifman->output_interface_id = TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY;
|
||||
|
||||
return 0;
|
||||
@ -574,10 +574,10 @@ int tsmf_ifman_on_playback_stopped(TSMF_IFMAN* ifman)
|
||||
DEBUG_WARN("unknown presentation id");
|
||||
|
||||
Stream_EnsureRemainingCapacity(ifman->output, 16);
|
||||
stream_write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */
|
||||
stream_write_UINT32(ifman->output, 0); /* StreamId */
|
||||
stream_write_UINT32(ifman->output, TSMM_CLIENT_EVENT_STOP_COMPLETED); /* EventId */
|
||||
stream_write_UINT32(ifman->output, 0); /* cbData */
|
||||
Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */
|
||||
Stream_Write_UINT32(ifman->output, 0); /* StreamId */
|
||||
Stream_Write_UINT32(ifman->output, TSMM_CLIENT_EVENT_STOP_COMPLETED); /* EventId */
|
||||
Stream_Write_UINT32(ifman->output, 0); /* cbData */
|
||||
ifman->output_interface_id = TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY;
|
||||
|
||||
return 0;
|
||||
@ -588,10 +588,10 @@ int tsmf_ifman_on_playback_rate_changed(TSMF_IFMAN * ifman)
|
||||
DEBUG_DVC("");
|
||||
|
||||
Stream_EnsureRemainingCapacity(ifman->output, 16);
|
||||
stream_write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */
|
||||
stream_write_UINT32(ifman->output, 0); /* StreamId */
|
||||
stream_write_UINT32(ifman->output, TSMM_CLIENT_EVENT_MONITORCHANGED); /* EventId */
|
||||
stream_write_UINT32(ifman->output, 0); /* cbData */
|
||||
Stream_Write_UINT32(ifman->output, CLIENT_EVENT_NOTIFICATION); /* FunctionId */
|
||||
Stream_Write_UINT32(ifman->output, 0); /* StreamId */
|
||||
Stream_Write_UINT32(ifman->output, TSMM_CLIENT_EVENT_MONITORCHANGED); /* EventId */
|
||||
Stream_Write_UINT32(ifman->output, 0); /* cbData */
|
||||
ifman->output_interface_id = TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY;
|
||||
|
||||
return 0;
|
||||
|
@ -82,12 +82,12 @@ void tsmf_playback_ack(IWTSVirtualChannelCallback* pChannelCallback,
|
||||
TSMF_CHANNEL_CALLBACK* callback = (TSMF_CHANNEL_CALLBACK*) pChannelCallback;
|
||||
|
||||
s = stream_new(32);
|
||||
stream_write_UINT32(s, TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY);
|
||||
stream_write_UINT32(s, message_id);
|
||||
stream_write_UINT32(s, PLAYBACK_ACK); /* FunctionId */
|
||||
stream_write_UINT32(s, callback->stream_id); /* StreamId */
|
||||
stream_write_UINT64(s, duration); /* DataDuration */
|
||||
stream_write_UINT64(s, data_size); /* cbData */
|
||||
Stream_Write_UINT32(s, TSMF_INTERFACE_CLIENT_NOTIFICATIONS | STREAM_ID_PROXY);
|
||||
Stream_Write_UINT32(s, message_id);
|
||||
Stream_Write_UINT32(s, PLAYBACK_ACK); /* FunctionId */
|
||||
Stream_Write_UINT32(s, callback->stream_id); /* StreamId */
|
||||
Stream_Write_UINT64(s, duration); /* DataDuration */
|
||||
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);
|
||||
@ -141,9 +141,9 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
|
||||
output = stream_new(256);
|
||||
Stream_Seek(output, 8);
|
||||
|
||||
stream_read_UINT32(input, InterfaceId);
|
||||
stream_read_UINT32(input, MessageId);
|
||||
stream_read_UINT32(input, FunctionId);
|
||||
Stream_Read_UINT32(input, InterfaceId);
|
||||
Stream_Read_UINT32(input, MessageId);
|
||||
Stream_Read_UINT32(input, FunctionId);
|
||||
DEBUG_DVC("cbSize=%d InterfaceId=0x%X MessageId=0x%X FunctionId=0x%X",
|
||||
cbSize, InterfaceId, MessageId, FunctionId);
|
||||
|
||||
@ -183,7 +183,7 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
|
||||
case SET_CHANNEL_PARAMS:
|
||||
memcpy(callback->presentation_id, Stream_Pointer(input), 16);
|
||||
Stream_Seek(input, 16);
|
||||
stream_read_UINT32(input, callback->stream_id);
|
||||
Stream_Read_UINT32(input, callback->stream_id);
|
||||
DEBUG_DVC("SET_CHANNEL_PARAMS StreamId=%d", callback->stream_id);
|
||||
ifman.output_pending = TRUE;
|
||||
status = 0;
|
||||
@ -319,8 +319,8 @@ static int tsmf_on_data_received(IWTSVirtualChannelCallback* pChannelCallback,
|
||||
/* Response packet does not have FunctionId */
|
||||
length = Stream_GetPosition(output);
|
||||
Stream_SetPosition(output, 0);
|
||||
stream_write_UINT32(output, ifman.output_interface_id);
|
||||
stream_write_UINT32(output, MessageId);
|
||||
Stream_Write_UINT32(output, ifman.output_interface_id);
|
||||
Stream_Write_UINT32(output, MessageId);
|
||||
|
||||
DEBUG_DVC("response size %d", length);
|
||||
status = callback->channel->Write(callback->channel, length, stream_get_head(output), NULL);
|
||||
|
@ -931,8 +931,8 @@ static void xf_cliprdr_process_dib(clipboardContext* cb, BYTE* data, int size)
|
||||
s = stream_new(0);
|
||||
stream_attach(s, data, size);
|
||||
Stream_Seek(s, 14);
|
||||
stream_read_UINT16(s, bpp);
|
||||
stream_read_UINT32(s, ncolors);
|
||||
Stream_Read_UINT16(s, bpp);
|
||||
Stream_Read_UINT32(s, ncolors);
|
||||
offset = 14 + 40 + (bpp <= 8 ? (ncolors == 0 ? (1 << bpp) : ncolors) * 4 : 0);
|
||||
stream_detach(s);
|
||||
stream_free(s);
|
||||
@ -940,12 +940,12 @@ static void xf_cliprdr_process_dib(clipboardContext* cb, BYTE* data, int size)
|
||||
DEBUG_X11_CLIPRDR("offset=%d bpp=%d ncolors=%d", offset, bpp, ncolors);
|
||||
|
||||
s = stream_new(14 + size);
|
||||
stream_write_BYTE(s, 'B');
|
||||
stream_write_BYTE(s, 'M');
|
||||
stream_write_UINT32(s, 14 + size);
|
||||
stream_write_UINT32(s, 0);
|
||||
stream_write_UINT32(s, offset);
|
||||
stream_write(s, data, size);
|
||||
Stream_Write_UINT8(s, 'B');
|
||||
Stream_Write_UINT8(s, 'M');
|
||||
Stream_Write_UINT32(s, 14 + size);
|
||||
Stream_Write_UINT32(s, 0);
|
||||
Stream_Write_UINT32(s, offset);
|
||||
Stream_Write(s, data, size);
|
||||
|
||||
cb->data = stream_get_head(s);
|
||||
cb->data_length = Stream_GetPosition(s);
|
||||
|
@ -307,9 +307,9 @@ void test_decode(void)
|
||||
wStream* s;
|
||||
|
||||
s = stream_new(sizeof(y_data) + sizeof(cb_data) + sizeof(cr_data));
|
||||
stream_write(s, y_data, sizeof(y_data));
|
||||
stream_write(s, cb_data, sizeof(cb_data));
|
||||
stream_write(s, cr_data, sizeof(cr_data));
|
||||
Stream_Write(s, y_data, sizeof(y_data));
|
||||
Stream_Write(s, cb_data, sizeof(cb_data));
|
||||
Stream_Write(s, cr_data, sizeof(cr_data));
|
||||
Stream_SetPosition(s, 0);
|
||||
|
||||
context = rfx_context_new();
|
||||
|
@ -174,10 +174,10 @@ static void nsc_stream_initialize(NSC_CONTEXT* context, wStream* s)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
stream_read_UINT32(s, context->nsc_stream.PlaneByteCount[i]);
|
||||
Stream_Read_UINT32(s, context->nsc_stream.PlaneByteCount[i]);
|
||||
|
||||
stream_read_BYTE(s, context->nsc_stream.ColorLossLevel);
|
||||
stream_read_BYTE(s, context->nsc_stream.ChromaSubSamplingLevel);
|
||||
Stream_Read_UINT8(s, context->nsc_stream.ColorLossLevel);
|
||||
Stream_Read_UINT8(s, context->nsc_stream.ChromaSubSamplingLevel);
|
||||
Stream_Seek(s, 2);
|
||||
|
||||
context->nsc_stream.Planes = Stream_Pointer(s);
|
||||
|
@ -350,20 +350,20 @@ void nsc_compose_message(NSC_CONTEXT* context, wStream* s,
|
||||
|
||||
/* Assemble the NSCodec message into stream */
|
||||
Stream_EnsureRemainingCapacity(s, 20);
|
||||
stream_write_UINT32(s, context->nsc_stream.PlaneByteCount[0]); /* LumaPlaneByteCount (4 bytes) */
|
||||
stream_write_UINT32(s, context->nsc_stream.PlaneByteCount[1]); /* OrangeChromaPlaneByteCount (4 bytes) */
|
||||
stream_write_UINT32(s, context->nsc_stream.PlaneByteCount[2]); /* GreenChromaPlaneByteCount (4 bytes) */
|
||||
stream_write_UINT32(s, context->nsc_stream.PlaneByteCount[3]); /* AlphaPlaneByteCount (4 bytes) */
|
||||
stream_write_BYTE(s, context->nsc_stream.ColorLossLevel); /* ColorLossLevel (1 byte) */
|
||||
stream_write_BYTE(s, context->nsc_stream.ChromaSubSamplingLevel); /* ChromaSubsamplingLevel (1 byte) */
|
||||
stream_write_UINT16(s, 0); /* Reserved (2 bytes) */
|
||||
Stream_Write_UINT32(s, context->nsc_stream.PlaneByteCount[0]); /* LumaPlaneByteCount (4 bytes) */
|
||||
Stream_Write_UINT32(s, context->nsc_stream.PlaneByteCount[1]); /* OrangeChromaPlaneByteCount (4 bytes) */
|
||||
Stream_Write_UINT32(s, context->nsc_stream.PlaneByteCount[2]); /* GreenChromaPlaneByteCount (4 bytes) */
|
||||
Stream_Write_UINT32(s, context->nsc_stream.PlaneByteCount[3]); /* AlphaPlaneByteCount (4 bytes) */
|
||||
Stream_Write_UINT8(s, context->nsc_stream.ColorLossLevel); /* ColorLossLevel (1 byte) */
|
||||
Stream_Write_UINT8(s, context->nsc_stream.ChromaSubSamplingLevel); /* ChromaSubsamplingLevel (1 byte) */
|
||||
Stream_Write_UINT16(s, 0); /* Reserved (2 bytes) */
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (context->nsc_stream.PlaneByteCount[i] > 0)
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(s, (int) context->nsc_stream.PlaneByteCount[i]);
|
||||
stream_write(s, context->priv->plane_buf[i], context->nsc_stream.PlaneByteCount[i]);
|
||||
Stream_Write(s, context->priv->plane_buf[i], context->nsc_stream.PlaneByteCount[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ static BOOL rfx_process_message_sync(RFX_CONTEXT* context, wStream* s)
|
||||
DEBUG_WARN("RfxSync packet too small");
|
||||
return FALSE;
|
||||
}
|
||||
stream_read_UINT32(s, magic); /* magic (4 bytes), 0xCACCACCA */
|
||||
Stream_Read_UINT32(s, magic); /* magic (4 bytes), 0xCACCACCA */
|
||||
|
||||
if (magic != WF_MAGIC)
|
||||
{
|
||||
@ -343,7 +343,7 @@ static BOOL rfx_process_message_sync(RFX_CONTEXT* context, wStream* s)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_UINT16(s, context->version); /* version (2 bytes), WF_VERSION_1_0 (0x0100) */
|
||||
Stream_Read_UINT16(s, context->version); /* version (2 bytes), WF_VERSION_1_0 (0x0100) */
|
||||
|
||||
if (context->version != WF_VERSION_1_0)
|
||||
{
|
||||
@ -364,7 +364,7 @@ static BOOL rfx_process_message_codec_versions(RFX_CONTEXT* context, wStream* s)
|
||||
DEBUG_WARN("RfxCodecVersion packet too small");
|
||||
return FALSE;
|
||||
}
|
||||
stream_read_BYTE(s, numCodecs); /* numCodecs (1 byte), must be set to 0x01 */
|
||||
Stream_Read_UINT8(s, numCodecs); /* numCodecs (1 byte), must be set to 0x01 */
|
||||
|
||||
if (numCodecs != 1)
|
||||
{
|
||||
@ -379,8 +379,8 @@ static BOOL rfx_process_message_codec_versions(RFX_CONTEXT* context, wStream* s)
|
||||
}
|
||||
|
||||
/* RFX_CODEC_VERSIONT */
|
||||
stream_read_BYTE(s, context->codec_id); /* codecId (1 byte) */
|
||||
stream_read_BYTE(s, context->codec_version); /* version (2 bytes) */
|
||||
Stream_Read_UINT8(s, context->codec_id); /* codecId (1 byte) */
|
||||
Stream_Read_UINT8(s, context->codec_version); /* version (2 bytes) */
|
||||
|
||||
DEBUG_RFX("id %d version 0x%X.", context->codec_id, context->codec_version);
|
||||
return TRUE;
|
||||
@ -397,7 +397,7 @@ static BOOL rfx_process_message_channels(RFX_CONTEXT* context, wStream* s)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_BYTE(s, numChannels); /* numChannels (1 byte), must bet set to 0x01 */
|
||||
Stream_Read_UINT8(s, numChannels); /* numChannels (1 byte), must bet set to 0x01 */
|
||||
|
||||
/* In RDVH sessions, numChannels will represent the number of virtual monitors
|
||||
* configured and does not always be set to 0x01 as [MS-RDPRFX] said.
|
||||
@ -415,9 +415,9 @@ static BOOL rfx_process_message_channels(RFX_CONTEXT* context, wStream* s)
|
||||
}
|
||||
|
||||
/* RFX_CHANNELT */
|
||||
stream_read_BYTE(s, channelId); /* channelId (1 byte) */
|
||||
stream_read_UINT16(s, context->width); /* width (2 bytes) */
|
||||
stream_read_UINT16(s, context->height); /* height (2 bytes) */
|
||||
Stream_Read_UINT8(s, channelId); /* channelId (1 byte) */
|
||||
Stream_Read_UINT16(s, context->width); /* width (2 bytes) */
|
||||
Stream_Read_UINT16(s, context->height); /* height (2 bytes) */
|
||||
|
||||
/* Now, only the first monitor can be used, therefore the other channels will be ignored. */
|
||||
Stream_Seek(s, 5 * (numChannels - 1));
|
||||
@ -439,9 +439,9 @@ static BOOL rfx_process_message_context(RFX_CONTEXT* context, wStream* s)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_BYTE(s, ctxId); /* ctxId (1 byte), must be set to 0x00 */
|
||||
stream_read_UINT16(s, tileSize); /* tileSize (2 bytes), must be set to CT_TILE_64x64 (0x0040) */
|
||||
stream_read_UINT16(s, properties); /* properties (2 bytes) */
|
||||
Stream_Read_UINT8(s, ctxId); /* ctxId (1 byte), must be set to 0x00 */
|
||||
Stream_Read_UINT16(s, tileSize); /* tileSize (2 bytes), must be set to CT_TILE_64x64 (0x0040) */
|
||||
Stream_Read_UINT16(s, properties); /* properties (2 bytes) */
|
||||
|
||||
DEBUG_RFX("ctxId %d tileSize %d properties 0x%X.", ctxId, tileSize, properties);
|
||||
|
||||
@ -482,8 +482,8 @@ static BOOL rfx_process_message_frame_begin(RFX_CONTEXT* context, RFX_MESSAGE* m
|
||||
DEBUG_WARN("RfxMessageFrameBegin packet too small");
|
||||
return FALSE;
|
||||
}
|
||||
stream_read_UINT32(s, frameIdx); /* frameIdx (4 bytes), if codec is in video mode, must be ignored */
|
||||
stream_read_UINT16(s, numRegions); /* numRegions (2 bytes) */
|
||||
Stream_Read_UINT32(s, frameIdx); /* frameIdx (4 bytes), if codec is in video mode, must be ignored */
|
||||
Stream_Read_UINT16(s, numRegions); /* numRegions (2 bytes) */
|
||||
|
||||
DEBUG_RFX("RFX_FRAME_BEGIN: frameIdx:%d numRegions:%d", frameIdx, numRegions);
|
||||
return TRUE;
|
||||
@ -505,7 +505,7 @@ static BOOL rfx_process_message_region(RFX_CONTEXT* context, RFX_MESSAGE* messag
|
||||
}
|
||||
|
||||
Stream_Seek_BYTE(s); /* regionFlags (1 byte) */
|
||||
stream_read_UINT16(s, message->num_rects); /* numRects (2 bytes) */
|
||||
Stream_Read_UINT16(s, message->num_rects); /* numRects (2 bytes) */
|
||||
|
||||
if (message->num_rects < 1)
|
||||
{
|
||||
@ -528,10 +528,10 @@ static BOOL rfx_process_message_region(RFX_CONTEXT* context, RFX_MESSAGE* messag
|
||||
for (i = 0; i < message->num_rects; i++)
|
||||
{
|
||||
/* RFX_RECT */
|
||||
stream_read_UINT16(s, message->rects[i].x); /* x (2 bytes) */
|
||||
stream_read_UINT16(s, message->rects[i].y); /* y (2 bytes) */
|
||||
stream_read_UINT16(s, message->rects[i].width); /* width (2 bytes) */
|
||||
stream_read_UINT16(s, message->rects[i].height); /* height (2 bytes) */
|
||||
Stream_Read_UINT16(s, message->rects[i].x); /* x (2 bytes) */
|
||||
Stream_Read_UINT16(s, message->rects[i].y); /* y (2 bytes) */
|
||||
Stream_Read_UINT16(s, message->rects[i].width); /* width (2 bytes) */
|
||||
Stream_Read_UINT16(s, message->rects[i].height); /* height (2 bytes) */
|
||||
|
||||
DEBUG_RFX("rect %d (%d %d %d %d).",
|
||||
i, message->rects[i].x, message->rects[i].y, message->rects[i].width, message->rects[i].height);
|
||||
@ -554,14 +554,14 @@ static BOOL rfx_process_message_tile(RFX_CONTEXT* context, RFX_TILE* tile, wStre
|
||||
}
|
||||
|
||||
/* RFX_TILE */
|
||||
stream_read_BYTE(s, quantIdxY); /* quantIdxY (1 byte) */
|
||||
stream_read_BYTE(s, quantIdxCb); /* quantIdxCb (1 byte) */
|
||||
stream_read_BYTE(s, quantIdxCr); /* quantIdxCr (1 byte) */
|
||||
stream_read_UINT16(s, xIdx); /* xIdx (2 bytes) */
|
||||
stream_read_UINT16(s, yIdx); /* yIdx (2 bytes) */
|
||||
stream_read_UINT16(s, YLen); /* YLen (2 bytes) */
|
||||
stream_read_UINT16(s, CbLen); /* CbLen (2 bytes) */
|
||||
stream_read_UINT16(s, CrLen); /* CrLen (2 bytes) */
|
||||
Stream_Read_UINT8(s, quantIdxY); /* quantIdxY (1 byte) */
|
||||
Stream_Read_UINT8(s, quantIdxCb); /* quantIdxCb (1 byte) */
|
||||
Stream_Read_UINT8(s, quantIdxCr); /* quantIdxCr (1 byte) */
|
||||
Stream_Read_UINT16(s, xIdx); /* xIdx (2 bytes) */
|
||||
Stream_Read_UINT16(s, yIdx); /* yIdx (2 bytes) */
|
||||
Stream_Read_UINT16(s, YLen); /* YLen (2 bytes) */
|
||||
Stream_Read_UINT16(s, CbLen); /* CbLen (2 bytes) */
|
||||
Stream_Read_UINT16(s, CrLen); /* CrLen (2 bytes) */
|
||||
|
||||
DEBUG_RFX("quantIdxY:%d quantIdxCb:%d quantIdxCr:%d xIdx:%d yIdx:%d YLen:%d CbLen:%d CrLen:%d",
|
||||
quantIdxY, quantIdxCb, quantIdxCr, xIdx, yIdx, YLen, CbLen, CrLen);
|
||||
@ -609,7 +609,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_UINT16(s, subtype); /* subtype (2 bytes) must be set to CBT_TILESET (0xCAC2) */
|
||||
Stream_Read_UINT16(s, subtype); /* subtype (2 bytes) must be set to CBT_TILESET (0xCAC2) */
|
||||
|
||||
if (subtype != CBT_TILESET)
|
||||
{
|
||||
@ -620,7 +620,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
|
||||
Stream_Seek_UINT16(s); /* idx (2 bytes), must be set to 0x0000 */
|
||||
Stream_Seek_UINT16(s); /* properties (2 bytes) */
|
||||
|
||||
stream_read_BYTE(s, context->num_quants); /* numQuant (1 byte) */
|
||||
Stream_Read_UINT8(s, context->num_quants); /* numQuant (1 byte) */
|
||||
Stream_Seek_BYTE(s); /* tileSize (1 byte), must be set to 0x40 */
|
||||
|
||||
if (context->num_quants < 1)
|
||||
@ -629,7 +629,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
stream_read_UINT16(s, message->num_tiles); /* numTiles (2 bytes) */
|
||||
Stream_Read_UINT16(s, message->num_tiles); /* numTiles (2 bytes) */
|
||||
|
||||
if (message->num_tiles < 1)
|
||||
{
|
||||
@ -637,7 +637,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
stream_read_UINT32(s, tilesDataSize); /* tilesDataSize (4 bytes) */
|
||||
Stream_Read_UINT32(s, tilesDataSize); /* tilesDataSize (4 bytes) */
|
||||
|
||||
if (context->quants != NULL)
|
||||
context->quants = (UINT32*) realloc((void*) context->quants, context->num_quants * 10 * sizeof(UINT32));
|
||||
@ -655,19 +655,19 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
|
||||
for (i = 0; i < context->num_quants; i++)
|
||||
{
|
||||
/* RFX_CODEC_QUANT */
|
||||
stream_read_BYTE(s, quant);
|
||||
Stream_Read_UINT8(s, quant);
|
||||
*quants++ = (quant & 0x0F);
|
||||
*quants++ = (quant >> 4);
|
||||
stream_read_BYTE(s, quant);
|
||||
Stream_Read_UINT8(s, quant);
|
||||
*quants++ = (quant & 0x0F);
|
||||
*quants++ = (quant >> 4);
|
||||
stream_read_BYTE(s, quant);
|
||||
Stream_Read_UINT8(s, quant);
|
||||
*quants++ = (quant & 0x0F);
|
||||
*quants++ = (quant >> 4);
|
||||
stream_read_BYTE(s, quant);
|
||||
Stream_Read_UINT8(s, quant);
|
||||
*quants++ = (quant & 0x0F);
|
||||
*quants++ = (quant >> 4);
|
||||
stream_read_BYTE(s, quant);
|
||||
Stream_Read_UINT8(s, quant);
|
||||
*quants++ = (quant & 0x0F);
|
||||
*quants++ = (quant >> 4);
|
||||
|
||||
@ -698,8 +698,8 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_UINT16(s, blockType); /* blockType (2 bytes), must be set to CBT_TILE (0xCAC3) */
|
||||
stream_read_UINT32(s, blockLen); /* blockLen (4 bytes) */
|
||||
Stream_Read_UINT16(s, blockType); /* blockType (2 bytes), must be set to CBT_TILE (0xCAC3) */
|
||||
Stream_Read_UINT32(s, blockLen); /* blockLen (4 bytes) */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < blockLen - 6)
|
||||
{
|
||||
@ -764,8 +764,8 @@ RFX_MESSAGE* rfx_process_message(RFX_CONTEXT* context, BYTE* data, UINT32 length
|
||||
while (Stream_GetRemainingLength(s) > 6)
|
||||
{
|
||||
/* RFX_BLOCKT */
|
||||
stream_read_UINT16(s, blockType); /* blockType (2 bytes) */
|
||||
stream_read_UINT32(s, blockLen); /* blockLen (4 bytes) */
|
||||
Stream_Read_UINT16(s, blockType); /* blockType (2 bytes) */
|
||||
Stream_Read_UINT32(s, blockLen); /* blockLen (4 bytes) */
|
||||
|
||||
DEBUG_RFX("blockType 0x%X blockLen %d", blockType, blockLen);
|
||||
|
||||
@ -886,41 +886,41 @@ void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message)
|
||||
|
||||
static void rfx_compose_message_sync(RFX_CONTEXT* context, wStream* s)
|
||||
{
|
||||
stream_write_UINT16(s, WBT_SYNC); /* BlockT.blockType */
|
||||
stream_write_UINT32(s, 12); /* BlockT.blockLen */
|
||||
stream_write_UINT32(s, WF_MAGIC); /* magic */
|
||||
stream_write_UINT16(s, WF_VERSION_1_0); /* version */
|
||||
Stream_Write_UINT16(s, WBT_SYNC); /* BlockT.blockType */
|
||||
Stream_Write_UINT32(s, 12); /* BlockT.blockLen */
|
||||
Stream_Write_UINT32(s, WF_MAGIC); /* magic */
|
||||
Stream_Write_UINT16(s, WF_VERSION_1_0); /* version */
|
||||
}
|
||||
|
||||
static void rfx_compose_message_codec_versions(RFX_CONTEXT* context, wStream* s)
|
||||
{
|
||||
stream_write_UINT16(s, WBT_CODEC_VERSIONS); /* BlockT.blockType */
|
||||
stream_write_UINT32(s, 10); /* BlockT.blockLen */
|
||||
stream_write_BYTE(s, 1); /* numCodecs */
|
||||
stream_write_BYTE(s, 1); /* codecs.codecId */
|
||||
stream_write_UINT16(s, WF_VERSION_1_0); /* codecs.version */
|
||||
Stream_Write_UINT16(s, WBT_CODEC_VERSIONS); /* BlockT.blockType */
|
||||
Stream_Write_UINT32(s, 10); /* BlockT.blockLen */
|
||||
Stream_Write_UINT8(s, 1); /* numCodecs */
|
||||
Stream_Write_UINT8(s, 1); /* codecs.codecId */
|
||||
Stream_Write_UINT16(s, WF_VERSION_1_0); /* codecs.version */
|
||||
}
|
||||
|
||||
static void rfx_compose_message_channels(RFX_CONTEXT* context, wStream* s)
|
||||
{
|
||||
stream_write_UINT16(s, WBT_CHANNELS); /* BlockT.blockType */
|
||||
stream_write_UINT32(s, 12); /* BlockT.blockLen */
|
||||
stream_write_BYTE(s, 1); /* numChannels */
|
||||
stream_write_BYTE(s, 0); /* Channel.channelId */
|
||||
stream_write_UINT16(s, context->width); /* Channel.width */
|
||||
stream_write_UINT16(s, context->height); /* Channel.height */
|
||||
Stream_Write_UINT16(s, WBT_CHANNELS); /* BlockT.blockType */
|
||||
Stream_Write_UINT32(s, 12); /* BlockT.blockLen */
|
||||
Stream_Write_UINT8(s, 1); /* numChannels */
|
||||
Stream_Write_UINT8(s, 0); /* Channel.channelId */
|
||||
Stream_Write_UINT16(s, context->width); /* Channel.width */
|
||||
Stream_Write_UINT16(s, context->height); /* Channel.height */
|
||||
}
|
||||
|
||||
static void rfx_compose_message_context(RFX_CONTEXT* context, wStream* s)
|
||||
{
|
||||
UINT16 properties;
|
||||
|
||||
stream_write_UINT16(s, WBT_CONTEXT); /* CodecChannelT.blockType */
|
||||
stream_write_UINT32(s, 13); /* CodecChannelT.blockLen */
|
||||
stream_write_BYTE(s, 1); /* CodecChannelT.codecId */
|
||||
stream_write_BYTE(s, 0); /* CodecChannelT.channelId */
|
||||
stream_write_BYTE(s, 0); /* ctxId */
|
||||
stream_write_UINT16(s, CT_TILE_64x64); /* tileSize */
|
||||
Stream_Write_UINT16(s, WBT_CONTEXT); /* CodecChannelT.blockType */
|
||||
Stream_Write_UINT32(s, 13); /* CodecChannelT.blockLen */
|
||||
Stream_Write_UINT8(s, 1); /* CodecChannelT.codecId */
|
||||
Stream_Write_UINT8(s, 0); /* CodecChannelT.channelId */
|
||||
Stream_Write_UINT8(s, 0); /* ctxId */
|
||||
Stream_Write_UINT16(s, CT_TILE_64x64); /* tileSize */
|
||||
|
||||
/* properties */
|
||||
properties = context->flags; /* flags */
|
||||
@ -928,7 +928,7 @@ static void rfx_compose_message_context(RFX_CONTEXT* context, wStream* s)
|
||||
properties |= (CLW_XFORM_DWT_53_A << 5); /* xft */
|
||||
properties |= ((context->mode == RLGR1 ? CLW_ENTROPY_RLGR1 : CLW_ENTROPY_RLGR3) << 9); /* et */
|
||||
properties |= (SCALAR_QUANTIZATION << 13); /* qt */
|
||||
stream_write_UINT16(s, properties);
|
||||
Stream_Write_UINT16(s, properties);
|
||||
|
||||
/* properties in tilesets: note that this has different format from the one in TS_RFX_CONTEXT */
|
||||
properties = 1; /* lt */
|
||||
@ -956,12 +956,12 @@ static void rfx_compose_message_frame_begin(RFX_CONTEXT* context, wStream* s)
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(s, 14);
|
||||
|
||||
stream_write_UINT16(s, WBT_FRAME_BEGIN); /* CodecChannelT.blockType */
|
||||
stream_write_UINT32(s, 14); /* CodecChannelT.blockLen */
|
||||
stream_write_BYTE(s, 1); /* CodecChannelT.codecId */
|
||||
stream_write_BYTE(s, 0); /* CodecChannelT.channelId */
|
||||
stream_write_UINT32(s, context->frame_idx); /* frameIdx */
|
||||
stream_write_UINT16(s, 1); /* numRegions */
|
||||
Stream_Write_UINT16(s, WBT_FRAME_BEGIN); /* CodecChannelT.blockType */
|
||||
Stream_Write_UINT32(s, 14); /* CodecChannelT.blockLen */
|
||||
Stream_Write_UINT8(s, 1); /* CodecChannelT.codecId */
|
||||
Stream_Write_UINT8(s, 0); /* CodecChannelT.channelId */
|
||||
Stream_Write_UINT32(s, context->frame_idx); /* frameIdx */
|
||||
Stream_Write_UINT16(s, 1); /* numRegions */
|
||||
|
||||
context->frame_idx++;
|
||||
}
|
||||
@ -975,23 +975,23 @@ static void rfx_compose_message_region(RFX_CONTEXT* context, wStream* s,
|
||||
size = 15 + num_rects * 8;
|
||||
Stream_EnsureRemainingCapacity(s, size);
|
||||
|
||||
stream_write_UINT16(s, WBT_REGION); /* CodecChannelT.blockType */
|
||||
stream_write_UINT32(s, size); /* set CodecChannelT.blockLen later */
|
||||
stream_write_BYTE(s, 1); /* CodecChannelT.codecId */
|
||||
stream_write_BYTE(s, 0); /* CodecChannelT.channelId */
|
||||
stream_write_BYTE(s, 1); /* regionFlags */
|
||||
stream_write_UINT16(s, num_rects); /* numRects */
|
||||
Stream_Write_UINT16(s, WBT_REGION); /* CodecChannelT.blockType */
|
||||
Stream_Write_UINT32(s, size); /* set CodecChannelT.blockLen later */
|
||||
Stream_Write_UINT8(s, 1); /* CodecChannelT.codecId */
|
||||
Stream_Write_UINT8(s, 0); /* CodecChannelT.channelId */
|
||||
Stream_Write_UINT8(s, 1); /* regionFlags */
|
||||
Stream_Write_UINT16(s, num_rects); /* numRects */
|
||||
|
||||
for (i = 0; i < num_rects; i++)
|
||||
{
|
||||
stream_write_UINT16(s, rects[i].x);
|
||||
stream_write_UINT16(s, rects[i].y);
|
||||
stream_write_UINT16(s, rects[i].width);
|
||||
stream_write_UINT16(s, rects[i].height);
|
||||
Stream_Write_UINT16(s, rects[i].x);
|
||||
Stream_Write_UINT16(s, rects[i].y);
|
||||
Stream_Write_UINT16(s, rects[i].width);
|
||||
Stream_Write_UINT16(s, rects[i].height);
|
||||
}
|
||||
|
||||
stream_write_UINT16(s, CBT_REGION); /* regionType */
|
||||
stream_write_UINT16(s, 1); /* numTilesets */
|
||||
Stream_Write_UINT16(s, CBT_REGION); /* regionType */
|
||||
Stream_Write_UINT16(s, 1); /* numTilesets */
|
||||
}
|
||||
|
||||
static void rfx_compose_message_tile(RFX_CONTEXT* context, wStream* s,
|
||||
@ -1007,13 +1007,13 @@ static void rfx_compose_message_tile(RFX_CONTEXT* context, wStream* s,
|
||||
Stream_EnsureRemainingCapacity(s, 19);
|
||||
start_pos = Stream_GetPosition(s);
|
||||
|
||||
stream_write_UINT16(s, CBT_TILE); /* BlockT.blockType */
|
||||
Stream_Write_UINT16(s, CBT_TILE); /* BlockT.blockType */
|
||||
Stream_Seek_UINT32(s); /* set BlockT.blockLen later */
|
||||
stream_write_BYTE(s, quantIdxY);
|
||||
stream_write_BYTE(s, quantIdxCb);
|
||||
stream_write_BYTE(s, quantIdxCr);
|
||||
stream_write_UINT16(s, xIdx);
|
||||
stream_write_UINT16(s, yIdx);
|
||||
Stream_Write_UINT8(s, quantIdxY);
|
||||
Stream_Write_UINT8(s, quantIdxCb);
|
||||
Stream_Write_UINT8(s, quantIdxCr);
|
||||
Stream_Write_UINT16(s, xIdx);
|
||||
Stream_Write_UINT16(s, yIdx);
|
||||
|
||||
Stream_Seek(s, 6); /* YLen, CbLen, CrLen */
|
||||
|
||||
@ -1027,11 +1027,11 @@ static void rfx_compose_message_tile(RFX_CONTEXT* context, wStream* s,
|
||||
end_pos = Stream_GetPosition(s);
|
||||
|
||||
Stream_SetPosition(s, start_pos + 2);
|
||||
stream_write_UINT32(s, 19 + YLen + CbLen + CrLen); /* BlockT.blockLen */
|
||||
Stream_Write_UINT32(s, 19 + YLen + CbLen + CrLen); /* BlockT.blockLen */
|
||||
Stream_SetPosition(s, start_pos + 13);
|
||||
stream_write_UINT16(s, YLen);
|
||||
stream_write_UINT16(s, CbLen);
|
||||
stream_write_UINT16(s, CrLen);
|
||||
Stream_Write_UINT16(s, YLen);
|
||||
Stream_Write_UINT16(s, CbLen);
|
||||
Stream_Write_UINT16(s, CrLen);
|
||||
|
||||
Stream_SetPosition(s, end_pos);
|
||||
}
|
||||
@ -1080,22 +1080,22 @@ static void rfx_compose_message_tileset(RFX_CONTEXT* context, wStream* s,
|
||||
Stream_EnsureRemainingCapacity(s, size);
|
||||
start_pos = Stream_GetPosition(s);
|
||||
|
||||
stream_write_UINT16(s, WBT_EXTENSION); /* CodecChannelT.blockType */
|
||||
Stream_Write_UINT16(s, WBT_EXTENSION); /* CodecChannelT.blockType */
|
||||
Stream_Seek_UINT32(s); /* set CodecChannelT.blockLen later */
|
||||
stream_write_BYTE(s, 1); /* CodecChannelT.codecId */
|
||||
stream_write_BYTE(s, 0); /* CodecChannelT.channelId */
|
||||
stream_write_UINT16(s, CBT_TILESET); /* subtype */
|
||||
stream_write_UINT16(s, 0); /* idx */
|
||||
stream_write_UINT16(s, context->properties); /* properties */
|
||||
stream_write_BYTE(s, numQuants); /* numQuants */
|
||||
stream_write_BYTE(s, 0x40); /* tileSize */
|
||||
stream_write_UINT16(s, numTiles); /* numTiles */
|
||||
Stream_Write_UINT8(s, 1); /* CodecChannelT.codecId */
|
||||
Stream_Write_UINT8(s, 0); /* CodecChannelT.channelId */
|
||||
Stream_Write_UINT16(s, CBT_TILESET); /* subtype */
|
||||
Stream_Write_UINT16(s, 0); /* idx */
|
||||
Stream_Write_UINT16(s, context->properties); /* properties */
|
||||
Stream_Write_UINT8(s, numQuants); /* numQuants */
|
||||
Stream_Write_UINT8(s, 0x40); /* tileSize */
|
||||
Stream_Write_UINT16(s, numTiles); /* numTiles */
|
||||
Stream_Seek_UINT32(s); /* set tilesDataSize later */
|
||||
|
||||
quantValsPtr = quantVals;
|
||||
for (i = 0; i < numQuants * 5; i++)
|
||||
{
|
||||
stream_write_BYTE(s, quantValsPtr[0] + (quantValsPtr[1] << 4));
|
||||
Stream_Write_UINT8(s, quantValsPtr[0] + (quantValsPtr[1] << 4));
|
||||
quantValsPtr += 2;
|
||||
}
|
||||
|
||||
@ -1118,9 +1118,9 @@ static void rfx_compose_message_tileset(RFX_CONTEXT* context, wStream* s,
|
||||
end_pos = Stream_GetPosition(s);
|
||||
|
||||
Stream_SetPosition(s, start_pos + 2);
|
||||
stream_write_UINT32(s, size); /* CodecChannelT.blockLen */
|
||||
Stream_Write_UINT32(s, size); /* CodecChannelT.blockLen */
|
||||
Stream_SetPosition(s, start_pos + 18);
|
||||
stream_write_UINT32(s, tilesDataSize);
|
||||
Stream_Write_UINT32(s, tilesDataSize);
|
||||
|
||||
Stream_SetPosition(s, end_pos);
|
||||
}
|
||||
@ -1129,10 +1129,10 @@ static void rfx_compose_message_frame_end(RFX_CONTEXT* context, wStream* s)
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(s, 8);
|
||||
|
||||
stream_write_UINT16(s, WBT_FRAME_END); /* CodecChannelT.blockType */
|
||||
stream_write_UINT32(s, 8); /* CodecChannelT.blockLen */
|
||||
stream_write_BYTE(s, 1); /* CodecChannelT.codecId */
|
||||
stream_write_BYTE(s, 0); /* CodecChannelT.channelId */
|
||||
Stream_Write_UINT16(s, WBT_FRAME_END); /* CodecChannelT.blockType */
|
||||
Stream_Write_UINT32(s, 8); /* CodecChannelT.blockLen */
|
||||
Stream_Write_UINT8(s, 1); /* CodecChannelT.codecId */
|
||||
Stream_Write_UINT8(s, 0); /* CodecChannelT.channelId */
|
||||
}
|
||||
|
||||
static void rfx_compose_message_data(RFX_CONTEXT* context, wStream* s,
|
||||
|
@ -36,8 +36,8 @@ static const char* const CTRLACTION_STRINGS[] =
|
||||
|
||||
void rdp_write_synchronize_pdu(wStream* s, rdpSettings* settings)
|
||||
{
|
||||
stream_write_UINT16(s, SYNCMSGTYPE_SYNC); /* messageType (2 bytes) */
|
||||
stream_write_UINT16(s, settings->PduSource); /* targetUser (2 bytes) */
|
||||
Stream_Write_UINT16(s, SYNCMSGTYPE_SYNC); /* messageType (2 bytes) */
|
||||
Stream_Write_UINT16(s, settings->PduSource); /* targetUser (2 bytes) */
|
||||
}
|
||||
|
||||
BOOL rdp_recv_synchronize_pdu(rdpRdp* rdp, wStream* s)
|
||||
@ -73,7 +73,7 @@ BOOL rdp_recv_client_synchronize_pdu(rdpRdp* rdp, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, messageType); /* messageType (2 bytes) */
|
||||
Stream_Read_UINT16(s, messageType); /* messageType (2 bytes) */
|
||||
|
||||
if (messageType != SYNCMSGTYPE_SYNC)
|
||||
return FALSE;
|
||||
@ -100,7 +100,7 @@ BOOL rdp_recv_control_pdu(wStream* s, UINT16* action)
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, *action); /* action (2 bytes) */
|
||||
Stream_Read_UINT16(s, *action); /* action (2 bytes) */
|
||||
Stream_Seek_UINT16(s); /* grantId (2 bytes) */
|
||||
Stream_Seek_UINT32(s); /* controlId (4 bytes) */
|
||||
|
||||
@ -109,9 +109,9 @@ BOOL rdp_recv_control_pdu(wStream* s, UINT16* action)
|
||||
|
||||
void rdp_write_client_control_pdu(wStream* s, UINT16 action)
|
||||
{
|
||||
stream_write_UINT16(s, action); /* action (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* grantId (2 bytes) */
|
||||
stream_write_UINT32(s, 0); /* controlId (4 bytes) */
|
||||
Stream_Write_UINT16(s, action); /* action (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* grantId (2 bytes) */
|
||||
Stream_Write_UINT32(s, 0); /* controlId (4 bytes) */
|
||||
}
|
||||
|
||||
BOOL rdp_recv_server_control_pdu(rdpRdp* rdp, wStream* s)
|
||||
@ -142,9 +142,9 @@ BOOL rdp_send_server_control_cooperate_pdu(rdpRdp* rdp)
|
||||
|
||||
s = rdp_data_pdu_init(rdp);
|
||||
|
||||
stream_write_UINT16(s, CTRLACTION_COOPERATE); /* action (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* grantId (2 bytes) */
|
||||
stream_write_UINT32(s, 0); /* controlId (4 bytes) */
|
||||
Stream_Write_UINT16(s, CTRLACTION_COOPERATE); /* action (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* grantId (2 bytes) */
|
||||
Stream_Write_UINT32(s, 0); /* controlId (4 bytes) */
|
||||
|
||||
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->user_id);
|
||||
}
|
||||
@ -155,9 +155,9 @@ BOOL rdp_send_server_control_granted_pdu(rdpRdp* rdp)
|
||||
|
||||
s = rdp_data_pdu_init(rdp);
|
||||
|
||||
stream_write_UINT16(s, CTRLACTION_GRANTED_CONTROL); /* action (2 bytes) */
|
||||
stream_write_UINT16(s, rdp->mcs->user_id); /* grantId (2 bytes) */
|
||||
stream_write_UINT32(s, 0x03EA); /* controlId (4 bytes) */
|
||||
Stream_Write_UINT16(s, CTRLACTION_GRANTED_CONTROL); /* action (2 bytes) */
|
||||
Stream_Write_UINT16(s, rdp->mcs->user_id); /* grantId (2 bytes) */
|
||||
Stream_Write_UINT32(s, 0x03EA); /* controlId (4 bytes) */
|
||||
|
||||
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_CONTROL, rdp->mcs->user_id);
|
||||
}
|
||||
@ -174,25 +174,25 @@ BOOL rdp_send_client_control_pdu(rdpRdp* rdp, UINT16 action)
|
||||
|
||||
void rdp_write_persistent_list_entry(wStream* s, UINT32 key1, UINT32 key2)
|
||||
{
|
||||
stream_write_UINT32(s, key1); /* key1 (4 bytes) */
|
||||
stream_write_UINT32(s, key2); /* key2 (4 bytes) */
|
||||
Stream_Write_UINT32(s, key1); /* key1 (4 bytes) */
|
||||
Stream_Write_UINT32(s, key2); /* key2 (4 bytes) */
|
||||
}
|
||||
|
||||
void rdp_write_client_persistent_key_list_pdu(wStream* s, rdpSettings* settings)
|
||||
{
|
||||
stream_write_UINT16(s, 0); /* numEntriesCache0 (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* numEntriesCache1 (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* numEntriesCache2 (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* numEntriesCache3 (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* numEntriesCache4 (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* totalEntriesCache0 (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* totalEntriesCache1 (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* totalEntriesCache2 (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* totalEntriesCache3 (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* totalEntriesCache4 (2 bytes) */
|
||||
stream_write_BYTE(s, PERSIST_FIRST_PDU | PERSIST_LAST_PDU); /* bBitMask (1 byte) */
|
||||
stream_write_BYTE(s, 0); /* pad1 (1 byte) */
|
||||
stream_write_UINT16(s, 0); /* pad3 (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* numEntriesCache0 (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* numEntriesCache1 (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* numEntriesCache2 (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* numEntriesCache3 (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* numEntriesCache4 (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* totalEntriesCache0 (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* totalEntriesCache1 (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* totalEntriesCache2 (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* totalEntriesCache3 (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* totalEntriesCache4 (2 bytes) */
|
||||
Stream_Write_UINT8(s, PERSIST_FIRST_PDU | PERSIST_LAST_PDU); /* bBitMask (1 byte) */
|
||||
Stream_Write_UINT8(s, 0); /* pad1 (1 byte) */
|
||||
Stream_Write_UINT16(s, 0); /* pad3 (2 bytes) */
|
||||
|
||||
/* entries */
|
||||
}
|
||||
@ -217,10 +217,10 @@ BOOL rdp_recv_client_font_list_pdu(wStream* s)
|
||||
|
||||
void rdp_write_client_font_list_pdu(wStream* s, UINT16 flags)
|
||||
{
|
||||
stream_write_UINT16(s, 0); /* numberFonts (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* totalNumFonts (2 bytes) */
|
||||
stream_write_UINT16(s, flags); /* listFlags (2 bytes) */
|
||||
stream_write_UINT16(s, 50); /* entrySize (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* numberFonts (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* totalNumFonts (2 bytes) */
|
||||
Stream_Write_UINT16(s, flags); /* listFlags (2 bytes) */
|
||||
Stream_Write_UINT16(s, 50); /* entrySize (2 bytes) */
|
||||
}
|
||||
|
||||
BOOL rdp_send_client_font_list_pdu(rdpRdp* rdp, UINT16 flags)
|
||||
@ -267,10 +267,10 @@ BOOL rdp_send_server_font_map_pdu(rdpRdp* rdp)
|
||||
|
||||
s = rdp_data_pdu_init(rdp);
|
||||
|
||||
stream_write_UINT16(s, 0); /* numberEntries (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* totalNumEntries (2 bytes) */
|
||||
stream_write_UINT16(s, FONTLIST_FIRST | FONTLIST_LAST); /* mapFlags (2 bytes) */
|
||||
stream_write_UINT16(s, 4); /* entrySize (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* numberEntries (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* totalNumEntries (2 bytes) */
|
||||
Stream_Write_UINT16(s, FONTLIST_FIRST | FONTLIST_LAST); /* mapFlags (2 bytes) */
|
||||
Stream_Write_UINT16(s, 4); /* entrySize (2 bytes) */
|
||||
|
||||
return rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FONT_MAP, rdp->mcs->user_id);
|
||||
}
|
||||
@ -288,10 +288,10 @@ BOOL rdp_recv_deactivate_all(rdpRdp* rdp, wStream* s)
|
||||
do {
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
break;
|
||||
stream_read_UINT32(s, rdp->settings->ShareId); /* shareId (4 bytes) */
|
||||
Stream_Read_UINT32(s, rdp->settings->ShareId); /* shareId (4 bytes) */
|
||||
if(Stream_GetRemainingLength(s) < 2)
|
||||
break;
|
||||
stream_read_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */
|
||||
Stream_Read_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */
|
||||
if(Stream_GetRemainingLength(s) < lengthSourceDescriptor)
|
||||
break;
|
||||
Stream_Seek(s, lengthSourceDescriptor); /* sourceDescriptor (should be 0x00) */
|
||||
@ -317,9 +317,9 @@ BOOL rdp_send_deactivate_all(rdpRdp* rdp)
|
||||
|
||||
s = rdp_pdu_init(rdp);
|
||||
|
||||
stream_write_UINT32(s, rdp->settings->ShareId); /* shareId (4 bytes) */
|
||||
stream_write_UINT16(s, 1); /* lengthSourceDescriptor (2 bytes) */
|
||||
stream_write_BYTE(s, 0); /* sourceDescriptor (should be 0x00) */
|
||||
Stream_Write_UINT32(s, rdp->settings->ShareId); /* shareId (4 bytes) */
|
||||
Stream_Write_UINT16(s, 1); /* lengthSourceDescriptor (2 bytes) */
|
||||
Stream_Write_UINT8(s, 0); /* sourceDescriptor (should be 0x00) */
|
||||
|
||||
return rdp_send_pdu(rdp, s, PDU_TYPE_DEACTIVATE_ALL, rdp->mcs->user_id);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -250,7 +250,7 @@ BOOL certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info)
|
||||
goto error1;
|
||||
info->ModulusLength = modulus_length;
|
||||
info->Modulus = (BYTE*) malloc(info->ModulusLength);
|
||||
stream_read(s, info->Modulus, info->ModulusLength);
|
||||
Stream_Read(s, info->Modulus, info->ModulusLength);
|
||||
error++;
|
||||
|
||||
if(!ber_read_integer_length(s, &exponent_length)) /* publicExponent (INTEGER) */
|
||||
@ -258,7 +258,7 @@ BOOL certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info)
|
||||
error++;
|
||||
if(Stream_GetRemainingLength(s) < exponent_length || exponent_length > 4)
|
||||
goto error2;
|
||||
stream_read(s, &info->exponent[4 - exponent_length], exponent_length);
|
||||
Stream_Read(s, &info->exponent[4 - exponent_length], exponent_length);
|
||||
crypto_reverse(info->Modulus, info->ModulusLength);
|
||||
crypto_reverse(info->exponent, 4);
|
||||
|
||||
@ -327,7 +327,7 @@ static BOOL certificate_process_server_public_key(rdpCertificate* certificate, w
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 20)
|
||||
return FALSE;
|
||||
stream_read(s, magic, 4);
|
||||
Stream_Read(s, magic, 4);
|
||||
|
||||
if (memcmp(magic, "RSA1", 4) != 0)
|
||||
{
|
||||
@ -335,17 +335,17 @@ static BOOL certificate_process_server_public_key(rdpCertificate* certificate, w
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_UINT32(s, keylen);
|
||||
stream_read_UINT32(s, bitlen);
|
||||
stream_read_UINT32(s, datalen);
|
||||
stream_read(s, certificate->cert_info.exponent, 4);
|
||||
Stream_Read_UINT32(s, keylen);
|
||||
Stream_Read_UINT32(s, bitlen);
|
||||
Stream_Read_UINT32(s, datalen);
|
||||
Stream_Read(s, certificate->cert_info.exponent, 4);
|
||||
modlen = keylen - 8;
|
||||
|
||||
if(Stream_GetRemainingLength(s) < modlen + 8) // count padding
|
||||
return FALSE;
|
||||
certificate->cert_info.ModulusLength = modlen;
|
||||
certificate->cert_info.Modulus = malloc(certificate->cert_info.ModulusLength);
|
||||
stream_read(s, certificate->cert_info.Modulus, certificate->cert_info.ModulusLength);
|
||||
Stream_Read(s, certificate->cert_info.Modulus, certificate->cert_info.ModulusLength);
|
||||
/* 8 bytes of zero padding */
|
||||
Stream_Seek(s, 8);
|
||||
|
||||
@ -365,7 +365,7 @@ static BOOL certificate_process_server_public_signature(rdpCertificate* certific
|
||||
crypto_md5_update(md5ctx, sigdata, sigdatalen);
|
||||
crypto_md5_final(md5ctx, md5hash);
|
||||
|
||||
stream_read(s, encsig, siglen);
|
||||
Stream_Read(s, encsig, siglen);
|
||||
|
||||
/* Last 8 bytes shall be all zero. */
|
||||
|
||||
@ -430,8 +430,8 @@ BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate
|
||||
|
||||
/* -4, because we need to include dwVersion */
|
||||
sigdata = Stream_Pointer(s) - 4;
|
||||
stream_read_UINT32(s, dwSigAlgId);
|
||||
stream_read_UINT32(s, dwKeyAlgId);
|
||||
Stream_Read_UINT32(s, dwSigAlgId);
|
||||
Stream_Read_UINT32(s, dwKeyAlgId);
|
||||
|
||||
if (!(dwSigAlgId == SIGNATURE_ALG_RSA && dwKeyAlgId == KEY_EXCHANGE_ALG_RSA))
|
||||
{
|
||||
@ -439,7 +439,7 @@ BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_UINT16(s, wPublicKeyBlobType);
|
||||
Stream_Read_UINT16(s, wPublicKeyBlobType);
|
||||
|
||||
if (wPublicKeyBlobType != BB_RSA_KEY_BLOB)
|
||||
{
|
||||
@ -447,7 +447,7 @@ BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_UINT16(s, wPublicKeyBlobLen);
|
||||
Stream_Read_UINT16(s, wPublicKeyBlobLen);
|
||||
if(Stream_GetRemainingLength(s) < wPublicKeyBlobLen)
|
||||
return FALSE;
|
||||
|
||||
@ -461,7 +461,7 @@ BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate
|
||||
return FALSE;
|
||||
|
||||
sigdatalen = Stream_Pointer(s) - sigdata;
|
||||
stream_read_UINT16(s, wSignatureBlobType);
|
||||
Stream_Read_UINT16(s, wSignatureBlobType);
|
||||
|
||||
if (wSignatureBlobType != BB_RSA_SIGNATURE_BLOB)
|
||||
{
|
||||
@ -469,7 +469,7 @@ BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
stream_read_UINT16(s, wSignatureBlobLen);
|
||||
Stream_Read_UINT16(s, wSignatureBlobLen);
|
||||
if(Stream_GetRemainingLength(s) < wSignatureBlobLen)
|
||||
return FALSE;
|
||||
|
||||
@ -505,7 +505,7 @@ BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate,
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, numCertBlobs); /* numCertBlobs */
|
||||
Stream_Read_UINT32(s, numCertBlobs); /* numCertBlobs */
|
||||
|
||||
certificate->x509_cert_chain = certificate_new_x509_certificate_chain(numCertBlobs);
|
||||
|
||||
@ -513,14 +513,14 @@ BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate,
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, certLength);
|
||||
Stream_Read_UINT32(s, certLength);
|
||||
if(Stream_GetRemainingLength(s) < certLength)
|
||||
return FALSE;
|
||||
|
||||
DEBUG_CERTIFICATE("\nX.509 Certificate #%d, length:%d", i + 1, certLength);
|
||||
|
||||
certificate->x509_cert_chain->array[i].data = (BYTE*) malloc(certLength);
|
||||
stream_read(s, certificate->x509_cert_chain->array[i].data, certLength);
|
||||
Stream_Read(s, certificate->x509_cert_chain->array[i].data, certLength);
|
||||
certificate->x509_cert_chain->array[i].length = certLength;
|
||||
|
||||
if (numCertBlobs - i == 2)
|
||||
@ -574,7 +574,7 @@ int certificate_read_server_certificate(rdpCertificate* certificate, BYTE* serve
|
||||
s = stream_new(0);
|
||||
stream_attach(s, server_cert, length);
|
||||
|
||||
stream_read_UINT32(s, dwVersion); /* dwVersion (4 bytes) */
|
||||
Stream_Read_UINT32(s, dwVersion); /* dwVersion (4 bytes) */
|
||||
|
||||
switch (dwVersion & CERT_CHAIN_VERSION_MASK)
|
||||
{
|
||||
|
@ -78,10 +78,10 @@ BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channel_id, BYTE* data, int size)
|
||||
flags |= CHANNEL_FLAG_SHOW_PROTOCOL;
|
||||
}
|
||||
|
||||
stream_write_UINT32(s, size);
|
||||
stream_write_UINT32(s, flags);
|
||||
Stream_Write_UINT32(s, size);
|
||||
Stream_Write_UINT32(s, flags);
|
||||
Stream_EnsureCapacity(s, chunk_size);
|
||||
stream_write(s, data, chunk_size);
|
||||
Stream_Write(s, data, chunk_size);
|
||||
|
||||
rdp_send(rdp, s, channel_id);
|
||||
|
||||
@ -102,8 +102,8 @@ BOOL freerdp_channel_process(freerdp* instance, wStream* s, UINT16 channel_id)
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, length);
|
||||
stream_read_UINT32(s, flags);
|
||||
Stream_Read_UINT32(s, length);
|
||||
Stream_Read_UINT32(s, flags);
|
||||
chunk_length = Stream_GetRemainingLength(s);
|
||||
|
||||
IFCALL(instance->ReceiveChannelData, instance,
|
||||
@ -120,8 +120,8 @@ BOOL freerdp_channel_peer_process(freerdp_peer* client, wStream* s, UINT16 chann
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, length);
|
||||
stream_read_UINT32(s, flags);
|
||||
Stream_Read_UINT32(s, length);
|
||||
Stream_Read_UINT32(s, flags);
|
||||
chunk_length = Stream_GetRemainingLength(s);
|
||||
|
||||
IFCALL(client->ReceiveChannelData, client,
|
||||
|
@ -285,8 +285,8 @@ static BOOL rdp_client_establish_keys(rdpRdp* rdp)
|
||||
rdp_write_security_header(s, SEC_EXCHANGE_PKT);
|
||||
length = key_len + 8;
|
||||
|
||||
stream_write_UINT32(s, length);
|
||||
stream_write(s, crypt_client_random, length);
|
||||
Stream_Write_UINT32(s, length);
|
||||
Stream_Write(s, crypt_client_random, length);
|
||||
|
||||
if (transport_write(rdp->mcs->transport, s) < 0)
|
||||
{
|
||||
@ -351,7 +351,7 @@ static BOOL rdp_server_establish_keys(rdpRdp* rdp, wStream* s)
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, rand_len);
|
||||
Stream_Read_UINT32(s, rand_len);
|
||||
if(Stream_GetRemainingLength(s) < rand_len + 8) /* include 8 bytes of padding */
|
||||
return FALSE;
|
||||
|
||||
@ -364,7 +364,7 @@ static BOOL rdp_server_establish_keys(rdpRdp* rdp, wStream* s)
|
||||
}
|
||||
|
||||
memset(crypt_client_random, 0, sizeof(crypt_client_random));
|
||||
stream_read(s, crypt_client_random, rand_len);
|
||||
Stream_Read(s, crypt_client_random, rand_len);
|
||||
/* 8 zero bytes of padding */
|
||||
Stream_Seek(s, 8);
|
||||
mod = rdp->settings->RdpServerRsaKey->Modulus;
|
||||
|
@ -77,7 +77,7 @@ UINT16 fastpath_header_length(wStream* s)
|
||||
BYTE length1;
|
||||
|
||||
Stream_Seek_BYTE(s);
|
||||
stream_read_BYTE(s, length1);
|
||||
Stream_Read_UINT8(s, length1);
|
||||
Stream_Rewind(s, 2);
|
||||
|
||||
return ((length1 & 0x80) != 0 ? 3 : 2);
|
||||
@ -94,7 +94,7 @@ UINT16 fastpath_read_header(rdpFastPath* fastpath, wStream* s)
|
||||
BYTE header;
|
||||
UINT16 length;
|
||||
|
||||
stream_read_BYTE(s, header);
|
||||
Stream_Read_UINT8(s, header);
|
||||
|
||||
if (fastpath)
|
||||
{
|
||||
@ -111,7 +111,7 @@ static INLINE void fastpath_read_update_header(wStream* s, BYTE* updateCode, BYT
|
||||
{
|
||||
BYTE updateHeader;
|
||||
|
||||
stream_read_BYTE(s, updateHeader);
|
||||
Stream_Read_UINT8(s, updateHeader);
|
||||
*updateCode = updateHeader & 0x0F;
|
||||
*fragmentation = (updateHeader >> 4) & 0x03;
|
||||
*compression = (updateHeader >> 6) & 0x03;
|
||||
@ -124,14 +124,14 @@ static INLINE void fastpath_write_update_header(wStream* s, BYTE updateCode, BYT
|
||||
updateHeader |= updateCode & 0x0F;
|
||||
updateHeader |= (fragmentation & 0x03) << 4;
|
||||
updateHeader |= (compression & 0x03) << 6;
|
||||
stream_write_BYTE(s, updateHeader);
|
||||
Stream_Write_UINT8(s, updateHeader);
|
||||
}
|
||||
|
||||
BOOL fastpath_read_header_rdp(rdpFastPath* fastpath, wStream* s, UINT16 *length)
|
||||
{
|
||||
BYTE header;
|
||||
|
||||
stream_read_BYTE(s, header);
|
||||
Stream_Read_UINT8(s, header);
|
||||
|
||||
if (fastpath)
|
||||
{
|
||||
@ -151,7 +151,7 @@ static BOOL fastpath_recv_orders(rdpFastPath* fastpath, wStream* s)
|
||||
rdpUpdate* update = fastpath->rdp->update;
|
||||
UINT16 numberOrders;
|
||||
|
||||
stream_read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */
|
||||
Stream_Read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */
|
||||
|
||||
while (numberOrders > 0)
|
||||
{
|
||||
@ -173,7 +173,7 @@ static BOOL fastpath_recv_update_common(rdpFastPath* fastpath, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, updateType); /* updateType (2 bytes) */
|
||||
Stream_Read_UINT16(s, updateType); /* updateType (2 bytes) */
|
||||
|
||||
switch (updateType)
|
||||
{
|
||||
@ -317,11 +317,11 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s)
|
||||
fastpath_read_update_header(s, &updateCode, &fragmentation, &compression);
|
||||
|
||||
if (compression == FASTPATH_OUTPUT_COMPRESSION_USED)
|
||||
stream_read_BYTE(s, compressionFlags);
|
||||
Stream_Read_UINT8(s, compressionFlags);
|
||||
else
|
||||
compressionFlags = 0;
|
||||
|
||||
stream_read_UINT16(s, size);
|
||||
Stream_Read_UINT16(s, size);
|
||||
|
||||
if (Stream_GetRemainingLength(s) < size)
|
||||
return -1;
|
||||
@ -483,7 +483,7 @@ static BOOL fastpath_read_input_event_header(wStream* s, BYTE* eventFlags, BYTE*
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, eventHeader); /* eventHeader (1 byte) */
|
||||
Stream_Read_UINT8(s, eventHeader); /* eventHeader (1 byte) */
|
||||
|
||||
*eventFlags = (eventHeader & 0x1F);
|
||||
*eventCode = (eventHeader >> 5);
|
||||
@ -499,7 +499,7 @@ static BOOL fastpath_recv_input_event_scancode(rdpFastPath* fastpath, wStream* s
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, code); /* keyCode (1 byte) */
|
||||
Stream_Read_UINT8(s, code); /* keyCode (1 byte) */
|
||||
|
||||
flags = 0;
|
||||
|
||||
@ -525,9 +525,9 @@ static BOOL fastpath_recv_input_event_mouse(rdpFastPath* fastpath, wStream* s, B
|
||||
if (Stream_GetRemainingLength(s) < 6)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */
|
||||
stream_read_UINT16(s, xPos); /* xPos (2 bytes) */
|
||||
stream_read_UINT16(s, yPos); /* yPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */
|
||||
Stream_Read_UINT16(s, xPos); /* xPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, yPos); /* yPos (2 bytes) */
|
||||
|
||||
IFCALL(fastpath->rdp->input->MouseEvent, fastpath->rdp->input, pointerFlags, xPos, yPos);
|
||||
|
||||
@ -543,9 +543,9 @@ static BOOL fastpath_recv_input_event_mousex(rdpFastPath* fastpath, wStream* s,
|
||||
if (Stream_GetRemainingLength(s) < 6)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */
|
||||
stream_read_UINT16(s, xPos); /* xPos (2 bytes) */
|
||||
stream_read_UINT16(s, yPos); /* yPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */
|
||||
Stream_Read_UINT16(s, xPos); /* xPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, yPos); /* yPos (2 bytes) */
|
||||
|
||||
IFCALL(fastpath->rdp->input->ExtendedMouseEvent, fastpath->rdp->input, pointerFlags, xPos, yPos);
|
||||
|
||||
@ -567,7 +567,7 @@ static BOOL fastpath_recv_input_event_unicode(rdpFastPath* fastpath, wStream* s,
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, unicodeCode); /* unicodeCode (2 bytes) */
|
||||
Stream_Read_UINT16(s, unicodeCode); /* unicodeCode (2 bytes) */
|
||||
|
||||
flags = 0;
|
||||
|
||||
@ -638,7 +638,7 @@ int fastpath_recv_inputs(rdpFastPath* fastpath, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
return -1;
|
||||
|
||||
stream_read_BYTE(s, fastpath->numberEvents); /* eventHeader (1 byte) */
|
||||
Stream_Read_UINT8(s, fastpath->numberEvents); /* eventHeader (1 byte) */
|
||||
}
|
||||
|
||||
for (i = 0; i < fastpath->numberEvents; i++)
|
||||
@ -699,7 +699,7 @@ wStream* fastpath_input_pdu_init(rdpFastPath* fastpath, BYTE eventFlags, BYTE ev
|
||||
rdp = fastpath->rdp;
|
||||
|
||||
s = fastpath_input_pdu_init_header(fastpath);
|
||||
stream_write_BYTE(s, eventFlags | (eventCode << 5)); /* eventHeader (1 byte) */
|
||||
Stream_Write_UINT8(s, eventFlags | (eventCode << 5)); /* eventHeader (1 byte) */
|
||||
|
||||
return s;
|
||||
}
|
||||
@ -730,7 +730,7 @@ BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s, int iNu
|
||||
eventHeader |= (FASTPATH_INPUT_SECURE_CHECKSUM << 6);
|
||||
|
||||
Stream_SetPosition(s, 0);
|
||||
stream_write_BYTE(s, eventHeader);
|
||||
Stream_Write_UINT8(s, eventHeader);
|
||||
sec_bytes = fastpath_get_sec_bytes(fastpath->rdp);
|
||||
|
||||
/*
|
||||
@ -739,7 +739,7 @@ BOOL fastpath_send_multiple_input_pdu(rdpFastPath* fastpath, wStream* s, int iNu
|
||||
* because we can leave room for fixed-length header, store all
|
||||
* the data first and then store the header.
|
||||
*/
|
||||
stream_write_UINT16_be(s, 0x8000 | length);
|
||||
Stream_Write_UINT16_BE(s, 0x8000 | length);
|
||||
|
||||
if (sec_bytes > 0)
|
||||
{
|
||||
@ -866,9 +866,9 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
|
||||
if (sec_bytes > 0)
|
||||
header |= (FASTPATH_OUTPUT_ENCRYPTED << 6);
|
||||
|
||||
stream_write_BYTE(ls, header); /* fpOutputHeader (1 byte) */
|
||||
stream_write_BYTE(ls, 0x80 | (pduLength >> 8)); /* length1 */
|
||||
stream_write_BYTE(ls, pduLength & 0xFF); /* length2 */
|
||||
Stream_Write_UINT8(ls, header); /* fpOutputHeader (1 byte) */
|
||||
Stream_Write_UINT8(ls, 0x80 | (pduLength >> 8)); /* length1 */
|
||||
Stream_Write_UINT8(ls, pduLength & 0xFF); /* length2 */
|
||||
|
||||
if (sec_bytes > 0)
|
||||
Stream_Seek(ls, sec_bytes);
|
||||
@ -878,7 +878,7 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
|
||||
/* extra byte if compressed */
|
||||
if (ls == comp_update)
|
||||
{
|
||||
stream_write_BYTE(ls, cflags);
|
||||
Stream_Write_UINT8(ls, cflags);
|
||||
bytes_to_crypt = pdu_data_bytes + 4;
|
||||
}
|
||||
else
|
||||
@ -886,7 +886,7 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
|
||||
bytes_to_crypt = pdu_data_bytes + 3;
|
||||
}
|
||||
|
||||
stream_write_UINT16(ls, pdu_data_bytes);
|
||||
Stream_Write_UINT16(ls, pdu_data_bytes);
|
||||
|
||||
stream_attach(update, bm, pduLength);
|
||||
Stream_Seek(update, pduLength);
|
||||
|
@ -456,8 +456,8 @@ BOOL gcc_read_user_data_header(wStream* s, UINT16* type, UINT16* length)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, *type); /* type */
|
||||
stream_read_UINT16(s, *length); /* length */
|
||||
Stream_Read_UINT16(s, *type); /* type */
|
||||
Stream_Read_UINT16(s, *length); /* length */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < *length - 4)
|
||||
return FALSE;
|
||||
@ -475,8 +475,8 @@ BOOL gcc_read_user_data_header(wStream* s, UINT16* type, UINT16* length)
|
||||
|
||||
void gcc_write_user_data_header(wStream* s, UINT16 type, UINT16 length)
|
||||
{
|
||||
stream_write_UINT16(s, type); /* type */
|
||||
stream_write_UINT16(s, length); /* length */
|
||||
Stream_Write_UINT16(s, type); /* type */
|
||||
Stream_Write_UINT16(s, length); /* length */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -501,15 +501,15 @@ BOOL gcc_read_client_core_data(wStream* s, rdpSettings* settings, UINT16 blockLe
|
||||
if (blockLength < 128)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, version); /* version */
|
||||
Stream_Read_UINT32(s, version); /* version */
|
||||
settings->RdpVersion = (version == RDP_VERSION_4 ? 4 : 7);
|
||||
|
||||
stream_read_UINT16(s, settings->DesktopWidth); /* DesktopWidth */
|
||||
stream_read_UINT16(s, settings->DesktopHeight); /* DesktopHeight */
|
||||
stream_read_UINT16(s, colorDepth); /* ColorDepth */
|
||||
Stream_Read_UINT16(s, settings->DesktopWidth); /* DesktopWidth */
|
||||
Stream_Read_UINT16(s, settings->DesktopHeight); /* DesktopHeight */
|
||||
Stream_Read_UINT16(s, colorDepth); /* ColorDepth */
|
||||
Stream_Seek_UINT16(s); /* SASSequence (Secure Access Sequence) */
|
||||
stream_read_UINT32(s, settings->KeyboardLayout); /* KeyboardLayout */
|
||||
stream_read_UINT32(s, settings->ClientBuild); /* ClientBuild */
|
||||
Stream_Read_UINT32(s, settings->KeyboardLayout); /* KeyboardLayout */
|
||||
Stream_Read_UINT32(s, settings->ClientBuild); /* ClientBuild */
|
||||
|
||||
/* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */
|
||||
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s), 32 / 2, &str, 0, NULL, NULL);
|
||||
@ -519,9 +519,9 @@ BOOL gcc_read_client_core_data(wStream* s, rdpSettings* settings, UINT16 blockLe
|
||||
free(str);
|
||||
str = NULL;
|
||||
|
||||
stream_read_UINT32(s, settings->KeyboardType); /* KeyboardType */
|
||||
stream_read_UINT32(s, settings->KeyboardSubType); /* KeyboardSubType */
|
||||
stream_read_UINT32(s, settings->KeyboardFunctionKey); /* KeyboardFunctionKey */
|
||||
Stream_Read_UINT32(s, settings->KeyboardType); /* KeyboardType */
|
||||
Stream_Read_UINT32(s, settings->KeyboardSubType); /* KeyboardSubType */
|
||||
Stream_Read_UINT32(s, settings->KeyboardFunctionKey); /* KeyboardFunctionKey */
|
||||
|
||||
Stream_Seek(s, 64); /* imeFileName */
|
||||
|
||||
@ -538,7 +538,7 @@ BOOL gcc_read_client_core_data(wStream* s, rdpSettings* settings, UINT16 blockLe
|
||||
{
|
||||
if (blockLength < 2)
|
||||
break;
|
||||
stream_read_UINT16(s, postBeta2ColorDepth); /* postBeta2ColorDepth */
|
||||
Stream_Read_UINT16(s, postBeta2ColorDepth); /* postBeta2ColorDepth */
|
||||
blockLength -= 2;
|
||||
|
||||
if (blockLength < 2)
|
||||
@ -553,17 +553,17 @@ BOOL gcc_read_client_core_data(wStream* s, rdpSettings* settings, UINT16 blockLe
|
||||
|
||||
if (blockLength < 2)
|
||||
break;
|
||||
stream_read_UINT16(s, highColorDepth); /* highColorDepth */
|
||||
Stream_Read_UINT16(s, highColorDepth); /* highColorDepth */
|
||||
blockLength -= 2;
|
||||
|
||||
if (blockLength < 2)
|
||||
break;
|
||||
stream_read_UINT16(s, supportedColorDepths); /* supportedColorDepths */
|
||||
Stream_Read_UINT16(s, supportedColorDepths); /* supportedColorDepths */
|
||||
blockLength -= 2;
|
||||
|
||||
if (blockLength < 2)
|
||||
break;
|
||||
stream_read_UINT16(s, settings->EarlyCapabilityFlags); /* earlyCapabilityFlags */
|
||||
Stream_Read_UINT16(s, settings->EarlyCapabilityFlags); /* earlyCapabilityFlags */
|
||||
blockLength -= 2;
|
||||
|
||||
if (blockLength < 64)
|
||||
@ -577,7 +577,7 @@ BOOL gcc_read_client_core_data(wStream* s, rdpSettings* settings, UINT16 blockLe
|
||||
|
||||
if (blockLength < 1)
|
||||
break;
|
||||
stream_read_BYTE(s, settings->PerformanceFlags); /* connectionType */
|
||||
Stream_Read_UINT8(s, settings->PerformanceFlags); /* connectionType */
|
||||
blockLength -= 1;
|
||||
|
||||
if (blockLength < 1)
|
||||
@ -587,7 +587,7 @@ BOOL gcc_read_client_core_data(wStream* s, rdpSettings* settings, UINT16 blockLe
|
||||
|
||||
if (blockLength < 4)
|
||||
break;
|
||||
stream_read_UINT32(s, serverSelectedProtocol); /* serverSelectedProtocol */
|
||||
Stream_Read_UINT32(s, serverSelectedProtocol); /* serverSelectedProtocol */
|
||||
blockLength -= 4;
|
||||
|
||||
if (settings->SelectedProtocol != serverSelectedProtocol)
|
||||
@ -675,13 +675,13 @@ void gcc_write_client_core_data(wStream* s, rdpSettings* settings)
|
||||
clientNameLength = ConvertToUnicode(CP_UTF8, 0, settings->ClientHostname, -1, &clientName, 0);
|
||||
clientDigProductIdLength = ConvertToUnicode(CP_UTF8, 0, settings->ClientProductId, -1, &clientDigProductId, 0);
|
||||
|
||||
stream_write_UINT32(s, version); /* Version */
|
||||
stream_write_UINT16(s, settings->DesktopWidth); /* DesktopWidth */
|
||||
stream_write_UINT16(s, settings->DesktopHeight); /* DesktopHeight */
|
||||
stream_write_UINT16(s, RNS_UD_COLOR_8BPP); /* ColorDepth, ignored because of postBeta2ColorDepth */
|
||||
stream_write_UINT16(s, RNS_UD_SAS_DEL); /* SASSequence (Secure Access Sequence) */
|
||||
stream_write_UINT32(s, settings->KeyboardLayout); /* KeyboardLayout */
|
||||
stream_write_UINT32(s, settings->ClientBuild); /* ClientBuild */
|
||||
Stream_Write_UINT32(s, version); /* Version */
|
||||
Stream_Write_UINT16(s, settings->DesktopWidth); /* DesktopWidth */
|
||||
Stream_Write_UINT16(s, settings->DesktopHeight); /* DesktopHeight */
|
||||
Stream_Write_UINT16(s, RNS_UD_COLOR_8BPP); /* ColorDepth, ignored because of postBeta2ColorDepth */
|
||||
Stream_Write_UINT16(s, RNS_UD_SAS_DEL); /* SASSequence (Secure Access Sequence) */
|
||||
Stream_Write_UINT32(s, settings->KeyboardLayout); /* KeyboardLayout */
|
||||
Stream_Write_UINT32(s, settings->ClientBuild); /* ClientBuild */
|
||||
|
||||
/* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */
|
||||
|
||||
@ -691,19 +691,19 @@ void gcc_write_client_core_data(wStream* s, rdpSettings* settings)
|
||||
clientName[clientNameLength-1] = 0;
|
||||
}
|
||||
|
||||
stream_write(s, clientName, (clientNameLength * 2));
|
||||
stream_write_zero(s, 32 - (clientNameLength * 2));
|
||||
Stream_Write(s, clientName, (clientNameLength * 2));
|
||||
Stream_Write_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_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_Write_zero(s, 64); /* imeFileName */
|
||||
|
||||
stream_write_UINT16(s, RNS_UD_COLOR_8BPP); /* postBeta2ColorDepth */
|
||||
stream_write_UINT16(s, 1); /* clientProductID */
|
||||
stream_write_UINT32(s, 0); /* serialNumber (should be initialized to 0) */
|
||||
Stream_Write_UINT16(s, RNS_UD_COLOR_8BPP); /* postBeta2ColorDepth */
|
||||
Stream_Write_UINT16(s, 1); /* clientProductID */
|
||||
Stream_Write_UINT32(s, 0); /* serialNumber (should be initialized to 0) */
|
||||
|
||||
highColorDepth = MIN(settings->ColorDepth, 24);
|
||||
|
||||
@ -727,10 +727,10 @@ void gcc_write_client_core_data(wStream* s, rdpSettings* settings)
|
||||
earlyCapabilityFlags |= RNS_UD_CS_WANT_32BPP_SESSION;
|
||||
}
|
||||
|
||||
stream_write_UINT16(s, highColorDepth); /* highColorDepth */
|
||||
stream_write_UINT16(s, supportedColorDepths); /* supportedColorDepths */
|
||||
Stream_Write_UINT16(s, highColorDepth); /* highColorDepth */
|
||||
Stream_Write_UINT16(s, supportedColorDepths); /* supportedColorDepths */
|
||||
|
||||
stream_write_UINT16(s, earlyCapabilityFlags); /* earlyCapabilityFlags */
|
||||
Stream_Write_UINT16(s, earlyCapabilityFlags); /* earlyCapabilityFlags */
|
||||
|
||||
/* clientDigProductId (64 bytes, null-terminated unicode, truncated to 31 characters) */
|
||||
if (clientDigProductIdLength >= 32)
|
||||
@ -738,14 +738,14 @@ void gcc_write_client_core_data(wStream* s, rdpSettings* settings)
|
||||
clientDigProductIdLength = 32;
|
||||
clientDigProductId[clientDigProductIdLength-1] = 0;
|
||||
}
|
||||
stream_write(s, clientDigProductId, (clientDigProductIdLength * 2) );
|
||||
stream_write_zero(s, 64 - (clientDigProductIdLength * 2) );
|
||||
Stream_Write(s, clientDigProductId, (clientDigProductIdLength * 2) );
|
||||
Stream_Write_zero(s, 64 - (clientDigProductIdLength * 2) );
|
||||
free(clientDigProductId);
|
||||
|
||||
stream_write_BYTE(s, connectionType); /* connectionType */
|
||||
stream_write_BYTE(s, 0); /* pad1octet */
|
||||
Stream_Write_UINT8(s, connectionType); /* connectionType */
|
||||
Stream_Write_UINT8(s, 0); /* pad1octet */
|
||||
|
||||
stream_write_UINT32(s, settings->SelectedProtocol); /* serverSelectedProtocol */
|
||||
Stream_Write_UINT32(s, settings->SelectedProtocol); /* serverSelectedProtocol */
|
||||
}
|
||||
|
||||
BOOL gcc_read_server_core_data(wStream* s, rdpSettings* settings)
|
||||
@ -755,8 +755,8 @@ BOOL gcc_read_server_core_data(wStream* s, rdpSettings* settings)
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, version); /* version */
|
||||
stream_read_UINT32(s, clientRequestedProtocols); /* clientRequestedProtocols */
|
||||
Stream_Read_UINT32(s, version); /* version */
|
||||
Stream_Read_UINT32(s, clientRequestedProtocols); /* clientRequestedProtocols */
|
||||
|
||||
if (version == RDP_VERSION_4 && settings->RdpVersion > 4)
|
||||
settings->RdpVersion = 4;
|
||||
@ -770,8 +770,8 @@ void gcc_write_server_core_data(wStream* s, rdpSettings* settings)
|
||||
{
|
||||
gcc_write_user_data_header(s, SC_CORE, 12);
|
||||
|
||||
stream_write_UINT32(s, settings->RdpVersion == 4 ? RDP_VERSION_4 : RDP_VERSION_5_PLUS);
|
||||
stream_write_UINT32(s, settings->RequestedProtocols); /* clientRequestedProtocols */
|
||||
Stream_Write_UINT32(s, settings->RdpVersion == 4 ? RDP_VERSION_4 : RDP_VERSION_5_PLUS);
|
||||
Stream_Write_UINT32(s, settings->RequestedProtocols); /* clientRequestedProtocols */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -788,9 +788,9 @@ BOOL gcc_read_client_security_data(wStream* s, rdpSettings* settings, UINT16 blo
|
||||
|
||||
if (settings->DisableEncryption)
|
||||
{
|
||||
stream_read_UINT32(s, settings->EncryptionMethods); /* encryptionMethods */
|
||||
Stream_Read_UINT32(s, settings->EncryptionMethods); /* encryptionMethods */
|
||||
if (settings->EncryptionMethods == 0)
|
||||
stream_read_UINT32(s, settings->EncryptionMethods); /* extEncryptionMethods */
|
||||
Stream_Read_UINT32(s, settings->EncryptionMethods); /* extEncryptionMethods */
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -812,14 +812,14 @@ void gcc_write_client_security_data(wStream* s, rdpSettings* settings)
|
||||
|
||||
if (settings->DisableEncryption)
|
||||
{
|
||||
stream_write_UINT32(s, settings->EncryptionMethods); /* encryptionMethods */
|
||||
stream_write_UINT32(s, 0); /* extEncryptionMethods */
|
||||
Stream_Write_UINT32(s, settings->EncryptionMethods); /* encryptionMethods */
|
||||
Stream_Write_UINT32(s, 0); /* extEncryptionMethods */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* French locale, disable encryption */
|
||||
stream_write_UINT32(s, 0); /* encryptionMethods */
|
||||
stream_write_UINT32(s, settings->EncryptionMethods); /* extEncryptionMethods */
|
||||
Stream_Write_UINT32(s, 0); /* encryptionMethods */
|
||||
Stream_Write_UINT32(s, settings->EncryptionMethods); /* extEncryptionMethods */
|
||||
}
|
||||
}
|
||||
|
||||
@ -830,8 +830,8 @@ BOOL gcc_read_server_security_data(wStream* s, rdpSettings* settings)
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, settings->EncryptionMethods); /* encryptionMethod */
|
||||
stream_read_UINT32(s, settings->EncryptionLevel); /* encryptionLevel */
|
||||
Stream_Read_UINT32(s, settings->EncryptionMethods); /* encryptionMethod */
|
||||
Stream_Read_UINT32(s, settings->EncryptionLevel); /* encryptionLevel */
|
||||
|
||||
if (settings->EncryptionMethods == 0 && settings->EncryptionLevel == 0)
|
||||
{
|
||||
@ -844,8 +844,8 @@ BOOL gcc_read_server_security_data(wStream* s, rdpSettings* settings)
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, settings->ServerRandomLength); /* serverRandomLen */
|
||||
stream_read_UINT32(s, settings->ServerCertificateLength); /* serverCertLen */
|
||||
Stream_Read_UINT32(s, settings->ServerRandomLength); /* serverRandomLen */
|
||||
Stream_Read_UINT32(s, settings->ServerCertificateLength); /* serverCertLen */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < settings->ServerRandomLength + settings->ServerCertificateLength)
|
||||
return FALSE;
|
||||
@ -854,7 +854,7 @@ BOOL gcc_read_server_security_data(wStream* s, rdpSettings* settings)
|
||||
{
|
||||
/* serverRandom */
|
||||
settings->ServerRandom = (BYTE*) malloc(settings->ServerRandomLength);
|
||||
stream_read(s, settings->ServerRandom, settings->ServerRandomLength);
|
||||
Stream_Read(s, settings->ServerRandom, settings->ServerRandomLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -865,7 +865,7 @@ BOOL gcc_read_server_security_data(wStream* s, rdpSettings* settings)
|
||||
{
|
||||
/* serverCertificate */
|
||||
settings->ServerCertificate = (BYTE*) malloc(settings->ServerCertificateLength);
|
||||
stream_read(s, settings->ServerCertificate, settings->ServerCertificateLength);
|
||||
Stream_Read(s, settings->ServerCertificate, settings->ServerCertificateLength);
|
||||
|
||||
certificate_free(settings->RdpServerCertificate);
|
||||
settings->RdpServerCertificate = certificate_new();
|
||||
@ -999,8 +999,8 @@ void gcc_write_server_security_data(wStream* s, rdpSettings* settings)
|
||||
|
||||
gcc_write_user_data_header(s, SC_SECURITY, headerLen);
|
||||
|
||||
stream_write_UINT32(s, settings->EncryptionMethods); /* encryptionMethod */
|
||||
stream_write_UINT32(s, settings->EncryptionLevel); /* encryptionLevel */
|
||||
Stream_Write_UINT32(s, settings->EncryptionMethods); /* encryptionMethod */
|
||||
Stream_Write_UINT32(s, settings->EncryptionLevel); /* encryptionLevel */
|
||||
|
||||
if (settings->EncryptionMethods == ENCRYPTION_METHOD_NONE &&
|
||||
settings->EncryptionLevel == ENCRYPTION_LEVEL_NONE)
|
||||
@ -1008,35 +1008,35 @@ void gcc_write_server_security_data(wStream* s, rdpSettings* settings)
|
||||
return;
|
||||
}
|
||||
|
||||
stream_write_UINT32(s, serverRandomLen); /* serverRandomLen */
|
||||
stream_write_UINT32(s, serverCertLen); /* serverCertLen */
|
||||
Stream_Write_UINT32(s, serverRandomLen); /* serverRandomLen */
|
||||
Stream_Write_UINT32(s, serverCertLen); /* serverCertLen */
|
||||
|
||||
settings->ServerRandomLength = serverRandomLen;
|
||||
settings->ServerRandom = (BYTE*) malloc(serverRandomLen);
|
||||
crypto_nonce(settings->ServerRandom, serverRandomLen);
|
||||
stream_write(s, settings->ServerRandom, serverRandomLen);
|
||||
Stream_Write(s, settings->ServerRandom, serverRandomLen);
|
||||
|
||||
sigData = Stream_Pointer(s);
|
||||
|
||||
stream_write_UINT32(s, CERT_CHAIN_VERSION_1); /* dwVersion (4 bytes) */
|
||||
stream_write_UINT32(s, SIGNATURE_ALG_RSA); /* dwSigAlgId */
|
||||
stream_write_UINT32(s, KEY_EXCHANGE_ALG_RSA); /* dwKeyAlgId */
|
||||
stream_write_UINT16(s, BB_RSA_KEY_BLOB); /* wPublicKeyBlobType */
|
||||
Stream_Write_UINT32(s, CERT_CHAIN_VERSION_1); /* dwVersion (4 bytes) */
|
||||
Stream_Write_UINT32(s, SIGNATURE_ALG_RSA); /* dwSigAlgId */
|
||||
Stream_Write_UINT32(s, KEY_EXCHANGE_ALG_RSA); /* dwKeyAlgId */
|
||||
Stream_Write_UINT16(s, BB_RSA_KEY_BLOB); /* wPublicKeyBlobType */
|
||||
|
||||
stream_write_UINT16(s, wPublicKeyBlobLen); /* wPublicKeyBlobLen */
|
||||
stream_write(s, "RSA1", 4); /* magic */
|
||||
stream_write_UINT32(s, keyLen + 8); /* keylen */
|
||||
stream_write_UINT32(s, keyLen * 8); /* bitlen */
|
||||
stream_write_UINT32(s, keyLen - 1); /* datalen */
|
||||
Stream_Write_UINT16(s, wPublicKeyBlobLen); /* wPublicKeyBlobLen */
|
||||
Stream_Write(s, "RSA1", 4); /* magic */
|
||||
Stream_Write_UINT32(s, keyLen + 8); /* keylen */
|
||||
Stream_Write_UINT32(s, keyLen * 8); /* bitlen */
|
||||
Stream_Write_UINT32(s, keyLen - 1); /* datalen */
|
||||
|
||||
stream_write(s, settings->RdpServerRsaKey->exponent, expLen);
|
||||
stream_write(s, settings->RdpServerRsaKey->Modulus, keyLen);
|
||||
stream_write_zero(s, 8);
|
||||
Stream_Write(s, settings->RdpServerRsaKey->exponent, expLen);
|
||||
Stream_Write(s, settings->RdpServerRsaKey->Modulus, keyLen);
|
||||
Stream_Write_zero(s, 8);
|
||||
|
||||
sigDataLen = Stream_Pointer(s) - sigData;
|
||||
|
||||
stream_write_UINT16(s, BB_RSA_SIGNATURE_BLOB); /* wSignatureBlobType */
|
||||
stream_write_UINT16(s, keyLen + 8); /* wSignatureBlobLen */
|
||||
Stream_Write_UINT16(s, BB_RSA_SIGNATURE_BLOB); /* wSignatureBlobType */
|
||||
Stream_Write_UINT16(s, keyLen + 8); /* wSignatureBlobLen */
|
||||
|
||||
memcpy(signature, initial_signature, sizeof(initial_signature));
|
||||
|
||||
@ -1047,8 +1047,8 @@ void gcc_write_server_security_data(wStream* s, rdpSettings* settings)
|
||||
crypto_rsa_private_encrypt(signature, sizeof(signature), TSSK_KEY_LENGTH,
|
||||
tssk_modulus, tssk_privateExponent, encryptedSignature);
|
||||
|
||||
stream_write(s, encryptedSignature, sizeof(encryptedSignature));
|
||||
stream_write_zero(s, 8);
|
||||
Stream_Write(s, encryptedSignature, sizeof(encryptedSignature));
|
||||
Stream_Write_zero(s, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1065,7 +1065,7 @@ BOOL gcc_read_client_network_data(wStream* s, rdpSettings* settings, UINT16 bloc
|
||||
if (blockLength < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, settings->ChannelCount); /* channelCount */
|
||||
Stream_Read_UINT32(s, settings->ChannelCount); /* channelCount */
|
||||
if (blockLength < 4 + settings->ChannelCount * 12)
|
||||
return FALSE;
|
||||
if (settings->ChannelCount > 16)
|
||||
@ -1075,8 +1075,8 @@ BOOL gcc_read_client_network_data(wStream* s, rdpSettings* settings, UINT16 bloc
|
||||
for (i = 0; i < settings->ChannelCount; i++)
|
||||
{
|
||||
/* CHANNEL_DEF */
|
||||
stream_read(s, settings->ChannelDefArray[i].Name, 8); /* name (8 bytes) */
|
||||
stream_read_UINT32(s, settings->ChannelDefArray[i].options); /* options (4 bytes) */
|
||||
Stream_Read(s, settings->ChannelDefArray[i].Name, 8); /* name (8 bytes) */
|
||||
Stream_Read_UINT32(s, settings->ChannelDefArray[i].options); /* options (4 bytes) */
|
||||
settings->ChannelDefArray[i].ChannelId = MCS_GLOBAL_CHANNEL_ID + 1 + i;
|
||||
}
|
||||
|
||||
@ -1100,14 +1100,14 @@ void gcc_write_client_network_data(wStream* s, rdpSettings* settings)
|
||||
length = settings->ChannelCount * 12 + 8;
|
||||
gcc_write_user_data_header(s, CS_NET, length);
|
||||
|
||||
stream_write_UINT32(s, settings->ChannelCount); /* channelCount */
|
||||
Stream_Write_UINT32(s, settings->ChannelCount); /* channelCount */
|
||||
|
||||
/* channelDefArray */
|
||||
for (i = 0; i < settings->ChannelCount; i++)
|
||||
{
|
||||
/* CHANNEL_DEF */
|
||||
stream_write(s, settings->ChannelDefArray[i].Name, 8); /* name (8 bytes) */
|
||||
stream_write_UINT32(s, settings->ChannelDefArray[i].options); /* options (4 bytes) */
|
||||
Stream_Write(s, settings->ChannelDefArray[i].Name, 8); /* name (8 bytes) */
|
||||
Stream_Write_UINT32(s, settings->ChannelDefArray[i].options); /* options (4 bytes) */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1121,8 +1121,8 @@ BOOL gcc_read_server_network_data(wStream* s, rdpSettings* settings)
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, MCSChannelId); /* MCSChannelId */
|
||||
stream_read_UINT16(s, channelCount); /* channelCount */
|
||||
Stream_Read_UINT16(s, MCSChannelId); /* MCSChannelId */
|
||||
Stream_Read_UINT16(s, channelCount); /* channelCount */
|
||||
|
||||
if (channelCount != settings->ChannelCount)
|
||||
{
|
||||
@ -1135,7 +1135,7 @@ BOOL gcc_read_server_network_data(wStream* s, rdpSettings* settings)
|
||||
|
||||
for (i = 0; i < channelCount; i++)
|
||||
{
|
||||
stream_read_UINT16(s, channelId); /* channelId */
|
||||
Stream_Read_UINT16(s, channelId); /* channelId */
|
||||
settings->ChannelDefArray[i].ChannelId = channelId;
|
||||
}
|
||||
|
||||
@ -1151,16 +1151,16 @@ void gcc_write_server_network_data(wStream* s, rdpSettings* settings)
|
||||
|
||||
gcc_write_user_data_header(s, SC_NET, 8 + settings->ChannelCount * 2 + (settings->ChannelCount % 2 == 1 ? 2 : 0));
|
||||
|
||||
stream_write_UINT16(s, MCS_GLOBAL_CHANNEL_ID); /* MCSChannelId */
|
||||
stream_write_UINT16(s, settings->ChannelCount); /* channelCount */
|
||||
Stream_Write_UINT16(s, MCS_GLOBAL_CHANNEL_ID); /* MCSChannelId */
|
||||
Stream_Write_UINT16(s, settings->ChannelCount); /* channelCount */
|
||||
|
||||
for (i = 0; i < settings->ChannelCount; i++)
|
||||
{
|
||||
stream_write_UINT16(s, settings->ChannelDefArray[i].ChannelId);
|
||||
Stream_Write_UINT16(s, settings->ChannelDefArray[i].ChannelId);
|
||||
}
|
||||
|
||||
if (settings->ChannelCount % 2 == 1)
|
||||
stream_write_UINT16(s, 0);
|
||||
Stream_Write_UINT16(s, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1177,13 +1177,13 @@ BOOL gcc_read_client_cluster_data(wStream* s, rdpSettings* settings, UINT16 bloc
|
||||
if (blockLength < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, flags); /* flags */
|
||||
Stream_Read_UINT32(s, flags); /* flags */
|
||||
|
||||
if ((flags & REDIRECTED_SESSIONID_FIELD_VALID))
|
||||
{
|
||||
if(blockLength < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, settings->RedirectedSessionId); /* redirectedSessionID */
|
||||
Stream_Read_UINT32(s, settings->RedirectedSessionId); /* redirectedSessionID */
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -1207,8 +1207,8 @@ void gcc_write_client_cluster_data(wStream* s, rdpSettings* settings)
|
||||
if (settings->ConsoleSession || settings->RedirectedSessionId)
|
||||
flags |= REDIRECTED_SESSIONID_FIELD_VALID;
|
||||
|
||||
stream_write_UINT32(s, flags); /* flags */
|
||||
stream_write_UINT32(s, settings->RedirectedSessionId); /* redirectedSessionID */
|
||||
Stream_Write_UINT32(s, flags); /* flags */
|
||||
Stream_Write_UINT32(s, settings->RedirectedSessionId); /* redirectedSessionID */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1242,8 +1242,8 @@ void gcc_write_client_monitor_data(wStream* s, rdpSettings* settings)
|
||||
length = (20 * settings->MonitorCount) + 12;
|
||||
gcc_write_user_data_header(s, CS_MONITOR, length);
|
||||
|
||||
stream_write_UINT32(s, 0); /* flags */
|
||||
stream_write_UINT32(s, settings->MonitorCount); /* monitorCount */
|
||||
Stream_Write_UINT32(s, 0); /* flags */
|
||||
Stream_Write_UINT32(s, settings->MonitorCount); /* monitorCount */
|
||||
|
||||
for (i = 0; i < settings->MonitorCount; i++)
|
||||
{
|
||||
@ -1253,11 +1253,11 @@ void gcc_write_client_monitor_data(wStream* s, rdpSettings* settings)
|
||||
bottom = settings->MonitorDefArray[i].y + settings->MonitorDefArray[i].height - 1;
|
||||
flags = settings->MonitorDefArray[i].is_primary ? MONITOR_PRIMARY : 0;
|
||||
|
||||
stream_write_UINT32(s, left); /* left */
|
||||
stream_write_UINT32(s, top); /* top */
|
||||
stream_write_UINT32(s, right); /* right */
|
||||
stream_write_UINT32(s, bottom); /* bottom */
|
||||
stream_write_UINT32(s, flags); /* flags */
|
||||
Stream_Write_UINT32(s, left); /* left */
|
||||
Stream_Write_UINT32(s, top); /* top */
|
||||
Stream_Write_UINT32(s, right); /* right */
|
||||
Stream_Write_UINT32(s, bottom); /* bottom */
|
||||
Stream_Write_UINT32(s, flags); /* flags */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,10 +56,10 @@ BOOL rdp_read_server_auto_reconnect_cookie(wStream* s, rdpSettings* settings)
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 4+4+4+16)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */
|
||||
stream_read_UINT32(s, autoReconnectCookie->version); /* version (4 bytes) */
|
||||
stream_read_UINT32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */
|
||||
stream_read(s, autoReconnectCookie->arcRandomBits, 16); /* arcRandomBits (16 bytes) */
|
||||
Stream_Read_UINT32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */
|
||||
Stream_Read_UINT32(s, autoReconnectCookie->version); /* version (4 bytes) */
|
||||
Stream_Read_UINT32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */
|
||||
Stream_Read(s, autoReconnectCookie->arcRandomBits, 16); /* arcRandomBits (16 bytes) */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -78,10 +78,10 @@ BOOL rdp_read_client_auto_reconnect_cookie(wStream* s, rdpSettings* settings)
|
||||
if (Stream_GetRemainingLength(s) < 28)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */
|
||||
stream_read_UINT32(s, autoReconnectCookie->version); /* version (4 bytes) */
|
||||
stream_read_UINT32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */
|
||||
stream_read(s, autoReconnectCookie->securityVerifier, 16); /* SecurityVerifier */
|
||||
Stream_Read_UINT32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */
|
||||
Stream_Read_UINT32(s, autoReconnectCookie->version); /* version (4 bytes) */
|
||||
Stream_Read_UINT32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */
|
||||
Stream_Read(s, autoReconnectCookie->securityVerifier, 16); /* SecurityVerifier */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -98,10 +98,10 @@ void rdp_write_client_auto_reconnect_cookie(wStream* s, rdpSettings* settings)
|
||||
ARC_CS_PRIVATE_PACKET* autoReconnectCookie;
|
||||
autoReconnectCookie = settings->ClientAutoReconnectCookie;
|
||||
|
||||
stream_write_UINT32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */
|
||||
stream_write_UINT32(s, autoReconnectCookie->version); /* version (4 bytes) */
|
||||
stream_write_UINT32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */
|
||||
stream_write(s, autoReconnectCookie->securityVerifier, 16); /* SecurityVerifier */
|
||||
Stream_Write_UINT32(s, autoReconnectCookie->cbLen); /* cbLen (4 bytes) */
|
||||
Stream_Write_UINT32(s, autoReconnectCookie->version); /* version (4 bytes) */
|
||||
Stream_Write_UINT32(s, autoReconnectCookie->logonId); /* LogonId (4 bytes) */
|
||||
Stream_Write(s, autoReconnectCookie->securityVerifier, 16); /* SecurityVerifier */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -120,8 +120,8 @@ BOOL rdp_read_extended_info_packet(wStream* s, rdpSettings* settings)
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, clientAddressFamily); /* clientAddressFamily */
|
||||
stream_read_UINT16(s, cbClientAddress); /* cbClientAddress */
|
||||
Stream_Read_UINT16(s, clientAddressFamily); /* clientAddressFamily */
|
||||
Stream_Read_UINT16(s, cbClientAddress); /* cbClientAddress */
|
||||
|
||||
settings->IPv6Enabled = (clientAddressFamily == ADDRESS_FAMILY_INET6 ? TRUE : FALSE);
|
||||
|
||||
@ -133,7 +133,7 @@ BOOL rdp_read_extended_info_packet(wStream* s, rdpSettings* settings)
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, cbClientDir); /* cbClientDir */
|
||||
Stream_Read_UINT16(s, cbClientDir); /* cbClientDir */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < cbClientDir)
|
||||
return FALSE;
|
||||
@ -150,9 +150,9 @@ BOOL rdp_read_extended_info_packet(wStream* s, rdpSettings* settings)
|
||||
if (Stream_GetRemainingLength(s) < 10)
|
||||
return FALSE;
|
||||
Stream_Seek_UINT32(s); /* clientSessionId, should be set to 0 */
|
||||
stream_read_UINT32(s, settings->PerformanceFlags); /* performanceFlags */
|
||||
Stream_Read_UINT32(s, settings->PerformanceFlags); /* performanceFlags */
|
||||
|
||||
stream_read_UINT16(s, cbAutoReconnectLen); /* cbAutoReconnectLen */
|
||||
Stream_Read_UINT16(s, cbAutoReconnectLen); /* cbAutoReconnectLen */
|
||||
|
||||
if (cbAutoReconnectLen > 0)
|
||||
return rdp_read_client_auto_reconnect_cookie(s, settings); /* autoReconnectCookie */
|
||||
@ -187,26 +187,26 @@ void rdp_write_extended_info_packet(wStream* s, rdpSettings* settings)
|
||||
|
||||
cbAutoReconnectLen = (int) settings->ClientAutoReconnectCookie->cbLen;
|
||||
|
||||
stream_write_UINT16(s, clientAddressFamily); /* clientAddressFamily */
|
||||
Stream_Write_UINT16(s, clientAddressFamily); /* clientAddressFamily */
|
||||
|
||||
stream_write_UINT16(s, cbClientAddress + 2); /* cbClientAddress */
|
||||
Stream_Write_UINT16(s, cbClientAddress + 2); /* cbClientAddress */
|
||||
|
||||
if (cbClientAddress > 0)
|
||||
stream_write(s, clientAddress, cbClientAddress); /* clientAddress */
|
||||
stream_write_UINT16(s, 0);
|
||||
Stream_Write(s, clientAddress, cbClientAddress); /* clientAddress */
|
||||
Stream_Write_UINT16(s, 0);
|
||||
|
||||
stream_write_UINT16(s, cbClientDir + 2); /* cbClientDir */
|
||||
Stream_Write_UINT16(s, cbClientDir + 2); /* cbClientDir */
|
||||
|
||||
if (cbClientDir > 0)
|
||||
stream_write(s, clientDir, cbClientDir); /* clientDir */
|
||||
stream_write_UINT16(s, 0);
|
||||
Stream_Write(s, clientDir, cbClientDir); /* clientDir */
|
||||
Stream_Write_UINT16(s, 0);
|
||||
|
||||
rdp_write_client_time_zone(s, settings); /* clientTimeZone */
|
||||
|
||||
stream_write_UINT32(s, 0); /* clientSessionId, should be set to 0 */
|
||||
stream_write_UINT32(s, settings->PerformanceFlags); /* performanceFlags */
|
||||
Stream_Write_UINT32(s, 0); /* clientSessionId, should be set to 0 */
|
||||
Stream_Write_UINT32(s, settings->PerformanceFlags); /* performanceFlags */
|
||||
|
||||
stream_write_UINT16(s, cbAutoReconnectLen); /* cbAutoReconnectLen */
|
||||
Stream_Write_UINT16(s, cbAutoReconnectLen); /* cbAutoReconnectLen */
|
||||
|
||||
if (cbAutoReconnectLen > 0)
|
||||
rdp_write_client_auto_reconnect_cookie(s, settings); /* autoReconnectCookie */
|
||||
@ -238,18 +238,18 @@ BOOL rdp_read_info_packet(wStream* s, rdpSettings* settings)
|
||||
return FALSE;
|
||||
|
||||
Stream_Seek_UINT32(s); /* CodePage */
|
||||
stream_read_UINT32(s, flags); /* flags */
|
||||
Stream_Read_UINT32(s, flags); /* flags */
|
||||
|
||||
settings->AutoLogonEnabled = ((flags & INFO_AUTOLOGON) ? TRUE : FALSE);
|
||||
settings->RemoteApplicationMode = ((flags & INFO_RAIL) ? TRUE : FALSE);
|
||||
settings->RemoteConsoleAudio = ((flags & INFO_REMOTECONSOLEAUDIO) ? TRUE : FALSE);
|
||||
settings->CompressionEnabled = ((flags & INFO_COMPRESSION) ? TRUE : FALSE);
|
||||
|
||||
stream_read_UINT16(s, cbDomain); /* cbDomain */
|
||||
stream_read_UINT16(s, cbUserName); /* cbUserName */
|
||||
stream_read_UINT16(s, cbPassword); /* cbPassword */
|
||||
stream_read_UINT16(s, cbAlternateShell); /* cbAlternateShell */
|
||||
stream_read_UINT16(s, cbWorkingDir); /* cbWorkingDir */
|
||||
Stream_Read_UINT16(s, cbDomain); /* cbDomain */
|
||||
Stream_Read_UINT16(s, cbUserName); /* cbUserName */
|
||||
Stream_Read_UINT16(s, cbPassword); /* cbPassword */
|
||||
Stream_Read_UINT16(s, cbAlternateShell); /* cbAlternateShell */
|
||||
Stream_Read_UINT16(s, cbWorkingDir); /* cbWorkingDir */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < cbDomain + 2)
|
||||
return FALSE;
|
||||
@ -382,34 +382,34 @@ void rdp_write_info_packet(wStream* s, rdpSettings* settings)
|
||||
|
||||
cbWorkingDir = ConvertToUnicode(CP_UTF8, 0, settings->ShellWorkingDirectory, -1, &workingDir, 0) * 2;
|
||||
|
||||
stream_write_UINT32(s, 0); /* CodePage */
|
||||
stream_write_UINT32(s, flags); /* flags */
|
||||
Stream_Write_UINT32(s, 0); /* CodePage */
|
||||
Stream_Write_UINT32(s, flags); /* flags */
|
||||
|
||||
stream_write_UINT16(s, cbDomain); /* cbDomain */
|
||||
stream_write_UINT16(s, cbUserName); /* cbUserName */
|
||||
stream_write_UINT16(s, cbPassword); /* cbPassword */
|
||||
stream_write_UINT16(s, cbAlternateShell); /* cbAlternateShell */
|
||||
stream_write_UINT16(s, cbWorkingDir); /* cbWorkingDir */
|
||||
Stream_Write_UINT16(s, cbDomain); /* cbDomain */
|
||||
Stream_Write_UINT16(s, cbUserName); /* cbUserName */
|
||||
Stream_Write_UINT16(s, cbPassword); /* cbPassword */
|
||||
Stream_Write_UINT16(s, cbAlternateShell); /* cbAlternateShell */
|
||||
Stream_Write_UINT16(s, cbWorkingDir); /* cbWorkingDir */
|
||||
|
||||
if (cbDomain > 0)
|
||||
stream_write(s, domain, cbDomain);
|
||||
stream_write_UINT16(s, 0);
|
||||
Stream_Write(s, domain, cbDomain);
|
||||
Stream_Write_UINT16(s, 0);
|
||||
|
||||
if (cbUserName > 0)
|
||||
stream_write(s, userName, cbUserName);
|
||||
stream_write_UINT16(s, 0);
|
||||
Stream_Write(s, userName, cbUserName);
|
||||
Stream_Write_UINT16(s, 0);
|
||||
|
||||
if (cbPassword > 0)
|
||||
stream_write(s, password, cbPassword);
|
||||
stream_write_UINT16(s, 0);
|
||||
Stream_Write(s, password, cbPassword);
|
||||
Stream_Write_UINT16(s, 0);
|
||||
|
||||
if (cbAlternateShell > 0)
|
||||
stream_write(s, alternateShell, cbAlternateShell);
|
||||
stream_write_UINT16(s, 0);
|
||||
Stream_Write(s, alternateShell, cbAlternateShell);
|
||||
Stream_Write_UINT16(s, 0);
|
||||
|
||||
if (cbWorkingDir > 0)
|
||||
stream_write(s, workingDir, cbWorkingDir);
|
||||
stream_write_UINT16(s, 0);
|
||||
Stream_Write(s, workingDir, cbWorkingDir);
|
||||
Stream_Write_UINT16(s, 0);
|
||||
|
||||
free(domain);
|
||||
free(userName);
|
||||
@ -491,9 +491,9 @@ BOOL rdp_recv_logon_info_v1(rdpRdp* rdp, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < (4 + 52 + 4 + 512 + 4))
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, cbDomain); /* cbDomain (4 bytes) */
|
||||
Stream_Read_UINT32(s, cbDomain); /* cbDomain (4 bytes) */
|
||||
Stream_Seek(s, 52); /* domain (52 bytes) */
|
||||
stream_read_UINT32(s, cbUserName); /* cbUserName (4 bytes) */
|
||||
Stream_Read_UINT32(s, cbUserName); /* cbUserName (4 bytes) */
|
||||
Stream_Seek(s, 512); /* userName (512 bytes) */
|
||||
Stream_Seek_UINT32(s); /* sessionId (4 bytes) */
|
||||
|
||||
@ -511,8 +511,8 @@ BOOL rdp_recv_logon_info_v2(rdpRdp* rdp, wStream* s)
|
||||
Stream_Seek_UINT16(s); /* version (2 bytes) */
|
||||
Stream_Seek_UINT32(s); /* size (4 bytes) */
|
||||
Stream_Seek_UINT32(s); /* sessionId (4 bytes) */
|
||||
stream_read_UINT32(s, cbDomain); /* cbDomain (4 bytes) */
|
||||
stream_read_UINT32(s, cbUserName); /* cbUserName (4 bytes) */
|
||||
Stream_Read_UINT32(s, cbDomain); /* cbDomain (4 bytes) */
|
||||
Stream_Read_UINT32(s, cbUserName); /* cbUserName (4 bytes) */
|
||||
Stream_Seek(s, 558); /* pad */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < cbDomain+cbUserName)
|
||||
@ -542,8 +542,8 @@ BOOL rdp_recv_logon_error_info(rdpRdp* rdp, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, errorNotificationData); /* errorNotificationData (4 bytes) */
|
||||
stream_read_UINT32(s, errorNotificationType); /* errorNotificationType (4 bytes) */
|
||||
Stream_Read_UINT32(s, errorNotificationData); /* errorNotificationData (4 bytes) */
|
||||
Stream_Read_UINT32(s, errorNotificationType); /* errorNotificationType (4 bytes) */
|
||||
|
||||
IFCALL(rdp->instance->LogonErrorInfo, rdp->instance, errorNotificationData, errorNotificationType);
|
||||
|
||||
@ -559,8 +559,8 @@ BOOL rdp_recv_logon_info_extended(rdpRdp* rdp, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 6)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, Length); /* The total size in bytes of this structure */
|
||||
stream_read_UINT32(s, fieldsPresent); /* fieldsPresent (4 bytes) */
|
||||
Stream_Read_UINT16(s, Length); /* The total size in bytes of this structure */
|
||||
Stream_Read_UINT32(s, fieldsPresent); /* fieldsPresent (4 bytes) */
|
||||
|
||||
/* logonFields */
|
||||
|
||||
@ -569,7 +569,7 @@ BOOL rdp_recv_logon_info_extended(rdpRdp* rdp, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, cbFieldData); /* cbFieldData (4 bytes) */
|
||||
Stream_Read_UINT32(s, cbFieldData); /* cbFieldData (4 bytes) */
|
||||
|
||||
if (rdp_read_server_auto_reconnect_cookie(s, rdp->settings) == FALSE)
|
||||
return FALSE;
|
||||
@ -580,7 +580,7 @@ BOOL rdp_recv_logon_info_extended(rdpRdp* rdp, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, cbFieldData); /* cbFieldData (4 bytes) */
|
||||
Stream_Read_UINT32(s, cbFieldData); /* cbFieldData (4 bytes) */
|
||||
|
||||
if (rdp_recv_logon_error_info(rdp, s) == FALSE)
|
||||
return FALSE;
|
||||
@ -600,7 +600,7 @@ BOOL rdp_recv_save_session_info(rdpRdp* rdp, wStream* s)
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, infoType); /* infoType (4 bytes) */
|
||||
Stream_Read_UINT32(s, infoType); /* infoType (4 bytes) */
|
||||
|
||||
//fprintf(stderr, "%s\n", INFO_TYPE_LOGON_STRINGS[infoType]);
|
||||
|
||||
|
@ -31,14 +31,14 @@
|
||||
|
||||
void rdp_write_client_input_pdu_header(wStream* s, UINT16 number)
|
||||
{
|
||||
stream_write_UINT16(s, 1); /* numberEvents (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */
|
||||
Stream_Write_UINT16(s, 1); /* numberEvents (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */
|
||||
}
|
||||
|
||||
void rdp_write_input_event_header(wStream* s, UINT32 time, UINT16 type)
|
||||
{
|
||||
stream_write_UINT32(s, time); /* eventTime (4 bytes) */
|
||||
stream_write_UINT16(s, type); /* messageType (2 bytes) */
|
||||
Stream_Write_UINT32(s, time); /* eventTime (4 bytes) */
|
||||
Stream_Write_UINT16(s, type); /* messageType (2 bytes) */
|
||||
}
|
||||
|
||||
wStream* rdp_client_input_pdu_init(rdpRdp* rdp, UINT16 type)
|
||||
@ -57,8 +57,8 @@ void rdp_send_client_input_pdu(rdpRdp* rdp, wStream* s)
|
||||
|
||||
void input_write_synchronize_event(wStream* s, UINT32 flags)
|
||||
{
|
||||
stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */
|
||||
stream_write_UINT32(s, flags); /* toggleFlags (4 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */
|
||||
Stream_Write_UINT32(s, flags); /* toggleFlags (4 bytes) */
|
||||
}
|
||||
|
||||
void input_send_synchronize_event(rdpInput* input, UINT32 flags)
|
||||
@ -73,9 +73,9 @@ void input_send_synchronize_event(rdpInput* input, UINT32 flags)
|
||||
|
||||
void input_write_keyboard_event(wStream* s, UINT16 flags, UINT16 code)
|
||||
{
|
||||
stream_write_UINT16(s, flags); /* keyboardFlags (2 bytes) */
|
||||
stream_write_UINT16(s, code); /* keyCode (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */
|
||||
Stream_Write_UINT16(s, flags); /* keyboardFlags (2 bytes) */
|
||||
Stream_Write_UINT16(s, code); /* keyCode (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */
|
||||
}
|
||||
|
||||
void input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
@ -90,9 +90,9 @@ void input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
|
||||
void input_write_unicode_keyboard_event(wStream* s, UINT16 flags, UINT16 code)
|
||||
{
|
||||
stream_write_UINT16(s, flags); /* keyboardFlags (2 bytes) */
|
||||
stream_write_UINT16(s, code); /* unicodeCode (2 bytes) */
|
||||
stream_write_UINT16(s, 0); /* pad2Octets (2 bytes) */
|
||||
Stream_Write_UINT16(s, flags); /* keyboardFlags (2 bytes) */
|
||||
Stream_Write_UINT16(s, code); /* unicodeCode (2 bytes) */
|
||||
Stream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */
|
||||
}
|
||||
|
||||
void input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
@ -119,9 +119,9 @@ void input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 cod
|
||||
|
||||
void input_write_mouse_event(wStream* s, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
stream_write_UINT16(s, flags); /* pointerFlags (2 bytes) */
|
||||
stream_write_UINT16(s, x); /* xPos (2 bytes) */
|
||||
stream_write_UINT16(s, y); /* yPos (2 bytes) */
|
||||
Stream_Write_UINT16(s, flags); /* pointerFlags (2 bytes) */
|
||||
Stream_Write_UINT16(s, x); /* xPos (2 bytes) */
|
||||
Stream_Write_UINT16(s, y); /* yPos (2 bytes) */
|
||||
}
|
||||
|
||||
void input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
@ -136,9 +136,9 @@ void input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
|
||||
void input_write_extended_mouse_event(wStream* s, UINT16 flags, UINT16 x, UINT16 y)
|
||||
{
|
||||
stream_write_UINT16(s, flags); /* pointerFlags (2 bytes) */
|
||||
stream_write_UINT16(s, x); /* xPos (2 bytes) */
|
||||
stream_write_UINT16(s, y); /* yPos (2 bytes) */
|
||||
Stream_Write_UINT16(s, flags); /* pointerFlags (2 bytes) */
|
||||
Stream_Write_UINT16(s, x); /* xPos (2 bytes) */
|
||||
Stream_Write_UINT16(s, y); /* yPos (2 bytes) */
|
||||
}
|
||||
|
||||
void input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
@ -185,7 +185,7 @@ void input_send_fastpath_keyboard_event(rdpInput* input, UINT16 flags, UINT16 co
|
||||
eventFlags |= (flags & KBD_FLAGS_RELEASE) ? FASTPATH_INPUT_KBDFLAGS_RELEASE : 0;
|
||||
eventFlags |= (flags & KBD_FLAGS_EXTENDED) ? FASTPATH_INPUT_KBDFLAGS_EXTENDED : 0;
|
||||
s = fastpath_input_pdu_init(rdp->fastpath, eventFlags, FASTPATH_INPUT_EVENT_SCANCODE);
|
||||
stream_write_BYTE(s, code); /* keyCode (1 byte) */
|
||||
Stream_Write_UINT8(s, code); /* keyCode (1 byte) */
|
||||
fastpath_send_input_pdu(rdp->fastpath, s);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ void input_send_fastpath_unicode_keyboard_event(rdpInput* input, UINT16 flags, U
|
||||
|
||||
eventFlags |= (flags & KBD_FLAGS_RELEASE) ? FASTPATH_INPUT_KBDFLAGS_RELEASE : 0;
|
||||
s = fastpath_input_pdu_init(rdp->fastpath, eventFlags, FASTPATH_INPUT_EVENT_UNICODE);
|
||||
stream_write_UINT16(s, code); /* unicodeCode (2 bytes) */
|
||||
Stream_Write_UINT16(s, code); /* unicodeCode (2 bytes) */
|
||||
fastpath_send_input_pdu(rdp->fastpath, s);
|
||||
}
|
||||
|
||||
@ -230,21 +230,21 @@ void input_send_fastpath_focus_in_event(rdpInput* input, UINT16 toggleStates, UI
|
||||
s = fastpath_input_pdu_init_header(rdp->fastpath);
|
||||
/* send a tab up like mstsc.exe */
|
||||
eventFlags = FASTPATH_INPUT_KBDFLAGS_RELEASE | FASTPATH_INPUT_EVENT_SCANCODE << 5;
|
||||
stream_write_BYTE(s, eventFlags); /* Key Release event (1 byte) */
|
||||
stream_write_BYTE(s, 0x0f); /* keyCode (1 byte) */
|
||||
Stream_Write_UINT8(s, eventFlags); /* Key Release event (1 byte) */
|
||||
Stream_Write_UINT8(s, 0x0f); /* keyCode (1 byte) */
|
||||
|
||||
/* send the toggle key states */
|
||||
eventFlags = (toggleStates & 0x1F) | FASTPATH_INPUT_EVENT_SYNC << 5;
|
||||
stream_write_BYTE(s, eventFlags); /* toggle state (1 byte) */
|
||||
Stream_Write_UINT8(s, eventFlags); /* toggle state (1 byte) */
|
||||
|
||||
/* send another tab up like mstsc.exe */
|
||||
eventFlags = FASTPATH_INPUT_KBDFLAGS_RELEASE | FASTPATH_INPUT_EVENT_SCANCODE << 5;
|
||||
stream_write_BYTE(s, eventFlags); /* Key Release event (1 byte) */
|
||||
stream_write_BYTE(s, 0x0f); /* keyCode (1 byte) */
|
||||
Stream_Write_UINT8(s, eventFlags); /* Key Release event (1 byte) */
|
||||
Stream_Write_UINT8(s, 0x0f); /* keyCode (1 byte) */
|
||||
|
||||
/* finish with a mouse pointer position like mstsc.exe */
|
||||
eventFlags = 0 | FASTPATH_INPUT_EVENT_MOUSE << 5;
|
||||
stream_write_BYTE(s, eventFlags); /* Mouse Pointer event (1 byte) */
|
||||
Stream_Write_UINT8(s, eventFlags); /* Mouse Pointer event (1 byte) */
|
||||
input_write_extended_mouse_event(s, PTR_FLAGS_MOVE, x, y);
|
||||
|
||||
fastpath_send_multiple_input_pdu(rdp->fastpath, s, 4);
|
||||
@ -258,7 +258,7 @@ static BOOL input_recv_sync_event(rdpInput* input, wStream* s)
|
||||
return FALSE;
|
||||
|
||||
Stream_Seek(s, 2); /* pad2Octets (2 bytes) */
|
||||
stream_read_UINT32(s, toggleFlags); /* toggleFlags (4 bytes) */
|
||||
Stream_Read_UINT32(s, toggleFlags); /* toggleFlags (4 bytes) */
|
||||
|
||||
IFCALL(input->SynchronizeEvent, input, toggleFlags);
|
||||
|
||||
@ -272,8 +272,8 @@ static BOOL input_recv_keyboard_event(rdpInput* input, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 6)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, keyboardFlags); /* keyboardFlags (2 bytes) */
|
||||
stream_read_UINT16(s, keyCode); /* keyCode (2 bytes) */
|
||||
Stream_Read_UINT16(s, keyboardFlags); /* keyboardFlags (2 bytes) */
|
||||
Stream_Read_UINT16(s, keyCode); /* keyCode (2 bytes) */
|
||||
Stream_Seek(s, 2); /* pad2Octets (2 bytes) */
|
||||
|
||||
IFCALL(input->KeyboardEvent, input, keyboardFlags, keyCode);
|
||||
@ -288,8 +288,8 @@ static BOOL input_recv_unicode_keyboard_event(rdpInput* input, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 6)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, keyboardFlags); /* keyboardFlags (2 bytes) */
|
||||
stream_read_UINT16(s, unicodeCode); /* unicodeCode (2 bytes) */
|
||||
Stream_Read_UINT16(s, keyboardFlags); /* keyboardFlags (2 bytes) */
|
||||
Stream_Read_UINT16(s, unicodeCode); /* unicodeCode (2 bytes) */
|
||||
Stream_Seek(s, 2); /* pad2Octets (2 bytes) */
|
||||
|
||||
/*
|
||||
@ -317,9 +317,9 @@ static BOOL input_recv_mouse_event(rdpInput* input, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 6)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */
|
||||
stream_read_UINT16(s, xPos); /* xPos (2 bytes) */
|
||||
stream_read_UINT16(s, yPos); /* yPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */
|
||||
Stream_Read_UINT16(s, xPos); /* xPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, yPos); /* yPos (2 bytes) */
|
||||
|
||||
IFCALL(input->MouseEvent, input, pointerFlags, xPos, yPos);
|
||||
|
||||
@ -333,9 +333,9 @@ static BOOL input_recv_extended_mouse_event(rdpInput* input, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 6)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */
|
||||
stream_read_UINT16(s, xPos); /* xPos (2 bytes) */
|
||||
stream_read_UINT16(s, yPos); /* yPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointerFlags); /* pointerFlags (2 bytes) */
|
||||
Stream_Read_UINT16(s, xPos); /* xPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, yPos); /* yPos (2 bytes) */
|
||||
|
||||
IFCALL(input->ExtendedMouseEvent, input, pointerFlags, xPos, yPos);
|
||||
|
||||
@ -350,7 +350,7 @@ static BOOL input_recv_event(rdpInput* input, wStream* s)
|
||||
return FALSE;
|
||||
|
||||
Stream_Seek(s, 4); /* eventTime (4 bytes), ignored by the server */
|
||||
stream_read_UINT16(s, messageType); /* messageType (2 bytes) */
|
||||
Stream_Read_UINT16(s, messageType); /* messageType (2 bytes) */
|
||||
|
||||
switch (messageType)
|
||||
{
|
||||
@ -396,7 +396,7 @@ BOOL input_recv(rdpInput* input, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, numberEvents); /* numberEvents (2 bytes) */
|
||||
Stream_Read_UINT16(s, numberEvents); /* numberEvents (2 bytes) */
|
||||
Stream_Seek(s, 2); /* pad2Octets (2 bytes) */
|
||||
|
||||
/* Each input event uses 6 exactly bytes. */
|
||||
|
@ -129,9 +129,9 @@ BOOL license_read_preamble(wStream* s, BYTE* bMsgType, BYTE* flags, UINT16* wMsg
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, *bMsgType); /* bMsgType (1 byte) */
|
||||
stream_read_BYTE(s, *flags); /* flags (1 byte) */
|
||||
stream_read_UINT16(s, *wMsgSize); /* wMsgSize (2 bytes) */
|
||||
Stream_Read_UINT8(s, *bMsgType); /* bMsgType (1 byte) */
|
||||
Stream_Read_UINT8(s, *flags); /* flags (1 byte) */
|
||||
Stream_Read_UINT16(s, *wMsgSize); /* wMsgSize (2 bytes) */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -148,9 +148,9 @@ BOOL license_read_preamble(wStream* s, BYTE* bMsgType, BYTE* flags, UINT16* wMsg
|
||||
void license_write_preamble(wStream* s, BYTE bMsgType, BYTE flags, UINT16 wMsgSize)
|
||||
{
|
||||
/* preamble (4 bytes) */
|
||||
stream_write_BYTE(s, bMsgType); /* bMsgType (1 byte) */
|
||||
stream_write_BYTE(s, flags); /* flags (1 byte) */
|
||||
stream_write_UINT16(s, wMsgSize); /* wMsgSize (2 bytes) */
|
||||
Stream_Write_UINT8(s, bMsgType); /* bMsgType (1 byte) */
|
||||
Stream_Write_UINT8(s, flags); /* flags (1 byte) */
|
||||
Stream_Write_UINT16(s, wMsgSize); /* wMsgSize (2 bytes) */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -466,17 +466,17 @@ BOOL license_read_product_info(wStream* s, PRODUCT_INFO* productInfo)
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, productInfo->dwVersion); /* dwVersion (4 bytes) */
|
||||
Stream_Read_UINT32(s, productInfo->dwVersion); /* dwVersion (4 bytes) */
|
||||
|
||||
stream_read_UINT32(s, productInfo->cbCompanyName); /* cbCompanyName (4 bytes) */
|
||||
Stream_Read_UINT32(s, productInfo->cbCompanyName); /* cbCompanyName (4 bytes) */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < productInfo->cbCompanyName + 4)
|
||||
return FALSE;
|
||||
|
||||
productInfo->pbCompanyName = (BYTE*) malloc(productInfo->cbCompanyName);
|
||||
stream_read(s, productInfo->pbCompanyName, productInfo->cbCompanyName);
|
||||
Stream_Read(s, productInfo->pbCompanyName, productInfo->cbCompanyName);
|
||||
|
||||
stream_read_UINT32(s, productInfo->cbProductId); /* cbProductId (4 bytes) */
|
||||
Stream_Read_UINT32(s, productInfo->cbProductId); /* cbProductId (4 bytes) */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < productInfo->cbProductId)
|
||||
{
|
||||
@ -486,7 +486,7 @@ BOOL license_read_product_info(wStream* s, PRODUCT_INFO* productInfo)
|
||||
}
|
||||
|
||||
productInfo->pbProductId = (BYTE*) malloc(productInfo->cbProductId);
|
||||
stream_read(s, productInfo->pbProductId, productInfo->cbProductId);
|
||||
Stream_Read(s, productInfo->pbProductId, productInfo->cbProductId);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -543,8 +543,8 @@ BOOL license_read_binary_blob(wStream* s, LICENSE_BLOB* blob)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, wBlobType); /* wBlobType (2 bytes) */
|
||||
stream_read_UINT16(s, blob->length); /* wBlobLen (2 bytes) */
|
||||
Stream_Read_UINT16(s, wBlobType); /* wBlobType (2 bytes) */
|
||||
Stream_Read_UINT16(s, blob->length); /* wBlobLen (2 bytes) */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < blob->length)
|
||||
return FALSE;
|
||||
@ -564,7 +564,7 @@ BOOL license_read_binary_blob(wStream* s, LICENSE_BLOB* blob)
|
||||
blob->type = wBlobType;
|
||||
blob->data = (BYTE*) malloc(blob->length);
|
||||
|
||||
stream_read(s, blob->data, blob->length); /* blobData */
|
||||
Stream_Read(s, blob->data, blob->length); /* blobData */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -577,11 +577,11 @@ BOOL license_read_binary_blob(wStream* s, LICENSE_BLOB* blob)
|
||||
|
||||
void license_write_binary_blob(wStream* s, LICENSE_BLOB* blob)
|
||||
{
|
||||
stream_write_UINT16(s, blob->type); /* wBlobType (2 bytes) */
|
||||
stream_write_UINT16(s, blob->length); /* wBlobLen (2 bytes) */
|
||||
Stream_Write_UINT16(s, blob->type); /* wBlobType (2 bytes) */
|
||||
Stream_Write_UINT16(s, blob->length); /* wBlobLen (2 bytes) */
|
||||
|
||||
if (blob->length > 0)
|
||||
stream_write(s, blob->data, blob->length); /* blobData */
|
||||
Stream_Write(s, blob->data, blob->length); /* blobData */
|
||||
}
|
||||
|
||||
void license_write_encrypted_premaster_secret_blob(wStream* s, LICENSE_BLOB* blob, UINT32 ModulusLength)
|
||||
@ -596,13 +596,13 @@ void license_write_encrypted_premaster_secret_blob(wStream* s, LICENSE_BLOB* blo
|
||||
return;
|
||||
}
|
||||
|
||||
stream_write_UINT16(s, blob->type); /* wBlobType (2 bytes) */
|
||||
stream_write_UINT16(s, length); /* wBlobLen (2 bytes) */
|
||||
Stream_Write_UINT16(s, blob->type); /* wBlobType (2 bytes) */
|
||||
Stream_Write_UINT16(s, length); /* wBlobLen (2 bytes) */
|
||||
|
||||
if (blob->length > 0)
|
||||
stream_write(s, blob->data, blob->length); /* blobData */
|
||||
Stream_Write(s, blob->data, blob->length); /* blobData */
|
||||
|
||||
stream_write_zero(s, length - blob->length);
|
||||
Stream_Write_zero(s, length - blob->length);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -652,7 +652,7 @@ BOOL license_read_scope_list(wStream* s, SCOPE_LIST* scopeList)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, scopeCount); /* ScopeCount (4 bytes) */
|
||||
Stream_Read_UINT32(s, scopeCount); /* ScopeCount (4 bytes) */
|
||||
|
||||
scopeList->count = scopeCount;
|
||||
scopeList->array = (LICENSE_BLOB*) malloc(sizeof(LICENSE_BLOB) * scopeCount);
|
||||
@ -725,7 +725,7 @@ BOOL license_read_license_request_packet(rdpLicense* license, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 32)
|
||||
return FALSE;
|
||||
|
||||
stream_read(s, license->ServerRandom, 32);
|
||||
Stream_Read(s, license->ServerRandom, 32);
|
||||
|
||||
/* ProductInfo */
|
||||
if (!license_read_product_info(s, license->ProductInfo))
|
||||
@ -784,7 +784,7 @@ BOOL license_read_platform_challenge_packet(rdpLicense* license, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, ConnectFlags); /* ConnectFlags, Reserved (4 bytes) */
|
||||
Stream_Read_UINT32(s, ConnectFlags); /* ConnectFlags, Reserved (4 bytes) */
|
||||
|
||||
/* EncryptedPlatformChallenge */
|
||||
license->EncryptedPlatformChallenge->type = BB_ANY_BLOB;
|
||||
@ -794,7 +794,7 @@ BOOL license_read_platform_challenge_packet(rdpLicense* license, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 16)
|
||||
return FALSE;
|
||||
|
||||
stream_read(s, MacData, 16); /* MACData (16 bytes) */
|
||||
Stream_Read(s, MacData, 16); /* MACData (16 bytes) */
|
||||
|
||||
license_decrypt_platform_challenge(license);
|
||||
|
||||
@ -859,8 +859,8 @@ BOOL license_read_error_alert_packet(rdpLicense* license, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, dwErrorCode); /* dwErrorCode (4 bytes) */
|
||||
stream_read_UINT32(s, dwStateTransition); /* dwStateTransition (4 bytes) */
|
||||
Stream_Read_UINT32(s, dwErrorCode); /* dwErrorCode (4 bytes) */
|
||||
Stream_Read_UINT32(s, dwStateTransition); /* dwStateTransition (4 bytes) */
|
||||
|
||||
if (!license_read_binary_blob(s, license->ErrorInfo)) /* bbErrorInfo */
|
||||
return FALSE;
|
||||
@ -914,9 +914,9 @@ void license_write_new_license_request_packet(rdpLicense* license, wStream* s)
|
||||
|
||||
PlatformId = CLIENT_OS_ID_WINNT_POST_52 | CLIENT_IMAGE_ID_MICROSOFT;
|
||||
|
||||
stream_write_UINT32(s, PreferredKeyExchangeAlg); /* PreferredKeyExchangeAlg (4 bytes) */
|
||||
stream_write_UINT32(s, PlatformId); /* PlatformId (4 bytes) */
|
||||
stream_write(s, license->ClientRandom, 32); /* ClientRandom (32 bytes) */
|
||||
Stream_Write_UINT32(s, PreferredKeyExchangeAlg); /* PreferredKeyExchangeAlg (4 bytes) */
|
||||
Stream_Write_UINT32(s, PlatformId); /* PlatformId (4 bytes) */
|
||||
Stream_Write(s, license->ClientRandom, 32); /* ClientRandom (32 bytes) */
|
||||
license_write_encrypted_premaster_secret_blob(s, license->EncryptedPremasterSecret, license->ModulusLength); /* EncryptedPremasterSecret */
|
||||
license_write_binary_blob(s, license->ClientUserName); /* ClientUserName */
|
||||
license_write_binary_blob(s, license->ClientMachineName); /* ClientMachineName */
|
||||
@ -990,7 +990,7 @@ void license_write_platform_challenge_response_packet(rdpLicense* license, wStre
|
||||
{
|
||||
license_write_binary_blob(s, license->EncryptedPlatformChallenge); /* EncryptedPlatformChallengeResponse */
|
||||
license_write_binary_blob(s, license->EncryptedHardwareId); /* EncryptedHWID */
|
||||
stream_write(s, macData, 16); /* MACData */
|
||||
Stream_Write(s, macData, 16); /* MACData */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1062,8 +1062,8 @@ BOOL license_send_valid_client_error_packet(rdpLicense* license)
|
||||
|
||||
DEBUG_LICENSE("Sending Error Alert Packet");
|
||||
|
||||
stream_write_UINT32(s, STATUS_VALID_CLIENT); /* dwErrorCode */
|
||||
stream_write_UINT32(s, ST_NO_TRANSITION); /* dwStateTransition */
|
||||
Stream_Write_UINT32(s, STATUS_VALID_CLIENT); /* dwErrorCode */
|
||||
Stream_Write_UINT32(s, ST_NO_TRANSITION); /* dwStateTransition */
|
||||
|
||||
license_write_binary_blob(s, license->ErrorInfo);
|
||||
|
||||
|
@ -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_get_head(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_get_head(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_get_head(tmps), length);
|
||||
stream_free(tmps);
|
||||
}
|
||||
|
||||
|
@ -277,15 +277,15 @@ BOOL nego_send_preconnection_pdu(rdpNego* nego)
|
||||
}
|
||||
|
||||
s = transport_send_stream_init(nego->transport, cbSize);
|
||||
stream_write_UINT32(s, cbSize); /* cbSize */
|
||||
stream_write_UINT32(s, 0); /* Flags */
|
||||
stream_write_UINT32(s, PRECONNECTION_PDU_V2); /* Version */
|
||||
stream_write_UINT32(s, nego->preconnection_id); /* Id */
|
||||
stream_write_UINT16(s, cchPCB); /* cchPCB */
|
||||
Stream_Write_UINT32(s, cbSize); /* cbSize */
|
||||
Stream_Write_UINT32(s, 0); /* Flags */
|
||||
Stream_Write_UINT32(s, PRECONNECTION_PDU_V2); /* Version */
|
||||
Stream_Write_UINT32(s, nego->preconnection_id); /* Id */
|
||||
Stream_Write_UINT16(s, cchPCB); /* cchPCB */
|
||||
|
||||
if (wszPCB)
|
||||
{
|
||||
stream_write(s, wszPCB, cchPCB * 2); /* wszPCB */
|
||||
Stream_Write(s, wszPCB, cchPCB * 2); /* wszPCB */
|
||||
free(wszPCB);
|
||||
}
|
||||
|
||||
@ -497,7 +497,7 @@ int nego_recv(rdpTransport* transport, wStream* s, void* extra)
|
||||
{
|
||||
/* rdpNegData (optional) */
|
||||
|
||||
stream_read_BYTE(s, type); /* Type */
|
||||
Stream_Read_UINT8(s, type); /* Type */
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@ -578,7 +578,7 @@ BOOL nego_read_request(rdpNego* nego, wStream* s)
|
||||
/* Optional routingToken or cookie, ending with CR+LF */
|
||||
while (Stream_GetRemainingLength(s) > 0)
|
||||
{
|
||||
stream_read_BYTE(s, c);
|
||||
Stream_Read_UINT8(s, c);
|
||||
|
||||
if (c != '\x0D')
|
||||
continue;
|
||||
@ -597,7 +597,7 @@ BOOL nego_read_request(rdpNego* nego, wStream* s)
|
||||
{
|
||||
/* rdpNegData (optional) */
|
||||
|
||||
stream_read_BYTE(s, type); /* Type */
|
||||
Stream_Read_UINT8(s, type); /* Type */
|
||||
|
||||
if (type != TYPE_RDP_NEG_REQ)
|
||||
{
|
||||
@ -651,9 +651,9 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
|
||||
|
||||
if (nego->RoutingToken)
|
||||
{
|
||||
stream_write(s, nego->RoutingToken, nego->RoutingTokenLength);
|
||||
stream_write_BYTE(s, 0x0D); /* CR */
|
||||
stream_write_BYTE(s, 0x0A); /* LF */
|
||||
Stream_Write(s, nego->RoutingToken, nego->RoutingTokenLength);
|
||||
Stream_Write_UINT8(s, 0x0D); /* CR */
|
||||
Stream_Write_UINT8(s, 0x0A); /* LF */
|
||||
length += nego->RoutingTokenLength + 2;
|
||||
}
|
||||
else if (nego->cookie)
|
||||
@ -663,10 +663,10 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
|
||||
if (cookie_length > (int) nego->cookie_max_length)
|
||||
cookie_length = nego->cookie_max_length;
|
||||
|
||||
stream_write(s, "Cookie: mstshash=", 17);
|
||||
stream_write(s, (BYTE*) nego->cookie, cookie_length);
|
||||
stream_write_BYTE(s, 0x0D); /* CR */
|
||||
stream_write_BYTE(s, 0x0A); /* LF */
|
||||
Stream_Write(s, "Cookie: mstshash=", 17);
|
||||
Stream_Write(s, (BYTE*) nego->cookie, cookie_length);
|
||||
Stream_Write_UINT8(s, 0x0D); /* CR */
|
||||
Stream_Write_UINT8(s, 0x0A); /* LF */
|
||||
length += cookie_length + 19;
|
||||
}
|
||||
|
||||
@ -675,10 +675,10 @@ BOOL nego_send_negotiation_request(rdpNego* nego)
|
||||
if ((nego->requested_protocols > PROTOCOL_RDP) || (nego->sendNegoData))
|
||||
{
|
||||
/* RDP_NEG_DATA must be present for TLS and NLA */
|
||||
stream_write_BYTE(s, TYPE_RDP_NEG_REQ);
|
||||
stream_write_BYTE(s, 0); /* flags, must be set to zero */
|
||||
stream_write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */
|
||||
stream_write_UINT32(s, nego->requested_protocols); /* requestedProtocols */
|
||||
Stream_Write_UINT8(s, TYPE_RDP_NEG_REQ);
|
||||
Stream_Write_UINT8(s, 0); /* flags, must be set to zero */
|
||||
Stream_Write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */
|
||||
Stream_Write_UINT32(s, nego->requested_protocols); /* requestedProtocols */
|
||||
length += 8;
|
||||
}
|
||||
|
||||
@ -707,9 +707,9 @@ void nego_process_negotiation_request(rdpNego* nego, wStream* s)
|
||||
|
||||
DEBUG_NEGO("RDP_NEG_REQ");
|
||||
|
||||
stream_read_BYTE(s, flags);
|
||||
stream_read_UINT16(s, length);
|
||||
stream_read_UINT32(s, nego->requested_protocols);
|
||||
Stream_Read_UINT8(s, flags);
|
||||
Stream_Read_UINT16(s, length);
|
||||
Stream_Read_UINT32(s, nego->requested_protocols);
|
||||
|
||||
DEBUG_NEGO("requested_protocols: %d", nego->requested_protocols);
|
||||
|
||||
@ -735,9 +735,9 @@ void nego_process_negotiation_response(rdpNego* nego, wStream* s)
|
||||
return;
|
||||
}
|
||||
|
||||
stream_read_BYTE(s, nego->flags);
|
||||
stream_read_UINT16(s, length);
|
||||
stream_read_UINT32(s, nego->selected_protocol);
|
||||
Stream_Read_UINT8(s, nego->flags);
|
||||
Stream_Read_UINT16(s, length);
|
||||
Stream_Read_UINT32(s, nego->selected_protocol);
|
||||
|
||||
nego->state = NEGO_STATE_FINAL;
|
||||
}
|
||||
@ -756,9 +756,9 @@ void nego_process_negotiation_failure(rdpNego* nego, wStream* s)
|
||||
|
||||
DEBUG_NEGO("RDP_NEG_FAILURE");
|
||||
|
||||
stream_read_BYTE(s, flags);
|
||||
stream_read_UINT16(s, length);
|
||||
stream_read_UINT32(s, failureCode);
|
||||
Stream_Read_UINT8(s, flags);
|
||||
Stream_Read_UINT16(s, length);
|
||||
Stream_Read_UINT32(s, failureCode);
|
||||
|
||||
switch (failureCode)
|
||||
{
|
||||
@ -816,23 +816,23 @@ BOOL nego_send_negotiation_response(rdpNego* nego)
|
||||
if (nego->selected_protocol > PROTOCOL_RDP)
|
||||
{
|
||||
/* RDP_NEG_DATA must be present for TLS and NLA */
|
||||
stream_write_BYTE(s, TYPE_RDP_NEG_RSP);
|
||||
stream_write_BYTE(s, EXTENDED_CLIENT_DATA_SUPPORTED); /* flags */
|
||||
stream_write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */
|
||||
stream_write_UINT32(s, nego->selected_protocol); /* selectedProtocol */
|
||||
Stream_Write_UINT8(s, TYPE_RDP_NEG_RSP);
|
||||
Stream_Write_UINT8(s, EXTENDED_CLIENT_DATA_SUPPORTED); /* flags */
|
||||
Stream_Write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */
|
||||
Stream_Write_UINT32(s, nego->selected_protocol); /* selectedProtocol */
|
||||
length += 8;
|
||||
}
|
||||
else if (!settings->RdpSecurity)
|
||||
{
|
||||
stream_write_BYTE(s, TYPE_RDP_NEG_FAILURE);
|
||||
stream_write_BYTE(s, 0); /* flags */
|
||||
stream_write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */
|
||||
Stream_Write_UINT8(s, TYPE_RDP_NEG_FAILURE);
|
||||
Stream_Write_UINT8(s, 0); /* flags */
|
||||
Stream_Write_UINT16(s, 8); /* RDP_NEG_DATA length (8) */
|
||||
/*
|
||||
* TODO: Check for other possibilities,
|
||||
* like SSL_NOT_ALLOWED_BY_SERVER.
|
||||
*/
|
||||
fprintf(stderr, "nego_send_negotiation_response: client supports only Standard RDP Security\n");
|
||||
stream_write_UINT32(s, SSL_REQUIRED_BY_SERVER);
|
||||
Stream_Write_UINT32(s, SSL_REQUIRED_BY_SERVER);
|
||||
length += 8;
|
||||
status = FALSE;
|
||||
}
|
||||
|
@ -1173,7 +1173,7 @@ int credssp_recv(rdpCredssp* credssp)
|
||||
Stream_GetRemainingLength(s) < length)
|
||||
return -1;
|
||||
sspi_SecBufferAlloc(&credssp->negoToken, length);
|
||||
stream_read(s, credssp->negoToken.pvBuffer, length);
|
||||
Stream_Read(s, credssp->negoToken.pvBuffer, length);
|
||||
credssp->negoToken.cbBuffer = length;
|
||||
}
|
||||
|
||||
@ -1184,7 +1184,7 @@ int credssp_recv(rdpCredssp* credssp)
|
||||
Stream_GetRemainingLength(s) < length)
|
||||
return -1;
|
||||
sspi_SecBufferAlloc(&credssp->authInfo, length);
|
||||
stream_read(s, credssp->authInfo.pvBuffer, length);
|
||||
Stream_Read(s, credssp->authInfo.pvBuffer, length);
|
||||
credssp->authInfo.cbBuffer = length;
|
||||
}
|
||||
|
||||
@ -1195,7 +1195,7 @@ int credssp_recv(rdpCredssp* credssp)
|
||||
Stream_GetRemainingLength(s) < length)
|
||||
return -1;
|
||||
sspi_SecBufferAlloc(&credssp->pubKeyAuth, length);
|
||||
stream_read(s, credssp->pubKeyAuth.pvBuffer, length);
|
||||
Stream_Read(s, credssp->pubKeyAuth.pvBuffer, length);
|
||||
credssp->pubKeyAuth.cbBuffer = length;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -137,7 +137,7 @@ static BOOL peer_recv_data_pdu(freerdp_peer* client, wStream* s)
|
||||
case DATA_PDU_TYPE_FRAME_ACKNOWLEDGE:
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, client->ack_frame_id);
|
||||
Stream_Read_UINT32(s, client->ack_frame_id);
|
||||
break;
|
||||
|
||||
case DATA_PDU_TYPE_REFRESH_RECT:
|
||||
|
@ -82,7 +82,7 @@ BOOL rdp_read_security_header(wStream* s, UINT16* flags)
|
||||
/* Basic Security Header */
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, *flags); /* flags */
|
||||
Stream_Read_UINT16(s, *flags); /* flags */
|
||||
Stream_Seek(s, 2); /* flagsHi (unused) */
|
||||
return TRUE;
|
||||
}
|
||||
@ -97,8 +97,8 @@ BOOL rdp_read_security_header(wStream* s, UINT16* flags)
|
||||
void rdp_write_security_header(wStream* s, UINT16 flags)
|
||||
{
|
||||
/* Basic Security Header */
|
||||
stream_write_UINT16(s, flags); /* flags */
|
||||
stream_write_UINT16(s, 0); /* flagsHi (unused) */
|
||||
Stream_Write_UINT16(s, flags); /* flags */
|
||||
Stream_Write_UINT16(s, 0); /* flagsHi (unused) */
|
||||
}
|
||||
|
||||
BOOL rdp_read_share_control_header(wStream* s, UINT16* length, UINT16* type, UINT16* channel_id)
|
||||
@ -107,16 +107,16 @@ BOOL rdp_read_share_control_header(wStream* s, UINT16* length, UINT16* type, UIN
|
||||
return FALSE;
|
||||
|
||||
/* Share Control Header */
|
||||
stream_read_UINT16(s, *length); /* totalLength */
|
||||
Stream_Read_UINT16(s, *length); /* totalLength */
|
||||
|
||||
if (*length - 2 > Stream_GetRemainingLength(s))
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, *type); /* pduType */
|
||||
Stream_Read_UINT16(s, *type); /* pduType */
|
||||
*type &= 0x0F; /* type is in the 4 least significant bits */
|
||||
|
||||
if (*length > 4)
|
||||
stream_read_UINT16(s, *channel_id); /* pduSource */
|
||||
Stream_Read_UINT16(s, *channel_id); /* pduSource */
|
||||
else
|
||||
*channel_id = 0; /* Windows XP can send such short DEACTIVATE_ALL PDUs. */
|
||||
|
||||
@ -128,9 +128,9 @@ void rdp_write_share_control_header(wStream* s, UINT16 length, UINT16 type, UINT
|
||||
length -= RDP_PACKET_HEADER_MAX_LENGTH;
|
||||
|
||||
/* Share Control Header */
|
||||
stream_write_UINT16(s, length); /* totalLength */
|
||||
stream_write_UINT16(s, type | 0x10); /* pduType */
|
||||
stream_write_UINT16(s, channel_id); /* pduSource */
|
||||
Stream_Write_UINT16(s, length); /* totalLength */
|
||||
Stream_Write_UINT16(s, type | 0x10); /* pduType */
|
||||
Stream_Write_UINT16(s, channel_id); /* pduSource */
|
||||
}
|
||||
|
||||
BOOL rdp_read_share_data_header(wStream* s, UINT16* length, BYTE* type, UINT32* share_id,
|
||||
@ -140,13 +140,13 @@ BOOL rdp_read_share_data_header(wStream* s, UINT16* length, BYTE* type, UINT32*
|
||||
return FALSE;
|
||||
|
||||
/* Share Data Header */
|
||||
stream_read_UINT32(s, *share_id); /* shareId (4 bytes) */
|
||||
Stream_Read_UINT32(s, *share_id); /* shareId (4 bytes) */
|
||||
Stream_Seek_BYTE(s); /* pad1 (1 byte) */
|
||||
Stream_Seek_BYTE(s); /* streamId (1 byte) */
|
||||
stream_read_UINT16(s, *length); /* uncompressedLength (2 bytes) */
|
||||
stream_read_BYTE(s, *type); /* pduType2, Data PDU Type (1 byte) */
|
||||
stream_read_BYTE(s, *compressed_type); /* compressedType (1 byte) */
|
||||
stream_read_UINT16(s, *compressed_len); /* compressedLength (2 bytes) */
|
||||
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) */
|
||||
Stream_Read_UINT16(s, *compressed_len); /* compressedLength (2 bytes) */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -157,13 +157,13 @@ void rdp_write_share_data_header(wStream* s, UINT16 length, BYTE type, UINT32 sh
|
||||
length -= RDP_SHARE_DATA_HEADER_LENGTH;
|
||||
|
||||
/* Share Data Header */
|
||||
stream_write_UINT32(s, share_id); /* shareId (4 bytes) */
|
||||
stream_write_BYTE(s, 0); /* pad1 (1 byte) */
|
||||
stream_write_BYTE(s, STREAM_LOW); /* streamId (1 byte) */
|
||||
stream_write_UINT16(s, length); /* uncompressedLength (2 bytes) */
|
||||
stream_write_BYTE(s, type); /* pduType2, Data PDU Type (1 byte) */
|
||||
stream_write_BYTE(s, 0); /* compressedType (1 byte) */
|
||||
stream_write_UINT16(s, 0); /* compressedLength (2 bytes) */
|
||||
Stream_Write_UINT32(s, share_id); /* shareId (4 bytes) */
|
||||
Stream_Write_UINT8(s, 0); /* pad1 (1 byte) */
|
||||
Stream_Write_UINT8(s, STREAM_LOW); /* streamId (1 byte) */
|
||||
Stream_Write_UINT16(s, length); /* uncompressedLength (2 bytes) */
|
||||
Stream_Write_UINT8(s, type); /* pduType2, Data PDU Type (1 byte) */
|
||||
Stream_Write_UINT8(s, 0); /* compressedType (1 byte) */
|
||||
Stream_Write_UINT16(s, 0); /* compressedLength (2 bytes) */
|
||||
}
|
||||
|
||||
static int rdp_security_stream_init(rdpRdp* rdp, wStream* s)
|
||||
@ -305,7 +305,7 @@ void rdp_write_header(rdpRdp* rdp, wStream* s, UINT16 length, UINT16 channel_id)
|
||||
mcs_write_domain_mcspdu_header(s, MCSPDU, length, 0);
|
||||
per_write_integer16(s, rdp->mcs->user_id, MCS_BASE_CHANNEL_ID); /* initiator */
|
||||
per_write_integer16(s, channel_id, 0); /* channelId */
|
||||
stream_write_BYTE(s, 0x70); /* dataPriority + segmentation */
|
||||
Stream_Write_UINT8(s, 0x70); /* dataPriority + segmentation */
|
||||
/*
|
||||
* We always encode length in two bytes, eventhough we could use
|
||||
* only one byte if length <= 0x7F. It is just easier that way,
|
||||
@ -313,7 +313,7 @@ void rdp_write_header(rdpRdp* rdp, wStream* s, UINT16 length, UINT16 channel_id)
|
||||
* the data first and then store the header.
|
||||
*/
|
||||
length = (length - RDP_PACKET_HEADER_MAX_LENGTH) | 0x8000;
|
||||
stream_write_UINT16_be(s, length); /* userData (OCTET_STRING) */
|
||||
Stream_Write_UINT16_BE(s, length); /* userData (OCTET_STRING) */
|
||||
}
|
||||
|
||||
static UINT32 rdp_security_stream_out(rdpRdp* rdp, wStream* s, int length)
|
||||
@ -335,8 +335,8 @@ static UINT32 rdp_security_stream_out(rdpRdp* rdp, wStream* s, int length)
|
||||
data = s->pointer + 12;
|
||||
|
||||
length = length - (data - s->buffer);
|
||||
stream_write_UINT16(s, 0x10); /* length */
|
||||
stream_write_BYTE(s, 0x1); /* TSFIPS_VERSION 1*/
|
||||
Stream_Write_UINT16(s, 0x10); /* length */
|
||||
Stream_Write_UINT8(s, 0x1); /* TSFIPS_VERSION 1*/
|
||||
|
||||
/* handle padding */
|
||||
pad = 8 - (length % 8);
|
||||
@ -346,7 +346,7 @@ static UINT32 rdp_security_stream_out(rdpRdp* rdp, wStream* s, int length)
|
||||
if (pad)
|
||||
memset(data+length, 0, pad);
|
||||
|
||||
stream_write_BYTE(s, pad);
|
||||
Stream_Write_UINT8(s, pad);
|
||||
|
||||
security_hmac_signature(data, length, s->pointer, rdp);
|
||||
Stream_Seek(s, 8);
|
||||
@ -487,7 +487,7 @@ BOOL rdp_recv_set_error_info_data_pdu(rdpRdp* rdp, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, rdp->errorInfo); /* errorInfo (4 bytes) */
|
||||
Stream_Read_UINT32(s, rdp->errorInfo); /* errorInfo (4 bytes) */
|
||||
|
||||
if (rdp->errorInfo != ERRINFO_SUCCESS)
|
||||
{
|
||||
@ -695,9 +695,9 @@ BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, int length, UINT16 securityFlags)
|
||||
if (Stream_GetRemainingLength(s) < 12)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, len); /* 0x10 */
|
||||
stream_read_BYTE(s, version); /* 0x1 */
|
||||
stream_read_BYTE(s, pad);
|
||||
Stream_Read_UINT16(s, len); /* 0x10 */
|
||||
Stream_Read_UINT8(s, version); /* 0x1 */
|
||||
Stream_Read_UINT8(s, pad);
|
||||
|
||||
sig = s->pointer;
|
||||
Stream_Seek(s, 8); /* signature */
|
||||
@ -724,7 +724,7 @@ BOOL rdp_decrypt(rdpRdp* rdp, wStream* s, int length, UINT16 securityFlags)
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
|
||||
stream_read(s, wmac, sizeof(wmac));
|
||||
Stream_Read(s, wmac, sizeof(wmac));
|
||||
length -= sizeof(wmac);
|
||||
if (!security_decrypt(s->pointer, length, rdp))
|
||||
return FALSE;
|
||||
|
@ -66,13 +66,13 @@ BOOL rdp_string_read_length32(wStream* s, rdpString* string)
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, string->length);
|
||||
Stream_Read_UINT32(s, string->length);
|
||||
|
||||
if(Stream_GetRemainingLength(s) < string->length)
|
||||
return FALSE;
|
||||
|
||||
string->unicode = (char*) malloc(string->length);
|
||||
stream_read(s, string->unicode, string->length);
|
||||
Stream_Read(s, string->unicode, string->length);
|
||||
|
||||
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) string->unicode, string->length / 2, &string->ascii, 0, NULL, NULL);
|
||||
|
||||
@ -96,10 +96,10 @@ BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, wStream* s)
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 12)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, flags); /* flags (2 bytes) */
|
||||
stream_read_UINT16(s, length); /* length (2 bytes) */
|
||||
stream_read_UINT32(s, redirection->sessionID); /* sessionID (4 bytes) */
|
||||
stream_read_UINT32(s, redirection->flags); /* redirFlags (4 bytes) */
|
||||
Stream_Read_UINT16(s, flags); /* flags (2 bytes) */
|
||||
Stream_Read_UINT16(s, length); /* length (2 bytes) */
|
||||
Stream_Read_UINT32(s, redirection->sessionID); /* sessionID (4 bytes) */
|
||||
Stream_Read_UINT32(s, redirection->flags); /* redirFlags (4 bytes) */
|
||||
|
||||
DEBUG_REDIR("flags: 0x%04X, length:%d, sessionID:0x%08X", flags, length, redirection->sessionID);
|
||||
|
||||
@ -118,12 +118,12 @@ BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, wStream* s)
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, redirection->LoadBalanceInfoLength);
|
||||
Stream_Read_UINT32(s, redirection->LoadBalanceInfoLength);
|
||||
if (Stream_GetRemainingLength(s) < redirection->LoadBalanceInfoLength)
|
||||
return FALSE;
|
||||
|
||||
redirection->LoadBalanceInfo = (BYTE*) malloc(redirection->LoadBalanceInfoLength);
|
||||
stream_read(s, redirection->LoadBalanceInfo, redirection->LoadBalanceInfoLength);
|
||||
Stream_Read(s, redirection->LoadBalanceInfo, redirection->LoadBalanceInfoLength);
|
||||
#ifdef WITH_DEBUG_REDIR
|
||||
DEBUG_REDIR("loadBalanceInfo:");
|
||||
winpr_HexDump(redirection->LoadBalanceInfo, redirection->LoadBalanceInfoLength);
|
||||
@ -149,9 +149,9 @@ BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, wStream* s)
|
||||
/* Note: length (hopefully) includes double zero termination */
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, redirection->PasswordCookieLength);
|
||||
Stream_Read_UINT32(s, redirection->PasswordCookieLength);
|
||||
redirection->PasswordCookie = (BYTE*) malloc(redirection->PasswordCookieLength);
|
||||
stream_read(s, redirection->PasswordCookie, redirection->PasswordCookieLength);
|
||||
Stream_Read(s, redirection->PasswordCookie, redirection->PasswordCookieLength);
|
||||
|
||||
#ifdef WITH_DEBUG_REDIR
|
||||
DEBUG_REDIR("password_cookie:");
|
||||
@ -188,9 +188,9 @@ BOOL rdp_recv_server_redirection_pdu(rdpRdp* rdp, wStream* s)
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, targetNetAddressesLength);
|
||||
Stream_Read_UINT32(s, targetNetAddressesLength);
|
||||
|
||||
stream_read_UINT32(s, redirection->targetNetAddressesCount);
|
||||
Stream_Read_UINT32(s, redirection->targetNetAddressesCount);
|
||||
count = redirection->targetNetAddressesCount;
|
||||
|
||||
redirection->targetNetAddresses = (rdpString*) malloc(count * sizeof(rdpString));
|
||||
|
@ -33,16 +33,16 @@ static int update_recv_surfcmd_surface_bits(rdpUpdate* update, wStream* s, UINT3
|
||||
if (Stream_GetRemainingLength(s) < 20)
|
||||
return -1;
|
||||
|
||||
stream_read_UINT16(s, cmd->destLeft);
|
||||
stream_read_UINT16(s, cmd->destTop);
|
||||
stream_read_UINT16(s, cmd->destRight);
|
||||
stream_read_UINT16(s, cmd->destBottom);
|
||||
stream_read_BYTE(s, cmd->bpp);
|
||||
Stream_Read_UINT16(s, cmd->destLeft);
|
||||
Stream_Read_UINT16(s, cmd->destTop);
|
||||
Stream_Read_UINT16(s, cmd->destRight);
|
||||
Stream_Read_UINT16(s, cmd->destBottom);
|
||||
Stream_Read_UINT8(s, cmd->bpp);
|
||||
Stream_Seek(s, 2); /* reserved1, reserved2 */
|
||||
stream_read_BYTE(s, cmd->codecID);
|
||||
stream_read_UINT16(s, cmd->width);
|
||||
stream_read_UINT16(s, cmd->height);
|
||||
stream_read_UINT32(s, cmd->bitmapDataLength);
|
||||
Stream_Read_UINT8(s, cmd->codecID);
|
||||
Stream_Read_UINT16(s, cmd->width);
|
||||
Stream_Read_UINT16(s, cmd->height);
|
||||
Stream_Read_UINT32(s, cmd->bitmapDataLength);
|
||||
|
||||
if (Stream_GetRemainingLength(s) < cmd->bitmapDataLength)
|
||||
return -1;
|
||||
@ -63,7 +63,7 @@ static void update_send_frame_acknowledge(rdpRdp* rdp, UINT32 frameId)
|
||||
wStream* s;
|
||||
|
||||
s = rdp_data_pdu_init(rdp);
|
||||
stream_write_UINT32(s, frameId);
|
||||
Stream_Write_UINT32(s, frameId);
|
||||
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FRAME_ACKNOWLEDGE, rdp->mcs->user_id);
|
||||
}
|
||||
|
||||
@ -74,8 +74,8 @@ static int update_recv_surfcmd_frame_marker(rdpUpdate* update, wStream* s, UINT3
|
||||
if (Stream_GetRemainingLength(s) < 6)
|
||||
return -1;
|
||||
|
||||
stream_read_UINT16(s, marker->frameAction);
|
||||
stream_read_UINT32(s, marker->frameId);
|
||||
Stream_Read_UINT16(s, marker->frameAction);
|
||||
Stream_Read_UINT32(s, marker->frameId);
|
||||
|
||||
IFCALL(update->SurfaceFrameMarker, update->context, marker);
|
||||
|
||||
@ -101,7 +101,7 @@ int update_recv_surfcmds(rdpUpdate* update, UINT32 size, wStream* s)
|
||||
{
|
||||
stream_get_mark(s, mark);
|
||||
|
||||
stream_read_UINT16(s, cmdType);
|
||||
Stream_Read_UINT16(s, cmdType);
|
||||
size -= 2;
|
||||
|
||||
switch (cmdType)
|
||||
@ -138,26 +138,26 @@ void update_write_surfcmd_surface_bits_header(wStream* s, SURFACE_BITS_COMMAND*
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH);
|
||||
|
||||
stream_write_UINT16(s, CMDTYPE_STREAM_SURFACE_BITS);
|
||||
Stream_Write_UINT16(s, CMDTYPE_STREAM_SURFACE_BITS);
|
||||
|
||||
stream_write_UINT16(s, cmd->destLeft);
|
||||
stream_write_UINT16(s, cmd->destTop);
|
||||
stream_write_UINT16(s, cmd->destRight);
|
||||
stream_write_UINT16(s, cmd->destBottom);
|
||||
stream_write_BYTE(s, cmd->bpp);
|
||||
stream_write_UINT16(s, 0); /* reserved1, reserved2 */
|
||||
stream_write_BYTE(s, cmd->codecID);
|
||||
stream_write_UINT16(s, cmd->width);
|
||||
stream_write_UINT16(s, cmd->height);
|
||||
stream_write_UINT32(s, cmd->bitmapDataLength);
|
||||
Stream_Write_UINT16(s, cmd->destLeft);
|
||||
Stream_Write_UINT16(s, cmd->destTop);
|
||||
Stream_Write_UINT16(s, cmd->destRight);
|
||||
Stream_Write_UINT16(s, cmd->destBottom);
|
||||
Stream_Write_UINT8(s, cmd->bpp);
|
||||
Stream_Write_UINT16(s, 0); /* reserved1, reserved2 */
|
||||
Stream_Write_UINT8(s, cmd->codecID);
|
||||
Stream_Write_UINT16(s, cmd->width);
|
||||
Stream_Write_UINT16(s, cmd->height);
|
||||
Stream_Write_UINT32(s, cmd->bitmapDataLength);
|
||||
}
|
||||
|
||||
void update_write_surfcmd_frame_marker(wStream* s, UINT16 frameAction, UINT32 frameId)
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(s, SURFCMD_FRAME_MARKER_LENGTH);
|
||||
|
||||
stream_write_UINT16(s, CMDTYPE_FRAME_MARKER);
|
||||
Stream_Write_UINT16(s, CMDTYPE_FRAME_MARKER);
|
||||
|
||||
stream_write_UINT16(s, frameAction);
|
||||
stream_write_UINT32(s, frameId);
|
||||
Stream_Write_UINT16(s, frameAction);
|
||||
Stream_Write_UINT32(s, frameId);
|
||||
}
|
||||
|
@ -34,14 +34,14 @@
|
||||
|
||||
void rdp_read_system_time(wStream* s, SYSTEM_TIME* system_time)
|
||||
{
|
||||
stream_read_UINT16(s, system_time->wYear); /* wYear, must be set to 0 */
|
||||
stream_read_UINT16(s, system_time->wMonth); /* wMonth */
|
||||
stream_read_UINT16(s, system_time->wDayOfWeek); /* wDayOfWeek */
|
||||
stream_read_UINT16(s, system_time->wDay); /* wDay */
|
||||
stream_read_UINT16(s, system_time->wHour); /* wHour */
|
||||
stream_read_UINT16(s, system_time->wMinute); /* wMinute */
|
||||
stream_read_UINT16(s, system_time->wSecond); /* wSecond */
|
||||
stream_read_UINT16(s, system_time->wMilliseconds); /* wMilliseconds */
|
||||
Stream_Read_UINT16(s, system_time->wYear); /* wYear, must be set to 0 */
|
||||
Stream_Read_UINT16(s, system_time->wMonth); /* wMonth */
|
||||
Stream_Read_UINT16(s, system_time->wDayOfWeek); /* wDayOfWeek */
|
||||
Stream_Read_UINT16(s, system_time->wDay); /* wDay */
|
||||
Stream_Read_UINT16(s, system_time->wHour); /* wHour */
|
||||
Stream_Read_UINT16(s, system_time->wMinute); /* wMinute */
|
||||
Stream_Read_UINT16(s, system_time->wSecond); /* wSecond */
|
||||
Stream_Read_UINT16(s, system_time->wMilliseconds); /* wMilliseconds */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -53,14 +53,14 @@ void rdp_read_system_time(wStream* s, SYSTEM_TIME* system_time)
|
||||
|
||||
void rdp_write_system_time(wStream* s, SYSTEM_TIME* system_time)
|
||||
{
|
||||
stream_write_UINT16(s, system_time->wYear); /* wYear, must be set to 0 */
|
||||
stream_write_UINT16(s, system_time->wMonth); /* wMonth */
|
||||
stream_write_UINT16(s, system_time->wDayOfWeek); /* wDayOfWeek */
|
||||
stream_write_UINT16(s, system_time->wDay); /* wDay */
|
||||
stream_write_UINT16(s, system_time->wHour); /* wHour */
|
||||
stream_write_UINT16(s, system_time->wMinute); /* wMinute */
|
||||
stream_write_UINT16(s, system_time->wSecond); /* wSecond */
|
||||
stream_write_UINT16(s, system_time->wMilliseconds); /* wMilliseconds */
|
||||
Stream_Write_UINT16(s, system_time->wYear); /* wYear, must be set to 0 */
|
||||
Stream_Write_UINT16(s, system_time->wMonth); /* wMonth */
|
||||
Stream_Write_UINT16(s, system_time->wDayOfWeek); /* wDayOfWeek */
|
||||
Stream_Write_UINT16(s, system_time->wDay); /* wDay */
|
||||
Stream_Write_UINT16(s, system_time->wHour); /* wHour */
|
||||
Stream_Write_UINT16(s, system_time->wMinute); /* wMinute */
|
||||
Stream_Write_UINT16(s, system_time->wSecond); /* wSecond */
|
||||
Stream_Write_UINT16(s, system_time->wMilliseconds); /* wMilliseconds */
|
||||
DEBUG_TIMEZONE("Time: y=%d,m=%d,dow=%d,d=%d, %02d:%02d:%02d.%03d",
|
||||
system_time->wYear, system_time->wMonth, system_time->wDayOfWeek,
|
||||
system_time->wDay, system_time->wHour, system_time->wMinute,
|
||||
@ -84,7 +84,7 @@ BOOL rdp_read_client_time_zone(wStream* s, rdpSettings* settings)
|
||||
|
||||
clientTimeZone = settings->ClientTimeZone;
|
||||
|
||||
stream_read_UINT32(s, clientTimeZone->bias); /* Bias */
|
||||
Stream_Read_UINT32(s, clientTimeZone->bias); /* Bias */
|
||||
|
||||
/* standardName (64 bytes) */
|
||||
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s), 64 / 2, &str, 0, NULL, NULL);
|
||||
@ -94,7 +94,7 @@ BOOL rdp_read_client_time_zone(wStream* s, rdpSettings* settings)
|
||||
str = NULL;
|
||||
|
||||
rdp_read_system_time(s, &clientTimeZone->standardDate); /* StandardDate */
|
||||
stream_read_UINT32(s, clientTimeZone->standardBias); /* StandardBias */
|
||||
Stream_Read_UINT32(s, clientTimeZone->standardBias); /* StandardBias */
|
||||
|
||||
/* daylightName (64 bytes) */
|
||||
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s), 64 / 2, &str, 0, NULL, NULL);
|
||||
@ -103,7 +103,7 @@ BOOL rdp_read_client_time_zone(wStream* s, rdpSettings* settings)
|
||||
free(str);
|
||||
|
||||
rdp_read_system_time(s, &clientTimeZone->daylightDate); /* DaylightDate */
|
||||
stream_read_UINT32(s, clientTimeZone->daylightBias); /* DaylightBias */
|
||||
Stream_Read_UINT32(s, clientTimeZone->daylightBias); /* DaylightBias */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -136,11 +136,11 @@ void rdp_write_client_time_zone(wStream* s, rdpSettings* settings)
|
||||
daylightNameLength = 62;
|
||||
|
||||
/* Bias */
|
||||
stream_write_UINT32(s, clientTimeZone->bias);
|
||||
Stream_Write_UINT32(s, clientTimeZone->bias);
|
||||
|
||||
/* standardName (64 bytes) */
|
||||
stream_write(s, standardName, standardNameLength);
|
||||
stream_write_zero(s, 64 - standardNameLength);
|
||||
Stream_Write(s, standardName, standardNameLength);
|
||||
Stream_Write_zero(s, 64 - standardNameLength);
|
||||
|
||||
/* StandardDate */
|
||||
rdp_write_system_time(s, &clientTimeZone->standardDate);
|
||||
@ -149,19 +149,19 @@ void rdp_write_client_time_zone(wStream* s, rdpSettings* settings)
|
||||
|
||||
/* Note that StandardBias is ignored if no valid standardDate is provided. */
|
||||
/* StandardBias */
|
||||
stream_write_UINT32(s, clientTimeZone->standardBias);
|
||||
Stream_Write_UINT32(s, clientTimeZone->standardBias);
|
||||
DEBUG_TIMEZONE("StandardBias=%d", clientTimeZone->standardBias);
|
||||
|
||||
/* daylightName (64 bytes) */
|
||||
stream_write(s, daylightName, daylightNameLength);
|
||||
stream_write_zero(s, 64 - daylightNameLength);
|
||||
Stream_Write(s, daylightName, daylightNameLength);
|
||||
Stream_Write_zero(s, 64 - daylightNameLength);
|
||||
|
||||
/* DaylightDate */
|
||||
rdp_write_system_time(s, &clientTimeZone->daylightDate);
|
||||
|
||||
/* Note that DaylightBias is ignored if no valid daylightDate is provided. */
|
||||
/* DaylightBias */
|
||||
stream_write_UINT32(s, clientTimeZone->daylightBias);
|
||||
Stream_Write_UINT32(s, clientTimeZone->daylightBias);
|
||||
DEBUG_TIMEZONE("DaylightBias=%d", clientTimeZone->daylightBias);
|
||||
|
||||
free(standardName);
|
||||
|
@ -71,8 +71,8 @@ BOOL tpdu_read_header(wStream* s, BYTE* code, BYTE *li)
|
||||
if(Stream_GetRemainingLength(s) < 3)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, *li); /* LI */
|
||||
stream_read_BYTE(s, *code); /* Code */
|
||||
Stream_Read_UINT8(s, *li); /* LI */
|
||||
Stream_Read_UINT8(s, *code); /* Code */
|
||||
|
||||
if (*code == X224_TPDU_DATA)
|
||||
{
|
||||
@ -98,18 +98,18 @@ BOOL tpdu_read_header(wStream* s, BYTE* code, BYTE *li)
|
||||
|
||||
void tpdu_write_header(wStream* s, UINT16 length, BYTE code)
|
||||
{
|
||||
stream_write_BYTE(s, length); /* LI */
|
||||
stream_write_BYTE(s, code); /* code */
|
||||
Stream_Write_UINT8(s, length); /* LI */
|
||||
Stream_Write_UINT8(s, code); /* code */
|
||||
|
||||
if (code == X224_TPDU_DATA)
|
||||
{
|
||||
stream_write_BYTE(s, 0x80); /* EOT */
|
||||
Stream_Write_UINT8(s, 0x80); /* EOT */
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_write_UINT16(s, 0); /* DST-REF */
|
||||
stream_write_UINT16(s, 0); /* SRC-REF */
|
||||
stream_write_BYTE(s, 0); /* Class 0 */
|
||||
Stream_Write_UINT16(s, 0); /* DST-REF */
|
||||
Stream_Write_UINT16(s, 0); /* SRC-REF */
|
||||
Stream_Write_UINT8(s, 0); /* Class 0 */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ UINT16 tpkt_read_header(wStream* s)
|
||||
if (version == 3)
|
||||
{
|
||||
Stream_Seek(s, 2);
|
||||
stream_read_UINT16_be(s, length);
|
||||
Stream_Read_UINT16_BE(s, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -110,7 +110,7 @@ UINT16 tpkt_read_header(wStream* s)
|
||||
|
||||
void tpkt_write_header(wStream* s, UINT16 length)
|
||||
{
|
||||
stream_write_BYTE(s, 3); /* version */
|
||||
stream_write_BYTE(s, 0); /* reserved */
|
||||
stream_write_UINT16_be(s, length); /* length */
|
||||
Stream_Write_UINT8(s, 3); /* version */
|
||||
Stream_Write_UINT8(s, 0); /* reserved */
|
||||
Stream_Write_UINT16_BE(s, length); /* length */
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ BOOL update_recv_orders(rdpUpdate* update, wStream* s)
|
||||
return FALSE;
|
||||
|
||||
Stream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */
|
||||
stream_read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */
|
||||
Stream_Read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */
|
||||
Stream_Seek_UINT16(s); /* pad2OctetsB (2 bytes) */
|
||||
|
||||
while (numberOrders > 0)
|
||||
@ -72,24 +72,24 @@ BOOL update_read_bitmap_data(wStream* s, BITMAP_DATA* bitmap_data)
|
||||
if (Stream_GetRemainingLength(s) < 18)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, bitmap_data->destLeft);
|
||||
stream_read_UINT16(s, bitmap_data->destTop);
|
||||
stream_read_UINT16(s, bitmap_data->destRight);
|
||||
stream_read_UINT16(s, bitmap_data->destBottom);
|
||||
stream_read_UINT16(s, bitmap_data->width);
|
||||
stream_read_UINT16(s, bitmap_data->height);
|
||||
stream_read_UINT16(s, bitmap_data->bitsPerPixel);
|
||||
stream_read_UINT16(s, bitmap_data->flags);
|
||||
stream_read_UINT16(s, bitmap_data->bitmapLength);
|
||||
Stream_Read_UINT16(s, bitmap_data->destLeft);
|
||||
Stream_Read_UINT16(s, bitmap_data->destTop);
|
||||
Stream_Read_UINT16(s, bitmap_data->destRight);
|
||||
Stream_Read_UINT16(s, bitmap_data->destBottom);
|
||||
Stream_Read_UINT16(s, bitmap_data->width);
|
||||
Stream_Read_UINT16(s, bitmap_data->height);
|
||||
Stream_Read_UINT16(s, bitmap_data->bitsPerPixel);
|
||||
Stream_Read_UINT16(s, bitmap_data->flags);
|
||||
Stream_Read_UINT16(s, bitmap_data->bitmapLength);
|
||||
|
||||
if (bitmap_data->flags & BITMAP_COMPRESSION)
|
||||
{
|
||||
if (!(bitmap_data->flags & NO_BITMAP_COMPRESSION_HDR))
|
||||
{
|
||||
stream_read_UINT16(s, bitmap_data->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */
|
||||
stream_read_UINT16(s, bitmap_data->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */
|
||||
stream_read_UINT16(s, bitmap_data->cbScanWidth); /* cbScanWidth (2 bytes) */
|
||||
stream_read_UINT16(s, bitmap_data->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */
|
||||
Stream_Read_UINT16(s, bitmap_data->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */
|
||||
Stream_Read_UINT16(s, bitmap_data->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */
|
||||
Stream_Read_UINT16(s, bitmap_data->cbScanWidth); /* cbScanWidth (2 bytes) */
|
||||
Stream_Read_UINT16(s, bitmap_data->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */
|
||||
bitmap_data->bitmapLength = bitmap_data->cbCompMainBodySize;
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ BOOL update_read_bitmap(rdpUpdate* update, wStream* s, BITMAP_UPDATE* bitmap_upd
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, bitmap_update->number); /* numberRectangles (2 bytes) */
|
||||
Stream_Read_UINT16(s, bitmap_update->number); /* numberRectangles (2 bytes) */
|
||||
|
||||
if (bitmap_update->number > bitmap_update->count)
|
||||
{
|
||||
@ -150,7 +150,7 @@ BOOL update_read_palette(rdpUpdate* update, wStream* s, PALETTE_UPDATE* palette_
|
||||
return FALSE;
|
||||
|
||||
Stream_Seek_UINT16(s); /* pad2Octets (2 bytes) */
|
||||
stream_read_UINT32(s, palette_update->number); /* numberColors (4 bytes), must be set to 256 */
|
||||
Stream_Read_UINT32(s, palette_update->number); /* numberColors (4 bytes), must be set to 256 */
|
||||
|
||||
if (palette_update->number > 256)
|
||||
palette_update->number = 256;
|
||||
@ -163,9 +163,9 @@ BOOL update_read_palette(rdpUpdate* update, wStream* s, PALETTE_UPDATE* palette_
|
||||
{
|
||||
entry = &palette_update->entries[i];
|
||||
|
||||
stream_read_BYTE(s, entry->blue);
|
||||
stream_read_BYTE(s, entry->green);
|
||||
stream_read_BYTE(s, entry->red);
|
||||
Stream_Read_UINT8(s, entry->blue);
|
||||
Stream_Read_UINT8(s, entry->green);
|
||||
Stream_Read_UINT8(s, entry->red);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -185,8 +185,8 @@ BOOL update_read_play_sound(wStream* s, PLAY_SOUND_UPDATE* play_sound)
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, play_sound->duration); /* duration (4 bytes) */
|
||||
stream_read_UINT32(s, play_sound->frequency); /* frequency (4 bytes) */
|
||||
Stream_Read_UINT32(s, play_sound->duration); /* duration (4 bytes) */
|
||||
Stream_Read_UINT32(s, play_sound->frequency); /* frequency (4 bytes) */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -205,8 +205,8 @@ BOOL update_read_pointer_position(wStream* s, POINTER_POSITION_UPDATE* pointer_p
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, pointer_position->xPos); /* xPos (2 bytes) */
|
||||
stream_read_UINT16(s, pointer_position->yPos); /* yPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointer_position->xPos); /* xPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointer_position->yPos); /* yPos (2 bytes) */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ BOOL update_read_pointer_system(wStream* s, POINTER_SYSTEM_UPDATE* pointer_syste
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT32(s, pointer_system->type); /* systemPointerType (4 bytes) */
|
||||
Stream_Read_UINT32(s, pointer_system->type); /* systemPointerType (4 bytes) */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -224,13 +224,13 @@ BOOL update_read_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color)
|
||||
if (Stream_GetRemainingLength(s) < 14)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, pointer_color->cacheIndex); /* cacheIndex (2 bytes) */
|
||||
stream_read_UINT16(s, pointer_color->xPos); /* xPos (2 bytes) */
|
||||
stream_read_UINT16(s, pointer_color->yPos); /* yPos (2 bytes) */
|
||||
stream_read_UINT16(s, pointer_color->width); /* width (2 bytes) */
|
||||
stream_read_UINT16(s, pointer_color->height); /* height (2 bytes) */
|
||||
stream_read_UINT16(s, pointer_color->lengthAndMask); /* lengthAndMask (2 bytes) */
|
||||
stream_read_UINT16(s, pointer_color->lengthXorMask); /* lengthXorMask (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointer_color->cacheIndex); /* cacheIndex (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointer_color->xPos); /* xPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointer_color->yPos); /* yPos (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointer_color->width); /* width (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointer_color->height); /* height (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointer_color->lengthAndMask); /* lengthAndMask (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointer_color->lengthXorMask); /* lengthXorMask (2 bytes) */
|
||||
|
||||
/**
|
||||
* There does not seem to be any documentation on why
|
||||
@ -253,7 +253,7 @@ BOOL update_read_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color)
|
||||
else
|
||||
pointer_color->xorMaskData = realloc(pointer_color->xorMaskData, pointer_color->lengthXorMask);
|
||||
|
||||
stream_read(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);
|
||||
Stream_Read(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);
|
||||
}
|
||||
|
||||
if (pointer_color->lengthAndMask > 0)
|
||||
@ -266,7 +266,7 @@ BOOL update_read_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color)
|
||||
else
|
||||
pointer_color->andMaskData = realloc(pointer_color->andMaskData, pointer_color->lengthAndMask);
|
||||
|
||||
stream_read(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
|
||||
Stream_Read(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
|
||||
}
|
||||
|
||||
if (Stream_GetRemainingLength(s) > 0)
|
||||
@ -280,7 +280,7 @@ BOOL update_read_pointer_new(wStream* s, POINTER_NEW_UPDATE* pointer_new)
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */
|
||||
return update_read_pointer_color(s, &pointer_new->colorPtrAttr); /* colorPtrAttr */
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ BOOL update_read_pointer_cached(wStream* s, POINTER_CACHED_UPDATE* pointer_cache
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */
|
||||
Stream_Read_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ BOOL update_recv_pointer(rdpUpdate* update, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 2 + 2)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, messageType); /* messageType (2 bytes) */
|
||||
Stream_Read_UINT16(s, messageType); /* messageType (2 bytes) */
|
||||
Stream_Seek_UINT16(s); /* pad2Octets (2 bytes) */
|
||||
|
||||
switch (messageType)
|
||||
@ -351,7 +351,7 @@ BOOL update_recv(rdpUpdate* update, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, updateType); /* updateType (2 bytes) */
|
||||
Stream_Read_UINT16(s, updateType); /* updateType (2 bytes) */
|
||||
|
||||
//fprintf(stderr, "%s Update Data PDU\n", UPDATE_TYPE_STRINGS[updateType]);
|
||||
|
||||
@ -455,15 +455,15 @@ static void update_write_refresh_rect(wStream* s, BYTE count, RECTANGLE_16* area
|
||||
{
|
||||
int i;
|
||||
|
||||
stream_write_BYTE(s, count); /* numberOfAreas (1 byte) */
|
||||
Stream_Write_UINT8(s, count); /* numberOfAreas (1 byte) */
|
||||
Stream_Seek(s, 3); /* pad3Octets (3 bytes) */
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
stream_write_UINT16(s, areas[i].left); /* left (2 bytes) */
|
||||
stream_write_UINT16(s, areas[i].top); /* top (2 bytes) */
|
||||
stream_write_UINT16(s, areas[i].right); /* right (2 bytes) */
|
||||
stream_write_UINT16(s, areas[i].bottom); /* bottom (2 bytes) */
|
||||
Stream_Write_UINT16(s, areas[i].left); /* left (2 bytes) */
|
||||
Stream_Write_UINT16(s, areas[i].top); /* top (2 bytes) */
|
||||
Stream_Write_UINT16(s, areas[i].right); /* right (2 bytes) */
|
||||
Stream_Write_UINT16(s, areas[i].bottom); /* bottom (2 bytes) */
|
||||
}
|
||||
}
|
||||
|
||||
@ -483,15 +483,15 @@ static void update_send_refresh_rect(rdpContext* context, BYTE count, RECTANGLE_
|
||||
|
||||
static void update_write_suppress_output(wStream* s, BYTE allow, RECTANGLE_16* area)
|
||||
{
|
||||
stream_write_BYTE(s, allow); /* allowDisplayUpdates (1 byte) */
|
||||
Stream_Write_UINT8(s, allow); /* allowDisplayUpdates (1 byte) */
|
||||
Stream_Seek(s, 3); /* pad3Octets (3 bytes) */
|
||||
|
||||
if (allow > 0)
|
||||
{
|
||||
stream_write_UINT16(s, area->left); /* left (2 bytes) */
|
||||
stream_write_UINT16(s, area->top); /* top (2 bytes) */
|
||||
stream_write_UINT16(s, area->right); /* right (2 bytes) */
|
||||
stream_write_UINT16(s, area->bottom); /* bottom (2 bytes) */
|
||||
Stream_Write_UINT16(s, area->left); /* left (2 bytes) */
|
||||
Stream_Write_UINT16(s, area->top); /* top (2 bytes) */
|
||||
Stream_Write_UINT16(s, area->right); /* right (2 bytes) */
|
||||
Stream_Write_UINT16(s, area->bottom); /* bottom (2 bytes) */
|
||||
}
|
||||
}
|
||||
|
||||
@ -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_get_head(s), Stream_GetPosition(s));
|
||||
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, update);
|
||||
}
|
||||
|
||||
@ -528,7 +528,7 @@ static void update_send_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND*
|
||||
s = fastpath_update_pdu_init(rdp->fastpath);
|
||||
Stream_EnsureRemainingCapacity(s, SURFCMD_SURFACE_BITS_HEADER_LENGTH + (int) surface_bits_command->bitmapDataLength);
|
||||
update_write_surfcmd_surface_bits_header(s, surface_bits_command);
|
||||
stream_write(s, surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
|
||||
Stream_Write(s, surface_bits_command->bitmapData, surface_bits_command->bitmapDataLength);
|
||||
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s);
|
||||
}
|
||||
|
||||
@ -550,7 +550,7 @@ static void update_send_frame_acknowledge(rdpContext* context, UINT32 frameId)
|
||||
if (rdp->settings->ReceivedCapabilities[CAPSET_TYPE_FRAME_ACKNOWLEDGE])
|
||||
{
|
||||
s = rdp_data_pdu_init(rdp);
|
||||
stream_write_UINT32(s, frameId);
|
||||
Stream_Write_UINT32(s, frameId);
|
||||
rdp_send_data_pdu(rdp, s, DATA_PDU_TYPE_FRAME_ACKNOWLEDGE, rdp->mcs->user_id);
|
||||
}
|
||||
}
|
||||
@ -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_Write_zero(s, 2); /* pad2Octets (2 bytes) */
|
||||
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SYNCHRONIZE, s);
|
||||
}
|
||||
|
||||
@ -595,9 +595,9 @@ static void update_send_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
em = Stream_Pointer(s);
|
||||
|
||||
Stream_Pointer(s) = bm;
|
||||
stream_write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
stream_write_BYTE(s, orderInfo.controlFlags); /* controlFlags (1 byte) */
|
||||
stream_write_BYTE(s, orderInfo.orderType); /* orderType (1 byte) */
|
||||
Stream_Write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
Stream_Write_UINT8(s, orderInfo.controlFlags); /* controlFlags (1 byte) */
|
||||
Stream_Write_UINT8(s, orderInfo.orderType); /* orderType (1 byte) */
|
||||
update_write_field_flags(s, orderInfo.fieldFlags, orderInfo.controlFlags,
|
||||
PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo.orderType]);
|
||||
Stream_Pointer(s) = em;
|
||||
@ -627,9 +627,9 @@ static void update_send_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
|
||||
em = Stream_Pointer(s);
|
||||
|
||||
Stream_Pointer(s) = bm;
|
||||
stream_write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
stream_write_BYTE(s, orderInfo.controlFlags); /* controlFlags (1 byte) */
|
||||
stream_write_BYTE(s, orderInfo.orderType); /* orderType (1 byte) */
|
||||
Stream_Write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
Stream_Write_UINT8(s, orderInfo.controlFlags); /* controlFlags (1 byte) */
|
||||
Stream_Write_UINT8(s, orderInfo.orderType); /* orderType (1 byte) */
|
||||
update_write_field_flags(s, orderInfo.fieldFlags, orderInfo.controlFlags,
|
||||
PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo.orderType]);
|
||||
Stream_Pointer(s) = em;
|
||||
@ -659,9 +659,9 @@ static void update_send_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaq
|
||||
em = Stream_Pointer(s);
|
||||
|
||||
Stream_Pointer(s) = bm;
|
||||
stream_write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
stream_write_BYTE(s, orderInfo.controlFlags); /* controlFlags (1 byte) */
|
||||
stream_write_BYTE(s, orderInfo.orderType); /* orderType (1 byte) */
|
||||
Stream_Write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
Stream_Write_UINT8(s, orderInfo.controlFlags); /* controlFlags (1 byte) */
|
||||
Stream_Write_UINT8(s, orderInfo.orderType); /* orderType (1 byte) */
|
||||
update_write_field_flags(s, orderInfo.fieldFlags, orderInfo.controlFlags,
|
||||
PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo.orderType]);
|
||||
Stream_Pointer(s) = em;
|
||||
@ -691,9 +691,9 @@ static void update_send_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
|
||||
em = Stream_Pointer(s);
|
||||
|
||||
Stream_Pointer(s) = bm;
|
||||
stream_write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
stream_write_BYTE(s, orderInfo.controlFlags); /* controlFlags (1 byte) */
|
||||
stream_write_BYTE(s, orderInfo.orderType); /* orderType (1 byte) */
|
||||
Stream_Write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
Stream_Write_UINT8(s, orderInfo.controlFlags); /* controlFlags (1 byte) */
|
||||
Stream_Write_UINT8(s, orderInfo.orderType); /* orderType (1 byte) */
|
||||
update_write_field_flags(s, orderInfo.fieldFlags, orderInfo.controlFlags,
|
||||
PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo.orderType]);
|
||||
Stream_Pointer(s) = em;
|
||||
@ -723,9 +723,9 @@ static void update_send_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyp
|
||||
em = Stream_Pointer(s);
|
||||
|
||||
Stream_Pointer(s) = bm;
|
||||
stream_write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
stream_write_BYTE(s, orderInfo.controlFlags); /* controlFlags (1 byte) */
|
||||
stream_write_BYTE(s, orderInfo.orderType); /* orderType (1 byte) */
|
||||
Stream_Write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
Stream_Write_UINT8(s, orderInfo.controlFlags); /* controlFlags (1 byte) */
|
||||
Stream_Write_UINT8(s, orderInfo.orderType); /* orderType (1 byte) */
|
||||
update_write_field_flags(s, orderInfo.fieldFlags, orderInfo.controlFlags,
|
||||
PRIMARY_DRAWING_ORDER_FIELD_BYTES[orderInfo.orderType]);
|
||||
Stream_Pointer(s) = em;
|
||||
@ -752,11 +752,11 @@ static void update_send_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORD
|
||||
orderLength = (em - bm) - 13 - 2;
|
||||
|
||||
Stream_Pointer(s) = bm;
|
||||
stream_write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
stream_write_BYTE(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
||||
stream_write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
||||
stream_write_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
|
||||
stream_write_BYTE(s, ORDER_TYPE_BITMAP_UNCOMPRESSED_V2); /* orderType (1 byte) */
|
||||
Stream_Write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
||||
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
||||
Stream_Write_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
|
||||
Stream_Write_UINT8(s, ORDER_TYPE_BITMAP_UNCOMPRESSED_V2); /* orderType (1 byte) */
|
||||
Stream_Pointer(s) = em;
|
||||
|
||||
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_ORDERS, s);
|
||||
@ -781,11 +781,11 @@ static void update_send_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cach
|
||||
orderLength = (em - bm) - 13 - 2;
|
||||
|
||||
Stream_Pointer(s) = bm;
|
||||
stream_write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
stream_write_BYTE(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
||||
stream_write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
||||
stream_write_UINT16(s, flags); /* extraFlags (2 bytes) */
|
||||
stream_write_BYTE(s, ORDER_TYPE_CACHE_GLYPH); /* orderType (1 byte) */
|
||||
Stream_Write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
||||
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
||||
Stream_Write_UINT16(s, flags); /* extraFlags (2 bytes) */
|
||||
Stream_Write_UINT8(s, ORDER_TYPE_CACHE_GLYPH); /* orderType (1 byte) */
|
||||
Stream_Pointer(s) = em;
|
||||
|
||||
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_ORDERS, s);
|
||||
@ -810,11 +810,11 @@ static void update_send_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER
|
||||
orderLength = (em - bm) - 13 - 2;
|
||||
|
||||
Stream_Pointer(s) = bm;
|
||||
stream_write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
stream_write_BYTE(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
||||
stream_write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
||||
stream_write_UINT16(s, flags); /* extraFlags (2 bytes) */
|
||||
stream_write_BYTE(s, ORDER_TYPE_CACHE_GLYPH); /* orderType (1 byte) */
|
||||
Stream_Write_UINT16(s, 1); /* numberOrders (2 bytes) */
|
||||
Stream_Write_UINT8(s, ORDER_STANDARD | ORDER_SECONDARY | ORDER_TYPE_CHANGE); /* controlFlags (1 byte) */
|
||||
Stream_Write_UINT16(s, orderLength); /* orderLength (2 bytes) */
|
||||
Stream_Write_UINT16(s, flags); /* extraFlags (2 bytes) */
|
||||
Stream_Write_UINT8(s, ORDER_TYPE_CACHE_GLYPH); /* orderType (1 byte) */
|
||||
Stream_Pointer(s) = em;
|
||||
|
||||
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_ORDERS, s);
|
||||
@ -840,21 +840,21 @@ static void update_write_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(s, 15 + (int) pointer_color->lengthAndMask + (int) pointer_color->lengthXorMask);
|
||||
|
||||
stream_write_UINT16(s, pointer_color->cacheIndex);
|
||||
stream_write_UINT16(s, pointer_color->xPos);
|
||||
stream_write_UINT16(s, pointer_color->yPos);
|
||||
stream_write_UINT16(s, pointer_color->width);
|
||||
stream_write_UINT16(s, pointer_color->height);
|
||||
stream_write_UINT16(s, pointer_color->lengthAndMask);
|
||||
stream_write_UINT16(s, pointer_color->lengthXorMask);
|
||||
Stream_Write_UINT16(s, pointer_color->cacheIndex);
|
||||
Stream_Write_UINT16(s, pointer_color->xPos);
|
||||
Stream_Write_UINT16(s, pointer_color->yPos);
|
||||
Stream_Write_UINT16(s, pointer_color->width);
|
||||
Stream_Write_UINT16(s, pointer_color->height);
|
||||
Stream_Write_UINT16(s, pointer_color->lengthAndMask);
|
||||
Stream_Write_UINT16(s, pointer_color->lengthXorMask);
|
||||
|
||||
if (pointer_color->lengthXorMask > 0)
|
||||
stream_write(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);
|
||||
Stream_Write(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);
|
||||
|
||||
if (pointer_color->lengthAndMask > 0)
|
||||
stream_write(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
|
||||
Stream_Write(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
|
||||
|
||||
stream_write_BYTE(s, 0); /* pad (1 byte) */
|
||||
Stream_Write_UINT8(s, 0); /* pad (1 byte) */
|
||||
}
|
||||
|
||||
static void update_send_pointer_color(rdpContext* context, POINTER_COLOR_UPDATE* pointer_color)
|
||||
@ -873,7 +873,7 @@ static void update_send_pointer_new(rdpContext* context, POINTER_NEW_UPDATE* poi
|
||||
rdpRdp* rdp = context->rdp;
|
||||
|
||||
s = fastpath_update_pdu_init(rdp->fastpath);
|
||||
stream_write_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */
|
||||
Stream_Write_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */
|
||||
update_write_pointer_color(s, &pointer_new->colorPtrAttr);
|
||||
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_POINTER, s);
|
||||
}
|
||||
@ -884,7 +884,7 @@ static void update_send_pointer_cached(rdpContext* context, POINTER_CACHED_UPDAT
|
||||
rdpRdp* rdp = context->rdp;
|
||||
|
||||
s = fastpath_update_pdu_init(rdp->fastpath);
|
||||
stream_write_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */
|
||||
Stream_Write_UINT16(s, pointer_cached->cacheIndex); /* cacheIndex (2 bytes) */
|
||||
fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_CACHED, s);
|
||||
}
|
||||
|
||||
@ -897,7 +897,7 @@ BOOL update_read_refresh_rect(rdpUpdate* update, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, numberOfAreas);
|
||||
Stream_Read_UINT8(s, numberOfAreas);
|
||||
Stream_Seek(s, 3); /* pad3Octects */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < numberOfAreas * 4 * 2)
|
||||
@ -907,10 +907,10 @@ BOOL update_read_refresh_rect(rdpUpdate* update, wStream* s)
|
||||
|
||||
for (index = 0; index < numberOfAreas; index++)
|
||||
{
|
||||
stream_read_UINT16(s, areas[index].left);
|
||||
stream_read_UINT16(s, areas[index].top);
|
||||
stream_read_UINT16(s, areas[index].right);
|
||||
stream_read_UINT16(s, areas[index].bottom);
|
||||
Stream_Read_UINT16(s, areas[index].left);
|
||||
Stream_Read_UINT16(s, areas[index].top);
|
||||
Stream_Read_UINT16(s, areas[index].right);
|
||||
Stream_Read_UINT16(s, areas[index].bottom);
|
||||
}
|
||||
|
||||
IFCALL(update->RefreshRect, update->context, numberOfAreas, areas);
|
||||
@ -927,7 +927,7 @@ BOOL update_read_suppress_output(rdpUpdate* update, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, allowDisplayUpdates);
|
||||
Stream_Read_UINT8(s, allowDisplayUpdates);
|
||||
Stream_Seek(s, 3); /* pad3Octects */
|
||||
|
||||
if (allowDisplayUpdates > 0 && Stream_GetRemainingLength(s) < 8)
|
||||
|
@ -32,25 +32,25 @@ BOOL update_read_icon_info(wStream* s, ICON_INFO* icon_info)
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, icon_info->cacheEntry); /* cacheEntry (2 bytes) */
|
||||
stream_read_BYTE(s, icon_info->cacheId); /* cacheId (1 byte) */
|
||||
stream_read_BYTE(s, icon_info->bpp); /* bpp (1 byte) */
|
||||
stream_read_UINT16(s, icon_info->width); /* width (2 bytes) */
|
||||
stream_read_UINT16(s, icon_info->height); /* height (2 bytes) */
|
||||
Stream_Read_UINT16(s, icon_info->cacheEntry); /* cacheEntry (2 bytes) */
|
||||
Stream_Read_UINT8(s, icon_info->cacheId); /* cacheId (1 byte) */
|
||||
Stream_Read_UINT8(s, icon_info->bpp); /* bpp (1 byte) */
|
||||
Stream_Read_UINT16(s, icon_info->width); /* width (2 bytes) */
|
||||
Stream_Read_UINT16(s, icon_info->height); /* height (2 bytes) */
|
||||
|
||||
/* cbColorTable is only present when bpp is 1, 2 or 4 */
|
||||
if (icon_info->bpp == 1 || icon_info->bpp == 2 || icon_info->bpp == 4) {
|
||||
if(Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, icon_info->cbColorTable); /* cbColorTable (2 bytes) */
|
||||
Stream_Read_UINT16(s, icon_info->cbColorTable); /* cbColorTable (2 bytes) */
|
||||
} else {
|
||||
icon_info->cbColorTable = 0;
|
||||
}
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, icon_info->cbBitsMask); /* cbBitsMask (2 bytes) */
|
||||
stream_read_UINT16(s, icon_info->cbBitsColor); /* cbBitsColor (2 bytes) */
|
||||
Stream_Read_UINT16(s, icon_info->cbBitsMask); /* cbBitsMask (2 bytes) */
|
||||
Stream_Read_UINT16(s, icon_info->cbBitsColor); /* cbBitsColor (2 bytes) */
|
||||
|
||||
if(Stream_GetRemainingLength(s) < icon_info->cbBitsMask + icon_info->cbBitsColor)
|
||||
return FALSE;
|
||||
@ -60,21 +60,21 @@ BOOL update_read_icon_info(wStream* s, ICON_INFO* icon_info)
|
||||
icon_info->bitsMask = (BYTE*) malloc(icon_info->cbBitsMask);
|
||||
else
|
||||
icon_info->bitsMask = (BYTE*) realloc(icon_info->bitsMask, icon_info->cbBitsMask);
|
||||
stream_read(s, icon_info->bitsMask, icon_info->cbBitsMask);
|
||||
Stream_Read(s, icon_info->bitsMask, icon_info->cbBitsMask);
|
||||
|
||||
/* colorTable */
|
||||
if (icon_info->colorTable == NULL)
|
||||
icon_info->colorTable = (BYTE*) malloc(icon_info->cbColorTable);
|
||||
else
|
||||
icon_info->colorTable = (BYTE*) realloc(icon_info->colorTable, icon_info->cbColorTable);
|
||||
stream_read(s, icon_info->colorTable, icon_info->cbColorTable);
|
||||
Stream_Read(s, icon_info->colorTable, icon_info->cbColorTable);
|
||||
|
||||
/* bitsColor */
|
||||
if (icon_info->bitsColor == NULL)
|
||||
icon_info->bitsColor = (BYTE*) malloc(icon_info->cbBitsColor);
|
||||
else
|
||||
icon_info->bitsColor = (BYTE*) realloc(icon_info->bitsColor, icon_info->cbBitsColor);
|
||||
stream_read(s, icon_info->bitsColor, icon_info->cbBitsColor);
|
||||
Stream_Read(s, icon_info->bitsColor, icon_info->cbBitsColor);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -82,8 +82,8 @@ BOOL update_read_cached_icon_info(wStream* s, CACHED_ICON_INFO* cached_icon_info
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 3)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, cached_icon_info->cacheEntry); /* cacheEntry (2 bytes) */
|
||||
stream_read_BYTE(s, cached_icon_info->cacheId); /* cacheId (1 byte) */
|
||||
Stream_Read_UINT16(s, cached_icon_info->cacheEntry); /* cacheEntry (2 bytes) */
|
||||
Stream_Read_UINT8(s, cached_icon_info->cacheId); /* cacheId (1 byte) */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -91,8 +91,8 @@ BOOL update_read_notify_icon_infotip(wStream* s, NOTIFY_ICON_INFOTIP* notify_ico
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, notify_icon_infotip->timeout); /* timeout (4 bytes) */
|
||||
stream_read_UINT32(s, notify_icon_infotip->flags); /* infoFlags (4 bytes) */
|
||||
Stream_Read_UINT32(s, notify_icon_infotip->timeout); /* timeout (4 bytes) */
|
||||
Stream_Read_UINT32(s, notify_icon_infotip->flags); /* infoFlags (4 bytes) */
|
||||
return rail_read_unicode_string(s, ¬ify_icon_infotip->text) && /* infoTipText */
|
||||
rail_read_unicode_string(s, ¬ify_icon_infotip->title); /* title */
|
||||
}
|
||||
@ -105,21 +105,21 @@ BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WI
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OWNER) {
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, window_state->ownerWindowId); /* ownerWindowId (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->ownerWindowId); /* ownerWindowId (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_STYLE)
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, window_state->style); /* style (4 bytes) */
|
||||
stream_read_UINT32(s, window_state->extendedStyle); /* extendedStyle (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->style); /* style (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->extendedStyle); /* extendedStyle (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_SHOW) {
|
||||
if(Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, window_state->showState); /* showState (1 byte) */
|
||||
Stream_Read_UINT8(s, window_state->showState); /* showState (1 byte) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE) {
|
||||
@ -131,59 +131,59 @@ BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WI
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, window_state->clientOffsetX); /* clientOffsetX (4 bytes) */
|
||||
stream_read_UINT32(s, window_state->clientOffsetY); /* clientOffsetY (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->clientOffsetX); /* clientOffsetX (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->clientOffsetY); /* clientOffsetY (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, window_state->clientAreaWidth); /* clientAreaWidth (4 bytes) */
|
||||
stream_read_UINT32(s, window_state->clientAreaHeight); /* clientAreaHeight (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->clientAreaWidth); /* clientAreaWidth (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->clientAreaHeight); /* clientAreaHeight (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT) {
|
||||
if(Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, window_state->RPContent); /* RPContent (1 byte) */
|
||||
Stream_Read_UINT8(s, window_state->RPContent); /* RPContent (1 byte) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT) {
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, window_state->rootParentHandle);/* rootParentHandle (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->rootParentHandle);/* rootParentHandle (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET)
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, window_state->windowOffsetX); /* windowOffsetX (4 bytes) */
|
||||
stream_read_UINT32(s, window_state->windowOffsetY); /* windowOffsetY (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->windowOffsetX); /* windowOffsetX (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->windowOffsetY); /* windowOffsetY (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, window_state->windowClientDeltaX); /* windowClientDeltaX (4 bytes) */
|
||||
stream_read_UINT32(s, window_state->windowClientDeltaY); /* windowClientDeltaY (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->windowClientDeltaX); /* windowClientDeltaX (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->windowClientDeltaY); /* windowClientDeltaY (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, window_state->windowWidth); /* windowWidth (4 bytes) */
|
||||
stream_read_UINT32(s, window_state->windowHeight); /* windowHeight (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->windowWidth); /* windowWidth (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->windowHeight); /* windowHeight (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, window_state->numWindowRects); /* numWindowRects (2 bytes) */
|
||||
Stream_Read_UINT16(s, window_state->numWindowRects); /* numWindowRects (2 bytes) */
|
||||
|
||||
size = sizeof(RECTANGLE_16) * window_state->numWindowRects;
|
||||
window_state->windowRects = (RECTANGLE_16*) malloc(size);
|
||||
@ -194,10 +194,10 @@ BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WI
|
||||
/* windowRects */
|
||||
for (i = 0; i < (int) window_state->numWindowRects; i++)
|
||||
{
|
||||
stream_read_UINT16(s, window_state->windowRects[i].left); /* left (2 bytes) */
|
||||
stream_read_UINT16(s, window_state->windowRects[i].top); /* top (2 bytes) */
|
||||
stream_read_UINT16(s, window_state->windowRects[i].right); /* right (2 bytes) */
|
||||
stream_read_UINT16(s, window_state->windowRects[i].bottom); /* bottom (2 bytes) */
|
||||
Stream_Read_UINT16(s, window_state->windowRects[i].left); /* left (2 bytes) */
|
||||
Stream_Read_UINT16(s, window_state->windowRects[i].top); /* top (2 bytes) */
|
||||
Stream_Read_UINT16(s, window_state->windowRects[i].right); /* right (2 bytes) */
|
||||
Stream_Read_UINT16(s, window_state->windowRects[i].bottom); /* bottom (2 bytes) */
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,15 +205,15 @@ BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WI
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, window_state->visibleOffsetX); /* visibleOffsetX (4 bytes) */
|
||||
stream_read_UINT32(s, window_state->visibleOffsetY); /* visibleOffsetY (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->visibleOffsetX); /* visibleOffsetX (4 bytes) */
|
||||
Stream_Read_UINT32(s, window_state->visibleOffsetY); /* visibleOffsetY (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, window_state->numVisibilityRects); /* numVisibilityRects (2 bytes) */
|
||||
Stream_Read_UINT16(s, window_state->numVisibilityRects); /* numVisibilityRects (2 bytes) */
|
||||
|
||||
size = sizeof(RECTANGLE_16) * window_state->numVisibilityRects;
|
||||
window_state->visibilityRects = (RECTANGLE_16*) malloc(size);
|
||||
@ -224,10 +224,10 @@ BOOL update_read_window_state_order(wStream* s, WINDOW_ORDER_INFO* orderInfo, WI
|
||||
/* visibilityRects */
|
||||
for (i = 0; i < (int) window_state->numVisibilityRects; i++)
|
||||
{
|
||||
stream_read_UINT16(s, window_state->visibilityRects[i].left); /* left (2 bytes) */
|
||||
stream_read_UINT16(s, window_state->visibilityRects[i].top); /* top (2 bytes) */
|
||||
stream_read_UINT16(s, window_state->visibilityRects[i].right); /* right (2 bytes) */
|
||||
stream_read_UINT16(s, window_state->visibilityRects[i].bottom); /* bottom (2 bytes) */
|
||||
Stream_Read_UINT16(s, window_state->visibilityRects[i].left); /* left (2 bytes) */
|
||||
Stream_Read_UINT16(s, window_state->visibilityRects[i].top); /* top (2 bytes) */
|
||||
Stream_Read_UINT16(s, window_state->visibilityRects[i].right); /* right (2 bytes) */
|
||||
Stream_Read_UINT16(s, window_state->visibilityRects[i].bottom); /* bottom (2 bytes) */
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -258,7 +258,7 @@ BOOL update_recv_window_info_order(rdpUpdate* update, wStream* s, WINDOW_ORDER_I
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, orderInfo->windowId); /* windowId (4 bytes) */
|
||||
Stream_Read_UINT32(s, orderInfo->windowId); /* windowId (4 bytes) */
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_ICON)
|
||||
{
|
||||
@ -299,7 +299,7 @@ BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* or
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_VERSION) {
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, notify_icon_state->version); /* version (4 bytes) */
|
||||
Stream_Read_UINT32(s, notify_icon_state->version); /* version (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_TIP) {
|
||||
@ -315,7 +315,7 @@ BOOL update_read_notification_icon_state_order(wStream* s, WINDOW_ORDER_INFO* or
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_STATE) {
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, notify_icon_state->state); /* state (4 bytes) */
|
||||
Stream_Read_UINT32(s, notify_icon_state->state); /* state (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_ICON) {
|
||||
@ -342,8 +342,8 @@ BOOL update_recv_notification_icon_info_order(rdpUpdate* update, wStream* s, WIN
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 8)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, orderInfo->windowId); /* windowId (4 bytes) */
|
||||
stream_read_UINT32(s, orderInfo->notifyIconId); /* notifyIconId (4 bytes) */
|
||||
Stream_Read_UINT32(s, orderInfo->windowId); /* windowId (4 bytes) */
|
||||
Stream_Read_UINT32(s, orderInfo->notifyIconId); /* notifyIconId (4 bytes) */
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_DELETED)
|
||||
{
|
||||
@ -373,14 +373,14 @@ BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO*
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND) {
|
||||
if(Stream_GetRemainingLength(s) < 4)
|
||||
return FALSE;
|
||||
stream_read_UINT32(s, monitored_desktop->activeWindowId); /* activeWindowId (4 bytes) */
|
||||
Stream_Read_UINT32(s, monitored_desktop->activeWindowId); /* activeWindowId (4 bytes) */
|
||||
}
|
||||
|
||||
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_ZORDER)
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, monitored_desktop->numWindowIds); /* numWindowIds (1 byte) */
|
||||
Stream_Read_UINT8(s, monitored_desktop->numWindowIds); /* numWindowIds (1 byte) */
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 4 * monitored_desktop->numWindowIds)
|
||||
return FALSE;
|
||||
@ -395,7 +395,7 @@ BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDER_INFO*
|
||||
/* windowIds */
|
||||
for (i = 0; i < (int) monitored_desktop->numWindowIds; i++)
|
||||
{
|
||||
stream_read_UINT32(s, monitored_desktop->windowIds[i]);
|
||||
Stream_Read_UINT32(s, monitored_desktop->windowIds[i]);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -434,8 +434,8 @@ BOOL update_recv_altsec_window_order(rdpUpdate* update, wStream* s)
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 6)
|
||||
return FALSE;
|
||||
stream_read_UINT16(s, orderSize); /* orderSize (2 bytes) */
|
||||
stream_read_UINT32(s, window->orderInfo.fieldFlags); /* FieldsPresentFlags (4 bytes) */
|
||||
Stream_Read_UINT16(s, orderSize); /* orderSize (2 bytes) */
|
||||
Stream_Read_UINT32(s, window->orderInfo.fieldFlags); /* FieldsPresentFlags (4 bytes) */
|
||||
|
||||
if (window->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_WINDOW)
|
||||
return update_recv_window_info_order(update, s, &window->orderInfo);
|
||||
|
@ -32,7 +32,7 @@ BOOL ber_read_length(wStream* s, int* length)
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte & 0x80)
|
||||
{
|
||||
@ -42,9 +42,9 @@ BOOL ber_read_length(wStream* s, int* length)
|
||||
return FALSE;
|
||||
|
||||
if (byte == 1)
|
||||
stream_read_BYTE(s, *length);
|
||||
Stream_Read_UINT8(s, *length);
|
||||
else if (byte == 2)
|
||||
stream_read_UINT16_be(s, *length);
|
||||
Stream_Read_UINT16_BE(s, *length);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
@ -65,13 +65,13 @@ int ber_write_length(wStream* s, int length)
|
||||
{
|
||||
if (length > 0x7F)
|
||||
{
|
||||
stream_write_BYTE(s, 0x82);
|
||||
stream_write_UINT16_be(s, length);
|
||||
Stream_Write_UINT8(s, 0x82);
|
||||
Stream_Write_UINT16_BE(s, length);
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_write_BYTE(s, length);
|
||||
Stream_Write_UINT8(s, length);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -105,7 +105,7 @@ BOOL ber_read_universal_tag(wStream* s, BYTE tag, BOOL pc)
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != (BER_CLASS_UNIV | BER_PC(pc) | (BER_TAG_MASK & tag)))
|
||||
return FALSE;
|
||||
@ -122,7 +122,7 @@ BOOL ber_read_universal_tag(wStream* s, BYTE tag, BOOL pc)
|
||||
|
||||
void ber_write_universal_tag(wStream* s, BYTE tag, BOOL pc)
|
||||
{
|
||||
stream_write_BYTE(s, (BER_CLASS_UNIV | BER_PC(pc)) | (BER_TAG_MASK & tag));
|
||||
Stream_Write_UINT8(s, (BER_CLASS_UNIV | BER_PC(pc)) | (BER_TAG_MASK & tag));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -140,14 +140,14 @@ BOOL ber_read_application_tag(wStream* s, BYTE tag, int* length)
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != ((BER_CLASS_APPL | BER_CONSTRUCT) | BER_TAG_MASK))
|
||||
return FALSE;
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != tag)
|
||||
return FALSE;
|
||||
@ -158,7 +158,7 @@ BOOL ber_read_application_tag(wStream* s, BYTE tag, int* length)
|
||||
{
|
||||
if(Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != ((BER_CLASS_APPL | BER_CONSTRUCT) | (BER_TAG_MASK & tag)))
|
||||
return FALSE;
|
||||
@ -180,13 +180,13 @@ void ber_write_application_tag(wStream* s, BYTE tag, int length)
|
||||
{
|
||||
if (tag > 30)
|
||||
{
|
||||
stream_write_BYTE(s, (BER_CLASS_APPL | BER_CONSTRUCT) | BER_TAG_MASK);
|
||||
stream_write_BYTE(s, tag);
|
||||
Stream_Write_UINT8(s, (BER_CLASS_APPL | BER_CONSTRUCT) | BER_TAG_MASK);
|
||||
Stream_Write_UINT8(s, tag);
|
||||
ber_write_length(s, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_write_BYTE(s, (BER_CLASS_APPL | BER_CONSTRUCT) | (BER_TAG_MASK & tag));
|
||||
Stream_Write_UINT8(s, (BER_CLASS_APPL | BER_CONSTRUCT) | (BER_TAG_MASK & tag));
|
||||
ber_write_length(s, length);
|
||||
}
|
||||
}
|
||||
@ -197,7 +197,7 @@ BOOL ber_read_contextual_tag(wStream* s, BYTE tag, int* length, BOOL pc)
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != ((BER_CLASS_CTXT | BER_PC(pc)) | (BER_TAG_MASK & tag)))
|
||||
{
|
||||
@ -210,7 +210,7 @@ BOOL ber_read_contextual_tag(wStream* s, BYTE tag, int* length, BOOL pc)
|
||||
|
||||
int ber_write_contextual_tag(wStream* s, BYTE tag, int length, BOOL pc)
|
||||
{
|
||||
stream_write_BYTE(s, (BER_CLASS_CTXT | BER_PC(pc)) | (BER_TAG_MASK & tag));
|
||||
Stream_Write_UINT8(s, (BER_CLASS_CTXT | BER_PC(pc)) | (BER_TAG_MASK & tag));
|
||||
return ber_write_length(s, length) + 1;
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ BOOL ber_read_sequence_tag(wStream* s, int* length)
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != ((BER_CLASS_UNIV | BER_CONSTRUCT) | (BER_TAG_SEQUENCE_OF)))
|
||||
return FALSE;
|
||||
@ -241,7 +241,7 @@ BOOL ber_read_sequence_tag(wStream* s, int* length)
|
||||
|
||||
int ber_write_sequence_tag(wStream* s, int length)
|
||||
{
|
||||
stream_write_BYTE(s, (BER_CLASS_UNIV | BER_CONSTRUCT) | (BER_TAG_MASK & BER_TAG_SEQUENCE));
|
||||
Stream_Write_UINT8(s, (BER_CLASS_UNIV | BER_CONSTRUCT) | (BER_TAG_MASK & BER_TAG_SEQUENCE));
|
||||
return ber_write_length(s, length) + 1;
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ BOOL ber_read_enumerated(wStream* s, BYTE* enumerated, BYTE count)
|
||||
if (length != 1 || Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, *enumerated);
|
||||
Stream_Read_UINT8(s, *enumerated);
|
||||
|
||||
/* check that enumerated value falls within expected range */
|
||||
if (*enumerated + 1 > count)
|
||||
@ -279,7 +279,7 @@ void ber_write_enumerated(wStream* s, BYTE enumerated, BYTE count)
|
||||
{
|
||||
ber_write_universal_tag(s, BER_TAG_ENUMERATED, FALSE);
|
||||
ber_write_length(s, 1);
|
||||
stream_write_BYTE(s, enumerated);
|
||||
Stream_Write_UINT8(s, enumerated);
|
||||
}
|
||||
|
||||
BOOL ber_read_bit_string(wStream* s, int* length, BYTE* padding)
|
||||
@ -290,7 +290,7 @@ BOOL ber_read_bit_string(wStream* s, int* length, BYTE* padding)
|
||||
|
||||
if(Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, *padding);
|
||||
Stream_Read_UINT8(s, *padding);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ void ber_write_octet_string(wStream* s, const BYTE* oct_str, int length)
|
||||
{
|
||||
ber_write_universal_tag(s, BER_TAG_OCTET_STRING, FALSE);
|
||||
ber_write_length(s, length);
|
||||
stream_write(s, oct_str, length);
|
||||
Stream_Write(s, oct_str, length);
|
||||
}
|
||||
|
||||
BOOL ber_read_octet_string_tag(wStream* s, int* length)
|
||||
@ -345,7 +345,7 @@ BOOL ber_read_BOOL(wStream* s, BOOL* value)
|
||||
if (length != 1 || Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, v);
|
||||
Stream_Read_UINT8(s, v);
|
||||
*value = (v ? TRUE : FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
@ -360,7 +360,7 @@ void ber_write_BOOL(wStream* s, BOOL value)
|
||||
{
|
||||
ber_write_universal_tag(s, BER_TAG_BOOLEAN, FALSE);
|
||||
ber_write_length(s, 1);
|
||||
stream_write_BYTE(s, (value == TRUE) ? 0xFF : 0);
|
||||
Stream_Write_UINT8(s, (value == TRUE) ? 0xFF : 0);
|
||||
}
|
||||
|
||||
BOOL ber_read_integer(wStream* s, UINT32* value)
|
||||
@ -380,22 +380,22 @@ BOOL ber_read_integer(wStream* s, UINT32* value)
|
||||
|
||||
if (length == 1)
|
||||
{
|
||||
stream_read_BYTE(s, *value);
|
||||
Stream_Read_UINT8(s, *value);
|
||||
}
|
||||
else if (length == 2)
|
||||
{
|
||||
stream_read_UINT16_be(s, *value);
|
||||
Stream_Read_UINT16_BE(s, *value);
|
||||
}
|
||||
else if (length == 3)
|
||||
{
|
||||
BYTE byte;
|
||||
stream_read_BYTE(s, byte);
|
||||
stream_read_UINT16_be(s, *value);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
Stream_Read_UINT16_BE(s, *value);
|
||||
*value += (byte << 16);
|
||||
}
|
||||
else if (length == 4)
|
||||
{
|
||||
stream_read_UINT32_be(s, *value);
|
||||
Stream_Read_UINT32_BE(s, *value);
|
||||
}
|
||||
else if (length == 8)
|
||||
{
|
||||
@ -424,26 +424,26 @@ int ber_write_integer(wStream* s, UINT32 value)
|
||||
if (value <= 0xFF)
|
||||
{
|
||||
ber_write_length(s, 1);
|
||||
stream_write_BYTE(s, value);
|
||||
Stream_Write_UINT8(s, value);
|
||||
return 2;
|
||||
}
|
||||
else if (value < 0xFF80)
|
||||
{
|
||||
ber_write_length(s, 2);
|
||||
stream_write_UINT16_be(s, value);
|
||||
Stream_Write_UINT16_BE(s, value);
|
||||
return 3;
|
||||
}
|
||||
else if (value < 0xFF8000)
|
||||
{
|
||||
ber_write_length(s, 3);
|
||||
stream_write_BYTE(s, (value >> 16));
|
||||
stream_write_UINT16_be(s, (value & 0xFFFF));
|
||||
Stream_Write_UINT8(s, (value >> 16));
|
||||
Stream_Write_UINT16_BE(s, (value & 0xFFFF));
|
||||
return 4;
|
||||
}
|
||||
else if (value <= 0xFFFFFFFF)
|
||||
{
|
||||
ber_write_length(s, 4);
|
||||
stream_write_UINT32_be(s, value);
|
||||
Stream_Write_UINT32_BE(s, value);
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
@ -39,19 +39,19 @@ int der_write_length(wStream* s, int length)
|
||||
{
|
||||
if (length > 0x7F && length <= 0xFF)
|
||||
{
|
||||
stream_write_BYTE(s, 0x81);
|
||||
stream_write_BYTE(s, length);
|
||||
Stream_Write_UINT8(s, 0x81);
|
||||
Stream_Write_UINT8(s, length);
|
||||
return 2;
|
||||
}
|
||||
else if (length > 0xFF)
|
||||
{
|
||||
stream_write_BYTE(s, 0x82);
|
||||
stream_write_UINT16_be(s, length);
|
||||
Stream_Write_UINT8(s, 0x82);
|
||||
Stream_Write_UINT16_BE(s, length);
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_write_BYTE(s, length);
|
||||
Stream_Write_UINT8(s, length);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -73,13 +73,13 @@ int der_skip_contextual_tag(int length)
|
||||
|
||||
int der_write_contextual_tag(wStream* s, BYTE tag, int length, BOOL pc)
|
||||
{
|
||||
stream_write_BYTE(s, (ER_CLASS_CTXT | ER_PC(pc)) | (ER_TAG_MASK & tag));
|
||||
Stream_Write_UINT8(s, (ER_CLASS_CTXT | ER_PC(pc)) | (ER_TAG_MASK & tag));
|
||||
return der_write_length(s, length) + 1;
|
||||
}
|
||||
|
||||
void der_write_universal_tag(wStream* s, BYTE tag, BOOL pc)
|
||||
{
|
||||
stream_write_BYTE(s, (ER_CLASS_UNIV | ER_PC(pc)) | (ER_TAG_MASK & tag));
|
||||
Stream_Write_UINT8(s, (ER_CLASS_UNIV | ER_PC(pc)) | (ER_TAG_MASK & tag));
|
||||
}
|
||||
|
||||
int der_skip_octet_string(int length)
|
||||
@ -91,7 +91,7 @@ void der_write_octet_string(wStream* s, BYTE* oct_str, int length)
|
||||
{
|
||||
der_write_universal_tag(s, ER_TAG_OCTET_STRING, FALSE);
|
||||
der_write_length(s, length);
|
||||
stream_write(s, oct_str, length);
|
||||
Stream_Write(s, oct_str, length);
|
||||
}
|
||||
|
||||
int der_skip_sequence_tag(int length)
|
||||
@ -101,7 +101,7 @@ int der_skip_sequence_tag(int length)
|
||||
|
||||
int der_write_sequence_tag(wStream* s, int length)
|
||||
{
|
||||
stream_write_BYTE(s, (ER_CLASS_UNIV | ER_CONSTRUCT) | (ER_TAG_MASK & ER_TAG_SEQUENCE));
|
||||
Stream_Write_UINT8(s, (ER_CLASS_UNIV | ER_CONSTRUCT) | (ER_TAG_MASK & ER_TAG_SEQUENCE));
|
||||
return der_write_length(s, length) + 1;
|
||||
}
|
||||
|
||||
|
@ -32,16 +32,16 @@ void er_read_length(wStream* s, int* length)
|
||||
{
|
||||
BYTE byte;
|
||||
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte & 0x80)
|
||||
{
|
||||
byte &= ~(0x80);
|
||||
|
||||
if (byte == 1)
|
||||
stream_read_BYTE(s, *length);
|
||||
Stream_Read_UINT8(s, *length);
|
||||
if (byte == 2)
|
||||
stream_read_UINT16_be(s, *length);
|
||||
Stream_Read_UINT16_BE(s, *length);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -90,7 +90,7 @@ BOOL er_read_universal_tag(wStream* s, BYTE tag, BOOL pc)
|
||||
{
|
||||
BYTE byte;
|
||||
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != (ER_CLASS_UNIV | ER_PC(pc) | (ER_TAG_MASK & tag)))
|
||||
return FALSE;
|
||||
@ -107,7 +107,7 @@ BOOL er_read_universal_tag(wStream* s, BYTE tag, BOOL pc)
|
||||
|
||||
void er_write_universal_tag(wStream* s, BYTE tag, BOOL pc)
|
||||
{
|
||||
stream_write_BYTE(s, (ER_CLASS_UNIV | ER_PC(pc)) | (ER_TAG_MASK & tag));
|
||||
Stream_Write_UINT8(s, (ER_CLASS_UNIV | ER_PC(pc)) | (ER_TAG_MASK & tag));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,12 +123,12 @@ BOOL er_read_application_tag(wStream* s, BYTE tag, int* length)
|
||||
|
||||
if (tag > 30)
|
||||
{
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != ((ER_CLASS_APPL | ER_CONSTRUCT) | ER_TAG_MASK))
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != tag)
|
||||
return FALSE;
|
||||
@ -137,7 +137,7 @@ BOOL er_read_application_tag(wStream* s, BYTE tag, int* length)
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != ((ER_CLASS_APPL | ER_CONSTRUCT) | (ER_TAG_MASK & tag)))
|
||||
return FALSE;
|
||||
@ -159,13 +159,13 @@ void er_write_application_tag(wStream* s, BYTE tag, int length, BOOL flag)
|
||||
{
|
||||
if (tag > 30)
|
||||
{
|
||||
stream_write_BYTE(s, (ER_CLASS_APPL | ER_CONSTRUCT) | ER_TAG_MASK);
|
||||
stream_write_BYTE(s, tag);
|
||||
Stream_Write_UINT8(s, (ER_CLASS_APPL | ER_CONSTRUCT) | ER_TAG_MASK);
|
||||
Stream_Write_UINT8(s, tag);
|
||||
er_write_length(s, length, flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
stream_write_BYTE(s, (ER_CLASS_APPL | ER_CONSTRUCT) | (ER_TAG_MASK & tag));
|
||||
Stream_Write_UINT8(s, (ER_CLASS_APPL | ER_CONSTRUCT) | (ER_TAG_MASK & tag));
|
||||
er_write_length(s, length, flag);
|
||||
}
|
||||
}
|
||||
@ -174,7 +174,7 @@ BOOL er_read_contextual_tag(wStream* s, BYTE tag, int* length, BOOL pc)
|
||||
{
|
||||
BYTE byte;
|
||||
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != ((ER_CLASS_CTXT | ER_PC(pc)) | (ER_TAG_MASK & tag)))
|
||||
{
|
||||
@ -189,7 +189,7 @@ BOOL er_read_contextual_tag(wStream* s, BYTE tag, int* length, BOOL pc)
|
||||
|
||||
int er_write_contextual_tag(wStream* s, BYTE tag, int length, BOOL pc, BOOL flag)
|
||||
{
|
||||
stream_write_BYTE(s, (ER_CLASS_CTXT | ER_PC(pc)) | (ER_TAG_MASK & tag));
|
||||
Stream_Write_UINT8(s, (ER_CLASS_CTXT | ER_PC(pc)) | (ER_TAG_MASK & tag));
|
||||
return er_write_length(s, length, flag) + 1;
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ BOOL er_read_sequence_tag(wStream* s, int* length)
|
||||
{
|
||||
BYTE byte;
|
||||
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte != ((ER_CLASS_UNIV | ER_CONSTRUCT) | (ER_TAG_SEQUENCE_OF)))
|
||||
return FALSE;
|
||||
@ -220,7 +220,7 @@ BOOL er_read_sequence_tag(wStream* s, int* length)
|
||||
|
||||
int er_write_sequence_tag(wStream* s, int length, BOOL flag)
|
||||
{
|
||||
stream_write_BYTE(s, (ER_CLASS_UNIV | ER_CONSTRUCT) | (ER_TAG_MASK & ER_TAG_SEQUENCE));
|
||||
Stream_Write_UINT8(s, (ER_CLASS_UNIV | ER_CONSTRUCT) | (ER_TAG_MASK & ER_TAG_SEQUENCE));
|
||||
return er_write_length(s, length, flag) + 1;
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ BOOL er_read_enumerated(wStream* s, BYTE* enumerated, BYTE count)
|
||||
er_read_length(s, &length);
|
||||
|
||||
if (length == 1)
|
||||
stream_read_BYTE(s, *enumerated);
|
||||
Stream_Read_UINT8(s, *enumerated);
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
@ -257,14 +257,14 @@ void er_write_enumerated(wStream* s, BYTE enumerated, BYTE count, BOOL flag)
|
||||
{
|
||||
er_write_universal_tag(s, ER_TAG_ENUMERATED, FALSE);
|
||||
er_write_length(s, 1, flag);
|
||||
stream_write_BYTE(s, enumerated);
|
||||
Stream_Write_UINT8(s, enumerated);
|
||||
}
|
||||
|
||||
BOOL er_read_bit_string(wStream* s, int* length, BYTE* padding)
|
||||
{
|
||||
er_read_universal_tag(s, ER_TAG_BIT_STRING, FALSE);
|
||||
er_read_length(s, length);
|
||||
stream_read_BYTE(s, *padding);
|
||||
Stream_Read_UINT8(s, *padding);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -273,7 +273,7 @@ BOOL er_write_bit_string_tag(wStream* s, UINT32 length, BYTE padding, BOOL flag)
|
||||
{
|
||||
er_write_universal_tag(s, ER_TAG_BIT_STRING, FALSE);
|
||||
er_write_length(s, length, flag);
|
||||
stream_write_BYTE(s, padding);
|
||||
Stream_Write_UINT8(s, padding);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ void er_write_octet_string(wStream* s, BYTE* oct_str, int length, BOOL flag)
|
||||
{
|
||||
er_write_universal_tag(s, ER_TAG_OCTET_STRING, FALSE);
|
||||
er_write_length(s, length, flag);
|
||||
stream_write(s, oct_str, length);
|
||||
Stream_Write(s, oct_str, length);
|
||||
}
|
||||
|
||||
int er_write_octet_string_tag(wStream* s, int length, BOOL flag)
|
||||
@ -328,7 +328,7 @@ BOOL er_read_BOOL(wStream* s, BOOL* value)
|
||||
er_read_length(s, &length);
|
||||
if (length != 1)
|
||||
return FALSE;
|
||||
stream_read_BYTE(s, v);
|
||||
Stream_Read_UINT8(s, v);
|
||||
*value = (v ? TRUE : FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
@ -343,7 +343,7 @@ void er_write_BOOL(wStream* s, BOOL value)
|
||||
{
|
||||
er_write_universal_tag(s, ER_TAG_BOOLEAN, FALSE);
|
||||
er_write_length(s, 1, FALSE);
|
||||
stream_write_BYTE(s, (value == TRUE) ? 0xFF : 0);
|
||||
Stream_Write_UINT8(s, (value == TRUE) ? 0xFF : 0);
|
||||
}
|
||||
|
||||
BOOL er_read_integer(wStream* s, UINT32* value)
|
||||
@ -360,20 +360,28 @@ BOOL er_read_integer(wStream* s, UINT32* value)
|
||||
}
|
||||
|
||||
if (length == 1)
|
||||
stream_read_BYTE(s, *value);
|
||||
{
|
||||
Stream_Read_UINT8(s, *value);
|
||||
}
|
||||
else if (length == 2)
|
||||
stream_read_UINT16_be(s, *value);
|
||||
{
|
||||
Stream_Read_UINT16_BE(s, *value);
|
||||
}
|
||||
else if (length == 3)
|
||||
{
|
||||
BYTE byte;
|
||||
stream_read_BYTE(s, byte);
|
||||
stream_read_UINT16_be(s, *value);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
Stream_Read_UINT16_BE(s, *value);
|
||||
*value += (byte << 16);
|
||||
}
|
||||
else if (length == 4)
|
||||
stream_read_UINT32_be(s, *value);
|
||||
{
|
||||
Stream_Read_UINT32_BE(s, *value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -391,19 +399,19 @@ int er_write_integer(wStream* s, INT32 value)
|
||||
if (value <= 127 && value >= -128)
|
||||
{
|
||||
er_write_length(s, 1, FALSE);
|
||||
stream_write_BYTE(s, value);
|
||||
Stream_Write_UINT8(s, value);
|
||||
return 2;
|
||||
}
|
||||
else if (value <= 32767 && value >= -32768)
|
||||
{
|
||||
er_write_length(s, 2, FALSE);
|
||||
stream_write_UINT16_be(s, value);
|
||||
Stream_Write_UINT16_BE(s, value);
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
er_write_length(s, 4, FALSE);
|
||||
stream_write_UINT32_be(s, value);
|
||||
Stream_Write_UINT32_BE(s, value);
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ BOOL per_read_length(wStream* s, UINT16* length)
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
|
||||
if (byte & 0x80)
|
||||
{
|
||||
@ -46,7 +46,7 @@ BOOL per_read_length(wStream* s, UINT16* length)
|
||||
|
||||
byte &= ~(0x80);
|
||||
*length = (byte << 8);
|
||||
stream_read_BYTE(s, byte);
|
||||
Stream_Read_UINT8(s, byte);
|
||||
*length += byte;
|
||||
}
|
||||
else
|
||||
@ -66,9 +66,9 @@ BOOL per_read_length(wStream* s, UINT16* length)
|
||||
void per_write_length(wStream* s, int length)
|
||||
{
|
||||
if (length > 0x7F)
|
||||
stream_write_UINT16_be(s, (length | 0x8000));
|
||||
Stream_Write_UINT16_BE(s, (length | 0x8000));
|
||||
else
|
||||
stream_write_BYTE(s, length);
|
||||
Stream_Write_UINT8(s, length);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,7 +83,7 @@ BOOL per_read_choice(wStream* s, BYTE* choice)
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, *choice);
|
||||
Stream_Read_UINT8(s, *choice);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ BOOL per_read_choice(wStream* s, BYTE* choice)
|
||||
|
||||
void per_write_choice(wStream* s, BYTE choice)
|
||||
{
|
||||
stream_write_BYTE(s, choice);
|
||||
Stream_Write_UINT8(s, choice);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,7 +110,7 @@ BOOL per_read_selection(wStream* s, BYTE* selection)
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, *selection);
|
||||
Stream_Read_UINT8(s, *selection);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ BOOL per_read_selection(wStream* s, BYTE* selection)
|
||||
|
||||
void per_write_selection(wStream* s, BYTE selection)
|
||||
{
|
||||
stream_write_BYTE(s, selection);
|
||||
Stream_Write_UINT8(s, selection);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -137,7 +137,7 @@ BOOL per_read_number_of_sets(wStream* s, BYTE* number)
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, *number);
|
||||
Stream_Read_UINT8(s, *number);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -149,7 +149,7 @@ BOOL per_read_number_of_sets(wStream* s, BYTE* number)
|
||||
|
||||
void per_write_number_of_sets(wStream* s, BYTE number)
|
||||
{
|
||||
stream_write_BYTE(s, number);
|
||||
Stream_Write_UINT8(s, number);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -178,7 +178,7 @@ void per_write_padding(wStream* s, int length)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
stream_write_BYTE(s, 0);
|
||||
Stream_Write_UINT8(s, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -199,9 +199,9 @@ BOOL per_read_integer(wStream* s, UINT32* integer)
|
||||
return FALSE;
|
||||
|
||||
if (length == 1)
|
||||
stream_read_BYTE(s, *integer);
|
||||
Stream_Read_UINT8(s, *integer);
|
||||
else if (length == 2)
|
||||
stream_read_UINT16_be(s, *integer);
|
||||
Stream_Read_UINT16_BE(s, *integer);
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
@ -219,17 +219,17 @@ void per_write_integer(wStream* s, UINT32 integer)
|
||||
if (integer <= 0xFF)
|
||||
{
|
||||
per_write_length(s, 1);
|
||||
stream_write_BYTE(s, integer);
|
||||
Stream_Write_UINT8(s, integer);
|
||||
}
|
||||
else if (integer <= 0xFFFF)
|
||||
{
|
||||
per_write_length(s, 2);
|
||||
stream_write_UINT16_be(s, integer);
|
||||
Stream_Write_UINT16_BE(s, integer);
|
||||
}
|
||||
else if (integer <= 0xFFFFFFFF)
|
||||
{
|
||||
per_write_length(s, 4);
|
||||
stream_write_UINT32_be(s, integer);
|
||||
Stream_Write_UINT32_BE(s, integer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ BOOL per_read_integer16(wStream* s, UINT16* integer, UINT16 min)
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16_be(s, *integer);
|
||||
Stream_Read_UINT16_BE(s, *integer);
|
||||
|
||||
if (*integer + min > 0xFFFF)
|
||||
return FALSE;
|
||||
@ -265,7 +265,7 @@ BOOL per_read_integer16(wStream* s, UINT16* integer, UINT16 min)
|
||||
|
||||
void per_write_integer16(wStream* s, UINT16 integer, UINT16 min)
|
||||
{
|
||||
stream_write_UINT16_be(s, integer - min);
|
||||
Stream_Write_UINT16_BE(s, integer - min);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -281,7 +281,7 @@ BOOL per_read_enumerated(wStream* s, BYTE* enumerated, BYTE count)
|
||||
if (Stream_GetRemainingLength(s) < 1)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, *enumerated);
|
||||
Stream_Read_UINT8(s, *enumerated);
|
||||
|
||||
/* check that enumerated value falls within expected range */
|
||||
if (*enumerated + 1 > count)
|
||||
@ -300,7 +300,7 @@ BOOL per_read_enumerated(wStream* s, BYTE* enumerated, BYTE count)
|
||||
|
||||
void per_write_enumerated(wStream* s, BYTE enumerated, BYTE count)
|
||||
{
|
||||
stream_write_BYTE(s, enumerated);
|
||||
Stream_Write_UINT8(s, enumerated);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -325,14 +325,14 @@ BOOL per_read_object_identifier(wStream* s, BYTE oid[6])
|
||||
if (Stream_GetRemainingLength(s) < length)
|
||||
return FALSE;
|
||||
|
||||
stream_read_BYTE(s, t12); /* first two tuples */
|
||||
Stream_Read_UINT8(s, t12); /* first two tuples */
|
||||
a_oid[0] = (t12 >> 4);
|
||||
a_oid[1] = (t12 & 0x0F);
|
||||
|
||||
stream_read_BYTE(s, a_oid[2]); /* tuple 3 */
|
||||
stream_read_BYTE(s, a_oid[3]); /* tuple 4 */
|
||||
stream_read_BYTE(s, a_oid[4]); /* tuple 5 */
|
||||
stream_read_BYTE(s, a_oid[5]); /* tuple 6 */
|
||||
Stream_Read_UINT8(s, a_oid[2]); /* tuple 3 */
|
||||
Stream_Read_UINT8(s, a_oid[3]); /* tuple 4 */
|
||||
Stream_Read_UINT8(s, a_oid[4]); /* tuple 5 */
|
||||
Stream_Read_UINT8(s, a_oid[5]); /* tuple 6 */
|
||||
|
||||
if ((a_oid[0] == oid[0]) && (a_oid[1] == oid[1]) &&
|
||||
(a_oid[2] == oid[2]) && (a_oid[3] == oid[3]) &&
|
||||
@ -355,12 +355,12 @@ BOOL per_read_object_identifier(wStream* s, BYTE oid[6])
|
||||
void per_write_object_identifier(wStream* s, BYTE oid[6])
|
||||
{
|
||||
BYTE t12 = (oid[0] << 4) & (oid[1] & 0x0F);
|
||||
stream_write_BYTE(s, 5); /* length */
|
||||
stream_write_BYTE(s, t12); /* first two tuples */
|
||||
stream_write_BYTE(s, oid[2]); /* tuple 3 */
|
||||
stream_write_BYTE(s, oid[3]); /* tuple 4 */
|
||||
stream_write_BYTE(s, oid[4]); /* tuple 5 */
|
||||
stream_write_BYTE(s, oid[5]); /* tuple 6 */
|
||||
Stream_Write_UINT8(s, 5); /* length */
|
||||
Stream_Write_UINT8(s, t12); /* first two tuples */
|
||||
Stream_Write_UINT8(s, oid[2]); /* tuple 3 */
|
||||
Stream_Write_UINT8(s, oid[3]); /* tuple 4 */
|
||||
Stream_Write_UINT8(s, oid[4]); /* tuple 5 */
|
||||
Stream_Write_UINT8(s, oid[5]); /* tuple 6 */
|
||||
}
|
||||
|
||||
/**
|
||||
@ -375,7 +375,7 @@ void per_write_string(wStream* s, BYTE* str, int length)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
stream_write_BYTE(s, str[i]);
|
||||
Stream_Write_UINT8(s, str[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -432,7 +432,7 @@ void per_write_octet_string(wStream* s, BYTE* oct_str, int length, int min)
|
||||
per_write_length(s, mlength);
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
stream_write_BYTE(s, oct_str[i]);
|
||||
Stream_Write_UINT8(s, oct_str[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -487,6 +487,6 @@ void per_write_numeric_string(wStream* s, BYTE* num_str, int length, int min)
|
||||
c2 = (c2 - 0x30) % 10;
|
||||
num = (c1 << 4) | c2;
|
||||
|
||||
stream_write_BYTE(s, num); /* string */
|
||||
Stream_Write_UINT8(s, num); /* string */
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ BOOL rail_read_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
if (Stream_GetRemainingLength(s) < 2)
|
||||
return FALSE;
|
||||
|
||||
stream_read_UINT16(s, unicode_string->length); /* cbString (2 bytes) */
|
||||
Stream_Read_UINT16(s, unicode_string->length); /* cbString (2 bytes) */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < unicode_string->length)
|
||||
return FALSE;
|
||||
@ -61,7 +61,7 @@ BOOL rail_read_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
else
|
||||
unicode_string->string = (BYTE*) realloc(unicode_string->string, unicode_string->length);
|
||||
|
||||
stream_read(s, unicode_string->string, unicode_string->length);
|
||||
Stream_Read(s, unicode_string->string, unicode_string->length);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -69,8 +69,8 @@ BOOL rail_read_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
void rail_write_unicode_string(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(s, 2 + unicode_string->length);
|
||||
stream_write_UINT16(s, unicode_string->length); /* cbString (2 bytes) */
|
||||
stream_write(s, unicode_string->string, unicode_string->length); /* string */
|
||||
Stream_Write_UINT16(s, unicode_string->length); /* cbString (2 bytes) */
|
||||
Stream_Write(s, unicode_string->string, unicode_string->length); /* string */
|
||||
}
|
||||
|
||||
void rail_write_unicode_string_value(wStream* s, RAIL_UNICODE_STRING* unicode_string)
|
||||
@ -78,24 +78,24 @@ void rail_write_unicode_string_value(wStream* s, RAIL_UNICODE_STRING* unicode_st
|
||||
if (unicode_string->length > 0)
|
||||
{
|
||||
Stream_EnsureRemainingCapacity(s, unicode_string->length);
|
||||
stream_write(s, unicode_string->string, unicode_string->length); /* string */
|
||||
Stream_Write(s, unicode_string->string, unicode_string->length); /* string */
|
||||
}
|
||||
}
|
||||
|
||||
void rail_read_rectangle_16(wStream* s, RECTANGLE_16* rectangle_16)
|
||||
{
|
||||
stream_read_UINT16(s, rectangle_16->left); /* left (2 bytes) */
|
||||
stream_read_UINT16(s, rectangle_16->top); /* top (2 bytes) */
|
||||
stream_read_UINT16(s, rectangle_16->right); /* right (2 bytes) */
|
||||
stream_read_UINT16(s, rectangle_16->bottom); /* bottom (2 bytes) */
|
||||
Stream_Read_UINT16(s, rectangle_16->left); /* left (2 bytes) */
|
||||
Stream_Read_UINT16(s, rectangle_16->top); /* top (2 bytes) */
|
||||
Stream_Read_UINT16(s, rectangle_16->right); /* right (2 bytes) */
|
||||
Stream_Read_UINT16(s, rectangle_16->bottom); /* bottom (2 bytes) */
|
||||
}
|
||||
|
||||
void rail_write_rectangle_16(wStream* s, RECTANGLE_16* rectangle_16)
|
||||
{
|
||||
stream_write_UINT16(s, rectangle_16->left); /* left (2 bytes) */
|
||||
stream_write_UINT16(s, rectangle_16->top); /* top (2 bytes) */
|
||||
stream_write_UINT16(s, rectangle_16->right); /* right (2 bytes) */
|
||||
stream_write_UINT16(s, rectangle_16->bottom); /* bottom (2 bytes) */
|
||||
Stream_Write_UINT16(s, rectangle_16->left); /* left (2 bytes) */
|
||||
Stream_Write_UINT16(s, rectangle_16->top); /* top (2 bytes) */
|
||||
Stream_Write_UINT16(s, rectangle_16->right); /* right (2 bytes) */
|
||||
Stream_Write_UINT16(s, rectangle_16->bottom); /* bottom (2 bytes) */
|
||||
}
|
||||
|
||||
void* rail_clone_order(UINT32 event_type, void* order)
|
||||
|
@ -123,7 +123,7 @@ static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, UINT3
|
||||
|
||||
data_in = plugin->data_in;
|
||||
Stream_EnsureRemainingCapacity(data_in, (int) dataLength);
|
||||
stream_write(data_in, pData, dataLength);
|
||||
Stream_Write(data_in, pData, dataLength);
|
||||
|
||||
if (dataFlags & CHANNEL_FLAG_LAST)
|
||||
{
|
||||
|
@ -69,10 +69,10 @@ WINPR_API void Stream_Free(wStream* s, BOOL bFreeBuffer);
|
||||
_s->pointer += 4; } while (0)
|
||||
|
||||
#define Stream_Read_UINT32_BE(_s, _v) do { _v = \
|
||||
(((uint32)(*(_s->pointer))) << 24) + \
|
||||
(((uint32)(*(_s->pointer + 1))) << 16) + \
|
||||
(((uint32)(*(_s->pointer + 2))) << 8) + \
|
||||
(((uint32)(*(_s->pointer + 3)))); \
|
||||
(((UINT32)(*(_s->pointer))) << 24) + \
|
||||
(((UINT32)(*(_s->pointer + 1))) << 16) + \
|
||||
(((UINT32)(*(_s->pointer + 2))) << 8) + \
|
||||
(((UINT32)(*(_s->pointer + 3)))); \
|
||||
_s->pointer += 4; } while (0)
|
||||
|
||||
#define Stream_Read_UINT64(_s, _v) do { _v = \
|
||||
@ -218,56 +218,7 @@ WINPR_API void stream_extend(wStream* stream, int request_size);
|
||||
#define stream_set_mark(_s,_mark) _s->pointer = _mark
|
||||
#define stream_get_head(_s) _s->buffer
|
||||
|
||||
#define stream_read_BYTE(_s, _v) do { _v = *_s->pointer++; } while (0)
|
||||
#define stream_read_UINT16(_s, _v) do { _v = \
|
||||
(UINT16)(*_s->pointer) + \
|
||||
(UINT16)(((UINT16)(*(_s->pointer + 1))) << 8); \
|
||||
_s->pointer += 2; } while (0)
|
||||
#define stream_read_UINT32(_s, _v) do { _v = \
|
||||
(UINT32)(*_s->pointer) + \
|
||||
(((UINT32)(*(_s->pointer + 1))) << 8) + \
|
||||
(((UINT32)(*(_s->pointer + 2))) << 16) + \
|
||||
(((UINT32)(*(_s->pointer + 3))) << 24); \
|
||||
_s->pointer += 4; } while (0)
|
||||
#define stream_read_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); \
|
||||
_s->pointer += 8; } while (0)
|
||||
#define stream_read(_s, _b, _n) do { \
|
||||
memcpy(_b, (_s->pointer), (_n)); \
|
||||
_s->pointer += (_n); \
|
||||
} while (0)
|
||||
|
||||
#define stream_write_BYTE(_s, _v) do { \
|
||||
*_s->pointer++ = (BYTE)(_v); } while (0)
|
||||
#define stream_write_UINT16(_s, _v) do { \
|
||||
*_s->pointer++ = (_v) & 0xFF; \
|
||||
*_s->pointer++ = ((_v) >> 8) & 0xFF; } while (0)
|
||||
#define stream_write_UINT32(_s, _v) do { \
|
||||
*_s->pointer++ = (_v) & 0xFF; \
|
||||
*_s->pointer++ = ((_v) >> 8) & 0xFF; \
|
||||
*_s->pointer++ = ((_v) >> 16) & 0xFF; \
|
||||
*_s->pointer++ = ((_v) >> 24) & 0xFF; } while (0)
|
||||
#define stream_write_UINT64(_s, _v) do { \
|
||||
*_s->pointer++ = (UINT64)(_v) & 0xFF; \
|
||||
*_s->pointer++ = ((UINT64)(_v) >> 8) & 0xFF; \
|
||||
*_s->pointer++ = ((UINT64)(_v) >> 16) & 0xFF; \
|
||||
*_s->pointer++ = ((UINT64)(_v) >> 24) & 0xFF; \
|
||||
*_s->pointer++ = ((UINT64)(_v) >> 32) & 0xFF; \
|
||||
*_s->pointer++ = ((UINT64)(_v) >> 40) & 0xFF; \
|
||||
*_s->pointer++ = ((UINT64)(_v) >> 48) & 0xFF; \
|
||||
*_s->pointer++ = ((UINT64)(_v) >> 56) & 0xFF; } while (0)
|
||||
#define stream_write(_s, _b, _n) do { \
|
||||
memcpy(_s->pointer, (_b), (_n)); \
|
||||
_s->pointer += (_n); \
|
||||
} while (0)
|
||||
#define stream_write_zero(_s, _n) do { \
|
||||
#define Stream_Write_zero(_s, _n) do { \
|
||||
memset(_s->pointer, '\0', (_n)); \
|
||||
_s->pointer += (_n); \
|
||||
} while (0)
|
||||
@ -303,25 +254,6 @@ WINPR_API void stream_extend(wStream* stream, int request_size);
|
||||
#define Stream_Seek_UINT32(_s) Stream_Seek(_s, 4)
|
||||
#define Stream_Seek_UINT64(_s) Stream_Seek(_s, 8)
|
||||
|
||||
#define stream_read_UINT16_be(_s, _v) do { _v = \
|
||||
(((UINT16)(*_s->pointer)) << 8) + \
|
||||
(UINT16)(*(_s->pointer + 1)); \
|
||||
_s->pointer += 2; } while (0)
|
||||
#define stream_read_UINT32_be(_s, _v) do { _v = \
|
||||
(((UINT32)(*(_s->pointer))) << 24) + \
|
||||
(((UINT32)(*(_s->pointer + 1))) << 16) + \
|
||||
(((UINT32)(*(_s->pointer + 2))) << 8) + \
|
||||
(((UINT32)(*(_s->pointer + 3)))); \
|
||||
_s->pointer += 4; } while (0)
|
||||
|
||||
#define stream_write_UINT16_be(_s, _v) do { \
|
||||
*_s->pointer++ = ((_v) >> 8) & 0xFF; \
|
||||
*_s->pointer++ = (_v) & 0xFF; } while (0)
|
||||
#define stream_write_UINT32_be(_s, _v) do { \
|
||||
stream_write_UINT16_be(_s, ((_v) >> 16 & 0xFFFF)); \
|
||||
stream_write_UINT16_be(_s, ((_v) & 0xFFFF)); \
|
||||
} while (0)
|
||||
|
||||
#define stream_copy(_dst, _src, _n) do { \
|
||||
memcpy(_dst->pointer, _src->pointer, _n); \
|
||||
_dst->pointer += _n; \
|
||||
|
Loading…
Reference in New Issue
Block a user