/[rdesktop]/jpeg/rdesktop/trunk/printercache.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /jpeg/rdesktop/trunk/printercache.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 611 by n-ki, Mon Feb 23 08:13:52 2004 UTC revision 1426 by matthewc, Sat Jan 5 05:43:02 2008 UTC
# Line 1  Line 1 
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-2007
5   * Copyright (C) Jeroen Meijer 2003   * Copyright (C) Jeroen Meijer 2003-2007
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
8   * it under the terms of the GNU General Public License as published by   * it under the terms of the GNU General Public License as published by
# Line 36  Line 36 
36  #include <string.h>  #include <string.h>
37  #include "rdesktop.h"  #include "rdesktop.h"
38    
39  BOOL  static RD_BOOL
40  printercache_mkdir(char *base, char *printer)  printercache_mkdir(char *base, char *printer)
41  {  {
42          char *path;          char *path;
# Line 72  printercache_mkdir(char *base, char *pri Line 72  printercache_mkdir(char *base, char *pri
72          return True;          return True;
73  }  }
74    
75  BOOL  static RD_BOOL
76  printercache_unlink_blob(char *printer)  printercache_unlink_blob(char *printer)
77  {  {
78          char *path;          char *path;
# Line 109  printercache_unlink_blob(char *printer) Line 109  printercache_unlink_blob(char *printer)
109  }  }
110    
111    
112  BOOL  static RD_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;
# Line 190  printercache_load_blob(char *printer_nam Line 190  printercache_load_blob(char *printer_nam
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;
# Line 239  printercache_process(STREAM s) Line 239  printercache_process(STREAM s)
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    
248                          rdp_in_unistr(s, printer, printer_length);                          rdp_in_unistr(s, printer, sizeof(printer), printer_length);
249                          rdp_in_unistr(s, driver, driver_length);                          rdp_in_unistr(s, driver, sizeof(driver), driver_length);
250    
251                          printercache_rename_blob(printer, driver);                          printercache_rename_blob(printer, driver);
252                          break;                          break;
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);                          rdp_in_unistr(s, printer, sizeof(printer), printer_unicode_length);
258                          printercache_unlink_blob(printer);                          printercache_unlink_blob(printer);
259                          break;                          break;
260    
# Line 264  printercache_process(STREAM s) Line 264  printercache_process(STREAM s)
264    
265                          if (printer_unicode_length < 2 * 255)                          if (printer_unicode_length < 2 * 255)
266                          {                          {
267                                  rdp_in_unistr(s, printer, printer_unicode_length);                                  rdp_in_unistr(s, printer, sizeof(printer), printer_unicode_length);
268                                  printercache_save_blob(printer, s->p, blob_length);                                  printercache_save_blob(printer, s->p, blob_length);
269                          }                          }
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,

Legend:
Removed from v.611  
changed lines
  Added in v.1426

  ViewVC Help
Powered by ViewVC 1.1.26