printercache.c revision d65680efa46fa49e8bf14e67b29b782510ff934c
/* -*- c-basic-offset: 8 -*-
* rdesktop: A Remote Desktop Protocol client.
* Entrypoint and utility functions
* Copyright (C) Matthew Chapman 1999-2007
* Copyright (C) Jeroen Meijer 2003-2007
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Sun GPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Sun elects to use only
* the General Public License version 2 (GPLv2) at this time for any software where
* a choice of GPL license versions is made available with the language indicating
* that GPLv2 or any later version may be used, or where a choice of which version
* of the GPL is applied is otherwise unspecified.
*/
/* According to the W2K RDP Printer Redirection WhitePaper, a data
* blob is sent to the client after the configuration of the printer
* is changed at the server.
*
* This data blob is saved to the registry. The client returns this
* data blob in a new session with the printer announce data.
* The data is not interpreted by the client.
*/
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include "rdesktop.h"
static RD_BOOL
{
char *path;
{
return False;
}
{
return False;
}
{
return False;
}
return True;
}
static RD_BOOL
printercache_unlink_blob(char *printer)
{
char *path;
char *home;
return False;
return False;
sizeof("/AutoPrinterCacheData") + 1);
{
return False;
}
{
return False;
}
return True;
}
static RD_BOOL
{
char *printer_path;
char *new_printer_path;
int printer_maxlen;
char *home;
return False;
return False;
{
return False;
}
return True;
}
int
{
if (printer_name == NULL)
return 0;
return 0;
sizeof("/AutoPrinterCacheData") + 1);
if (fd == -1)
{
return 0;
}
{
return 0;
}
return length;
}
static void
{
int fd;
if (printer_name == NULL)
return;
return;
return;
sizeof("/AutoPrinterCacheData") + 1);
if (fd == -1)
{
return;
}
{
}
}
void
{
in_uint32_le(s, type);
switch (type)
{
case 4: /* rename item */
in_uint8(s, printer_length);
in_uint8(s, driver_length);
/* NOTE - 'driver' doesn't contain driver, it contains the new printer name */
break;
case 3: /* delete item */
break;
case 2: /* save printer data */
in_uint32_le(s, blob_length);
{
}
break;
case 1: /* save device data */
/* need to fetch this data so that we can get the length of the packet to store. */
/* next is driver in unicode */
/* next is printer in unicode */
/* TODO: figure out how to use this information when reconnecting */
/* actually - all we need to store is the driver and printer */
/* and figure out what the first word is. */
/* rewind stream so that we can save this blob */
/* length is driver_length + printer_length + 19 */
/* rewind stream */
s->p = s->p - 19;
break;
default:
break;
}
}