2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-2000,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-2000,
6 * Copyright (C) Jean François Micouleau 1998-2000,
7 * Copyright (C) Gerald Carter 2000-2002,
8 * Copyright (C) Tim Potter 2001-2002.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #define DBGC_CLASS DBGC_RPC_PARSE
31 /*******************************************************************
32 This should be moved in a more generic lib.
33 ********************************************************************/
35 BOOL
spoolss_io_system_time(const char *desc
, prs_struct
*ps
, int depth
, SYSTEMTIME
*systime
)
37 if(!prs_uint16("year", ps
, depth
, &systime
->year
))
39 if(!prs_uint16("month", ps
, depth
, &systime
->month
))
41 if(!prs_uint16("dayofweek", ps
, depth
, &systime
->dayofweek
))
43 if(!prs_uint16("day", ps
, depth
, &systime
->day
))
45 if(!prs_uint16("hour", ps
, depth
, &systime
->hour
))
47 if(!prs_uint16("minute", ps
, depth
, &systime
->minute
))
49 if(!prs_uint16("second", ps
, depth
, &systime
->second
))
51 if(!prs_uint16("milliseconds", ps
, depth
, &systime
->milliseconds
))
57 /*******************************************************************
58 ********************************************************************/
60 BOOL
make_systemtime(SYSTEMTIME
*systime
, struct tm
*unixtime
)
62 systime
->year
=unixtime
->tm_year
+1900;
63 systime
->month
=unixtime
->tm_mon
+1;
64 systime
->dayofweek
=unixtime
->tm_wday
;
65 systime
->day
=unixtime
->tm_mday
;
66 systime
->hour
=unixtime
->tm_hour
;
67 systime
->minute
=unixtime
->tm_min
;
68 systime
->second
=unixtime
->tm_sec
;
69 systime
->milliseconds
=0;
74 /*******************************************************************
75 reads or writes an DOC_INFO structure.
76 ********************************************************************/
78 static BOOL
smb_io_doc_info_1(const char *desc
, DOC_INFO_1
*info_1
, prs_struct
*ps
, int depth
)
80 if (info_1
== NULL
) return False
;
82 prs_debug(ps
, depth
, desc
, "smb_io_doc_info_1");
88 if(!prs_uint32("p_docname", ps
, depth
, &info_1
->p_docname
))
90 if(!prs_uint32("p_outputfile", ps
, depth
, &info_1
->p_outputfile
))
92 if(!prs_uint32("p_datatype", ps
, depth
, &info_1
->p_datatype
))
95 if(!smb_io_unistr2("", &info_1
->docname
, info_1
->p_docname
, ps
, depth
))
97 if(!smb_io_unistr2("", &info_1
->outputfile
, info_1
->p_outputfile
, ps
, depth
))
99 if(!smb_io_unistr2("", &info_1
->datatype
, info_1
->p_datatype
, ps
, depth
))
105 /*******************************************************************
106 reads or writes an DOC_INFO structure.
107 ********************************************************************/
109 static BOOL
smb_io_doc_info(const char *desc
, DOC_INFO
*info
, prs_struct
*ps
, int depth
)
111 uint32 useless_ptr
=0;
113 if (info
== NULL
) return False
;
115 prs_debug(ps
, depth
, desc
, "smb_io_doc_info");
121 if(!prs_uint32("switch_value", ps
, depth
, &info
->switch_value
))
124 if(!prs_uint32("doc_info_X ptr", ps
, depth
, &useless_ptr
))
127 switch (info
->switch_value
)
130 if(!smb_io_doc_info_1("",&info
->doc_info_1
, ps
, depth
))
135 this is just a placeholder
137 MSDN July 1998 says doc_info_2 is only on
138 Windows 95, and as Win95 doesn't do RPC to print
139 this case is nearly impossible
141 Maybe one day with Windows for dishwasher 2037 ...
144 /* smb_io_doc_info_2("",&info->doc_info_2, ps, depth); */
147 DEBUG(0,("Something is obviously wrong somewhere !\n"));
154 /*******************************************************************
155 reads or writes an DOC_INFO_CONTAINER structure.
156 ********************************************************************/
158 static BOOL
smb_io_doc_info_container(const char *desc
, DOC_INFO_CONTAINER
*cont
, prs_struct
*ps
, int depth
)
160 if (cont
== NULL
) return False
;
162 prs_debug(ps
, depth
, desc
, "smb_io_doc_info_container");
168 if(!prs_uint32("level", ps
, depth
, &cont
->level
))
171 if(!smb_io_doc_info("",&cont
->docinfo
, ps
, depth
))
177 /*******************************************************************
178 reads or writes an NOTIFY OPTION TYPE structure.
179 ********************************************************************/
181 /* NOTIFY_OPTION_TYPE and NOTIFY_OPTION_TYPE_DATA are really one
182 structure. The _TYPE structure is really the deferred referrants (i.e
183 the notify fields array) of the _TYPE structure. -tpot */
185 static BOOL
smb_io_notify_option_type(const char *desc
, SPOOL_NOTIFY_OPTION_TYPE
*type
, prs_struct
*ps
, int depth
)
187 prs_debug(ps
, depth
, desc
, "smb_io_notify_option_type");
193 if(!prs_uint16("type", ps
, depth
, &type
->type
))
195 if(!prs_uint16("reserved0", ps
, depth
, &type
->reserved0
))
197 if(!prs_uint32("reserved1", ps
, depth
, &type
->reserved1
))
199 if(!prs_uint32("reserved2", ps
, depth
, &type
->reserved2
))
201 if(!prs_uint32("count", ps
, depth
, &type
->count
))
203 if(!prs_uint32("fields_ptr", ps
, depth
, &type
->fields_ptr
))
209 /*******************************************************************
210 reads or writes an NOTIFY OPTION TYPE DATA.
211 ********************************************************************/
213 static BOOL
smb_io_notify_option_type_data(const char *desc
, SPOOL_NOTIFY_OPTION_TYPE
*type
, prs_struct
*ps
, int depth
)
217 prs_debug(ps
, depth
, desc
, "smb_io_notify_option_type_data");
220 /* if there are no fields just return */
221 if (type
->fields_ptr
==0)
227 if(!prs_uint32("count2", ps
, depth
, &type
->count2
))
230 if (type
->count2
!= type
->count
)
231 DEBUG(4,("What a mess, count was %x now is %x !\n", type
->count
, type
->count2
));
233 /* parse the option type data */
234 for(i
=0;i
<type
->count2
;i
++)
235 if(!prs_uint16("fields",ps
,depth
,&type
->fields
[i
]))
240 /*******************************************************************
241 reads or writes an NOTIFY OPTION structure.
242 ********************************************************************/
244 static BOOL
smb_io_notify_option_type_ctr(const char *desc
, SPOOL_NOTIFY_OPTION_TYPE_CTR
*ctr
, prs_struct
*ps
, int depth
)
248 prs_debug(ps
, depth
, desc
, "smb_io_notify_option_type_ctr");
251 if(!prs_uint32("count", ps
, depth
, &ctr
->count
))
255 if (UNMARSHALLING(ps
))
256 if((ctr
->type
=PRS_ALLOC_MEM(ps
,SPOOL_NOTIFY_OPTION_TYPE
,ctr
->count
)) == NULL
)
259 /* the option type struct */
260 for(i
=0;i
<ctr
->count
;i
++)
261 if(!smb_io_notify_option_type("", &ctr
->type
[i
] , ps
, depth
))
264 /* the type associated with the option type struct */
265 for(i
=0;i
<ctr
->count
;i
++)
266 if(!smb_io_notify_option_type_data("", &ctr
->type
[i
] , ps
, depth
))
272 /*******************************************************************
273 reads or writes an NOTIFY OPTION structure.
274 ********************************************************************/
276 static BOOL
smb_io_notify_option(const char *desc
, SPOOL_NOTIFY_OPTION
*option
, prs_struct
*ps
, int depth
)
278 prs_debug(ps
, depth
, desc
, "smb_io_notify_option");
281 if(!prs_uint32("version", ps
, depth
, &option
->version
))
283 if(!prs_uint32("flags", ps
, depth
, &option
->flags
))
285 if(!prs_uint32("count", ps
, depth
, &option
->count
))
287 if(!prs_uint32("option_type_ptr", ps
, depth
, &option
->option_type_ptr
))
290 /* marshalling or unmarshalling, that would work */
291 if (option
->option_type_ptr
!=0) {
292 if(!smb_io_notify_option_type_ctr("", &option
->ctr
,ps
, depth
))
296 option
->ctr
.type
=NULL
;
303 /*******************************************************************
304 reads or writes an NOTIFY INFO DATA structure.
305 ********************************************************************/
307 static BOOL
smb_io_notify_info_data(const char *desc
,SPOOL_NOTIFY_INFO_DATA
*data
, prs_struct
*ps
, int depth
)
309 uint32 useless_ptr
=0x0FF0ADDE;
311 prs_debug(ps
, depth
, desc
, "smb_io_notify_info_data");
316 if(!prs_uint16("type", ps
, depth
, &data
->type
))
318 if(!prs_uint16("field", ps
, depth
, &data
->field
))
321 if(!prs_uint32("how many words", ps
, depth
, &data
->size
))
323 if(!prs_uint32("id", ps
, depth
, &data
->id
))
325 if(!prs_uint32("how many words", ps
, depth
, &data
->size
))
328 switch (data
->enc_type
) {
330 /* One and two value data has two uint32 values */
332 case NOTIFY_ONE_VALUE
:
333 case NOTIFY_TWO_VALUE
:
335 if(!prs_uint32("value[0]", ps
, depth
, &data
->notify_data
.value
[0]))
337 if(!prs_uint32("value[1]", ps
, depth
, &data
->notify_data
.value
[1]))
341 /* Pointers and strings have a string length and a
342 pointer. For a string the length is expressed as
343 the number of uint16 characters plus a trailing
348 if(!prs_uint32("string length", ps
, depth
, &data
->notify_data
.data
.length
))
350 if(!prs_uint32("pointer", ps
, depth
, &useless_ptr
))
357 if(!prs_uint32("string length", ps
, depth
, &data
->notify_data
.data
.length
))
360 if(!prs_uint32("pointer", ps
, depth
, &useless_ptr
))
366 if( !prs_uint32( "sd size", ps
, depth
, &data
->notify_data
.sd
.size
) )
368 if( !prs_uint32( "pointer", ps
, depth
, &useless_ptr
) )
374 DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data\n",
382 /*******************************************************************
383 reads or writes an NOTIFY INFO DATA structure.
384 ********************************************************************/
386 BOOL
smb_io_notify_info_data_strings(const char *desc
,SPOOL_NOTIFY_INFO_DATA
*data
,
387 prs_struct
*ps
, int depth
)
389 prs_debug(ps
, depth
, desc
, "smb_io_notify_info_data_strings");
395 switch(data
->enc_type
) {
397 /* No data for values */
399 case NOTIFY_ONE_VALUE
:
400 case NOTIFY_TWO_VALUE
:
404 /* Strings start with a length in uint16s */
409 data
->notify_data
.data
.length
/= 2;
411 if(!prs_uint32("string length", ps
, depth
, &data
->notify_data
.data
.length
))
414 if (UNMARSHALLING(ps
)) {
415 data
->notify_data
.data
.string
= PRS_ALLOC_MEM(ps
, uint16
,
416 data
->notify_data
.data
.length
);
418 if (!data
->notify_data
.data
.string
)
422 if (!prs_uint16uni(True
, "string", ps
, depth
, data
->notify_data
.data
.string
,
423 data
->notify_data
.data
.length
))
427 data
->notify_data
.data
.length
*= 2;
433 if (UNMARSHALLING(ps
)) {
434 data
->notify_data
.data
.string
= PRS_ALLOC_MEM(ps
, uint16
,
435 data
->notify_data
.data
.length
);
437 if (!data
->notify_data
.data
.string
)
441 if(!prs_uint8s(True
,"buffer",ps
,depth
,(uint8
*)data
->notify_data
.data
.string
,data
->notify_data
.data
.length
))
447 if( !prs_uint32("secdesc size ", ps
, depth
, &data
->notify_data
.sd
.size
) )
449 if ( !sec_io_desc( "sec_desc", &data
->notify_data
.sd
.desc
, ps
, depth
) )
454 DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data_strings\n",
460 if (isvalue
==False
) {
462 /* length of string in unicode include \0 */
463 x
=data
->notify_data
.data
.length
+1;
465 if (data
->field
!= 16)
466 if(!prs_uint32("string length", ps
, depth
, &x
))
469 if (MARSHALLING(ps
)) {
470 /* These are already in little endian format. Don't byte swap. */
473 /* No memory allocated for this string
474 therefore following the data.string
475 pointer is a bad idea. Use a pointer to
476 the uint32 length union member to
477 provide a source for a unicode NULL */
479 if(!prs_uint8s(True
,"string",ps
,depth
, (uint8
*)&data
->notify_data
.data
.length
,x
*2))
483 if (data
->field
== 16)
486 if(!prs_uint16uni(True
,"string",ps
,depth
,data
->notify_data
.data
.string
,x
))
491 /* Tallocate memory for string */
493 data
->notify_data
.data
.string
= PRS_ALLOC_MEM(ps
, uint16
, x
* 2);
494 if (!data
->notify_data
.data
.string
)
497 if(!prs_uint16uni(True
,"string",ps
,depth
,data
->notify_data
.data
.string
,x
))
505 /* Win2k does not seem to put this parse align here */
513 /*******************************************************************
514 reads or writes an NOTIFY INFO structure.
515 ********************************************************************/
517 static BOOL
smb_io_notify_info(const char *desc
, SPOOL_NOTIFY_INFO
*info
, prs_struct
*ps
, int depth
)
521 prs_debug(ps
, depth
, desc
, "smb_io_notify_info");
527 if(!prs_uint32("count", ps
, depth
, &info
->count
))
529 if(!prs_uint32("version", ps
, depth
, &info
->version
))
531 if(!prs_uint32("flags", ps
, depth
, &info
->flags
))
533 if(!prs_uint32("count", ps
, depth
, &info
->count
))
536 for (i
=0;i
<info
->count
;i
++) {
537 if(!smb_io_notify_info_data(desc
, &info
->data
[i
], ps
, depth
))
541 /* now do the strings at the end of the stream */
542 for (i
=0;i
<info
->count
;i
++) {
543 if(!smb_io_notify_info_data_strings(desc
, &info
->data
[i
], ps
, depth
))
550 /*******************************************************************
551 ********************************************************************/
553 BOOL
spool_io_user_level_1( const char *desc
, prs_struct
*ps
, int depth
, SPOOL_USER_1
*q_u
)
555 prs_debug(ps
, depth
, desc
, "");
561 if (!prs_uint32("size", ps
, depth
, &q_u
->size
))
564 if (!prs_io_unistr2_p("", ps
, depth
, &q_u
->client_name
))
566 if (!prs_io_unistr2_p("", ps
, depth
, &q_u
->user_name
))
569 if (!prs_uint32("build", ps
, depth
, &q_u
->build
))
571 if (!prs_uint32("major", ps
, depth
, &q_u
->major
))
573 if (!prs_uint32("minor", ps
, depth
, &q_u
->minor
))
575 if (!prs_uint32("processor", ps
, depth
, &q_u
->processor
))
578 if (!prs_io_unistr2("", ps
, depth
, q_u
->client_name
))
583 if (!prs_io_unistr2("", ps
, depth
, q_u
->user_name
))
589 /*******************************************************************
590 ********************************************************************/
592 static BOOL
spool_io_user_level(const char *desc
, SPOOL_USER_CTR
*q_u
, prs_struct
*ps
, int depth
)
597 prs_debug(ps
, depth
, desc
, "spool_io_user_level");
603 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
606 switch ( q_u
->level
)
609 if ( !prs_pointer( "" , ps
, depth
, (void**)&q_u
->user
.user1
,
610 sizeof(SPOOL_USER_1
), (PRS_POINTER_CAST
)spool_io_user_level_1
))
622 /*******************************************************************
623 * read or write a DEVICEMODE struct.
624 * on reading allocate memory for the private member
625 ********************************************************************/
627 #define DM_NUM_OPTIONAL_FIELDS 8
629 BOOL
spoolss_io_devmode(const char *desc
, prs_struct
*ps
, int depth
, DEVICEMODE
*devmode
)
631 int available_space
; /* size of the device mode left to parse */
632 /* only important on unmarshalling */
635 struct optional_fields
{
638 } opt_fields
[DM_NUM_OPTIONAL_FIELDS
] = {
639 { "icmmethod", NULL
},
640 { "icmintent", NULL
},
641 { "mediatype", NULL
},
642 { "dithertype", NULL
},
643 { "reserved1", NULL
},
644 { "reserved2", NULL
},
645 { "panningwidth", NULL
},
646 { "panningheight", NULL
}
649 /* assign at run time to keep non-gcc compilers happy */
651 opt_fields
[0].field
= &devmode
->icmmethod
;
652 opt_fields
[1].field
= &devmode
->icmintent
;
653 opt_fields
[2].field
= &devmode
->mediatype
;
654 opt_fields
[3].field
= &devmode
->dithertype
;
655 opt_fields
[4].field
= &devmode
->reserved1
;
656 opt_fields
[5].field
= &devmode
->reserved2
;
657 opt_fields
[6].field
= &devmode
->panningwidth
;
658 opt_fields
[7].field
= &devmode
->panningheight
;
661 prs_debug(ps
, depth
, desc
, "spoolss_io_devmode");
664 if (UNMARSHALLING(ps
)) {
665 devmode
->devicename
.buffer
= PRS_ALLOC_MEM(ps
, uint16
, 32);
666 if (devmode
->devicename
.buffer
== NULL
)
670 if (!prs_uint16uni(True
,"devicename", ps
, depth
, devmode
->devicename
.buffer
, MAXDEVICENAME
))
673 if (!prs_uint16("specversion", ps
, depth
, &devmode
->specversion
))
676 if (!prs_uint16("driverversion", ps
, depth
, &devmode
->driverversion
))
678 if (!prs_uint16("size", ps
, depth
, &devmode
->size
))
680 if (!prs_uint16("driverextra", ps
, depth
, &devmode
->driverextra
))
682 if (!prs_uint32("fields", ps
, depth
, &devmode
->fields
))
684 if (!prs_uint16("orientation", ps
, depth
, &devmode
->orientation
))
686 if (!prs_uint16("papersize", ps
, depth
, &devmode
->papersize
))
688 if (!prs_uint16("paperlength", ps
, depth
, &devmode
->paperlength
))
690 if (!prs_uint16("paperwidth", ps
, depth
, &devmode
->paperwidth
))
692 if (!prs_uint16("scale", ps
, depth
, &devmode
->scale
))
694 if (!prs_uint16("copies", ps
, depth
, &devmode
->copies
))
696 if (!prs_uint16("defaultsource", ps
, depth
, &devmode
->defaultsource
))
698 if (!prs_uint16("printquality", ps
, depth
, &devmode
->printquality
))
700 if (!prs_uint16("color", ps
, depth
, &devmode
->color
))
702 if (!prs_uint16("duplex", ps
, depth
, &devmode
->duplex
))
704 if (!prs_uint16("yresolution", ps
, depth
, &devmode
->yresolution
))
706 if (!prs_uint16("ttoption", ps
, depth
, &devmode
->ttoption
))
708 if (!prs_uint16("collate", ps
, depth
, &devmode
->collate
))
711 if (UNMARSHALLING(ps
)) {
712 devmode
->formname
.buffer
= PRS_ALLOC_MEM(ps
, uint16
, 32);
713 if (devmode
->formname
.buffer
== NULL
)
717 if (!prs_uint16uni(True
, "formname", ps
, depth
, devmode
->formname
.buffer
, 32))
719 if (!prs_uint16("logpixels", ps
, depth
, &devmode
->logpixels
))
721 if (!prs_uint32("bitsperpel", ps
, depth
, &devmode
->bitsperpel
))
723 if (!prs_uint32("pelswidth", ps
, depth
, &devmode
->pelswidth
))
725 if (!prs_uint32("pelsheight", ps
, depth
, &devmode
->pelsheight
))
727 if (!prs_uint32("displayflags", ps
, depth
, &devmode
->displayflags
))
729 if (!prs_uint32("displayfrequency", ps
, depth
, &devmode
->displayfrequency
))
732 * every device mode I've ever seen on the wire at least has up
733 * to the displayfrequency field. --jerry (05-09-2002)
736 /* add uint32's + uint16's + two UNICODE strings */
738 available_space
= devmode
->size
- (sizeof(uint32
)*6 + sizeof(uint16
)*18 + sizeof(uint16
)*64);
740 /* Sanity check - we only have uint32's left tp parse */
742 if ( available_space
&& ((available_space
% sizeof(uint32
)) != 0) ) {
743 DEBUG(0,("spoolss_io_devmode: available_space [%d] no in multiple of 4 bytes (size = %d)!\n",
744 available_space
, devmode
->size
));
745 DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
750 * Conditional parsing. Assume that the DeviceMode has been
751 * zero'd by the caller.
754 while ((available_space
> 0) && (i
< DM_NUM_OPTIONAL_FIELDS
))
756 DEBUG(11, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space
));
757 if (!prs_uint32(opt_fields
[i
].name
, ps
, depth
, opt_fields
[i
].field
))
759 available_space
-= sizeof(uint32
);
763 /* Sanity Check - we should no available space at this point unless
764 MS changes the device mode structure */
766 if (available_space
) {
767 DEBUG(0,("spoolss_io_devmode: I've parsed all I know and there is still stuff left|\n"));
768 DEBUG(0,("spoolss_io_devmode: available_space = [%d], devmode_size = [%d]!\n",
769 available_space
, devmode
->size
));
770 DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
775 if (devmode
->driverextra
!=0) {
776 if (UNMARSHALLING(ps
)) {
777 devmode
->dev_private
=PRS_ALLOC_MEM(ps
, uint8
, devmode
->driverextra
);
778 if(devmode
->dev_private
== NULL
)
780 DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for dev_private\n",devmode
->driverextra
));
783 DEBUG(7,("spoolss_io_devmode: parsing [%d] bytes of dev_private\n",devmode
->driverextra
));
784 if (!prs_uint8s(False
, "dev_private", ps
, depth
,
785 devmode
->dev_private
, devmode
->driverextra
))
792 /*******************************************************************
793 Read or write a DEVICEMODE container
794 ********************************************************************/
796 static BOOL
spoolss_io_devmode_cont(const char *desc
, DEVMODE_CTR
*dm_c
, prs_struct
*ps
, int depth
)
801 prs_debug(ps
, depth
, desc
, "spoolss_io_devmode_cont");
807 if (!prs_uint32("size", ps
, depth
, &dm_c
->size
))
810 if (!prs_uint32("devmode_ptr", ps
, depth
, &dm_c
->devmode_ptr
))
813 if (dm_c
->size
==0 || dm_c
->devmode_ptr
==0) {
814 if (UNMARSHALLING(ps
))
815 /* if while reading there is no DEVMODE ... */
820 /* so we have a DEVICEMODE to follow */
821 if (UNMARSHALLING(ps
)) {
822 DEBUG(9,("Allocating memory for spoolss_io_devmode\n"));
823 dm_c
->devmode
=PRS_ALLOC_MEM(ps
,DEVICEMODE
,1);
824 if(dm_c
->devmode
== NULL
)
828 /* this is bad code, shouldn't be there */
829 if (!prs_uint32("size", ps
, depth
, &dm_c
->size
))
832 if (!spoolss_io_devmode(desc
, ps
, depth
, dm_c
->devmode
))
838 /*******************************************************************
839 ********************************************************************/
841 static BOOL
spoolss_io_printer_default(const char *desc
, PRINTER_DEFAULT
*pd
, prs_struct
*ps
, int depth
)
846 prs_debug(ps
, depth
, desc
, "spoolss_io_printer_default");
849 if (!prs_uint32("datatype_ptr", ps
, depth
, &pd
->datatype_ptr
))
852 if (!smb_io_unistr2("datatype", &pd
->datatype
, pd
->datatype_ptr
, ps
,depth
))
858 if (!spoolss_io_devmode_cont("", &pd
->devmode_cont
, ps
, depth
))
864 if (!prs_uint32("access_required", ps
, depth
, &pd
->access_required
))
870 /*******************************************************************
872 ********************************************************************/
874 BOOL
make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX
*q_u
,
875 const fstring printername
,
876 const fstring datatype
,
877 uint32 access_required
,
878 const fstring clientname
,
879 const fstring user_name
)
881 DEBUG(5,("make_spoolss_q_open_printer_ex\n"));
883 q_u
->printername
= TALLOC_P( get_talloc_ctx(), UNISTR2
);
884 init_unistr2(q_u
->printername
, printername
, UNI_STR_TERMINATE
);
886 q_u
->printer_default
.datatype_ptr
= 0;
888 q_u
->printer_default
.devmode_cont
.size
=0;
889 q_u
->printer_default
.devmode_cont
.devmode_ptr
=0;
890 q_u
->printer_default
.devmode_cont
.devmode
=NULL
;
891 q_u
->printer_default
.access_required
=access_required
;
893 q_u
->user_switch
= 1;
895 q_u
->user_ctr
.level
= 1;
896 q_u
->user_ctr
.user
.user1
= TALLOC_P( get_talloc_ctx(), SPOOL_USER_1
);
897 q_u
->user_ctr
.user
.user1
->size
= strlen(clientname
) + strlen(user_name
) + 10;
898 q_u
->user_ctr
.user
.user1
->build
= 1381;
899 q_u
->user_ctr
.user
.user1
->major
= 2;
900 q_u
->user_ctr
.user
.user1
->minor
= 0;
901 q_u
->user_ctr
.user
.user1
->processor
= 0;
903 q_u
->user_ctr
.user
.user1
->client_name
= TALLOC_P( get_talloc_ctx(), UNISTR2
);
904 q_u
->user_ctr
.user
.user1
->user_name
= TALLOC_P( get_talloc_ctx(), UNISTR2
);
906 init_unistr2(q_u
->user_ctr
.user
.user1
->client_name
, clientname
, UNI_STR_TERMINATE
);
907 init_unistr2(q_u
->user_ctr
.user
.user1
->user_name
, user_name
, UNI_STR_TERMINATE
);
912 /*******************************************************************
914 ********************************************************************/
916 BOOL
make_spoolss_q_addprinterex( TALLOC_CTX
*mem_ctx
, SPOOL_Q_ADDPRINTEREX
*q_u
,
917 const char *srv_name
, const char* clientname
, const char* user_name
,
918 uint32 level
, PRINTER_INFO_CTR
*ctr
)
920 DEBUG(5,("make_spoolss_q_addprinterex\n"));
927 q_u
->server_name
= TALLOC_P( mem_ctx
, UNISTR2
);
928 init_unistr2(q_u
->server_name
, srv_name
, UNI_FLAGS_NONE
);
932 q_u
->info
.level
= level
;
933 q_u
->info
.info_ptr
= (ctr
->printers_2
!=NULL
)?1:0;
936 /* init q_u->info.info2 from *info */
937 if (!make_spoolss_printer_info_2(mem_ctx
, &q_u
->info
.info_2
, ctr
->printers_2
)) {
938 DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n"));
948 q_u
->user_ctr
.level
= 1;
949 q_u
->user_ctr
.user
.user1
= TALLOC_P( get_talloc_ctx(), SPOOL_USER_1
);
950 q_u
->user_ctr
.user
.user1
->build
= 1381;
951 q_u
->user_ctr
.user
.user1
->major
= 2;
952 q_u
->user_ctr
.user
.user1
->minor
= 0;
953 q_u
->user_ctr
.user
.user1
->processor
= 0;
955 q_u
->user_ctr
.user
.user1
->client_name
= TALLOC_P( mem_ctx
, UNISTR2
);
956 q_u
->user_ctr
.user
.user1
->user_name
= TALLOC_P( mem_ctx
, UNISTR2
);
958 init_unistr2(q_u
->user_ctr
.user
.user1
->client_name
, clientname
, UNI_STR_TERMINATE
);
959 init_unistr2(q_u
->user_ctr
.user
.user1
->user_name
, user_name
, UNI_STR_TERMINATE
);
961 q_u
->user_ctr
.user
.user1
->size
= q_u
->user_ctr
.user
.user1
->user_name
->uni_str_len
+
962 q_u
->user_ctr
.user
.user1
->client_name
->uni_str_len
+ 2;
967 /*******************************************************************
968 create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct
969 *******************************************************************/
971 BOOL
make_spoolss_printer_info_2(TALLOC_CTX
*mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_2
**spool_info2
,
972 PRINTER_INFO_2
*info
)
975 SPOOL_PRINTER_INFO_LEVEL_2
*inf
;
977 /* allocate the necessary memory */
978 if (!(inf
=TALLOC_P(mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_2
))) {
979 DEBUG(0,("make_spoolss_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n"));
983 inf
->servername_ptr
= (info
->servername
.buffer
!=NULL
)?1:0;
984 inf
->printername_ptr
= (info
->printername
.buffer
!=NULL
)?1:0;
985 inf
->sharename_ptr
= (info
->sharename
.buffer
!=NULL
)?1:0;
986 inf
->portname_ptr
= (info
->portname
.buffer
!=NULL
)?1:0;
987 inf
->drivername_ptr
= (info
->drivername
.buffer
!=NULL
)?1:0;
988 inf
->comment_ptr
= (info
->comment
.buffer
!=NULL
)?1:0;
989 inf
->location_ptr
= (info
->location
.buffer
!=NULL
)?1:0;
990 inf
->devmode_ptr
= (info
->devmode
!=NULL
)?1:0;
991 inf
->sepfile_ptr
= (info
->sepfile
.buffer
!=NULL
)?1:0;
992 inf
->printprocessor_ptr
= (info
->printprocessor
.buffer
!=NULL
)?1:0;
993 inf
->datatype_ptr
= (info
->datatype
.buffer
!=NULL
)?1:0;
994 inf
->parameters_ptr
= (info
->parameters
.buffer
!=NULL
)?1:0;
995 inf
->secdesc_ptr
= (info
->secdesc
!=NULL
)?1:0;
996 inf
->attributes
= info
->attributes
;
997 inf
->priority
= info
->priority
;
998 inf
->default_priority
= info
->defaultpriority
;
999 inf
->starttime
= info
->starttime
;
1000 inf
->untiltime
= info
->untiltime
;
1001 inf
->cjobs
= info
->cjobs
;
1002 inf
->averageppm
= info
->averageppm
;
1003 init_unistr2_from_unistr(&inf
->servername
, &info
->servername
);
1004 init_unistr2_from_unistr(&inf
->printername
, &info
->printername
);
1005 init_unistr2_from_unistr(&inf
->sharename
, &info
->sharename
);
1006 init_unistr2_from_unistr(&inf
->portname
, &info
->portname
);
1007 init_unistr2_from_unistr(&inf
->drivername
, &info
->drivername
);
1008 init_unistr2_from_unistr(&inf
->comment
, &info
->comment
);
1009 init_unistr2_from_unistr(&inf
->location
, &info
->location
);
1010 init_unistr2_from_unistr(&inf
->sepfile
, &info
->sepfile
);
1011 init_unistr2_from_unistr(&inf
->printprocessor
, &info
->printprocessor
);
1012 init_unistr2_from_unistr(&inf
->datatype
, &info
->datatype
);
1013 init_unistr2_from_unistr(&inf
->parameters
, &info
->parameters
);
1014 init_unistr2_from_unistr(&inf
->datatype
, &info
->datatype
);
1021 /*******************************************************************
1022 create a SPOOL_PRINTER_INFO_3 struct from a PRINTER_INFO_3 struct
1023 *******************************************************************/
1025 BOOL
make_spoolss_printer_info_3(TALLOC_CTX
*mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_3
**spool_info3
,
1026 PRINTER_INFO_3
*info
)
1029 SPOOL_PRINTER_INFO_LEVEL_3
*inf
;
1031 /* allocate the necessary memory */
1032 if (!(inf
=TALLOC_P(mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_3
))) {
1033 DEBUG(0,("make_spoolss_printer_info_3: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_3 sruct!\n"));
1037 inf
->secdesc_ptr
= (info
->secdesc
!=NULL
)?1:0;
1044 /*******************************************************************
1045 create a SPOOL_PRINTER_INFO_7 struct from a PRINTER_INFO_7 struct
1046 *******************************************************************/
1048 BOOL
make_spoolss_printer_info_7(TALLOC_CTX
*mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_7
**spool_info7
,
1049 PRINTER_INFO_7
*info
)
1052 SPOOL_PRINTER_INFO_LEVEL_7
*inf
;
1054 /* allocate the necessary memory */
1055 if (!(inf
=TALLOC_P(mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_7
))) {
1056 DEBUG(0,("make_spoolss_printer_info_7: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_7 struct!\n"));
1060 inf
->guid_ptr
= (info
->guid
.buffer
!=NULL
)?1:0;
1061 inf
->action
= info
->action
;
1062 init_unistr2_from_unistr(&inf
->guid
, &info
->guid
);
1070 /*******************************************************************
1072 * called from spoolss_q_open_printer_ex (srv_spoolss.c)
1073 ********************************************************************/
1075 BOOL
spoolss_io_q_open_printer(const char *desc
, SPOOL_Q_OPEN_PRINTER
*q_u
, prs_struct
*ps
, int depth
)
1080 prs_debug(ps
, depth
, desc
, "spoolss_io_q_open_printer");
1086 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->printername
))
1088 if (!prs_io_unistr2("printername", ps
, depth
, q_u
->printername
))
1094 if (!spoolss_io_printer_default("", &q_u
->printer_default
, ps
, depth
))
1100 /*******************************************************************
1101 * write a structure.
1102 * called from static spoolss_r_open_printer_ex (srv_spoolss.c)
1103 * called from spoolss_open_printer_ex (cli_spoolss.c)
1104 ********************************************************************/
1106 BOOL
spoolss_io_r_open_printer(const char *desc
, SPOOL_R_OPEN_PRINTER
*r_u
, prs_struct
*ps
, int depth
)
1108 if (r_u
== NULL
) return False
;
1110 prs_debug(ps
, depth
, desc
, "spoolss_io_r_open_printer");
1116 if (!smb_io_pol_hnd("printer handle",&(r_u
->handle
),ps
,depth
))
1119 if (!prs_werror("status code", ps
, depth
, &(r_u
->status
)))
1126 /*******************************************************************
1128 * called from spoolss_q_open_printer_ex (srv_spoolss.c)
1129 ********************************************************************/
1131 BOOL
spoolss_io_q_open_printer_ex(const char *desc
, SPOOL_Q_OPEN_PRINTER_EX
*q_u
, prs_struct
*ps
, int depth
)
1136 prs_debug(ps
, depth
, desc
, "spoolss_io_q_open_printer_ex");
1142 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->printername
))
1144 if (!prs_io_unistr2("printername", ps
, depth
, q_u
->printername
))
1150 if (!spoolss_io_printer_default("", &q_u
->printer_default
, ps
, depth
))
1153 if (!prs_uint32("user_switch", ps
, depth
, &q_u
->user_switch
))
1155 if (!spool_io_user_level("", &q_u
->user_ctr
, ps
, depth
))
1161 /*******************************************************************
1162 * write a structure.
1163 * called from static spoolss_r_open_printer_ex (srv_spoolss.c)
1164 * called from spoolss_open_printer_ex (cli_spoolss.c)
1165 ********************************************************************/
1167 BOOL
spoolss_io_r_open_printer_ex(const char *desc
, SPOOL_R_OPEN_PRINTER_EX
*r_u
, prs_struct
*ps
, int depth
)
1169 if (r_u
== NULL
) return False
;
1171 prs_debug(ps
, depth
, desc
, "spoolss_io_r_open_printer_ex");
1177 if (!smb_io_pol_hnd("printer handle",&(r_u
->handle
),ps
,depth
))
1180 if (!prs_werror("status code", ps
, depth
, &(r_u
->status
)))
1186 /*******************************************************************
1188 ********************************************************************/
1189 BOOL
make_spoolss_q_deleteprinterdriverex( TALLOC_CTX
*mem_ctx
,
1190 SPOOL_Q_DELETEPRINTERDRIVEREX
*q_u
,
1196 DEBUG(5,("make_spoolss_q_deleteprinterdriverex\n"));
1198 q_u
->server_ptr
= (server
!=NULL
)?1:0;
1199 q_u
->delete_flags
= DPD_DELETE_UNUSED_FILES
;
1201 /* these must be NULL terminated or else NT4 will
1202 complain about invalid parameters --jerry */
1203 init_unistr2(&q_u
->server
, server
, UNI_STR_TERMINATE
);
1204 init_unistr2(&q_u
->arch
, arch
, UNI_STR_TERMINATE
);
1205 init_unistr2(&q_u
->driver
, driver
, UNI_STR_TERMINATE
);
1208 q_u
->delete_flags
|= DPD_DELETE_SPECIFIC_VERSION
;
1209 q_u
->version
= version
;
1216 /*******************************************************************
1218 ********************************************************************/
1219 BOOL
make_spoolss_q_deleteprinterdriver(
1220 TALLOC_CTX
*mem_ctx
,
1221 SPOOL_Q_DELETEPRINTERDRIVER
*q_u
,
1227 DEBUG(5,("make_spoolss_q_deleteprinterdriver\n"));
1229 q_u
->server_ptr
= (server
!=NULL
)?1:0;
1231 /* these must be NULL terminated or else NT4 will
1232 complain about invalid parameters --jerry */
1233 init_unistr2(&q_u
->server
, server
, UNI_STR_TERMINATE
);
1234 init_unistr2(&q_u
->arch
, arch
, UNI_STR_TERMINATE
);
1235 init_unistr2(&q_u
->driver
, driver
, UNI_STR_TERMINATE
);
1240 /*******************************************************************
1242 ********************************************************************/
1244 BOOL
make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA
*q_u
,
1245 const POLICY_HND
*handle
,
1246 const char *valuename
, uint32 size
)
1248 if (q_u
== NULL
) return False
;
1250 DEBUG(5,("make_spoolss_q_getprinterdata\n"));
1252 q_u
->handle
= *handle
;
1253 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
1259 /*******************************************************************
1261 ********************************************************************/
1263 BOOL
make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX
*q_u
,
1264 const POLICY_HND
*handle
,
1265 const char *keyname
,
1266 const char *valuename
, uint32 size
)
1268 if (q_u
== NULL
) return False
;
1270 DEBUG(5,("make_spoolss_q_getprinterdataex\n"));
1272 q_u
->handle
= *handle
;
1273 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
1274 init_unistr2(&q_u
->keyname
, keyname
, UNI_STR_TERMINATE
);
1280 /*******************************************************************
1282 * called from spoolss_q_getprinterdata (srv_spoolss.c)
1283 ********************************************************************/
1285 BOOL
spoolss_io_q_getprinterdata(const char *desc
, SPOOL_Q_GETPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
1290 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdata");
1295 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1299 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
1303 if (!prs_uint32("size", ps
, depth
, &q_u
->size
))
1309 /*******************************************************************
1311 * called from spoolss_q_deleteprinterdata (srv_spoolss.c)
1312 ********************************************************************/
1314 BOOL
spoolss_io_q_deleteprinterdata(const char *desc
, SPOOL_Q_DELETEPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
1319 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdata");
1324 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1328 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
1334 /*******************************************************************
1335 * write a structure.
1336 * called from spoolss_r_deleteprinterdata (srv_spoolss.c)
1337 ********************************************************************/
1339 BOOL
spoolss_io_r_deleteprinterdata(const char *desc
, SPOOL_R_DELETEPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
1341 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdata");
1343 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1349 /*******************************************************************
1351 * called from spoolss_q_deleteprinterdataex (srv_spoolss.c)
1352 ********************************************************************/
1354 BOOL
spoolss_io_q_deleteprinterdataex(const char *desc
, SPOOL_Q_DELETEPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
1359 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdataex");
1364 if (!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
1367 if (!smb_io_unistr2("keyname ", &q_u
->keyname
, True
, ps
, depth
))
1369 if (!smb_io_unistr2("valuename", &q_u
->valuename
, True
, ps
, depth
))
1375 /*******************************************************************
1376 * write a structure.
1377 * called from spoolss_r_deleteprinterdataex (srv_spoolss.c)
1378 ********************************************************************/
1380 BOOL
spoolss_io_r_deleteprinterdataex(const char *desc
, SPOOL_R_DELETEPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
1382 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdataex");
1385 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1391 /*******************************************************************
1392 * write a structure.
1393 * called from spoolss_r_getprinterdata (srv_spoolss.c)
1394 ********************************************************************/
1396 BOOL
spoolss_io_r_getprinterdata(const char *desc
, SPOOL_R_GETPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
1401 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdata");
1406 if (!prs_uint32("type", ps
, depth
, &r_u
->type
))
1408 if (!prs_uint32("size", ps
, depth
, &r_u
->size
))
1411 if (UNMARSHALLING(ps
) && r_u
->size
) {
1412 r_u
->data
= PRS_ALLOC_MEM(ps
, unsigned char, r_u
->size
);
1417 if (!prs_uint8s( False
, "data", ps
, depth
, r_u
->data
, r_u
->size
))
1423 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
1425 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1431 /*******************************************************************
1433 ********************************************************************/
1435 BOOL
make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER
*q_u
, POLICY_HND
*hnd
)
1437 if (q_u
== NULL
) return False
;
1439 DEBUG(5,("make_spoolss_q_closeprinter\n"));
1441 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
1446 /*******************************************************************
1448 * called from static spoolss_q_abortprinter (srv_spoolss.c)
1449 * called from spoolss_abortprinter (cli_spoolss.c)
1450 ********************************************************************/
1452 BOOL
spoolss_io_q_abortprinter(const char *desc
, SPOOL_Q_ABORTPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1454 if (q_u
== NULL
) return False
;
1456 prs_debug(ps
, depth
, desc
, "spoolss_io_q_abortprinter");
1462 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1468 /*******************************************************************
1469 * write a structure.
1470 * called from spoolss_r_abortprinter (srv_spoolss.c)
1471 ********************************************************************/
1473 BOOL
spoolss_io_r_abortprinter(const char *desc
, SPOOL_R_ABORTPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1475 prs_debug(ps
, depth
, desc
, "spoolss_io_r_abortprinter");
1477 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1483 /*******************************************************************
1485 * called from static spoolss_q_deleteprinter (srv_spoolss.c)
1486 * called from spoolss_deleteprinter (cli_spoolss.c)
1487 ********************************************************************/
1489 BOOL
spoolss_io_q_deleteprinter(const char *desc
, SPOOL_Q_DELETEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1491 if (q_u
== NULL
) return False
;
1493 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinter");
1499 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1505 /*******************************************************************
1506 * write a structure.
1507 * called from static spoolss_r_deleteprinter (srv_spoolss.c)
1508 * called from spoolss_deleteprinter (cli_spoolss.c)
1509 ********************************************************************/
1511 BOOL
spoolss_io_r_deleteprinter(const char *desc
, SPOOL_R_DELETEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1513 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinter");
1519 if (!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
1521 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1528 /*******************************************************************
1530 * called from api_spoolss_deleteprinterdriver (srv_spoolss.c)
1531 * called from spoolss_deleteprinterdriver (cli_spoolss.c)
1532 ********************************************************************/
1534 BOOL
spoolss_io_q_deleteprinterdriver(const char *desc
, SPOOL_Q_DELETEPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
1536 if (q_u
== NULL
) return False
;
1538 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdriver");
1544 if(!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
1546 if(!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
1548 if(!smb_io_unistr2("arch", &q_u
->arch
, True
, ps
, depth
))
1550 if(!smb_io_unistr2("driver", &q_u
->driver
, True
, ps
, depth
))
1558 /*******************************************************************
1559 * write a structure.
1560 ********************************************************************/
1561 BOOL
spoolss_io_r_deleteprinterdriver(const char *desc
, SPOOL_R_DELETEPRINTERDRIVER
*r_u
, prs_struct
*ps
, int depth
)
1563 if (r_u
== NULL
) return False
;
1565 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdriver");
1571 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1578 /*******************************************************************
1580 * called from api_spoolss_deleteprinterdriver (srv_spoolss.c)
1581 * called from spoolss_deleteprinterdriver (cli_spoolss.c)
1582 ********************************************************************/
1584 BOOL
spoolss_io_q_deleteprinterdriverex(const char *desc
, SPOOL_Q_DELETEPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
1586 if (q_u
== NULL
) return False
;
1588 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdriverex");
1594 if(!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
1596 if(!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
1598 if(!smb_io_unistr2("arch", &q_u
->arch
, True
, ps
, depth
))
1600 if(!smb_io_unistr2("driver", &q_u
->driver
, True
, ps
, depth
))
1606 if(!prs_uint32("delete_flags ", ps
, depth
, &q_u
->delete_flags
))
1608 if(!prs_uint32("version ", ps
, depth
, &q_u
->version
))
1616 /*******************************************************************
1617 * write a structure.
1618 ********************************************************************/
1619 BOOL
spoolss_io_r_deleteprinterdriverex(const char *desc
, SPOOL_R_DELETEPRINTERDRIVEREX
*r_u
, prs_struct
*ps
, int depth
)
1621 if (r_u
== NULL
) return False
;
1623 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdriverex");
1629 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1637 /*******************************************************************
1639 * called from static spoolss_q_closeprinter (srv_spoolss.c)
1640 * called from spoolss_closeprinter (cli_spoolss.c)
1641 ********************************************************************/
1643 BOOL
spoolss_io_q_closeprinter(const char *desc
, SPOOL_Q_CLOSEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1645 if (q_u
== NULL
) return False
;
1647 prs_debug(ps
, depth
, desc
, "spoolss_io_q_closeprinter");
1653 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1659 /*******************************************************************
1660 * write a structure.
1661 * called from static spoolss_r_closeprinter (srv_spoolss.c)
1662 * called from spoolss_closeprinter (cli_spoolss.c)
1663 ********************************************************************/
1665 BOOL
spoolss_io_r_closeprinter(const char *desc
, SPOOL_R_CLOSEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1667 prs_debug(ps
, depth
, desc
, "spoolss_io_r_closeprinter");
1673 if (!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
1675 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1681 /*******************************************************************
1683 * called from spoolss_q_startdocprinter (srv_spoolss.c)
1684 ********************************************************************/
1686 BOOL
spoolss_io_q_startdocprinter(const char *desc
, SPOOL_Q_STARTDOCPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1688 if (q_u
== NULL
) return False
;
1690 prs_debug(ps
, depth
, desc
, "spoolss_io_q_startdocprinter");
1696 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1699 if(!smb_io_doc_info_container("",&q_u
->doc_info_container
, ps
, depth
))
1705 /*******************************************************************
1706 * write a structure.
1707 * called from spoolss_r_startdocprinter (srv_spoolss.c)
1708 ********************************************************************/
1710 BOOL
spoolss_io_r_startdocprinter(const char *desc
, SPOOL_R_STARTDOCPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1712 prs_debug(ps
, depth
, desc
, "spoolss_io_r_startdocprinter");
1714 if(!prs_uint32("jobid", ps
, depth
, &r_u
->jobid
))
1716 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1722 /*******************************************************************
1724 * called from spoolss_q_enddocprinter (srv_spoolss.c)
1725 ********************************************************************/
1727 BOOL
spoolss_io_q_enddocprinter(const char *desc
, SPOOL_Q_ENDDOCPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1729 if (q_u
== NULL
) return False
;
1731 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enddocprinter");
1737 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1743 /*******************************************************************
1744 * write a structure.
1745 * called from spoolss_r_enddocprinter (srv_spoolss.c)
1746 ********************************************************************/
1748 BOOL
spoolss_io_r_enddocprinter(const char *desc
, SPOOL_R_ENDDOCPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1750 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enddocprinter");
1752 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1758 /*******************************************************************
1760 * called from spoolss_q_startpageprinter (srv_spoolss.c)
1761 ********************************************************************/
1763 BOOL
spoolss_io_q_startpageprinter(const char *desc
, SPOOL_Q_STARTPAGEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1765 if (q_u
== NULL
) return False
;
1767 prs_debug(ps
, depth
, desc
, "spoolss_io_q_startpageprinter");
1773 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1779 /*******************************************************************
1780 * write a structure.
1781 * called from spoolss_r_startpageprinter (srv_spoolss.c)
1782 ********************************************************************/
1784 BOOL
spoolss_io_r_startpageprinter(const char *desc
, SPOOL_R_STARTPAGEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1786 prs_debug(ps
, depth
, desc
, "spoolss_io_r_startpageprinter");
1788 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1794 /*******************************************************************
1796 * called from spoolss_q_endpageprinter (srv_spoolss.c)
1797 ********************************************************************/
1799 BOOL
spoolss_io_q_endpageprinter(const char *desc
, SPOOL_Q_ENDPAGEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1801 if (q_u
== NULL
) return False
;
1803 prs_debug(ps
, depth
, desc
, "spoolss_io_q_endpageprinter");
1809 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1815 /*******************************************************************
1816 * write a structure.
1817 * called from spoolss_r_endpageprinter (srv_spoolss.c)
1818 ********************************************************************/
1820 BOOL
spoolss_io_r_endpageprinter(const char *desc
, SPOOL_R_ENDPAGEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1822 prs_debug(ps
, depth
, desc
, "spoolss_io_r_endpageprinter");
1824 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1830 /*******************************************************************
1832 * called from spoolss_q_writeprinter (srv_spoolss.c)
1833 ********************************************************************/
1835 BOOL
spoolss_io_q_writeprinter(const char *desc
, SPOOL_Q_WRITEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1837 if (q_u
== NULL
) return False
;
1839 prs_debug(ps
, depth
, desc
, "spoolss_io_q_writeprinter");
1845 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1847 if(!prs_uint32("buffer_size", ps
, depth
, &q_u
->buffer_size
))
1850 if (q_u
->buffer_size
!=0)
1852 if (UNMARSHALLING(ps
))
1853 q_u
->buffer
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->buffer_size
);
1854 if(q_u
->buffer
== NULL
)
1856 if(!prs_uint8s(True
, "buffer", ps
, depth
, q_u
->buffer
, q_u
->buffer_size
))
1861 if(!prs_uint32("buffer_size2", ps
, depth
, &q_u
->buffer_size2
))
1867 /*******************************************************************
1868 * write a structure.
1869 * called from spoolss_r_writeprinter (srv_spoolss.c)
1870 ********************************************************************/
1872 BOOL
spoolss_io_r_writeprinter(const char *desc
, SPOOL_R_WRITEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1874 prs_debug(ps
, depth
, desc
, "spoolss_io_r_writeprinter");
1876 if(!prs_uint32("buffer_written", ps
, depth
, &r_u
->buffer_written
))
1878 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1884 /*******************************************************************
1886 * called from spoolss_q_rffpcnex (srv_spoolss.c)
1887 ********************************************************************/
1889 BOOL
spoolss_io_q_rffpcnex(const char *desc
, SPOOL_Q_RFFPCNEX
*q_u
, prs_struct
*ps
, int depth
)
1891 prs_debug(ps
, depth
, desc
, "spoolss_io_q_rffpcnex");
1897 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
1899 if(!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
1901 if(!prs_uint32("options", ps
, depth
, &q_u
->options
))
1903 if(!prs_uint32("localmachine_ptr", ps
, depth
, &q_u
->localmachine_ptr
))
1905 if(!smb_io_unistr2("localmachine", &q_u
->localmachine
, q_u
->localmachine_ptr
, ps
, depth
))
1911 if(!prs_uint32("printerlocal", ps
, depth
, &q_u
->printerlocal
))
1914 if(!prs_uint32("option_ptr", ps
, depth
, &q_u
->option_ptr
))
1917 if (q_u
->option_ptr
!=0) {
1919 if (UNMARSHALLING(ps
))
1920 if((q_u
->option
=PRS_ALLOC_MEM(ps
,SPOOL_NOTIFY_OPTION
,1)) == NULL
)
1923 if(!smb_io_notify_option("notify option", q_u
->option
, ps
, depth
))
1930 /*******************************************************************
1931 * write a structure.
1932 * called from spoolss_r_rffpcnex (srv_spoolss.c)
1933 ********************************************************************/
1935 BOOL
spoolss_io_r_rffpcnex(const char *desc
, SPOOL_R_RFFPCNEX
*r_u
, prs_struct
*ps
, int depth
)
1937 prs_debug(ps
, depth
, desc
, "spoolss_io_r_rffpcnex");
1940 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1946 /*******************************************************************
1948 * called from spoolss_q_rfnpcnex (srv_spoolss.c)
1949 ********************************************************************/
1951 BOOL
spoolss_io_q_rfnpcnex(const char *desc
, SPOOL_Q_RFNPCNEX
*q_u
, prs_struct
*ps
, int depth
)
1953 prs_debug(ps
, depth
, desc
, "spoolss_io_q_rfnpcnex");
1959 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1962 if(!prs_uint32("change", ps
, depth
, &q_u
->change
))
1965 if(!prs_uint32("option_ptr", ps
, depth
, &q_u
->option_ptr
))
1968 if (q_u
->option_ptr
!=0) {
1970 if (UNMARSHALLING(ps
))
1971 if((q_u
->option
=PRS_ALLOC_MEM(ps
,SPOOL_NOTIFY_OPTION
,1)) == NULL
)
1974 if(!smb_io_notify_option("notify option", q_u
->option
, ps
, depth
))
1981 /*******************************************************************
1982 * write a structure.
1983 * called from spoolss_r_rfnpcnex (srv_spoolss.c)
1984 ********************************************************************/
1986 BOOL
spoolss_io_r_rfnpcnex(const char *desc
, SPOOL_R_RFNPCNEX
*r_u
, prs_struct
*ps
, int depth
)
1988 prs_debug(ps
, depth
, desc
, "spoolss_io_r_rfnpcnex");
1994 if (!prs_uint32("info_ptr", ps
, depth
, &r_u
->info_ptr
))
1997 if(!smb_io_notify_info("notify info", &r_u
->info
,ps
,depth
))
2002 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
2008 /*******************************************************************
2009 * return the length of a uint16 (obvious, but the code is clean)
2010 ********************************************************************/
2012 static uint32
size_of_uint16(uint16
*value
)
2014 return (sizeof(*value
));
2017 /*******************************************************************
2018 * return the length of a uint32 (obvious, but the code is clean)
2019 ********************************************************************/
2021 static uint32
size_of_uint32(uint32
*value
)
2023 return (sizeof(*value
));
2026 /*******************************************************************
2027 * return the length of a NTTIME (obvious, but the code is clean)
2028 ********************************************************************/
2030 static uint32
size_of_nttime(NTTIME
*value
)
2032 return (sizeof(*value
));
2035 /*******************************************************************
2036 * return the length of a uint32 (obvious, but the code is clean)
2037 ********************************************************************/
2039 static uint32
size_of_device_mode(DEVICEMODE
*devmode
)
2044 return (4+devmode
->size
+devmode
->driverextra
);
2047 /*******************************************************************
2048 * return the length of a uint32 (obvious, but the code is clean)
2049 ********************************************************************/
2051 static uint32
size_of_systemtime(SYSTEMTIME
*systime
)
2056 return (sizeof(SYSTEMTIME
) +4);
2059 /*******************************************************************
2060 Parse a DEVMODE structure and its relative pointer.
2061 ********************************************************************/
2063 static BOOL
smb_io_reldevmode(const char *desc
, RPC_BUFFER
*buffer
, int depth
, DEVICEMODE
**devmode
)
2065 prs_struct
*ps
=&buffer
->prs
;
2067 prs_debug(ps
, depth
, desc
, "smb_io_reldevmode");
2070 if (MARSHALLING(ps
)) {
2071 uint32 struct_offset
= prs_offset(ps
);
2072 uint32 relative_offset
;
2074 if (*devmode
== NULL
) {
2076 if (!prs_uint32("offset", ps
, depth
, &relative_offset
))
2078 DEBUG(8, ("boing, the devmode was NULL\n"));
2083 buffer
->string_at_end
-= ((*devmode
)->size
+ (*devmode
)->driverextra
);
2085 if(!prs_set_offset(ps
, buffer
->string_at_end
))
2088 /* write the DEVMODE */
2089 if (!spoolss_io_devmode(desc
, ps
, depth
, *devmode
))
2092 if(!prs_set_offset(ps
, struct_offset
))
2095 relative_offset
=buffer
->string_at_end
- buffer
->struct_start
;
2096 /* write its offset */
2097 if (!prs_uint32("offset", ps
, depth
, &relative_offset
))
2103 /* read the offset */
2104 if (!prs_uint32("offset", ps
, depth
, &buffer
->string_at_end
))
2106 if (buffer
->string_at_end
== 0) {
2111 old_offset
= prs_offset(ps
);
2112 if(!prs_set_offset(ps
, buffer
->string_at_end
+ buffer
->struct_start
))
2115 /* read the string */
2116 if((*devmode
=PRS_ALLOC_MEM(ps
,DEVICEMODE
,1)) == NULL
)
2118 if (!spoolss_io_devmode(desc
, ps
, depth
, *devmode
))
2121 if(!prs_set_offset(ps
, old_offset
))
2127 /*******************************************************************
2128 Parse a PRINTER_INFO_0 structure.
2129 ********************************************************************/
2131 BOOL
smb_io_printer_info_0(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_0
*info
, int depth
)
2133 prs_struct
*ps
=&buffer
->prs
;
2135 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_0");
2138 buffer
->struct_start
=prs_offset(ps
);
2140 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2142 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
2145 if(!prs_uint32("cjobs", ps
, depth
, &info
->cjobs
))
2147 if(!prs_uint32("total_jobs", ps
, depth
, &info
->total_jobs
))
2149 if(!prs_uint32("total_bytes", ps
, depth
, &info
->total_bytes
))
2152 if(!prs_uint16("year", ps
, depth
, &info
->year
))
2154 if(!prs_uint16("month", ps
, depth
, &info
->month
))
2156 if(!prs_uint16("dayofweek", ps
, depth
, &info
->dayofweek
))
2158 if(!prs_uint16("day", ps
, depth
, &info
->day
))
2160 if(!prs_uint16("hour", ps
, depth
, &info
->hour
))
2162 if(!prs_uint16("minute", ps
, depth
, &info
->minute
))
2164 if(!prs_uint16("second", ps
, depth
, &info
->second
))
2166 if(!prs_uint16("milliseconds", ps
, depth
, &info
->milliseconds
))
2169 if(!prs_uint32("global_counter", ps
, depth
, &info
->global_counter
))
2171 if(!prs_uint32("total_pages", ps
, depth
, &info
->total_pages
))
2174 if(!prs_uint16("major_version", ps
, depth
, &info
->major_version
))
2176 if(!prs_uint16("build_version", ps
, depth
, &info
->build_version
))
2178 if(!prs_uint32("unknown7", ps
, depth
, &info
->unknown7
))
2180 if(!prs_uint32("unknown8", ps
, depth
, &info
->unknown8
))
2182 if(!prs_uint32("unknown9", ps
, depth
, &info
->unknown9
))
2184 if(!prs_uint32("session_counter", ps
, depth
, &info
->session_counter
))
2186 if(!prs_uint32("unknown11", ps
, depth
, &info
->unknown11
))
2188 if(!prs_uint32("printer_errors", ps
, depth
, &info
->printer_errors
))
2190 if(!prs_uint32("unknown13", ps
, depth
, &info
->unknown13
))
2192 if(!prs_uint32("unknown14", ps
, depth
, &info
->unknown14
))
2194 if(!prs_uint32("unknown15", ps
, depth
, &info
->unknown15
))
2196 if(!prs_uint32("unknown16", ps
, depth
, &info
->unknown16
))
2198 if(!prs_uint32("change_id", ps
, depth
, &info
->change_id
))
2200 if(!prs_uint32("unknown18", ps
, depth
, &info
->unknown18
))
2202 if(!prs_uint32("status" , ps
, depth
, &info
->status
))
2204 if(!prs_uint32("unknown20", ps
, depth
, &info
->unknown20
))
2206 if(!prs_uint32("c_setprinter", ps
, depth
, &info
->c_setprinter
))
2208 if(!prs_uint16("unknown22", ps
, depth
, &info
->unknown22
))
2210 if(!prs_uint16("unknown23", ps
, depth
, &info
->unknown23
))
2212 if(!prs_uint16("unknown24", ps
, depth
, &info
->unknown24
))
2214 if(!prs_uint16("unknown25", ps
, depth
, &info
->unknown25
))
2216 if(!prs_uint16("unknown26", ps
, depth
, &info
->unknown26
))
2218 if(!prs_uint16("unknown27", ps
, depth
, &info
->unknown27
))
2220 if(!prs_uint16("unknown28", ps
, depth
, &info
->unknown28
))
2222 if(!prs_uint16("unknown29", ps
, depth
, &info
->unknown29
))
2228 /*******************************************************************
2229 Parse a PRINTER_INFO_1 structure.
2230 ********************************************************************/
2232 BOOL
smb_io_printer_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_1
*info
, int depth
)
2234 prs_struct
*ps
=&buffer
->prs
;
2236 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_1");
2239 buffer
->struct_start
=prs_offset(ps
);
2241 if (!prs_uint32("flags", ps
, depth
, &info
->flags
))
2243 if (!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2245 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2247 if (!smb_io_relstr("comment", buffer
, depth
, &info
->comment
))
2253 /*******************************************************************
2254 Parse a PRINTER_INFO_2 structure.
2255 ********************************************************************/
2257 BOOL
smb_io_printer_info_2(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_2
*info
, int depth
)
2259 prs_struct
*ps
=&buffer
->prs
;
2260 uint32 dm_offset
, sd_offset
, current_offset
;
2261 uint32 dummy_value
= 0, has_secdesc
= 0;
2263 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_2");
2266 buffer
->struct_start
=prs_offset(ps
);
2268 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
2270 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2272 if (!smb_io_relstr("sharename", buffer
, depth
, &info
->sharename
))
2274 if (!smb_io_relstr("portname", buffer
, depth
, &info
->portname
))
2276 if (!smb_io_relstr("drivername", buffer
, depth
, &info
->drivername
))
2278 if (!smb_io_relstr("comment", buffer
, depth
, &info
->comment
))
2280 if (!smb_io_relstr("location", buffer
, depth
, &info
->location
))
2283 /* save current offset and wind forwared by a uint32 */
2284 dm_offset
= prs_offset(ps
);
2285 if (!prs_uint32("devmode", ps
, depth
, &dummy_value
))
2288 if (!smb_io_relstr("sepfile", buffer
, depth
, &info
->sepfile
))
2290 if (!smb_io_relstr("printprocessor", buffer
, depth
, &info
->printprocessor
))
2292 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2294 if (!smb_io_relstr("parameters", buffer
, depth
, &info
->parameters
))
2297 /* save current offset for the sec_desc */
2298 sd_offset
= prs_offset(ps
);
2299 if (!prs_uint32("sec_desc", ps
, depth
, &has_secdesc
))
2303 /* save current location so we can pick back up here */
2304 current_offset
= prs_offset(ps
);
2306 /* parse the devmode */
2307 if (!prs_set_offset(ps
, dm_offset
))
2309 if (!smb_io_reldevmode("devmode", buffer
, depth
, &info
->devmode
))
2312 /* parse the sec_desc */
2313 if (info
->secdesc
) {
2314 if (!prs_set_offset(ps
, sd_offset
))
2316 if (!smb_io_relsecdesc("secdesc", buffer
, depth
, &info
->secdesc
))
2320 /* pick up where we left off */
2321 if (!prs_set_offset(ps
, current_offset
))
2324 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2326 if (!prs_uint32("priority", ps
, depth
, &info
->priority
))
2328 if (!prs_uint32("defpriority", ps
, depth
, &info
->defaultpriority
))
2330 if (!prs_uint32("starttime", ps
, depth
, &info
->starttime
))
2332 if (!prs_uint32("untiltime", ps
, depth
, &info
->untiltime
))
2334 if (!prs_uint32("status", ps
, depth
, &info
->status
))
2336 if (!prs_uint32("jobs", ps
, depth
, &info
->cjobs
))
2338 if (!prs_uint32("averageppm", ps
, depth
, &info
->averageppm
))
2344 /*******************************************************************
2345 Parse a PRINTER_INFO_3 structure.
2346 ********************************************************************/
2348 BOOL
smb_io_printer_info_3(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_3
*info
, int depth
)
2350 prs_struct
*ps
=&buffer
->prs
;
2352 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_3");
2355 buffer
->struct_start
=prs_offset(ps
);
2357 if (!prs_uint32("flags", ps
, depth
, &info
->flags
))
2359 if (!sec_io_desc("sec_desc", &info
->secdesc
, ps
, depth
))
2365 /*******************************************************************
2366 Parse a PRINTER_INFO_4 structure.
2367 ********************************************************************/
2369 BOOL
smb_io_printer_info_4(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_4
*info
, int depth
)
2371 prs_struct
*ps
=&buffer
->prs
;
2373 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_4");
2376 buffer
->struct_start
=prs_offset(ps
);
2378 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2380 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
2382 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2387 /*******************************************************************
2388 Parse a PRINTER_INFO_5 structure.
2389 ********************************************************************/
2391 BOOL
smb_io_printer_info_5(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_5
*info
, int depth
)
2393 prs_struct
*ps
=&buffer
->prs
;
2395 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_5");
2398 buffer
->struct_start
=prs_offset(ps
);
2400 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2402 if (!smb_io_relstr("portname", buffer
, depth
, &info
->portname
))
2404 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2406 if (!prs_uint32("device_not_selected_timeout", ps
, depth
, &info
->device_not_selected_timeout
))
2408 if (!prs_uint32("transmission_retry_timeout", ps
, depth
, &info
->transmission_retry_timeout
))
2413 /*******************************************************************
2414 Parse a PRINTER_INFO_7 structure.
2415 ********************************************************************/
2417 BOOL
smb_io_printer_info_7(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_7
*info
, int depth
)
2419 prs_struct
*ps
=&buffer
->prs
;
2421 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_7");
2424 buffer
->struct_start
=prs_offset(ps
);
2426 if (!smb_io_relstr("guid", buffer
, depth
, &info
->guid
))
2428 if (!prs_uint32("action", ps
, depth
, &info
->action
))
2433 /*******************************************************************
2434 Parse a PORT_INFO_1 structure.
2435 ********************************************************************/
2437 BOOL
smb_io_port_info_1(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_1
*info
, int depth
)
2439 prs_struct
*ps
=&buffer
->prs
;
2441 prs_debug(ps
, depth
, desc
, "smb_io_port_info_1");
2444 buffer
->struct_start
=prs_offset(ps
);
2446 if (!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2452 /*******************************************************************
2453 Parse a PORT_INFO_2 structure.
2454 ********************************************************************/
2456 BOOL
smb_io_port_info_2(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_2
*info
, int depth
)
2458 prs_struct
*ps
=&buffer
->prs
;
2460 prs_debug(ps
, depth
, desc
, "smb_io_port_info_2");
2463 buffer
->struct_start
=prs_offset(ps
);
2465 if (!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2467 if (!smb_io_relstr("monitor_name", buffer
, depth
, &info
->monitor_name
))
2469 if (!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2471 if (!prs_uint32("port_type", ps
, depth
, &info
->port_type
))
2473 if (!prs_uint32("reserved", ps
, depth
, &info
->reserved
))
2479 /*******************************************************************
2480 Parse a DRIVER_INFO_1 structure.
2481 ********************************************************************/
2483 BOOL
smb_io_printer_driver_info_1(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_1
*info
, int depth
)
2485 prs_struct
*ps
=&buffer
->prs
;
2487 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_1");
2490 buffer
->struct_start
=prs_offset(ps
);
2492 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2498 /*******************************************************************
2499 Parse a DRIVER_INFO_2 structure.
2500 ********************************************************************/
2502 BOOL
smb_io_printer_driver_info_2(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_2
*info
, int depth
)
2504 prs_struct
*ps
=&buffer
->prs
;
2506 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_2");
2509 buffer
->struct_start
=prs_offset(ps
);
2511 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2513 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2515 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2517 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2519 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2521 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2527 /*******************************************************************
2528 Parse a DRIVER_INFO_3 structure.
2529 ********************************************************************/
2531 BOOL
smb_io_printer_driver_info_3(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_3
*info
, int depth
)
2533 prs_struct
*ps
=&buffer
->prs
;
2535 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_3");
2538 buffer
->struct_start
=prs_offset(ps
);
2540 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2542 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2544 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2546 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2548 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2550 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2552 if (!smb_io_relstr("helpfile", buffer
, depth
, &info
->helpfile
))
2555 if (!smb_io_relarraystr("dependentfiles", buffer
, depth
, &info
->dependentfiles
))
2558 if (!smb_io_relstr("monitorname", buffer
, depth
, &info
->monitorname
))
2560 if (!smb_io_relstr("defaultdatatype", buffer
, depth
, &info
->defaultdatatype
))
2566 /*******************************************************************
2567 Parse a DRIVER_INFO_6 structure.
2568 ********************************************************************/
2570 BOOL
smb_io_printer_driver_info_6(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_6
*info
, int depth
)
2572 prs_struct
*ps
=&buffer
->prs
;
2574 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_6");
2577 buffer
->struct_start
=prs_offset(ps
);
2579 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2581 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2583 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2585 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2587 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2589 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2591 if (!smb_io_relstr("helpfile", buffer
, depth
, &info
->helpfile
))
2594 if (!smb_io_relarraystr("dependentfiles", buffer
, depth
, &info
->dependentfiles
))
2597 if (!smb_io_relstr("monitorname", buffer
, depth
, &info
->monitorname
))
2599 if (!smb_io_relstr("defaultdatatype", buffer
, depth
, &info
->defaultdatatype
))
2602 if (!smb_io_relarraystr("previousdrivernames", buffer
, depth
, &info
->previousdrivernames
))
2605 if (!prs_uint32("date.low", ps
, depth
, &info
->driver_date
.low
))
2607 if (!prs_uint32("date.high", ps
, depth
, &info
->driver_date
.high
))
2610 if (!prs_uint32("padding", ps
, depth
, &info
->padding
))
2613 if (!prs_uint32("driver_version_low", ps
, depth
, &info
->driver_version_low
))
2616 if (!prs_uint32("driver_version_high", ps
, depth
, &info
->driver_version_high
))
2619 if (!smb_io_relstr("mfgname", buffer
, depth
, &info
->mfgname
))
2621 if (!smb_io_relstr("oem_url", buffer
, depth
, &info
->oem_url
))
2623 if (!smb_io_relstr("hardware_id", buffer
, depth
, &info
->hardware_id
))
2625 if (!smb_io_relstr("provider", buffer
, depth
, &info
->provider
))
2631 /*******************************************************************
2632 Parse a JOB_INFO_1 structure.
2633 ********************************************************************/
2635 BOOL
smb_io_job_info_1(const char *desc
, RPC_BUFFER
*buffer
, JOB_INFO_1
*info
, int depth
)
2637 prs_struct
*ps
=&buffer
->prs
;
2639 prs_debug(ps
, depth
, desc
, "smb_io_job_info_1");
2642 buffer
->struct_start
=prs_offset(ps
);
2644 if (!prs_uint32("jobid", ps
, depth
, &info
->jobid
))
2646 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2648 if (!smb_io_relstr("machinename", buffer
, depth
, &info
->machinename
))
2650 if (!smb_io_relstr("username", buffer
, depth
, &info
->username
))
2652 if (!smb_io_relstr("document", buffer
, depth
, &info
->document
))
2654 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2656 if (!smb_io_relstr("text_status", buffer
, depth
, &info
->text_status
))
2658 if (!prs_uint32("status", ps
, depth
, &info
->status
))
2660 if (!prs_uint32("priority", ps
, depth
, &info
->priority
))
2662 if (!prs_uint32("position", ps
, depth
, &info
->position
))
2664 if (!prs_uint32("totalpages", ps
, depth
, &info
->totalpages
))
2666 if (!prs_uint32("pagesprinted", ps
, depth
, &info
->pagesprinted
))
2668 if (!spoolss_io_system_time("submitted", ps
, depth
, &info
->submitted
))
2674 /*******************************************************************
2675 Parse a JOB_INFO_2 structure.
2676 ********************************************************************/
2678 BOOL
smb_io_job_info_2(const char *desc
, RPC_BUFFER
*buffer
, JOB_INFO_2
*info
, int depth
)
2681 prs_struct
*ps
=&buffer
->prs
;
2683 prs_debug(ps
, depth
, desc
, "smb_io_job_info_2");
2686 buffer
->struct_start
=prs_offset(ps
);
2688 if (!prs_uint32("jobid",ps
, depth
, &info
->jobid
))
2690 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2692 if (!smb_io_relstr("machinename", buffer
, depth
, &info
->machinename
))
2694 if (!smb_io_relstr("username", buffer
, depth
, &info
->username
))
2696 if (!smb_io_relstr("document", buffer
, depth
, &info
->document
))
2698 if (!smb_io_relstr("notifyname", buffer
, depth
, &info
->notifyname
))
2700 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2703 if (!smb_io_relstr("printprocessor", buffer
, depth
, &info
->printprocessor
))
2705 if (!smb_io_relstr("parameters", buffer
, depth
, &info
->parameters
))
2707 if (!smb_io_relstr("drivername", buffer
, depth
, &info
->drivername
))
2709 if (!smb_io_reldevmode("devmode", buffer
, depth
, &info
->devmode
))
2711 if (!smb_io_relstr("text_status", buffer
, depth
, &info
->text_status
))
2714 /* SEC_DESC sec_desc;*/
2715 if (!prs_uint32("Hack! sec desc", ps
, depth
, &pipo
))
2718 if (!prs_uint32("status",ps
, depth
, &info
->status
))
2720 if (!prs_uint32("priority",ps
, depth
, &info
->priority
))
2722 if (!prs_uint32("position",ps
, depth
, &info
->position
))
2724 if (!prs_uint32("starttime",ps
, depth
, &info
->starttime
))
2726 if (!prs_uint32("untiltime",ps
, depth
, &info
->untiltime
))
2728 if (!prs_uint32("totalpages",ps
, depth
, &info
->totalpages
))
2730 if (!prs_uint32("size",ps
, depth
, &info
->size
))
2732 if (!spoolss_io_system_time("submitted", ps
, depth
, &info
->submitted
) )
2734 if (!prs_uint32("timeelapsed",ps
, depth
, &info
->timeelapsed
))
2736 if (!prs_uint32("pagesprinted",ps
, depth
, &info
->pagesprinted
))
2742 /*******************************************************************
2743 ********************************************************************/
2745 BOOL
smb_io_form_1(const char *desc
, RPC_BUFFER
*buffer
, FORM_1
*info
, int depth
)
2747 prs_struct
*ps
=&buffer
->prs
;
2749 prs_debug(ps
, depth
, desc
, "smb_io_form_1");
2752 buffer
->struct_start
=prs_offset(ps
);
2754 if (!prs_uint32("flag", ps
, depth
, &info
->flag
))
2757 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2760 if (!prs_uint32("width", ps
, depth
, &info
->width
))
2762 if (!prs_uint32("length", ps
, depth
, &info
->length
))
2764 if (!prs_uint32("left", ps
, depth
, &info
->left
))
2766 if (!prs_uint32("top", ps
, depth
, &info
->top
))
2768 if (!prs_uint32("right", ps
, depth
, &info
->right
))
2770 if (!prs_uint32("bottom", ps
, depth
, &info
->bottom
))
2778 /*******************************************************************
2779 Parse a DRIVER_DIRECTORY_1 structure.
2780 ********************************************************************/
2782 BOOL
smb_io_driverdir_1(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_DIRECTORY_1
*info
, int depth
)
2784 prs_struct
*ps
=&buffer
->prs
;
2786 prs_debug(ps
, depth
, desc
, "smb_io_driverdir_1");
2789 buffer
->struct_start
=prs_offset(ps
);
2791 if (!smb_io_unistr(desc
, &info
->name
, ps
, depth
))
2797 /*******************************************************************
2798 Parse a PORT_INFO_1 structure.
2799 ********************************************************************/
2801 BOOL
smb_io_port_1(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_1
*info
, int depth
)
2803 prs_struct
*ps
=&buffer
->prs
;
2805 prs_debug(ps
, depth
, desc
, "smb_io_port_1");
2808 buffer
->struct_start
=prs_offset(ps
);
2810 if(!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2816 /*******************************************************************
2817 Parse a PORT_INFO_2 structure.
2818 ********************************************************************/
2820 BOOL
smb_io_port_2(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_2
*info
, int depth
)
2822 prs_struct
*ps
=&buffer
->prs
;
2824 prs_debug(ps
, depth
, desc
, "smb_io_port_2");
2827 buffer
->struct_start
=prs_offset(ps
);
2829 if(!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2831 if(!smb_io_relstr("monitor_name", buffer
, depth
, &info
->monitor_name
))
2833 if(!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2835 if(!prs_uint32("port_type", ps
, depth
, &info
->port_type
))
2837 if(!prs_uint32("reserved", ps
, depth
, &info
->reserved
))
2843 /*******************************************************************
2844 ********************************************************************/
2846 BOOL
smb_io_printprocessor_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCESSOR_1
*info
, int depth
)
2848 prs_struct
*ps
=&buffer
->prs
;
2850 prs_debug(ps
, depth
, desc
, "smb_io_printprocessor_info_1");
2853 buffer
->struct_start
=prs_offset(ps
);
2855 if (smb_io_relstr("name", buffer
, depth
, &info
->name
))
2861 /*******************************************************************
2862 ********************************************************************/
2864 BOOL
smb_io_printprocdatatype_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCDATATYPE_1
*info
, int depth
)
2866 prs_struct
*ps
=&buffer
->prs
;
2868 prs_debug(ps
, depth
, desc
, "smb_io_printprocdatatype_info_1");
2871 buffer
->struct_start
=prs_offset(ps
);
2873 if (smb_io_relstr("name", buffer
, depth
, &info
->name
))
2879 /*******************************************************************
2880 ********************************************************************/
2882 BOOL
smb_io_printmonitor_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTMONITOR_1
*info
, int depth
)
2884 prs_struct
*ps
=&buffer
->prs
;
2886 prs_debug(ps
, depth
, desc
, "smb_io_printmonitor_info_1");
2889 buffer
->struct_start
=prs_offset(ps
);
2891 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2897 /*******************************************************************
2898 ********************************************************************/
2900 BOOL
smb_io_printmonitor_info_2(const char *desc
, RPC_BUFFER
*buffer
, PRINTMONITOR_2
*info
, int depth
)
2902 prs_struct
*ps
=&buffer
->prs
;
2904 prs_debug(ps
, depth
, desc
, "smb_io_printmonitor_info_2");
2907 buffer
->struct_start
=prs_offset(ps
);
2909 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2911 if (!smb_io_relstr("environment", buffer
, depth
, &info
->environment
))
2913 if (!smb_io_relstr("dll_name", buffer
, depth
, &info
->dll_name
))
2919 /*******************************************************************
2920 return the size required by a struct in the stream
2921 ********************************************************************/
2923 uint32
spoolss_size_printer_info_0(PRINTER_INFO_0
*info
)
2927 size
+=size_of_relative_string( &info
->printername
);
2928 size
+=size_of_relative_string( &info
->servername
);
2930 size
+=size_of_uint32( &info
->cjobs
);
2931 size
+=size_of_uint32( &info
->total_jobs
);
2932 size
+=size_of_uint32( &info
->total_bytes
);
2934 size
+=size_of_uint16( &info
->year
);
2935 size
+=size_of_uint16( &info
->month
);
2936 size
+=size_of_uint16( &info
->dayofweek
);
2937 size
+=size_of_uint16( &info
->day
);
2938 size
+=size_of_uint16( &info
->hour
);
2939 size
+=size_of_uint16( &info
->minute
);
2940 size
+=size_of_uint16( &info
->second
);
2941 size
+=size_of_uint16( &info
->milliseconds
);
2943 size
+=size_of_uint32( &info
->global_counter
);
2944 size
+=size_of_uint32( &info
->total_pages
);
2946 size
+=size_of_uint16( &info
->major_version
);
2947 size
+=size_of_uint16( &info
->build_version
);
2949 size
+=size_of_uint32( &info
->unknown7
);
2950 size
+=size_of_uint32( &info
->unknown8
);
2951 size
+=size_of_uint32( &info
->unknown9
);
2952 size
+=size_of_uint32( &info
->session_counter
);
2953 size
+=size_of_uint32( &info
->unknown11
);
2954 size
+=size_of_uint32( &info
->printer_errors
);
2955 size
+=size_of_uint32( &info
->unknown13
);
2956 size
+=size_of_uint32( &info
->unknown14
);
2957 size
+=size_of_uint32( &info
->unknown15
);
2958 size
+=size_of_uint32( &info
->unknown16
);
2959 size
+=size_of_uint32( &info
->change_id
);
2960 size
+=size_of_uint32( &info
->unknown18
);
2961 size
+=size_of_uint32( &info
->status
);
2962 size
+=size_of_uint32( &info
->unknown20
);
2963 size
+=size_of_uint32( &info
->c_setprinter
);
2965 size
+=size_of_uint16( &info
->unknown22
);
2966 size
+=size_of_uint16( &info
->unknown23
);
2967 size
+=size_of_uint16( &info
->unknown24
);
2968 size
+=size_of_uint16( &info
->unknown25
);
2969 size
+=size_of_uint16( &info
->unknown26
);
2970 size
+=size_of_uint16( &info
->unknown27
);
2971 size
+=size_of_uint16( &info
->unknown28
);
2972 size
+=size_of_uint16( &info
->unknown29
);
2977 /*******************************************************************
2978 return the size required by a struct in the stream
2979 ********************************************************************/
2981 uint32
spoolss_size_printer_info_1(PRINTER_INFO_1
*info
)
2985 size
+=size_of_uint32( &info
->flags
);
2986 size
+=size_of_relative_string( &info
->description
);
2987 size
+=size_of_relative_string( &info
->name
);
2988 size
+=size_of_relative_string( &info
->comment
);
2993 /*******************************************************************
2994 return the size required by a struct in the stream
2995 ********************************************************************/
2997 uint32
spoolss_size_printer_info_2(PRINTER_INFO_2
*info
)
3003 size
+= sec_desc_size( info
->secdesc
);
3005 size
+=size_of_device_mode( info
->devmode
);
3007 size
+=size_of_relative_string( &info
->servername
);
3008 size
+=size_of_relative_string( &info
->printername
);
3009 size
+=size_of_relative_string( &info
->sharename
);
3010 size
+=size_of_relative_string( &info
->portname
);
3011 size
+=size_of_relative_string( &info
->drivername
);
3012 size
+=size_of_relative_string( &info
->comment
);
3013 size
+=size_of_relative_string( &info
->location
);
3015 size
+=size_of_relative_string( &info
->sepfile
);
3016 size
+=size_of_relative_string( &info
->printprocessor
);
3017 size
+=size_of_relative_string( &info
->datatype
);
3018 size
+=size_of_relative_string( &info
->parameters
);
3020 size
+=size_of_uint32( &info
->attributes
);
3021 size
+=size_of_uint32( &info
->priority
);
3022 size
+=size_of_uint32( &info
->defaultpriority
);
3023 size
+=size_of_uint32( &info
->starttime
);
3024 size
+=size_of_uint32( &info
->untiltime
);
3025 size
+=size_of_uint32( &info
->status
);
3026 size
+=size_of_uint32( &info
->cjobs
);
3027 size
+=size_of_uint32( &info
->averageppm
);
3030 * add any adjustments for alignment. This is
3031 * not optimal since we could be calling this
3032 * function from a loop (e.g. enumprinters), but
3033 * it is easier to maintain the calculation here and
3034 * not place the burden on the caller to remember. --jerry
3036 if ((size
% 4) != 0)
3037 size
+= 4 - (size
% 4);
3042 /*******************************************************************
3043 return the size required by a struct in the stream
3044 ********************************************************************/
3046 uint32
spoolss_size_printer_info_4(PRINTER_INFO_4
*info
)
3050 size
+=size_of_relative_string( &info
->printername
);
3051 size
+=size_of_relative_string( &info
->servername
);
3053 size
+=size_of_uint32( &info
->attributes
);
3057 /*******************************************************************
3058 return the size required by a struct in the stream
3059 ********************************************************************/
3061 uint32
spoolss_size_printer_info_5(PRINTER_INFO_5
*info
)
3065 size
+=size_of_relative_string( &info
->printername
);
3066 size
+=size_of_relative_string( &info
->portname
);
3068 size
+=size_of_uint32( &info
->attributes
);
3069 size
+=size_of_uint32( &info
->device_not_selected_timeout
);
3070 size
+=size_of_uint32( &info
->transmission_retry_timeout
);
3075 /*******************************************************************
3076 return the size required by a struct in the stream
3077 ********************************************************************/
3079 uint32
spoolss_size_printer_info_3(PRINTER_INFO_3
*info
)
3081 /* The 4 is for the self relative pointer.. */
3082 /* JRA !!!! TESTME - WHAT ABOUT prs_align.... !!! */
3083 return 4 + (uint32
)sec_desc_size( info
->secdesc
);
3086 /*******************************************************************
3087 return the size required by a struct in the stream
3088 ********************************************************************/
3090 uint32
spoolss_size_printer_info_7(PRINTER_INFO_7
*info
)
3094 size
+=size_of_relative_string( &info
->guid
);
3095 size
+=size_of_uint32( &info
->action
);
3099 /*******************************************************************
3100 return the size required by a struct in the stream
3101 ********************************************************************/
3103 uint32
spoolss_size_printer_driver_info_1(DRIVER_INFO_1
*info
)
3106 size
+=size_of_relative_string( &info
->name
);
3111 /*******************************************************************
3112 return the size required by a struct in the stream
3113 ********************************************************************/
3115 uint32
spoolss_size_printer_driver_info_2(DRIVER_INFO_2
*info
)
3118 size
+=size_of_uint32( &info
->version
);
3119 size
+=size_of_relative_string( &info
->name
);
3120 size
+=size_of_relative_string( &info
->architecture
);
3121 size
+=size_of_relative_string( &info
->driverpath
);
3122 size
+=size_of_relative_string( &info
->datafile
);
3123 size
+=size_of_relative_string( &info
->configfile
);
3128 /*******************************************************************
3129 return the size required by a string array.
3130 ********************************************************************/
3132 uint32
spoolss_size_string_array(uint16
*string
)
3137 for (i
=0; (string
[i
]!=0x0000) || (string
[i
+1]!=0x0000); i
++);
3139 i
=i
+2; /* to count all chars including the leading zero */
3140 i
=2*i
; /* because we need the value in bytes */
3141 i
=i
+4; /* the offset pointer size */
3146 /*******************************************************************
3147 return the size required by a struct in the stream
3148 ********************************************************************/
3150 uint32
spoolss_size_printer_driver_info_3(DRIVER_INFO_3
*info
)
3154 size
+=size_of_uint32( &info
->version
);
3155 size
+=size_of_relative_string( &info
->name
);
3156 size
+=size_of_relative_string( &info
->architecture
);
3157 size
+=size_of_relative_string( &info
->driverpath
);
3158 size
+=size_of_relative_string( &info
->datafile
);
3159 size
+=size_of_relative_string( &info
->configfile
);
3160 size
+=size_of_relative_string( &info
->helpfile
);
3161 size
+=size_of_relative_string( &info
->monitorname
);
3162 size
+=size_of_relative_string( &info
->defaultdatatype
);
3164 size
+=spoolss_size_string_array(info
->dependentfiles
);
3169 /*******************************************************************
3170 return the size required by a struct in the stream
3171 ********************************************************************/
3173 uint32
spoolss_size_printer_driver_info_6(DRIVER_INFO_6
*info
)
3177 size
+=size_of_uint32( &info
->version
);
3178 size
+=size_of_relative_string( &info
->name
);
3179 size
+=size_of_relative_string( &info
->architecture
);
3180 size
+=size_of_relative_string( &info
->driverpath
);
3181 size
+=size_of_relative_string( &info
->datafile
);
3182 size
+=size_of_relative_string( &info
->configfile
);
3183 size
+=size_of_relative_string( &info
->helpfile
);
3185 size
+=spoolss_size_string_array(info
->dependentfiles
);
3187 size
+=size_of_relative_string( &info
->monitorname
);
3188 size
+=size_of_relative_string( &info
->defaultdatatype
);
3190 size
+=spoolss_size_string_array(info
->previousdrivernames
);
3192 size
+=size_of_nttime(&info
->driver_date
);
3193 size
+=size_of_uint32( &info
->padding
);
3194 size
+=size_of_uint32( &info
->driver_version_low
);
3195 size
+=size_of_uint32( &info
->driver_version_high
);
3196 size
+=size_of_relative_string( &info
->mfgname
);
3197 size
+=size_of_relative_string( &info
->oem_url
);
3198 size
+=size_of_relative_string( &info
->hardware_id
);
3199 size
+=size_of_relative_string( &info
->provider
);
3204 /*******************************************************************
3205 return the size required by a struct in the stream
3206 ********************************************************************/
3208 uint32
spoolss_size_job_info_1(JOB_INFO_1
*info
)
3211 size
+=size_of_uint32( &info
->jobid
);
3212 size
+=size_of_relative_string( &info
->printername
);
3213 size
+=size_of_relative_string( &info
->machinename
);
3214 size
+=size_of_relative_string( &info
->username
);
3215 size
+=size_of_relative_string( &info
->document
);
3216 size
+=size_of_relative_string( &info
->datatype
);
3217 size
+=size_of_relative_string( &info
->text_status
);
3218 size
+=size_of_uint32( &info
->status
);
3219 size
+=size_of_uint32( &info
->priority
);
3220 size
+=size_of_uint32( &info
->position
);
3221 size
+=size_of_uint32( &info
->totalpages
);
3222 size
+=size_of_uint32( &info
->pagesprinted
);
3223 size
+=size_of_systemtime( &info
->submitted
);
3228 /*******************************************************************
3229 return the size required by a struct in the stream
3230 ********************************************************************/
3232 uint32
spoolss_size_job_info_2(JOB_INFO_2
*info
)
3236 size
+=4; /* size of sec desc ptr */
3238 size
+=size_of_uint32( &info
->jobid
);
3239 size
+=size_of_relative_string( &info
->printername
);
3240 size
+=size_of_relative_string( &info
->machinename
);
3241 size
+=size_of_relative_string( &info
->username
);
3242 size
+=size_of_relative_string( &info
->document
);
3243 size
+=size_of_relative_string( &info
->notifyname
);
3244 size
+=size_of_relative_string( &info
->datatype
);
3245 size
+=size_of_relative_string( &info
->printprocessor
);
3246 size
+=size_of_relative_string( &info
->parameters
);
3247 size
+=size_of_relative_string( &info
->drivername
);
3248 size
+=size_of_device_mode( info
->devmode
);
3249 size
+=size_of_relative_string( &info
->text_status
);
3250 /* SEC_DESC sec_desc;*/
3251 size
+=size_of_uint32( &info
->status
);
3252 size
+=size_of_uint32( &info
->priority
);
3253 size
+=size_of_uint32( &info
->position
);
3254 size
+=size_of_uint32( &info
->starttime
);
3255 size
+=size_of_uint32( &info
->untiltime
);
3256 size
+=size_of_uint32( &info
->totalpages
);
3257 size
+=size_of_uint32( &info
->size
);
3258 size
+=size_of_systemtime( &info
->submitted
);
3259 size
+=size_of_uint32( &info
->timeelapsed
);
3260 size
+=size_of_uint32( &info
->pagesprinted
);
3265 /*******************************************************************
3266 return the size required by a struct in the stream
3267 ********************************************************************/
3269 uint32
spoolss_size_form_1(FORM_1
*info
)
3273 size
+=size_of_uint32( &info
->flag
);
3274 size
+=size_of_relative_string( &info
->name
);
3275 size
+=size_of_uint32( &info
->width
);
3276 size
+=size_of_uint32( &info
->length
);
3277 size
+=size_of_uint32( &info
->left
);
3278 size
+=size_of_uint32( &info
->top
);
3279 size
+=size_of_uint32( &info
->right
);
3280 size
+=size_of_uint32( &info
->bottom
);
3285 /*******************************************************************
3286 return the size required by a struct in the stream
3287 ********************************************************************/
3289 uint32
spoolss_size_port_info_1(PORT_INFO_1
*info
)
3293 size
+=size_of_relative_string( &info
->port_name
);
3298 /*******************************************************************
3299 return the size required by a struct in the stream
3300 ********************************************************************/
3302 uint32
spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1
*info
)
3306 size
=str_len_uni(&info
->name
); /* the string length */
3307 size
=size
+1; /* add the leading zero */
3308 size
=size
*2; /* convert in char */
3313 /*******************************************************************
3314 return the size required by a struct in the stream
3315 ********************************************************************/
3317 uint32
spoolss_size_printprocessordirectory_info_1(PRINTPROCESSOR_DIRECTORY_1
*info
)
3321 size
=str_len_uni(&info
->name
); /* the string length */
3322 size
=size
+1; /* add the leading zero */
3323 size
=size
*2; /* convert in char */
3328 /*******************************************************************
3329 return the size required by a struct in the stream
3330 ********************************************************************/
3332 uint32
spoolss_size_port_info_2(PORT_INFO_2
*info
)
3336 size
+=size_of_relative_string( &info
->port_name
);
3337 size
+=size_of_relative_string( &info
->monitor_name
);
3338 size
+=size_of_relative_string( &info
->description
);
3340 size
+=size_of_uint32( &info
->port_type
);
3341 size
+=size_of_uint32( &info
->reserved
);
3346 /*******************************************************************
3347 return the size required by a struct in the stream
3348 ********************************************************************/
3350 uint32
spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1
*info
)
3353 size
+=size_of_relative_string( &info
->name
);
3358 /*******************************************************************
3359 return the size required by a struct in the stream
3360 ********************************************************************/
3362 uint32
spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1
*info
)
3365 size
+=size_of_relative_string( &info
->name
);
3370 /*******************************************************************
3371 return the size required by a struct in the stream
3372 ********************************************************************/
3373 uint32
spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES
*p
)
3380 /* uint32(offset) + uint32(length) + length) */
3381 size
+= (size_of_uint32(&p
->value_len
)*2) + p
->value_len
;
3382 size
+= (size_of_uint32(&p
->data_len
)*2) + p
->data_len
+ (p
->data_len
%2) ;
3384 size
+= size_of_uint32(&p
->type
);
3389 /*******************************************************************
3390 return the size required by a struct in the stream
3391 ********************************************************************/
3393 uint32
spoolss_size_printmonitor_info_1(PRINTMONITOR_1
*info
)
3396 size
+=size_of_relative_string( &info
->name
);
3401 /*******************************************************************
3402 return the size required by a struct in the stream
3403 ********************************************************************/
3405 uint32
spoolss_size_printmonitor_info_2(PRINTMONITOR_2
*info
)
3408 size
+=size_of_relative_string( &info
->name
);
3409 size
+=size_of_relative_string( &info
->environment
);
3410 size
+=size_of_relative_string( &info
->dll_name
);
3415 /*******************************************************************
3417 ********************************************************************/
3419 BOOL
make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2
*q_u
,
3420 const POLICY_HND
*hnd
,
3421 const fstring architecture
,
3422 uint32 level
, uint32 clientmajor
, uint32 clientminor
,
3423 RPC_BUFFER
*buffer
, uint32 offered
)
3428 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3430 init_buf_unistr2(&q_u
->architecture
, &q_u
->architecture_ptr
, architecture
);
3433 q_u
->clientmajorversion
=clientmajor
;
3434 q_u
->clientminorversion
=clientminor
;
3437 q_u
->offered
=offered
;
3442 /*******************************************************************
3444 * called from spoolss_getprinterdriver2 (srv_spoolss.c)
3445 ********************************************************************/
3447 BOOL
spoolss_io_q_getprinterdriver2(const char *desc
, SPOOL_Q_GETPRINTERDRIVER2
*q_u
, prs_struct
*ps
, int depth
)
3449 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdriver2");
3455 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3457 if(!prs_uint32("architecture_ptr", ps
, depth
, &q_u
->architecture_ptr
))
3459 if(!smb_io_unistr2("architecture", &q_u
->architecture
, q_u
->architecture_ptr
, ps
, depth
))
3464 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3467 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3473 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3476 if(!prs_uint32("clientmajorversion", ps
, depth
, &q_u
->clientmajorversion
))
3478 if(!prs_uint32("clientminorversion", ps
, depth
, &q_u
->clientminorversion
))
3484 /*******************************************************************
3486 * called from spoolss_getprinterdriver2 (srv_spoolss.c)
3487 ********************************************************************/
3489 BOOL
spoolss_io_r_getprinterdriver2(const char *desc
, SPOOL_R_GETPRINTERDRIVER2
*r_u
, prs_struct
*ps
, int depth
)
3491 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdriver2");
3497 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3502 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3504 if (!prs_uint32("servermajorversion", ps
, depth
, &r_u
->servermajorversion
))
3506 if (!prs_uint32("serverminorversion", ps
, depth
, &r_u
->serverminorversion
))
3508 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3514 /*******************************************************************
3516 ********************************************************************/
3518 BOOL
make_spoolss_q_enumprinters(
3519 SPOOL_Q_ENUMPRINTERS
*q_u
,
3529 q_u
->servername_ptr
= (servername
!= NULL
) ? 1 : 0;
3530 init_buf_unistr2(&q_u
->servername
, &q_u
->servername_ptr
, servername
);
3534 q_u
->offered
=offered
;
3539 /*******************************************************************
3541 ********************************************************************/
3543 BOOL
make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS
*q_u
,
3544 fstring servername
, uint32 level
,
3545 RPC_BUFFER
*buffer
, uint32 offered
)
3547 q_u
->name_ptr
= (servername
!= NULL
) ? 1 : 0;
3548 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, servername
);
3552 q_u
->offered
=offered
;
3557 /*******************************************************************
3559 * called from spoolss_enumprinters (srv_spoolss.c)
3560 ********************************************************************/
3562 BOOL
spoolss_io_q_enumprinters(const char *desc
, SPOOL_Q_ENUMPRINTERS
*q_u
, prs_struct
*ps
, int depth
)
3564 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinters");
3570 if (!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
3572 if (!prs_uint32("servername_ptr", ps
, depth
, &q_u
->servername_ptr
))
3575 if (!smb_io_unistr2("", &q_u
->servername
, q_u
->servername_ptr
, ps
, depth
))
3580 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
3583 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3588 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3594 /*******************************************************************
3595 Parse a SPOOL_R_ENUMPRINTERS structure.
3596 ********************************************************************/
3598 BOOL
spoolss_io_r_enumprinters(const char *desc
, SPOOL_R_ENUMPRINTERS
*r_u
, prs_struct
*ps
, int depth
)
3600 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinters");
3606 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3612 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3615 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
3618 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3624 /*******************************************************************
3625 * write a structure.
3626 * called from spoolss_r_enum_printers (srv_spoolss.c)
3628 ********************************************************************/
3630 BOOL
spoolss_io_r_getprinter(const char *desc
, SPOOL_R_GETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
3632 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinter");
3638 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3644 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3647 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3653 /*******************************************************************
3655 * called from spoolss_getprinter (srv_spoolss.c)
3656 ********************************************************************/
3658 BOOL
spoolss_io_q_getprinter(const char *desc
, SPOOL_Q_GETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
3660 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinter");
3666 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3668 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
3671 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3676 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3682 /*******************************************************************
3684 ********************************************************************/
3686 BOOL
make_spoolss_q_getprinter(
3687 TALLOC_CTX
*mem_ctx
,
3688 SPOOL_Q_GETPRINTER
*q_u
,
3689 const POLICY_HND
*hnd
,
3699 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3703 q_u
->offered
=offered
;
3708 /*******************************************************************
3710 ********************************************************************/
3711 BOOL
make_spoolss_q_setprinter(TALLOC_CTX
*mem_ctx
, SPOOL_Q_SETPRINTER
*q_u
,
3712 const POLICY_HND
*hnd
, uint32 level
, PRINTER_INFO_CTR
*info
,
3716 DEVICEMODE
*devmode
;
3721 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3724 q_u
->info
.level
= level
;
3725 q_u
->info
.info_ptr
= (info
!= NULL
) ? 1 : 0;
3728 /* There's no such thing as a setprinter level 1 */
3731 secdesc
= info
->printers_2
->secdesc
;
3732 devmode
= info
->printers_2
->devmode
;
3734 make_spoolss_printer_info_2 (mem_ctx
, &q_u
->info
.info_2
, info
->printers_2
);
3735 #if 1 /* JERRY TEST */
3736 q_u
->secdesc_ctr
= SMB_MALLOC_P(SEC_DESC_BUF
);
3737 if (!q_u
->secdesc_ctr
)
3739 q_u
->secdesc_ctr
->ptr
= (secdesc
!= NULL
) ? 1: 0;
3740 q_u
->secdesc_ctr
->max_len
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3741 q_u
->secdesc_ctr
->len
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3742 q_u
->secdesc_ctr
->sec
= secdesc
;
3744 q_u
->devmode_ctr
.devmode_ptr
= (devmode
!= NULL
) ? 1 : 0;
3745 q_u
->devmode_ctr
.size
= (devmode
!= NULL
) ? sizeof(DEVICEMODE
) + (3*sizeof(uint32
)) : 0;
3746 q_u
->devmode_ctr
.devmode
= devmode
;
3748 q_u
->secdesc_ctr
= NULL
;
3750 q_u
->devmode_ctr
.devmode_ptr
= 0;
3751 q_u
->devmode_ctr
.size
= 0;
3752 q_u
->devmode_ctr
.devmode
= NULL
;
3756 secdesc
= info
->printers_3
->secdesc
;
3758 make_spoolss_printer_info_3 (mem_ctx
, &q_u
->info
.info_3
, info
->printers_3
);
3760 q_u
->secdesc_ctr
= SMB_MALLOC_P(SEC_DESC_BUF
);
3761 if (!q_u
->secdesc_ctr
)
3763 q_u
->secdesc_ctr
->ptr
= (secdesc
!= NULL
) ? 1: 0;
3764 q_u
->secdesc_ctr
->max_len
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3765 q_u
->secdesc_ctr
->len
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3766 q_u
->secdesc_ctr
->sec
= secdesc
;
3770 make_spoolss_printer_info_7 (mem_ctx
, &q_u
->info
.info_7
, info
->printers_7
);
3774 DEBUG(0,("make_spoolss_q_setprinter: Unknown info level [%d]\n", level
));
3779 q_u
->command
= command
;
3785 /*******************************************************************
3786 ********************************************************************/
3788 BOOL
spoolss_io_r_setprinter(const char *desc
, SPOOL_R_SETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
3790 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinter");
3796 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3802 /*******************************************************************
3803 Marshall/unmarshall a SPOOL_Q_SETPRINTER struct.
3804 ********************************************************************/
3806 BOOL
spoolss_io_q_setprinter(const char *desc
, SPOOL_Q_SETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
3808 uint32 ptr_sec_desc
= 0;
3810 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinter");
3816 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
,ps
, depth
))
3818 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3821 /* check for supported levels and structures we know about */
3823 switch ( q_u
->level
) {
3828 /* supported levels */
3831 DEBUG(0,("spoolss_io_q_setprinter: unsupported printer info level [%d]\n",
3837 if(!spool_io_printer_info_level("", &q_u
->info
, ps
, depth
))
3840 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
3850 ptr_sec_desc
= q_u
->info
.info_2
->secdesc_ptr
;
3855 ptr_sec_desc
= q_u
->info
.info_3
->secdesc_ptr
;
3861 if (!sec_io_desc_buf(desc
, &q_u
->secdesc_ctr
, ps
, depth
))
3866 /* Parse a NULL security descriptor. This should really
3867 happen inside the sec_io_desc_buf() function. */
3869 prs_debug(ps
, depth
, "", "sec_io_desc_buf");
3870 if (!prs_uint32("size", ps
, depth
+ 1, &dummy
))
3872 if (!prs_uint32("ptr", ps
, depth
+ 1, &dummy
)) return
3876 if(!prs_uint32("command", ps
, depth
, &q_u
->command
))
3882 /*******************************************************************
3883 ********************************************************************/
3885 BOOL
spoolss_io_r_fcpn(const char *desc
, SPOOL_R_FCPN
*r_u
, prs_struct
*ps
, int depth
)
3887 prs_debug(ps
, depth
, desc
, "spoolss_io_r_fcpn");
3893 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3899 /*******************************************************************
3900 ********************************************************************/
3902 BOOL
spoolss_io_q_fcpn(const char *desc
, SPOOL_Q_FCPN
*q_u
, prs_struct
*ps
, int depth
)
3905 prs_debug(ps
, depth
, desc
, "spoolss_io_q_fcpn");
3911 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
3918 /*******************************************************************
3919 ********************************************************************/
3921 BOOL
spoolss_io_r_addjob(const char *desc
, SPOOL_R_ADDJOB
*r_u
, prs_struct
*ps
, int depth
)
3923 prs_debug(ps
, depth
, desc
, "");
3929 if(!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3935 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3938 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3944 /*******************************************************************
3945 ********************************************************************/
3947 BOOL
spoolss_io_q_addjob(const char *desc
, SPOOL_Q_ADDJOB
*q_u
, prs_struct
*ps
, int depth
)
3949 prs_debug(ps
, depth
, desc
, "");
3955 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3957 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3960 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3966 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3972 /*******************************************************************
3973 ********************************************************************/
3975 BOOL
spoolss_io_r_enumjobs(const char *desc
, SPOOL_R_ENUMJOBS
*r_u
, prs_struct
*ps
, int depth
)
3977 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumjobs");
3983 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3989 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3992 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
3995 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4001 /*******************************************************************
4002 ********************************************************************/
4004 BOOL
make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS
*q_u
, const POLICY_HND
*hnd
,
4015 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
4016 q_u
->firstjob
= firstjob
;
4017 q_u
->numofjobs
= numofjobs
;
4019 q_u
->buffer
= buffer
;
4020 q_u
->offered
= offered
;
4024 /*******************************************************************
4025 ********************************************************************/
4027 BOOL
spoolss_io_q_enumjobs(const char *desc
, SPOOL_Q_ENUMJOBS
*q_u
, prs_struct
*ps
, int depth
)
4029 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumjobs");
4035 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
, ps
, depth
))
4038 if (!prs_uint32("firstjob", ps
, depth
, &q_u
->firstjob
))
4040 if (!prs_uint32("numofjobs", ps
, depth
, &q_u
->numofjobs
))
4042 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4045 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4051 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4057 /*******************************************************************
4058 ********************************************************************/
4060 BOOL
spoolss_io_r_schedulejob(const char *desc
, SPOOL_R_SCHEDULEJOB
*r_u
, prs_struct
*ps
, int depth
)
4062 prs_debug(ps
, depth
, desc
, "spoolss_io_r_schedulejob");
4068 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4074 /*******************************************************************
4075 ********************************************************************/
4077 BOOL
spoolss_io_q_schedulejob(const char *desc
, SPOOL_Q_SCHEDULEJOB
*q_u
, prs_struct
*ps
, int depth
)
4079 prs_debug(ps
, depth
, desc
, "spoolss_io_q_schedulejob");
4085 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4087 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
4093 /*******************************************************************
4094 ********************************************************************/
4096 BOOL
spoolss_io_r_setjob(const char *desc
, SPOOL_R_SETJOB
*r_u
, prs_struct
*ps
, int depth
)
4098 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setjob");
4104 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4110 /*******************************************************************
4111 ********************************************************************/
4113 BOOL
spoolss_io_q_setjob(const char *desc
, SPOOL_Q_SETJOB
*q_u
, prs_struct
*ps
, int depth
)
4115 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setjob");
4121 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4123 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
4126 * level is usually 0. If (level!=0) then I'm in trouble !
4127 * I will try to generate setjob command with level!=0, one day.
4129 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
4131 if(!prs_uint32("command", ps
, depth
, &q_u
->command
))
4137 /*******************************************************************
4138 Parse a SPOOL_R_ENUMPRINTERDRIVERS structure.
4139 ********************************************************************/
4141 BOOL
spoolss_io_r_enumprinterdrivers(const char *desc
, SPOOL_R_ENUMPRINTERDRIVERS
*r_u
, prs_struct
*ps
, int depth
)
4143 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdrivers");
4149 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4155 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4158 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4161 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4167 /*******************************************************************
4169 ********************************************************************/
4171 BOOL
make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS
*q_u
,
4173 const char *environment
,
4175 RPC_BUFFER
*buffer
, uint32 offered
)
4177 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, name
);
4178 init_buf_unistr2(&q_u
->environment
, &q_u
->environment_ptr
, environment
);
4182 q_u
->offered
=offered
;
4187 /*******************************************************************
4188 Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure.
4189 ********************************************************************/
4191 BOOL
spoolss_io_q_enumprinterdrivers(const char *desc
, SPOOL_Q_ENUMPRINTERDRIVERS
*q_u
, prs_struct
*ps
, int depth
)
4194 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdrivers");
4200 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
4202 if (!smb_io_unistr2("", &q_u
->name
, q_u
->name_ptr
,ps
, depth
))
4207 if (!prs_uint32("environment_ptr", ps
, depth
, &q_u
->environment_ptr
))
4209 if (!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
4214 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4217 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4223 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4229 /*******************************************************************
4230 ********************************************************************/
4232 BOOL
spoolss_io_q_enumforms(const char *desc
, SPOOL_Q_ENUMFORMS
*q_u
, prs_struct
*ps
, int depth
)
4235 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumforms");
4240 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4242 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4245 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4250 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4256 /*******************************************************************
4257 ********************************************************************/
4259 BOOL
spoolss_io_r_enumforms(const char *desc
, SPOOL_R_ENUMFORMS
*r_u
, prs_struct
*ps
, int depth
)
4261 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumforms");
4267 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4273 if (!prs_uint32("size of buffer needed", ps
, depth
, &r_u
->needed
))
4276 if (!prs_uint32("numofforms", ps
, depth
, &r_u
->numofforms
))
4279 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4285 /*******************************************************************
4286 ********************************************************************/
4288 BOOL
spoolss_io_q_getform(const char *desc
, SPOOL_Q_GETFORM
*q_u
, prs_struct
*ps
, int depth
)
4291 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getform");
4296 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4298 if (!smb_io_unistr2("", &q_u
->formname
,True
,ps
,depth
))
4304 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4307 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4312 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4318 /*******************************************************************
4319 ********************************************************************/
4321 BOOL
spoolss_io_r_getform(const char *desc
, SPOOL_R_GETFORM
*r_u
, prs_struct
*ps
, int depth
)
4323 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getform");
4329 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4335 if (!prs_uint32("size of buffer needed", ps
, depth
, &r_u
->needed
))
4338 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4344 /*******************************************************************
4345 Parse a SPOOL_R_ENUMPORTS structure.
4346 ********************************************************************/
4348 BOOL
spoolss_io_r_enumports(const char *desc
, SPOOL_R_ENUMPORTS
*r_u
, prs_struct
*ps
, int depth
)
4350 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumports");
4356 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4362 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4365 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4368 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4374 /*******************************************************************
4375 ********************************************************************/
4377 BOOL
spoolss_io_q_enumports(const char *desc
, SPOOL_Q_ENUMPORTS
*q_u
, prs_struct
*ps
, int depth
)
4379 prs_debug(ps
, depth
, desc
, "");
4385 if (!prs_uint32("", ps
, depth
, &q_u
->name_ptr
))
4387 if (!smb_io_unistr2("", &q_u
->name
,True
,ps
,depth
))
4392 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4395 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4400 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4406 /*******************************************************************
4407 Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure.
4408 ********************************************************************/
4410 BOOL
spool_io_printer_info_level_1(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_1
*il
, prs_struct
*ps
, int depth
)
4412 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_1");
4418 if(!prs_uint32("flags", ps
, depth
, &il
->flags
))
4420 if(!prs_uint32("description_ptr", ps
, depth
, &il
->description_ptr
))
4422 if(!prs_uint32("name_ptr", ps
, depth
, &il
->name_ptr
))
4424 if(!prs_uint32("comment_ptr", ps
, depth
, &il
->comment_ptr
))
4427 if(!smb_io_unistr2("description", &il
->description
, il
->description_ptr
, ps
, depth
))
4429 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4431 if(!smb_io_unistr2("comment", &il
->comment
, il
->comment_ptr
, ps
, depth
))
4437 /*******************************************************************
4438 Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure.
4439 ********************************************************************/
4441 BOOL
spool_io_printer_info_level_3(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_3
*il
, prs_struct
*ps
, int depth
)
4443 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_3");
4449 if(!prs_uint32("secdesc_ptr", ps
, depth
, &il
->secdesc_ptr
))
4455 /*******************************************************************
4456 Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure.
4457 ********************************************************************/
4459 BOOL
spool_io_printer_info_level_2(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_2
*il
, prs_struct
*ps
, int depth
)
4461 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_2");
4467 if(!prs_uint32("servername_ptr", ps
, depth
, &il
->servername_ptr
))
4469 if(!prs_uint32("printername_ptr", ps
, depth
, &il
->printername_ptr
))
4471 if(!prs_uint32("sharename_ptr", ps
, depth
, &il
->sharename_ptr
))
4473 if(!prs_uint32("portname_ptr", ps
, depth
, &il
->portname_ptr
))
4476 if(!prs_uint32("drivername_ptr", ps
, depth
, &il
->drivername_ptr
))
4478 if(!prs_uint32("comment_ptr", ps
, depth
, &il
->comment_ptr
))
4480 if(!prs_uint32("location_ptr", ps
, depth
, &il
->location_ptr
))
4482 if(!prs_uint32("devmode_ptr", ps
, depth
, &il
->devmode_ptr
))
4484 if(!prs_uint32("sepfile_ptr", ps
, depth
, &il
->sepfile_ptr
))
4486 if(!prs_uint32("printprocessor_ptr", ps
, depth
, &il
->printprocessor_ptr
))
4488 if(!prs_uint32("datatype_ptr", ps
, depth
, &il
->datatype_ptr
))
4490 if(!prs_uint32("parameters_ptr", ps
, depth
, &il
->parameters_ptr
))
4492 if(!prs_uint32("secdesc_ptr", ps
, depth
, &il
->secdesc_ptr
))
4495 if(!prs_uint32("attributes", ps
, depth
, &il
->attributes
))
4497 if(!prs_uint32("priority", ps
, depth
, &il
->priority
))
4499 if(!prs_uint32("default_priority", ps
, depth
, &il
->default_priority
))
4501 if(!prs_uint32("starttime", ps
, depth
, &il
->starttime
))
4503 if(!prs_uint32("untiltime", ps
, depth
, &il
->untiltime
))
4505 if(!prs_uint32("status", ps
, depth
, &il
->status
))
4507 if(!prs_uint32("cjobs", ps
, depth
, &il
->cjobs
))
4509 if(!prs_uint32("averageppm", ps
, depth
, &il
->averageppm
))
4512 if(!smb_io_unistr2("servername", &il
->servername
, il
->servername_ptr
, ps
, depth
))
4514 if(!smb_io_unistr2("printername", &il
->printername
, il
->printername_ptr
, ps
, depth
))
4516 if(!smb_io_unistr2("sharename", &il
->sharename
, il
->sharename_ptr
, ps
, depth
))
4518 if(!smb_io_unistr2("portname", &il
->portname
, il
->portname_ptr
, ps
, depth
))
4520 if(!smb_io_unistr2("drivername", &il
->drivername
, il
->drivername_ptr
, ps
, depth
))
4522 if(!smb_io_unistr2("comment", &il
->comment
, il
->comment_ptr
, ps
, depth
))
4524 if(!smb_io_unistr2("location", &il
->location
, il
->location_ptr
, ps
, depth
))
4526 if(!smb_io_unistr2("sepfile", &il
->sepfile
, il
->sepfile_ptr
, ps
, depth
))
4528 if(!smb_io_unistr2("printprocessor", &il
->printprocessor
, il
->printprocessor_ptr
, ps
, depth
))
4530 if(!smb_io_unistr2("datatype", &il
->datatype
, il
->datatype_ptr
, ps
, depth
))
4532 if(!smb_io_unistr2("parameters", &il
->parameters
, il
->parameters_ptr
, ps
, depth
))
4538 BOOL
spool_io_printer_info_level_7(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_7
*il
, prs_struct
*ps
, int depth
)
4540 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_7");
4546 if(!prs_uint32("guid_ptr", ps
, depth
, &il
->guid_ptr
))
4548 if(!prs_uint32("action", ps
, depth
, &il
->action
))
4551 if(!smb_io_unistr2("servername", &il
->guid
, il
->guid_ptr
, ps
, depth
))
4556 /*******************************************************************
4557 ********************************************************************/
4559 BOOL
spool_io_printer_info_level(const char *desc
, SPOOL_PRINTER_INFO_LEVEL
*il
, prs_struct
*ps
, int depth
)
4561 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level");
4566 if(!prs_uint32("level", ps
, depth
, &il
->level
))
4568 if(!prs_uint32("info_ptr", ps
, depth
, &il
->info_ptr
))
4571 /* if no struct inside just return */
4572 if (il
->info_ptr
==0) {
4573 if (UNMARSHALLING(ps
)) {
4580 switch (il
->level
) {
4582 * level 0 is used by setprinter when managing the queue
4583 * (hold, stop, start a queue)
4587 /* DOCUMENT ME!!! What is level 1 used for? */
4590 if (UNMARSHALLING(ps
)) {
4591 if ((il
->info_1
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_1
,1)) == NULL
)
4594 if (!spool_io_printer_info_level_1("", il
->info_1
, ps
, depth
))
4599 * level 2 is used by addprinter
4600 * and by setprinter when updating printer's info
4603 if (UNMARSHALLING(ps
)) {
4604 if ((il
->info_2
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_2
,1)) == NULL
)
4607 if (!spool_io_printer_info_level_2("", il
->info_2
, ps
, depth
))
4610 /* DOCUMENT ME!!! What is level 3 used for? */
4613 if (UNMARSHALLING(ps
)) {
4614 if ((il
->info_3
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_3
,1)) == NULL
)
4617 if (!spool_io_printer_info_level_3("", il
->info_3
, ps
, depth
))
4622 if (UNMARSHALLING(ps
))
4623 if ((il
->info_7
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_7
,1)) == NULL
)
4625 if (!spool_io_printer_info_level_7("", il
->info_7
, ps
, depth
))
4633 /*******************************************************************
4634 ********************************************************************/
4636 BOOL
spoolss_io_q_addprinterex(const char *desc
, SPOOL_Q_ADDPRINTEREX
*q_u
, prs_struct
*ps
, int depth
)
4638 uint32 ptr_sec_desc
= 0;
4640 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterex");
4646 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->server_name
))
4648 if (!prs_io_unistr2("servername", ps
, depth
, q_u
->server_name
))
4654 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
4657 if(!spool_io_printer_info_level("", &q_u
->info
, ps
, depth
))
4660 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
4666 switch (q_u
->level
) {
4668 ptr_sec_desc
= q_u
->info
.info_2
->secdesc_ptr
;
4671 ptr_sec_desc
= q_u
->info
.info_3
->secdesc_ptr
;
4675 if (!sec_io_desc_buf(desc
, &q_u
->secdesc_ctr
, ps
, depth
))
4680 /* Parse a NULL security descriptor. This should really
4681 happen inside the sec_io_desc_buf() function. */
4683 prs_debug(ps
, depth
, "", "sec_io_desc_buf");
4684 if (!prs_uint32("size", ps
, depth
+ 1, &dummy
))
4686 if (!prs_uint32("ptr", ps
, depth
+ 1, &dummy
))
4690 if(!prs_uint32("user_switch", ps
, depth
, &q_u
->user_switch
))
4692 if(!spool_io_user_level("", &q_u
->user_ctr
, ps
, depth
))
4698 /*******************************************************************
4699 ********************************************************************/
4701 BOOL
spoolss_io_r_addprinterex(const char *desc
, SPOOL_R_ADDPRINTEREX
*r_u
,
4702 prs_struct
*ps
, int depth
)
4704 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterex");
4707 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
4710 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4716 /*******************************************************************
4717 ********************************************************************/
4719 BOOL
spool_io_printer_driver_info_level_3(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
**q_u
,
4720 prs_struct
*ps
, int depth
)
4722 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*il
;
4724 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level_3");
4728 if (UNMARSHALLING(ps
)) {
4729 il
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
,1);
4741 if(!prs_uint32("cversion", ps
, depth
, &il
->cversion
))
4743 if(!prs_uint32("name", ps
, depth
, &il
->name_ptr
))
4745 if(!prs_uint32("environment", ps
, depth
, &il
->environment_ptr
))
4747 if(!prs_uint32("driverpath", ps
, depth
, &il
->driverpath_ptr
))
4749 if(!prs_uint32("datafile", ps
, depth
, &il
->datafile_ptr
))
4751 if(!prs_uint32("configfile", ps
, depth
, &il
->configfile_ptr
))
4753 if(!prs_uint32("helpfile", ps
, depth
, &il
->helpfile_ptr
))
4755 if(!prs_uint32("monitorname", ps
, depth
, &il
->monitorname_ptr
))
4757 if(!prs_uint32("defaultdatatype", ps
, depth
, &il
->defaultdatatype_ptr
))
4759 if(!prs_uint32("dependentfilessize", ps
, depth
, &il
->dependentfilessize
))
4761 if(!prs_uint32("dependentfiles", ps
, depth
, &il
->dependentfiles_ptr
))
4767 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4769 if(!smb_io_unistr2("environment", &il
->environment
, il
->environment_ptr
, ps
, depth
))
4771 if(!smb_io_unistr2("driverpath", &il
->driverpath
, il
->driverpath_ptr
, ps
, depth
))
4773 if(!smb_io_unistr2("datafile", &il
->datafile
, il
->datafile_ptr
, ps
, depth
))
4775 if(!smb_io_unistr2("configfile", &il
->configfile
, il
->configfile_ptr
, ps
, depth
))
4777 if(!smb_io_unistr2("helpfile", &il
->helpfile
, il
->helpfile_ptr
, ps
, depth
))
4779 if(!smb_io_unistr2("monitorname", &il
->monitorname
, il
->monitorname_ptr
, ps
, depth
))
4781 if(!smb_io_unistr2("defaultdatatype", &il
->defaultdatatype
, il
->defaultdatatype_ptr
, ps
, depth
))
4787 if (il
->dependentfiles_ptr
)
4788 smb_io_buffer5("", &il
->dependentfiles
, ps
, depth
);
4793 /*******************************************************************
4794 parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure
4795 ********************************************************************/
4797 BOOL
spool_io_printer_driver_info_level_6(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
**q_u
,
4798 prs_struct
*ps
, int depth
)
4800 SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
*il
;
4802 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level_6");
4806 if (UNMARSHALLING(ps
)) {
4807 il
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
,1);
4820 * I know this seems weird, but I have no other explanation.
4821 * This is observed behavior on both NT4 and 2K servers.
4825 if (!prs_align_uint64(ps
))
4828 /* parse the main elements the packet */
4830 if(!prs_uint32("cversion ", ps
, depth
, &il
->version
))
4832 if(!prs_uint32("name ", ps
, depth
, &il
->name_ptr
))
4834 if(!prs_uint32("environment ", ps
, depth
, &il
->environment_ptr
))
4836 if(!prs_uint32("driverpath ", ps
, depth
, &il
->driverpath_ptr
))
4838 if(!prs_uint32("datafile ", ps
, depth
, &il
->datafile_ptr
))
4840 if(!prs_uint32("configfile ", ps
, depth
, &il
->configfile_ptr
))
4842 if(!prs_uint32("helpfile ", ps
, depth
, &il
->helpfile_ptr
))
4844 if(!prs_uint32("monitorname ", ps
, depth
, &il
->monitorname_ptr
))
4846 if(!prs_uint32("defaultdatatype", ps
, depth
, &il
->defaultdatatype_ptr
))
4848 if(!prs_uint32("dependentfiles ", ps
, depth
, &il
->dependentfiles_len
))
4850 if(!prs_uint32("dependentfiles ", ps
, depth
, &il
->dependentfiles_ptr
))
4852 if(!prs_uint32("previousnames ", ps
, depth
, &il
->previousnames_len
))
4854 if(!prs_uint32("previousnames ", ps
, depth
, &il
->previousnames_ptr
))
4856 if(!smb_io_time("driverdate ", &il
->driverdate
, ps
, depth
))
4858 if(!prs_uint32("dummy4 ", ps
, depth
, &il
->dummy4
))
4860 if(!prs_uint64("driverversion ", ps
, depth
, &il
->driverversion
))
4862 if(!prs_uint32("mfgname ", ps
, depth
, &il
->mfgname_ptr
))
4864 if(!prs_uint32("oemurl ", ps
, depth
, &il
->oemurl_ptr
))
4866 if(!prs_uint32("hardwareid ", ps
, depth
, &il
->hardwareid_ptr
))
4868 if(!prs_uint32("provider ", ps
, depth
, &il
->provider_ptr
))
4871 /* parse the structures in the packet */
4873 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4878 if(!smb_io_unistr2("environment", &il
->environment
, il
->environment_ptr
, ps
, depth
))
4883 if(!smb_io_unistr2("driverpath", &il
->driverpath
, il
->driverpath_ptr
, ps
, depth
))
4888 if(!smb_io_unistr2("datafile", &il
->datafile
, il
->datafile_ptr
, ps
, depth
))
4893 if(!smb_io_unistr2("configfile", &il
->configfile
, il
->configfile_ptr
, ps
, depth
))
4898 if(!smb_io_unistr2("helpfile", &il
->helpfile
, il
->helpfile_ptr
, ps
, depth
))
4903 if(!smb_io_unistr2("monitorname", &il
->monitorname
, il
->monitorname_ptr
, ps
, depth
))
4908 if(!smb_io_unistr2("defaultdatatype", &il
->defaultdatatype
, il
->defaultdatatype_ptr
, ps
, depth
))
4912 if (il
->dependentfiles_ptr
) {
4913 if(!smb_io_buffer5("dependentfiles", &il
->dependentfiles
, ps
, depth
))
4918 if (il
->previousnames_ptr
) {
4919 if(!smb_io_buffer5("previousnames", &il
->previousnames
, ps
, depth
))
4924 if(!smb_io_unistr2("mfgname", &il
->mfgname
, il
->mfgname_ptr
, ps
, depth
))
4928 if(!smb_io_unistr2("oemurl", &il
->oemurl
, il
->oemurl_ptr
, ps
, depth
))
4932 if(!smb_io_unistr2("hardwareid", &il
->hardwareid
, il
->hardwareid_ptr
, ps
, depth
))
4936 if(!smb_io_unistr2("provider", &il
->provider
, il
->provider_ptr
, ps
, depth
))
4942 /*******************************************************************
4943 convert a buffer of UNICODE strings null terminated
4944 the buffer is terminated by a NULL
4946 convert to an dos codepage array (null terminated)
4948 dynamically allocate memory
4950 ********************************************************************/
4951 static BOOL
uniarray_2_dosarray(BUFFER5
*buf5
, fstring
**ar
)
4960 src
= (char *)buf5
->buffer
;
4963 while (src
< ((char *)buf5
->buffer
) + buf5
->buf_len
*2) {
4964 rpcstr_pull(f
, src
, sizeof(f
)-1, -1, STR_TERMINATE
);
4965 src
= skip_unibuf(src
, 2*buf5
->buf_len
- PTR_DIFF(src
,buf5
->buffer
));
4966 tar
= SMB_REALLOC_ARRAY(*ar
, fstring
, n
+2);
4971 fstrcpy((*ar
)[n
], f
);
4974 fstrcpy((*ar
)[n
], "");
4982 /*******************************************************************
4983 read a UNICODE array with null terminated strings
4984 and null terminated array
4985 and size of array at beginning
4986 ********************************************************************/
4988 BOOL
smb_io_unibuffer(const char *desc
, UNISTR2
*buffer
, prs_struct
*ps
, int depth
)
4990 if (buffer
==NULL
) return False
;
4993 buffer
->uni_str_len
=buffer
->uni_max_len
;
4995 if(!prs_uint32("buffer_size", ps
, depth
, &buffer
->uni_max_len
))
4998 if(!prs_unistr2(True
, "buffer ", ps
, depth
, buffer
))
5004 /*******************************************************************
5005 ********************************************************************/
5007 BOOL
spool_io_printer_driver_info_level(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL
*il
, prs_struct
*ps
, int depth
)
5009 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level");
5014 if(!prs_uint32("level", ps
, depth
, &il
->level
))
5016 if(!prs_uint32("ptr", ps
, depth
, &il
->ptr
))
5022 switch (il
->level
) {
5024 if(!spool_io_printer_driver_info_level_3("", &il
->info_3
, ps
, depth
))
5028 if(!spool_io_printer_driver_info_level_6("", &il
->info_6
, ps
, depth
))
5038 /*******************************************************************
5039 init a SPOOL_Q_ADDPRINTERDRIVER struct
5040 ******************************************************************/
5042 BOOL
make_spoolss_q_addprinterdriver(TALLOC_CTX
*mem_ctx
,
5043 SPOOL_Q_ADDPRINTERDRIVER
*q_u
, const char* srv_name
,
5044 uint32 level
, PRINTER_DRIVER_CTR
*info
)
5046 DEBUG(5,("make_spoolss_q_addprinterdriver\n"));
5048 q_u
->server_name_ptr
= (srv_name
!=NULL
)?1:0;
5049 init_unistr2(&q_u
->server_name
, srv_name
, UNI_STR_TERMINATE
);
5053 q_u
->info
.level
= level
;
5054 q_u
->info
.ptr
= (info
!=NULL
)?1:0;
5057 /* info level 3 is supported by Windows 95/98, WinNT and Win2k */
5059 make_spoolss_driver_info_3(mem_ctx
, &q_u
->info
.info_3
, info
->info3
);
5063 DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level
));
5070 BOOL
make_spoolss_driver_info_3(TALLOC_CTX
*mem_ctx
,
5071 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
**spool_drv_info
,
5072 DRIVER_INFO_3
*info3
)
5075 uint16
*ptr
= info3
->dependentfiles
;
5077 BOOL null_char
= False
;
5078 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*inf
;
5080 if (!(inf
=TALLOC_ZERO_P(mem_ctx
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
)))
5083 inf
->cversion
= info3
->version
;
5084 inf
->name_ptr
= (info3
->name
.buffer
!=NULL
)?1:0;
5085 inf
->environment_ptr
= (info3
->architecture
.buffer
!=NULL
)?1:0;
5086 inf
->driverpath_ptr
= (info3
->driverpath
.buffer
!=NULL
)?1:0;
5087 inf
->datafile_ptr
= (info3
->datafile
.buffer
!=NULL
)?1:0;
5088 inf
->configfile_ptr
= (info3
->configfile
.buffer
!=NULL
)?1:0;
5089 inf
->helpfile_ptr
= (info3
->helpfile
.buffer
!=NULL
)?1:0;
5090 inf
->monitorname_ptr
= (info3
->monitorname
.buffer
!=NULL
)?1:0;
5091 inf
->defaultdatatype_ptr
= (info3
->defaultdatatype
.buffer
!=NULL
)?1:0;
5093 init_unistr2_from_unistr(&inf
->name
, &info3
->name
);
5094 init_unistr2_from_unistr(&inf
->environment
, &info3
->architecture
);
5095 init_unistr2_from_unistr(&inf
->driverpath
, &info3
->driverpath
);
5096 init_unistr2_from_unistr(&inf
->datafile
, &info3
->datafile
);
5097 init_unistr2_from_unistr(&inf
->configfile
, &info3
->configfile
);
5098 init_unistr2_from_unistr(&inf
->helpfile
, &info3
->helpfile
);
5099 init_unistr2_from_unistr(&inf
->monitorname
, &info3
->monitorname
);
5100 init_unistr2_from_unistr(&inf
->defaultdatatype
, &info3
->defaultdatatype
);
5107 /* the null_char BOOL is used to help locate
5108 two '\0's back to back */
5123 inf
->dependentfiles_ptr
= (info3
->dependentfiles
!= NULL
) ? 1 : 0;
5124 inf
->dependentfilessize
= len
;
5125 if(!make_spoolss_buffer5(mem_ctx
, &inf
->dependentfiles
, len
, info3
->dependentfiles
))
5131 *spool_drv_info
= inf
;
5136 /*******************************************************************
5137 make a BUFFER5 struct from a uint16*
5138 ******************************************************************/
5139 BOOL
make_spoolss_buffer5(TALLOC_CTX
*mem_ctx
, BUFFER5
*buf5
, uint32 len
, uint16
*src
)
5142 buf5
->buf_len
= len
;
5143 if((buf5
->buffer
=(uint16
*)TALLOC_MEMDUP(mem_ctx
, src
, sizeof(uint16
)*len
)) == NULL
) {
5144 DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n"));
5151 /*******************************************************************
5152 fill in the prs_struct for a ADDPRINTERDRIVER request PDU
5153 ********************************************************************/
5155 BOOL
spoolss_io_q_addprinterdriver(const char *desc
, SPOOL_Q_ADDPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
5157 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterdriver");
5163 if(!prs_uint32("server_name_ptr", ps
, depth
, &q_u
->server_name_ptr
))
5165 if(!smb_io_unistr2("server_name", &q_u
->server_name
, q_u
->server_name_ptr
, ps
, depth
))
5170 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
5173 if(!spool_io_printer_driver_info_level("", &q_u
->info
, ps
, depth
))
5179 /*******************************************************************
5180 ********************************************************************/
5182 BOOL
spoolss_io_r_addprinterdriver(const char *desc
, SPOOL_R_ADDPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
5184 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterdriver");
5187 if(!prs_werror("status", ps
, depth
, &q_u
->status
))
5193 /*******************************************************************
5194 fill in the prs_struct for a ADDPRINTERDRIVER request PDU
5195 ********************************************************************/
5197 BOOL
spoolss_io_q_addprinterdriverex(const char *desc
, SPOOL_Q_ADDPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
5199 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterdriverex");
5205 if(!prs_uint32("server_name_ptr", ps
, depth
, &q_u
->server_name_ptr
))
5207 if(!smb_io_unistr2("server_name", &q_u
->server_name
, q_u
->server_name_ptr
, ps
, depth
))
5212 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
5215 if(!spool_io_printer_driver_info_level("", &q_u
->info
, ps
, depth
))
5220 if(!prs_uint32("copy flags", ps
, depth
, &q_u
->copy_flags
))
5226 /*******************************************************************
5227 ********************************************************************/
5229 BOOL
spoolss_io_r_addprinterdriverex(const char *desc
, SPOOL_R_ADDPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
5231 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterdriverex");
5234 if(!prs_werror("status", ps
, depth
, &q_u
->status
))
5240 /*******************************************************************
5241 ********************************************************************/
5243 BOOL
uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*uni
,
5244 NT_PRINTER_DRIVER_INFO_LEVEL_3
**asc
)
5246 NT_PRINTER_DRIVER_INFO_LEVEL_3
*d
;
5248 DEBUG(7,("uni_2_asc_printer_driver_3: Converting from UNICODE to ASCII\n"));
5252 *asc
=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_3
);
5260 d
->cversion
=uni
->cversion
;
5262 unistr2_to_ascii(d
->name
, &uni
->name
, sizeof(d
->name
)-1);
5263 unistr2_to_ascii(d
->environment
, &uni
->environment
, sizeof(d
->environment
)-1);
5264 unistr2_to_ascii(d
->driverpath
, &uni
->driverpath
, sizeof(d
->driverpath
)-1);
5265 unistr2_to_ascii(d
->datafile
, &uni
->datafile
, sizeof(d
->datafile
)-1);
5266 unistr2_to_ascii(d
->configfile
, &uni
->configfile
, sizeof(d
->configfile
)-1);
5267 unistr2_to_ascii(d
->helpfile
, &uni
->helpfile
, sizeof(d
->helpfile
)-1);
5268 unistr2_to_ascii(d
->monitorname
, &uni
->monitorname
, sizeof(d
->monitorname
)-1);
5269 unistr2_to_ascii(d
->defaultdatatype
, &uni
->defaultdatatype
, sizeof(d
->defaultdatatype
)-1);
5271 DEBUGADD(8,( "version: %d\n", d
->cversion
));
5272 DEBUGADD(8,( "name: %s\n", d
->name
));
5273 DEBUGADD(8,( "environment: %s\n", d
->environment
));
5274 DEBUGADD(8,( "driverpath: %s\n", d
->driverpath
));
5275 DEBUGADD(8,( "datafile: %s\n", d
->datafile
));
5276 DEBUGADD(8,( "configfile: %s\n", d
->configfile
));
5277 DEBUGADD(8,( "helpfile: %s\n", d
->helpfile
));
5278 DEBUGADD(8,( "monitorname: %s\n", d
->monitorname
));
5279 DEBUGADD(8,( "defaultdatatype: %s\n", d
->defaultdatatype
));
5281 if (uniarray_2_dosarray(&uni
->dependentfiles
, &d
->dependentfiles
))
5288 /*******************************************************************
5289 ********************************************************************/
5290 BOOL
uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
*uni
,
5291 NT_PRINTER_DRIVER_INFO_LEVEL_6
**asc
)
5293 NT_PRINTER_DRIVER_INFO_LEVEL_6
*d
;
5295 DEBUG(7,("uni_2_asc_printer_driver_6: Converting from UNICODE to ASCII\n"));
5299 *asc
=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_6
);
5307 d
->version
=uni
->version
;
5309 unistr2_to_ascii(d
->name
, &uni
->name
, sizeof(d
->name
)-1);
5310 unistr2_to_ascii(d
->environment
, &uni
->environment
, sizeof(d
->environment
)-1);
5311 unistr2_to_ascii(d
->driverpath
, &uni
->driverpath
, sizeof(d
->driverpath
)-1);
5312 unistr2_to_ascii(d
->datafile
, &uni
->datafile
, sizeof(d
->datafile
)-1);
5313 unistr2_to_ascii(d
->configfile
, &uni
->configfile
, sizeof(d
->configfile
)-1);
5314 unistr2_to_ascii(d
->helpfile
, &uni
->helpfile
, sizeof(d
->helpfile
)-1);
5315 unistr2_to_ascii(d
->monitorname
, &uni
->monitorname
, sizeof(d
->monitorname
)-1);
5316 unistr2_to_ascii(d
->defaultdatatype
, &uni
->defaultdatatype
, sizeof(d
->defaultdatatype
)-1);
5318 DEBUGADD(8,( "version: %d\n", d
->version
));
5319 DEBUGADD(8,( "name: %s\n", d
->name
));
5320 DEBUGADD(8,( "environment: %s\n", d
->environment
));
5321 DEBUGADD(8,( "driverpath: %s\n", d
->driverpath
));
5322 DEBUGADD(8,( "datafile: %s\n", d
->datafile
));
5323 DEBUGADD(8,( "configfile: %s\n", d
->configfile
));
5324 DEBUGADD(8,( "helpfile: %s\n", d
->helpfile
));
5325 DEBUGADD(8,( "monitorname: %s\n", d
->monitorname
));
5326 DEBUGADD(8,( "defaultdatatype: %s\n", d
->defaultdatatype
));
5328 if (!uniarray_2_dosarray(&uni
->dependentfiles
, &d
->dependentfiles
))
5330 if (!uniarray_2_dosarray(&uni
->previousnames
, &d
->previousnames
))
5340 BOOL
uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2
*uni
,
5341 NT_PRINTER_INFO_LEVEL_2
**asc
)
5343 NT_PRINTER_INFO_LEVEL_2
*d
;
5346 DEBUG(7,("Converting from UNICODE to ASCII\n"));
5347 time_unix
=time(NULL
);
5350 DEBUGADD(8,("allocating memory\n"));
5352 *asc
=SMB_MALLOC_P(NT_PRINTER_INFO_LEVEL_2
);
5357 /* we allocate memory iff called from
5358 * addprinter(ex) so we can do one time stuff here.
5360 (*asc
)->setuptime
=time_unix
;
5363 DEBUGADD(8,("start converting\n"));
5367 d
->attributes
=uni
->attributes
;
5368 d
->priority
=uni
->priority
;
5369 d
->default_priority
=uni
->default_priority
;
5370 d
->starttime
=uni
->starttime
;
5371 d
->untiltime
=uni
->untiltime
;
5372 d
->status
=uni
->status
;
5373 d
->cjobs
=uni
->cjobs
;
5375 unistr2_to_ascii(d
->servername
, &uni
->servername
, sizeof(d
->servername
)-1);
5376 unistr2_to_ascii(d
->printername
, &uni
->printername
, sizeof(d
->printername
)-1);
5377 unistr2_to_ascii(d
->sharename
, &uni
->sharename
, sizeof(d
->sharename
)-1);
5378 unistr2_to_ascii(d
->portname
, &uni
->portname
, sizeof(d
->portname
)-1);
5379 unistr2_to_ascii(d
->drivername
, &uni
->drivername
, sizeof(d
->drivername
)-1);
5380 unistr2_to_ascii(d
->comment
, &uni
->comment
, sizeof(d
->comment
)-1);
5381 unistr2_to_ascii(d
->location
, &uni
->location
, sizeof(d
->location
)-1);
5382 unistr2_to_ascii(d
->sepfile
, &uni
->sepfile
, sizeof(d
->sepfile
)-1);
5383 unistr2_to_ascii(d
->printprocessor
, &uni
->printprocessor
, sizeof(d
->printprocessor
)-1);
5384 unistr2_to_ascii(d
->datatype
, &uni
->datatype
, sizeof(d
->datatype
)-1);
5385 unistr2_to_ascii(d
->parameters
, &uni
->parameters
, sizeof(d
->parameters
)-1);
5390 /*******************************************************************
5392 ********************************************************************/
5394 BOOL
make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR
*q_u
,
5395 fstring servername
, fstring env_name
, uint32 level
,
5396 RPC_BUFFER
*buffer
, uint32 offered
)
5398 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, servername
);
5399 init_buf_unistr2(&q_u
->environment
, &q_u
->environment_ptr
, env_name
);
5403 q_u
->offered
=offered
;
5408 /*******************************************************************
5409 Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure.
5410 ********************************************************************/
5412 BOOL
spoolss_io_q_getprinterdriverdir(const char *desc
, SPOOL_Q_GETPRINTERDRIVERDIR
*q_u
, prs_struct
*ps
, int depth
)
5414 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdriverdir");
5419 if(!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5421 if(!smb_io_unistr2("", &q_u
->name
, q_u
->name_ptr
, ps
, depth
))
5427 if(!prs_uint32("", ps
, depth
, &q_u
->environment_ptr
))
5429 if(!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
5435 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
5438 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5444 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5450 /*******************************************************************
5451 Parse a SPOOL_R_GETPRINTERDRIVERDIR structure.
5452 ********************************************************************/
5454 BOOL
spoolss_io_r_getprinterdriverdir(const char *desc
, SPOOL_R_GETPRINTERDRIVERDIR
*r_u
, prs_struct
*ps
, int depth
)
5456 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdriverdir");
5462 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5468 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5471 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5477 /*******************************************************************
5478 ********************************************************************/
5480 BOOL
spoolss_io_r_enumprintprocessors(const char *desc
, SPOOL_R_ENUMPRINTPROCESSORS
*r_u
, prs_struct
*ps
, int depth
)
5482 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintprocessors");
5488 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5494 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5497 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5500 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5506 /*******************************************************************
5507 ********************************************************************/
5509 BOOL
spoolss_io_q_enumprintprocessors(const char *desc
, SPOOL_Q_ENUMPRINTPROCESSORS
*q_u
, prs_struct
*ps
, int depth
)
5511 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintprocessors");
5517 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5519 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5525 if (!prs_uint32("", ps
, depth
, &q_u
->environment_ptr
))
5527 if (!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
5533 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5536 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5542 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5548 /*******************************************************************
5549 ********************************************************************/
5551 BOOL
spoolss_io_q_addprintprocessor(const char *desc
, SPOOL_Q_ADDPRINTPROCESSOR
*q_u
, prs_struct
*ps
, int depth
)
5553 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprintprocessor");
5559 if (!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
5561 if (!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
5566 if (!smb_io_unistr2("environment", &q_u
->environment
, True
, ps
, depth
))
5571 if (!smb_io_unistr2("path", &q_u
->path
, True
, ps
, depth
))
5576 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5582 /*******************************************************************
5583 ********************************************************************/
5585 BOOL
spoolss_io_r_addprintprocessor(const char *desc
, SPOOL_R_ADDPRINTPROCESSOR
*r_u
, prs_struct
*ps
, int depth
)
5587 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprintproicessor");
5593 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5599 /*******************************************************************
5600 ********************************************************************/
5602 BOOL
spoolss_io_r_enumprintprocdatatypes(const char *desc
, SPOOL_R_ENUMPRINTPROCDATATYPES
*r_u
, prs_struct
*ps
, int depth
)
5604 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintprocdatatypes");
5610 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5616 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5619 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5622 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5628 /*******************************************************************
5629 ********************************************************************/
5631 BOOL
spoolss_io_q_enumprintprocdatatypes(const char *desc
, SPOOL_Q_ENUMPRINTPROCDATATYPES
*q_u
, prs_struct
*ps
, int depth
)
5633 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintprocdatatypes");
5639 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5641 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5647 if (!prs_uint32("processor_ptr", ps
, depth
, &q_u
->processor_ptr
))
5649 if (!smb_io_unistr2("processor", &q_u
->processor
, q_u
->processor_ptr
, ps
, depth
))
5655 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5658 if(!prs_rpcbuffer_p("buffer", ps
, depth
, &q_u
->buffer
))
5664 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5670 /*******************************************************************
5671 Parse a SPOOL_Q_ENUMPRINTMONITORS structure.
5672 ********************************************************************/
5674 BOOL
spoolss_io_q_enumprintmonitors(const char *desc
, SPOOL_Q_ENUMPRINTMONITORS
*q_u
, prs_struct
*ps
, int depth
)
5676 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintmonitors");
5682 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5684 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5690 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5693 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5699 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5705 /*******************************************************************
5706 ********************************************************************/
5708 BOOL
spoolss_io_r_enumprintmonitors(const char *desc
, SPOOL_R_ENUMPRINTMONITORS
*r_u
, prs_struct
*ps
, int depth
)
5710 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintmonitors");
5716 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5722 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5725 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5728 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5734 /*******************************************************************
5735 ********************************************************************/
5737 BOOL
spoolss_io_r_enumprinterdata(const char *desc
, SPOOL_R_ENUMPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
5739 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdata");
5744 if(!prs_uint32("valuesize", ps
, depth
, &r_u
->valuesize
))
5747 if (UNMARSHALLING(ps
) && r_u
->valuesize
) {
5748 r_u
->value
= PRS_ALLOC_MEM(ps
, uint16
, r_u
->valuesize
);
5750 DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata value\n"));
5755 if(!prs_uint16uni(False
, "value", ps
, depth
, r_u
->value
, r_u
->valuesize
))
5761 if(!prs_uint32("realvaluesize", ps
, depth
, &r_u
->realvaluesize
))
5764 if(!prs_uint32("type", ps
, depth
, &r_u
->type
))
5767 if(!prs_uint32("datasize", ps
, depth
, &r_u
->datasize
))
5770 if (UNMARSHALLING(ps
) && r_u
->datasize
) {
5771 r_u
->data
= PRS_ALLOC_MEM(ps
, uint8
, r_u
->datasize
);
5773 DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata data\n"));
5778 if(!prs_uint8s(False
, "data", ps
, depth
, r_u
->data
, r_u
->datasize
))
5783 if(!prs_uint32("realdatasize", ps
, depth
, &r_u
->realdatasize
))
5785 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5791 /*******************************************************************
5792 ********************************************************************/
5794 BOOL
spoolss_io_q_enumprinterdata(const char *desc
, SPOOL_Q_ENUMPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
5796 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdata");
5801 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
5803 if(!prs_uint32("index", ps
, depth
, &q_u
->index
))
5805 if(!prs_uint32("valuesize", ps
, depth
, &q_u
->valuesize
))
5807 if(!prs_uint32("datasize", ps
, depth
, &q_u
->datasize
))
5813 /*******************************************************************
5814 ********************************************************************/
5816 BOOL
make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA
*q_u
,
5817 const POLICY_HND
*hnd
,
5818 uint32 idx
, uint32 valuelen
, uint32 datalen
)
5820 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5822 q_u
->valuesize
=valuelen
;
5823 q_u
->datasize
=datalen
;
5828 /*******************************************************************
5829 ********************************************************************/
5831 BOOL
make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX
*q_u
,
5832 const POLICY_HND
*hnd
, const char *key
,
5835 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5836 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
5842 /*******************************************************************
5843 ********************************************************************/
5844 BOOL
make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA
*q_u
, const POLICY_HND
*hnd
,
5845 char* value
, uint32 data_type
, char* data
, uint32 data_size
)
5847 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5848 q_u
->type
= data_type
;
5849 init_unistr2(&q_u
->value
, value
, UNI_STR_TERMINATE
);
5851 q_u
->max_len
= q_u
->real_len
= data_size
;
5852 q_u
->data
= (unsigned char *)data
;
5857 /*******************************************************************
5858 ********************************************************************/
5859 BOOL
make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX
*q_u
, const POLICY_HND
*hnd
,
5860 char *key
, char* value
, uint32 data_type
, char* data
,
5863 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5864 q_u
->type
= data_type
;
5865 init_unistr2(&q_u
->value
, value
, UNI_STR_TERMINATE
);
5866 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
5868 q_u
->max_len
= q_u
->real_len
= data_size
;
5869 q_u
->data
= (unsigned char *)data
;
5874 /*******************************************************************
5875 ********************************************************************/
5877 BOOL
spoolss_io_q_setprinterdata(const char *desc
, SPOOL_Q_SETPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
5879 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinterdata");
5884 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
5886 if(!smb_io_unistr2("", &q_u
->value
, True
, ps
, depth
))
5892 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
5895 if(!prs_uint32("max_len", ps
, depth
, &q_u
->max_len
))
5905 if (UNMARSHALLING(ps
))
5906 q_u
->data
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->max_len
);
5907 if(q_u
->data
== NULL
)
5909 if(!prs_uint8s(False
,"data", ps
, depth
, q_u
->data
, q_u
->max_len
))
5917 if(!prs_uint32("real_len", ps
, depth
, &q_u
->real_len
))
5923 /*******************************************************************
5924 ********************************************************************/
5926 BOOL
spoolss_io_r_setprinterdata(const char *desc
, SPOOL_R_SETPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
5928 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinterdata");
5933 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5939 /*******************************************************************
5940 ********************************************************************/
5941 BOOL
spoolss_io_q_resetprinter(const char *desc
, SPOOL_Q_RESETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
5943 prs_debug(ps
, depth
, desc
, "spoolss_io_q_resetprinter");
5948 if (!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
5951 if (!prs_uint32("datatype_ptr", ps
, depth
, &q_u
->datatype_ptr
))
5954 if (q_u
->datatype_ptr
) {
5955 if (!smb_io_unistr2("datatype", &q_u
->datatype
, q_u
->datatype_ptr
?True
:False
, ps
, depth
))
5959 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
5966 /*******************************************************************
5967 ********************************************************************/
5968 BOOL
spoolss_io_r_resetprinter(const char *desc
, SPOOL_R_RESETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
5970 prs_debug(ps
, depth
, desc
, "spoolss_io_r_resetprinter");
5975 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5981 /*******************************************************************
5982 ********************************************************************/
5984 static BOOL
spoolss_io_addform(const char *desc
, FORM
*f
, uint32 ptr
, prs_struct
*ps
, int depth
)
5986 prs_debug(ps
, depth
, desc
, "spoolss_io_addform");
5993 if(!prs_uint32("flags", ps
, depth
, &f
->flags
))
5995 if(!prs_uint32("name_ptr", ps
, depth
, &f
->name_ptr
))
5997 if(!prs_uint32("size_x", ps
, depth
, &f
->size_x
))
5999 if(!prs_uint32("size_y", ps
, depth
, &f
->size_y
))
6001 if(!prs_uint32("left", ps
, depth
, &f
->left
))
6003 if(!prs_uint32("top", ps
, depth
, &f
->top
))
6005 if(!prs_uint32("right", ps
, depth
, &f
->right
))
6007 if(!prs_uint32("bottom", ps
, depth
, &f
->bottom
))
6010 if(!smb_io_unistr2("", &f
->name
, f
->name_ptr
, ps
, depth
))
6017 /*******************************************************************
6018 ********************************************************************/
6020 BOOL
spoolss_io_q_deleteform(const char *desc
, SPOOL_Q_DELETEFORM
*q_u
, prs_struct
*ps
, int depth
)
6022 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteform");
6027 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6029 if(!smb_io_unistr2("form name", &q_u
->name
, True
, ps
, depth
))
6035 /*******************************************************************
6036 ********************************************************************/
6038 BOOL
spoolss_io_r_deleteform(const char *desc
, SPOOL_R_DELETEFORM
*r_u
, prs_struct
*ps
, int depth
)
6040 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteform");
6045 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6051 /*******************************************************************
6052 ********************************************************************/
6054 BOOL
spoolss_io_q_addform(const char *desc
, SPOOL_Q_ADDFORM
*q_u
, prs_struct
*ps
, int depth
)
6056 uint32 useless_ptr
=1;
6057 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addform");
6062 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6064 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6066 if(!prs_uint32("level2", ps
, depth
, &q_u
->level2
))
6071 if(!prs_uint32("useless_ptr", ps
, depth
, &useless_ptr
))
6073 if(!spoolss_io_addform("", &q_u
->form
, useless_ptr
, ps
, depth
))
6080 /*******************************************************************
6081 ********************************************************************/
6083 BOOL
spoolss_io_r_addform(const char *desc
, SPOOL_R_ADDFORM
*r_u
, prs_struct
*ps
, int depth
)
6085 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addform");
6090 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6096 /*******************************************************************
6097 ********************************************************************/
6099 BOOL
spoolss_io_q_setform(const char *desc
, SPOOL_Q_SETFORM
*q_u
, prs_struct
*ps
, int depth
)
6101 uint32 useless_ptr
=1;
6102 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setform");
6107 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6109 if(!smb_io_unistr2("", &q_u
->name
, True
, ps
, depth
))
6115 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6117 if(!prs_uint32("level2", ps
, depth
, &q_u
->level2
))
6122 if(!prs_uint32("useless_ptr", ps
, depth
, &useless_ptr
))
6124 if(!spoolss_io_addform("", &q_u
->form
, useless_ptr
, ps
, depth
))
6131 /*******************************************************************
6132 ********************************************************************/
6134 BOOL
spoolss_io_r_setform(const char *desc
, SPOOL_R_SETFORM
*r_u
, prs_struct
*ps
, int depth
)
6136 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setform");
6141 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6147 /*******************************************************************
6148 Parse a SPOOL_R_GETJOB structure.
6149 ********************************************************************/
6151 BOOL
spoolss_io_r_getjob(const char *desc
, SPOOL_R_GETJOB
*r_u
, prs_struct
*ps
, int depth
)
6153 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getjob");
6159 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
6165 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6168 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6174 /*******************************************************************
6175 Parse a SPOOL_Q_GETJOB structure.
6176 ********************************************************************/
6178 BOOL
spoolss_io_q_getjob(const char *desc
, SPOOL_Q_GETJOB
*q_u
, prs_struct
*ps
, int depth
)
6180 prs_debug(ps
, depth
, desc
, "");
6186 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6188 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
6190 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6193 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
6199 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
6205 void free_devmode(DEVICEMODE
*devmode
)
6207 if (devmode
!=NULL
) {
6208 SAFE_FREE(devmode
->dev_private
);
6213 void free_printer_info_1(PRINTER_INFO_1
*printer
)
6218 void free_printer_info_2(PRINTER_INFO_2
*printer
)
6220 if (printer
!=NULL
) {
6221 free_devmode(printer
->devmode
);
6222 printer
->devmode
= NULL
;
6227 void free_printer_info_3(PRINTER_INFO_3
*printer
)
6232 void free_printer_info_4(PRINTER_INFO_4
*printer
)
6237 void free_printer_info_5(PRINTER_INFO_5
*printer
)
6242 void free_printer_info_7(PRINTER_INFO_7
*printer
)
6247 void free_job_info_2(JOB_INFO_2
*job
)
6250 free_devmode(job
->devmode
);
6253 /*******************************************************************
6255 ********************************************************************/
6257 BOOL
make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER
*q_u
,
6258 const fstring string
, uint32 printer
, uint32 type
)
6263 init_unistr2(&q_u
->string
, string
, UNI_STR_TERMINATE
);
6265 q_u
->printer
=printer
;
6274 /*******************************************************************
6275 Parse a SPOOL_Q_REPLYOPENPRINTER structure.
6276 ********************************************************************/
6278 BOOL
spoolss_io_q_replyopenprinter(const char *desc
, SPOOL_Q_REPLYOPENPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6280 prs_debug(ps
, depth
, desc
, "spoolss_io_q_replyopenprinter");
6286 if(!smb_io_unistr2("", &q_u
->string
, True
, ps
, depth
))
6292 if(!prs_uint32("printer", ps
, depth
, &q_u
->printer
))
6294 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
6297 if(!prs_uint32("unknown0", ps
, depth
, &q_u
->unknown0
))
6299 if(!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6305 /*******************************************************************
6306 Parse a SPOOL_R_REPLYOPENPRINTER structure.
6307 ********************************************************************/
6309 BOOL
spoolss_io_r_replyopenprinter(const char *desc
, SPOOL_R_REPLYOPENPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6311 prs_debug(ps
, depth
, desc
, "spoolss_io_r_replyopenprinter");
6317 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
6320 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6326 /*******************************************************************
6328 ********************************************************************/
6329 BOOL
make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER
*q_u
, POLICY_HND
*hnd
,
6330 uint32 condition
, uint32 change_id
)
6333 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6335 q_u
->condition
= condition
;
6336 q_u
->change_id
= change_id
;
6339 q_u
->unknown1
= 0x1;
6340 memset(q_u
->unknown2
, 0x0, 5);
6341 q_u
->unknown2
[0] = 0x1;
6346 /*******************************************************************
6347 Parse a SPOOL_Q_ROUTERREPLYPRINTER structure.
6348 ********************************************************************/
6349 BOOL
spoolss_io_q_routerreplyprinter (const char *desc
, SPOOL_Q_ROUTERREPLYPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6352 prs_debug(ps
, depth
, desc
, "spoolss_io_q_routerreplyprinter");
6358 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6361 if (!prs_uint32("condition", ps
, depth
, &q_u
->condition
))
6364 if (!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6367 if (!prs_uint32("change_id", ps
, depth
, &q_u
->change_id
))
6370 if (!prs_uint8s(False
, "dev_private", ps
, depth
, q_u
->unknown2
, 5))
6376 /*******************************************************************
6377 Parse a SPOOL_R_ROUTERREPLYPRINTER structure.
6378 ********************************************************************/
6379 BOOL
spoolss_io_r_routerreplyprinter (const char *desc
, SPOOL_R_ROUTERREPLYPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6381 prs_debug(ps
, depth
, desc
, "spoolss_io_r_routerreplyprinter");
6387 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6393 /*******************************************************************
6395 ********************************************************************/
6397 BOOL
make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER
*q_u
, POLICY_HND
*hnd
)
6402 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6407 /*******************************************************************
6408 Parse a SPOOL_Q_REPLYCLOSEPRINTER structure.
6409 ********************************************************************/
6411 BOOL
spoolss_io_q_replycloseprinter(const char *desc
, SPOOL_Q_REPLYCLOSEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6413 prs_debug(ps
, depth
, desc
, "spoolss_io_q_replycloseprinter");
6419 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6425 /*******************************************************************
6426 Parse a SPOOL_R_REPLYCLOSEPRINTER structure.
6427 ********************************************************************/
6429 BOOL
spoolss_io_r_replycloseprinter(const char *desc
, SPOOL_R_REPLYCLOSEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6431 prs_debug(ps
, depth
, desc
, "spoolss_io_r_replycloseprinter");
6437 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
6440 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6446 #if 0 /* JERRY - not currently used but could be :-) */
6448 /*******************************************************************
6449 Deep copy a SPOOL_NOTIFY_INFO_DATA structure
6450 ******************************************************************/
6451 static BOOL
copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA
*dst
,
6452 SPOOL_NOTIFY_INFO_DATA
*src
, int n
)
6456 memcpy(dst
, src
, sizeof(SPOOL_NOTIFY_INFO_DATA
)*n
);
6458 for (i
=0; i
<n
; i
++) {
6462 if (src
->size
!= POINTER
)
6464 len
= src
->notify_data
.data
.length
;
6465 s
= SMB_MALLOC_ARRAY(uint16
, len
);
6467 DEBUG(0,("copy_spool_notify_info_data: malloc() failed!\n"));
6471 memcpy(s
, src
->notify_data
.data
.string
, len
*2);
6472 dst
->notify_data
.data
.string
= s
;
6478 /*******************************************************************
6479 Deep copy a SPOOL_NOTIFY_INFO structure
6480 ******************************************************************/
6481 static BOOL
copy_spool_notify_info(SPOOL_NOTIFY_INFO
*dst
, SPOOL_NOTIFY_INFO
*src
)
6484 DEBUG(0,("copy_spool_notify_info: NULL destination pointer!\n"));
6488 dst
->version
= src
->version
;
6489 dst
->flags
= src
->flags
;
6490 dst
->count
= src
->count
;
6494 dst
->data
= SMB_MALLOC_ARRAY(SPOOL_NOTIFY_INFO_DATA
, dst
->count
);
6496 DEBUG(10,("copy_spool_notify_info: allocating space for [%d] PRINTER_NOTIFY_INFO_DATA entries\n",
6499 if (dst
->data
== NULL
) {
6500 DEBUG(0,("copy_spool_notify_info: malloc() failed for [%d] entries!\n",
6505 return (copy_spool_notify_info_data(dst
->data
, src
->data
, src
->count
));
6512 /*******************************************************************
6514 ********************************************************************/
6516 BOOL
make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN
*q_u
, POLICY_HND
*hnd
,
6517 uint32 change_low
, uint32 change_high
,
6518 SPOOL_NOTIFY_INFO
*info
)
6523 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6525 q_u
->change_low
=change_low
;
6526 q_u
->change_high
=change_high
;
6531 q_u
->info_ptr
=0x0FF0ADDE;
6533 q_u
->info
.version
=2;
6536 DEBUG(10,("make_spoolss_q_reply_rrpcn: [%d] PRINTER_NOTIFY_INFO_DATA\n",
6538 q_u
->info
.version
= info
->version
;
6539 q_u
->info
.flags
= info
->flags
;
6540 q_u
->info
.count
= info
->count
;
6541 /* pointer field - be careful! */
6542 q_u
->info
.data
= info
->data
;
6545 q_u
->info
.flags
=PRINTER_NOTIFY_INFO_DISCARDED
;
6552 /*******************************************************************
6553 Parse a SPOOL_Q_REPLY_RRPCN structure.
6554 ********************************************************************/
6556 BOOL
spoolss_io_q_reply_rrpcn(const char *desc
, SPOOL_Q_REPLY_RRPCN
*q_u
, prs_struct
*ps
, int depth
)
6558 prs_debug(ps
, depth
, desc
, "spoolss_io_q_reply_rrpcn");
6564 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6567 if (!prs_uint32("change_low", ps
, depth
, &q_u
->change_low
))
6570 if (!prs_uint32("change_high", ps
, depth
, &q_u
->change_high
))
6573 if (!prs_uint32("unknown0", ps
, depth
, &q_u
->unknown0
))
6576 if (!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6579 if (!prs_uint32("info_ptr", ps
, depth
, &q_u
->info_ptr
))
6582 if(q_u
->info_ptr
!=0)
6583 if(!smb_io_notify_info(desc
, &q_u
->info
, ps
, depth
))
6589 /*******************************************************************
6590 Parse a SPOOL_R_REPLY_RRPCN structure.
6591 ********************************************************************/
6593 BOOL
spoolss_io_r_reply_rrpcn(const char *desc
, SPOOL_R_REPLY_RRPCN
*r_u
, prs_struct
*ps
, int depth
)
6595 prs_debug(ps
, depth
, desc
, "spoolss_io_r_reply_rrpcn");
6601 if (!prs_uint32("unknown0", ps
, depth
, &r_u
->unknown0
))
6604 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6610 /*******************************************************************
6612 * called from spoolss_q_getprinterdataex (srv_spoolss.c)
6613 ********************************************************************/
6615 BOOL
spoolss_io_q_getprinterdataex(const char *desc
, SPOOL_Q_GETPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6620 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdataex");
6625 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6629 if (!smb_io_unistr2("keyname", &q_u
->keyname
,True
,ps
,depth
))
6633 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
6637 if (!prs_uint32("size", ps
, depth
, &q_u
->size
))
6643 /*******************************************************************
6644 * write a structure.
6645 * called from spoolss_r_getprinterdataex (srv_spoolss.c)
6646 ********************************************************************/
6648 BOOL
spoolss_io_r_getprinterdataex(const char *desc
, SPOOL_R_GETPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6653 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdataex");
6658 if (!prs_uint32("type", ps
, depth
, &r_u
->type
))
6660 if (!prs_uint32("size", ps
, depth
, &r_u
->size
))
6663 if (UNMARSHALLING(ps
) && r_u
->size
) {
6664 r_u
->data
= PRS_ALLOC_MEM(ps
, unsigned char, r_u
->size
);
6669 if (!prs_uint8s(False
,"data", ps
, depth
, r_u
->data
, r_u
->size
))
6675 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6677 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6683 /*******************************************************************
6685 ********************************************************************/
6687 BOOL
spoolss_io_q_setprinterdataex(const char *desc
, SPOOL_Q_SETPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6689 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinterdataex");
6694 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6696 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6702 if(!smb_io_unistr2("", &q_u
->value
, True
, ps
, depth
))
6708 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
6711 if(!prs_uint32("max_len", ps
, depth
, &q_u
->max_len
))
6721 if (UNMARSHALLING(ps
))
6722 q_u
->data
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->max_len
);
6723 if(q_u
->data
== NULL
)
6725 if(!prs_uint8s(False
,"data", ps
, depth
, q_u
->data
, q_u
->max_len
))
6733 if(!prs_uint32("real_len", ps
, depth
, &q_u
->real_len
))
6739 /*******************************************************************
6740 * write a structure.
6741 ********************************************************************/
6743 BOOL
spoolss_io_r_setprinterdataex(const char *desc
, SPOOL_R_SETPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6745 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinterdataex");
6750 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6756 /*******************************************************************
6758 ********************************************************************/
6759 BOOL
make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY
*q_u
,
6760 POLICY_HND
*hnd
, const char *key
,
6763 DEBUG(5,("make_spoolss_q_enumprinterkey\n"));
6765 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6766 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
6772 /*******************************************************************
6774 ********************************************************************/
6776 BOOL
spoolss_io_q_enumprinterkey(const char *desc
, SPOOL_Q_ENUMPRINTERKEY
*q_u
, prs_struct
*ps
, int depth
)
6778 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterkey");
6783 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6786 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6792 if(!prs_uint32("size", ps
, depth
, &q_u
->size
))
6798 /*******************************************************************
6799 * write a structure.
6800 ********************************************************************/
6802 BOOL
spoolss_io_r_enumprinterkey(const char *desc
, SPOOL_R_ENUMPRINTERKEY
*r_u
, prs_struct
*ps
, int depth
)
6804 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterkey");
6810 if (!smb_io_buffer5("", &r_u
->keys
, ps
, depth
))
6816 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6819 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6825 /*******************************************************************
6827 ********************************************************************/
6829 BOOL
make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY
*q_u
,
6830 POLICY_HND
*hnd
, char *keyname
)
6832 DEBUG(5,("make_spoolss_q_deleteprinterkey\n"));
6834 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6835 init_unistr2(&q_u
->keyname
, keyname
, UNI_STR_TERMINATE
);
6840 /*******************************************************************
6842 ********************************************************************/
6844 BOOL
spoolss_io_q_deleteprinterkey(const char *desc
, SPOOL_Q_DELETEPRINTERKEY
*q_u
, prs_struct
*ps
, int depth
)
6846 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterkey");
6851 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6854 if(!smb_io_unistr2("", &q_u
->keyname
, True
, ps
, depth
))
6860 /*******************************************************************
6861 * write a structure.
6862 ********************************************************************/
6864 BOOL
spoolss_io_r_deleteprinterkey(const char *desc
, SPOOL_R_DELETEPRINTERKEY
*r_u
, prs_struct
*ps
, int depth
)
6866 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterkey");
6872 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6879 /*******************************************************************
6881 ********************************************************************/
6883 BOOL
spoolss_io_q_enumprinterdataex(const char *desc
, SPOOL_Q_ENUMPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6885 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdataex");
6890 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6893 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6899 if(!prs_uint32("size", ps
, depth
, &q_u
->size
))
6905 /*******************************************************************
6906 ********************************************************************/
6908 static BOOL
spoolss_io_printer_enum_values_ctr(const char *desc
, prs_struct
*ps
,
6909 PRINTER_ENUM_VALUES_CTR
*ctr
, int depth
)
6912 uint32 valuename_offset
,
6915 const uint32 basic_unit
= 20; /* size of static portion of enum_values */
6917 prs_debug(ps
, depth
, desc
, "spoolss_io_printer_enum_values_ctr");
6921 * offset data begins at 20 bytes per structure * size_of_array.
6922 * Don't forget the uint32 at the beginning
6925 current_offset
= basic_unit
* ctr
->size_of_array
;
6927 /* first loop to write basic enum_value information */
6929 if (UNMARSHALLING(ps
)) {
6930 ctr
->values
= PRS_ALLOC_MEM(ps
, PRINTER_ENUM_VALUES
, ctr
->size_of_array
);
6935 for (i
=0; i
<ctr
->size_of_array
; i
++) {
6936 valuename_offset
= current_offset
;
6937 if (!prs_uint32("valuename_offset", ps
, depth
, &valuename_offset
))
6940 if (!prs_uint32("value_len", ps
, depth
, &ctr
->values
[i
].value_len
))
6943 if (!prs_uint32("type", ps
, depth
, &ctr
->values
[i
].type
))
6946 data_offset
= ctr
->values
[i
].value_len
+ valuename_offset
;
6948 if (!prs_uint32("data_offset", ps
, depth
, &data_offset
))
6951 if (!prs_uint32("data_len", ps
, depth
, &ctr
->values
[i
].data_len
))
6954 current_offset
= data_offset
+ ctr
->values
[i
].data_len
- basic_unit
;
6955 /* account for 2 byte alignment */
6956 current_offset
+= (current_offset
% 2);
6960 * loop #2 for writing the dynamically size objects; pay
6961 * attention to 2-byte alignment here....
6964 for (i
=0; i
<ctr
->size_of_array
; i
++) {
6966 if (!prs_unistr("valuename", ps
, depth
, &ctr
->values
[i
].valuename
))
6969 if ( ctr
->values
[i
].data_len
) {
6970 if ( UNMARSHALLING(ps
) ) {
6971 ctr
->values
[i
].data
= PRS_ALLOC_MEM(ps
, uint8
, ctr
->values
[i
].data_len
);
6972 if (!ctr
->values
[i
].data
)
6975 if (!prs_uint8s(False
, "data", ps
, depth
, ctr
->values
[i
].data
, ctr
->values
[i
].data_len
))
6979 if ( !prs_align_uint16(ps
) )
6986 /*******************************************************************
6987 * write a structure.
6988 ********************************************************************/
6990 BOOL
spoolss_io_r_enumprinterdataex(const char *desc
, SPOOL_R_ENUMPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6992 uint32 data_offset
, end_offset
;
6993 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdataex");
6999 if (!prs_uint32("size", ps
, depth
, &r_u
->ctr
.size
))
7002 data_offset
= prs_offset(ps
);
7004 if (!prs_set_offset(ps
, data_offset
+ r_u
->ctr
.size
))
7010 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7013 if(!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
7016 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7019 r_u
->ctr
.size_of_array
= r_u
->returned
;
7021 end_offset
= prs_offset(ps
);
7023 if (!prs_set_offset(ps
, data_offset
))
7027 if (!spoolss_io_printer_enum_values_ctr("", ps
, &r_u
->ctr
, depth
))
7030 if (!prs_set_offset(ps
, end_offset
))
7035 /*******************************************************************
7036 * write a structure.
7037 ********************************************************************/
7040 uint32 GetPrintProcessorDirectory(
7042 [in] unistr2 *environment,
7044 [in,out] RPC_BUFFER buffer,
7045 [in] uint32 offered,
7046 [out] uint32 needed,
7047 [out] uint32 returned
7052 BOOL
make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY
*q_u
, const char *name
, char *environment
, int level
, RPC_BUFFER
*buffer
, uint32 offered
)
7054 DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n"));
7056 init_unistr2(&q_u
->name
, name
, UNI_STR_TERMINATE
);
7057 init_unistr2(&q_u
->environment
, environment
, UNI_STR_TERMINATE
);
7061 q_u
->buffer
= buffer
;
7062 q_u
->offered
= offered
;
7067 BOOL
spoolss_io_q_getprintprocessordirectory(const char *desc
, SPOOL_Q_GETPRINTPROCESSORDIRECTORY
*q_u
, prs_struct
*ps
, int depth
)
7071 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprintprocessordirectory");
7077 if (!prs_uint32("ptr", ps
, depth
, &ptr
))
7081 if(!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
7088 if (!prs_uint32("ptr", ps
, depth
, &ptr
))
7092 if(!smb_io_unistr2("environment", &q_u
->environment
, True
,
7100 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
7103 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
7109 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
7115 /*******************************************************************
7116 * write a structure.
7117 ********************************************************************/
7119 BOOL
spoolss_io_r_getprintprocessordirectory(const char *desc
, SPOOL_R_GETPRINTPROCESSORDIRECTORY
*r_u
, prs_struct
*ps
, int depth
)
7121 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprintprocessordirectory");
7127 if(!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
7133 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7136 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7142 BOOL
smb_io_printprocessordirectory_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCESSOR_DIRECTORY_1
*info
, int depth
)
7144 prs_struct
*ps
=&buffer
->prs
;
7146 prs_debug(ps
, depth
, desc
, "smb_io_printprocessordirectory_1");
7149 buffer
->struct_start
=prs_offset(ps
);
7151 if (!smb_io_unistr(desc
, &info
->name
, ps
, depth
))
7157 /*******************************************************************
7159 ********************************************************************/
7161 BOOL
make_spoolss_q_addform(SPOOL_Q_ADDFORM
*q_u
, POLICY_HND
*handle
,
7162 int level
, FORM
*form
)
7164 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7166 q_u
->level2
= level
;
7167 memcpy(&q_u
->form
, form
, sizeof(FORM
));
7172 /*******************************************************************
7174 ********************************************************************/
7176 BOOL
make_spoolss_q_setform(SPOOL_Q_SETFORM
*q_u
, POLICY_HND
*handle
,
7177 int level
, const char *form_name
, FORM
*form
)
7179 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7181 q_u
->level2
= level
;
7182 memcpy(&q_u
->form
, form
, sizeof(FORM
));
7183 init_unistr2(&q_u
->name
, form_name
, UNI_STR_TERMINATE
);
7188 /*******************************************************************
7190 ********************************************************************/
7192 BOOL
make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM
*q_u
, POLICY_HND
*handle
,
7195 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7196 init_unistr2(&q_u
->name
, form
, UNI_STR_TERMINATE
);
7200 /*******************************************************************
7202 ********************************************************************/
7204 BOOL
make_spoolss_q_getform(SPOOL_Q_GETFORM
*q_u
, POLICY_HND
*handle
,
7205 const char *formname
, uint32 level
,
7206 RPC_BUFFER
*buffer
, uint32 offered
)
7208 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7210 init_unistr2(&q_u
->formname
, formname
, UNI_STR_TERMINATE
);
7212 q_u
->offered
=offered
;
7217 /*******************************************************************
7219 ********************************************************************/
7221 BOOL
make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS
*q_u
, POLICY_HND
*handle
,
7222 uint32 level
, RPC_BUFFER
*buffer
,
7225 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7228 q_u
->offered
=offered
;
7233 /*******************************************************************
7235 ********************************************************************/
7237 BOOL
make_spoolss_q_setjob(SPOOL_Q_SETJOB
*q_u
, POLICY_HND
*handle
,
7238 uint32 jobid
, uint32 level
, uint32 command
)
7240 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7244 /* Hmm - the SPOOL_Q_SETJOB structure has a JOB_INFO ctr in it but
7245 the server side code has it marked as unused. */
7247 q_u
->command
= command
;
7252 /*******************************************************************
7254 ********************************************************************/
7256 BOOL
make_spoolss_q_getjob(SPOOL_Q_GETJOB
*q_u
, POLICY_HND
*handle
,
7257 uint32 jobid
, uint32 level
, RPC_BUFFER
*buffer
,
7260 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7263 q_u
->buffer
= buffer
;
7264 q_u
->offered
= offered
;
7269 /*******************************************************************
7271 ********************************************************************/
7273 BOOL
make_spoolss_q_startpageprinter(SPOOL_Q_STARTPAGEPRINTER
*q_u
,
7276 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7281 /*******************************************************************
7283 ********************************************************************/
7285 BOOL
make_spoolss_q_endpageprinter(SPOOL_Q_ENDPAGEPRINTER
*q_u
,
7288 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7293 /*******************************************************************
7295 ********************************************************************/
7297 BOOL
make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER
*q_u
,
7298 POLICY_HND
*handle
, uint32 level
,
7299 char *docname
, char *outputfile
,
7302 DOC_INFO_CONTAINER
*ctr
= &q_u
->doc_info_container
;
7304 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7310 ctr
->docinfo
.switch_value
= level
;
7312 ctr
->docinfo
.doc_info_1
.p_docname
= docname
? 1 : 0;
7313 ctr
->docinfo
.doc_info_1
.p_outputfile
= outputfile
? 1 : 0;
7314 ctr
->docinfo
.doc_info_1
.p_datatype
= datatype
? 1 : 0;
7316 init_unistr2(&ctr
->docinfo
.doc_info_1
.docname
, docname
, UNI_STR_TERMINATE
);
7317 init_unistr2(&ctr
->docinfo
.doc_info_1
.outputfile
, outputfile
, UNI_STR_TERMINATE
);
7318 init_unistr2(&ctr
->docinfo
.doc_info_1
.datatype
, datatype
, UNI_STR_TERMINATE
);
7322 /* DOC_INFO_2 is only used by Windows 9x and since it
7323 doesn't do printing over RPC we don't have to worry
7326 DEBUG(3, ("unsupported info level %d\n", level
));
7333 /*******************************************************************
7335 ********************************************************************/
7337 BOOL
make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER
*q_u
,
7340 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7345 /*******************************************************************
7347 ********************************************************************/
7349 BOOL
make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER
*q_u
,
7350 POLICY_HND
*handle
, uint32 data_size
,
7353 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7354 q_u
->buffer_size
= q_u
->buffer_size2
= data_size
;
7355 q_u
->buffer
= (unsigned char *)data
;
7359 /*******************************************************************
7361 ********************************************************************/
7363 BOOL
make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA
*q_u
,
7364 POLICY_HND
*handle
, char *valuename
)
7366 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7367 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
7372 /*******************************************************************
7374 ********************************************************************/
7376 BOOL
make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX
*q_u
,
7377 POLICY_HND
*handle
, char *key
,
7380 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7381 init_unistr2(&q_u
->valuename
, value
, UNI_STR_TERMINATE
);
7382 init_unistr2(&q_u
->keyname
, key
, UNI_STR_TERMINATE
);
7387 /*******************************************************************
7389 ********************************************************************/
7391 BOOL
make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX
*q_u
, POLICY_HND
*handle
,
7392 uint32 flags
, uint32 options
, const char *localmachine
,
7393 uint32 printerlocal
, SPOOL_NOTIFY_OPTION
*option
)
7395 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7398 q_u
->options
= options
;
7400 q_u
->localmachine_ptr
= 1;
7402 init_unistr2(&q_u
->localmachine
, localmachine
, UNI_STR_TERMINATE
);
7404 q_u
->printerlocal
= printerlocal
;
7407 q_u
->option_ptr
= 1;
7409 q_u
->option
= option
;