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 */
634 uint16
*unistr_buffer
;
637 struct optional_fields
{
640 } opt_fields
[DM_NUM_OPTIONAL_FIELDS
] = {
641 { "icmmethod", NULL
},
642 { "icmintent", NULL
},
643 { "mediatype", NULL
},
644 { "dithertype", NULL
},
645 { "reserved1", NULL
},
646 { "reserved2", NULL
},
647 { "panningwidth", NULL
},
648 { "panningheight", NULL
}
651 /* assign at run time to keep non-gcc compilers happy */
653 opt_fields
[0].field
= &devmode
->icmmethod
;
654 opt_fields
[1].field
= &devmode
->icmintent
;
655 opt_fields
[2].field
= &devmode
->mediatype
;
656 opt_fields
[3].field
= &devmode
->dithertype
;
657 opt_fields
[4].field
= &devmode
->reserved1
;
658 opt_fields
[5].field
= &devmode
->reserved2
;
659 opt_fields
[6].field
= &devmode
->panningwidth
;
660 opt_fields
[7].field
= &devmode
->panningheight
;
663 prs_debug(ps
, depth
, desc
, "spoolss_io_devmode");
666 if (UNMARSHALLING(ps
)) {
667 devmode
->devicename
.buffer
= PRS_ALLOC_MEM(ps
, uint16
, MAXDEVICENAME
);
668 if (devmode
->devicename
.buffer
== NULL
)
670 unistr_buffer
= devmode
->devicename
.buffer
;
673 /* devicename is a static sized string but the buffer we set is not */
674 unistr_buffer
= PRS_ALLOC_MEM(ps
, uint16
, MAXDEVICENAME
);
675 memset( unistr_buffer
, 0x0, MAXDEVICENAME
);
676 for ( j
=0; devmode
->devicename
.buffer
[j
]; j
++ )
677 unistr_buffer
[j
] = devmode
->devicename
.buffer
[j
];
680 if (!prs_uint16uni(True
,"devicename", ps
, depth
, unistr_buffer
, MAXDEVICENAME
))
683 if (!prs_uint16("specversion", ps
, depth
, &devmode
->specversion
))
686 if (!prs_uint16("driverversion", ps
, depth
, &devmode
->driverversion
))
688 if (!prs_uint16("size", ps
, depth
, &devmode
->size
))
690 if (!prs_uint16("driverextra", ps
, depth
, &devmode
->driverextra
))
692 if (!prs_uint32("fields", ps
, depth
, &devmode
->fields
))
694 if (!prs_uint16("orientation", ps
, depth
, &devmode
->orientation
))
696 if (!prs_uint16("papersize", ps
, depth
, &devmode
->papersize
))
698 if (!prs_uint16("paperlength", ps
, depth
, &devmode
->paperlength
))
700 if (!prs_uint16("paperwidth", ps
, depth
, &devmode
->paperwidth
))
702 if (!prs_uint16("scale", ps
, depth
, &devmode
->scale
))
704 if (!prs_uint16("copies", ps
, depth
, &devmode
->copies
))
706 if (!prs_uint16("defaultsource", ps
, depth
, &devmode
->defaultsource
))
708 if (!prs_uint16("printquality", ps
, depth
, &devmode
->printquality
))
710 if (!prs_uint16("color", ps
, depth
, &devmode
->color
))
712 if (!prs_uint16("duplex", ps
, depth
, &devmode
->duplex
))
714 if (!prs_uint16("yresolution", ps
, depth
, &devmode
->yresolution
))
716 if (!prs_uint16("ttoption", ps
, depth
, &devmode
->ttoption
))
718 if (!prs_uint16("collate", ps
, depth
, &devmode
->collate
))
721 if (UNMARSHALLING(ps
)) {
722 devmode
->formname
.buffer
= PRS_ALLOC_MEM(ps
, uint16
, MAXDEVICENAME
);
723 if (devmode
->formname
.buffer
== NULL
)
725 unistr_buffer
= devmode
->formname
.buffer
;
728 /* devicename is a static sized string but the buffer we set is not */
729 unistr_buffer
= PRS_ALLOC_MEM(ps
, uint16
, MAXDEVICENAME
);
730 memset( unistr_buffer
, 0x0, MAXDEVICENAME
);
731 for ( j
=0; devmode
->formname
.buffer
[j
]; j
++ )
732 unistr_buffer
[j
] = devmode
->formname
.buffer
[j
];
735 if (!prs_uint16uni(True
, "formname", ps
, depth
, unistr_buffer
, MAXDEVICENAME
))
737 if (!prs_uint16("logpixels", ps
, depth
, &devmode
->logpixels
))
739 if (!prs_uint32("bitsperpel", ps
, depth
, &devmode
->bitsperpel
))
741 if (!prs_uint32("pelswidth", ps
, depth
, &devmode
->pelswidth
))
743 if (!prs_uint32("pelsheight", ps
, depth
, &devmode
->pelsheight
))
745 if (!prs_uint32("displayflags", ps
, depth
, &devmode
->displayflags
))
747 if (!prs_uint32("displayfrequency", ps
, depth
, &devmode
->displayfrequency
))
750 * every device mode I've ever seen on the wire at least has up
751 * to the displayfrequency field. --jerry (05-09-2002)
754 /* add uint32's + uint16's + two UNICODE strings */
756 available_space
= devmode
->size
- (sizeof(uint32
)*6 + sizeof(uint16
)*18 + sizeof(uint16
)*64);
758 /* Sanity check - we only have uint32's left tp parse */
760 if ( available_space
&& ((available_space
% sizeof(uint32
)) != 0) ) {
761 DEBUG(0,("spoolss_io_devmode: available_space [%d] no in multiple of 4 bytes (size = %d)!\n",
762 available_space
, devmode
->size
));
763 DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
768 * Conditional parsing. Assume that the DeviceMode has been
769 * zero'd by the caller.
772 while ((available_space
> 0) && (i
< DM_NUM_OPTIONAL_FIELDS
))
774 DEBUG(11, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space
));
775 if (!prs_uint32(opt_fields
[i
].name
, ps
, depth
, opt_fields
[i
].field
))
777 available_space
-= sizeof(uint32
);
781 /* Sanity Check - we should no available space at this point unless
782 MS changes the device mode structure */
784 if (available_space
) {
785 DEBUG(0,("spoolss_io_devmode: I've parsed all I know and there is still stuff left|\n"));
786 DEBUG(0,("spoolss_io_devmode: available_space = [%d], devmode_size = [%d]!\n",
787 available_space
, devmode
->size
));
788 DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
793 if (devmode
->driverextra
!=0) {
794 if (UNMARSHALLING(ps
)) {
795 devmode
->dev_private
=PRS_ALLOC_MEM(ps
, uint8
, devmode
->driverextra
);
796 if(devmode
->dev_private
== NULL
)
798 DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for dev_private\n",devmode
->driverextra
));
801 DEBUG(7,("spoolss_io_devmode: parsing [%d] bytes of dev_private\n",devmode
->driverextra
));
802 if (!prs_uint8s(False
, "dev_private", ps
, depth
,
803 devmode
->dev_private
, devmode
->driverextra
))
810 /*******************************************************************
811 Read or write a DEVICEMODE container
812 ********************************************************************/
814 static BOOL
spoolss_io_devmode_cont(const char *desc
, DEVMODE_CTR
*dm_c
, prs_struct
*ps
, int depth
)
819 prs_debug(ps
, depth
, desc
, "spoolss_io_devmode_cont");
825 if (!prs_uint32("size", ps
, depth
, &dm_c
->size
))
828 if (!prs_uint32("devmode_ptr", ps
, depth
, &dm_c
->devmode_ptr
))
831 if (dm_c
->size
==0 || dm_c
->devmode_ptr
==0) {
832 if (UNMARSHALLING(ps
))
833 /* if while reading there is no DEVMODE ... */
838 /* so we have a DEVICEMODE to follow */
839 if (UNMARSHALLING(ps
)) {
840 DEBUG(9,("Allocating memory for spoolss_io_devmode\n"));
841 dm_c
->devmode
=PRS_ALLOC_MEM(ps
,DEVICEMODE
,1);
842 if(dm_c
->devmode
== NULL
)
846 /* this is bad code, shouldn't be there */
847 if (!prs_uint32("size", ps
, depth
, &dm_c
->size
))
850 if (!spoolss_io_devmode(desc
, ps
, depth
, dm_c
->devmode
))
856 /*******************************************************************
857 ********************************************************************/
859 static BOOL
spoolss_io_printer_default(const char *desc
, PRINTER_DEFAULT
*pd
, prs_struct
*ps
, int depth
)
864 prs_debug(ps
, depth
, desc
, "spoolss_io_printer_default");
867 if (!prs_uint32("datatype_ptr", ps
, depth
, &pd
->datatype_ptr
))
870 if (!smb_io_unistr2("datatype", &pd
->datatype
, pd
->datatype_ptr
, ps
,depth
))
876 if (!spoolss_io_devmode_cont("", &pd
->devmode_cont
, ps
, depth
))
882 if (!prs_uint32("access_required", ps
, depth
, &pd
->access_required
))
888 /*******************************************************************
890 ********************************************************************/
892 BOOL
make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX
*q_u
,
893 const fstring printername
,
894 const fstring datatype
,
895 uint32 access_required
,
896 const fstring clientname
,
897 const fstring user_name
)
899 DEBUG(5,("make_spoolss_q_open_printer_ex\n"));
901 q_u
->printername
= TALLOC_P( get_talloc_ctx(), UNISTR2
);
902 init_unistr2(q_u
->printername
, printername
, UNI_STR_TERMINATE
);
904 q_u
->printer_default
.datatype_ptr
= 0;
906 q_u
->printer_default
.devmode_cont
.size
=0;
907 q_u
->printer_default
.devmode_cont
.devmode_ptr
=0;
908 q_u
->printer_default
.devmode_cont
.devmode
=NULL
;
909 q_u
->printer_default
.access_required
=access_required
;
911 q_u
->user_switch
= 1;
913 q_u
->user_ctr
.level
= 1;
914 q_u
->user_ctr
.user
.user1
= TALLOC_P( get_talloc_ctx(), SPOOL_USER_1
);
915 q_u
->user_ctr
.user
.user1
->size
= strlen(clientname
) + strlen(user_name
) + 10;
916 q_u
->user_ctr
.user
.user1
->build
= 1381;
917 q_u
->user_ctr
.user
.user1
->major
= 2;
918 q_u
->user_ctr
.user
.user1
->minor
= 0;
919 q_u
->user_ctr
.user
.user1
->processor
= 0;
921 q_u
->user_ctr
.user
.user1
->client_name
= TALLOC_P( get_talloc_ctx(), UNISTR2
);
922 q_u
->user_ctr
.user
.user1
->user_name
= TALLOC_P( get_talloc_ctx(), UNISTR2
);
924 init_unistr2(q_u
->user_ctr
.user
.user1
->client_name
, clientname
, UNI_STR_TERMINATE
);
925 init_unistr2(q_u
->user_ctr
.user
.user1
->user_name
, user_name
, UNI_STR_TERMINATE
);
930 /*******************************************************************
932 ********************************************************************/
934 BOOL
make_spoolss_q_addprinterex( TALLOC_CTX
*mem_ctx
, SPOOL_Q_ADDPRINTEREX
*q_u
,
935 const char *srv_name
, const char* clientname
, const char* user_name
,
936 uint32 level
, PRINTER_INFO_CTR
*ctr
)
938 DEBUG(5,("make_spoolss_q_addprinterex\n"));
945 q_u
->server_name
= TALLOC_P( mem_ctx
, UNISTR2
);
946 init_unistr2(q_u
->server_name
, srv_name
, UNI_FLAGS_NONE
);
950 q_u
->info
.level
= level
;
951 q_u
->info
.info_ptr
= (ctr
->printers_2
!=NULL
)?1:0;
954 /* init q_u->info.info2 from *info */
955 if (!make_spoolss_printer_info_2(mem_ctx
, &q_u
->info
.info_2
, ctr
->printers_2
)) {
956 DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n"));
966 q_u
->user_ctr
.level
= 1;
967 q_u
->user_ctr
.user
.user1
= TALLOC_P( get_talloc_ctx(), SPOOL_USER_1
);
968 q_u
->user_ctr
.user
.user1
->build
= 1381;
969 q_u
->user_ctr
.user
.user1
->major
= 2;
970 q_u
->user_ctr
.user
.user1
->minor
= 0;
971 q_u
->user_ctr
.user
.user1
->processor
= 0;
973 q_u
->user_ctr
.user
.user1
->client_name
= TALLOC_P( mem_ctx
, UNISTR2
);
974 q_u
->user_ctr
.user
.user1
->user_name
= TALLOC_P( mem_ctx
, UNISTR2
);
976 init_unistr2(q_u
->user_ctr
.user
.user1
->client_name
, clientname
, UNI_STR_TERMINATE
);
977 init_unistr2(q_u
->user_ctr
.user
.user1
->user_name
, user_name
, UNI_STR_TERMINATE
);
979 q_u
->user_ctr
.user
.user1
->size
= q_u
->user_ctr
.user
.user1
->user_name
->uni_str_len
+
980 q_u
->user_ctr
.user
.user1
->client_name
->uni_str_len
+ 2;
985 /*******************************************************************
986 create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct
987 *******************************************************************/
989 BOOL
make_spoolss_printer_info_2(TALLOC_CTX
*mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_2
**spool_info2
,
990 PRINTER_INFO_2
*info
)
993 SPOOL_PRINTER_INFO_LEVEL_2
*inf
;
995 /* allocate the necessary memory */
996 if (!(inf
=TALLOC_P(mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_2
))) {
997 DEBUG(0,("make_spoolss_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n"));
1001 inf
->servername_ptr
= (info
->servername
.buffer
!=NULL
)?1:0;
1002 inf
->printername_ptr
= (info
->printername
.buffer
!=NULL
)?1:0;
1003 inf
->sharename_ptr
= (info
->sharename
.buffer
!=NULL
)?1:0;
1004 inf
->portname_ptr
= (info
->portname
.buffer
!=NULL
)?1:0;
1005 inf
->drivername_ptr
= (info
->drivername
.buffer
!=NULL
)?1:0;
1006 inf
->comment_ptr
= (info
->comment
.buffer
!=NULL
)?1:0;
1007 inf
->location_ptr
= (info
->location
.buffer
!=NULL
)?1:0;
1008 inf
->devmode_ptr
= (info
->devmode
!=NULL
)?1:0;
1009 inf
->sepfile_ptr
= (info
->sepfile
.buffer
!=NULL
)?1:0;
1010 inf
->printprocessor_ptr
= (info
->printprocessor
.buffer
!=NULL
)?1:0;
1011 inf
->datatype_ptr
= (info
->datatype
.buffer
!=NULL
)?1:0;
1012 inf
->parameters_ptr
= (info
->parameters
.buffer
!=NULL
)?1:0;
1013 inf
->secdesc_ptr
= (info
->secdesc
!=NULL
)?1:0;
1014 inf
->attributes
= info
->attributes
;
1015 inf
->priority
= info
->priority
;
1016 inf
->default_priority
= info
->defaultpriority
;
1017 inf
->starttime
= info
->starttime
;
1018 inf
->untiltime
= info
->untiltime
;
1019 inf
->cjobs
= info
->cjobs
;
1020 inf
->averageppm
= info
->averageppm
;
1021 init_unistr2_from_unistr(&inf
->servername
, &info
->servername
);
1022 init_unistr2_from_unistr(&inf
->printername
, &info
->printername
);
1023 init_unistr2_from_unistr(&inf
->sharename
, &info
->sharename
);
1024 init_unistr2_from_unistr(&inf
->portname
, &info
->portname
);
1025 init_unistr2_from_unistr(&inf
->drivername
, &info
->drivername
);
1026 init_unistr2_from_unistr(&inf
->comment
, &info
->comment
);
1027 init_unistr2_from_unistr(&inf
->location
, &info
->location
);
1028 init_unistr2_from_unistr(&inf
->sepfile
, &info
->sepfile
);
1029 init_unistr2_from_unistr(&inf
->printprocessor
, &info
->printprocessor
);
1030 init_unistr2_from_unistr(&inf
->datatype
, &info
->datatype
);
1031 init_unistr2_from_unistr(&inf
->parameters
, &info
->parameters
);
1032 init_unistr2_from_unistr(&inf
->datatype
, &info
->datatype
);
1039 /*******************************************************************
1040 create a SPOOL_PRINTER_INFO_3 struct from a PRINTER_INFO_3 struct
1041 *******************************************************************/
1043 BOOL
make_spoolss_printer_info_3(TALLOC_CTX
*mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_3
**spool_info3
,
1044 PRINTER_INFO_3
*info
)
1047 SPOOL_PRINTER_INFO_LEVEL_3
*inf
;
1049 /* allocate the necessary memory */
1050 if (!(inf
=TALLOC_P(mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_3
))) {
1051 DEBUG(0,("make_spoolss_printer_info_3: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_3 sruct!\n"));
1055 inf
->secdesc_ptr
= (info
->secdesc
!=NULL
)?1:0;
1062 /*******************************************************************
1063 create a SPOOL_PRINTER_INFO_7 struct from a PRINTER_INFO_7 struct
1064 *******************************************************************/
1066 BOOL
make_spoolss_printer_info_7(TALLOC_CTX
*mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_7
**spool_info7
,
1067 PRINTER_INFO_7
*info
)
1070 SPOOL_PRINTER_INFO_LEVEL_7
*inf
;
1072 /* allocate the necessary memory */
1073 if (!(inf
=TALLOC_P(mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_7
))) {
1074 DEBUG(0,("make_spoolss_printer_info_7: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_7 struct!\n"));
1078 inf
->guid_ptr
= (info
->guid
.buffer
!=NULL
)?1:0;
1079 inf
->action
= info
->action
;
1080 init_unistr2_from_unistr(&inf
->guid
, &info
->guid
);
1088 /*******************************************************************
1090 * called from spoolss_q_open_printer_ex (srv_spoolss.c)
1091 ********************************************************************/
1093 BOOL
spoolss_io_q_open_printer(const char *desc
, SPOOL_Q_OPEN_PRINTER
*q_u
, prs_struct
*ps
, int depth
)
1098 prs_debug(ps
, depth
, desc
, "spoolss_io_q_open_printer");
1104 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->printername
))
1106 if (!prs_io_unistr2("printername", ps
, depth
, q_u
->printername
))
1112 if (!spoolss_io_printer_default("", &q_u
->printer_default
, ps
, depth
))
1118 /*******************************************************************
1119 * write a structure.
1120 * called from static spoolss_r_open_printer_ex (srv_spoolss.c)
1121 * called from spoolss_open_printer_ex (cli_spoolss.c)
1122 ********************************************************************/
1124 BOOL
spoolss_io_r_open_printer(const char *desc
, SPOOL_R_OPEN_PRINTER
*r_u
, prs_struct
*ps
, int depth
)
1126 if (r_u
== NULL
) return False
;
1128 prs_debug(ps
, depth
, desc
, "spoolss_io_r_open_printer");
1134 if (!smb_io_pol_hnd("printer handle",&(r_u
->handle
),ps
,depth
))
1137 if (!prs_werror("status code", ps
, depth
, &(r_u
->status
)))
1144 /*******************************************************************
1146 * called from spoolss_q_open_printer_ex (srv_spoolss.c)
1147 ********************************************************************/
1149 BOOL
spoolss_io_q_open_printer_ex(const char *desc
, SPOOL_Q_OPEN_PRINTER_EX
*q_u
, prs_struct
*ps
, int depth
)
1154 prs_debug(ps
, depth
, desc
, "spoolss_io_q_open_printer_ex");
1160 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->printername
))
1162 if (!prs_io_unistr2("printername", ps
, depth
, q_u
->printername
))
1168 if (!spoolss_io_printer_default("", &q_u
->printer_default
, ps
, depth
))
1171 if (!prs_uint32("user_switch", ps
, depth
, &q_u
->user_switch
))
1173 if (!spool_io_user_level("", &q_u
->user_ctr
, ps
, depth
))
1179 /*******************************************************************
1180 * write a structure.
1181 * called from static spoolss_r_open_printer_ex (srv_spoolss.c)
1182 * called from spoolss_open_printer_ex (cli_spoolss.c)
1183 ********************************************************************/
1185 BOOL
spoolss_io_r_open_printer_ex(const char *desc
, SPOOL_R_OPEN_PRINTER_EX
*r_u
, prs_struct
*ps
, int depth
)
1187 if (r_u
== NULL
) return False
;
1189 prs_debug(ps
, depth
, desc
, "spoolss_io_r_open_printer_ex");
1195 if (!smb_io_pol_hnd("printer handle",&(r_u
->handle
),ps
,depth
))
1198 if (!prs_werror("status code", ps
, depth
, &(r_u
->status
)))
1204 /*******************************************************************
1206 ********************************************************************/
1207 BOOL
make_spoolss_q_deleteprinterdriverex( TALLOC_CTX
*mem_ctx
,
1208 SPOOL_Q_DELETEPRINTERDRIVEREX
*q_u
,
1214 DEBUG(5,("make_spoolss_q_deleteprinterdriverex\n"));
1216 q_u
->server_ptr
= (server
!=NULL
)?1:0;
1217 q_u
->delete_flags
= DPD_DELETE_UNUSED_FILES
;
1219 /* these must be NULL terminated or else NT4 will
1220 complain about invalid parameters --jerry */
1221 init_unistr2(&q_u
->server
, server
, UNI_STR_TERMINATE
);
1222 init_unistr2(&q_u
->arch
, arch
, UNI_STR_TERMINATE
);
1223 init_unistr2(&q_u
->driver
, driver
, UNI_STR_TERMINATE
);
1226 q_u
->delete_flags
|= DPD_DELETE_SPECIFIC_VERSION
;
1227 q_u
->version
= version
;
1234 /*******************************************************************
1236 ********************************************************************/
1237 BOOL
make_spoolss_q_deleteprinterdriver(
1238 TALLOC_CTX
*mem_ctx
,
1239 SPOOL_Q_DELETEPRINTERDRIVER
*q_u
,
1245 DEBUG(5,("make_spoolss_q_deleteprinterdriver\n"));
1247 q_u
->server_ptr
= (server
!=NULL
)?1:0;
1249 /* these must be NULL terminated or else NT4 will
1250 complain about invalid parameters --jerry */
1251 init_unistr2(&q_u
->server
, server
, UNI_STR_TERMINATE
);
1252 init_unistr2(&q_u
->arch
, arch
, UNI_STR_TERMINATE
);
1253 init_unistr2(&q_u
->driver
, driver
, UNI_STR_TERMINATE
);
1258 /*******************************************************************
1260 ********************************************************************/
1262 BOOL
make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA
*q_u
,
1263 const POLICY_HND
*handle
,
1264 const char *valuename
, uint32 size
)
1266 if (q_u
== NULL
) return False
;
1268 DEBUG(5,("make_spoolss_q_getprinterdata\n"));
1270 q_u
->handle
= *handle
;
1271 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
1277 /*******************************************************************
1279 ********************************************************************/
1281 BOOL
make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX
*q_u
,
1282 const POLICY_HND
*handle
,
1283 const char *keyname
,
1284 const char *valuename
, uint32 size
)
1286 if (q_u
== NULL
) return False
;
1288 DEBUG(5,("make_spoolss_q_getprinterdataex\n"));
1290 q_u
->handle
= *handle
;
1291 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
1292 init_unistr2(&q_u
->keyname
, keyname
, UNI_STR_TERMINATE
);
1298 /*******************************************************************
1300 * called from spoolss_q_getprinterdata (srv_spoolss.c)
1301 ********************************************************************/
1303 BOOL
spoolss_io_q_getprinterdata(const char *desc
, SPOOL_Q_GETPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
1308 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdata");
1313 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1317 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
1321 if (!prs_uint32("size", ps
, depth
, &q_u
->size
))
1327 /*******************************************************************
1329 * called from spoolss_q_deleteprinterdata (srv_spoolss.c)
1330 ********************************************************************/
1332 BOOL
spoolss_io_q_deleteprinterdata(const char *desc
, SPOOL_Q_DELETEPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
1337 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdata");
1342 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1346 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
1352 /*******************************************************************
1353 * write a structure.
1354 * called from spoolss_r_deleteprinterdata (srv_spoolss.c)
1355 ********************************************************************/
1357 BOOL
spoolss_io_r_deleteprinterdata(const char *desc
, SPOOL_R_DELETEPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
1359 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdata");
1361 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1367 /*******************************************************************
1369 * called from spoolss_q_deleteprinterdataex (srv_spoolss.c)
1370 ********************************************************************/
1372 BOOL
spoolss_io_q_deleteprinterdataex(const char *desc
, SPOOL_Q_DELETEPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
1377 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdataex");
1382 if (!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
1385 if (!smb_io_unistr2("keyname ", &q_u
->keyname
, True
, ps
, depth
))
1387 if (!smb_io_unistr2("valuename", &q_u
->valuename
, True
, ps
, depth
))
1393 /*******************************************************************
1394 * write a structure.
1395 * called from spoolss_r_deleteprinterdataex (srv_spoolss.c)
1396 ********************************************************************/
1398 BOOL
spoolss_io_r_deleteprinterdataex(const char *desc
, SPOOL_R_DELETEPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
1400 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdataex");
1403 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1409 /*******************************************************************
1410 * write a structure.
1411 * called from spoolss_r_getprinterdata (srv_spoolss.c)
1412 ********************************************************************/
1414 BOOL
spoolss_io_r_getprinterdata(const char *desc
, SPOOL_R_GETPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
1419 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdata");
1424 if (!prs_uint32("type", ps
, depth
, &r_u
->type
))
1426 if (!prs_uint32("size", ps
, depth
, &r_u
->size
))
1429 if (UNMARSHALLING(ps
) && r_u
->size
) {
1430 r_u
->data
= PRS_ALLOC_MEM(ps
, unsigned char, r_u
->size
);
1435 if (!prs_uint8s( False
, "data", ps
, depth
, r_u
->data
, r_u
->size
))
1441 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
1443 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1449 /*******************************************************************
1451 ********************************************************************/
1453 BOOL
make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER
*q_u
, POLICY_HND
*hnd
)
1455 if (q_u
== NULL
) return False
;
1457 DEBUG(5,("make_spoolss_q_closeprinter\n"));
1459 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
1464 /*******************************************************************
1466 * called from static spoolss_q_abortprinter (srv_spoolss.c)
1467 * called from spoolss_abortprinter (cli_spoolss.c)
1468 ********************************************************************/
1470 BOOL
spoolss_io_q_abortprinter(const char *desc
, SPOOL_Q_ABORTPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1472 if (q_u
== NULL
) return False
;
1474 prs_debug(ps
, depth
, desc
, "spoolss_io_q_abortprinter");
1480 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1486 /*******************************************************************
1487 * write a structure.
1488 * called from spoolss_r_abortprinter (srv_spoolss.c)
1489 ********************************************************************/
1491 BOOL
spoolss_io_r_abortprinter(const char *desc
, SPOOL_R_ABORTPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1493 prs_debug(ps
, depth
, desc
, "spoolss_io_r_abortprinter");
1495 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1501 /*******************************************************************
1503 * called from static spoolss_q_deleteprinter (srv_spoolss.c)
1504 * called from spoolss_deleteprinter (cli_spoolss.c)
1505 ********************************************************************/
1507 BOOL
spoolss_io_q_deleteprinter(const char *desc
, SPOOL_Q_DELETEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1509 if (q_u
== NULL
) return False
;
1511 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinter");
1517 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1523 /*******************************************************************
1524 * write a structure.
1525 * called from static spoolss_r_deleteprinter (srv_spoolss.c)
1526 * called from spoolss_deleteprinter (cli_spoolss.c)
1527 ********************************************************************/
1529 BOOL
spoolss_io_r_deleteprinter(const char *desc
, SPOOL_R_DELETEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1531 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinter");
1537 if (!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
1539 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1546 /*******************************************************************
1548 * called from api_spoolss_deleteprinterdriver (srv_spoolss.c)
1549 * called from spoolss_deleteprinterdriver (cli_spoolss.c)
1550 ********************************************************************/
1552 BOOL
spoolss_io_q_deleteprinterdriver(const char *desc
, SPOOL_Q_DELETEPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
1554 if (q_u
== NULL
) return False
;
1556 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdriver");
1562 if(!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
1564 if(!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
1566 if(!smb_io_unistr2("arch", &q_u
->arch
, True
, ps
, depth
))
1568 if(!smb_io_unistr2("driver", &q_u
->driver
, True
, ps
, depth
))
1576 /*******************************************************************
1577 * write a structure.
1578 ********************************************************************/
1579 BOOL
spoolss_io_r_deleteprinterdriver(const char *desc
, SPOOL_R_DELETEPRINTERDRIVER
*r_u
, prs_struct
*ps
, int depth
)
1581 if (r_u
== NULL
) return False
;
1583 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdriver");
1589 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1596 /*******************************************************************
1598 * called from api_spoolss_deleteprinterdriver (srv_spoolss.c)
1599 * called from spoolss_deleteprinterdriver (cli_spoolss.c)
1600 ********************************************************************/
1602 BOOL
spoolss_io_q_deleteprinterdriverex(const char *desc
, SPOOL_Q_DELETEPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
1604 if (q_u
== NULL
) return False
;
1606 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdriverex");
1612 if(!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
1614 if(!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
1616 if(!smb_io_unistr2("arch", &q_u
->arch
, True
, ps
, depth
))
1618 if(!smb_io_unistr2("driver", &q_u
->driver
, True
, ps
, depth
))
1624 if(!prs_uint32("delete_flags ", ps
, depth
, &q_u
->delete_flags
))
1626 if(!prs_uint32("version ", ps
, depth
, &q_u
->version
))
1634 /*******************************************************************
1635 * write a structure.
1636 ********************************************************************/
1637 BOOL
spoolss_io_r_deleteprinterdriverex(const char *desc
, SPOOL_R_DELETEPRINTERDRIVEREX
*r_u
, prs_struct
*ps
, int depth
)
1639 if (r_u
== NULL
) return False
;
1641 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdriverex");
1647 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1655 /*******************************************************************
1657 * called from static spoolss_q_closeprinter (srv_spoolss.c)
1658 * called from spoolss_closeprinter (cli_spoolss.c)
1659 ********************************************************************/
1661 BOOL
spoolss_io_q_closeprinter(const char *desc
, SPOOL_Q_CLOSEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1663 if (q_u
== NULL
) return False
;
1665 prs_debug(ps
, depth
, desc
, "spoolss_io_q_closeprinter");
1671 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1677 /*******************************************************************
1678 * write a structure.
1679 * called from static spoolss_r_closeprinter (srv_spoolss.c)
1680 * called from spoolss_closeprinter (cli_spoolss.c)
1681 ********************************************************************/
1683 BOOL
spoolss_io_r_closeprinter(const char *desc
, SPOOL_R_CLOSEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1685 prs_debug(ps
, depth
, desc
, "spoolss_io_r_closeprinter");
1691 if (!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
1693 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1699 /*******************************************************************
1701 * called from spoolss_q_startdocprinter (srv_spoolss.c)
1702 ********************************************************************/
1704 BOOL
spoolss_io_q_startdocprinter(const char *desc
, SPOOL_Q_STARTDOCPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1706 if (q_u
== NULL
) return False
;
1708 prs_debug(ps
, depth
, desc
, "spoolss_io_q_startdocprinter");
1714 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1717 if(!smb_io_doc_info_container("",&q_u
->doc_info_container
, ps
, depth
))
1723 /*******************************************************************
1724 * write a structure.
1725 * called from spoolss_r_startdocprinter (srv_spoolss.c)
1726 ********************************************************************/
1728 BOOL
spoolss_io_r_startdocprinter(const char *desc
, SPOOL_R_STARTDOCPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1730 prs_debug(ps
, depth
, desc
, "spoolss_io_r_startdocprinter");
1732 if(!prs_uint32("jobid", ps
, depth
, &r_u
->jobid
))
1734 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1740 /*******************************************************************
1742 * called from spoolss_q_enddocprinter (srv_spoolss.c)
1743 ********************************************************************/
1745 BOOL
spoolss_io_q_enddocprinter(const char *desc
, SPOOL_Q_ENDDOCPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1747 if (q_u
== NULL
) return False
;
1749 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enddocprinter");
1755 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1761 /*******************************************************************
1762 * write a structure.
1763 * called from spoolss_r_enddocprinter (srv_spoolss.c)
1764 ********************************************************************/
1766 BOOL
spoolss_io_r_enddocprinter(const char *desc
, SPOOL_R_ENDDOCPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1768 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enddocprinter");
1770 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1776 /*******************************************************************
1778 * called from spoolss_q_startpageprinter (srv_spoolss.c)
1779 ********************************************************************/
1781 BOOL
spoolss_io_q_startpageprinter(const char *desc
, SPOOL_Q_STARTPAGEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1783 if (q_u
== NULL
) return False
;
1785 prs_debug(ps
, depth
, desc
, "spoolss_io_q_startpageprinter");
1791 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1797 /*******************************************************************
1798 * write a structure.
1799 * called from spoolss_r_startpageprinter (srv_spoolss.c)
1800 ********************************************************************/
1802 BOOL
spoolss_io_r_startpageprinter(const char *desc
, SPOOL_R_STARTPAGEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1804 prs_debug(ps
, depth
, desc
, "spoolss_io_r_startpageprinter");
1806 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1812 /*******************************************************************
1814 * called from spoolss_q_endpageprinter (srv_spoolss.c)
1815 ********************************************************************/
1817 BOOL
spoolss_io_q_endpageprinter(const char *desc
, SPOOL_Q_ENDPAGEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1819 if (q_u
== NULL
) return False
;
1821 prs_debug(ps
, depth
, desc
, "spoolss_io_q_endpageprinter");
1827 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1833 /*******************************************************************
1834 * write a structure.
1835 * called from spoolss_r_endpageprinter (srv_spoolss.c)
1836 ********************************************************************/
1838 BOOL
spoolss_io_r_endpageprinter(const char *desc
, SPOOL_R_ENDPAGEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1840 prs_debug(ps
, depth
, desc
, "spoolss_io_r_endpageprinter");
1842 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1848 /*******************************************************************
1850 * called from spoolss_q_writeprinter (srv_spoolss.c)
1851 ********************************************************************/
1853 BOOL
spoolss_io_q_writeprinter(const char *desc
, SPOOL_Q_WRITEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1855 if (q_u
== NULL
) return False
;
1857 prs_debug(ps
, depth
, desc
, "spoolss_io_q_writeprinter");
1863 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1865 if(!prs_uint32("buffer_size", ps
, depth
, &q_u
->buffer_size
))
1868 if (q_u
->buffer_size
!=0)
1870 if (UNMARSHALLING(ps
))
1871 q_u
->buffer
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->buffer_size
);
1872 if(q_u
->buffer
== NULL
)
1874 if(!prs_uint8s(True
, "buffer", ps
, depth
, q_u
->buffer
, q_u
->buffer_size
))
1879 if(!prs_uint32("buffer_size2", ps
, depth
, &q_u
->buffer_size2
))
1885 /*******************************************************************
1886 * write a structure.
1887 * called from spoolss_r_writeprinter (srv_spoolss.c)
1888 ********************************************************************/
1890 BOOL
spoolss_io_r_writeprinter(const char *desc
, SPOOL_R_WRITEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1892 prs_debug(ps
, depth
, desc
, "spoolss_io_r_writeprinter");
1894 if(!prs_uint32("buffer_written", ps
, depth
, &r_u
->buffer_written
))
1896 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1902 /*******************************************************************
1904 * called from spoolss_q_rffpcnex (srv_spoolss.c)
1905 ********************************************************************/
1907 BOOL
spoolss_io_q_rffpcnex(const char *desc
, SPOOL_Q_RFFPCNEX
*q_u
, prs_struct
*ps
, int depth
)
1909 prs_debug(ps
, depth
, desc
, "spoolss_io_q_rffpcnex");
1915 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
1917 if(!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
1919 if(!prs_uint32("options", ps
, depth
, &q_u
->options
))
1921 if(!prs_uint32("localmachine_ptr", ps
, depth
, &q_u
->localmachine_ptr
))
1923 if(!smb_io_unistr2("localmachine", &q_u
->localmachine
, q_u
->localmachine_ptr
, ps
, depth
))
1929 if(!prs_uint32("printerlocal", ps
, depth
, &q_u
->printerlocal
))
1932 if(!prs_uint32("option_ptr", ps
, depth
, &q_u
->option_ptr
))
1935 if (q_u
->option_ptr
!=0) {
1937 if (UNMARSHALLING(ps
))
1938 if((q_u
->option
=PRS_ALLOC_MEM(ps
,SPOOL_NOTIFY_OPTION
,1)) == NULL
)
1941 if(!smb_io_notify_option("notify option", q_u
->option
, ps
, depth
))
1948 /*******************************************************************
1949 * write a structure.
1950 * called from spoolss_r_rffpcnex (srv_spoolss.c)
1951 ********************************************************************/
1953 BOOL
spoolss_io_r_rffpcnex(const char *desc
, SPOOL_R_RFFPCNEX
*r_u
, prs_struct
*ps
, int depth
)
1955 prs_debug(ps
, depth
, desc
, "spoolss_io_r_rffpcnex");
1958 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1964 /*******************************************************************
1966 * called from spoolss_q_rfnpcnex (srv_spoolss.c)
1967 ********************************************************************/
1969 BOOL
spoolss_io_q_rfnpcnex(const char *desc
, SPOOL_Q_RFNPCNEX
*q_u
, prs_struct
*ps
, int depth
)
1971 prs_debug(ps
, depth
, desc
, "spoolss_io_q_rfnpcnex");
1977 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1980 if(!prs_uint32("change", ps
, depth
, &q_u
->change
))
1983 if(!prs_uint32("option_ptr", ps
, depth
, &q_u
->option_ptr
))
1986 if (q_u
->option_ptr
!=0) {
1988 if (UNMARSHALLING(ps
))
1989 if((q_u
->option
=PRS_ALLOC_MEM(ps
,SPOOL_NOTIFY_OPTION
,1)) == NULL
)
1992 if(!smb_io_notify_option("notify option", q_u
->option
, ps
, depth
))
1999 /*******************************************************************
2000 * write a structure.
2001 * called from spoolss_r_rfnpcnex (srv_spoolss.c)
2002 ********************************************************************/
2004 BOOL
spoolss_io_r_rfnpcnex(const char *desc
, SPOOL_R_RFNPCNEX
*r_u
, prs_struct
*ps
, int depth
)
2006 prs_debug(ps
, depth
, desc
, "spoolss_io_r_rfnpcnex");
2012 if (!prs_uint32("info_ptr", ps
, depth
, &r_u
->info_ptr
))
2015 if(!smb_io_notify_info("notify info", &r_u
->info
,ps
,depth
))
2020 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
2026 /*******************************************************************
2027 * return the length of a uint16 (obvious, but the code is clean)
2028 ********************************************************************/
2030 static uint32
size_of_uint16(uint16
*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_uint32(uint32
*value
)
2041 return (sizeof(*value
));
2044 /*******************************************************************
2045 * return the length of a NTTIME (obvious, but the code is clean)
2046 ********************************************************************/
2048 static uint32
size_of_nttime(NTTIME
*value
)
2050 return (sizeof(*value
));
2053 /*******************************************************************
2054 * return the length of a uint32 (obvious, but the code is clean)
2055 ********************************************************************/
2057 static uint32
size_of_device_mode(DEVICEMODE
*devmode
)
2062 return (4+devmode
->size
+devmode
->driverextra
);
2065 /*******************************************************************
2066 * return the length of a uint32 (obvious, but the code is clean)
2067 ********************************************************************/
2069 static uint32
size_of_systemtime(SYSTEMTIME
*systime
)
2074 return (sizeof(SYSTEMTIME
) +4);
2077 /*******************************************************************
2078 Parse a DEVMODE structure and its relative pointer.
2079 ********************************************************************/
2081 static BOOL
smb_io_reldevmode(const char *desc
, RPC_BUFFER
*buffer
, int depth
, DEVICEMODE
**devmode
)
2083 prs_struct
*ps
=&buffer
->prs
;
2085 prs_debug(ps
, depth
, desc
, "smb_io_reldevmode");
2088 if (MARSHALLING(ps
)) {
2089 uint32 struct_offset
= prs_offset(ps
);
2090 uint32 relative_offset
;
2092 if (*devmode
== NULL
) {
2094 if (!prs_uint32("offset", ps
, depth
, &relative_offset
))
2096 DEBUG(8, ("boing, the devmode was NULL\n"));
2101 buffer
->string_at_end
-= ((*devmode
)->size
+ (*devmode
)->driverextra
);
2103 if(!prs_set_offset(ps
, buffer
->string_at_end
))
2106 /* write the DEVMODE */
2107 if (!spoolss_io_devmode(desc
, ps
, depth
, *devmode
))
2110 if(!prs_set_offset(ps
, struct_offset
))
2113 relative_offset
=buffer
->string_at_end
- buffer
->struct_start
;
2114 /* write its offset */
2115 if (!prs_uint32("offset", ps
, depth
, &relative_offset
))
2121 /* read the offset */
2122 if (!prs_uint32("offset", ps
, depth
, &buffer
->string_at_end
))
2124 if (buffer
->string_at_end
== 0) {
2129 old_offset
= prs_offset(ps
);
2130 if(!prs_set_offset(ps
, buffer
->string_at_end
+ buffer
->struct_start
))
2133 /* read the string */
2134 if((*devmode
=PRS_ALLOC_MEM(ps
,DEVICEMODE
,1)) == NULL
)
2136 if (!spoolss_io_devmode(desc
, ps
, depth
, *devmode
))
2139 if(!prs_set_offset(ps
, old_offset
))
2145 /*******************************************************************
2146 Parse a PRINTER_INFO_0 structure.
2147 ********************************************************************/
2149 BOOL
smb_io_printer_info_0(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_0
*info
, int depth
)
2151 prs_struct
*ps
=&buffer
->prs
;
2153 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_0");
2156 buffer
->struct_start
=prs_offset(ps
);
2158 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2160 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
2163 if(!prs_uint32("cjobs", ps
, depth
, &info
->cjobs
))
2165 if(!prs_uint32("total_jobs", ps
, depth
, &info
->total_jobs
))
2167 if(!prs_uint32("total_bytes", ps
, depth
, &info
->total_bytes
))
2170 if(!prs_uint16("year", ps
, depth
, &info
->year
))
2172 if(!prs_uint16("month", ps
, depth
, &info
->month
))
2174 if(!prs_uint16("dayofweek", ps
, depth
, &info
->dayofweek
))
2176 if(!prs_uint16("day", ps
, depth
, &info
->day
))
2178 if(!prs_uint16("hour", ps
, depth
, &info
->hour
))
2180 if(!prs_uint16("minute", ps
, depth
, &info
->minute
))
2182 if(!prs_uint16("second", ps
, depth
, &info
->second
))
2184 if(!prs_uint16("milliseconds", ps
, depth
, &info
->milliseconds
))
2187 if(!prs_uint32("global_counter", ps
, depth
, &info
->global_counter
))
2189 if(!prs_uint32("total_pages", ps
, depth
, &info
->total_pages
))
2192 if(!prs_uint16("major_version", ps
, depth
, &info
->major_version
))
2194 if(!prs_uint16("build_version", ps
, depth
, &info
->build_version
))
2196 if(!prs_uint32("unknown7", ps
, depth
, &info
->unknown7
))
2198 if(!prs_uint32("unknown8", ps
, depth
, &info
->unknown8
))
2200 if(!prs_uint32("unknown9", ps
, depth
, &info
->unknown9
))
2202 if(!prs_uint32("session_counter", ps
, depth
, &info
->session_counter
))
2204 if(!prs_uint32("unknown11", ps
, depth
, &info
->unknown11
))
2206 if(!prs_uint32("printer_errors", ps
, depth
, &info
->printer_errors
))
2208 if(!prs_uint32("unknown13", ps
, depth
, &info
->unknown13
))
2210 if(!prs_uint32("unknown14", ps
, depth
, &info
->unknown14
))
2212 if(!prs_uint32("unknown15", ps
, depth
, &info
->unknown15
))
2214 if(!prs_uint32("unknown16", ps
, depth
, &info
->unknown16
))
2216 if(!prs_uint32("change_id", ps
, depth
, &info
->change_id
))
2218 if(!prs_uint32("unknown18", ps
, depth
, &info
->unknown18
))
2220 if(!prs_uint32("status" , ps
, depth
, &info
->status
))
2222 if(!prs_uint32("unknown20", ps
, depth
, &info
->unknown20
))
2224 if(!prs_uint32("c_setprinter", ps
, depth
, &info
->c_setprinter
))
2226 if(!prs_uint16("unknown22", ps
, depth
, &info
->unknown22
))
2228 if(!prs_uint16("unknown23", ps
, depth
, &info
->unknown23
))
2230 if(!prs_uint16("unknown24", ps
, depth
, &info
->unknown24
))
2232 if(!prs_uint16("unknown25", ps
, depth
, &info
->unknown25
))
2234 if(!prs_uint16("unknown26", ps
, depth
, &info
->unknown26
))
2236 if(!prs_uint16("unknown27", ps
, depth
, &info
->unknown27
))
2238 if(!prs_uint16("unknown28", ps
, depth
, &info
->unknown28
))
2240 if(!prs_uint16("unknown29", ps
, depth
, &info
->unknown29
))
2246 /*******************************************************************
2247 Parse a PRINTER_INFO_1 structure.
2248 ********************************************************************/
2250 BOOL
smb_io_printer_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_1
*info
, int depth
)
2252 prs_struct
*ps
=&buffer
->prs
;
2254 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_1");
2257 buffer
->struct_start
=prs_offset(ps
);
2259 if (!prs_uint32("flags", ps
, depth
, &info
->flags
))
2261 if (!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2263 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2265 if (!smb_io_relstr("comment", buffer
, depth
, &info
->comment
))
2271 /*******************************************************************
2272 Parse a PRINTER_INFO_2 structure.
2273 ********************************************************************/
2275 BOOL
smb_io_printer_info_2(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_2
*info
, int depth
)
2277 prs_struct
*ps
=&buffer
->prs
;
2278 uint32 dm_offset
, sd_offset
, current_offset
;
2279 uint32 dummy_value
= 0, has_secdesc
= 0;
2281 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_2");
2284 buffer
->struct_start
=prs_offset(ps
);
2286 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
2288 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2290 if (!smb_io_relstr("sharename", buffer
, depth
, &info
->sharename
))
2292 if (!smb_io_relstr("portname", buffer
, depth
, &info
->portname
))
2294 if (!smb_io_relstr("drivername", buffer
, depth
, &info
->drivername
))
2296 if (!smb_io_relstr("comment", buffer
, depth
, &info
->comment
))
2298 if (!smb_io_relstr("location", buffer
, depth
, &info
->location
))
2301 /* save current offset and wind forwared by a uint32 */
2302 dm_offset
= prs_offset(ps
);
2303 if (!prs_uint32("devmode", ps
, depth
, &dummy_value
))
2306 if (!smb_io_relstr("sepfile", buffer
, depth
, &info
->sepfile
))
2308 if (!smb_io_relstr("printprocessor", buffer
, depth
, &info
->printprocessor
))
2310 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2312 if (!smb_io_relstr("parameters", buffer
, depth
, &info
->parameters
))
2315 /* save current offset for the sec_desc */
2316 sd_offset
= prs_offset(ps
);
2317 if (!prs_uint32("sec_desc", ps
, depth
, &has_secdesc
))
2321 /* save current location so we can pick back up here */
2322 current_offset
= prs_offset(ps
);
2324 /* parse the devmode */
2325 if (!prs_set_offset(ps
, dm_offset
))
2327 if (!smb_io_reldevmode("devmode", buffer
, depth
, &info
->devmode
))
2330 /* parse the sec_desc */
2331 if (info
->secdesc
) {
2332 if (!prs_set_offset(ps
, sd_offset
))
2334 if (!smb_io_relsecdesc("secdesc", buffer
, depth
, &info
->secdesc
))
2338 /* pick up where we left off */
2339 if (!prs_set_offset(ps
, current_offset
))
2342 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2344 if (!prs_uint32("priority", ps
, depth
, &info
->priority
))
2346 if (!prs_uint32("defpriority", ps
, depth
, &info
->defaultpriority
))
2348 if (!prs_uint32("starttime", ps
, depth
, &info
->starttime
))
2350 if (!prs_uint32("untiltime", ps
, depth
, &info
->untiltime
))
2352 if (!prs_uint32("status", ps
, depth
, &info
->status
))
2354 if (!prs_uint32("jobs", ps
, depth
, &info
->cjobs
))
2356 if (!prs_uint32("averageppm", ps
, depth
, &info
->averageppm
))
2362 /*******************************************************************
2363 Parse a PRINTER_INFO_3 structure.
2364 ********************************************************************/
2366 BOOL
smb_io_printer_info_3(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_3
*info
, int depth
)
2368 prs_struct
*ps
=&buffer
->prs
;
2370 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_3");
2373 buffer
->struct_start
=prs_offset(ps
);
2375 if (!prs_uint32("flags", ps
, depth
, &info
->flags
))
2377 if (!sec_io_desc("sec_desc", &info
->secdesc
, ps
, depth
))
2383 /*******************************************************************
2384 Parse a PRINTER_INFO_4 structure.
2385 ********************************************************************/
2387 BOOL
smb_io_printer_info_4(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_4
*info
, int depth
)
2389 prs_struct
*ps
=&buffer
->prs
;
2391 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_4");
2394 buffer
->struct_start
=prs_offset(ps
);
2396 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2398 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
2400 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2405 /*******************************************************************
2406 Parse a PRINTER_INFO_5 structure.
2407 ********************************************************************/
2409 BOOL
smb_io_printer_info_5(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_5
*info
, int depth
)
2411 prs_struct
*ps
=&buffer
->prs
;
2413 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_5");
2416 buffer
->struct_start
=prs_offset(ps
);
2418 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2420 if (!smb_io_relstr("portname", buffer
, depth
, &info
->portname
))
2422 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2424 if (!prs_uint32("device_not_selected_timeout", ps
, depth
, &info
->device_not_selected_timeout
))
2426 if (!prs_uint32("transmission_retry_timeout", ps
, depth
, &info
->transmission_retry_timeout
))
2431 /*******************************************************************
2432 Parse a PRINTER_INFO_7 structure.
2433 ********************************************************************/
2435 BOOL
smb_io_printer_info_7(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_7
*info
, int depth
)
2437 prs_struct
*ps
=&buffer
->prs
;
2439 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_7");
2442 buffer
->struct_start
=prs_offset(ps
);
2444 if (!smb_io_relstr("guid", buffer
, depth
, &info
->guid
))
2446 if (!prs_uint32("action", ps
, depth
, &info
->action
))
2451 /*******************************************************************
2452 Parse a PORT_INFO_1 structure.
2453 ********************************************************************/
2455 BOOL
smb_io_port_info_1(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_1
*info
, int depth
)
2457 prs_struct
*ps
=&buffer
->prs
;
2459 prs_debug(ps
, depth
, desc
, "smb_io_port_info_1");
2462 buffer
->struct_start
=prs_offset(ps
);
2464 if (!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2470 /*******************************************************************
2471 Parse a PORT_INFO_2 structure.
2472 ********************************************************************/
2474 BOOL
smb_io_port_info_2(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_2
*info
, int depth
)
2476 prs_struct
*ps
=&buffer
->prs
;
2478 prs_debug(ps
, depth
, desc
, "smb_io_port_info_2");
2481 buffer
->struct_start
=prs_offset(ps
);
2483 if (!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2485 if (!smb_io_relstr("monitor_name", buffer
, depth
, &info
->monitor_name
))
2487 if (!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2489 if (!prs_uint32("port_type", ps
, depth
, &info
->port_type
))
2491 if (!prs_uint32("reserved", ps
, depth
, &info
->reserved
))
2497 /*******************************************************************
2498 Parse a DRIVER_INFO_1 structure.
2499 ********************************************************************/
2501 BOOL
smb_io_printer_driver_info_1(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_1
*info
, int depth
)
2503 prs_struct
*ps
=&buffer
->prs
;
2505 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_1");
2508 buffer
->struct_start
=prs_offset(ps
);
2510 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2516 /*******************************************************************
2517 Parse a DRIVER_INFO_2 structure.
2518 ********************************************************************/
2520 BOOL
smb_io_printer_driver_info_2(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_2
*info
, int depth
)
2522 prs_struct
*ps
=&buffer
->prs
;
2524 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_2");
2527 buffer
->struct_start
=prs_offset(ps
);
2529 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2531 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2533 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2535 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2537 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2539 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2545 /*******************************************************************
2546 Parse a DRIVER_INFO_3 structure.
2547 ********************************************************************/
2549 BOOL
smb_io_printer_driver_info_3(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_3
*info
, int depth
)
2551 prs_struct
*ps
=&buffer
->prs
;
2553 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_3");
2556 buffer
->struct_start
=prs_offset(ps
);
2558 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2560 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2562 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2564 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2566 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2568 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2570 if (!smb_io_relstr("helpfile", buffer
, depth
, &info
->helpfile
))
2573 if (!smb_io_relarraystr("dependentfiles", buffer
, depth
, &info
->dependentfiles
))
2576 if (!smb_io_relstr("monitorname", buffer
, depth
, &info
->monitorname
))
2578 if (!smb_io_relstr("defaultdatatype", buffer
, depth
, &info
->defaultdatatype
))
2584 /*******************************************************************
2585 Parse a DRIVER_INFO_6 structure.
2586 ********************************************************************/
2588 BOOL
smb_io_printer_driver_info_6(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_6
*info
, int depth
)
2590 prs_struct
*ps
=&buffer
->prs
;
2592 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_6");
2595 buffer
->struct_start
=prs_offset(ps
);
2597 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2599 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2601 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2603 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2605 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2607 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2609 if (!smb_io_relstr("helpfile", buffer
, depth
, &info
->helpfile
))
2612 if (!smb_io_relarraystr("dependentfiles", buffer
, depth
, &info
->dependentfiles
))
2615 if (!smb_io_relstr("monitorname", buffer
, depth
, &info
->monitorname
))
2617 if (!smb_io_relstr("defaultdatatype", buffer
, depth
, &info
->defaultdatatype
))
2620 if (!smb_io_relarraystr("previousdrivernames", buffer
, depth
, &info
->previousdrivernames
))
2623 if (!prs_uint32("date.low", ps
, depth
, &info
->driver_date
.low
))
2625 if (!prs_uint32("date.high", ps
, depth
, &info
->driver_date
.high
))
2628 if (!prs_uint32("padding", ps
, depth
, &info
->padding
))
2631 if (!prs_uint32("driver_version_low", ps
, depth
, &info
->driver_version_low
))
2634 if (!prs_uint32("driver_version_high", ps
, depth
, &info
->driver_version_high
))
2637 if (!smb_io_relstr("mfgname", buffer
, depth
, &info
->mfgname
))
2639 if (!smb_io_relstr("oem_url", buffer
, depth
, &info
->oem_url
))
2641 if (!smb_io_relstr("hardware_id", buffer
, depth
, &info
->hardware_id
))
2643 if (!smb_io_relstr("provider", buffer
, depth
, &info
->provider
))
2649 /*******************************************************************
2650 Parse a JOB_INFO_1 structure.
2651 ********************************************************************/
2653 BOOL
smb_io_job_info_1(const char *desc
, RPC_BUFFER
*buffer
, JOB_INFO_1
*info
, int depth
)
2655 prs_struct
*ps
=&buffer
->prs
;
2657 prs_debug(ps
, depth
, desc
, "smb_io_job_info_1");
2660 buffer
->struct_start
=prs_offset(ps
);
2662 if (!prs_uint32("jobid", ps
, depth
, &info
->jobid
))
2664 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2666 if (!smb_io_relstr("machinename", buffer
, depth
, &info
->machinename
))
2668 if (!smb_io_relstr("username", buffer
, depth
, &info
->username
))
2670 if (!smb_io_relstr("document", buffer
, depth
, &info
->document
))
2672 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2674 if (!smb_io_relstr("text_status", buffer
, depth
, &info
->text_status
))
2676 if (!prs_uint32("status", ps
, depth
, &info
->status
))
2678 if (!prs_uint32("priority", ps
, depth
, &info
->priority
))
2680 if (!prs_uint32("position", ps
, depth
, &info
->position
))
2682 if (!prs_uint32("totalpages", ps
, depth
, &info
->totalpages
))
2684 if (!prs_uint32("pagesprinted", ps
, depth
, &info
->pagesprinted
))
2686 if (!spoolss_io_system_time("submitted", ps
, depth
, &info
->submitted
))
2692 /*******************************************************************
2693 Parse a JOB_INFO_2 structure.
2694 ********************************************************************/
2696 BOOL
smb_io_job_info_2(const char *desc
, RPC_BUFFER
*buffer
, JOB_INFO_2
*info
, int depth
)
2699 prs_struct
*ps
=&buffer
->prs
;
2701 prs_debug(ps
, depth
, desc
, "smb_io_job_info_2");
2704 buffer
->struct_start
=prs_offset(ps
);
2706 if (!prs_uint32("jobid",ps
, depth
, &info
->jobid
))
2708 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2710 if (!smb_io_relstr("machinename", buffer
, depth
, &info
->machinename
))
2712 if (!smb_io_relstr("username", buffer
, depth
, &info
->username
))
2714 if (!smb_io_relstr("document", buffer
, depth
, &info
->document
))
2716 if (!smb_io_relstr("notifyname", buffer
, depth
, &info
->notifyname
))
2718 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2721 if (!smb_io_relstr("printprocessor", buffer
, depth
, &info
->printprocessor
))
2723 if (!smb_io_relstr("parameters", buffer
, depth
, &info
->parameters
))
2725 if (!smb_io_relstr("drivername", buffer
, depth
, &info
->drivername
))
2727 if (!smb_io_reldevmode("devmode", buffer
, depth
, &info
->devmode
))
2729 if (!smb_io_relstr("text_status", buffer
, depth
, &info
->text_status
))
2732 /* SEC_DESC sec_desc;*/
2733 if (!prs_uint32("Hack! sec desc", ps
, depth
, &pipo
))
2736 if (!prs_uint32("status",ps
, depth
, &info
->status
))
2738 if (!prs_uint32("priority",ps
, depth
, &info
->priority
))
2740 if (!prs_uint32("position",ps
, depth
, &info
->position
))
2742 if (!prs_uint32("starttime",ps
, depth
, &info
->starttime
))
2744 if (!prs_uint32("untiltime",ps
, depth
, &info
->untiltime
))
2746 if (!prs_uint32("totalpages",ps
, depth
, &info
->totalpages
))
2748 if (!prs_uint32("size",ps
, depth
, &info
->size
))
2750 if (!spoolss_io_system_time("submitted", ps
, depth
, &info
->submitted
) )
2752 if (!prs_uint32("timeelapsed",ps
, depth
, &info
->timeelapsed
))
2754 if (!prs_uint32("pagesprinted",ps
, depth
, &info
->pagesprinted
))
2760 /*******************************************************************
2761 ********************************************************************/
2763 BOOL
smb_io_form_1(const char *desc
, RPC_BUFFER
*buffer
, FORM_1
*info
, int depth
)
2765 prs_struct
*ps
=&buffer
->prs
;
2767 prs_debug(ps
, depth
, desc
, "smb_io_form_1");
2770 buffer
->struct_start
=prs_offset(ps
);
2772 if (!prs_uint32("flag", ps
, depth
, &info
->flag
))
2775 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2778 if (!prs_uint32("width", ps
, depth
, &info
->width
))
2780 if (!prs_uint32("length", ps
, depth
, &info
->length
))
2782 if (!prs_uint32("left", ps
, depth
, &info
->left
))
2784 if (!prs_uint32("top", ps
, depth
, &info
->top
))
2786 if (!prs_uint32("right", ps
, depth
, &info
->right
))
2788 if (!prs_uint32("bottom", ps
, depth
, &info
->bottom
))
2796 /*******************************************************************
2797 Parse a DRIVER_DIRECTORY_1 structure.
2798 ********************************************************************/
2800 BOOL
smb_io_driverdir_1(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_DIRECTORY_1
*info
, int depth
)
2802 prs_struct
*ps
=&buffer
->prs
;
2804 prs_debug(ps
, depth
, desc
, "smb_io_driverdir_1");
2807 buffer
->struct_start
=prs_offset(ps
);
2809 if (!smb_io_unistr(desc
, &info
->name
, ps
, depth
))
2815 /*******************************************************************
2816 Parse a PORT_INFO_1 structure.
2817 ********************************************************************/
2819 BOOL
smb_io_port_1(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_1
*info
, int depth
)
2821 prs_struct
*ps
=&buffer
->prs
;
2823 prs_debug(ps
, depth
, desc
, "smb_io_port_1");
2826 buffer
->struct_start
=prs_offset(ps
);
2828 if(!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2834 /*******************************************************************
2835 Parse a PORT_INFO_2 structure.
2836 ********************************************************************/
2838 BOOL
smb_io_port_2(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_2
*info
, int depth
)
2840 prs_struct
*ps
=&buffer
->prs
;
2842 prs_debug(ps
, depth
, desc
, "smb_io_port_2");
2845 buffer
->struct_start
=prs_offset(ps
);
2847 if(!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2849 if(!smb_io_relstr("monitor_name", buffer
, depth
, &info
->monitor_name
))
2851 if(!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2853 if(!prs_uint32("port_type", ps
, depth
, &info
->port_type
))
2855 if(!prs_uint32("reserved", ps
, depth
, &info
->reserved
))
2861 /*******************************************************************
2862 ********************************************************************/
2864 BOOL
smb_io_printprocessor_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCESSOR_1
*info
, int depth
)
2866 prs_struct
*ps
=&buffer
->prs
;
2868 prs_debug(ps
, depth
, desc
, "smb_io_printprocessor_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_printprocdatatype_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCDATATYPE_1
*info
, int depth
)
2884 prs_struct
*ps
=&buffer
->prs
;
2886 prs_debug(ps
, depth
, desc
, "smb_io_printprocdatatype_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_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTMONITOR_1
*info
, int depth
)
2902 prs_struct
*ps
=&buffer
->prs
;
2904 prs_debug(ps
, depth
, desc
, "smb_io_printmonitor_info_1");
2907 buffer
->struct_start
=prs_offset(ps
);
2909 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2915 /*******************************************************************
2916 ********************************************************************/
2918 BOOL
smb_io_printmonitor_info_2(const char *desc
, RPC_BUFFER
*buffer
, PRINTMONITOR_2
*info
, int depth
)
2920 prs_struct
*ps
=&buffer
->prs
;
2922 prs_debug(ps
, depth
, desc
, "smb_io_printmonitor_info_2");
2925 buffer
->struct_start
=prs_offset(ps
);
2927 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2929 if (!smb_io_relstr("environment", buffer
, depth
, &info
->environment
))
2931 if (!smb_io_relstr("dll_name", buffer
, depth
, &info
->dll_name
))
2937 /*******************************************************************
2938 return the size required by a struct in the stream
2939 ********************************************************************/
2941 uint32
spoolss_size_printer_info_0(PRINTER_INFO_0
*info
)
2945 size
+=size_of_relative_string( &info
->printername
);
2946 size
+=size_of_relative_string( &info
->servername
);
2948 size
+=size_of_uint32( &info
->cjobs
);
2949 size
+=size_of_uint32( &info
->total_jobs
);
2950 size
+=size_of_uint32( &info
->total_bytes
);
2952 size
+=size_of_uint16( &info
->year
);
2953 size
+=size_of_uint16( &info
->month
);
2954 size
+=size_of_uint16( &info
->dayofweek
);
2955 size
+=size_of_uint16( &info
->day
);
2956 size
+=size_of_uint16( &info
->hour
);
2957 size
+=size_of_uint16( &info
->minute
);
2958 size
+=size_of_uint16( &info
->second
);
2959 size
+=size_of_uint16( &info
->milliseconds
);
2961 size
+=size_of_uint32( &info
->global_counter
);
2962 size
+=size_of_uint32( &info
->total_pages
);
2964 size
+=size_of_uint16( &info
->major_version
);
2965 size
+=size_of_uint16( &info
->build_version
);
2967 size
+=size_of_uint32( &info
->unknown7
);
2968 size
+=size_of_uint32( &info
->unknown8
);
2969 size
+=size_of_uint32( &info
->unknown9
);
2970 size
+=size_of_uint32( &info
->session_counter
);
2971 size
+=size_of_uint32( &info
->unknown11
);
2972 size
+=size_of_uint32( &info
->printer_errors
);
2973 size
+=size_of_uint32( &info
->unknown13
);
2974 size
+=size_of_uint32( &info
->unknown14
);
2975 size
+=size_of_uint32( &info
->unknown15
);
2976 size
+=size_of_uint32( &info
->unknown16
);
2977 size
+=size_of_uint32( &info
->change_id
);
2978 size
+=size_of_uint32( &info
->unknown18
);
2979 size
+=size_of_uint32( &info
->status
);
2980 size
+=size_of_uint32( &info
->unknown20
);
2981 size
+=size_of_uint32( &info
->c_setprinter
);
2983 size
+=size_of_uint16( &info
->unknown22
);
2984 size
+=size_of_uint16( &info
->unknown23
);
2985 size
+=size_of_uint16( &info
->unknown24
);
2986 size
+=size_of_uint16( &info
->unknown25
);
2987 size
+=size_of_uint16( &info
->unknown26
);
2988 size
+=size_of_uint16( &info
->unknown27
);
2989 size
+=size_of_uint16( &info
->unknown28
);
2990 size
+=size_of_uint16( &info
->unknown29
);
2995 /*******************************************************************
2996 return the size required by a struct in the stream
2997 ********************************************************************/
2999 uint32
spoolss_size_printer_info_1(PRINTER_INFO_1
*info
)
3003 size
+=size_of_uint32( &info
->flags
);
3004 size
+=size_of_relative_string( &info
->description
);
3005 size
+=size_of_relative_string( &info
->name
);
3006 size
+=size_of_relative_string( &info
->comment
);
3011 /*******************************************************************
3012 return the size required by a struct in the stream
3013 ********************************************************************/
3015 uint32
spoolss_size_printer_info_2(PRINTER_INFO_2
*info
)
3021 size
+= sec_desc_size( info
->secdesc
);
3023 size
+=size_of_device_mode( info
->devmode
);
3025 size
+=size_of_relative_string( &info
->servername
);
3026 size
+=size_of_relative_string( &info
->printername
);
3027 size
+=size_of_relative_string( &info
->sharename
);
3028 size
+=size_of_relative_string( &info
->portname
);
3029 size
+=size_of_relative_string( &info
->drivername
);
3030 size
+=size_of_relative_string( &info
->comment
);
3031 size
+=size_of_relative_string( &info
->location
);
3033 size
+=size_of_relative_string( &info
->sepfile
);
3034 size
+=size_of_relative_string( &info
->printprocessor
);
3035 size
+=size_of_relative_string( &info
->datatype
);
3036 size
+=size_of_relative_string( &info
->parameters
);
3038 size
+=size_of_uint32( &info
->attributes
);
3039 size
+=size_of_uint32( &info
->priority
);
3040 size
+=size_of_uint32( &info
->defaultpriority
);
3041 size
+=size_of_uint32( &info
->starttime
);
3042 size
+=size_of_uint32( &info
->untiltime
);
3043 size
+=size_of_uint32( &info
->status
);
3044 size
+=size_of_uint32( &info
->cjobs
);
3045 size
+=size_of_uint32( &info
->averageppm
);
3048 * add any adjustments for alignment. This is
3049 * not optimal since we could be calling this
3050 * function from a loop (e.g. enumprinters), but
3051 * it is easier to maintain the calculation here and
3052 * not place the burden on the caller to remember. --jerry
3054 if ((size
% 4) != 0)
3055 size
+= 4 - (size
% 4);
3060 /*******************************************************************
3061 return the size required by a struct in the stream
3062 ********************************************************************/
3064 uint32
spoolss_size_printer_info_4(PRINTER_INFO_4
*info
)
3068 size
+=size_of_relative_string( &info
->printername
);
3069 size
+=size_of_relative_string( &info
->servername
);
3071 size
+=size_of_uint32( &info
->attributes
);
3075 /*******************************************************************
3076 return the size required by a struct in the stream
3077 ********************************************************************/
3079 uint32
spoolss_size_printer_info_5(PRINTER_INFO_5
*info
)
3083 size
+=size_of_relative_string( &info
->printername
);
3084 size
+=size_of_relative_string( &info
->portname
);
3086 size
+=size_of_uint32( &info
->attributes
);
3087 size
+=size_of_uint32( &info
->device_not_selected_timeout
);
3088 size
+=size_of_uint32( &info
->transmission_retry_timeout
);
3093 /*******************************************************************
3094 return the size required by a struct in the stream
3095 ********************************************************************/
3097 uint32
spoolss_size_printer_info_3(PRINTER_INFO_3
*info
)
3099 /* The 4 is for the self relative pointer.. */
3100 /* JRA !!!! TESTME - WHAT ABOUT prs_align.... !!! */
3101 return 4 + (uint32
)sec_desc_size( info
->secdesc
);
3104 /*******************************************************************
3105 return the size required by a struct in the stream
3106 ********************************************************************/
3108 uint32
spoolss_size_printer_info_7(PRINTER_INFO_7
*info
)
3112 size
+=size_of_relative_string( &info
->guid
);
3113 size
+=size_of_uint32( &info
->action
);
3117 /*******************************************************************
3118 return the size required by a struct in the stream
3119 ********************************************************************/
3121 uint32
spoolss_size_printer_driver_info_1(DRIVER_INFO_1
*info
)
3124 size
+=size_of_relative_string( &info
->name
);
3129 /*******************************************************************
3130 return the size required by a struct in the stream
3131 ********************************************************************/
3133 uint32
spoolss_size_printer_driver_info_2(DRIVER_INFO_2
*info
)
3136 size
+=size_of_uint32( &info
->version
);
3137 size
+=size_of_relative_string( &info
->name
);
3138 size
+=size_of_relative_string( &info
->architecture
);
3139 size
+=size_of_relative_string( &info
->driverpath
);
3140 size
+=size_of_relative_string( &info
->datafile
);
3141 size
+=size_of_relative_string( &info
->configfile
);
3146 /*******************************************************************
3147 return the size required by a string array.
3148 ********************************************************************/
3150 uint32
spoolss_size_string_array(uint16
*string
)
3155 for (i
=0; (string
[i
]!=0x0000) || (string
[i
+1]!=0x0000); i
++);
3157 i
=i
+2; /* to count all chars including the leading zero */
3158 i
=2*i
; /* because we need the value in bytes */
3159 i
=i
+4; /* the offset pointer size */
3164 /*******************************************************************
3165 return the size required by a struct in the stream
3166 ********************************************************************/
3168 uint32
spoolss_size_printer_driver_info_3(DRIVER_INFO_3
*info
)
3172 size
+=size_of_uint32( &info
->version
);
3173 size
+=size_of_relative_string( &info
->name
);
3174 size
+=size_of_relative_string( &info
->architecture
);
3175 size
+=size_of_relative_string( &info
->driverpath
);
3176 size
+=size_of_relative_string( &info
->datafile
);
3177 size
+=size_of_relative_string( &info
->configfile
);
3178 size
+=size_of_relative_string( &info
->helpfile
);
3179 size
+=size_of_relative_string( &info
->monitorname
);
3180 size
+=size_of_relative_string( &info
->defaultdatatype
);
3182 size
+=spoolss_size_string_array(info
->dependentfiles
);
3187 /*******************************************************************
3188 return the size required by a struct in the stream
3189 ********************************************************************/
3191 uint32
spoolss_size_printer_driver_info_6(DRIVER_INFO_6
*info
)
3195 size
+=size_of_uint32( &info
->version
);
3196 size
+=size_of_relative_string( &info
->name
);
3197 size
+=size_of_relative_string( &info
->architecture
);
3198 size
+=size_of_relative_string( &info
->driverpath
);
3199 size
+=size_of_relative_string( &info
->datafile
);
3200 size
+=size_of_relative_string( &info
->configfile
);
3201 size
+=size_of_relative_string( &info
->helpfile
);
3203 size
+=spoolss_size_string_array(info
->dependentfiles
);
3205 size
+=size_of_relative_string( &info
->monitorname
);
3206 size
+=size_of_relative_string( &info
->defaultdatatype
);
3208 size
+=spoolss_size_string_array(info
->previousdrivernames
);
3210 size
+=size_of_nttime(&info
->driver_date
);
3211 size
+=size_of_uint32( &info
->padding
);
3212 size
+=size_of_uint32( &info
->driver_version_low
);
3213 size
+=size_of_uint32( &info
->driver_version_high
);
3214 size
+=size_of_relative_string( &info
->mfgname
);
3215 size
+=size_of_relative_string( &info
->oem_url
);
3216 size
+=size_of_relative_string( &info
->hardware_id
);
3217 size
+=size_of_relative_string( &info
->provider
);
3222 /*******************************************************************
3223 return the size required by a struct in the stream
3224 ********************************************************************/
3226 uint32
spoolss_size_job_info_1(JOB_INFO_1
*info
)
3229 size
+=size_of_uint32( &info
->jobid
);
3230 size
+=size_of_relative_string( &info
->printername
);
3231 size
+=size_of_relative_string( &info
->machinename
);
3232 size
+=size_of_relative_string( &info
->username
);
3233 size
+=size_of_relative_string( &info
->document
);
3234 size
+=size_of_relative_string( &info
->datatype
);
3235 size
+=size_of_relative_string( &info
->text_status
);
3236 size
+=size_of_uint32( &info
->status
);
3237 size
+=size_of_uint32( &info
->priority
);
3238 size
+=size_of_uint32( &info
->position
);
3239 size
+=size_of_uint32( &info
->totalpages
);
3240 size
+=size_of_uint32( &info
->pagesprinted
);
3241 size
+=size_of_systemtime( &info
->submitted
);
3246 /*******************************************************************
3247 return the size required by a struct in the stream
3248 ********************************************************************/
3250 uint32
spoolss_size_job_info_2(JOB_INFO_2
*info
)
3254 size
+=4; /* size of sec desc ptr */
3256 size
+=size_of_uint32( &info
->jobid
);
3257 size
+=size_of_relative_string( &info
->printername
);
3258 size
+=size_of_relative_string( &info
->machinename
);
3259 size
+=size_of_relative_string( &info
->username
);
3260 size
+=size_of_relative_string( &info
->document
);
3261 size
+=size_of_relative_string( &info
->notifyname
);
3262 size
+=size_of_relative_string( &info
->datatype
);
3263 size
+=size_of_relative_string( &info
->printprocessor
);
3264 size
+=size_of_relative_string( &info
->parameters
);
3265 size
+=size_of_relative_string( &info
->drivername
);
3266 size
+=size_of_device_mode( info
->devmode
);
3267 size
+=size_of_relative_string( &info
->text_status
);
3268 /* SEC_DESC sec_desc;*/
3269 size
+=size_of_uint32( &info
->status
);
3270 size
+=size_of_uint32( &info
->priority
);
3271 size
+=size_of_uint32( &info
->position
);
3272 size
+=size_of_uint32( &info
->starttime
);
3273 size
+=size_of_uint32( &info
->untiltime
);
3274 size
+=size_of_uint32( &info
->totalpages
);
3275 size
+=size_of_uint32( &info
->size
);
3276 size
+=size_of_systemtime( &info
->submitted
);
3277 size
+=size_of_uint32( &info
->timeelapsed
);
3278 size
+=size_of_uint32( &info
->pagesprinted
);
3283 /*******************************************************************
3284 return the size required by a struct in the stream
3285 ********************************************************************/
3287 uint32
spoolss_size_form_1(FORM_1
*info
)
3291 size
+=size_of_uint32( &info
->flag
);
3292 size
+=size_of_relative_string( &info
->name
);
3293 size
+=size_of_uint32( &info
->width
);
3294 size
+=size_of_uint32( &info
->length
);
3295 size
+=size_of_uint32( &info
->left
);
3296 size
+=size_of_uint32( &info
->top
);
3297 size
+=size_of_uint32( &info
->right
);
3298 size
+=size_of_uint32( &info
->bottom
);
3303 /*******************************************************************
3304 return the size required by a struct in the stream
3305 ********************************************************************/
3307 uint32
spoolss_size_port_info_1(PORT_INFO_1
*info
)
3311 size
+=size_of_relative_string( &info
->port_name
);
3316 /*******************************************************************
3317 return the size required by a struct in the stream
3318 ********************************************************************/
3320 uint32
spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1
*info
)
3324 size
=str_len_uni(&info
->name
); /* the string length */
3325 size
=size
+1; /* add the leading zero */
3326 size
=size
*2; /* convert in char */
3331 /*******************************************************************
3332 return the size required by a struct in the stream
3333 ********************************************************************/
3335 uint32
spoolss_size_printprocessordirectory_info_1(PRINTPROCESSOR_DIRECTORY_1
*info
)
3339 size
=str_len_uni(&info
->name
); /* the string length */
3340 size
=size
+1; /* add the leading zero */
3341 size
=size
*2; /* convert in char */
3346 /*******************************************************************
3347 return the size required by a struct in the stream
3348 ********************************************************************/
3350 uint32
spoolss_size_port_info_2(PORT_INFO_2
*info
)
3354 size
+=size_of_relative_string( &info
->port_name
);
3355 size
+=size_of_relative_string( &info
->monitor_name
);
3356 size
+=size_of_relative_string( &info
->description
);
3358 size
+=size_of_uint32( &info
->port_type
);
3359 size
+=size_of_uint32( &info
->reserved
);
3364 /*******************************************************************
3365 return the size required by a struct in the stream
3366 ********************************************************************/
3368 uint32
spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1
*info
)
3371 size
+=size_of_relative_string( &info
->name
);
3376 /*******************************************************************
3377 return the size required by a struct in the stream
3378 ********************************************************************/
3380 uint32
spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1
*info
)
3383 size
+=size_of_relative_string( &info
->name
);
3388 /*******************************************************************
3389 return the size required by a struct in the stream
3390 ********************************************************************/
3391 uint32
spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES
*p
)
3398 /* uint32(offset) + uint32(length) + length) */
3399 size
+= (size_of_uint32(&p
->value_len
)*2) + p
->value_len
;
3400 size
+= (size_of_uint32(&p
->data_len
)*2) + p
->data_len
+ (p
->data_len
%2) ;
3402 size
+= size_of_uint32(&p
->type
);
3407 /*******************************************************************
3408 return the size required by a struct in the stream
3409 ********************************************************************/
3411 uint32
spoolss_size_printmonitor_info_1(PRINTMONITOR_1
*info
)
3414 size
+=size_of_relative_string( &info
->name
);
3419 /*******************************************************************
3420 return the size required by a struct in the stream
3421 ********************************************************************/
3423 uint32
spoolss_size_printmonitor_info_2(PRINTMONITOR_2
*info
)
3426 size
+=size_of_relative_string( &info
->name
);
3427 size
+=size_of_relative_string( &info
->environment
);
3428 size
+=size_of_relative_string( &info
->dll_name
);
3433 /*******************************************************************
3435 ********************************************************************/
3437 BOOL
make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2
*q_u
,
3438 const POLICY_HND
*hnd
,
3439 const fstring architecture
,
3440 uint32 level
, uint32 clientmajor
, uint32 clientminor
,
3441 RPC_BUFFER
*buffer
, uint32 offered
)
3446 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3448 init_buf_unistr2(&q_u
->architecture
, &q_u
->architecture_ptr
, architecture
);
3451 q_u
->clientmajorversion
=clientmajor
;
3452 q_u
->clientminorversion
=clientminor
;
3455 q_u
->offered
=offered
;
3460 /*******************************************************************
3462 * called from spoolss_getprinterdriver2 (srv_spoolss.c)
3463 ********************************************************************/
3465 BOOL
spoolss_io_q_getprinterdriver2(const char *desc
, SPOOL_Q_GETPRINTERDRIVER2
*q_u
, prs_struct
*ps
, int depth
)
3467 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdriver2");
3473 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3475 if(!prs_uint32("architecture_ptr", ps
, depth
, &q_u
->architecture_ptr
))
3477 if(!smb_io_unistr2("architecture", &q_u
->architecture
, q_u
->architecture_ptr
, ps
, depth
))
3482 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3485 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3491 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3494 if(!prs_uint32("clientmajorversion", ps
, depth
, &q_u
->clientmajorversion
))
3496 if(!prs_uint32("clientminorversion", ps
, depth
, &q_u
->clientminorversion
))
3502 /*******************************************************************
3504 * called from spoolss_getprinterdriver2 (srv_spoolss.c)
3505 ********************************************************************/
3507 BOOL
spoolss_io_r_getprinterdriver2(const char *desc
, SPOOL_R_GETPRINTERDRIVER2
*r_u
, prs_struct
*ps
, int depth
)
3509 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdriver2");
3515 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3520 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3522 if (!prs_uint32("servermajorversion", ps
, depth
, &r_u
->servermajorversion
))
3524 if (!prs_uint32("serverminorversion", ps
, depth
, &r_u
->serverminorversion
))
3526 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3532 /*******************************************************************
3534 ********************************************************************/
3536 BOOL
make_spoolss_q_enumprinters(
3537 SPOOL_Q_ENUMPRINTERS
*q_u
,
3547 q_u
->servername_ptr
= (servername
!= NULL
) ? 1 : 0;
3548 init_buf_unistr2(&q_u
->servername
, &q_u
->servername_ptr
, servername
);
3552 q_u
->offered
=offered
;
3557 /*******************************************************************
3559 ********************************************************************/
3561 BOOL
make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS
*q_u
,
3562 fstring servername
, uint32 level
,
3563 RPC_BUFFER
*buffer
, uint32 offered
)
3565 q_u
->name_ptr
= (servername
!= NULL
) ? 1 : 0;
3566 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, servername
);
3570 q_u
->offered
=offered
;
3575 /*******************************************************************
3577 * called from spoolss_enumprinters (srv_spoolss.c)
3578 ********************************************************************/
3580 BOOL
spoolss_io_q_enumprinters(const char *desc
, SPOOL_Q_ENUMPRINTERS
*q_u
, prs_struct
*ps
, int depth
)
3582 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinters");
3588 if (!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
3590 if (!prs_uint32("servername_ptr", ps
, depth
, &q_u
->servername_ptr
))
3593 if (!smb_io_unistr2("", &q_u
->servername
, q_u
->servername_ptr
, ps
, depth
))
3598 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
3601 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3606 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3612 /*******************************************************************
3613 Parse a SPOOL_R_ENUMPRINTERS structure.
3614 ********************************************************************/
3616 BOOL
spoolss_io_r_enumprinters(const char *desc
, SPOOL_R_ENUMPRINTERS
*r_u
, prs_struct
*ps
, int depth
)
3618 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinters");
3624 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3630 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3633 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
3636 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3642 /*******************************************************************
3643 * write a structure.
3644 * called from spoolss_r_enum_printers (srv_spoolss.c)
3646 ********************************************************************/
3648 BOOL
spoolss_io_r_getprinter(const char *desc
, SPOOL_R_GETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
3650 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinter");
3656 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3662 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3665 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3671 /*******************************************************************
3673 * called from spoolss_getprinter (srv_spoolss.c)
3674 ********************************************************************/
3676 BOOL
spoolss_io_q_getprinter(const char *desc
, SPOOL_Q_GETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
3678 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinter");
3684 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3686 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
3689 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3694 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3700 /*******************************************************************
3702 ********************************************************************/
3704 BOOL
make_spoolss_q_getprinter(
3705 TALLOC_CTX
*mem_ctx
,
3706 SPOOL_Q_GETPRINTER
*q_u
,
3707 const POLICY_HND
*hnd
,
3717 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3721 q_u
->offered
=offered
;
3726 /*******************************************************************
3728 ********************************************************************/
3729 BOOL
make_spoolss_q_setprinter(TALLOC_CTX
*mem_ctx
, SPOOL_Q_SETPRINTER
*q_u
,
3730 const POLICY_HND
*hnd
, uint32 level
, PRINTER_INFO_CTR
*info
,
3734 DEVICEMODE
*devmode
;
3739 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3742 q_u
->info
.level
= level
;
3743 q_u
->info
.info_ptr
= (info
!= NULL
) ? 1 : 0;
3746 /* There's no such thing as a setprinter level 1 */
3749 secdesc
= info
->printers_2
->secdesc
;
3750 devmode
= info
->printers_2
->devmode
;
3752 make_spoolss_printer_info_2 (mem_ctx
, &q_u
->info
.info_2
, info
->printers_2
);
3753 #if 1 /* JERRY TEST */
3754 q_u
->secdesc_ctr
= SMB_MALLOC_P(SEC_DESC_BUF
);
3755 if (!q_u
->secdesc_ctr
)
3757 q_u
->secdesc_ctr
->ptr
= (secdesc
!= NULL
) ? 1: 0;
3758 q_u
->secdesc_ctr
->max_len
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3759 q_u
->secdesc_ctr
->len
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3760 q_u
->secdesc_ctr
->sec
= secdesc
;
3762 q_u
->devmode_ctr
.devmode_ptr
= (devmode
!= NULL
) ? 1 : 0;
3763 q_u
->devmode_ctr
.size
= (devmode
!= NULL
) ? sizeof(DEVICEMODE
) + (3*sizeof(uint32
)) : 0;
3764 q_u
->devmode_ctr
.devmode
= devmode
;
3766 q_u
->secdesc_ctr
= NULL
;
3768 q_u
->devmode_ctr
.devmode_ptr
= 0;
3769 q_u
->devmode_ctr
.size
= 0;
3770 q_u
->devmode_ctr
.devmode
= NULL
;
3774 secdesc
= info
->printers_3
->secdesc
;
3776 make_spoolss_printer_info_3 (mem_ctx
, &q_u
->info
.info_3
, info
->printers_3
);
3778 q_u
->secdesc_ctr
= SMB_MALLOC_P(SEC_DESC_BUF
);
3779 if (!q_u
->secdesc_ctr
)
3781 q_u
->secdesc_ctr
->ptr
= (secdesc
!= NULL
) ? 1: 0;
3782 q_u
->secdesc_ctr
->max_len
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3783 q_u
->secdesc_ctr
->len
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3784 q_u
->secdesc_ctr
->sec
= secdesc
;
3788 make_spoolss_printer_info_7 (mem_ctx
, &q_u
->info
.info_7
, info
->printers_7
);
3792 DEBUG(0,("make_spoolss_q_setprinter: Unknown info level [%d]\n", level
));
3797 q_u
->command
= command
;
3803 /*******************************************************************
3804 ********************************************************************/
3806 BOOL
spoolss_io_r_setprinter(const char *desc
, SPOOL_R_SETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
3808 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinter");
3814 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3820 /*******************************************************************
3821 Marshall/unmarshall a SPOOL_Q_SETPRINTER struct.
3822 ********************************************************************/
3824 BOOL
spoolss_io_q_setprinter(const char *desc
, SPOOL_Q_SETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
3826 uint32 ptr_sec_desc
= 0;
3828 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinter");
3834 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
,ps
, depth
))
3836 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3839 /* check for supported levels and structures we know about */
3841 switch ( q_u
->level
) {
3846 /* supported levels */
3849 DEBUG(0,("spoolss_io_q_setprinter: unsupported printer info level [%d]\n",
3855 if(!spool_io_printer_info_level("", &q_u
->info
, ps
, depth
))
3858 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
3868 ptr_sec_desc
= q_u
->info
.info_2
->secdesc_ptr
;
3873 ptr_sec_desc
= q_u
->info
.info_3
->secdesc_ptr
;
3879 if (!sec_io_desc_buf(desc
, &q_u
->secdesc_ctr
, ps
, depth
))
3884 /* Parse a NULL security descriptor. This should really
3885 happen inside the sec_io_desc_buf() function. */
3887 prs_debug(ps
, depth
, "", "sec_io_desc_buf");
3888 if (!prs_uint32("size", ps
, depth
+ 1, &dummy
))
3890 if (!prs_uint32("ptr", ps
, depth
+ 1, &dummy
)) return
3894 if(!prs_uint32("command", ps
, depth
, &q_u
->command
))
3900 /*******************************************************************
3901 ********************************************************************/
3903 BOOL
spoolss_io_r_fcpn(const char *desc
, SPOOL_R_FCPN
*r_u
, prs_struct
*ps
, int depth
)
3905 prs_debug(ps
, depth
, desc
, "spoolss_io_r_fcpn");
3911 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3917 /*******************************************************************
3918 ********************************************************************/
3920 BOOL
spoolss_io_q_fcpn(const char *desc
, SPOOL_Q_FCPN
*q_u
, prs_struct
*ps
, int depth
)
3923 prs_debug(ps
, depth
, desc
, "spoolss_io_q_fcpn");
3929 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
3936 /*******************************************************************
3937 ********************************************************************/
3939 BOOL
spoolss_io_r_addjob(const char *desc
, SPOOL_R_ADDJOB
*r_u
, prs_struct
*ps
, int depth
)
3941 prs_debug(ps
, depth
, desc
, "");
3947 if(!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3953 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3956 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3962 /*******************************************************************
3963 ********************************************************************/
3965 BOOL
spoolss_io_q_addjob(const char *desc
, SPOOL_Q_ADDJOB
*q_u
, prs_struct
*ps
, int depth
)
3967 prs_debug(ps
, depth
, desc
, "");
3973 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3975 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3978 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3984 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3990 /*******************************************************************
3991 ********************************************************************/
3993 BOOL
spoolss_io_r_enumjobs(const char *desc
, SPOOL_R_ENUMJOBS
*r_u
, prs_struct
*ps
, int depth
)
3995 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumjobs");
4001 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4007 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4010 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4013 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4019 /*******************************************************************
4020 ********************************************************************/
4022 BOOL
make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS
*q_u
, const POLICY_HND
*hnd
,
4033 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
4034 q_u
->firstjob
= firstjob
;
4035 q_u
->numofjobs
= numofjobs
;
4037 q_u
->buffer
= buffer
;
4038 q_u
->offered
= offered
;
4042 /*******************************************************************
4043 ********************************************************************/
4045 BOOL
spoolss_io_q_enumjobs(const char *desc
, SPOOL_Q_ENUMJOBS
*q_u
, prs_struct
*ps
, int depth
)
4047 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumjobs");
4053 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
, ps
, depth
))
4056 if (!prs_uint32("firstjob", ps
, depth
, &q_u
->firstjob
))
4058 if (!prs_uint32("numofjobs", ps
, depth
, &q_u
->numofjobs
))
4060 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4063 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4069 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4075 /*******************************************************************
4076 ********************************************************************/
4078 BOOL
spoolss_io_r_schedulejob(const char *desc
, SPOOL_R_SCHEDULEJOB
*r_u
, prs_struct
*ps
, int depth
)
4080 prs_debug(ps
, depth
, desc
, "spoolss_io_r_schedulejob");
4086 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4092 /*******************************************************************
4093 ********************************************************************/
4095 BOOL
spoolss_io_q_schedulejob(const char *desc
, SPOOL_Q_SCHEDULEJOB
*q_u
, prs_struct
*ps
, int depth
)
4097 prs_debug(ps
, depth
, desc
, "spoolss_io_q_schedulejob");
4103 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4105 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
4111 /*******************************************************************
4112 ********************************************************************/
4114 BOOL
spoolss_io_r_setjob(const char *desc
, SPOOL_R_SETJOB
*r_u
, prs_struct
*ps
, int depth
)
4116 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setjob");
4122 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4128 /*******************************************************************
4129 ********************************************************************/
4131 BOOL
spoolss_io_q_setjob(const char *desc
, SPOOL_Q_SETJOB
*q_u
, prs_struct
*ps
, int depth
)
4133 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setjob");
4139 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4141 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
4144 * level is usually 0. If (level!=0) then I'm in trouble !
4145 * I will try to generate setjob command with level!=0, one day.
4147 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
4149 if(!prs_uint32("command", ps
, depth
, &q_u
->command
))
4155 /*******************************************************************
4156 Parse a SPOOL_R_ENUMPRINTERDRIVERS structure.
4157 ********************************************************************/
4159 BOOL
spoolss_io_r_enumprinterdrivers(const char *desc
, SPOOL_R_ENUMPRINTERDRIVERS
*r_u
, prs_struct
*ps
, int depth
)
4161 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdrivers");
4167 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4173 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4176 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4179 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4185 /*******************************************************************
4187 ********************************************************************/
4189 BOOL
make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS
*q_u
,
4191 const char *environment
,
4193 RPC_BUFFER
*buffer
, uint32 offered
)
4195 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, name
);
4196 init_buf_unistr2(&q_u
->environment
, &q_u
->environment_ptr
, environment
);
4200 q_u
->offered
=offered
;
4205 /*******************************************************************
4206 Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure.
4207 ********************************************************************/
4209 BOOL
spoolss_io_q_enumprinterdrivers(const char *desc
, SPOOL_Q_ENUMPRINTERDRIVERS
*q_u
, prs_struct
*ps
, int depth
)
4212 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdrivers");
4218 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
4220 if (!smb_io_unistr2("", &q_u
->name
, q_u
->name_ptr
,ps
, depth
))
4225 if (!prs_uint32("environment_ptr", ps
, depth
, &q_u
->environment_ptr
))
4227 if (!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
4232 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4235 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4241 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4247 /*******************************************************************
4248 ********************************************************************/
4250 BOOL
spoolss_io_q_enumforms(const char *desc
, SPOOL_Q_ENUMFORMS
*q_u
, prs_struct
*ps
, int depth
)
4253 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumforms");
4258 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4260 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4263 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4268 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4274 /*******************************************************************
4275 ********************************************************************/
4277 BOOL
spoolss_io_r_enumforms(const char *desc
, SPOOL_R_ENUMFORMS
*r_u
, prs_struct
*ps
, int depth
)
4279 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumforms");
4285 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4291 if (!prs_uint32("size of buffer needed", ps
, depth
, &r_u
->needed
))
4294 if (!prs_uint32("numofforms", ps
, depth
, &r_u
->numofforms
))
4297 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4303 /*******************************************************************
4304 ********************************************************************/
4306 BOOL
spoolss_io_q_getform(const char *desc
, SPOOL_Q_GETFORM
*q_u
, prs_struct
*ps
, int depth
)
4309 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getform");
4314 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4316 if (!smb_io_unistr2("", &q_u
->formname
,True
,ps
,depth
))
4322 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4325 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4330 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4336 /*******************************************************************
4337 ********************************************************************/
4339 BOOL
spoolss_io_r_getform(const char *desc
, SPOOL_R_GETFORM
*r_u
, prs_struct
*ps
, int depth
)
4341 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getform");
4347 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4353 if (!prs_uint32("size of buffer needed", ps
, depth
, &r_u
->needed
))
4356 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4362 /*******************************************************************
4363 Parse a SPOOL_R_ENUMPORTS structure.
4364 ********************************************************************/
4366 BOOL
spoolss_io_r_enumports(const char *desc
, SPOOL_R_ENUMPORTS
*r_u
, prs_struct
*ps
, int depth
)
4368 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumports");
4374 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4380 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4383 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4386 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4392 /*******************************************************************
4393 ********************************************************************/
4395 BOOL
spoolss_io_q_enumports(const char *desc
, SPOOL_Q_ENUMPORTS
*q_u
, prs_struct
*ps
, int depth
)
4397 prs_debug(ps
, depth
, desc
, "");
4403 if (!prs_uint32("", ps
, depth
, &q_u
->name_ptr
))
4405 if (!smb_io_unistr2("", &q_u
->name
,True
,ps
,depth
))
4410 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4413 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4418 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4424 /*******************************************************************
4425 Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure.
4426 ********************************************************************/
4428 BOOL
spool_io_printer_info_level_1(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_1
*il
, prs_struct
*ps
, int depth
)
4430 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_1");
4436 if(!prs_uint32("flags", ps
, depth
, &il
->flags
))
4438 if(!prs_uint32("description_ptr", ps
, depth
, &il
->description_ptr
))
4440 if(!prs_uint32("name_ptr", ps
, depth
, &il
->name_ptr
))
4442 if(!prs_uint32("comment_ptr", ps
, depth
, &il
->comment_ptr
))
4445 if(!smb_io_unistr2("description", &il
->description
, il
->description_ptr
, ps
, depth
))
4447 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4449 if(!smb_io_unistr2("comment", &il
->comment
, il
->comment_ptr
, ps
, depth
))
4455 /*******************************************************************
4456 Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure.
4457 ********************************************************************/
4459 BOOL
spool_io_printer_info_level_3(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_3
*il
, prs_struct
*ps
, int depth
)
4461 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_3");
4467 if(!prs_uint32("secdesc_ptr", ps
, depth
, &il
->secdesc_ptr
))
4473 /*******************************************************************
4474 Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure.
4475 ********************************************************************/
4477 BOOL
spool_io_printer_info_level_2(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_2
*il
, prs_struct
*ps
, int depth
)
4479 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_2");
4485 if(!prs_uint32("servername_ptr", ps
, depth
, &il
->servername_ptr
))
4487 if(!prs_uint32("printername_ptr", ps
, depth
, &il
->printername_ptr
))
4489 if(!prs_uint32("sharename_ptr", ps
, depth
, &il
->sharename_ptr
))
4491 if(!prs_uint32("portname_ptr", ps
, depth
, &il
->portname_ptr
))
4494 if(!prs_uint32("drivername_ptr", ps
, depth
, &il
->drivername_ptr
))
4496 if(!prs_uint32("comment_ptr", ps
, depth
, &il
->comment_ptr
))
4498 if(!prs_uint32("location_ptr", ps
, depth
, &il
->location_ptr
))
4500 if(!prs_uint32("devmode_ptr", ps
, depth
, &il
->devmode_ptr
))
4502 if(!prs_uint32("sepfile_ptr", ps
, depth
, &il
->sepfile_ptr
))
4504 if(!prs_uint32("printprocessor_ptr", ps
, depth
, &il
->printprocessor_ptr
))
4506 if(!prs_uint32("datatype_ptr", ps
, depth
, &il
->datatype_ptr
))
4508 if(!prs_uint32("parameters_ptr", ps
, depth
, &il
->parameters_ptr
))
4510 if(!prs_uint32("secdesc_ptr", ps
, depth
, &il
->secdesc_ptr
))
4513 if(!prs_uint32("attributes", ps
, depth
, &il
->attributes
))
4515 if(!prs_uint32("priority", ps
, depth
, &il
->priority
))
4517 if(!prs_uint32("default_priority", ps
, depth
, &il
->default_priority
))
4519 if(!prs_uint32("starttime", ps
, depth
, &il
->starttime
))
4521 if(!prs_uint32("untiltime", ps
, depth
, &il
->untiltime
))
4523 if(!prs_uint32("status", ps
, depth
, &il
->status
))
4525 if(!prs_uint32("cjobs", ps
, depth
, &il
->cjobs
))
4527 if(!prs_uint32("averageppm", ps
, depth
, &il
->averageppm
))
4530 if(!smb_io_unistr2("servername", &il
->servername
, il
->servername_ptr
, ps
, depth
))
4532 if(!smb_io_unistr2("printername", &il
->printername
, il
->printername_ptr
, ps
, depth
))
4534 if(!smb_io_unistr2("sharename", &il
->sharename
, il
->sharename_ptr
, ps
, depth
))
4536 if(!smb_io_unistr2("portname", &il
->portname
, il
->portname_ptr
, ps
, depth
))
4538 if(!smb_io_unistr2("drivername", &il
->drivername
, il
->drivername_ptr
, ps
, depth
))
4540 if(!smb_io_unistr2("comment", &il
->comment
, il
->comment_ptr
, ps
, depth
))
4542 if(!smb_io_unistr2("location", &il
->location
, il
->location_ptr
, ps
, depth
))
4544 if(!smb_io_unistr2("sepfile", &il
->sepfile
, il
->sepfile_ptr
, ps
, depth
))
4546 if(!smb_io_unistr2("printprocessor", &il
->printprocessor
, il
->printprocessor_ptr
, ps
, depth
))
4548 if(!smb_io_unistr2("datatype", &il
->datatype
, il
->datatype_ptr
, ps
, depth
))
4550 if(!smb_io_unistr2("parameters", &il
->parameters
, il
->parameters_ptr
, ps
, depth
))
4556 BOOL
spool_io_printer_info_level_7(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_7
*il
, prs_struct
*ps
, int depth
)
4558 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_7");
4564 if(!prs_uint32("guid_ptr", ps
, depth
, &il
->guid_ptr
))
4566 if(!prs_uint32("action", ps
, depth
, &il
->action
))
4569 if(!smb_io_unistr2("servername", &il
->guid
, il
->guid_ptr
, ps
, depth
))
4574 /*******************************************************************
4575 ********************************************************************/
4577 BOOL
spool_io_printer_info_level(const char *desc
, SPOOL_PRINTER_INFO_LEVEL
*il
, prs_struct
*ps
, int depth
)
4579 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level");
4584 if(!prs_uint32("level", ps
, depth
, &il
->level
))
4586 if(!prs_uint32("info_ptr", ps
, depth
, &il
->info_ptr
))
4589 /* if no struct inside just return */
4590 if (il
->info_ptr
==0) {
4591 if (UNMARSHALLING(ps
)) {
4598 switch (il
->level
) {
4600 * level 0 is used by setprinter when managing the queue
4601 * (hold, stop, start a queue)
4605 /* DOCUMENT ME!!! What is level 1 used for? */
4608 if (UNMARSHALLING(ps
)) {
4609 if ((il
->info_1
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_1
,1)) == NULL
)
4612 if (!spool_io_printer_info_level_1("", il
->info_1
, ps
, depth
))
4617 * level 2 is used by addprinter
4618 * and by setprinter when updating printer's info
4621 if (UNMARSHALLING(ps
)) {
4622 if ((il
->info_2
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_2
,1)) == NULL
)
4625 if (!spool_io_printer_info_level_2("", il
->info_2
, ps
, depth
))
4628 /* DOCUMENT ME!!! What is level 3 used for? */
4631 if (UNMARSHALLING(ps
)) {
4632 if ((il
->info_3
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_3
,1)) == NULL
)
4635 if (!spool_io_printer_info_level_3("", il
->info_3
, ps
, depth
))
4640 if (UNMARSHALLING(ps
))
4641 if ((il
->info_7
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_7
,1)) == NULL
)
4643 if (!spool_io_printer_info_level_7("", il
->info_7
, ps
, depth
))
4651 /*******************************************************************
4652 ********************************************************************/
4654 BOOL
spoolss_io_q_addprinterex(const char *desc
, SPOOL_Q_ADDPRINTEREX
*q_u
, prs_struct
*ps
, int depth
)
4656 uint32 ptr_sec_desc
= 0;
4658 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterex");
4664 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->server_name
))
4666 if (!prs_io_unistr2("servername", ps
, depth
, q_u
->server_name
))
4672 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
4675 if(!spool_io_printer_info_level("", &q_u
->info
, ps
, depth
))
4678 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
4684 switch (q_u
->level
) {
4686 ptr_sec_desc
= q_u
->info
.info_2
->secdesc_ptr
;
4689 ptr_sec_desc
= q_u
->info
.info_3
->secdesc_ptr
;
4693 if (!sec_io_desc_buf(desc
, &q_u
->secdesc_ctr
, ps
, depth
))
4698 /* Parse a NULL security descriptor. This should really
4699 happen inside the sec_io_desc_buf() function. */
4701 prs_debug(ps
, depth
, "", "sec_io_desc_buf");
4702 if (!prs_uint32("size", ps
, depth
+ 1, &dummy
))
4704 if (!prs_uint32("ptr", ps
, depth
+ 1, &dummy
))
4708 if(!prs_uint32("user_switch", ps
, depth
, &q_u
->user_switch
))
4710 if(!spool_io_user_level("", &q_u
->user_ctr
, ps
, depth
))
4716 /*******************************************************************
4717 ********************************************************************/
4719 BOOL
spoolss_io_r_addprinterex(const char *desc
, SPOOL_R_ADDPRINTEREX
*r_u
,
4720 prs_struct
*ps
, int depth
)
4722 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterex");
4725 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
4728 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4734 /*******************************************************************
4735 ********************************************************************/
4737 BOOL
spool_io_printer_driver_info_level_3(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
**q_u
,
4738 prs_struct
*ps
, int depth
)
4740 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*il
;
4742 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level_3");
4746 if (UNMARSHALLING(ps
)) {
4747 il
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
,1);
4759 if(!prs_uint32("cversion", ps
, depth
, &il
->cversion
))
4761 if(!prs_uint32("name", ps
, depth
, &il
->name_ptr
))
4763 if(!prs_uint32("environment", ps
, depth
, &il
->environment_ptr
))
4765 if(!prs_uint32("driverpath", ps
, depth
, &il
->driverpath_ptr
))
4767 if(!prs_uint32("datafile", ps
, depth
, &il
->datafile_ptr
))
4769 if(!prs_uint32("configfile", ps
, depth
, &il
->configfile_ptr
))
4771 if(!prs_uint32("helpfile", ps
, depth
, &il
->helpfile_ptr
))
4773 if(!prs_uint32("monitorname", ps
, depth
, &il
->monitorname_ptr
))
4775 if(!prs_uint32("defaultdatatype", ps
, depth
, &il
->defaultdatatype_ptr
))
4777 if(!prs_uint32("dependentfilessize", ps
, depth
, &il
->dependentfilessize
))
4779 if(!prs_uint32("dependentfiles", ps
, depth
, &il
->dependentfiles_ptr
))
4785 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4787 if(!smb_io_unistr2("environment", &il
->environment
, il
->environment_ptr
, ps
, depth
))
4789 if(!smb_io_unistr2("driverpath", &il
->driverpath
, il
->driverpath_ptr
, ps
, depth
))
4791 if(!smb_io_unistr2("datafile", &il
->datafile
, il
->datafile_ptr
, ps
, depth
))
4793 if(!smb_io_unistr2("configfile", &il
->configfile
, il
->configfile_ptr
, ps
, depth
))
4795 if(!smb_io_unistr2("helpfile", &il
->helpfile
, il
->helpfile_ptr
, ps
, depth
))
4797 if(!smb_io_unistr2("monitorname", &il
->monitorname
, il
->monitorname_ptr
, ps
, depth
))
4799 if(!smb_io_unistr2("defaultdatatype", &il
->defaultdatatype
, il
->defaultdatatype_ptr
, ps
, depth
))
4805 if (il
->dependentfiles_ptr
)
4806 smb_io_buffer5("", &il
->dependentfiles
, ps
, depth
);
4811 /*******************************************************************
4812 parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure
4813 ********************************************************************/
4815 BOOL
spool_io_printer_driver_info_level_6(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
**q_u
,
4816 prs_struct
*ps
, int depth
)
4818 SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
*il
;
4820 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level_6");
4824 if (UNMARSHALLING(ps
)) {
4825 il
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
,1);
4838 * I know this seems weird, but I have no other explanation.
4839 * This is observed behavior on both NT4 and 2K servers.
4843 if (!prs_align_uint64(ps
))
4846 /* parse the main elements the packet */
4848 if(!prs_uint32("cversion ", ps
, depth
, &il
->version
))
4850 if(!prs_uint32("name ", ps
, depth
, &il
->name_ptr
))
4852 if(!prs_uint32("environment ", ps
, depth
, &il
->environment_ptr
))
4854 if(!prs_uint32("driverpath ", ps
, depth
, &il
->driverpath_ptr
))
4856 if(!prs_uint32("datafile ", ps
, depth
, &il
->datafile_ptr
))
4858 if(!prs_uint32("configfile ", ps
, depth
, &il
->configfile_ptr
))
4860 if(!prs_uint32("helpfile ", ps
, depth
, &il
->helpfile_ptr
))
4862 if(!prs_uint32("monitorname ", ps
, depth
, &il
->monitorname_ptr
))
4864 if(!prs_uint32("defaultdatatype", ps
, depth
, &il
->defaultdatatype_ptr
))
4866 if(!prs_uint32("dependentfiles ", ps
, depth
, &il
->dependentfiles_len
))
4868 if(!prs_uint32("dependentfiles ", ps
, depth
, &il
->dependentfiles_ptr
))
4870 if(!prs_uint32("previousnames ", ps
, depth
, &il
->previousnames_len
))
4872 if(!prs_uint32("previousnames ", ps
, depth
, &il
->previousnames_ptr
))
4874 if(!smb_io_time("driverdate ", &il
->driverdate
, ps
, depth
))
4876 if(!prs_uint32("dummy4 ", ps
, depth
, &il
->dummy4
))
4878 if(!prs_uint64("driverversion ", ps
, depth
, &il
->driverversion
))
4880 if(!prs_uint32("mfgname ", ps
, depth
, &il
->mfgname_ptr
))
4882 if(!prs_uint32("oemurl ", ps
, depth
, &il
->oemurl_ptr
))
4884 if(!prs_uint32("hardwareid ", ps
, depth
, &il
->hardwareid_ptr
))
4886 if(!prs_uint32("provider ", ps
, depth
, &il
->provider_ptr
))
4889 /* parse the structures in the packet */
4891 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4896 if(!smb_io_unistr2("environment", &il
->environment
, il
->environment_ptr
, ps
, depth
))
4901 if(!smb_io_unistr2("driverpath", &il
->driverpath
, il
->driverpath_ptr
, ps
, depth
))
4906 if(!smb_io_unistr2("datafile", &il
->datafile
, il
->datafile_ptr
, ps
, depth
))
4911 if(!smb_io_unistr2("configfile", &il
->configfile
, il
->configfile_ptr
, ps
, depth
))
4916 if(!smb_io_unistr2("helpfile", &il
->helpfile
, il
->helpfile_ptr
, ps
, depth
))
4921 if(!smb_io_unistr2("monitorname", &il
->monitorname
, il
->monitorname_ptr
, ps
, depth
))
4926 if(!smb_io_unistr2("defaultdatatype", &il
->defaultdatatype
, il
->defaultdatatype_ptr
, ps
, depth
))
4930 if (il
->dependentfiles_ptr
) {
4931 if(!smb_io_buffer5("dependentfiles", &il
->dependentfiles
, ps
, depth
))
4936 if (il
->previousnames_ptr
) {
4937 if(!smb_io_buffer5("previousnames", &il
->previousnames
, ps
, depth
))
4942 if(!smb_io_unistr2("mfgname", &il
->mfgname
, il
->mfgname_ptr
, ps
, depth
))
4946 if(!smb_io_unistr2("oemurl", &il
->oemurl
, il
->oemurl_ptr
, ps
, depth
))
4950 if(!smb_io_unistr2("hardwareid", &il
->hardwareid
, il
->hardwareid_ptr
, ps
, depth
))
4954 if(!smb_io_unistr2("provider", &il
->provider
, il
->provider_ptr
, ps
, depth
))
4960 /*******************************************************************
4961 convert a buffer of UNICODE strings null terminated
4962 the buffer is terminated by a NULL
4964 convert to an dos codepage array (null terminated)
4966 dynamically allocate memory
4968 ********************************************************************/
4969 static BOOL
uniarray_2_dosarray(BUFFER5
*buf5
, fstring
**ar
)
4978 src
= (char *)buf5
->buffer
;
4981 while (src
< ((char *)buf5
->buffer
) + buf5
->buf_len
*2) {
4982 rpcstr_pull(f
, src
, sizeof(f
)-1, -1, STR_TERMINATE
);
4983 src
= skip_unibuf(src
, 2*buf5
->buf_len
- PTR_DIFF(src
,buf5
->buffer
));
4984 tar
= SMB_REALLOC_ARRAY(*ar
, fstring
, n
+2);
4989 fstrcpy((*ar
)[n
], f
);
4992 fstrcpy((*ar
)[n
], "");
5000 /*******************************************************************
5001 read a UNICODE array with null terminated strings
5002 and null terminated array
5003 and size of array at beginning
5004 ********************************************************************/
5006 BOOL
smb_io_unibuffer(const char *desc
, UNISTR2
*buffer
, prs_struct
*ps
, int depth
)
5008 if (buffer
==NULL
) return False
;
5011 buffer
->uni_str_len
=buffer
->uni_max_len
;
5013 if(!prs_uint32("buffer_size", ps
, depth
, &buffer
->uni_max_len
))
5016 if(!prs_unistr2(True
, "buffer ", ps
, depth
, buffer
))
5022 /*******************************************************************
5023 ********************************************************************/
5025 BOOL
spool_io_printer_driver_info_level(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL
*il
, prs_struct
*ps
, int depth
)
5027 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level");
5032 if(!prs_uint32("level", ps
, depth
, &il
->level
))
5034 if(!prs_uint32("ptr", ps
, depth
, &il
->ptr
))
5040 switch (il
->level
) {
5042 if(!spool_io_printer_driver_info_level_3("", &il
->info_3
, ps
, depth
))
5046 if(!spool_io_printer_driver_info_level_6("", &il
->info_6
, ps
, depth
))
5056 /*******************************************************************
5057 init a SPOOL_Q_ADDPRINTERDRIVER struct
5058 ******************************************************************/
5060 BOOL
make_spoolss_q_addprinterdriver(TALLOC_CTX
*mem_ctx
,
5061 SPOOL_Q_ADDPRINTERDRIVER
*q_u
, const char* srv_name
,
5062 uint32 level
, PRINTER_DRIVER_CTR
*info
)
5064 DEBUG(5,("make_spoolss_q_addprinterdriver\n"));
5066 q_u
->server_name_ptr
= (srv_name
!=NULL
)?1:0;
5067 init_unistr2(&q_u
->server_name
, srv_name
, UNI_STR_TERMINATE
);
5071 q_u
->info
.level
= level
;
5072 q_u
->info
.ptr
= (info
!=NULL
)?1:0;
5075 /* info level 3 is supported by Windows 95/98, WinNT and Win2k */
5077 make_spoolss_driver_info_3(mem_ctx
, &q_u
->info
.info_3
, info
->info3
);
5081 DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level
));
5088 BOOL
make_spoolss_driver_info_3(TALLOC_CTX
*mem_ctx
,
5089 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
**spool_drv_info
,
5090 DRIVER_INFO_3
*info3
)
5093 uint16
*ptr
= info3
->dependentfiles
;
5095 BOOL null_char
= False
;
5096 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*inf
;
5098 if (!(inf
=TALLOC_ZERO_P(mem_ctx
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
)))
5101 inf
->cversion
= info3
->version
;
5102 inf
->name_ptr
= (info3
->name
.buffer
!=NULL
)?1:0;
5103 inf
->environment_ptr
= (info3
->architecture
.buffer
!=NULL
)?1:0;
5104 inf
->driverpath_ptr
= (info3
->driverpath
.buffer
!=NULL
)?1:0;
5105 inf
->datafile_ptr
= (info3
->datafile
.buffer
!=NULL
)?1:0;
5106 inf
->configfile_ptr
= (info3
->configfile
.buffer
!=NULL
)?1:0;
5107 inf
->helpfile_ptr
= (info3
->helpfile
.buffer
!=NULL
)?1:0;
5108 inf
->monitorname_ptr
= (info3
->monitorname
.buffer
!=NULL
)?1:0;
5109 inf
->defaultdatatype_ptr
= (info3
->defaultdatatype
.buffer
!=NULL
)?1:0;
5111 init_unistr2_from_unistr(&inf
->name
, &info3
->name
);
5112 init_unistr2_from_unistr(&inf
->environment
, &info3
->architecture
);
5113 init_unistr2_from_unistr(&inf
->driverpath
, &info3
->driverpath
);
5114 init_unistr2_from_unistr(&inf
->datafile
, &info3
->datafile
);
5115 init_unistr2_from_unistr(&inf
->configfile
, &info3
->configfile
);
5116 init_unistr2_from_unistr(&inf
->helpfile
, &info3
->helpfile
);
5117 init_unistr2_from_unistr(&inf
->monitorname
, &info3
->monitorname
);
5118 init_unistr2_from_unistr(&inf
->defaultdatatype
, &info3
->defaultdatatype
);
5125 /* the null_char BOOL is used to help locate
5126 two '\0's back to back */
5141 inf
->dependentfiles_ptr
= (info3
->dependentfiles
!= NULL
) ? 1 : 0;
5142 inf
->dependentfilessize
= len
;
5143 if(!make_spoolss_buffer5(mem_ctx
, &inf
->dependentfiles
, len
, info3
->dependentfiles
))
5149 *spool_drv_info
= inf
;
5154 /*******************************************************************
5155 make a BUFFER5 struct from a uint16*
5156 ******************************************************************/
5157 BOOL
make_spoolss_buffer5(TALLOC_CTX
*mem_ctx
, BUFFER5
*buf5
, uint32 len
, uint16
*src
)
5160 buf5
->buf_len
= len
;
5161 if((buf5
->buffer
=(uint16
*)TALLOC_MEMDUP(mem_ctx
, src
, sizeof(uint16
)*len
)) == NULL
) {
5162 DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n"));
5169 /*******************************************************************
5170 fill in the prs_struct for a ADDPRINTERDRIVER request PDU
5171 ********************************************************************/
5173 BOOL
spoolss_io_q_addprinterdriver(const char *desc
, SPOOL_Q_ADDPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
5175 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterdriver");
5181 if(!prs_uint32("server_name_ptr", ps
, depth
, &q_u
->server_name_ptr
))
5183 if(!smb_io_unistr2("server_name", &q_u
->server_name
, q_u
->server_name_ptr
, ps
, depth
))
5188 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
5191 if(!spool_io_printer_driver_info_level("", &q_u
->info
, ps
, depth
))
5197 /*******************************************************************
5198 ********************************************************************/
5200 BOOL
spoolss_io_r_addprinterdriver(const char *desc
, SPOOL_R_ADDPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
5202 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterdriver");
5205 if(!prs_werror("status", ps
, depth
, &q_u
->status
))
5211 /*******************************************************************
5212 fill in the prs_struct for a ADDPRINTERDRIVER request PDU
5213 ********************************************************************/
5215 BOOL
spoolss_io_q_addprinterdriverex(const char *desc
, SPOOL_Q_ADDPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
5217 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterdriverex");
5223 if(!prs_uint32("server_name_ptr", ps
, depth
, &q_u
->server_name_ptr
))
5225 if(!smb_io_unistr2("server_name", &q_u
->server_name
, q_u
->server_name_ptr
, ps
, depth
))
5230 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
5233 if(!spool_io_printer_driver_info_level("", &q_u
->info
, ps
, depth
))
5238 if(!prs_uint32("copy flags", ps
, depth
, &q_u
->copy_flags
))
5244 /*******************************************************************
5245 ********************************************************************/
5247 BOOL
spoolss_io_r_addprinterdriverex(const char *desc
, SPOOL_R_ADDPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
5249 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterdriverex");
5252 if(!prs_werror("status", ps
, depth
, &q_u
->status
))
5258 /*******************************************************************
5259 ********************************************************************/
5261 BOOL
uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*uni
,
5262 NT_PRINTER_DRIVER_INFO_LEVEL_3
**asc
)
5264 NT_PRINTER_DRIVER_INFO_LEVEL_3
*d
;
5266 DEBUG(7,("uni_2_asc_printer_driver_3: Converting from UNICODE to ASCII\n"));
5270 *asc
=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_3
);
5278 d
->cversion
=uni
->cversion
;
5280 unistr2_to_ascii(d
->name
, &uni
->name
, sizeof(d
->name
)-1);
5281 unistr2_to_ascii(d
->environment
, &uni
->environment
, sizeof(d
->environment
)-1);
5282 unistr2_to_ascii(d
->driverpath
, &uni
->driverpath
, sizeof(d
->driverpath
)-1);
5283 unistr2_to_ascii(d
->datafile
, &uni
->datafile
, sizeof(d
->datafile
)-1);
5284 unistr2_to_ascii(d
->configfile
, &uni
->configfile
, sizeof(d
->configfile
)-1);
5285 unistr2_to_ascii(d
->helpfile
, &uni
->helpfile
, sizeof(d
->helpfile
)-1);
5286 unistr2_to_ascii(d
->monitorname
, &uni
->monitorname
, sizeof(d
->monitorname
)-1);
5287 unistr2_to_ascii(d
->defaultdatatype
, &uni
->defaultdatatype
, sizeof(d
->defaultdatatype
)-1);
5289 DEBUGADD(8,( "version: %d\n", d
->cversion
));
5290 DEBUGADD(8,( "name: %s\n", d
->name
));
5291 DEBUGADD(8,( "environment: %s\n", d
->environment
));
5292 DEBUGADD(8,( "driverpath: %s\n", d
->driverpath
));
5293 DEBUGADD(8,( "datafile: %s\n", d
->datafile
));
5294 DEBUGADD(8,( "configfile: %s\n", d
->configfile
));
5295 DEBUGADD(8,( "helpfile: %s\n", d
->helpfile
));
5296 DEBUGADD(8,( "monitorname: %s\n", d
->monitorname
));
5297 DEBUGADD(8,( "defaultdatatype: %s\n", d
->defaultdatatype
));
5299 if (uniarray_2_dosarray(&uni
->dependentfiles
, &d
->dependentfiles
))
5306 /*******************************************************************
5307 ********************************************************************/
5308 BOOL
uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
*uni
,
5309 NT_PRINTER_DRIVER_INFO_LEVEL_6
**asc
)
5311 NT_PRINTER_DRIVER_INFO_LEVEL_6
*d
;
5313 DEBUG(7,("uni_2_asc_printer_driver_6: Converting from UNICODE to ASCII\n"));
5317 *asc
=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_6
);
5325 d
->version
=uni
->version
;
5327 unistr2_to_ascii(d
->name
, &uni
->name
, sizeof(d
->name
)-1);
5328 unistr2_to_ascii(d
->environment
, &uni
->environment
, sizeof(d
->environment
)-1);
5329 unistr2_to_ascii(d
->driverpath
, &uni
->driverpath
, sizeof(d
->driverpath
)-1);
5330 unistr2_to_ascii(d
->datafile
, &uni
->datafile
, sizeof(d
->datafile
)-1);
5331 unistr2_to_ascii(d
->configfile
, &uni
->configfile
, sizeof(d
->configfile
)-1);
5332 unistr2_to_ascii(d
->helpfile
, &uni
->helpfile
, sizeof(d
->helpfile
)-1);
5333 unistr2_to_ascii(d
->monitorname
, &uni
->monitorname
, sizeof(d
->monitorname
)-1);
5334 unistr2_to_ascii(d
->defaultdatatype
, &uni
->defaultdatatype
, sizeof(d
->defaultdatatype
)-1);
5336 DEBUGADD(8,( "version: %d\n", d
->version
));
5337 DEBUGADD(8,( "name: %s\n", d
->name
));
5338 DEBUGADD(8,( "environment: %s\n", d
->environment
));
5339 DEBUGADD(8,( "driverpath: %s\n", d
->driverpath
));
5340 DEBUGADD(8,( "datafile: %s\n", d
->datafile
));
5341 DEBUGADD(8,( "configfile: %s\n", d
->configfile
));
5342 DEBUGADD(8,( "helpfile: %s\n", d
->helpfile
));
5343 DEBUGADD(8,( "monitorname: %s\n", d
->monitorname
));
5344 DEBUGADD(8,( "defaultdatatype: %s\n", d
->defaultdatatype
));
5346 if (!uniarray_2_dosarray(&uni
->dependentfiles
, &d
->dependentfiles
))
5348 if (!uniarray_2_dosarray(&uni
->previousnames
, &d
->previousnames
))
5358 BOOL
uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2
*uni
,
5359 NT_PRINTER_INFO_LEVEL_2
**asc
)
5361 NT_PRINTER_INFO_LEVEL_2
*d
;
5364 DEBUG(7,("Converting from UNICODE to ASCII\n"));
5365 time_unix
=time(NULL
);
5368 DEBUGADD(8,("allocating memory\n"));
5370 *asc
=SMB_MALLOC_P(NT_PRINTER_INFO_LEVEL_2
);
5375 /* we allocate memory iff called from
5376 * addprinter(ex) so we can do one time stuff here.
5378 (*asc
)->setuptime
=time_unix
;
5381 DEBUGADD(8,("start converting\n"));
5385 d
->attributes
=uni
->attributes
;
5386 d
->priority
=uni
->priority
;
5387 d
->default_priority
=uni
->default_priority
;
5388 d
->starttime
=uni
->starttime
;
5389 d
->untiltime
=uni
->untiltime
;
5390 d
->status
=uni
->status
;
5391 d
->cjobs
=uni
->cjobs
;
5393 unistr2_to_ascii(d
->servername
, &uni
->servername
, sizeof(d
->servername
)-1);
5394 unistr2_to_ascii(d
->printername
, &uni
->printername
, sizeof(d
->printername
)-1);
5395 unistr2_to_ascii(d
->sharename
, &uni
->sharename
, sizeof(d
->sharename
)-1);
5396 unistr2_to_ascii(d
->portname
, &uni
->portname
, sizeof(d
->portname
)-1);
5397 unistr2_to_ascii(d
->drivername
, &uni
->drivername
, sizeof(d
->drivername
)-1);
5398 unistr2_to_ascii(d
->comment
, &uni
->comment
, sizeof(d
->comment
)-1);
5399 unistr2_to_ascii(d
->location
, &uni
->location
, sizeof(d
->location
)-1);
5400 unistr2_to_ascii(d
->sepfile
, &uni
->sepfile
, sizeof(d
->sepfile
)-1);
5401 unistr2_to_ascii(d
->printprocessor
, &uni
->printprocessor
, sizeof(d
->printprocessor
)-1);
5402 unistr2_to_ascii(d
->datatype
, &uni
->datatype
, sizeof(d
->datatype
)-1);
5403 unistr2_to_ascii(d
->parameters
, &uni
->parameters
, sizeof(d
->parameters
)-1);
5408 /*******************************************************************
5410 ********************************************************************/
5412 BOOL
make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR
*q_u
,
5413 fstring servername
, fstring env_name
, uint32 level
,
5414 RPC_BUFFER
*buffer
, uint32 offered
)
5416 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, servername
);
5417 init_buf_unistr2(&q_u
->environment
, &q_u
->environment_ptr
, env_name
);
5421 q_u
->offered
=offered
;
5426 /*******************************************************************
5427 Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure.
5428 ********************************************************************/
5430 BOOL
spoolss_io_q_getprinterdriverdir(const char *desc
, SPOOL_Q_GETPRINTERDRIVERDIR
*q_u
, prs_struct
*ps
, int depth
)
5432 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdriverdir");
5437 if(!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5439 if(!smb_io_unistr2("", &q_u
->name
, q_u
->name_ptr
, ps
, depth
))
5445 if(!prs_uint32("", ps
, depth
, &q_u
->environment_ptr
))
5447 if(!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
5453 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
5456 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5462 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5468 /*******************************************************************
5469 Parse a SPOOL_R_GETPRINTERDRIVERDIR structure.
5470 ********************************************************************/
5472 BOOL
spoolss_io_r_getprinterdriverdir(const char *desc
, SPOOL_R_GETPRINTERDRIVERDIR
*r_u
, prs_struct
*ps
, int depth
)
5474 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdriverdir");
5480 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5486 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5489 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5495 /*******************************************************************
5496 ********************************************************************/
5498 BOOL
spoolss_io_r_enumprintprocessors(const char *desc
, SPOOL_R_ENUMPRINTPROCESSORS
*r_u
, prs_struct
*ps
, int depth
)
5500 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintprocessors");
5506 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5512 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5515 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5518 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5524 /*******************************************************************
5525 ********************************************************************/
5527 BOOL
spoolss_io_q_enumprintprocessors(const char *desc
, SPOOL_Q_ENUMPRINTPROCESSORS
*q_u
, prs_struct
*ps
, int depth
)
5529 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintprocessors");
5535 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5537 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5543 if (!prs_uint32("", ps
, depth
, &q_u
->environment_ptr
))
5545 if (!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
5551 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5554 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5560 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5566 /*******************************************************************
5567 ********************************************************************/
5569 BOOL
spoolss_io_q_addprintprocessor(const char *desc
, SPOOL_Q_ADDPRINTPROCESSOR
*q_u
, prs_struct
*ps
, int depth
)
5571 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprintprocessor");
5577 if (!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
5579 if (!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
5584 if (!smb_io_unistr2("environment", &q_u
->environment
, True
, ps
, depth
))
5589 if (!smb_io_unistr2("path", &q_u
->path
, True
, ps
, depth
))
5594 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5600 /*******************************************************************
5601 ********************************************************************/
5603 BOOL
spoolss_io_r_addprintprocessor(const char *desc
, SPOOL_R_ADDPRINTPROCESSOR
*r_u
, prs_struct
*ps
, int depth
)
5605 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprintproicessor");
5611 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5617 /*******************************************************************
5618 ********************************************************************/
5620 BOOL
spoolss_io_r_enumprintprocdatatypes(const char *desc
, SPOOL_R_ENUMPRINTPROCDATATYPES
*r_u
, prs_struct
*ps
, int depth
)
5622 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintprocdatatypes");
5628 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5634 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5637 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5640 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5646 /*******************************************************************
5647 ********************************************************************/
5649 BOOL
spoolss_io_q_enumprintprocdatatypes(const char *desc
, SPOOL_Q_ENUMPRINTPROCDATATYPES
*q_u
, prs_struct
*ps
, int depth
)
5651 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintprocdatatypes");
5657 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5659 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5665 if (!prs_uint32("processor_ptr", ps
, depth
, &q_u
->processor_ptr
))
5667 if (!smb_io_unistr2("processor", &q_u
->processor
, q_u
->processor_ptr
, ps
, depth
))
5673 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5676 if(!prs_rpcbuffer_p("buffer", ps
, depth
, &q_u
->buffer
))
5682 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5688 /*******************************************************************
5689 Parse a SPOOL_Q_ENUMPRINTMONITORS structure.
5690 ********************************************************************/
5692 BOOL
spoolss_io_q_enumprintmonitors(const char *desc
, SPOOL_Q_ENUMPRINTMONITORS
*q_u
, prs_struct
*ps
, int depth
)
5694 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintmonitors");
5700 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5702 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5708 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5711 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5717 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5723 /*******************************************************************
5724 ********************************************************************/
5726 BOOL
spoolss_io_r_enumprintmonitors(const char *desc
, SPOOL_R_ENUMPRINTMONITORS
*r_u
, prs_struct
*ps
, int depth
)
5728 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintmonitors");
5734 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5740 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5743 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5746 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5752 /*******************************************************************
5753 ********************************************************************/
5755 BOOL
spoolss_io_r_enumprinterdata(const char *desc
, SPOOL_R_ENUMPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
5757 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdata");
5762 if(!prs_uint32("valuesize", ps
, depth
, &r_u
->valuesize
))
5765 if (UNMARSHALLING(ps
) && r_u
->valuesize
) {
5766 r_u
->value
= PRS_ALLOC_MEM(ps
, uint16
, r_u
->valuesize
);
5768 DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata value\n"));
5773 if(!prs_uint16uni(False
, "value", ps
, depth
, r_u
->value
, r_u
->valuesize
))
5779 if(!prs_uint32("realvaluesize", ps
, depth
, &r_u
->realvaluesize
))
5782 if(!prs_uint32("type", ps
, depth
, &r_u
->type
))
5785 if(!prs_uint32("datasize", ps
, depth
, &r_u
->datasize
))
5788 if (UNMARSHALLING(ps
) && r_u
->datasize
) {
5789 r_u
->data
= PRS_ALLOC_MEM(ps
, uint8
, r_u
->datasize
);
5791 DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata data\n"));
5796 if(!prs_uint8s(False
, "data", ps
, depth
, r_u
->data
, r_u
->datasize
))
5801 if(!prs_uint32("realdatasize", ps
, depth
, &r_u
->realdatasize
))
5803 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5809 /*******************************************************************
5810 ********************************************************************/
5812 BOOL
spoolss_io_q_enumprinterdata(const char *desc
, SPOOL_Q_ENUMPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
5814 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdata");
5819 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
5821 if(!prs_uint32("index", ps
, depth
, &q_u
->index
))
5823 if(!prs_uint32("valuesize", ps
, depth
, &q_u
->valuesize
))
5825 if(!prs_uint32("datasize", ps
, depth
, &q_u
->datasize
))
5831 /*******************************************************************
5832 ********************************************************************/
5834 BOOL
make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA
*q_u
,
5835 const POLICY_HND
*hnd
,
5836 uint32 idx
, uint32 valuelen
, uint32 datalen
)
5838 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5840 q_u
->valuesize
=valuelen
;
5841 q_u
->datasize
=datalen
;
5846 /*******************************************************************
5847 ********************************************************************/
5849 BOOL
make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX
*q_u
,
5850 const POLICY_HND
*hnd
, const char *key
,
5853 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5854 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
5860 /*******************************************************************
5861 ********************************************************************/
5862 BOOL
make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA
*q_u
, const POLICY_HND
*hnd
,
5863 char* value
, uint32 data_type
, char* data
, uint32 data_size
)
5865 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5866 q_u
->type
= data_type
;
5867 init_unistr2(&q_u
->value
, value
, UNI_STR_TERMINATE
);
5869 q_u
->max_len
= q_u
->real_len
= data_size
;
5870 q_u
->data
= (unsigned char *)data
;
5875 /*******************************************************************
5876 ********************************************************************/
5877 BOOL
make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX
*q_u
, const POLICY_HND
*hnd
,
5878 char *key
, char* value
, uint32 data_type
, char* data
,
5881 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5882 q_u
->type
= data_type
;
5883 init_unistr2(&q_u
->value
, value
, UNI_STR_TERMINATE
);
5884 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
5886 q_u
->max_len
= q_u
->real_len
= data_size
;
5887 q_u
->data
= (unsigned char *)data
;
5892 /*******************************************************************
5893 ********************************************************************/
5895 BOOL
spoolss_io_q_setprinterdata(const char *desc
, SPOOL_Q_SETPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
5897 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinterdata");
5902 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
5904 if(!smb_io_unistr2("", &q_u
->value
, True
, ps
, depth
))
5910 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
5913 if(!prs_uint32("max_len", ps
, depth
, &q_u
->max_len
))
5923 if (UNMARSHALLING(ps
))
5924 q_u
->data
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->max_len
);
5925 if(q_u
->data
== NULL
)
5927 if(!prs_uint8s(False
,"data", ps
, depth
, q_u
->data
, q_u
->max_len
))
5935 if(!prs_uint32("real_len", ps
, depth
, &q_u
->real_len
))
5941 /*******************************************************************
5942 ********************************************************************/
5944 BOOL
spoolss_io_r_setprinterdata(const char *desc
, SPOOL_R_SETPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
5946 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinterdata");
5951 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5957 /*******************************************************************
5958 ********************************************************************/
5959 BOOL
spoolss_io_q_resetprinter(const char *desc
, SPOOL_Q_RESETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
5961 prs_debug(ps
, depth
, desc
, "spoolss_io_q_resetprinter");
5966 if (!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
5969 if (!prs_uint32("datatype_ptr", ps
, depth
, &q_u
->datatype_ptr
))
5972 if (q_u
->datatype_ptr
) {
5973 if (!smb_io_unistr2("datatype", &q_u
->datatype
, q_u
->datatype_ptr
?True
:False
, ps
, depth
))
5977 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
5984 /*******************************************************************
5985 ********************************************************************/
5986 BOOL
spoolss_io_r_resetprinter(const char *desc
, SPOOL_R_RESETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
5988 prs_debug(ps
, depth
, desc
, "spoolss_io_r_resetprinter");
5993 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5999 /*******************************************************************
6000 ********************************************************************/
6002 static BOOL
spoolss_io_addform(const char *desc
, FORM
*f
, uint32 ptr
, prs_struct
*ps
, int depth
)
6004 prs_debug(ps
, depth
, desc
, "spoolss_io_addform");
6011 if(!prs_uint32("flags", ps
, depth
, &f
->flags
))
6013 if(!prs_uint32("name_ptr", ps
, depth
, &f
->name_ptr
))
6015 if(!prs_uint32("size_x", ps
, depth
, &f
->size_x
))
6017 if(!prs_uint32("size_y", ps
, depth
, &f
->size_y
))
6019 if(!prs_uint32("left", ps
, depth
, &f
->left
))
6021 if(!prs_uint32("top", ps
, depth
, &f
->top
))
6023 if(!prs_uint32("right", ps
, depth
, &f
->right
))
6025 if(!prs_uint32("bottom", ps
, depth
, &f
->bottom
))
6028 if(!smb_io_unistr2("", &f
->name
, f
->name_ptr
, ps
, depth
))
6035 /*******************************************************************
6036 ********************************************************************/
6038 BOOL
spoolss_io_q_deleteform(const char *desc
, SPOOL_Q_DELETEFORM
*q_u
, prs_struct
*ps
, int depth
)
6040 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteform");
6045 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6047 if(!smb_io_unistr2("form name", &q_u
->name
, True
, ps
, depth
))
6053 /*******************************************************************
6054 ********************************************************************/
6056 BOOL
spoolss_io_r_deleteform(const char *desc
, SPOOL_R_DELETEFORM
*r_u
, prs_struct
*ps
, int depth
)
6058 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteform");
6063 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6069 /*******************************************************************
6070 ********************************************************************/
6072 BOOL
spoolss_io_q_addform(const char *desc
, SPOOL_Q_ADDFORM
*q_u
, prs_struct
*ps
, int depth
)
6074 uint32 useless_ptr
=1;
6075 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addform");
6080 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6082 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6084 if(!prs_uint32("level2", ps
, depth
, &q_u
->level2
))
6089 if(!prs_uint32("useless_ptr", ps
, depth
, &useless_ptr
))
6091 if(!spoolss_io_addform("", &q_u
->form
, useless_ptr
, ps
, depth
))
6098 /*******************************************************************
6099 ********************************************************************/
6101 BOOL
spoolss_io_r_addform(const char *desc
, SPOOL_R_ADDFORM
*r_u
, prs_struct
*ps
, int depth
)
6103 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addform");
6108 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6114 /*******************************************************************
6115 ********************************************************************/
6117 BOOL
spoolss_io_q_setform(const char *desc
, SPOOL_Q_SETFORM
*q_u
, prs_struct
*ps
, int depth
)
6119 uint32 useless_ptr
=1;
6120 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setform");
6125 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6127 if(!smb_io_unistr2("", &q_u
->name
, True
, ps
, depth
))
6133 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6135 if(!prs_uint32("level2", ps
, depth
, &q_u
->level2
))
6140 if(!prs_uint32("useless_ptr", ps
, depth
, &useless_ptr
))
6142 if(!spoolss_io_addform("", &q_u
->form
, useless_ptr
, ps
, depth
))
6149 /*******************************************************************
6150 ********************************************************************/
6152 BOOL
spoolss_io_r_setform(const char *desc
, SPOOL_R_SETFORM
*r_u
, prs_struct
*ps
, int depth
)
6154 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setform");
6159 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6165 /*******************************************************************
6166 Parse a SPOOL_R_GETJOB structure.
6167 ********************************************************************/
6169 BOOL
spoolss_io_r_getjob(const char *desc
, SPOOL_R_GETJOB
*r_u
, prs_struct
*ps
, int depth
)
6171 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getjob");
6177 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
6183 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6186 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6192 /*******************************************************************
6193 Parse a SPOOL_Q_GETJOB structure.
6194 ********************************************************************/
6196 BOOL
spoolss_io_q_getjob(const char *desc
, SPOOL_Q_GETJOB
*q_u
, prs_struct
*ps
, int depth
)
6198 prs_debug(ps
, depth
, desc
, "");
6204 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6206 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
6208 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6211 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
6217 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
6223 void free_devmode(DEVICEMODE
*devmode
)
6225 if (devmode
!=NULL
) {
6226 SAFE_FREE(devmode
->dev_private
);
6231 void free_printer_info_1(PRINTER_INFO_1
*printer
)
6236 void free_printer_info_2(PRINTER_INFO_2
*printer
)
6238 if (printer
!=NULL
) {
6239 free_devmode(printer
->devmode
);
6240 printer
->devmode
= NULL
;
6245 void free_printer_info_3(PRINTER_INFO_3
*printer
)
6250 void free_printer_info_4(PRINTER_INFO_4
*printer
)
6255 void free_printer_info_5(PRINTER_INFO_5
*printer
)
6260 void free_printer_info_7(PRINTER_INFO_7
*printer
)
6265 void free_job_info_2(JOB_INFO_2
*job
)
6268 free_devmode(job
->devmode
);
6271 /*******************************************************************
6273 ********************************************************************/
6275 BOOL
make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER
*q_u
,
6276 const fstring string
, uint32 printer
, uint32 type
)
6281 init_unistr2(&q_u
->string
, string
, UNI_STR_TERMINATE
);
6283 q_u
->printer
=printer
;
6292 /*******************************************************************
6293 Parse a SPOOL_Q_REPLYOPENPRINTER structure.
6294 ********************************************************************/
6296 BOOL
spoolss_io_q_replyopenprinter(const char *desc
, SPOOL_Q_REPLYOPENPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6298 prs_debug(ps
, depth
, desc
, "spoolss_io_q_replyopenprinter");
6304 if(!smb_io_unistr2("", &q_u
->string
, True
, ps
, depth
))
6310 if(!prs_uint32("printer", ps
, depth
, &q_u
->printer
))
6312 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
6315 if(!prs_uint32("unknown0", ps
, depth
, &q_u
->unknown0
))
6317 if(!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6323 /*******************************************************************
6324 Parse a SPOOL_R_REPLYOPENPRINTER structure.
6325 ********************************************************************/
6327 BOOL
spoolss_io_r_replyopenprinter(const char *desc
, SPOOL_R_REPLYOPENPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6329 prs_debug(ps
, depth
, desc
, "spoolss_io_r_replyopenprinter");
6335 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
6338 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6344 /*******************************************************************
6346 ********************************************************************/
6347 BOOL
make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER
*q_u
, POLICY_HND
*hnd
,
6348 uint32 condition
, uint32 change_id
)
6351 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6353 q_u
->condition
= condition
;
6354 q_u
->change_id
= change_id
;
6357 q_u
->unknown1
= 0x1;
6358 memset(q_u
->unknown2
, 0x0, 5);
6359 q_u
->unknown2
[0] = 0x1;
6364 /*******************************************************************
6365 Parse a SPOOL_Q_ROUTERREPLYPRINTER structure.
6366 ********************************************************************/
6367 BOOL
spoolss_io_q_routerreplyprinter (const char *desc
, SPOOL_Q_ROUTERREPLYPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6370 prs_debug(ps
, depth
, desc
, "spoolss_io_q_routerreplyprinter");
6376 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6379 if (!prs_uint32("condition", ps
, depth
, &q_u
->condition
))
6382 if (!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6385 if (!prs_uint32("change_id", ps
, depth
, &q_u
->change_id
))
6388 if (!prs_uint8s(False
, "dev_private", ps
, depth
, q_u
->unknown2
, 5))
6394 /*******************************************************************
6395 Parse a SPOOL_R_ROUTERREPLYPRINTER structure.
6396 ********************************************************************/
6397 BOOL
spoolss_io_r_routerreplyprinter (const char *desc
, SPOOL_R_ROUTERREPLYPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6399 prs_debug(ps
, depth
, desc
, "spoolss_io_r_routerreplyprinter");
6405 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6411 /*******************************************************************
6413 ********************************************************************/
6415 BOOL
make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER
*q_u
, POLICY_HND
*hnd
)
6420 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6425 /*******************************************************************
6426 Parse a SPOOL_Q_REPLYCLOSEPRINTER structure.
6427 ********************************************************************/
6429 BOOL
spoolss_io_q_replycloseprinter(const char *desc
, SPOOL_Q_REPLYCLOSEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6431 prs_debug(ps
, depth
, desc
, "spoolss_io_q_replycloseprinter");
6437 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6443 /*******************************************************************
6444 Parse a SPOOL_R_REPLYCLOSEPRINTER structure.
6445 ********************************************************************/
6447 BOOL
spoolss_io_r_replycloseprinter(const char *desc
, SPOOL_R_REPLYCLOSEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6449 prs_debug(ps
, depth
, desc
, "spoolss_io_r_replycloseprinter");
6455 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
6458 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6464 #if 0 /* JERRY - not currently used but could be :-) */
6466 /*******************************************************************
6467 Deep copy a SPOOL_NOTIFY_INFO_DATA structure
6468 ******************************************************************/
6469 static BOOL
copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA
*dst
,
6470 SPOOL_NOTIFY_INFO_DATA
*src
, int n
)
6474 memcpy(dst
, src
, sizeof(SPOOL_NOTIFY_INFO_DATA
)*n
);
6476 for (i
=0; i
<n
; i
++) {
6480 if (src
->size
!= POINTER
)
6482 len
= src
->notify_data
.data
.length
;
6483 s
= SMB_MALLOC_ARRAY(uint16
, len
);
6485 DEBUG(0,("copy_spool_notify_info_data: malloc() failed!\n"));
6489 memcpy(s
, src
->notify_data
.data
.string
, len
*2);
6490 dst
->notify_data
.data
.string
= s
;
6496 /*******************************************************************
6497 Deep copy a SPOOL_NOTIFY_INFO structure
6498 ******************************************************************/
6499 static BOOL
copy_spool_notify_info(SPOOL_NOTIFY_INFO
*dst
, SPOOL_NOTIFY_INFO
*src
)
6502 DEBUG(0,("copy_spool_notify_info: NULL destination pointer!\n"));
6506 dst
->version
= src
->version
;
6507 dst
->flags
= src
->flags
;
6508 dst
->count
= src
->count
;
6512 dst
->data
= SMB_MALLOC_ARRAY(SPOOL_NOTIFY_INFO_DATA
, dst
->count
);
6514 DEBUG(10,("copy_spool_notify_info: allocating space for [%d] PRINTER_NOTIFY_INFO_DATA entries\n",
6517 if (dst
->data
== NULL
) {
6518 DEBUG(0,("copy_spool_notify_info: malloc() failed for [%d] entries!\n",
6523 return (copy_spool_notify_info_data(dst
->data
, src
->data
, src
->count
));
6530 /*******************************************************************
6532 ********************************************************************/
6534 BOOL
make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN
*q_u
, POLICY_HND
*hnd
,
6535 uint32 change_low
, uint32 change_high
,
6536 SPOOL_NOTIFY_INFO
*info
)
6541 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6543 q_u
->change_low
=change_low
;
6544 q_u
->change_high
=change_high
;
6549 q_u
->info_ptr
=0x0FF0ADDE;
6551 q_u
->info
.version
=2;
6554 DEBUG(10,("make_spoolss_q_reply_rrpcn: [%d] PRINTER_NOTIFY_INFO_DATA\n",
6556 q_u
->info
.version
= info
->version
;
6557 q_u
->info
.flags
= info
->flags
;
6558 q_u
->info
.count
= info
->count
;
6559 /* pointer field - be careful! */
6560 q_u
->info
.data
= info
->data
;
6563 q_u
->info
.flags
=PRINTER_NOTIFY_INFO_DISCARDED
;
6570 /*******************************************************************
6571 Parse a SPOOL_Q_REPLY_RRPCN structure.
6572 ********************************************************************/
6574 BOOL
spoolss_io_q_reply_rrpcn(const char *desc
, SPOOL_Q_REPLY_RRPCN
*q_u
, prs_struct
*ps
, int depth
)
6576 prs_debug(ps
, depth
, desc
, "spoolss_io_q_reply_rrpcn");
6582 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6585 if (!prs_uint32("change_low", ps
, depth
, &q_u
->change_low
))
6588 if (!prs_uint32("change_high", ps
, depth
, &q_u
->change_high
))
6591 if (!prs_uint32("unknown0", ps
, depth
, &q_u
->unknown0
))
6594 if (!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6597 if (!prs_uint32("info_ptr", ps
, depth
, &q_u
->info_ptr
))
6600 if(q_u
->info_ptr
!=0)
6601 if(!smb_io_notify_info(desc
, &q_u
->info
, ps
, depth
))
6607 /*******************************************************************
6608 Parse a SPOOL_R_REPLY_RRPCN structure.
6609 ********************************************************************/
6611 BOOL
spoolss_io_r_reply_rrpcn(const char *desc
, SPOOL_R_REPLY_RRPCN
*r_u
, prs_struct
*ps
, int depth
)
6613 prs_debug(ps
, depth
, desc
, "spoolss_io_r_reply_rrpcn");
6619 if (!prs_uint32("unknown0", ps
, depth
, &r_u
->unknown0
))
6622 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6628 /*******************************************************************
6630 * called from spoolss_q_getprinterdataex (srv_spoolss.c)
6631 ********************************************************************/
6633 BOOL
spoolss_io_q_getprinterdataex(const char *desc
, SPOOL_Q_GETPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6638 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdataex");
6643 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6647 if (!smb_io_unistr2("keyname", &q_u
->keyname
,True
,ps
,depth
))
6651 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
6655 if (!prs_uint32("size", ps
, depth
, &q_u
->size
))
6661 /*******************************************************************
6662 * write a structure.
6663 * called from spoolss_r_getprinterdataex (srv_spoolss.c)
6664 ********************************************************************/
6666 BOOL
spoolss_io_r_getprinterdataex(const char *desc
, SPOOL_R_GETPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6671 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdataex");
6676 if (!prs_uint32("type", ps
, depth
, &r_u
->type
))
6678 if (!prs_uint32("size", ps
, depth
, &r_u
->size
))
6681 if (UNMARSHALLING(ps
) && r_u
->size
) {
6682 r_u
->data
= PRS_ALLOC_MEM(ps
, unsigned char, r_u
->size
);
6687 if (!prs_uint8s(False
,"data", ps
, depth
, r_u
->data
, r_u
->size
))
6693 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6695 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6701 /*******************************************************************
6703 ********************************************************************/
6705 BOOL
spoolss_io_q_setprinterdataex(const char *desc
, SPOOL_Q_SETPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6707 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinterdataex");
6712 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6714 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6720 if(!smb_io_unistr2("", &q_u
->value
, True
, ps
, depth
))
6726 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
6729 if(!prs_uint32("max_len", ps
, depth
, &q_u
->max_len
))
6739 if (UNMARSHALLING(ps
))
6740 q_u
->data
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->max_len
);
6741 if(q_u
->data
== NULL
)
6743 if(!prs_uint8s(False
,"data", ps
, depth
, q_u
->data
, q_u
->max_len
))
6751 if(!prs_uint32("real_len", ps
, depth
, &q_u
->real_len
))
6757 /*******************************************************************
6758 * write a structure.
6759 ********************************************************************/
6761 BOOL
spoolss_io_r_setprinterdataex(const char *desc
, SPOOL_R_SETPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6763 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinterdataex");
6768 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6774 /*******************************************************************
6776 ********************************************************************/
6777 BOOL
make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY
*q_u
,
6778 POLICY_HND
*hnd
, const char *key
,
6781 DEBUG(5,("make_spoolss_q_enumprinterkey\n"));
6783 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6784 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
6790 /*******************************************************************
6792 ********************************************************************/
6794 BOOL
spoolss_io_q_enumprinterkey(const char *desc
, SPOOL_Q_ENUMPRINTERKEY
*q_u
, prs_struct
*ps
, int depth
)
6796 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterkey");
6801 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6804 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6810 if(!prs_uint32("size", ps
, depth
, &q_u
->size
))
6816 /*******************************************************************
6817 * write a structure.
6818 ********************************************************************/
6820 BOOL
spoolss_io_r_enumprinterkey(const char *desc
, SPOOL_R_ENUMPRINTERKEY
*r_u
, prs_struct
*ps
, int depth
)
6822 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterkey");
6828 if (!smb_io_buffer5("", &r_u
->keys
, ps
, depth
))
6834 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6837 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6843 /*******************************************************************
6845 ********************************************************************/
6847 BOOL
make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY
*q_u
,
6848 POLICY_HND
*hnd
, char *keyname
)
6850 DEBUG(5,("make_spoolss_q_deleteprinterkey\n"));
6852 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6853 init_unistr2(&q_u
->keyname
, keyname
, UNI_STR_TERMINATE
);
6858 /*******************************************************************
6860 ********************************************************************/
6862 BOOL
spoolss_io_q_deleteprinterkey(const char *desc
, SPOOL_Q_DELETEPRINTERKEY
*q_u
, prs_struct
*ps
, int depth
)
6864 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterkey");
6869 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6872 if(!smb_io_unistr2("", &q_u
->keyname
, True
, ps
, depth
))
6878 /*******************************************************************
6879 * write a structure.
6880 ********************************************************************/
6882 BOOL
spoolss_io_r_deleteprinterkey(const char *desc
, SPOOL_R_DELETEPRINTERKEY
*r_u
, prs_struct
*ps
, int depth
)
6884 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterkey");
6890 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6897 /*******************************************************************
6899 ********************************************************************/
6901 BOOL
spoolss_io_q_enumprinterdataex(const char *desc
, SPOOL_Q_ENUMPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6903 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdataex");
6908 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6911 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6917 if(!prs_uint32("size", ps
, depth
, &q_u
->size
))
6923 /*******************************************************************
6924 ********************************************************************/
6926 static BOOL
spoolss_io_printer_enum_values_ctr(const char *desc
, prs_struct
*ps
,
6927 PRINTER_ENUM_VALUES_CTR
*ctr
, int depth
)
6930 uint32 valuename_offset
,
6933 const uint32 basic_unit
= 20; /* size of static portion of enum_values */
6935 prs_debug(ps
, depth
, desc
, "spoolss_io_printer_enum_values_ctr");
6939 * offset data begins at 20 bytes per structure * size_of_array.
6940 * Don't forget the uint32 at the beginning
6943 current_offset
= basic_unit
* ctr
->size_of_array
;
6945 /* first loop to write basic enum_value information */
6947 if (UNMARSHALLING(ps
)) {
6948 ctr
->values
= PRS_ALLOC_MEM(ps
, PRINTER_ENUM_VALUES
, ctr
->size_of_array
);
6953 for (i
=0; i
<ctr
->size_of_array
; i
++) {
6954 valuename_offset
= current_offset
;
6955 if (!prs_uint32("valuename_offset", ps
, depth
, &valuename_offset
))
6958 if (!prs_uint32("value_len", ps
, depth
, &ctr
->values
[i
].value_len
))
6961 if (!prs_uint32("type", ps
, depth
, &ctr
->values
[i
].type
))
6964 data_offset
= ctr
->values
[i
].value_len
+ valuename_offset
;
6966 if (!prs_uint32("data_offset", ps
, depth
, &data_offset
))
6969 if (!prs_uint32("data_len", ps
, depth
, &ctr
->values
[i
].data_len
))
6972 current_offset
= data_offset
+ ctr
->values
[i
].data_len
- basic_unit
;
6973 /* account for 2 byte alignment */
6974 current_offset
+= (current_offset
% 2);
6978 * loop #2 for writing the dynamically size objects; pay
6979 * attention to 2-byte alignment here....
6982 for (i
=0; i
<ctr
->size_of_array
; i
++) {
6984 if (!prs_unistr("valuename", ps
, depth
, &ctr
->values
[i
].valuename
))
6987 if ( ctr
->values
[i
].data_len
) {
6988 if ( UNMARSHALLING(ps
) ) {
6989 ctr
->values
[i
].data
= PRS_ALLOC_MEM(ps
, uint8
, ctr
->values
[i
].data_len
);
6990 if (!ctr
->values
[i
].data
)
6993 if (!prs_uint8s(False
, "data", ps
, depth
, ctr
->values
[i
].data
, ctr
->values
[i
].data_len
))
6997 if ( !prs_align_uint16(ps
) )
7004 /*******************************************************************
7005 * write a structure.
7006 ********************************************************************/
7008 BOOL
spoolss_io_r_enumprinterdataex(const char *desc
, SPOOL_R_ENUMPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
7010 uint32 data_offset
, end_offset
;
7011 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdataex");
7017 if (!prs_uint32("size", ps
, depth
, &r_u
->ctr
.size
))
7020 data_offset
= prs_offset(ps
);
7022 if (!prs_set_offset(ps
, data_offset
+ r_u
->ctr
.size
))
7028 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7031 if(!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
7034 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7037 r_u
->ctr
.size_of_array
= r_u
->returned
;
7039 end_offset
= prs_offset(ps
);
7041 if (!prs_set_offset(ps
, data_offset
))
7045 if (!spoolss_io_printer_enum_values_ctr("", ps
, &r_u
->ctr
, depth
))
7048 if (!prs_set_offset(ps
, end_offset
))
7053 /*******************************************************************
7054 * write a structure.
7055 ********************************************************************/
7058 uint32 GetPrintProcessorDirectory(
7060 [in] unistr2 *environment,
7062 [in,out] RPC_BUFFER buffer,
7063 [in] uint32 offered,
7064 [out] uint32 needed,
7065 [out] uint32 returned
7070 BOOL
make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY
*q_u
, const char *name
, char *environment
, int level
, RPC_BUFFER
*buffer
, uint32 offered
)
7072 DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n"));
7074 init_unistr2(&q_u
->name
, name
, UNI_STR_TERMINATE
);
7075 init_unistr2(&q_u
->environment
, environment
, UNI_STR_TERMINATE
);
7079 q_u
->buffer
= buffer
;
7080 q_u
->offered
= offered
;
7085 BOOL
spoolss_io_q_getprintprocessordirectory(const char *desc
, SPOOL_Q_GETPRINTPROCESSORDIRECTORY
*q_u
, prs_struct
*ps
, int depth
)
7089 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprintprocessordirectory");
7095 if (!prs_uint32("ptr", ps
, depth
, &ptr
))
7099 if(!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
7106 if (!prs_uint32("ptr", ps
, depth
, &ptr
))
7110 if(!smb_io_unistr2("environment", &q_u
->environment
, True
,
7118 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
7121 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
7127 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
7133 /*******************************************************************
7134 * write a structure.
7135 ********************************************************************/
7137 BOOL
spoolss_io_r_getprintprocessordirectory(const char *desc
, SPOOL_R_GETPRINTPROCESSORDIRECTORY
*r_u
, prs_struct
*ps
, int depth
)
7139 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprintprocessordirectory");
7145 if(!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
7151 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7154 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7160 BOOL
smb_io_printprocessordirectory_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCESSOR_DIRECTORY_1
*info
, int depth
)
7162 prs_struct
*ps
=&buffer
->prs
;
7164 prs_debug(ps
, depth
, desc
, "smb_io_printprocessordirectory_1");
7167 buffer
->struct_start
=prs_offset(ps
);
7169 if (!smb_io_unistr(desc
, &info
->name
, ps
, depth
))
7175 /*******************************************************************
7177 ********************************************************************/
7179 BOOL
make_spoolss_q_addform(SPOOL_Q_ADDFORM
*q_u
, POLICY_HND
*handle
,
7180 int level
, FORM
*form
)
7182 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7184 q_u
->level2
= level
;
7185 memcpy(&q_u
->form
, form
, sizeof(FORM
));
7190 /*******************************************************************
7192 ********************************************************************/
7194 BOOL
make_spoolss_q_setform(SPOOL_Q_SETFORM
*q_u
, POLICY_HND
*handle
,
7195 int level
, const char *form_name
, FORM
*form
)
7197 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7199 q_u
->level2
= level
;
7200 memcpy(&q_u
->form
, form
, sizeof(FORM
));
7201 init_unistr2(&q_u
->name
, form_name
, UNI_STR_TERMINATE
);
7206 /*******************************************************************
7208 ********************************************************************/
7210 BOOL
make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM
*q_u
, POLICY_HND
*handle
,
7213 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7214 init_unistr2(&q_u
->name
, form
, UNI_STR_TERMINATE
);
7218 /*******************************************************************
7220 ********************************************************************/
7222 BOOL
make_spoolss_q_getform(SPOOL_Q_GETFORM
*q_u
, POLICY_HND
*handle
,
7223 const char *formname
, uint32 level
,
7224 RPC_BUFFER
*buffer
, uint32 offered
)
7226 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7228 init_unistr2(&q_u
->formname
, formname
, UNI_STR_TERMINATE
);
7230 q_u
->offered
=offered
;
7235 /*******************************************************************
7237 ********************************************************************/
7239 BOOL
make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS
*q_u
, POLICY_HND
*handle
,
7240 uint32 level
, RPC_BUFFER
*buffer
,
7243 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7246 q_u
->offered
=offered
;
7251 /*******************************************************************
7253 ********************************************************************/
7255 BOOL
make_spoolss_q_setjob(SPOOL_Q_SETJOB
*q_u
, POLICY_HND
*handle
,
7256 uint32 jobid
, uint32 level
, uint32 command
)
7258 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7262 /* Hmm - the SPOOL_Q_SETJOB structure has a JOB_INFO ctr in it but
7263 the server side code has it marked as unused. */
7265 q_u
->command
= command
;
7270 /*******************************************************************
7272 ********************************************************************/
7274 BOOL
make_spoolss_q_getjob(SPOOL_Q_GETJOB
*q_u
, POLICY_HND
*handle
,
7275 uint32 jobid
, uint32 level
, RPC_BUFFER
*buffer
,
7278 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7281 q_u
->buffer
= buffer
;
7282 q_u
->offered
= offered
;
7287 /*******************************************************************
7289 ********************************************************************/
7291 BOOL
make_spoolss_q_startpageprinter(SPOOL_Q_STARTPAGEPRINTER
*q_u
,
7294 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7299 /*******************************************************************
7301 ********************************************************************/
7303 BOOL
make_spoolss_q_endpageprinter(SPOOL_Q_ENDPAGEPRINTER
*q_u
,
7306 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7311 /*******************************************************************
7313 ********************************************************************/
7315 BOOL
make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER
*q_u
,
7316 POLICY_HND
*handle
, uint32 level
,
7317 char *docname
, char *outputfile
,
7320 DOC_INFO_CONTAINER
*ctr
= &q_u
->doc_info_container
;
7322 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7328 ctr
->docinfo
.switch_value
= level
;
7330 ctr
->docinfo
.doc_info_1
.p_docname
= docname
? 1 : 0;
7331 ctr
->docinfo
.doc_info_1
.p_outputfile
= outputfile
? 1 : 0;
7332 ctr
->docinfo
.doc_info_1
.p_datatype
= datatype
? 1 : 0;
7334 init_unistr2(&ctr
->docinfo
.doc_info_1
.docname
, docname
, UNI_STR_TERMINATE
);
7335 init_unistr2(&ctr
->docinfo
.doc_info_1
.outputfile
, outputfile
, UNI_STR_TERMINATE
);
7336 init_unistr2(&ctr
->docinfo
.doc_info_1
.datatype
, datatype
, UNI_STR_TERMINATE
);
7340 /* DOC_INFO_2 is only used by Windows 9x and since it
7341 doesn't do printing over RPC we don't have to worry
7344 DEBUG(3, ("unsupported info level %d\n", level
));
7351 /*******************************************************************
7353 ********************************************************************/
7355 BOOL
make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER
*q_u
,
7358 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7363 /*******************************************************************
7365 ********************************************************************/
7367 BOOL
make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER
*q_u
,
7368 POLICY_HND
*handle
, uint32 data_size
,
7371 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7372 q_u
->buffer_size
= q_u
->buffer_size2
= data_size
;
7373 q_u
->buffer
= (unsigned char *)data
;
7377 /*******************************************************************
7379 ********************************************************************/
7381 BOOL
make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA
*q_u
,
7382 POLICY_HND
*handle
, char *valuename
)
7384 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7385 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
7390 /*******************************************************************
7392 ********************************************************************/
7394 BOOL
make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX
*q_u
,
7395 POLICY_HND
*handle
, char *key
,
7398 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7399 init_unistr2(&q_u
->valuename
, value
, UNI_STR_TERMINATE
);
7400 init_unistr2(&q_u
->keyname
, key
, UNI_STR_TERMINATE
);
7405 /*******************************************************************
7407 ********************************************************************/
7409 BOOL
make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX
*q_u
, POLICY_HND
*handle
,
7410 uint32 flags
, uint32 options
, const char *localmachine
,
7411 uint32 printerlocal
, SPOOL_NOTIFY_OPTION
*option
)
7413 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7416 q_u
->options
= options
;
7418 q_u
->localmachine_ptr
= 1;
7420 init_unistr2(&q_u
->localmachine
, localmachine
, UNI_STR_TERMINATE
);
7422 q_u
->printerlocal
= printerlocal
;
7425 q_u
->option_ptr
= 1;
7427 q_u
->option
= option
;