2 |
|
|
3 |
extern RDPDR_DEVICE g_rdpdr_device[]; |
extern RDPDR_DEVICE g_rdpdr_device[]; |
4 |
|
|
5 |
PRINTER * |
static PRINTER * |
6 |
get_printer_data(HANDLE handle) |
get_printer_data(NTHANDLE handle) |
7 |
{ |
{ |
8 |
int index; |
int index; |
9 |
|
|
16 |
} |
} |
17 |
|
|
18 |
int |
int |
19 |
printer_enum_devices(uint32 *id, char *optarg) |
printer_enum_devices(uint32 * id, char *optarg) |
20 |
{ |
{ |
21 |
PRINTER *pprinter_data; |
PRINTER *pprinter_data; |
22 |
|
|
25 |
int count = 0; |
int count = 0; |
26 |
int already = 0; |
int already = 0; |
27 |
|
|
28 |
// we need to know how many printers we've already set up |
/* we need to know how many printers we've already set up |
29 |
// supplied from other -r flags than this one. |
supplied from other -r flags than this one. */ |
30 |
while (count < *id) |
while (count < *id) |
31 |
{ |
{ |
32 |
if (g_rdpdr_device[count].device_type == DEVICE_TYPE_PRINTER) |
if (g_rdpdr_device[count].device_type == DEVICE_TYPE_PRINTER) |
83 |
|
|
84 |
static NTSTATUS |
static NTSTATUS |
85 |
printer_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition, uint32 flags, |
printer_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition, uint32 flags, |
86 |
char *filename, HANDLE * handle) |
char *filename, NTHANDLE * handle) |
87 |
{ |
{ |
88 |
char cmd[256]; |
char cmd[256]; |
89 |
PRINTER *pprinter_data; |
PRINTER *pprinter_data; |
107 |
} |
} |
108 |
|
|
109 |
static NTSTATUS |
static NTSTATUS |
110 |
printer_close(HANDLE handle) |
printer_close(NTHANDLE handle) |
111 |
{ |
{ |
112 |
PRINTER *pprinter_data; |
int i = get_device_index(handle); |
113 |
|
if (i >= 0) |
114 |
pprinter_data = get_printer_data(handle); |
{ |
115 |
|
PRINTER *pprinter_data = g_rdpdr_device[i].pdevice_data; |
116 |
g_rdpdr_device[get_device_index(handle)].handle = 0; |
if (pprinter_data) |
117 |
|
pclose(pprinter_data->printer_fp); |
118 |
pclose(pprinter_data->printer_fp); |
g_rdpdr_device[i].handle = 0; |
119 |
|
} |
120 |
return STATUS_SUCCESS; |
return STATUS_SUCCESS; |
121 |
} |
} |
122 |
|
|
123 |
static NTSTATUS |
static NTSTATUS |
124 |
printer_write(HANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) |
printer_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) |
125 |
{ |
{ |
126 |
PRINTER *pprinter_data; |
PRINTER *pprinter_data; |
127 |
|
|