Fourth Batch: Update files using ChatGPT 4o

This commit is contained in:
Stig-Ørjan Smelror 2024-05-31 16:42:49 +02:00
parent 867c553378
commit dbac3db7b7
7 changed files with 412 additions and 589 deletions

22
iso.c
View File

@ -20,6 +20,8 @@
*/
#include "rdesktop.h"
#include <string.h>
#include <stdlib.h>
extern RD_BOOL g_encryption;
extern RD_BOOL g_encryption_initial;
@ -59,7 +61,7 @@ iso_send_msg(uint8 code)
}
static void
iso_send_connection_request(char *username, uint32 neg_proto)
iso_send_connection_request(const char *username, uint32 neg_proto)
{
STREAM s;
int length = 30 + strlen(username);
@ -132,7 +134,7 @@ iso_recv_msg(uint8 * code, RD_BOOL * is_fastpath, uint8 * fastpath_hdr)
{
/* length2 is only present if the most significant bit of length1 is set */
length &= ~0x80;
next_be(s, length);
in_uint8(s, length); /* length2 */
}
}
@ -218,19 +220,19 @@ iso_recv(RD_BOOL * is_fastpath, uint8 * fastpath_hdr)
/* try to setup a more helpful error message about TLS */
char *get_credSSP_reason(uint32 neg_proto)
{
static char msg[256];
static char msg[256] = "CredSSP required by server";
strcat(msg, "CredSSP required by server");
if ((neg_proto & PROTOCOL_SSL) &&
( (g_tls_version[0] == 0) ||
(strcmp(g_tls_version, "1.2") < 0)))
((g_tls_version[0] == 0) || (strcmp(g_tls_version, "1.2") < 0)))
{
strcat(msg, " (check if server has disabled old TLS versions, if yes use -V option)");
}
return msg;
}
/* Establish a connection up to the ISO layer */
RD_BOOL
iso_connect(char *server, char *username, char *domain, char *password,
iso_connect(const char *server, const char *username, const char *domain, const char *password,
RD_BOOL reconnect, uint32 * selected_protocol)
{
UNUSED(reconnect);
@ -354,7 +356,7 @@ iso_connect(char *server, char *username, char *domain, char *password,
{
if (!tcp_tls_connect())
{
/* failed to connect using cssp, let retry with plain TLS */
/* failed to connect using CredSSP, retry with plain TLS */
logger(Core, Verbose,
"Failed to connect using SSL, trying with plain RDP.");
tcp_disconnect();
@ -370,7 +372,7 @@ iso_connect(char *server, char *username, char *domain, char *password,
{
if (!cssp_connect(server, username, domain, password, s))
{
/* failed to connect using cssp, let retry with plain TLS */
/* failed to connect using CredSSP, retry with plain TLS */
logger(Core, Verbose,
"Failed to connect using NLA, trying with SSL");
tcp_disconnect();
@ -387,7 +389,7 @@ iso_connect(char *server, char *username, char *domain, char *password,
{
logger(Core, Notice, "Connection established using plain RDP.");
}
else if (data != PROTOCOL_RDP)
else
{
tcp_disconnect();
logger(Protocol, Error,

View File

@ -5,7 +5,6 @@
Copyright (C) Thomas Uhle <thomas.uhle@mailbox.tu-dresden.de> 2011
Copyright (C) Henrik Andersson <henrik.andersson@cendio.com> 2014
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
@ -22,6 +21,7 @@
#include "rdesktop.h"
#include "ssl.h"
#include <string.h>
extern char *g_username;
extern char g_hostname[16];
@ -35,7 +35,7 @@ RD_BOOL g_licence_error_result = False;
/* Generate a session key and RC4 keys, given client and server randoms */
static void
licence_generate_keys(uint8 * client_random, uint8 * server_random, uint8 * pre_master_secret)
licence_generate_keys(const uint8 * client_random, const uint8 * server_random, const uint8 * pre_master_secret)
{
uint8 master_secret[48];
uint8 key_block[48];
@ -60,12 +60,11 @@ licence_generate_hwid(uint8 * hwid)
/* Send a licence info packet to server */
static void
licence_info(uint8 * client_random, uint8 * rsa_data,
uint8 * licence_data, int licence_size, uint8 * hwid, uint8 * signature)
licence_info(const uint8 * client_random, const uint8 * rsa_data,
const uint8 * licence_data, int licence_size, const uint8 * hwid, const uint8 * signature)
{
uint32 sec_flags = SEC_LICENSE_PKT;
uint16 length =
24 + SEC_RANDOM_SIZE + SEC_MODULUS_SIZE + SEC_PADDING_SIZE +
uint16 length = 24 + SEC_RANDOM_SIZE + SEC_MODULUS_SIZE + SEC_PADDING_SIZE +
licence_size + LICENCE_HWID_SIZE + LICENCE_SIGNATURE_SIZE;
STREAM s;
@ -102,13 +101,12 @@ licence_info(uint8 * client_random, uint8 * rsa_data,
/* Send a new licence request packet */
static void
licence_send_new_licence_request(uint8 * client_random, uint8 * rsa_data, char *user, char *host)
licence_send_new_licence_request(const uint8 * client_random, const uint8 * rsa_data, const char *user, const char *host)
{
uint32 sec_flags = SEC_LICENSE_PKT;
uint16 userlen = strlen(user) + 1;
uint16 hostlen = strlen(host) + 1;
uint16 length =
24 + SEC_RANDOM_SIZE + SEC_MODULUS_SIZE + SEC_PADDING_SIZE + userlen + hostlen;
uint16 length = 24 + SEC_RANDOM_SIZE + SEC_MODULUS_SIZE + SEC_PADDING_SIZE + userlen + hostlen;
STREAM s;
s = sec_init(sec_flags, length + 2);
@ -146,7 +144,7 @@ licence_send_new_licence_request(uint8 * client_random, uint8 * rsa_data, char *
static void
licence_process_request(STREAM s)
{
uint8 null_data[SEC_MODULUS_SIZE];
uint8 null_data[SEC_MODULUS_SIZE] = {0};
uint8 *server_random;
uint8 signature[LICENCE_SIGNATURE_SIZE];
uint8 hwid[LICENCE_HWID_SIZE];
@ -159,7 +157,6 @@ licence_process_request(STREAM s)
/* We currently use null client keys. This is a bit naughty but, hey,
the security of licence negotiation isn't exactly paramount. */
memset(null_data, 0, sizeof(null_data));
licence_generate_keys(null_data, server_random, null_data);
licence_size = load_licence(&licence_data);
@ -179,7 +176,7 @@ licence_process_request(STREAM s)
licence_info(null_data, null_data, licence_data, licence_size, hwid, signature);
xfree(licence_data);
free(licence_data);
return;
}
@ -192,7 +189,7 @@ licence_process_request(STREAM s)
/* Send a platform challenge response packet */
static void
licence_send_platform_challenge_response(uint8 * token, uint8 * crypt_hwid, uint8 * signature)
licence_send_platform_challenge_response(const uint8 * token, const uint8 * crypt_hwid, const uint8 * signature)
{
uint32 sec_flags = SEC_LICENSE_PKT;
uint16 length = 58;
@ -219,7 +216,7 @@ licence_send_platform_challenge_response(uint8 * token, uint8 * crypt_hwid, uint
s_free(s);
}
/* Parse an platform challenge request packet */
/* Parse a platform challenge request packet */
static RD_BOOL
licence_parse_platform_challenge(STREAM s, uint8 ** token, uint8 ** signature)
{
@ -301,7 +298,6 @@ licence_process_new_license(STREAM s)
/* Skip strings, Scope, CompanyName and ProductId to get
to the LicenseInfo which we store in license blob. */
length = 0;
for (i = 0; i < 4; i++)
{
in_uint8s(s, length);
@ -315,7 +311,7 @@ licence_process_new_license(STREAM s)
save_licence(data, length);
}
/* process a licence error alert packet */
/* Process a licence error alert packet */
void
licence_process_error_alert(STREAM s)
{
@ -330,7 +326,7 @@ licence_process_error_alert(STREAM s)
and the server is not sending a license to client, a "Server License Error PDU -
Valid Client" packet is sent which means, every thing is ok.
Therefor we should flag that everything is ok with license here.
Therefore we should flag that everything is ok with license here.
*/
if (error_code == 0x07)
{
@ -338,7 +334,7 @@ licence_process_error_alert(STREAM s)
return;
}
/* handle error codes, for now, just report them */
/* Handle error codes, for now, just report them */
switch (error_code)
{
case 0x6: // ERR_NO_LICENSE_SERVER
@ -362,7 +358,6 @@ licence_process_error_alert(STREAM s)
g_licence_error_result = True;
}
/* Process a licence packet */
void
licence_process(STREAM s)
@ -397,6 +392,6 @@ licence_process(STREAM s)
default:
logger(Protocol, Warning,
"license_process(), unhandled license PDU tag 0x%02", tag);
"license_process(), unhandled license PDU tag 0x%02x", tag);
}
}

39
lspci.c
View File

@ -21,6 +21,7 @@
#include "rdesktop.h"
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
static VCHANNEL *lspci_channel;
@ -50,42 +51,40 @@ handle_child_line(const char *line, void *data)
if (str_startswith(line, "Class:"))
{
val = line + sizeof("Class:");
/* Skip whitespace and second Class: occurrence */
val += strspn(val, " \t") + sizeof("Class");
val = line + strlen("Class:");
val += strspn(val, " \t"); /* Skip whitespace */
current_device.klass = strtol(val, NULL, 16);
}
else if (str_startswith(line, "Vendor:"))
{
val = line + sizeof("Vendor:");
val = line + strlen("Vendor:");
current_device.vendor = strtol(val, NULL, 16);
}
else if (str_startswith(line, "Device:"))
{
val = line + sizeof("Device:");
/* Sigh, there are *two* lines tagged as Device:. We
are not interested in the domain/bus/slot/func */
val = line + strlen("Device:");
/* Ignore the domain/bus/slot/func line */
if (!strchr(val, ':'))
current_device.device = strtol(val, NULL, 16);
}
else if (str_startswith(line, "SVendor:"))
{
val = line + sizeof("SVendor:");
val = line + strlen("SVendor:");
current_device.subvendor = strtol(val, NULL, 16);
}
else if (str_startswith(line, "SDevice:"))
{
val = line + sizeof("SDevice:");
val = line + strlen("SDevice:");
current_device.subdevice = strtol(val, NULL, 16);
}
else if (str_startswith(line, "Rev:"))
{
val = line + sizeof("Rev:");
val = line + strlen("Rev:");
current_device.revision = strtol(val, NULL, 16);
}
else if (str_startswith(line, "ProgIf:"))
{
val = line + sizeof("ProgIf:");
val = line + strlen("ProgIf:");
current_device.progif = strtol(val, NULL, 16);
}
else if (strspn(line, " \t") == strlen(line))
@ -111,12 +110,12 @@ static RD_BOOL
lspci_process_line(const char *line, void *data)
{
UNUSED(data);
char *lspci_command[5] = { "lspci", "-m", "-n", "-v", NULL };
const char *lspci_command[] = { "lspci", "-m", "-n", "-v", NULL };
if (!strcmp(line, "LSPCI"))
if (strcmp(line, "LSPCI") == 0)
{
memset(&current_device, 0, sizeof(current_device));
subprocess(lspci_command, handle_child_line, NULL);
subprocess((char **)lspci_command, handle_child_line, NULL);
/* Send single dot to indicate end of enumeration */
lspci_send(".\n");
}
@ -138,11 +137,16 @@ lspci_process(STREAM s)
pkglen = s_remaining(s);
/* str_handle_lines requires null terminated strings */
buf = xmalloc(pkglen + 1);
buf = (char *)malloc(pkglen + 1);
if (!buf)
{
logger(Core, Error, "lspci_process(), memory allocation failed");
return;
}
in_uint8a(s, buf, pkglen);
buf[pkglen] = '\0';
str_handle_lines(buf, &rest, lspci_process_line, NULL);
xfree(buf);
free(buf);
}
/* Initialize this module: Register the lspci channel */
@ -164,7 +168,8 @@ lspci_send(const char *output)
len = strlen(output);
s = channel_init(lspci_channel, len);
out_uint8a(s, output, len) s_mark_end(s);
out_uint8a(s, output, len);
s_mark_end(s);
channel_send(s, lspci_channel);
s_free(s);
}

68
mcs.c
View File

@ -25,10 +25,8 @@ uint16 g_mcs_userid;
extern VCHANNEL g_channels[];
extern unsigned int g_num_channels;
/* Output a DOMAIN_PARAMS structure (ASN.1 BER) */
static void
mcs_out_domain_params(STREAM s, int max_channels, int max_users, int max_tokens, int max_pdusize)
static void mcs_out_domain_params(STREAM s, int max_channels, int max_users, int max_tokens, int max_pdusize)
{
ber_out_header(s, MCS_TAG_DOMAIN_PARAMS, 32);
ber_out_integer(s, max_channels);
@ -42,8 +40,7 @@ mcs_out_domain_params(STREAM s, int max_channels, int max_users, int max_tokens,
}
/* Parse a DOMAIN_PARAMS structure (ASN.1 BER) */
static void
mcs_parse_domain_params(STREAM s)
static void mcs_parse_domain_params(STREAM s)
{
uint32 length;
struct stream packet = *s;
@ -59,12 +56,12 @@ mcs_parse_domain_params(STREAM s)
}
/* Send an MCS_CONNECT_INITIAL message (ASN.1 BER) */
static void
mcs_send_connect_initial(STREAM mcs_data)
static void mcs_send_connect_initial(STREAM mcs_data)
{
int datalen = s_length(mcs_data);
int length = 9 + 3 * 34 + 4 + datalen;
STREAM s;
logger(Protocol, Debug, "%s()", __func__);
s = iso_init(length + 5);
@ -90,8 +87,7 @@ mcs_send_connect_initial(STREAM mcs_data)
}
/* Expect a MCS_CONNECT_RESPONSE message (ASN.1 BER) */
static RD_BOOL
mcs_recv_connect_response(STREAM mcs_data)
static RD_BOOL mcs_recv_connect_response(STREAM mcs_data)
{
UNUSED(mcs_data);
uint8 result;
@ -132,24 +128,12 @@ mcs_recv_connect_response(STREAM mcs_data)
ber_parse_header(s, BER_TAG_OCTET_STRING, &length);
sec_process_mcs_data(s);
/*
if (length > mcs_data->size)
{
logger(Protocol, Error, "mcs_recv_connect_response(), expected length=%d, got %d",length, mcs_data->size);
length = mcs_data->size;
}
s_reset(mcs_data);
in_uint8stream(s, mcs_data, length);
s_mark_end(mcs_data);
s_seek(mcs_data, 0);
*/
return s_check_end(s);
}
/* Send an EDrq message (ASN.1 PER) */
static void
mcs_send_edrq(void)
static void mcs_send_edrq(void)
{
STREAM s;
logger(Protocol, Debug, "%s()", __func__);
@ -165,8 +149,7 @@ mcs_send_edrq(void)
}
/* Send an AUrq message (ASN.1 PER) */
static void
mcs_send_aurq(void)
static void mcs_send_aurq(void)
{
STREAM s;
logger(Protocol, Debug, "%s()", __func__);
@ -180,8 +163,7 @@ mcs_send_aurq(void)
}
/* Expect a AUcf message (ASN.1 PER) */
static RD_BOOL
mcs_recv_aucf(uint16 * mcs_userid)
static RD_BOOL mcs_recv_aucf(uint16 * mcs_userid)
{
RD_BOOL is_fastpath;
uint8 fastpath_hdr;
@ -215,8 +197,7 @@ mcs_recv_aucf(uint16 * mcs_userid)
}
/* Send a CJrq message (ASN.1 PER) */
static void
mcs_send_cjrq(uint16 chanid)
static void mcs_send_cjrq(uint16 chanid)
{
STREAM s;
@ -234,8 +215,7 @@ mcs_send_cjrq(uint16 chanid)
}
/* Expect a CJcf message (ASN.1 PER) */
static RD_BOOL
mcs_recv_cjcf(void)
static RD_BOOL mcs_recv_cjcf(void)
{
RD_BOOL is_fastpath;
uint8 fastpath_hdr;
@ -269,10 +249,8 @@ mcs_recv_cjcf(void)
return s_check_end(s);
}
/* Send MCS Disconnect provider ultimatum PDU */
void
mcs_send_dpu(unsigned short reason)
void mcs_send_dpu(unsigned short reason)
{
STREAM s, contents;
@ -294,8 +272,7 @@ mcs_send_dpu(unsigned short reason)
}
/* Initialise an MCS transport data packet */
STREAM
mcs_init(int length)
STREAM mcs_init(int length)
{
STREAM s;
@ -306,8 +283,7 @@ mcs_init(int length)
}
/* Send an MCS transport data packet to a specific channel */
void
mcs_send_to_channel(STREAM s, uint16 channel)
void mcs_send_to_channel(STREAM s, uint16 channel)
{
uint16 length;
@ -325,15 +301,13 @@ mcs_send_to_channel(STREAM s, uint16 channel)
}
/* Send an MCS transport data packet to the global channel */
void
mcs_send(STREAM s)
void mcs_send(STREAM s)
{
mcs_send_to_channel(s, MCS_GLOBAL_CHANNEL);
}
/* Receive an MCS transport data packet */
STREAM
mcs_recv(uint16 * channel, RD_BOOL * is_fastpath, uint8 * fastpath_hdr)
STREAM mcs_recv(uint16 * channel, RD_BOOL * is_fastpath, uint8 * fastpath_hdr)
{
uint8 opcode, appid, length;
STREAM s;
@ -364,16 +338,14 @@ mcs_recv(uint16 * channel, RD_BOOL * is_fastpath, uint8 * fastpath_hdr)
return s;
}
RD_BOOL
mcs_connect_start(char *server, char *username, char *domain, char *password,
RD_BOOL mcs_connect_start(char *server, char *username, char *domain, char *password,
RD_BOOL reconnect, uint32 * selected_protocol)
{
logger(Protocol, Debug, "%s()", __func__);
return iso_connect(server, username, domain, password, reconnect, selected_protocol);
}
RD_BOOL
mcs_connect_finalize(STREAM mcs_data)
RD_BOOL mcs_connect_finalize(STREAM mcs_data)
{
unsigned int i;
@ -411,16 +383,14 @@ mcs_connect_finalize(STREAM mcs_data)
}
/* Disconnect from the MCS layer */
void
mcs_disconnect(int reason)
void mcs_disconnect(int reason)
{
mcs_send_dpu(reason);
iso_disconnect();
}
/* reset the state of the mcs layer */
void
mcs_reset_state(void)
void mcs_reset_state(void)
{
g_mcs_userid = 0;
iso_reset_state();

123
mppc.c
View File

@ -22,40 +22,19 @@
#include "rdesktop.h"
/* mppc decompression */
/* http://www.faqs.org/rfcs/rfc2118.html */
/* Contacts: */
/* hifn contact mentioned in the FAQ is */
/* Robert Friend rfriend at hifn dot com */
/* if you have questions regarding MPPC */
/* our contact is */
/* Guus Dhaeze GDhaeze at hifn dot com */
/* MPPC decompression based on RFC 2118 */
/* Licensing: */
/* decompression is alright as long as we */
/* Decompression is allowed as long as we */
/* don't compress data */
/* Algorithm: */
/* as the RFC states the algorithm seems to */
/* be LZ77 with a sliding buffer */
/* that is empty at init. */
/* the algorithm is called LZS and is */
/* patented for another couple of years. */
/* more information is available in */
/* The algorithm is LZS and is patented for another couple of years. */
/* More information: */
/* http://www.ietf.org/ietf/IPR/hifn-ipr-draft-friend-tls-lzs-compression.txt */
RDPCOMP g_mppc_dict;
int
mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen)
int mppc_expand(uint8 *data, uint32 clen, uint8 ctype, uint32 *roff, uint32 *rlen)
{
int k, walker_len = 0, walker;
uint32 i = 0;
@ -88,12 +67,13 @@ mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen
*rlen = 0;
walker = g_mppc_dict.roff;
next_offset = walker;
old_offset = next_offset;
*roff = old_offset;
if (clen == 0)
return 0;
clen += i;
do
@ -120,13 +100,12 @@ mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen
}
if (next_offset >= RDP_MPPC_DICT_SIZE)
return -1;
dict[next_offset++] = (((uint32) walker) >> ((uint32) 24));
dict[next_offset++] = (uint8)((uint32)walker >> 24);
walker <<= 8;
walker_len -= 8;
continue;
}
walker <<= 1;
/* fetch next 8-bits */
if (--walker_len == 0)
{
if (i >= clen)
@ -134,7 +113,6 @@ mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen
walker = data[i++] << 24;
walker_len = 8;
}
/* literal decoding */
if (walker >= 0)
{
if (walker_len < 8)
@ -152,8 +130,6 @@ mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen
continue;
}
/* decode offset */
/* length pair */
walker <<= 1;
if (--walker_len < (big ? 3 : 2))
{
@ -165,15 +141,9 @@ mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen
if (big)
{
/* offset decoding where offset len is:
-63: 11111 followed by the lower 6 bits of the value
64-319: 11110 followed by the lower 8 bits of the value ( value - 64 )
320-2367: 1110 followed by lower 11 bits of the value ( value - 320 )
2368-65535: 110 followed by lower 16 bits of the value ( value - 2368 )
*/
switch (((uint32) walker) >> ((uint32) 29))
switch (((uint32)walker) >> 29)
{
case 7: /* - 63 */
case 7:
for (; walker_len < 9; walker_len += 8)
{
if (i >= clen)
@ -181,50 +151,44 @@ mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen
walker |= (data[i++] & 0xff) << (24 - walker_len);
}
walker <<= 3;
match_off = ((uint32) walker) >> ((uint32) 26);
match_off = ((uint32)walker) >> 26;
walker <<= 6;
walker_len -= 9;
break;
case 6: /* 64 - 319 */
case 6:
for (; walker_len < 11; walker_len += 8)
{
if (i >= clen)
return -1;
walker |= (data[i++] & 0xff) << (24 - walker_len);
}
walker <<= 3;
match_off = (((uint32) walker) >> ((uint32) 24)) + 64;
match_off = (((uint32)walker) >> 24) + 64;
walker <<= 8;
walker_len -= 11;
break;
case 5:
case 4: /* 320 - 2367 */
case 4:
for (; walker_len < 13; walker_len += 8)
{
if (i >= clen)
return -1;
walker |= (data[i++] & 0xff) << (24 - walker_len);
}
walker <<= 2;
match_off = (((uint32) walker) >> ((uint32) 21)) + 320;
match_off = (((uint32)walker) >> 21) + 320;
walker <<= 11;
walker_len -= 13;
break;
default: /* 2368 - 65535 */
default:
for (; walker_len < 17; walker_len += 8)
{
if (i >= clen)
return -1;
walker |= (data[i++] & 0xff) << (24 - walker_len);
}
walker <<= 1;
match_off = (((uint32) walker) >> ((uint32) 16)) + 2368;
match_off = (((uint32)walker) >> 16) + 2368;
walker <<= 16;
walker_len -= 17;
break;
@ -232,14 +196,9 @@ mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen
}
else
{
/* offset decoding where offset len is:
-63: 1111 followed by the lower 6 bits of the value
64-319: 1110 followed by the lower 8 bits of the value ( value - 64 )
320-8191: 110 followed by the lower 13 bits of the value ( value - 320 )
*/
switch (((uint32) walker) >> ((uint32) 30))
switch (((uint32)walker) >> 30)
{
case 3: /* - 63 */
case 3:
if (walker_len < 8)
{
if (i >= clen)
@ -248,33 +207,29 @@ mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen
walker_len += 8;
}
walker <<= 2;
match_off = ((uint32) walker) >> ((uint32) 26);
match_off = ((uint32)walker) >> 26;
walker <<= 6;
walker_len -= 8;
break;
case 2: /* 64 - 319 */
case 2:
for (; walker_len < 10; walker_len += 8)
{
if (i >= clen)
return -1;
walker |= (data[i++] & 0xff) << (24 - walker_len);
}
walker <<= 2;
match_off = (((uint32) walker) >> ((uint32) 24)) + 64;
match_off = (((uint32)walker) >> 24) + 64;
walker <<= 8;
walker_len -= 10;
break;
default: /* 320 - 8191 */
default:
for (; walker_len < 14; walker_len += 8)
{
if (i >= clen)
return -1;
walker |= (data[i++] & 0xff) << (24 - walker_len);
}
match_off = (walker >> 18) + 320;
walker <<= 14;
walker_len -= 14;
@ -289,33 +244,16 @@ mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen
walker_len = 8;
}
/* decode length of match */
match_len = 0;
if (walker >= 0)
{ /* special case - length of 3 is in bit 0 */
{
match_len = 3;
walker <<= 1;
walker_len--;
}
else
{
/* this is how it works len of:
4-7: 10 followed by 2 bits of the value
8-15: 110 followed by 3 bits of the value
16-31: 1110 followed by 4 bits of the value
32-63: .... and so forth
64-127:
128-255:
256-511:
512-1023:
1024-2047:
2048-4095:
4096-8191:
i.e. 4097 is encoded as: 111111111110 000000000001
meaning 4096 + 1...
*/
match_bits = big ? 14 : 11; /* 11 or 14 bits of value at most */
match_bits = big ? 14 : 11;
do
{
walker <<= 1;
@ -332,8 +270,7 @@ mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen
{
return -1;
}
}
while (1);
} while (1);
match_len = (big ? 16 : 13) - match_bits;
walker <<= 1;
if (--walker_len < match_len)
@ -359,17 +296,13 @@ mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen
{
return -1;
}
/* memory areas can overlap - meaning we can't use memXXX functions */
k = (next_offset - match_off) & (big ? 65535 : 8191);
do
{
dict[next_offset++] = dict[k++];
}
while (--match_len != 0);
}
while (1);
} while (--match_len != 0);
} while (1);
/* store history offset */
g_mppc_dict.roff = next_offset;
*roff = old_offset;

113
orders.c
View File

@ -25,8 +25,7 @@ static RDP_ORDER_STATE g_order_state;
extern RDP_VERSION g_rdp_version;
/* Read field indicating which parameters are present */
static void
rdp_in_present(STREAM s, uint32 * present, uint8 flags, int size)
static void rdp_in_present(STREAM s, uint32 *present, uint8 flags, int size)
{
uint8 bits;
int i;
@ -53,8 +52,7 @@ rdp_in_present(STREAM s, uint32 * present, uint8 flags, int size)
}
/* Read a co-ordinate (16-bit, or 8-bit delta) */
static void
rdp_in_coord(STREAM s, sint16 * coord, RD_BOOL delta)
static void rdp_in_coord(STREAM s, sint16 *coord, RD_BOOL delta)
{
sint8 change;
@ -70,8 +68,7 @@ rdp_in_coord(STREAM s, sint16 * coord, RD_BOOL delta)
}
/* Parse a delta co-ordinate in polyline/polygon order form */
static int
parse_delta(uint8 * buffer, int *offset)
static int parse_delta(uint8 *buffer, int *offset)
{
int value = buffer[(*offset)++];
int two_byte = value & 0x80;
@ -88,8 +85,7 @@ parse_delta(uint8 * buffer, int *offset)
}
/* Read a colour entry */
static void
rdp_in_colour(STREAM s, uint32 * colour)
static void rdp_in_colour(STREAM s, uint32 *colour)
{
uint32 i;
in_uint8(s, i);
@ -101,8 +97,7 @@ rdp_in_colour(STREAM s, uint32 * colour)
}
/* Parse bounds information */
static void
rdp_parse_bounds(STREAM s, BOUNDS * bounds)
static void rdp_parse_bounds(STREAM s, BOUNDS *bounds)
{
uint8 present;
@ -130,8 +125,7 @@ rdp_parse_bounds(STREAM s, BOUNDS * bounds)
}
/* Parse a pen */
static void
rdp_parse_pen(STREAM s, PEN * pen, uint32 present)
static void rdp_parse_pen(STREAM s, PEN *pen, uint32 present)
{
if (present & 1)
in_uint8(s, pen->style);
@ -143,8 +137,7 @@ rdp_parse_pen(STREAM s, PEN * pen, uint32 present)
rdp_in_colour(s, &pen->colour);
}
static void
setup_brush(BRUSH * out_brush, BRUSH * in_brush)
static void setup_brush(BRUSH *out_brush, BRUSH *in_brush)
{
BRUSHDATA *brush_data;
uint8 cache_idx;
@ -158,8 +151,7 @@ setup_brush(BRUSH * out_brush, BRUSH * in_brush)
brush_data = cache_get_brush_data(colour_code, cache_idx);
if ((brush_data == NULL) || (brush_data->data == NULL))
{
logger(Graphics, Error, "setup_brush(), error getting brush data, style %x",
out_brush->style);
logger(Graphics, Error, "setup_brush(), error getting brush data, style %x", out_brush->style);
out_brush->bd = NULL;
memset(out_brush->pattern, 0, 8);
}
@ -172,8 +164,7 @@ setup_brush(BRUSH * out_brush, BRUSH * in_brush)
}
/* Parse a brush */
static void
rdp_parse_brush(STREAM s, BRUSH * brush, uint32 present)
static void rdp_parse_brush(STREAM s, BRUSH *brush, uint32 present)
{
if (present & 1)
in_uint8(s, brush->xorigin);
@ -192,8 +183,7 @@ rdp_parse_brush(STREAM s, BRUSH * brush, uint32 present)
}
/* Process a destination blt order */
static void
process_destblt(STREAM s, DESTBLT_ORDER * os, uint32 present, RD_BOOL delta)
static void process_destblt(STREAM s, DESTBLT_ORDER *os, uint32 present, RD_BOOL delta)
{
if (present & 0x01)
rdp_in_coord(s, &os->x, delta);
@ -217,8 +207,7 @@ process_destblt(STREAM s, DESTBLT_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process a pattern blt order */
static void
process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, RD_BOOL delta)
static void process_patblt(STREAM s, PATBLT_ORDER *os, uint32 present, RD_BOOL delta)
{
BRUSH brush;
@ -247,18 +236,15 @@ process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, RD_BOOL delta)
logger(Graphics, Debug,
"process_patblt(), op=0x%x, x=%d, y=%d, cx=%d, cy=%d, bs=%d, bg=0x%x, fg=0x%x)",
os->opcode, os->x, os->y, os->cx, os->cy, os->brush.style, os->bgcolour,
os->fgcolour);
os->opcode, os->x, os->y, os->cx, os->cy, os->brush.style, os->bgcolour, os->fgcolour);
setup_brush(&brush, &os->brush);
ui_patblt(ROP2_P(os->opcode), os->x, os->y, os->cx, os->cy,
&brush, os->bgcolour, os->fgcolour);
ui_patblt(ROP2_P(os->opcode), os->x, os->y, os->cx, os->cy, &brush, os->bgcolour, os->fgcolour);
}
/* Process a screen blt order */
static void
process_screenblt(STREAM s, SCREENBLT_ORDER * os, uint32 present, RD_BOOL delta)
static void process_screenblt(STREAM s, SCREENBLT_ORDER *os, uint32 present, RD_BOOL delta)
{
if (present & 0x0001)
rdp_in_coord(s, &os->x, delta);
@ -289,8 +275,7 @@ process_screenblt(STREAM s, SCREENBLT_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process a line order */
static void
process_line(STREAM s, LINE_ORDER * os, uint32 present, RD_BOOL delta)
static void process_line(STREAM s, LINE_ORDER *os, uint32 present, RD_BOOL delta)
{
if (present & 0x0001)
in_uint16_le(s, os->mixmode);
@ -328,8 +313,7 @@ process_line(STREAM s, LINE_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process an opaque rectangle order */
static void
process_rect(STREAM s, RECT_ORDER * os, uint32 present, RD_BOOL delta)
static void process_rect(STREAM s, RECT_ORDER *os, uint32 present, RD_BOOL delta)
{
uint32 i;
if (present & 0x01)
@ -369,8 +353,7 @@ process_rect(STREAM s, RECT_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process a desktop save order */
static void
process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, RD_BOOL delta)
static void process_desksave(STREAM s, DESKSAVE_ORDER *os, uint32 present, RD_BOOL delta)
{
int width, height;
@ -405,8 +388,7 @@ process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process a memory blt order */
static void
process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, RD_BOOL delta)
static void process_memblt(STREAM s, MEMBLT_ORDER *os, uint32 present, RD_BOOL delta)
{
RD_HBITMAP bitmap;
@ -452,8 +434,7 @@ process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process a 3-way blt order */
static void
process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, RD_BOOL delta)
static void process_triblt(STREAM s, TRIBLT_ORDER *os, uint32 present, RD_BOOL delta)
{
RD_HBITMAP bitmap;
BRUSH brush;
@ -510,13 +491,11 @@ process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, RD_BOOL delta)
setup_brush(&brush, &os->brush);
ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy,
bitmap, os->srcx, os->srcy, &brush, os->bgcolour, os->fgcolour);
ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy, bitmap, os->srcx, os->srcy, &brush, os->bgcolour, os->fgcolour);
}
/* Process a polygon order */
static void
process_polygon(STREAM s, POLYGON_ORDER * os, uint32 present, RD_BOOL delta)
static void process_polygon(STREAM s, POLYGON_ORDER *os, uint32 present, RD_BOOL delta)
{
int index, data, next;
uint8 flags = 0;
@ -588,8 +567,7 @@ process_polygon(STREAM s, POLYGON_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process a polygon2 order */
static void
process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, RD_BOOL delta)
static void process_polygon2(STREAM s, POLYGON2_ORDER *os, uint32 present, RD_BOOL delta)
{
int index, data, next;
uint8 flags = 0;
@ -670,8 +648,7 @@ process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process a polyline order */
static void
process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, RD_BOOL delta)
static void process_polyline(STREAM s, POLYLINE_ORDER *os, uint32 present, RD_BOOL delta)
{
int index, next, data;
uint8 flags = 0;
@ -741,8 +718,7 @@ process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process an ellipse order */
static void
process_ellipse(STREAM s, ELLIPSE_ORDER * os, uint32 present, RD_BOOL delta)
static void process_ellipse(STREAM s, ELLIPSE_ORDER *os, uint32 present, RD_BOOL delta)
{
if (present & 0x01)
rdp_in_coord(s, &os->left, delta);
@ -774,8 +750,7 @@ process_ellipse(STREAM s, ELLIPSE_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process an ellipse2 order */
static void
process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, RD_BOOL delta)
static void process_ellipse2(STREAM s, ELLIPSE2_ORDER *os, uint32 present, RD_BOOL delta)
{
BRUSH brush;
@ -817,8 +792,7 @@ process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process a text order */
static void
process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, RD_BOOL delta)
static void process_text2(STREAM s, TEXT2_ORDER *os, uint32 present, RD_BOOL delta)
{
UNUSED(delta);
BRUSH brush;
@ -895,8 +869,7 @@ process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, RD_BOOL delta)
}
/* Process a raw bitmap cache order */
static void
process_raw_bmpcache(STREAM s)
static void process_raw_bmpcache(STREAM s)
{
RD_HBITMAP bitmap;
uint16 cache_idx, bufsize;
@ -929,8 +902,7 @@ process_raw_bmpcache(STREAM s)
}
/* Process a bitmap cache order */
static void
process_bmpcache(STREAM s)
static void process_bmpcache(STREAM s)
{
RD_HBITMAP bitmap;
uint16 cache_idx, size;
@ -963,7 +935,6 @@ process_bmpcache(STREAM s)
/* in_uint8s(s, 4); *//* row_size, final_size */
in_uint16_le(s, row_size);
in_uint16_le(s, final_size);
}
in_uint8p(s, data, size);
logger(Graphics, Debug,
@ -987,8 +958,7 @@ process_bmpcache(STREAM s)
}
/* Process a bitmap cache v2 order */
static void
process_bmpcache2(STREAM s, uint16 flags, RD_BOOL compressed)
static void process_bmpcache2(STREAM s, uint16 flags, RD_BOOL compressed)
{
RD_HBITMAP bitmap;
int y;
@ -1069,8 +1039,7 @@ process_bmpcache2(STREAM s, uint16 flags, RD_BOOL compressed)
}
/* Process a colourmap cache order */
static void
process_colcache(STREAM s)
static void process_colcache(STREAM s)
{
COLOURENTRY *entry;
COLOURMAP map;
@ -1103,8 +1072,7 @@ process_colcache(STREAM s)
}
/* Process a font cache order */
static void
process_fontcache(STREAM s)
static void process_fontcache(STREAM s)
{
RD_HGLYPH bitmap;
uint8 font, nglyphs;
@ -1133,8 +1101,7 @@ process_fontcache(STREAM s)
}
}
static void
process_compressed_8x8_brush_data(uint8 * in, uint8 * out, int Bpp)
static void process_compressed_8x8_brush_data(uint8 *in, uint8 *out, int Bpp)
{
int x, y, pal_index, in_index, shift, do2, i;
uint8 *pal;
@ -1167,8 +1134,7 @@ process_compressed_8x8_brush_data(uint8 * in, uint8 * out, int Bpp)
}
/* Process a brush cache order */
static void
process_brushcache(STREAM s, uint16 flags)
static void process_brushcache(STREAM s, uint16 flags)
{
UNUSED(flags);
BRUSHDATA brush_data;
@ -1243,8 +1209,7 @@ process_brushcache(STREAM s, uint16 flags)
}
/* Process a secondary order */
static void
process_secondary_order(STREAM s)
static void process_secondary_order(STREAM s)
{
/* The length isn't calculated correctly by the server.
* For very compact orders the length becomes negative
@ -1310,8 +1275,7 @@ process_secondary_order(STREAM s)
}
/* Process an order PDU */
void
process_orders(STREAM s, uint16 num_orders)
void process_orders(STREAM s, uint16 num_orders)
{
RDP_ORDER_STATE *os = &g_order_state;
uint32 present;
@ -1368,8 +1332,7 @@ process_orders(STREAM s, uint16 num_orders)
ui_set_clip(os->bounds.left,
os->bounds.top,
os->bounds.right -
os->bounds.left + 1,
os->bounds.right - os->bounds.left + 1,
os->bounds.bottom - os->bounds.top + 1);
}
@ -1452,12 +1415,10 @@ process_orders(STREAM s, uint16 num_orders)
logger(Graphics, Error, "process_orders(), %d bytes remaining",
(int)(g_next_packet - s_tell(s)));
#endif
}
/* Reset order state */
void
reset_order_state(void)
void reset_order_state(void)
{
memset(&g_order_state, 0, sizeof(g_order_state));
g_order_state.order_type = RDP_ORDER_PATBLT;

173
orders.h
View File

@ -26,8 +26,8 @@
#define RDP_ORDER_SMALL 0x40
#define RDP_ORDER_TINY 0x80
enum RDP_ORDER_TYPE
{
/* Enumeration for RDP order types */
enum RDP_ORDER_TYPE {
RDP_ORDER_DESTBLT = 0,
RDP_ORDER_PATBLT = 1,
RDP_ORDER_SCREENBLT = 2,
@ -44,8 +44,8 @@ enum RDP_ORDER_TYPE
RDP_ORDER_TEXT2 = 27
};
enum RDP_SECONDARY_ORDER_TYPE
{
/* Enumeration for RDP secondary order types */
enum RDP_SECONDARY_ORDER_TYPE {
RDP_ORDER_RAW_BMPCACHE = 0,
RDP_ORDER_COLCACHE = 1,
RDP_ORDER_BMPCACHE = 2,
@ -55,19 +55,17 @@ enum RDP_SECONDARY_ORDER_TYPE
RDP_ORDER_BRUSHCACHE = 7
};
typedef struct _DESTBLT_ORDER
{
/* Structure for DESTBLT order */
typedef struct _DESTBLT_ORDER {
sint16 x;
sint16 y;
sint16 cx;
sint16 cy;
uint8 opcode;
} DESTBLT_ORDER;
}
DESTBLT_ORDER;
typedef struct _PATBLT_ORDER
{
/* Structure for PATBLT order */
typedef struct _PATBLT_ORDER {
sint16 x;
sint16 y;
sint16 cx;
@ -76,12 +74,10 @@ typedef struct _PATBLT_ORDER
uint32 bgcolour;
uint32 fgcolour;
BRUSH brush;
} PATBLT_ORDER;
}
PATBLT_ORDER;
typedef struct _SCREENBLT_ORDER
{
/* Structure for SCREENBLT order */
typedef struct _SCREENBLT_ORDER {
sint16 x;
sint16 y;
sint16 cx;
@ -89,12 +85,10 @@ typedef struct _SCREENBLT_ORDER
uint8 opcode;
sint16 srcx;
sint16 srcy;
} SCREENBLT_ORDER;
}
SCREENBLT_ORDER;
typedef struct _LINE_ORDER
{
/* Structure for LINE order */
typedef struct _LINE_ORDER {
uint16 mixmode;
sint16 startx;
sint16 starty;
@ -103,35 +97,29 @@ typedef struct _LINE_ORDER
uint32 bgcolour;
uint8 opcode;
PEN pen;
} LINE_ORDER;
}
LINE_ORDER;
typedef struct _RECT_ORDER
{
/* Structure for RECT order */
typedef struct _RECT_ORDER {
sint16 x;
sint16 y;
sint16 cx;
sint16 cy;
uint32 colour;
} RECT_ORDER;
}
RECT_ORDER;
typedef struct _DESKSAVE_ORDER
{
/* Structure for DESKSAVE order */
typedef struct _DESKSAVE_ORDER {
uint32 offset;
sint16 left;
sint16 top;
sint16 right;
sint16 bottom;
uint8 action;
} DESKSAVE_ORDER;
}
DESKSAVE_ORDER;
typedef struct _TRIBLT_ORDER
{
/* Structure for TRIBLT order */
typedef struct _TRIBLT_ORDER {
uint8 colour_table;
uint8 cache_id;
sint16 x;
@ -146,12 +134,10 @@ typedef struct _TRIBLT_ORDER
BRUSH brush;
uint16 cache_idx;
uint16 unknown;
} TRIBLT_ORDER;
}
TRIBLT_ORDER;
typedef struct _MEMBLT_ORDER
{
/* Structure for MEMBLT order */
typedef struct _MEMBLT_ORDER {
uint8 colour_table;
uint8 cache_id;
sint16 x;
@ -162,14 +148,12 @@ typedef struct _MEMBLT_ORDER
sint16 srcx;
sint16 srcy;
uint16 cache_idx;
}
MEMBLT_ORDER;
} MEMBLT_ORDER;
#define MAX_DATA 256
typedef struct _POLYGON_ORDER
{
/* Structure for POLYGON order */
typedef struct _POLYGON_ORDER {
sint16 x;
sint16 y;
uint8 opcode;
@ -178,12 +162,10 @@ typedef struct _POLYGON_ORDER
uint8 npoints;
uint8 datasize;
uint8 data[MAX_DATA];
} POLYGON_ORDER;
}
POLYGON_ORDER;
typedef struct _POLYGON2_ORDER
{
/* Structure for POLYGON2 order */
typedef struct _POLYGON2_ORDER {
sint16 x;
sint16 y;
uint8 opcode;
@ -194,12 +176,10 @@ typedef struct _POLYGON2_ORDER
uint8 npoints;
uint8 datasize;
uint8 data[MAX_DATA];
} POLYGON2_ORDER;
}
POLYGON2_ORDER;
typedef struct _POLYLINE_ORDER
{
/* Structure for POLYLINE order */
typedef struct _POLYLINE_ORDER {
sint16 x;
sint16 y;
uint8 opcode;
@ -207,12 +187,10 @@ typedef struct _POLYLINE_ORDER
uint8 lines;
uint8 datasize;
uint8 data[MAX_DATA];
} POLYLINE_ORDER;
}
POLYLINE_ORDER;
typedef struct _ELLIPSE_ORDER
{
/* Structure for ELLIPSE order */
typedef struct _ELLIPSE_ORDER {
sint16 left;
sint16 top;
sint16 right;
@ -220,12 +198,10 @@ typedef struct _ELLIPSE_ORDER
uint8 opcode;
uint8 fillmode;
uint32 fgcolour;
} ELLIPSE_ORDER;
}
ELLIPSE_ORDER;
typedef struct _ELLIPSE2_ORDER
{
/* Structure for ELLIPSE2 order */
typedef struct _ELLIPSE2_ORDER {
sint16 left;
sint16 top;
sint16 right;
@ -235,14 +211,12 @@ typedef struct _ELLIPSE2_ORDER
BRUSH brush;
uint32 bgcolour;
uint32 fgcolour;
}
ELLIPSE2_ORDER;
} ELLIPSE2_ORDER;
#define MAX_TEXT 256
typedef struct _TEXT2_ORDER
{
/* Structure for TEXT2 order */
typedef struct _TEXT2_ORDER {
uint8 font;
uint8 flags;
uint8 opcode;
@ -262,15 +236,12 @@ typedef struct _TEXT2_ORDER
sint16 y;
uint8 length;
uint8 text[MAX_TEXT];
} TEXT2_ORDER;
}
TEXT2_ORDER;
typedef struct _RDP_ORDER_STATE
{
/* Structure for RDP order state */
typedef struct _RDP_ORDER_STATE {
uint8 order_type;
BOUNDS bounds;
DESTBLT_ORDER destblt;
PATBLT_ORDER patblt;
SCREENBLT_ORDER screenblt;
@ -285,12 +256,10 @@ typedef struct _RDP_ORDER_STATE
ELLIPSE_ORDER ellipse;
ELLIPSE2_ORDER ellipse2;
TEXT2_ORDER text2;
} RDP_ORDER_STATE;
}
RDP_ORDER_STATE;
typedef struct _RDP_RAW_BMPCACHE_ORDER
{
/* Structure for RAW BMPCACHE order */
typedef struct _RDP_RAW_BMPCACHE_ORDER {
uint8 cache_id;
uint8 pad1;
uint8 width;
@ -299,12 +268,10 @@ typedef struct _RDP_RAW_BMPCACHE_ORDER
uint16 bufsize;
uint16 cache_idx;
uint8 *data;
} RDP_RAW_BMPCACHE_ORDER;
}
RDP_RAW_BMPCACHE_ORDER;
typedef struct _RDP_BMPCACHE_ORDER
{
/* Structure for BMPCACHE order */
typedef struct _RDP_BMPCACHE_ORDER {
uint8 cache_id;
uint8 pad1;
uint8 width;
@ -317,51 +284,41 @@ typedef struct _RDP_BMPCACHE_ORDER
uint16 row_size;
uint16 final_size;
uint8 *data;
} RDP_BMPCACHE_ORDER;
}
RDP_BMPCACHE_ORDER;
/* RDP_BMPCACHE2_ORDER */
/* Constants for BMPCACHE2 order */
#define ID_MASK 0x0007
#define MODE_MASK 0x0038
#define SQUARE 0x0080
#define PERSIST 0x0100
#define FLAG_51_UNKNOWN 0x0800
#define MODE_SHIFT 3
#define LONG_FORMAT 0x80
#define BUFSIZE_MASK 0x3FFF /* or 0x1FFF? */
#define MAX_GLYPH 32
typedef struct _RDP_FONT_GLYPH
{
/* Structure for font glyph */
typedef struct _RDP_FONT_GLYPH {
uint16 character;
uint16 unknown;
uint16 baseline;
uint16 width;
uint16 height;
uint8 data[MAX_GLYPH];
}
RDP_FONT_GLYPH;
} RDP_FONT_GLYPH;
#define MAX_GLYPHS 256
typedef struct _RDP_FONTCACHE_ORDER
{
/* Structure for font cache order */
typedef struct _RDP_FONTCACHE_ORDER {
uint8 font;
uint8 nglyphs;
RDP_FONT_GLYPH glyphs[MAX_GLYPHS];
} RDP_FONTCACHE_ORDER;
}
RDP_FONTCACHE_ORDER;
typedef struct _RDP_COLCACHE_ORDER
{
/* Structure for colour cache order */
typedef struct _RDP_COLCACHE_ORDER {
uint8 cache_id;
COLOURMAP map;
}
RDP_COLCACHE_ORDER;
} RDP_COLCACHE_ORDER;