1 |
/* -*- c-basic-offset: 8 -*- |
/* -*- c-basic-offset: 8 -*- |
2 |
* rdesktop: A Remote Desktop Protocol client. |
* rdesktop: A Remote Desktop Protocol client. |
3 |
* Entrypoint and utility functions |
* Entrypoint and utility functions |
4 |
* Copyright (C) Matthew Chapman 1999-2003 |
* Copyright (C) Matthew Chapman 1999-2005 |
5 |
* Copyright (C) Jeroen Meijer 2003 |
* Copyright (C) Jeroen Meijer 2003 |
6 |
* |
* |
7 |
* This program is free software; you can redistribute it and/or modify |
* This program is free software; you can redistribute it and/or modify |
36 |
#include <string.h> |
#include <string.h> |
37 |
#include "rdesktop.h" |
#include "rdesktop.h" |
38 |
|
|
39 |
BOOL |
static BOOL |
40 |
printercache_mkdir(char *base, char *printer) |
printercache_mkdir(char *base, char *printer) |
41 |
{ |
{ |
42 |
char *path; |
char *path; |
72 |
return True; |
return True; |
73 |
} |
} |
74 |
|
|
75 |
BOOL |
static BOOL |
76 |
printercache_unlink_blob(char *printer) |
printercache_unlink_blob(char *printer) |
77 |
{ |
{ |
78 |
char *path; |
char *path; |
109 |
} |
} |
110 |
|
|
111 |
|
|
112 |
BOOL |
static BOOL |
113 |
printercache_rename_blob(char *printer, char *new_printer) |
printercache_rename_blob(char *printer, char *new_printer) |
114 |
{ |
{ |
115 |
char *printer_path; |
char *printer_path; |
190 |
return length; |
return length; |
191 |
} |
} |
192 |
|
|
193 |
void |
static void |
194 |
printercache_save_blob(char *printer_name, uint8 * data, uint32 length) |
printercache_save_blob(char *printer_name, uint8 * data, uint32 length) |
195 |
{ |
{ |
196 |
char *home, *path; |
char *home, *path; |
239 |
{ |
{ |
240 |
case 4: /* rename item */ |
case 4: /* rename item */ |
241 |
in_uint8(s, printer_length); |
in_uint8(s, printer_length); |
242 |
in_uint8s(s, 0x3); // padding |
in_uint8s(s, 0x3); /* padding */ |
243 |
in_uint8(s, driver_length); |
in_uint8(s, driver_length); |
244 |
in_uint8s(s, 0x3); // padding |
in_uint8s(s, 0x3); /* padding */ |
245 |
|
|
246 |
/* NOTE - 'driver' doesn't contain driver, it contains the new printer name */ |
/* NOTE - 'driver' doesn't contain driver, it contains the new printer name */ |
247 |
|
|
253 |
|
|
254 |
case 3: /* delete item */ |
case 3: /* delete item */ |
255 |
in_uint8(s, printer_unicode_length); |
in_uint8(s, printer_unicode_length); |
256 |
in_uint8s(s, 0x3); // padding |
in_uint8s(s, 0x3); /* padding */ |
257 |
printer_length = rdp_in_unistr(s, printer, printer_unicode_length); |
printer_length = rdp_in_unistr(s, printer, printer_unicode_length); |
258 |
printercache_unlink_blob(printer); |
printercache_unlink_blob(printer); |
259 |
break; |
break; |
270 |
break; |
break; |
271 |
|
|
272 |
case 1: /* save device data */ |
case 1: /* save device data */ |
273 |
in_uint8a(s, device_name, 5); // get LPTx/COMx name |
in_uint8a(s, device_name, 5); /* get LPTx/COMx name */ |
274 |
|
|
275 |
// need to fetch this data so that we can get the length of the packet to store. |
/* need to fetch this data so that we can get the length of the packet to store. */ |
276 |
in_uint8s(s, 0x2); // ??? |
in_uint8s(s, 0x2); /* ??? */ |
277 |
in_uint8s(s, 0x2) // pad?? |
in_uint8s(s, 0x2) /* pad?? */ |
278 |
in_uint32_be(s, driver_length); |
in_uint32_be(s, driver_length); |
279 |
in_uint32_be(s, printer_length); |
in_uint32_be(s, printer_length); |
280 |
in_uint8s(s, 0x7) // pad?? |
in_uint8s(s, 0x7) /* pad?? */ |
281 |
// next is driver in unicode |
/* next is driver in unicode */ |
282 |
// next is printer in unicode |
/* next is printer in unicode */ |
283 |
/* TODO: figure out how to use this information when reconnecting */ |
/* TODO: figure out how to use this information when reconnecting */ |
284 |
/* actually - all we need to store is the driver and printer */ |
/* actually - all we need to store is the driver and printer */ |
285 |
/* and figure out what the first word is. */ |
/* and figure out what the first word is. */ |
286 |
/* rewind stream so that we can save this blob */ |
/* rewind stream so that we can save this blob */ |
287 |
/* length is driver_length + printer_length + 19 */ |
/* length is driver_length + printer_length + 19 */ |
288 |
// rewind stream |
/* rewind stream */ |
289 |
s->p = s->p - 19; |
s->p = s->p - 19; |
290 |
|
|
291 |
printercache_save_blob(device_name, s->p, |
printercache_save_blob(device_name, s->p, |