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 if (!q_u
->printername
) {
905 init_unistr2(q_u
->printername
, printername
, UNI_STR_TERMINATE
);
907 q_u
->printer_default
.datatype_ptr
= 0;
909 q_u
->printer_default
.devmode_cont
.size
=0;
910 q_u
->printer_default
.devmode_cont
.devmode_ptr
=0;
911 q_u
->printer_default
.devmode_cont
.devmode
=NULL
;
912 q_u
->printer_default
.access_required
=access_required
;
914 q_u
->user_switch
= 1;
916 q_u
->user_ctr
.level
= 1;
917 q_u
->user_ctr
.user
.user1
= TALLOC_P( get_talloc_ctx(), SPOOL_USER_1
);
918 if (!q_u
->user_ctr
.user
.user1
) {
921 q_u
->user_ctr
.user
.user1
->size
= strlen(clientname
) + strlen(user_name
) + 10;
922 q_u
->user_ctr
.user
.user1
->build
= 1381;
923 q_u
->user_ctr
.user
.user1
->major
= 2;
924 q_u
->user_ctr
.user
.user1
->minor
= 0;
925 q_u
->user_ctr
.user
.user1
->processor
= 0;
927 q_u
->user_ctr
.user
.user1
->client_name
= TALLOC_P( get_talloc_ctx(), UNISTR2
);
928 if (!q_u
->user_ctr
.user
.user1
->client_name
) {
931 q_u
->user_ctr
.user
.user1
->user_name
= TALLOC_P( get_talloc_ctx(), UNISTR2
);
932 if (!q_u
->user_ctr
.user
.user1
->user_name
) {
936 init_unistr2(q_u
->user_ctr
.user
.user1
->client_name
, clientname
, UNI_STR_TERMINATE
);
937 init_unistr2(q_u
->user_ctr
.user
.user1
->user_name
, user_name
, UNI_STR_TERMINATE
);
942 /*******************************************************************
944 ********************************************************************/
946 BOOL
make_spoolss_q_addprinterex( TALLOC_CTX
*mem_ctx
, SPOOL_Q_ADDPRINTEREX
*q_u
,
947 const char *srv_name
, const char* clientname
, const char* user_name
,
948 uint32 level
, PRINTER_INFO_CTR
*ctr
)
950 DEBUG(5,("make_spoolss_q_addprinterex\n"));
952 if (!ctr
|| !ctr
->printers_2
)
957 q_u
->server_name
= TALLOC_P( mem_ctx
, UNISTR2
);
958 if (!q_u
->server_name
) {
961 init_unistr2(q_u
->server_name
, srv_name
, UNI_FLAGS_NONE
);
965 q_u
->info
.level
= level
;
966 q_u
->info
.info_ptr
= (ctr
->printers_2
!=NULL
)?1:0;
969 /* init q_u->info.info2 from *info */
970 if (!make_spoolss_printer_info_2(mem_ctx
, &q_u
->info
.info_2
, ctr
->printers_2
)) {
971 DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n"));
981 q_u
->user_ctr
.level
= 1;
982 q_u
->user_ctr
.user
.user1
= TALLOC_P( get_talloc_ctx(), SPOOL_USER_1
);
983 if (!q_u
->user_ctr
.user
.user1
) {
986 q_u
->user_ctr
.user
.user1
->build
= 1381;
987 q_u
->user_ctr
.user
.user1
->major
= 2;
988 q_u
->user_ctr
.user
.user1
->minor
= 0;
989 q_u
->user_ctr
.user
.user1
->processor
= 0;
991 q_u
->user_ctr
.user
.user1
->client_name
= TALLOC_P( mem_ctx
, UNISTR2
);
992 if (!q_u
->user_ctr
.user
.user1
->client_name
) {
995 q_u
->user_ctr
.user
.user1
->user_name
= TALLOC_P( mem_ctx
, UNISTR2
);
996 if (!q_u
->user_ctr
.user
.user1
->user_name
) {
999 init_unistr2(q_u
->user_ctr
.user
.user1
->client_name
, clientname
, UNI_STR_TERMINATE
);
1000 init_unistr2(q_u
->user_ctr
.user
.user1
->user_name
, user_name
, UNI_STR_TERMINATE
);
1002 q_u
->user_ctr
.user
.user1
->size
= q_u
->user_ctr
.user
.user1
->user_name
->uni_str_len
+
1003 q_u
->user_ctr
.user
.user1
->client_name
->uni_str_len
+ 2;
1008 /*******************************************************************
1009 create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct
1010 *******************************************************************/
1012 BOOL
make_spoolss_printer_info_2(TALLOC_CTX
*mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_2
**spool_info2
,
1013 PRINTER_INFO_2
*info
)
1016 SPOOL_PRINTER_INFO_LEVEL_2
*inf
;
1018 /* allocate the necessary memory */
1019 if (!(inf
=TALLOC_P(mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_2
))) {
1020 DEBUG(0,("make_spoolss_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n"));
1024 inf
->servername_ptr
= (info
->servername
.buffer
!=NULL
)?1:0;
1025 inf
->printername_ptr
= (info
->printername
.buffer
!=NULL
)?1:0;
1026 inf
->sharename_ptr
= (info
->sharename
.buffer
!=NULL
)?1:0;
1027 inf
->portname_ptr
= (info
->portname
.buffer
!=NULL
)?1:0;
1028 inf
->drivername_ptr
= (info
->drivername
.buffer
!=NULL
)?1:0;
1029 inf
->comment_ptr
= (info
->comment
.buffer
!=NULL
)?1:0;
1030 inf
->location_ptr
= (info
->location
.buffer
!=NULL
)?1:0;
1031 inf
->devmode_ptr
= (info
->devmode
!=NULL
)?1:0;
1032 inf
->sepfile_ptr
= (info
->sepfile
.buffer
!=NULL
)?1:0;
1033 inf
->printprocessor_ptr
= (info
->printprocessor
.buffer
!=NULL
)?1:0;
1034 inf
->datatype_ptr
= (info
->datatype
.buffer
!=NULL
)?1:0;
1035 inf
->parameters_ptr
= (info
->parameters
.buffer
!=NULL
)?1:0;
1036 inf
->secdesc_ptr
= (info
->secdesc
!=NULL
)?1:0;
1037 inf
->attributes
= info
->attributes
;
1038 inf
->priority
= info
->priority
;
1039 inf
->default_priority
= info
->defaultpriority
;
1040 inf
->starttime
= info
->starttime
;
1041 inf
->untiltime
= info
->untiltime
;
1042 inf
->cjobs
= info
->cjobs
;
1043 inf
->averageppm
= info
->averageppm
;
1044 init_unistr2_from_unistr(&inf
->servername
, &info
->servername
);
1045 init_unistr2_from_unistr(&inf
->printername
, &info
->printername
);
1046 init_unistr2_from_unistr(&inf
->sharename
, &info
->sharename
);
1047 init_unistr2_from_unistr(&inf
->portname
, &info
->portname
);
1048 init_unistr2_from_unistr(&inf
->drivername
, &info
->drivername
);
1049 init_unistr2_from_unistr(&inf
->comment
, &info
->comment
);
1050 init_unistr2_from_unistr(&inf
->location
, &info
->location
);
1051 init_unistr2_from_unistr(&inf
->sepfile
, &info
->sepfile
);
1052 init_unistr2_from_unistr(&inf
->printprocessor
, &info
->printprocessor
);
1053 init_unistr2_from_unistr(&inf
->datatype
, &info
->datatype
);
1054 init_unistr2_from_unistr(&inf
->parameters
, &info
->parameters
);
1055 init_unistr2_from_unistr(&inf
->datatype
, &info
->datatype
);
1062 /*******************************************************************
1063 create a SPOOL_PRINTER_INFO_3 struct from a PRINTER_INFO_3 struct
1064 *******************************************************************/
1066 BOOL
make_spoolss_printer_info_3(TALLOC_CTX
*mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_3
**spool_info3
,
1067 PRINTER_INFO_3
*info
)
1070 SPOOL_PRINTER_INFO_LEVEL_3
*inf
;
1072 /* allocate the necessary memory */
1073 if (!(inf
=TALLOC_P(mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_3
))) {
1074 DEBUG(0,("make_spoolss_printer_info_3: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_3 sruct!\n"));
1078 inf
->secdesc_ptr
= (info
->secdesc
!=NULL
)?1:0;
1085 /*******************************************************************
1086 create a SPOOL_PRINTER_INFO_7 struct from a PRINTER_INFO_7 struct
1087 *******************************************************************/
1089 BOOL
make_spoolss_printer_info_7(TALLOC_CTX
*mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_7
**spool_info7
,
1090 PRINTER_INFO_7
*info
)
1093 SPOOL_PRINTER_INFO_LEVEL_7
*inf
;
1095 /* allocate the necessary memory */
1096 if (!(inf
=TALLOC_P(mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_7
))) {
1097 DEBUG(0,("make_spoolss_printer_info_7: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_7 struct!\n"));
1101 inf
->guid_ptr
= (info
->guid
.buffer
!=NULL
)?1:0;
1102 inf
->action
= info
->action
;
1103 init_unistr2_from_unistr(&inf
->guid
, &info
->guid
);
1111 /*******************************************************************
1113 * called from spoolss_q_open_printer_ex (srv_spoolss.c)
1114 ********************************************************************/
1116 BOOL
spoolss_io_q_open_printer(const char *desc
, SPOOL_Q_OPEN_PRINTER
*q_u
, prs_struct
*ps
, int depth
)
1121 prs_debug(ps
, depth
, desc
, "spoolss_io_q_open_printer");
1127 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->printername
))
1129 if (!prs_io_unistr2("printername", ps
, depth
, q_u
->printername
))
1135 if (!spoolss_io_printer_default("", &q_u
->printer_default
, ps
, depth
))
1141 /*******************************************************************
1142 * write a structure.
1143 * called from static spoolss_r_open_printer_ex (srv_spoolss.c)
1144 * called from spoolss_open_printer_ex (cli_spoolss.c)
1145 ********************************************************************/
1147 BOOL
spoolss_io_r_open_printer(const char *desc
, SPOOL_R_OPEN_PRINTER
*r_u
, prs_struct
*ps
, int depth
)
1149 if (r_u
== NULL
) return False
;
1151 prs_debug(ps
, depth
, desc
, "spoolss_io_r_open_printer");
1157 if (!smb_io_pol_hnd("printer handle",&(r_u
->handle
),ps
,depth
))
1160 if (!prs_werror("status code", ps
, depth
, &(r_u
->status
)))
1167 /*******************************************************************
1169 * called from spoolss_q_open_printer_ex (srv_spoolss.c)
1170 ********************************************************************/
1172 BOOL
spoolss_io_q_open_printer_ex(const char *desc
, SPOOL_Q_OPEN_PRINTER_EX
*q_u
, prs_struct
*ps
, int depth
)
1177 prs_debug(ps
, depth
, desc
, "spoolss_io_q_open_printer_ex");
1183 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->printername
))
1185 if (!prs_io_unistr2("printername", ps
, depth
, q_u
->printername
))
1191 if (!spoolss_io_printer_default("", &q_u
->printer_default
, ps
, depth
))
1194 if (!prs_uint32("user_switch", ps
, depth
, &q_u
->user_switch
))
1196 if (!spool_io_user_level("", &q_u
->user_ctr
, ps
, depth
))
1202 /*******************************************************************
1203 * write a structure.
1204 * called from static spoolss_r_open_printer_ex (srv_spoolss.c)
1205 * called from spoolss_open_printer_ex (cli_spoolss.c)
1206 ********************************************************************/
1208 BOOL
spoolss_io_r_open_printer_ex(const char *desc
, SPOOL_R_OPEN_PRINTER_EX
*r_u
, prs_struct
*ps
, int depth
)
1210 if (r_u
== NULL
) return False
;
1212 prs_debug(ps
, depth
, desc
, "spoolss_io_r_open_printer_ex");
1218 if (!smb_io_pol_hnd("printer handle",&(r_u
->handle
),ps
,depth
))
1221 if (!prs_werror("status code", ps
, depth
, &(r_u
->status
)))
1227 /*******************************************************************
1229 ********************************************************************/
1230 BOOL
make_spoolss_q_deleteprinterdriverex( TALLOC_CTX
*mem_ctx
,
1231 SPOOL_Q_DELETEPRINTERDRIVEREX
*q_u
,
1237 DEBUG(5,("make_spoolss_q_deleteprinterdriverex\n"));
1239 q_u
->server_ptr
= (server
!=NULL
)?1:0;
1240 q_u
->delete_flags
= DPD_DELETE_UNUSED_FILES
;
1242 /* these must be NULL terminated or else NT4 will
1243 complain about invalid parameters --jerry */
1244 init_unistr2(&q_u
->server
, server
, UNI_STR_TERMINATE
);
1245 init_unistr2(&q_u
->arch
, arch
, UNI_STR_TERMINATE
);
1246 init_unistr2(&q_u
->driver
, driver
, UNI_STR_TERMINATE
);
1249 q_u
->delete_flags
|= DPD_DELETE_SPECIFIC_VERSION
;
1250 q_u
->version
= version
;
1257 /*******************************************************************
1259 ********************************************************************/
1260 BOOL
make_spoolss_q_deleteprinterdriver(
1261 TALLOC_CTX
*mem_ctx
,
1262 SPOOL_Q_DELETEPRINTERDRIVER
*q_u
,
1268 DEBUG(5,("make_spoolss_q_deleteprinterdriver\n"));
1270 q_u
->server_ptr
= (server
!=NULL
)?1:0;
1272 /* these must be NULL terminated or else NT4 will
1273 complain about invalid parameters --jerry */
1274 init_unistr2(&q_u
->server
, server
, UNI_STR_TERMINATE
);
1275 init_unistr2(&q_u
->arch
, arch
, UNI_STR_TERMINATE
);
1276 init_unistr2(&q_u
->driver
, driver
, UNI_STR_TERMINATE
);
1281 /*******************************************************************
1283 ********************************************************************/
1285 BOOL
make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA
*q_u
,
1286 const POLICY_HND
*handle
,
1287 const char *valuename
, uint32 size
)
1289 if (q_u
== NULL
) return False
;
1291 DEBUG(5,("make_spoolss_q_getprinterdata\n"));
1293 q_u
->handle
= *handle
;
1294 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
1300 /*******************************************************************
1302 ********************************************************************/
1304 BOOL
make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX
*q_u
,
1305 const POLICY_HND
*handle
,
1306 const char *keyname
,
1307 const char *valuename
, uint32 size
)
1309 if (q_u
== NULL
) return False
;
1311 DEBUG(5,("make_spoolss_q_getprinterdataex\n"));
1313 q_u
->handle
= *handle
;
1314 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
1315 init_unistr2(&q_u
->keyname
, keyname
, UNI_STR_TERMINATE
);
1321 /*******************************************************************
1323 * called from spoolss_q_getprinterdata (srv_spoolss.c)
1324 ********************************************************************/
1326 BOOL
spoolss_io_q_getprinterdata(const char *desc
, SPOOL_Q_GETPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
1331 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdata");
1336 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1340 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
1344 if (!prs_uint32("size", ps
, depth
, &q_u
->size
))
1350 /*******************************************************************
1352 * called from spoolss_q_deleteprinterdata (srv_spoolss.c)
1353 ********************************************************************/
1355 BOOL
spoolss_io_q_deleteprinterdata(const char *desc
, SPOOL_Q_DELETEPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
1360 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdata");
1365 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1369 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
1375 /*******************************************************************
1376 * write a structure.
1377 * called from spoolss_r_deleteprinterdata (srv_spoolss.c)
1378 ********************************************************************/
1380 BOOL
spoolss_io_r_deleteprinterdata(const char *desc
, SPOOL_R_DELETEPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
1382 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdata");
1384 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1390 /*******************************************************************
1392 * called from spoolss_q_deleteprinterdataex (srv_spoolss.c)
1393 ********************************************************************/
1395 BOOL
spoolss_io_q_deleteprinterdataex(const char *desc
, SPOOL_Q_DELETEPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
1400 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdataex");
1405 if (!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
1408 if (!smb_io_unistr2("keyname ", &q_u
->keyname
, True
, ps
, depth
))
1410 if (!smb_io_unistr2("valuename", &q_u
->valuename
, True
, ps
, depth
))
1416 /*******************************************************************
1417 * write a structure.
1418 * called from spoolss_r_deleteprinterdataex (srv_spoolss.c)
1419 ********************************************************************/
1421 BOOL
spoolss_io_r_deleteprinterdataex(const char *desc
, SPOOL_R_DELETEPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
1423 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdataex");
1426 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1432 /*******************************************************************
1433 * write a structure.
1434 * called from spoolss_r_getprinterdata (srv_spoolss.c)
1435 ********************************************************************/
1437 BOOL
spoolss_io_r_getprinterdata(const char *desc
, SPOOL_R_GETPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
1442 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdata");
1447 if (!prs_uint32("type", ps
, depth
, &r_u
->type
))
1449 if (!prs_uint32("size", ps
, depth
, &r_u
->size
))
1452 if (UNMARSHALLING(ps
) && r_u
->size
) {
1453 r_u
->data
= PRS_ALLOC_MEM(ps
, unsigned char, r_u
->size
);
1458 if (!prs_uint8s( False
, "data", ps
, depth
, r_u
->data
, r_u
->size
))
1464 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
1466 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1472 /*******************************************************************
1474 ********************************************************************/
1476 BOOL
make_spoolss_q_closeprinter(SPOOL_Q_CLOSEPRINTER
*q_u
, POLICY_HND
*hnd
)
1478 if (q_u
== NULL
) return False
;
1480 DEBUG(5,("make_spoolss_q_closeprinter\n"));
1482 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
1487 /*******************************************************************
1489 * called from static spoolss_q_abortprinter (srv_spoolss.c)
1490 * called from spoolss_abortprinter (cli_spoolss.c)
1491 ********************************************************************/
1493 BOOL
spoolss_io_q_abortprinter(const char *desc
, SPOOL_Q_ABORTPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1495 if (q_u
== NULL
) return False
;
1497 prs_debug(ps
, depth
, desc
, "spoolss_io_q_abortprinter");
1503 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1509 /*******************************************************************
1510 * write a structure.
1511 * called from spoolss_r_abortprinter (srv_spoolss.c)
1512 ********************************************************************/
1514 BOOL
spoolss_io_r_abortprinter(const char *desc
, SPOOL_R_ABORTPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1516 prs_debug(ps
, depth
, desc
, "spoolss_io_r_abortprinter");
1518 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1524 /*******************************************************************
1526 * called from static spoolss_q_deleteprinter (srv_spoolss.c)
1527 * called from spoolss_deleteprinter (cli_spoolss.c)
1528 ********************************************************************/
1530 BOOL
spoolss_io_q_deleteprinter(const char *desc
, SPOOL_Q_DELETEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1532 if (q_u
== NULL
) return False
;
1534 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinter");
1540 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1546 /*******************************************************************
1547 * write a structure.
1548 * called from static spoolss_r_deleteprinter (srv_spoolss.c)
1549 * called from spoolss_deleteprinter (cli_spoolss.c)
1550 ********************************************************************/
1552 BOOL
spoolss_io_r_deleteprinter(const char *desc
, SPOOL_R_DELETEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1554 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinter");
1560 if (!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
1562 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1569 /*******************************************************************
1571 * called from api_spoolss_deleteprinterdriver (srv_spoolss.c)
1572 * called from spoolss_deleteprinterdriver (cli_spoolss.c)
1573 ********************************************************************/
1575 BOOL
spoolss_io_q_deleteprinterdriver(const char *desc
, SPOOL_Q_DELETEPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
1577 if (q_u
== NULL
) return False
;
1579 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdriver");
1585 if(!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
1587 if(!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
1589 if(!smb_io_unistr2("arch", &q_u
->arch
, True
, ps
, depth
))
1591 if(!smb_io_unistr2("driver", &q_u
->driver
, True
, ps
, depth
))
1599 /*******************************************************************
1600 * write a structure.
1601 ********************************************************************/
1602 BOOL
spoolss_io_r_deleteprinterdriver(const char *desc
, SPOOL_R_DELETEPRINTERDRIVER
*r_u
, prs_struct
*ps
, int depth
)
1604 if (r_u
== NULL
) return False
;
1606 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdriver");
1612 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1619 /*******************************************************************
1621 * called from api_spoolss_deleteprinterdriver (srv_spoolss.c)
1622 * called from spoolss_deleteprinterdriver (cli_spoolss.c)
1623 ********************************************************************/
1625 BOOL
spoolss_io_q_deleteprinterdriverex(const char *desc
, SPOOL_Q_DELETEPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
1627 if (q_u
== NULL
) return False
;
1629 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdriverex");
1635 if(!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
1637 if(!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
1639 if(!smb_io_unistr2("arch", &q_u
->arch
, True
, ps
, depth
))
1641 if(!smb_io_unistr2("driver", &q_u
->driver
, True
, ps
, depth
))
1647 if(!prs_uint32("delete_flags ", ps
, depth
, &q_u
->delete_flags
))
1649 if(!prs_uint32("version ", ps
, depth
, &q_u
->version
))
1657 /*******************************************************************
1658 * write a structure.
1659 ********************************************************************/
1660 BOOL
spoolss_io_r_deleteprinterdriverex(const char *desc
, SPOOL_R_DELETEPRINTERDRIVEREX
*r_u
, prs_struct
*ps
, int depth
)
1662 if (r_u
== NULL
) return False
;
1664 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdriverex");
1670 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1678 /*******************************************************************
1680 * called from static spoolss_q_closeprinter (srv_spoolss.c)
1681 * called from spoolss_closeprinter (cli_spoolss.c)
1682 ********************************************************************/
1684 BOOL
spoolss_io_q_closeprinter(const char *desc
, SPOOL_Q_CLOSEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1686 if (q_u
== NULL
) return False
;
1688 prs_debug(ps
, depth
, desc
, "spoolss_io_q_closeprinter");
1694 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1700 /*******************************************************************
1701 * write a structure.
1702 * called from static spoolss_r_closeprinter (srv_spoolss.c)
1703 * called from spoolss_closeprinter (cli_spoolss.c)
1704 ********************************************************************/
1706 BOOL
spoolss_io_r_closeprinter(const char *desc
, SPOOL_R_CLOSEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1708 prs_debug(ps
, depth
, desc
, "spoolss_io_r_closeprinter");
1714 if (!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
1716 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1722 /*******************************************************************
1724 * called from spoolss_q_startdocprinter (srv_spoolss.c)
1725 ********************************************************************/
1727 BOOL
spoolss_io_q_startdocprinter(const char *desc
, SPOOL_Q_STARTDOCPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1729 if (q_u
== NULL
) return False
;
1731 prs_debug(ps
, depth
, desc
, "spoolss_io_q_startdocprinter");
1737 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1740 if(!smb_io_doc_info_container("",&q_u
->doc_info_container
, ps
, depth
))
1746 /*******************************************************************
1747 * write a structure.
1748 * called from spoolss_r_startdocprinter (srv_spoolss.c)
1749 ********************************************************************/
1751 BOOL
spoolss_io_r_startdocprinter(const char *desc
, SPOOL_R_STARTDOCPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1753 prs_debug(ps
, depth
, desc
, "spoolss_io_r_startdocprinter");
1755 if(!prs_uint32("jobid", ps
, depth
, &r_u
->jobid
))
1757 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1763 /*******************************************************************
1765 * called from spoolss_q_enddocprinter (srv_spoolss.c)
1766 ********************************************************************/
1768 BOOL
spoolss_io_q_enddocprinter(const char *desc
, SPOOL_Q_ENDDOCPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1770 if (q_u
== NULL
) return False
;
1772 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enddocprinter");
1778 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1784 /*******************************************************************
1785 * write a structure.
1786 * called from spoolss_r_enddocprinter (srv_spoolss.c)
1787 ********************************************************************/
1789 BOOL
spoolss_io_r_enddocprinter(const char *desc
, SPOOL_R_ENDDOCPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1791 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enddocprinter");
1793 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1799 /*******************************************************************
1801 * called from spoolss_q_startpageprinter (srv_spoolss.c)
1802 ********************************************************************/
1804 BOOL
spoolss_io_q_startpageprinter(const char *desc
, SPOOL_Q_STARTPAGEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1806 if (q_u
== NULL
) return False
;
1808 prs_debug(ps
, depth
, desc
, "spoolss_io_q_startpageprinter");
1814 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1820 /*******************************************************************
1821 * write a structure.
1822 * called from spoolss_r_startpageprinter (srv_spoolss.c)
1823 ********************************************************************/
1825 BOOL
spoolss_io_r_startpageprinter(const char *desc
, SPOOL_R_STARTPAGEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1827 prs_debug(ps
, depth
, desc
, "spoolss_io_r_startpageprinter");
1829 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1835 /*******************************************************************
1837 * called from spoolss_q_endpageprinter (srv_spoolss.c)
1838 ********************************************************************/
1840 BOOL
spoolss_io_q_endpageprinter(const char *desc
, SPOOL_Q_ENDPAGEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1842 if (q_u
== NULL
) return False
;
1844 prs_debug(ps
, depth
, desc
, "spoolss_io_q_endpageprinter");
1850 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1856 /*******************************************************************
1857 * write a structure.
1858 * called from spoolss_r_endpageprinter (srv_spoolss.c)
1859 ********************************************************************/
1861 BOOL
spoolss_io_r_endpageprinter(const char *desc
, SPOOL_R_ENDPAGEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1863 prs_debug(ps
, depth
, desc
, "spoolss_io_r_endpageprinter");
1865 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1871 /*******************************************************************
1873 * called from spoolss_q_writeprinter (srv_spoolss.c)
1874 ********************************************************************/
1876 BOOL
spoolss_io_q_writeprinter(const char *desc
, SPOOL_Q_WRITEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1878 if (q_u
== NULL
) return False
;
1880 prs_debug(ps
, depth
, desc
, "spoolss_io_q_writeprinter");
1886 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1888 if(!prs_uint32("buffer_size", ps
, depth
, &q_u
->buffer_size
))
1891 if (q_u
->buffer_size
!=0)
1893 if (UNMARSHALLING(ps
))
1894 q_u
->buffer
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->buffer_size
);
1895 if(q_u
->buffer
== NULL
)
1897 if(!prs_uint8s(True
, "buffer", ps
, depth
, q_u
->buffer
, q_u
->buffer_size
))
1902 if(!prs_uint32("buffer_size2", ps
, depth
, &q_u
->buffer_size2
))
1908 /*******************************************************************
1909 * write a structure.
1910 * called from spoolss_r_writeprinter (srv_spoolss.c)
1911 ********************************************************************/
1913 BOOL
spoolss_io_r_writeprinter(const char *desc
, SPOOL_R_WRITEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1915 prs_debug(ps
, depth
, desc
, "spoolss_io_r_writeprinter");
1917 if(!prs_uint32("buffer_written", ps
, depth
, &r_u
->buffer_written
))
1919 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1925 /*******************************************************************
1927 * called from spoolss_q_rffpcnex (srv_spoolss.c)
1928 ********************************************************************/
1930 BOOL
spoolss_io_q_rffpcnex(const char *desc
, SPOOL_Q_RFFPCNEX
*q_u
, prs_struct
*ps
, int depth
)
1932 prs_debug(ps
, depth
, desc
, "spoolss_io_q_rffpcnex");
1938 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
1940 if(!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
1942 if(!prs_uint32("options", ps
, depth
, &q_u
->options
))
1944 if(!prs_uint32("localmachine_ptr", ps
, depth
, &q_u
->localmachine_ptr
))
1946 if(!smb_io_unistr2("localmachine", &q_u
->localmachine
, q_u
->localmachine_ptr
, ps
, depth
))
1952 if(!prs_uint32("printerlocal", ps
, depth
, &q_u
->printerlocal
))
1955 if(!prs_uint32("option_ptr", ps
, depth
, &q_u
->option_ptr
))
1958 if (q_u
->option_ptr
!=0) {
1960 if (UNMARSHALLING(ps
))
1961 if((q_u
->option
=PRS_ALLOC_MEM(ps
,SPOOL_NOTIFY_OPTION
,1)) == NULL
)
1964 if(!smb_io_notify_option("notify option", q_u
->option
, ps
, depth
))
1971 /*******************************************************************
1972 * write a structure.
1973 * called from spoolss_r_rffpcnex (srv_spoolss.c)
1974 ********************************************************************/
1976 BOOL
spoolss_io_r_rffpcnex(const char *desc
, SPOOL_R_RFFPCNEX
*r_u
, prs_struct
*ps
, int depth
)
1978 prs_debug(ps
, depth
, desc
, "spoolss_io_r_rffpcnex");
1981 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1987 /*******************************************************************
1989 * called from spoolss_q_rfnpcnex (srv_spoolss.c)
1990 ********************************************************************/
1992 BOOL
spoolss_io_q_rfnpcnex(const char *desc
, SPOOL_Q_RFNPCNEX
*q_u
, prs_struct
*ps
, int depth
)
1994 prs_debug(ps
, depth
, desc
, "spoolss_io_q_rfnpcnex");
2000 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
2003 if(!prs_uint32("change", ps
, depth
, &q_u
->change
))
2006 if(!prs_uint32("option_ptr", ps
, depth
, &q_u
->option_ptr
))
2009 if (q_u
->option_ptr
!=0) {
2011 if (UNMARSHALLING(ps
))
2012 if((q_u
->option
=PRS_ALLOC_MEM(ps
,SPOOL_NOTIFY_OPTION
,1)) == NULL
)
2015 if(!smb_io_notify_option("notify option", q_u
->option
, ps
, depth
))
2022 /*******************************************************************
2023 * write a structure.
2024 * called from spoolss_r_rfnpcnex (srv_spoolss.c)
2025 ********************************************************************/
2027 BOOL
spoolss_io_r_rfnpcnex(const char *desc
, SPOOL_R_RFNPCNEX
*r_u
, prs_struct
*ps
, int depth
)
2029 prs_debug(ps
, depth
, desc
, "spoolss_io_r_rfnpcnex");
2035 if (!prs_uint32("info_ptr", ps
, depth
, &r_u
->info_ptr
))
2038 if(!smb_io_notify_info("notify info", &r_u
->info
,ps
,depth
))
2043 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
2049 /*******************************************************************
2050 * return the length of a uint16 (obvious, but the code is clean)
2051 ********************************************************************/
2053 static uint32
size_of_uint16(uint16
*value
)
2055 return (sizeof(*value
));
2058 /*******************************************************************
2059 * return the length of a uint32 (obvious, but the code is clean)
2060 ********************************************************************/
2062 static uint32
size_of_uint32(uint32
*value
)
2064 return (sizeof(*value
));
2067 /*******************************************************************
2068 * return the length of a NTTIME (obvious, but the code is clean)
2069 ********************************************************************/
2071 static uint32
size_of_nttime(NTTIME
*value
)
2073 return (sizeof(*value
));
2076 /*******************************************************************
2077 * return the length of a uint32 (obvious, but the code is clean)
2078 ********************************************************************/
2080 static uint32
size_of_device_mode(DEVICEMODE
*devmode
)
2085 return (4+devmode
->size
+devmode
->driverextra
);
2088 /*******************************************************************
2089 * return the length of a uint32 (obvious, but the code is clean)
2090 ********************************************************************/
2092 static uint32
size_of_systemtime(SYSTEMTIME
*systime
)
2097 return (sizeof(SYSTEMTIME
) +4);
2100 /*******************************************************************
2101 Parse a DEVMODE structure and its relative pointer.
2102 ********************************************************************/
2104 static BOOL
smb_io_reldevmode(const char *desc
, RPC_BUFFER
*buffer
, int depth
, DEVICEMODE
**devmode
)
2106 prs_struct
*ps
=&buffer
->prs
;
2108 prs_debug(ps
, depth
, desc
, "smb_io_reldevmode");
2111 if (MARSHALLING(ps
)) {
2112 uint32 struct_offset
= prs_offset(ps
);
2113 uint32 relative_offset
;
2115 if (*devmode
== NULL
) {
2117 if (!prs_uint32("offset", ps
, depth
, &relative_offset
))
2119 DEBUG(8, ("boing, the devmode was NULL\n"));
2124 buffer
->string_at_end
-= ((*devmode
)->size
+ (*devmode
)->driverextra
);
2126 if(!prs_set_offset(ps
, buffer
->string_at_end
))
2129 /* write the DEVMODE */
2130 if (!spoolss_io_devmode(desc
, ps
, depth
, *devmode
))
2133 if(!prs_set_offset(ps
, struct_offset
))
2136 relative_offset
=buffer
->string_at_end
- buffer
->struct_start
;
2137 /* write its offset */
2138 if (!prs_uint32("offset", ps
, depth
, &relative_offset
))
2144 /* read the offset */
2145 if (!prs_uint32("offset", ps
, depth
, &buffer
->string_at_end
))
2147 if (buffer
->string_at_end
== 0) {
2152 old_offset
= prs_offset(ps
);
2153 if(!prs_set_offset(ps
, buffer
->string_at_end
+ buffer
->struct_start
))
2156 /* read the string */
2157 if((*devmode
=PRS_ALLOC_MEM(ps
,DEVICEMODE
,1)) == NULL
)
2159 if (!spoolss_io_devmode(desc
, ps
, depth
, *devmode
))
2162 if(!prs_set_offset(ps
, old_offset
))
2168 /*******************************************************************
2169 Parse a PRINTER_INFO_0 structure.
2170 ********************************************************************/
2172 BOOL
smb_io_printer_info_0(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_0
*info
, int depth
)
2174 prs_struct
*ps
=&buffer
->prs
;
2176 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_0");
2179 buffer
->struct_start
=prs_offset(ps
);
2181 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2183 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
2186 if(!prs_uint32("cjobs", ps
, depth
, &info
->cjobs
))
2188 if(!prs_uint32("total_jobs", ps
, depth
, &info
->total_jobs
))
2190 if(!prs_uint32("total_bytes", ps
, depth
, &info
->total_bytes
))
2193 if(!prs_uint16("year", ps
, depth
, &info
->year
))
2195 if(!prs_uint16("month", ps
, depth
, &info
->month
))
2197 if(!prs_uint16("dayofweek", ps
, depth
, &info
->dayofweek
))
2199 if(!prs_uint16("day", ps
, depth
, &info
->day
))
2201 if(!prs_uint16("hour", ps
, depth
, &info
->hour
))
2203 if(!prs_uint16("minute", ps
, depth
, &info
->minute
))
2205 if(!prs_uint16("second", ps
, depth
, &info
->second
))
2207 if(!prs_uint16("milliseconds", ps
, depth
, &info
->milliseconds
))
2210 if(!prs_uint32("global_counter", ps
, depth
, &info
->global_counter
))
2212 if(!prs_uint32("total_pages", ps
, depth
, &info
->total_pages
))
2215 if(!prs_uint16("major_version", ps
, depth
, &info
->major_version
))
2217 if(!prs_uint16("build_version", ps
, depth
, &info
->build_version
))
2219 if(!prs_uint32("unknown7", ps
, depth
, &info
->unknown7
))
2221 if(!prs_uint32("unknown8", ps
, depth
, &info
->unknown8
))
2223 if(!prs_uint32("unknown9", ps
, depth
, &info
->unknown9
))
2225 if(!prs_uint32("session_counter", ps
, depth
, &info
->session_counter
))
2227 if(!prs_uint32("unknown11", ps
, depth
, &info
->unknown11
))
2229 if(!prs_uint32("printer_errors", ps
, depth
, &info
->printer_errors
))
2231 if(!prs_uint32("unknown13", ps
, depth
, &info
->unknown13
))
2233 if(!prs_uint32("unknown14", ps
, depth
, &info
->unknown14
))
2235 if(!prs_uint32("unknown15", ps
, depth
, &info
->unknown15
))
2237 if(!prs_uint32("unknown16", ps
, depth
, &info
->unknown16
))
2239 if(!prs_uint32("change_id", ps
, depth
, &info
->change_id
))
2241 if(!prs_uint32("unknown18", ps
, depth
, &info
->unknown18
))
2243 if(!prs_uint32("status" , ps
, depth
, &info
->status
))
2245 if(!prs_uint32("unknown20", ps
, depth
, &info
->unknown20
))
2247 if(!prs_uint32("c_setprinter", ps
, depth
, &info
->c_setprinter
))
2249 if(!prs_uint16("unknown22", ps
, depth
, &info
->unknown22
))
2251 if(!prs_uint16("unknown23", ps
, depth
, &info
->unknown23
))
2253 if(!prs_uint16("unknown24", ps
, depth
, &info
->unknown24
))
2255 if(!prs_uint16("unknown25", ps
, depth
, &info
->unknown25
))
2257 if(!prs_uint16("unknown26", ps
, depth
, &info
->unknown26
))
2259 if(!prs_uint16("unknown27", ps
, depth
, &info
->unknown27
))
2261 if(!prs_uint16("unknown28", ps
, depth
, &info
->unknown28
))
2263 if(!prs_uint16("unknown29", ps
, depth
, &info
->unknown29
))
2269 /*******************************************************************
2270 Parse a PRINTER_INFO_1 structure.
2271 ********************************************************************/
2273 BOOL
smb_io_printer_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_1
*info
, int depth
)
2275 prs_struct
*ps
=&buffer
->prs
;
2277 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_1");
2280 buffer
->struct_start
=prs_offset(ps
);
2282 if (!prs_uint32("flags", ps
, depth
, &info
->flags
))
2284 if (!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2286 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2288 if (!smb_io_relstr("comment", buffer
, depth
, &info
->comment
))
2294 /*******************************************************************
2295 Parse a PRINTER_INFO_2 structure.
2296 ********************************************************************/
2298 BOOL
smb_io_printer_info_2(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_2
*info
, int depth
)
2300 prs_struct
*ps
=&buffer
->prs
;
2301 uint32 dm_offset
, sd_offset
, current_offset
;
2302 uint32 dummy_value
= 0, has_secdesc
= 0;
2304 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_2");
2307 buffer
->struct_start
=prs_offset(ps
);
2309 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
2311 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2313 if (!smb_io_relstr("sharename", buffer
, depth
, &info
->sharename
))
2315 if (!smb_io_relstr("portname", buffer
, depth
, &info
->portname
))
2317 if (!smb_io_relstr("drivername", buffer
, depth
, &info
->drivername
))
2319 if (!smb_io_relstr("comment", buffer
, depth
, &info
->comment
))
2321 if (!smb_io_relstr("location", buffer
, depth
, &info
->location
))
2324 /* save current offset and wind forwared by a uint32 */
2325 dm_offset
= prs_offset(ps
);
2326 if (!prs_uint32("devmode", ps
, depth
, &dummy_value
))
2329 if (!smb_io_relstr("sepfile", buffer
, depth
, &info
->sepfile
))
2331 if (!smb_io_relstr("printprocessor", buffer
, depth
, &info
->printprocessor
))
2333 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2335 if (!smb_io_relstr("parameters", buffer
, depth
, &info
->parameters
))
2338 /* save current offset for the sec_desc */
2339 sd_offset
= prs_offset(ps
);
2340 if (!prs_uint32("sec_desc", ps
, depth
, &has_secdesc
))
2344 /* save current location so we can pick back up here */
2345 current_offset
= prs_offset(ps
);
2347 /* parse the devmode */
2348 if (!prs_set_offset(ps
, dm_offset
))
2350 if (!smb_io_reldevmode("devmode", buffer
, depth
, &info
->devmode
))
2353 /* parse the sec_desc */
2354 if (info
->secdesc
) {
2355 if (!prs_set_offset(ps
, sd_offset
))
2357 if (!smb_io_relsecdesc("secdesc", buffer
, depth
, &info
->secdesc
))
2361 /* pick up where we left off */
2362 if (!prs_set_offset(ps
, current_offset
))
2365 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2367 if (!prs_uint32("priority", ps
, depth
, &info
->priority
))
2369 if (!prs_uint32("defpriority", ps
, depth
, &info
->defaultpriority
))
2371 if (!prs_uint32("starttime", ps
, depth
, &info
->starttime
))
2373 if (!prs_uint32("untiltime", ps
, depth
, &info
->untiltime
))
2375 if (!prs_uint32("status", ps
, depth
, &info
->status
))
2377 if (!prs_uint32("jobs", ps
, depth
, &info
->cjobs
))
2379 if (!prs_uint32("averageppm", ps
, depth
, &info
->averageppm
))
2385 /*******************************************************************
2386 Parse a PRINTER_INFO_3 structure.
2387 ********************************************************************/
2389 BOOL
smb_io_printer_info_3(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_3
*info
, int depth
)
2391 prs_struct
*ps
=&buffer
->prs
;
2393 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_3");
2396 buffer
->struct_start
=prs_offset(ps
);
2398 if (!prs_uint32("flags", ps
, depth
, &info
->flags
))
2400 if (!sec_io_desc("sec_desc", &info
->secdesc
, ps
, depth
))
2406 /*******************************************************************
2407 Parse a PRINTER_INFO_4 structure.
2408 ********************************************************************/
2410 BOOL
smb_io_printer_info_4(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_4
*info
, int depth
)
2412 prs_struct
*ps
=&buffer
->prs
;
2414 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_4");
2417 buffer
->struct_start
=prs_offset(ps
);
2419 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2421 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
2423 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2428 /*******************************************************************
2429 Parse a PRINTER_INFO_5 structure.
2430 ********************************************************************/
2432 BOOL
smb_io_printer_info_5(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_5
*info
, int depth
)
2434 prs_struct
*ps
=&buffer
->prs
;
2436 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_5");
2439 buffer
->struct_start
=prs_offset(ps
);
2441 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2443 if (!smb_io_relstr("portname", buffer
, depth
, &info
->portname
))
2445 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2447 if (!prs_uint32("device_not_selected_timeout", ps
, depth
, &info
->device_not_selected_timeout
))
2449 if (!prs_uint32("transmission_retry_timeout", ps
, depth
, &info
->transmission_retry_timeout
))
2454 /*******************************************************************
2455 Parse a PRINTER_INFO_6 structure.
2456 ********************************************************************/
2458 BOOL
smb_io_printer_info_6(const char *desc
, RPC_BUFFER
*buffer
,
2459 PRINTER_INFO_6
*info
, int depth
)
2461 prs_struct
*ps
=&buffer
->prs
;
2463 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_6");
2466 if (!prs_uint32("status", ps
, depth
, &info
->status
))
2472 /*******************************************************************
2473 Parse a PRINTER_INFO_7 structure.
2474 ********************************************************************/
2476 BOOL
smb_io_printer_info_7(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_7
*info
, int depth
)
2478 prs_struct
*ps
=&buffer
->prs
;
2480 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_7");
2483 buffer
->struct_start
=prs_offset(ps
);
2485 if (!smb_io_relstr("guid", buffer
, depth
, &info
->guid
))
2487 if (!prs_uint32("action", ps
, depth
, &info
->action
))
2492 /*******************************************************************
2493 Parse a PORT_INFO_1 structure.
2494 ********************************************************************/
2496 BOOL
smb_io_port_info_1(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_1
*info
, int depth
)
2498 prs_struct
*ps
=&buffer
->prs
;
2500 prs_debug(ps
, depth
, desc
, "smb_io_port_info_1");
2503 buffer
->struct_start
=prs_offset(ps
);
2505 if (!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2511 /*******************************************************************
2512 Parse a PORT_INFO_2 structure.
2513 ********************************************************************/
2515 BOOL
smb_io_port_info_2(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_2
*info
, int depth
)
2517 prs_struct
*ps
=&buffer
->prs
;
2519 prs_debug(ps
, depth
, desc
, "smb_io_port_info_2");
2522 buffer
->struct_start
=prs_offset(ps
);
2524 if (!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2526 if (!smb_io_relstr("monitor_name", buffer
, depth
, &info
->monitor_name
))
2528 if (!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2530 if (!prs_uint32("port_type", ps
, depth
, &info
->port_type
))
2532 if (!prs_uint32("reserved", ps
, depth
, &info
->reserved
))
2538 /*******************************************************************
2539 Parse a DRIVER_INFO_1 structure.
2540 ********************************************************************/
2542 BOOL
smb_io_printer_driver_info_1(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_1
*info
, int depth
)
2544 prs_struct
*ps
=&buffer
->prs
;
2546 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_1");
2549 buffer
->struct_start
=prs_offset(ps
);
2551 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2557 /*******************************************************************
2558 Parse a DRIVER_INFO_2 structure.
2559 ********************************************************************/
2561 BOOL
smb_io_printer_driver_info_2(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_2
*info
, int depth
)
2563 prs_struct
*ps
=&buffer
->prs
;
2565 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_2");
2568 buffer
->struct_start
=prs_offset(ps
);
2570 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2572 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2574 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2576 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2578 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2580 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2586 /*******************************************************************
2587 Parse a DRIVER_INFO_3 structure.
2588 ********************************************************************/
2590 BOOL
smb_io_printer_driver_info_3(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_3
*info
, int depth
)
2592 prs_struct
*ps
=&buffer
->prs
;
2594 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_3");
2597 buffer
->struct_start
=prs_offset(ps
);
2599 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2601 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2603 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2605 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2607 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2609 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2611 if (!smb_io_relstr("helpfile", buffer
, depth
, &info
->helpfile
))
2614 if (!smb_io_relarraystr("dependentfiles", buffer
, depth
, &info
->dependentfiles
))
2617 if (!smb_io_relstr("monitorname", buffer
, depth
, &info
->monitorname
))
2619 if (!smb_io_relstr("defaultdatatype", buffer
, depth
, &info
->defaultdatatype
))
2625 /*******************************************************************
2626 Parse a DRIVER_INFO_6 structure.
2627 ********************************************************************/
2629 BOOL
smb_io_printer_driver_info_6(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_6
*info
, int depth
)
2631 prs_struct
*ps
=&buffer
->prs
;
2633 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_6");
2636 buffer
->struct_start
=prs_offset(ps
);
2638 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2640 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2642 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2644 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2646 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2648 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2650 if (!smb_io_relstr("helpfile", buffer
, depth
, &info
->helpfile
))
2653 if (!smb_io_relarraystr("dependentfiles", buffer
, depth
, &info
->dependentfiles
))
2656 if (!smb_io_relstr("monitorname", buffer
, depth
, &info
->monitorname
))
2658 if (!smb_io_relstr("defaultdatatype", buffer
, depth
, &info
->defaultdatatype
))
2661 if (!smb_io_relarraystr("previousdrivernames", buffer
, depth
, &info
->previousdrivernames
))
2664 if (!prs_uint64("date", ps
, depth
, &info
->driver_date
))
2667 if (!prs_uint32("padding", ps
, depth
, &info
->padding
))
2670 if (!prs_uint32("driver_version_low", ps
, depth
, &info
->driver_version_low
))
2673 if (!prs_uint32("driver_version_high", ps
, depth
, &info
->driver_version_high
))
2676 if (!smb_io_relstr("mfgname", buffer
, depth
, &info
->mfgname
))
2678 if (!smb_io_relstr("oem_url", buffer
, depth
, &info
->oem_url
))
2680 if (!smb_io_relstr("hardware_id", buffer
, depth
, &info
->hardware_id
))
2682 if (!smb_io_relstr("provider", buffer
, depth
, &info
->provider
))
2688 /*******************************************************************
2689 Parse a JOB_INFO_1 structure.
2690 ********************************************************************/
2692 BOOL
smb_io_job_info_1(const char *desc
, RPC_BUFFER
*buffer
, JOB_INFO_1
*info
, int depth
)
2694 prs_struct
*ps
=&buffer
->prs
;
2696 prs_debug(ps
, depth
, desc
, "smb_io_job_info_1");
2699 buffer
->struct_start
=prs_offset(ps
);
2701 if (!prs_uint32("jobid", ps
, depth
, &info
->jobid
))
2703 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2705 if (!smb_io_relstr("machinename", buffer
, depth
, &info
->machinename
))
2707 if (!smb_io_relstr("username", buffer
, depth
, &info
->username
))
2709 if (!smb_io_relstr("document", buffer
, depth
, &info
->document
))
2711 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2713 if (!smb_io_relstr("text_status", buffer
, depth
, &info
->text_status
))
2715 if (!prs_uint32("status", ps
, depth
, &info
->status
))
2717 if (!prs_uint32("priority", ps
, depth
, &info
->priority
))
2719 if (!prs_uint32("position", ps
, depth
, &info
->position
))
2721 if (!prs_uint32("totalpages", ps
, depth
, &info
->totalpages
))
2723 if (!prs_uint32("pagesprinted", ps
, depth
, &info
->pagesprinted
))
2725 if (!spoolss_io_system_time("submitted", ps
, depth
, &info
->submitted
))
2731 /*******************************************************************
2732 Parse a JOB_INFO_2 structure.
2733 ********************************************************************/
2735 BOOL
smb_io_job_info_2(const char *desc
, RPC_BUFFER
*buffer
, JOB_INFO_2
*info
, int depth
)
2738 prs_struct
*ps
=&buffer
->prs
;
2740 prs_debug(ps
, depth
, desc
, "smb_io_job_info_2");
2743 buffer
->struct_start
=prs_offset(ps
);
2745 if (!prs_uint32("jobid",ps
, depth
, &info
->jobid
))
2747 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2749 if (!smb_io_relstr("machinename", buffer
, depth
, &info
->machinename
))
2751 if (!smb_io_relstr("username", buffer
, depth
, &info
->username
))
2753 if (!smb_io_relstr("document", buffer
, depth
, &info
->document
))
2755 if (!smb_io_relstr("notifyname", buffer
, depth
, &info
->notifyname
))
2757 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2760 if (!smb_io_relstr("printprocessor", buffer
, depth
, &info
->printprocessor
))
2762 if (!smb_io_relstr("parameters", buffer
, depth
, &info
->parameters
))
2764 if (!smb_io_relstr("drivername", buffer
, depth
, &info
->drivername
))
2766 if (!smb_io_reldevmode("devmode", buffer
, depth
, &info
->devmode
))
2768 if (!smb_io_relstr("text_status", buffer
, depth
, &info
->text_status
))
2771 /* SEC_DESC sec_desc;*/
2772 if (!prs_uint32("Hack! sec desc", ps
, depth
, &pipo
))
2775 if (!prs_uint32("status",ps
, depth
, &info
->status
))
2777 if (!prs_uint32("priority",ps
, depth
, &info
->priority
))
2779 if (!prs_uint32("position",ps
, depth
, &info
->position
))
2781 if (!prs_uint32("starttime",ps
, depth
, &info
->starttime
))
2783 if (!prs_uint32("untiltime",ps
, depth
, &info
->untiltime
))
2785 if (!prs_uint32("totalpages",ps
, depth
, &info
->totalpages
))
2787 if (!prs_uint32("size",ps
, depth
, &info
->size
))
2789 if (!spoolss_io_system_time("submitted", ps
, depth
, &info
->submitted
) )
2791 if (!prs_uint32("timeelapsed",ps
, depth
, &info
->timeelapsed
))
2793 if (!prs_uint32("pagesprinted",ps
, depth
, &info
->pagesprinted
))
2799 /*******************************************************************
2800 ********************************************************************/
2802 BOOL
smb_io_form_1(const char *desc
, RPC_BUFFER
*buffer
, FORM_1
*info
, int depth
)
2804 prs_struct
*ps
=&buffer
->prs
;
2806 prs_debug(ps
, depth
, desc
, "smb_io_form_1");
2809 buffer
->struct_start
=prs_offset(ps
);
2811 if (!prs_uint32("flag", ps
, depth
, &info
->flag
))
2814 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2817 if (!prs_uint32("width", ps
, depth
, &info
->width
))
2819 if (!prs_uint32("length", ps
, depth
, &info
->length
))
2821 if (!prs_uint32("left", ps
, depth
, &info
->left
))
2823 if (!prs_uint32("top", ps
, depth
, &info
->top
))
2825 if (!prs_uint32("right", ps
, depth
, &info
->right
))
2827 if (!prs_uint32("bottom", ps
, depth
, &info
->bottom
))
2835 /*******************************************************************
2836 Parse a DRIVER_DIRECTORY_1 structure.
2837 ********************************************************************/
2839 BOOL
smb_io_driverdir_1(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_DIRECTORY_1
*info
, int depth
)
2841 prs_struct
*ps
=&buffer
->prs
;
2843 prs_debug(ps
, depth
, desc
, "smb_io_driverdir_1");
2846 buffer
->struct_start
=prs_offset(ps
);
2848 if (!smb_io_unistr(desc
, &info
->name
, ps
, depth
))
2854 /*******************************************************************
2855 Parse a PORT_INFO_1 structure.
2856 ********************************************************************/
2858 BOOL
smb_io_port_1(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_1
*info
, int depth
)
2860 prs_struct
*ps
=&buffer
->prs
;
2862 prs_debug(ps
, depth
, desc
, "smb_io_port_1");
2865 buffer
->struct_start
=prs_offset(ps
);
2867 if(!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2873 /*******************************************************************
2874 Parse a PORT_INFO_2 structure.
2875 ********************************************************************/
2877 BOOL
smb_io_port_2(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_2
*info
, int depth
)
2879 prs_struct
*ps
=&buffer
->prs
;
2881 prs_debug(ps
, depth
, desc
, "smb_io_port_2");
2884 buffer
->struct_start
=prs_offset(ps
);
2886 if(!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2888 if(!smb_io_relstr("monitor_name", buffer
, depth
, &info
->monitor_name
))
2890 if(!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2892 if(!prs_uint32("port_type", ps
, depth
, &info
->port_type
))
2894 if(!prs_uint32("reserved", ps
, depth
, &info
->reserved
))
2900 /*******************************************************************
2901 ********************************************************************/
2903 BOOL
smb_io_printprocessor_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCESSOR_1
*info
, int depth
)
2905 prs_struct
*ps
=&buffer
->prs
;
2907 prs_debug(ps
, depth
, desc
, "smb_io_printprocessor_info_1");
2910 buffer
->struct_start
=prs_offset(ps
);
2912 if (smb_io_relstr("name", buffer
, depth
, &info
->name
))
2918 /*******************************************************************
2919 ********************************************************************/
2921 BOOL
smb_io_printprocdatatype_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCDATATYPE_1
*info
, int depth
)
2923 prs_struct
*ps
=&buffer
->prs
;
2925 prs_debug(ps
, depth
, desc
, "smb_io_printprocdatatype_info_1");
2928 buffer
->struct_start
=prs_offset(ps
);
2930 if (smb_io_relstr("name", buffer
, depth
, &info
->name
))
2936 /*******************************************************************
2937 ********************************************************************/
2939 BOOL
smb_io_printmonitor_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTMONITOR_1
*info
, int depth
)
2941 prs_struct
*ps
=&buffer
->prs
;
2943 prs_debug(ps
, depth
, desc
, "smb_io_printmonitor_info_1");
2946 buffer
->struct_start
=prs_offset(ps
);
2948 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2954 /*******************************************************************
2955 ********************************************************************/
2957 BOOL
smb_io_printmonitor_info_2(const char *desc
, RPC_BUFFER
*buffer
, PRINTMONITOR_2
*info
, int depth
)
2959 prs_struct
*ps
=&buffer
->prs
;
2961 prs_debug(ps
, depth
, desc
, "smb_io_printmonitor_info_2");
2964 buffer
->struct_start
=prs_offset(ps
);
2966 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2968 if (!smb_io_relstr("environment", buffer
, depth
, &info
->environment
))
2970 if (!smb_io_relstr("dll_name", buffer
, depth
, &info
->dll_name
))
2976 /*******************************************************************
2977 return the size required by a struct in the stream
2978 ********************************************************************/
2980 uint32
spoolss_size_printer_info_0(PRINTER_INFO_0
*info
)
2984 size
+=size_of_relative_string( &info
->printername
);
2985 size
+=size_of_relative_string( &info
->servername
);
2987 size
+=size_of_uint32( &info
->cjobs
);
2988 size
+=size_of_uint32( &info
->total_jobs
);
2989 size
+=size_of_uint32( &info
->total_bytes
);
2991 size
+=size_of_uint16( &info
->year
);
2992 size
+=size_of_uint16( &info
->month
);
2993 size
+=size_of_uint16( &info
->dayofweek
);
2994 size
+=size_of_uint16( &info
->day
);
2995 size
+=size_of_uint16( &info
->hour
);
2996 size
+=size_of_uint16( &info
->minute
);
2997 size
+=size_of_uint16( &info
->second
);
2998 size
+=size_of_uint16( &info
->milliseconds
);
3000 size
+=size_of_uint32( &info
->global_counter
);
3001 size
+=size_of_uint32( &info
->total_pages
);
3003 size
+=size_of_uint16( &info
->major_version
);
3004 size
+=size_of_uint16( &info
->build_version
);
3006 size
+=size_of_uint32( &info
->unknown7
);
3007 size
+=size_of_uint32( &info
->unknown8
);
3008 size
+=size_of_uint32( &info
->unknown9
);
3009 size
+=size_of_uint32( &info
->session_counter
);
3010 size
+=size_of_uint32( &info
->unknown11
);
3011 size
+=size_of_uint32( &info
->printer_errors
);
3012 size
+=size_of_uint32( &info
->unknown13
);
3013 size
+=size_of_uint32( &info
->unknown14
);
3014 size
+=size_of_uint32( &info
->unknown15
);
3015 size
+=size_of_uint32( &info
->unknown16
);
3016 size
+=size_of_uint32( &info
->change_id
);
3017 size
+=size_of_uint32( &info
->unknown18
);
3018 size
+=size_of_uint32( &info
->status
);
3019 size
+=size_of_uint32( &info
->unknown20
);
3020 size
+=size_of_uint32( &info
->c_setprinter
);
3022 size
+=size_of_uint16( &info
->unknown22
);
3023 size
+=size_of_uint16( &info
->unknown23
);
3024 size
+=size_of_uint16( &info
->unknown24
);
3025 size
+=size_of_uint16( &info
->unknown25
);
3026 size
+=size_of_uint16( &info
->unknown26
);
3027 size
+=size_of_uint16( &info
->unknown27
);
3028 size
+=size_of_uint16( &info
->unknown28
);
3029 size
+=size_of_uint16( &info
->unknown29
);
3034 /*******************************************************************
3035 return the size required by a struct in the stream
3036 ********************************************************************/
3038 uint32
spoolss_size_printer_info_1(PRINTER_INFO_1
*info
)
3042 size
+=size_of_uint32( &info
->flags
);
3043 size
+=size_of_relative_string( &info
->description
);
3044 size
+=size_of_relative_string( &info
->name
);
3045 size
+=size_of_relative_string( &info
->comment
);
3050 /*******************************************************************
3051 return the size required by a struct in the stream
3052 ********************************************************************/
3054 uint32
spoolss_size_printer_info_2(PRINTER_INFO_2
*info
)
3060 size
+= sec_desc_size( info
->secdesc
);
3062 size
+=size_of_device_mode( info
->devmode
);
3064 size
+=size_of_relative_string( &info
->servername
);
3065 size
+=size_of_relative_string( &info
->printername
);
3066 size
+=size_of_relative_string( &info
->sharename
);
3067 size
+=size_of_relative_string( &info
->portname
);
3068 size
+=size_of_relative_string( &info
->drivername
);
3069 size
+=size_of_relative_string( &info
->comment
);
3070 size
+=size_of_relative_string( &info
->location
);
3072 size
+=size_of_relative_string( &info
->sepfile
);
3073 size
+=size_of_relative_string( &info
->printprocessor
);
3074 size
+=size_of_relative_string( &info
->datatype
);
3075 size
+=size_of_relative_string( &info
->parameters
);
3077 size
+=size_of_uint32( &info
->attributes
);
3078 size
+=size_of_uint32( &info
->priority
);
3079 size
+=size_of_uint32( &info
->defaultpriority
);
3080 size
+=size_of_uint32( &info
->starttime
);
3081 size
+=size_of_uint32( &info
->untiltime
);
3082 size
+=size_of_uint32( &info
->status
);
3083 size
+=size_of_uint32( &info
->cjobs
);
3084 size
+=size_of_uint32( &info
->averageppm
);
3087 * add any adjustments for alignment. This is
3088 * not optimal since we could be calling this
3089 * function from a loop (e.g. enumprinters), but
3090 * it is easier to maintain the calculation here and
3091 * not place the burden on the caller to remember. --jerry
3093 if ((size
% 4) != 0)
3094 size
+= 4 - (size
% 4);
3099 /*******************************************************************
3100 return the size required by a struct in the stream
3101 ********************************************************************/
3103 uint32
spoolss_size_printer_info_4(PRINTER_INFO_4
*info
)
3107 size
+=size_of_relative_string( &info
->printername
);
3108 size
+=size_of_relative_string( &info
->servername
);
3110 size
+=size_of_uint32( &info
->attributes
);
3114 /*******************************************************************
3115 return the size required by a struct in the stream
3116 ********************************************************************/
3118 uint32
spoolss_size_printer_info_5(PRINTER_INFO_5
*info
)
3122 size
+=size_of_relative_string( &info
->printername
);
3123 size
+=size_of_relative_string( &info
->portname
);
3125 size
+=size_of_uint32( &info
->attributes
);
3126 size
+=size_of_uint32( &info
->device_not_selected_timeout
);
3127 size
+=size_of_uint32( &info
->transmission_retry_timeout
);
3131 /*******************************************************************
3132 return the size required by a struct in the stream
3133 ********************************************************************/
3135 uint32
spoolss_size_printer_info_6(PRINTER_INFO_6
*info
)
3137 return sizeof(uint32
);
3140 /*******************************************************************
3141 return the size required by a struct in the stream
3142 ********************************************************************/
3144 uint32
spoolss_size_printer_info_3(PRINTER_INFO_3
*info
)
3146 /* The 4 is for the self relative pointer.. */
3147 /* JRA !!!! TESTME - WHAT ABOUT prs_align.... !!! */
3148 return 4 + (uint32
)sec_desc_size( info
->secdesc
);
3151 /*******************************************************************
3152 return the size required by a struct in the stream
3153 ********************************************************************/
3155 uint32
spoolss_size_printer_info_7(PRINTER_INFO_7
*info
)
3159 size
+=size_of_relative_string( &info
->guid
);
3160 size
+=size_of_uint32( &info
->action
);
3164 /*******************************************************************
3165 return the size required by a struct in the stream
3166 ********************************************************************/
3168 uint32
spoolss_size_printer_driver_info_1(DRIVER_INFO_1
*info
)
3171 size
+=size_of_relative_string( &info
->name
);
3176 /*******************************************************************
3177 return the size required by a struct in the stream
3178 ********************************************************************/
3180 uint32
spoolss_size_printer_driver_info_2(DRIVER_INFO_2
*info
)
3183 size
+=size_of_uint32( &info
->version
);
3184 size
+=size_of_relative_string( &info
->name
);
3185 size
+=size_of_relative_string( &info
->architecture
);
3186 size
+=size_of_relative_string( &info
->driverpath
);
3187 size
+=size_of_relative_string( &info
->datafile
);
3188 size
+=size_of_relative_string( &info
->configfile
);
3193 /*******************************************************************
3194 return the size required by a string array.
3195 ********************************************************************/
3197 uint32
spoolss_size_string_array(uint16
*string
)
3202 for (i
=0; (string
[i
]!=0x0000) || (string
[i
+1]!=0x0000); i
++);
3204 i
=i
+2; /* to count all chars including the leading zero */
3205 i
=2*i
; /* because we need the value in bytes */
3206 i
=i
+4; /* the offset pointer size */
3211 /*******************************************************************
3212 return the size required by a struct in the stream
3213 ********************************************************************/
3215 uint32
spoolss_size_printer_driver_info_3(DRIVER_INFO_3
*info
)
3219 size
+=size_of_uint32( &info
->version
);
3220 size
+=size_of_relative_string( &info
->name
);
3221 size
+=size_of_relative_string( &info
->architecture
);
3222 size
+=size_of_relative_string( &info
->driverpath
);
3223 size
+=size_of_relative_string( &info
->datafile
);
3224 size
+=size_of_relative_string( &info
->configfile
);
3225 size
+=size_of_relative_string( &info
->helpfile
);
3226 size
+=size_of_relative_string( &info
->monitorname
);
3227 size
+=size_of_relative_string( &info
->defaultdatatype
);
3229 size
+=spoolss_size_string_array(info
->dependentfiles
);
3234 /*******************************************************************
3235 return the size required by a struct in the stream
3236 ********************************************************************/
3238 uint32
spoolss_size_printer_driver_info_6(DRIVER_INFO_6
*info
)
3242 size
+=size_of_uint32( &info
->version
);
3243 size
+=size_of_relative_string( &info
->name
);
3244 size
+=size_of_relative_string( &info
->architecture
);
3245 size
+=size_of_relative_string( &info
->driverpath
);
3246 size
+=size_of_relative_string( &info
->datafile
);
3247 size
+=size_of_relative_string( &info
->configfile
);
3248 size
+=size_of_relative_string( &info
->helpfile
);
3250 size
+=spoolss_size_string_array(info
->dependentfiles
);
3252 size
+=size_of_relative_string( &info
->monitorname
);
3253 size
+=size_of_relative_string( &info
->defaultdatatype
);
3255 size
+=spoolss_size_string_array(info
->previousdrivernames
);
3257 size
+=size_of_nttime(&info
->driver_date
);
3258 size
+=size_of_uint32( &info
->padding
);
3259 size
+=size_of_uint32( &info
->driver_version_low
);
3260 size
+=size_of_uint32( &info
->driver_version_high
);
3261 size
+=size_of_relative_string( &info
->mfgname
);
3262 size
+=size_of_relative_string( &info
->oem_url
);
3263 size
+=size_of_relative_string( &info
->hardware_id
);
3264 size
+=size_of_relative_string( &info
->provider
);
3269 /*******************************************************************
3270 return the size required by a struct in the stream
3271 ********************************************************************/
3273 uint32
spoolss_size_job_info_1(JOB_INFO_1
*info
)
3276 size
+=size_of_uint32( &info
->jobid
);
3277 size
+=size_of_relative_string( &info
->printername
);
3278 size
+=size_of_relative_string( &info
->machinename
);
3279 size
+=size_of_relative_string( &info
->username
);
3280 size
+=size_of_relative_string( &info
->document
);
3281 size
+=size_of_relative_string( &info
->datatype
);
3282 size
+=size_of_relative_string( &info
->text_status
);
3283 size
+=size_of_uint32( &info
->status
);
3284 size
+=size_of_uint32( &info
->priority
);
3285 size
+=size_of_uint32( &info
->position
);
3286 size
+=size_of_uint32( &info
->totalpages
);
3287 size
+=size_of_uint32( &info
->pagesprinted
);
3288 size
+=size_of_systemtime( &info
->submitted
);
3293 /*******************************************************************
3294 return the size required by a struct in the stream
3295 ********************************************************************/
3297 uint32
spoolss_size_job_info_2(JOB_INFO_2
*info
)
3301 size
+=4; /* size of sec desc ptr */
3303 size
+=size_of_uint32( &info
->jobid
);
3304 size
+=size_of_relative_string( &info
->printername
);
3305 size
+=size_of_relative_string( &info
->machinename
);
3306 size
+=size_of_relative_string( &info
->username
);
3307 size
+=size_of_relative_string( &info
->document
);
3308 size
+=size_of_relative_string( &info
->notifyname
);
3309 size
+=size_of_relative_string( &info
->datatype
);
3310 size
+=size_of_relative_string( &info
->printprocessor
);
3311 size
+=size_of_relative_string( &info
->parameters
);
3312 size
+=size_of_relative_string( &info
->drivername
);
3313 size
+=size_of_device_mode( info
->devmode
);
3314 size
+=size_of_relative_string( &info
->text_status
);
3315 /* SEC_DESC sec_desc;*/
3316 size
+=size_of_uint32( &info
->status
);
3317 size
+=size_of_uint32( &info
->priority
);
3318 size
+=size_of_uint32( &info
->position
);
3319 size
+=size_of_uint32( &info
->starttime
);
3320 size
+=size_of_uint32( &info
->untiltime
);
3321 size
+=size_of_uint32( &info
->totalpages
);
3322 size
+=size_of_uint32( &info
->size
);
3323 size
+=size_of_systemtime( &info
->submitted
);
3324 size
+=size_of_uint32( &info
->timeelapsed
);
3325 size
+=size_of_uint32( &info
->pagesprinted
);
3330 /*******************************************************************
3331 return the size required by a struct in the stream
3332 ********************************************************************/
3334 uint32
spoolss_size_form_1(FORM_1
*info
)
3338 size
+=size_of_uint32( &info
->flag
);
3339 size
+=size_of_relative_string( &info
->name
);
3340 size
+=size_of_uint32( &info
->width
);
3341 size
+=size_of_uint32( &info
->length
);
3342 size
+=size_of_uint32( &info
->left
);
3343 size
+=size_of_uint32( &info
->top
);
3344 size
+=size_of_uint32( &info
->right
);
3345 size
+=size_of_uint32( &info
->bottom
);
3350 /*******************************************************************
3351 return the size required by a struct in the stream
3352 ********************************************************************/
3354 uint32
spoolss_size_port_info_1(PORT_INFO_1
*info
)
3358 size
+=size_of_relative_string( &info
->port_name
);
3363 /*******************************************************************
3364 return the size required by a struct in the stream
3365 ********************************************************************/
3367 uint32
spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1
*info
)
3371 size
=str_len_uni(&info
->name
); /* the string length */
3372 size
=size
+1; /* add the leading zero */
3373 size
=size
*2; /* convert in char */
3378 /*******************************************************************
3379 return the size required by a struct in the stream
3380 ********************************************************************/
3382 uint32
spoolss_size_printprocessordirectory_info_1(PRINTPROCESSOR_DIRECTORY_1
*info
)
3386 size
=str_len_uni(&info
->name
); /* the string length */
3387 size
=size
+1; /* add the leading zero */
3388 size
=size
*2; /* convert in char */
3393 /*******************************************************************
3394 return the size required by a struct in the stream
3395 ********************************************************************/
3397 uint32
spoolss_size_port_info_2(PORT_INFO_2
*info
)
3401 size
+=size_of_relative_string( &info
->port_name
);
3402 size
+=size_of_relative_string( &info
->monitor_name
);
3403 size
+=size_of_relative_string( &info
->description
);
3405 size
+=size_of_uint32( &info
->port_type
);
3406 size
+=size_of_uint32( &info
->reserved
);
3411 /*******************************************************************
3412 return the size required by a struct in the stream
3413 ********************************************************************/
3415 uint32
spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1
*info
)
3418 size
+=size_of_relative_string( &info
->name
);
3423 /*******************************************************************
3424 return the size required by a struct in the stream
3425 ********************************************************************/
3427 uint32
spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1
*info
)
3430 size
+=size_of_relative_string( &info
->name
);
3435 /*******************************************************************
3436 return the size required by a struct in the stream
3437 ********************************************************************/
3438 uint32
spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES
*p
)
3445 /* uint32(offset) + uint32(length) + length) */
3446 size
+= (size_of_uint32(&p
->value_len
)*2) + p
->value_len
;
3447 size
+= (size_of_uint32(&p
->data_len
)*2) + p
->data_len
+ (p
->data_len
%2) ;
3449 size
+= size_of_uint32(&p
->type
);
3454 /*******************************************************************
3455 return the size required by a struct in the stream
3456 ********************************************************************/
3458 uint32
spoolss_size_printmonitor_info_1(PRINTMONITOR_1
*info
)
3461 size
+=size_of_relative_string( &info
->name
);
3466 /*******************************************************************
3467 return the size required by a struct in the stream
3468 ********************************************************************/
3470 uint32
spoolss_size_printmonitor_info_2(PRINTMONITOR_2
*info
)
3473 size
+=size_of_relative_string( &info
->name
);
3474 size
+=size_of_relative_string( &info
->environment
);
3475 size
+=size_of_relative_string( &info
->dll_name
);
3480 /*******************************************************************
3482 ********************************************************************/
3484 BOOL
make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2
*q_u
,
3485 const POLICY_HND
*hnd
,
3486 const fstring architecture
,
3487 uint32 level
, uint32 clientmajor
, uint32 clientminor
,
3488 RPC_BUFFER
*buffer
, uint32 offered
)
3493 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3495 init_buf_unistr2(&q_u
->architecture
, &q_u
->architecture_ptr
, architecture
);
3498 q_u
->clientmajorversion
=clientmajor
;
3499 q_u
->clientminorversion
=clientminor
;
3502 q_u
->offered
=offered
;
3507 /*******************************************************************
3509 * called from spoolss_getprinterdriver2 (srv_spoolss.c)
3510 ********************************************************************/
3512 BOOL
spoolss_io_q_getprinterdriver2(const char *desc
, SPOOL_Q_GETPRINTERDRIVER2
*q_u
, prs_struct
*ps
, int depth
)
3514 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdriver2");
3520 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3522 if(!prs_uint32("architecture_ptr", ps
, depth
, &q_u
->architecture_ptr
))
3524 if(!smb_io_unistr2("architecture", &q_u
->architecture
, q_u
->architecture_ptr
, ps
, depth
))
3529 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3532 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3538 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3541 if(!prs_uint32("clientmajorversion", ps
, depth
, &q_u
->clientmajorversion
))
3543 if(!prs_uint32("clientminorversion", ps
, depth
, &q_u
->clientminorversion
))
3549 /*******************************************************************
3551 * called from spoolss_getprinterdriver2 (srv_spoolss.c)
3552 ********************************************************************/
3554 BOOL
spoolss_io_r_getprinterdriver2(const char *desc
, SPOOL_R_GETPRINTERDRIVER2
*r_u
, prs_struct
*ps
, int depth
)
3556 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdriver2");
3562 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3567 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3569 if (!prs_uint32("servermajorversion", ps
, depth
, &r_u
->servermajorversion
))
3571 if (!prs_uint32("serverminorversion", ps
, depth
, &r_u
->serverminorversion
))
3573 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3579 /*******************************************************************
3581 ********************************************************************/
3583 BOOL
make_spoolss_q_enumprinters(
3584 SPOOL_Q_ENUMPRINTERS
*q_u
,
3594 q_u
->servername_ptr
= (servername
!= NULL
) ? 1 : 0;
3595 init_buf_unistr2(&q_u
->servername
, &q_u
->servername_ptr
, servername
);
3599 q_u
->offered
=offered
;
3604 /*******************************************************************
3606 ********************************************************************/
3608 BOOL
make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS
*q_u
,
3609 fstring servername
, uint32 level
,
3610 RPC_BUFFER
*buffer
, uint32 offered
)
3612 q_u
->name_ptr
= (servername
!= NULL
) ? 1 : 0;
3613 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, servername
);
3617 q_u
->offered
=offered
;
3622 /*******************************************************************
3624 * called from spoolss_enumprinters (srv_spoolss.c)
3625 ********************************************************************/
3627 BOOL
spoolss_io_q_enumprinters(const char *desc
, SPOOL_Q_ENUMPRINTERS
*q_u
, prs_struct
*ps
, int depth
)
3629 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinters");
3635 if (!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
3637 if (!prs_uint32("servername_ptr", ps
, depth
, &q_u
->servername_ptr
))
3640 if (!smb_io_unistr2("", &q_u
->servername
, q_u
->servername_ptr
, ps
, depth
))
3645 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
3648 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3653 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3659 /*******************************************************************
3660 Parse a SPOOL_R_ENUMPRINTERS structure.
3661 ********************************************************************/
3663 BOOL
spoolss_io_r_enumprinters(const char *desc
, SPOOL_R_ENUMPRINTERS
*r_u
, prs_struct
*ps
, int depth
)
3665 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinters");
3671 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3677 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3680 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
3683 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3689 /*******************************************************************
3690 * write a structure.
3691 * called from spoolss_r_enum_printers (srv_spoolss.c)
3693 ********************************************************************/
3695 BOOL
spoolss_io_r_getprinter(const char *desc
, SPOOL_R_GETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
3697 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinter");
3703 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3709 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3712 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3718 /*******************************************************************
3720 * called from spoolss_getprinter (srv_spoolss.c)
3721 ********************************************************************/
3723 BOOL
spoolss_io_q_getprinter(const char *desc
, SPOOL_Q_GETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
3725 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinter");
3731 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3733 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
3736 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3741 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3747 /*******************************************************************
3749 ********************************************************************/
3751 BOOL
make_spoolss_q_getprinter(
3752 TALLOC_CTX
*mem_ctx
,
3753 SPOOL_Q_GETPRINTER
*q_u
,
3754 const POLICY_HND
*hnd
,
3764 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3768 q_u
->offered
=offered
;
3773 /*******************************************************************
3775 ********************************************************************/
3776 BOOL
make_spoolss_q_setprinter(TALLOC_CTX
*mem_ctx
, SPOOL_Q_SETPRINTER
*q_u
,
3777 const POLICY_HND
*hnd
, uint32 level
, PRINTER_INFO_CTR
*info
,
3781 DEVICEMODE
*devmode
;
3786 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3789 q_u
->info
.level
= level
;
3790 q_u
->info
.info_ptr
= 1; /* Info is != NULL, see above */
3793 /* There's no such thing as a setprinter level 1 */
3796 secdesc
= info
->printers_2
->secdesc
;
3797 devmode
= info
->printers_2
->devmode
;
3799 make_spoolss_printer_info_2 (mem_ctx
, &q_u
->info
.info_2
, info
->printers_2
);
3800 #if 1 /* JERRY TEST */
3801 q_u
->secdesc_ctr
= SMB_MALLOC_P(SEC_DESC_BUF
);
3802 if (!q_u
->secdesc_ctr
)
3804 q_u
->secdesc_ctr
->sd
= secdesc
;
3805 q_u
->secdesc_ctr
->sd_size
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3807 q_u
->devmode_ctr
.devmode_ptr
= (devmode
!= NULL
) ? 1 : 0;
3808 q_u
->devmode_ctr
.size
= (devmode
!= NULL
) ? sizeof(DEVICEMODE
) + (3*sizeof(uint32
)) : 0;
3809 q_u
->devmode_ctr
.devmode
= devmode
;
3811 q_u
->secdesc_ctr
= NULL
;
3813 q_u
->devmode_ctr
.devmode_ptr
= 0;
3814 q_u
->devmode_ctr
.size
= 0;
3815 q_u
->devmode_ctr
.devmode
= NULL
;
3819 secdesc
= info
->printers_3
->secdesc
;
3821 make_spoolss_printer_info_3 (mem_ctx
, &q_u
->info
.info_3
, info
->printers_3
);
3823 q_u
->secdesc_ctr
= SMB_MALLOC_P(SEC_DESC_BUF
);
3824 if (!q_u
->secdesc_ctr
)
3826 q_u
->secdesc_ctr
->sd_size
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3827 q_u
->secdesc_ctr
->sd
= secdesc
;
3831 make_spoolss_printer_info_7 (mem_ctx
, &q_u
->info
.info_7
, info
->printers_7
);
3835 DEBUG(0,("make_spoolss_q_setprinter: Unknown info level [%d]\n", level
));
3840 q_u
->command
= command
;
3846 /*******************************************************************
3847 ********************************************************************/
3849 BOOL
spoolss_io_r_setprinter(const char *desc
, SPOOL_R_SETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
3851 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinter");
3857 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3863 /*******************************************************************
3864 Marshall/unmarshall a SPOOL_Q_SETPRINTER struct.
3865 ********************************************************************/
3867 BOOL
spoolss_io_q_setprinter(const char *desc
, SPOOL_Q_SETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
3869 uint32 ptr_sec_desc
= 0;
3871 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinter");
3877 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
,ps
, depth
))
3879 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3882 /* check for supported levels and structures we know about */
3884 switch ( q_u
->level
) {
3889 /* supported levels */
3892 DEBUG(0,("spoolss_io_q_setprinter: unsupported printer info level [%d]\n",
3898 if(!spool_io_printer_info_level("", &q_u
->info
, ps
, depth
))
3901 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
3911 ptr_sec_desc
= q_u
->info
.info_2
->secdesc_ptr
;
3916 ptr_sec_desc
= q_u
->info
.info_3
->secdesc_ptr
;
3922 if (!sec_io_desc_buf(desc
, &q_u
->secdesc_ctr
, ps
, depth
))
3927 /* Parse a NULL security descriptor. This should really
3928 happen inside the sec_io_desc_buf() function. */
3930 prs_debug(ps
, depth
, "", "sec_io_desc_buf");
3931 if (!prs_uint32("size", ps
, depth
+ 1, &dummy
))
3933 if (!prs_uint32("ptr", ps
, depth
+ 1, &dummy
)) return
3937 if(!prs_uint32("command", ps
, depth
, &q_u
->command
))
3943 /*******************************************************************
3944 ********************************************************************/
3946 BOOL
spoolss_io_r_fcpn(const char *desc
, SPOOL_R_FCPN
*r_u
, prs_struct
*ps
, int depth
)
3948 prs_debug(ps
, depth
, desc
, "spoolss_io_r_fcpn");
3954 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3960 /*******************************************************************
3961 ********************************************************************/
3963 BOOL
spoolss_io_q_fcpn(const char *desc
, SPOOL_Q_FCPN
*q_u
, prs_struct
*ps
, int depth
)
3966 prs_debug(ps
, depth
, desc
, "spoolss_io_q_fcpn");
3972 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
3979 /*******************************************************************
3980 ********************************************************************/
3982 BOOL
spoolss_io_r_addjob(const char *desc
, SPOOL_R_ADDJOB
*r_u
, prs_struct
*ps
, int depth
)
3984 prs_debug(ps
, depth
, desc
, "");
3990 if(!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3996 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3999 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4005 /*******************************************************************
4006 ********************************************************************/
4008 BOOL
spoolss_io_q_addjob(const char *desc
, SPOOL_Q_ADDJOB
*q_u
, prs_struct
*ps
, int depth
)
4010 prs_debug(ps
, depth
, desc
, "");
4016 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
4018 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
4021 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4027 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4033 /*******************************************************************
4034 ********************************************************************/
4036 BOOL
spoolss_io_r_enumjobs(const char *desc
, SPOOL_R_ENUMJOBS
*r_u
, prs_struct
*ps
, int depth
)
4038 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumjobs");
4044 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4050 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4053 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4056 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4062 /*******************************************************************
4063 ********************************************************************/
4065 BOOL
make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS
*q_u
, const POLICY_HND
*hnd
,
4076 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
4077 q_u
->firstjob
= firstjob
;
4078 q_u
->numofjobs
= numofjobs
;
4080 q_u
->buffer
= buffer
;
4081 q_u
->offered
= offered
;
4085 /*******************************************************************
4086 ********************************************************************/
4088 BOOL
spoolss_io_q_enumjobs(const char *desc
, SPOOL_Q_ENUMJOBS
*q_u
, prs_struct
*ps
, int depth
)
4090 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumjobs");
4096 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
, ps
, depth
))
4099 if (!prs_uint32("firstjob", ps
, depth
, &q_u
->firstjob
))
4101 if (!prs_uint32("numofjobs", ps
, depth
, &q_u
->numofjobs
))
4103 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4106 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4112 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4118 /*******************************************************************
4119 ********************************************************************/
4121 BOOL
spoolss_io_r_schedulejob(const char *desc
, SPOOL_R_SCHEDULEJOB
*r_u
, prs_struct
*ps
, int depth
)
4123 prs_debug(ps
, depth
, desc
, "spoolss_io_r_schedulejob");
4129 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4135 /*******************************************************************
4136 ********************************************************************/
4138 BOOL
spoolss_io_q_schedulejob(const char *desc
, SPOOL_Q_SCHEDULEJOB
*q_u
, prs_struct
*ps
, int depth
)
4140 prs_debug(ps
, depth
, desc
, "spoolss_io_q_schedulejob");
4146 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4148 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
4154 /*******************************************************************
4155 ********************************************************************/
4157 BOOL
spoolss_io_r_setjob(const char *desc
, SPOOL_R_SETJOB
*r_u
, prs_struct
*ps
, int depth
)
4159 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setjob");
4165 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4171 /*******************************************************************
4172 ********************************************************************/
4174 BOOL
spoolss_io_q_setjob(const char *desc
, SPOOL_Q_SETJOB
*q_u
, prs_struct
*ps
, int depth
)
4176 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setjob");
4182 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4184 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
4187 * level is usually 0. If (level!=0) then I'm in trouble !
4188 * I will try to generate setjob command with level!=0, one day.
4190 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
4192 if(!prs_uint32("command", ps
, depth
, &q_u
->command
))
4198 /*******************************************************************
4199 Parse a SPOOL_R_ENUMPRINTERDRIVERS structure.
4200 ********************************************************************/
4202 BOOL
spoolss_io_r_enumprinterdrivers(const char *desc
, SPOOL_R_ENUMPRINTERDRIVERS
*r_u
, prs_struct
*ps
, int depth
)
4204 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdrivers");
4210 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4216 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4219 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4222 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4228 /*******************************************************************
4230 ********************************************************************/
4232 BOOL
make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS
*q_u
,
4234 const char *environment
,
4236 RPC_BUFFER
*buffer
, uint32 offered
)
4238 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, name
);
4239 init_buf_unistr2(&q_u
->environment
, &q_u
->environment_ptr
, environment
);
4243 q_u
->offered
=offered
;
4248 /*******************************************************************
4249 Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure.
4250 ********************************************************************/
4252 BOOL
spoolss_io_q_enumprinterdrivers(const char *desc
, SPOOL_Q_ENUMPRINTERDRIVERS
*q_u
, prs_struct
*ps
, int depth
)
4255 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdrivers");
4261 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
4263 if (!smb_io_unistr2("", &q_u
->name
, q_u
->name_ptr
,ps
, depth
))
4268 if (!prs_uint32("environment_ptr", ps
, depth
, &q_u
->environment_ptr
))
4270 if (!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
4275 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4278 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4284 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4290 /*******************************************************************
4291 ********************************************************************/
4293 BOOL
spoolss_io_q_enumforms(const char *desc
, SPOOL_Q_ENUMFORMS
*q_u
, prs_struct
*ps
, int depth
)
4296 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumforms");
4301 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4303 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4306 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4311 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4317 /*******************************************************************
4318 ********************************************************************/
4320 BOOL
spoolss_io_r_enumforms(const char *desc
, SPOOL_R_ENUMFORMS
*r_u
, prs_struct
*ps
, int depth
)
4322 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumforms");
4328 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4334 if (!prs_uint32("size of buffer needed", ps
, depth
, &r_u
->needed
))
4337 if (!prs_uint32("numofforms", ps
, depth
, &r_u
->numofforms
))
4340 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4346 /*******************************************************************
4347 ********************************************************************/
4349 BOOL
spoolss_io_q_getform(const char *desc
, SPOOL_Q_GETFORM
*q_u
, prs_struct
*ps
, int depth
)
4352 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getform");
4357 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4359 if (!smb_io_unistr2("", &q_u
->formname
,True
,ps
,depth
))
4365 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4368 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4373 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4379 /*******************************************************************
4380 ********************************************************************/
4382 BOOL
spoolss_io_r_getform(const char *desc
, SPOOL_R_GETFORM
*r_u
, prs_struct
*ps
, int depth
)
4384 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getform");
4390 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4396 if (!prs_uint32("size of buffer needed", ps
, depth
, &r_u
->needed
))
4399 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4405 /*******************************************************************
4406 Parse a SPOOL_R_ENUMPORTS structure.
4407 ********************************************************************/
4409 BOOL
spoolss_io_r_enumports(const char *desc
, SPOOL_R_ENUMPORTS
*r_u
, prs_struct
*ps
, int depth
)
4411 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumports");
4417 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4423 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4426 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4429 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4435 /*******************************************************************
4436 ********************************************************************/
4438 BOOL
spoolss_io_q_enumports(const char *desc
, SPOOL_Q_ENUMPORTS
*q_u
, prs_struct
*ps
, int depth
)
4440 prs_debug(ps
, depth
, desc
, "");
4446 if (!prs_uint32("", ps
, depth
, &q_u
->name_ptr
))
4448 if (!smb_io_unistr2("", &q_u
->name
,True
,ps
,depth
))
4453 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4456 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4461 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4467 /*******************************************************************
4468 Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure.
4469 ********************************************************************/
4471 BOOL
spool_io_printer_info_level_1(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_1
*il
, prs_struct
*ps
, int depth
)
4473 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_1");
4479 if(!prs_uint32("flags", ps
, depth
, &il
->flags
))
4481 if(!prs_uint32("description_ptr", ps
, depth
, &il
->description_ptr
))
4483 if(!prs_uint32("name_ptr", ps
, depth
, &il
->name_ptr
))
4485 if(!prs_uint32("comment_ptr", ps
, depth
, &il
->comment_ptr
))
4488 if(!smb_io_unistr2("description", &il
->description
, il
->description_ptr
, ps
, depth
))
4490 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4492 if(!smb_io_unistr2("comment", &il
->comment
, il
->comment_ptr
, ps
, depth
))
4498 /*******************************************************************
4499 Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure.
4500 ********************************************************************/
4502 BOOL
spool_io_printer_info_level_3(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_3
*il
, prs_struct
*ps
, int depth
)
4504 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_3");
4510 if(!prs_uint32("secdesc_ptr", ps
, depth
, &il
->secdesc_ptr
))
4516 /*******************************************************************
4517 Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure.
4518 ********************************************************************/
4520 BOOL
spool_io_printer_info_level_2(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_2
*il
, prs_struct
*ps
, int depth
)
4522 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_2");
4528 if(!prs_uint32("servername_ptr", ps
, depth
, &il
->servername_ptr
))
4530 if(!prs_uint32("printername_ptr", ps
, depth
, &il
->printername_ptr
))
4532 if(!prs_uint32("sharename_ptr", ps
, depth
, &il
->sharename_ptr
))
4534 if(!prs_uint32("portname_ptr", ps
, depth
, &il
->portname_ptr
))
4537 if(!prs_uint32("drivername_ptr", ps
, depth
, &il
->drivername_ptr
))
4539 if(!prs_uint32("comment_ptr", ps
, depth
, &il
->comment_ptr
))
4541 if(!prs_uint32("location_ptr", ps
, depth
, &il
->location_ptr
))
4543 if(!prs_uint32("devmode_ptr", ps
, depth
, &il
->devmode_ptr
))
4545 if(!prs_uint32("sepfile_ptr", ps
, depth
, &il
->sepfile_ptr
))
4547 if(!prs_uint32("printprocessor_ptr", ps
, depth
, &il
->printprocessor_ptr
))
4549 if(!prs_uint32("datatype_ptr", ps
, depth
, &il
->datatype_ptr
))
4551 if(!prs_uint32("parameters_ptr", ps
, depth
, &il
->parameters_ptr
))
4553 if(!prs_uint32("secdesc_ptr", ps
, depth
, &il
->secdesc_ptr
))
4556 if(!prs_uint32("attributes", ps
, depth
, &il
->attributes
))
4558 if(!prs_uint32("priority", ps
, depth
, &il
->priority
))
4560 if(!prs_uint32("default_priority", ps
, depth
, &il
->default_priority
))
4562 if(!prs_uint32("starttime", ps
, depth
, &il
->starttime
))
4564 if(!prs_uint32("untiltime", ps
, depth
, &il
->untiltime
))
4566 if(!prs_uint32("status", ps
, depth
, &il
->status
))
4568 if(!prs_uint32("cjobs", ps
, depth
, &il
->cjobs
))
4570 if(!prs_uint32("averageppm", ps
, depth
, &il
->averageppm
))
4573 if(!smb_io_unistr2("servername", &il
->servername
, il
->servername_ptr
, ps
, depth
))
4575 if(!smb_io_unistr2("printername", &il
->printername
, il
->printername_ptr
, ps
, depth
))
4577 if(!smb_io_unistr2("sharename", &il
->sharename
, il
->sharename_ptr
, ps
, depth
))
4579 if(!smb_io_unistr2("portname", &il
->portname
, il
->portname_ptr
, ps
, depth
))
4581 if(!smb_io_unistr2("drivername", &il
->drivername
, il
->drivername_ptr
, ps
, depth
))
4583 if(!smb_io_unistr2("comment", &il
->comment
, il
->comment_ptr
, ps
, depth
))
4585 if(!smb_io_unistr2("location", &il
->location
, il
->location_ptr
, ps
, depth
))
4587 if(!smb_io_unistr2("sepfile", &il
->sepfile
, il
->sepfile_ptr
, ps
, depth
))
4589 if(!smb_io_unistr2("printprocessor", &il
->printprocessor
, il
->printprocessor_ptr
, ps
, depth
))
4591 if(!smb_io_unistr2("datatype", &il
->datatype
, il
->datatype_ptr
, ps
, depth
))
4593 if(!smb_io_unistr2("parameters", &il
->parameters
, il
->parameters_ptr
, ps
, depth
))
4599 BOOL
spool_io_printer_info_level_7(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_7
*il
, prs_struct
*ps
, int depth
)
4601 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_7");
4607 if(!prs_uint32("guid_ptr", ps
, depth
, &il
->guid_ptr
))
4609 if(!prs_uint32("action", ps
, depth
, &il
->action
))
4612 if(!smb_io_unistr2("servername", &il
->guid
, il
->guid_ptr
, ps
, depth
))
4617 /*******************************************************************
4618 ********************************************************************/
4620 BOOL
spool_io_printer_info_level(const char *desc
, SPOOL_PRINTER_INFO_LEVEL
*il
, prs_struct
*ps
, int depth
)
4622 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level");
4627 if(!prs_uint32("level", ps
, depth
, &il
->level
))
4629 if(!prs_uint32("info_ptr", ps
, depth
, &il
->info_ptr
))
4632 /* if no struct inside just return */
4633 if (il
->info_ptr
==0) {
4634 if (UNMARSHALLING(ps
)) {
4641 switch (il
->level
) {
4643 * level 0 is used by setprinter when managing the queue
4644 * (hold, stop, start a queue)
4648 /* DOCUMENT ME!!! What is level 1 used for? */
4651 if (UNMARSHALLING(ps
)) {
4652 if ((il
->info_1
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_1
,1)) == NULL
)
4655 if (!spool_io_printer_info_level_1("", il
->info_1
, ps
, depth
))
4660 * level 2 is used by addprinter
4661 * and by setprinter when updating printer's info
4664 if (UNMARSHALLING(ps
)) {
4665 if ((il
->info_2
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_2
,1)) == NULL
)
4668 if (!spool_io_printer_info_level_2("", il
->info_2
, ps
, depth
))
4671 /* DOCUMENT ME!!! What is level 3 used for? */
4674 if (UNMARSHALLING(ps
)) {
4675 if ((il
->info_3
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_3
,1)) == NULL
)
4678 if (!spool_io_printer_info_level_3("", il
->info_3
, ps
, depth
))
4683 if (UNMARSHALLING(ps
))
4684 if ((il
->info_7
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_7
,1)) == NULL
)
4686 if (!spool_io_printer_info_level_7("", il
->info_7
, ps
, depth
))
4694 /*******************************************************************
4695 ********************************************************************/
4697 BOOL
spoolss_io_q_addprinterex(const char *desc
, SPOOL_Q_ADDPRINTEREX
*q_u
, prs_struct
*ps
, int depth
)
4699 uint32 ptr_sec_desc
= 0;
4701 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterex");
4707 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->server_name
))
4709 if (!prs_io_unistr2("servername", ps
, depth
, q_u
->server_name
))
4715 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
4718 if(!spool_io_printer_info_level("", &q_u
->info
, ps
, depth
))
4721 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
4727 switch (q_u
->level
) {
4729 ptr_sec_desc
= q_u
->info
.info_2
->secdesc_ptr
;
4732 ptr_sec_desc
= q_u
->info
.info_3
->secdesc_ptr
;
4736 if (!sec_io_desc_buf(desc
, &q_u
->secdesc_ctr
, ps
, depth
))
4741 /* Parse a NULL security descriptor. This should really
4742 happen inside the sec_io_desc_buf() function. */
4744 prs_debug(ps
, depth
, "", "sec_io_desc_buf");
4745 if (!prs_uint32("size", ps
, depth
+ 1, &dummy
))
4747 if (!prs_uint32("ptr", ps
, depth
+ 1, &dummy
))
4751 if(!prs_uint32("user_switch", ps
, depth
, &q_u
->user_switch
))
4753 if(!spool_io_user_level("", &q_u
->user_ctr
, ps
, depth
))
4759 /*******************************************************************
4760 ********************************************************************/
4762 BOOL
spoolss_io_r_addprinterex(const char *desc
, SPOOL_R_ADDPRINTEREX
*r_u
,
4763 prs_struct
*ps
, int depth
)
4765 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterex");
4768 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
4771 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4777 /*******************************************************************
4778 ********************************************************************/
4780 BOOL
spool_io_printer_driver_info_level_3(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
**q_u
,
4781 prs_struct
*ps
, int depth
)
4783 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*il
;
4785 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level_3");
4789 if (UNMARSHALLING(ps
)) {
4790 il
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
,1);
4802 if(!prs_uint32("cversion", ps
, depth
, &il
->cversion
))
4804 if(!prs_uint32("name", ps
, depth
, &il
->name_ptr
))
4806 if(!prs_uint32("environment", ps
, depth
, &il
->environment_ptr
))
4808 if(!prs_uint32("driverpath", ps
, depth
, &il
->driverpath_ptr
))
4810 if(!prs_uint32("datafile", ps
, depth
, &il
->datafile_ptr
))
4812 if(!prs_uint32("configfile", ps
, depth
, &il
->configfile_ptr
))
4814 if(!prs_uint32("helpfile", ps
, depth
, &il
->helpfile_ptr
))
4816 if(!prs_uint32("monitorname", ps
, depth
, &il
->monitorname_ptr
))
4818 if(!prs_uint32("defaultdatatype", ps
, depth
, &il
->defaultdatatype_ptr
))
4820 if(!prs_uint32("dependentfilessize", ps
, depth
, &il
->dependentfilessize
))
4822 if(!prs_uint32("dependentfiles", ps
, depth
, &il
->dependentfiles_ptr
))
4828 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4830 if(!smb_io_unistr2("environment", &il
->environment
, il
->environment_ptr
, ps
, depth
))
4832 if(!smb_io_unistr2("driverpath", &il
->driverpath
, il
->driverpath_ptr
, ps
, depth
))
4834 if(!smb_io_unistr2("datafile", &il
->datafile
, il
->datafile_ptr
, ps
, depth
))
4836 if(!smb_io_unistr2("configfile", &il
->configfile
, il
->configfile_ptr
, ps
, depth
))
4838 if(!smb_io_unistr2("helpfile", &il
->helpfile
, il
->helpfile_ptr
, ps
, depth
))
4840 if(!smb_io_unistr2("monitorname", &il
->monitorname
, il
->monitorname_ptr
, ps
, depth
))
4842 if(!smb_io_unistr2("defaultdatatype", &il
->defaultdatatype
, il
->defaultdatatype_ptr
, ps
, depth
))
4848 if (il
->dependentfiles_ptr
)
4849 smb_io_buffer5("", &il
->dependentfiles
, ps
, depth
);
4854 /*******************************************************************
4855 parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure
4856 ********************************************************************/
4858 BOOL
spool_io_printer_driver_info_level_6(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
**q_u
,
4859 prs_struct
*ps
, int depth
)
4861 SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
*il
;
4863 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level_6");
4867 if (UNMARSHALLING(ps
)) {
4868 il
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
,1);
4881 * I know this seems weird, but I have no other explanation.
4882 * This is observed behavior on both NT4 and 2K servers.
4886 if (!prs_align_uint64(ps
))
4889 /* parse the main elements the packet */
4891 if(!prs_uint32("cversion ", ps
, depth
, &il
->version
))
4893 if(!prs_uint32("name ", ps
, depth
, &il
->name_ptr
))
4895 if(!prs_uint32("environment ", ps
, depth
, &il
->environment_ptr
))
4897 if(!prs_uint32("driverpath ", ps
, depth
, &il
->driverpath_ptr
))
4899 if(!prs_uint32("datafile ", ps
, depth
, &il
->datafile_ptr
))
4901 if(!prs_uint32("configfile ", ps
, depth
, &il
->configfile_ptr
))
4903 if(!prs_uint32("helpfile ", ps
, depth
, &il
->helpfile_ptr
))
4905 if(!prs_uint32("monitorname ", ps
, depth
, &il
->monitorname_ptr
))
4907 if(!prs_uint32("defaultdatatype", ps
, depth
, &il
->defaultdatatype_ptr
))
4909 if(!prs_uint32("dependentfiles ", ps
, depth
, &il
->dependentfiles_len
))
4911 if(!prs_uint32("dependentfiles ", ps
, depth
, &il
->dependentfiles_ptr
))
4913 if(!prs_uint32("previousnames ", ps
, depth
, &il
->previousnames_len
))
4915 if(!prs_uint32("previousnames ", ps
, depth
, &il
->previousnames_ptr
))
4917 if(!smb_io_time("driverdate ", &il
->driverdate
, ps
, depth
))
4919 if(!prs_uint32("dummy4 ", ps
, depth
, &il
->dummy4
))
4921 if(!prs_uint64("driverversion ", ps
, depth
, &il
->driverversion
))
4923 if(!prs_uint32("mfgname ", ps
, depth
, &il
->mfgname_ptr
))
4925 if(!prs_uint32("oemurl ", ps
, depth
, &il
->oemurl_ptr
))
4927 if(!prs_uint32("hardwareid ", ps
, depth
, &il
->hardwareid_ptr
))
4929 if(!prs_uint32("provider ", ps
, depth
, &il
->provider_ptr
))
4932 /* parse the structures in the packet */
4934 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4939 if(!smb_io_unistr2("environment", &il
->environment
, il
->environment_ptr
, ps
, depth
))
4944 if(!smb_io_unistr2("driverpath", &il
->driverpath
, il
->driverpath_ptr
, ps
, depth
))
4949 if(!smb_io_unistr2("datafile", &il
->datafile
, il
->datafile_ptr
, ps
, depth
))
4954 if(!smb_io_unistr2("configfile", &il
->configfile
, il
->configfile_ptr
, ps
, depth
))
4959 if(!smb_io_unistr2("helpfile", &il
->helpfile
, il
->helpfile_ptr
, ps
, depth
))
4964 if(!smb_io_unistr2("monitorname", &il
->monitorname
, il
->monitorname_ptr
, ps
, depth
))
4969 if(!smb_io_unistr2("defaultdatatype", &il
->defaultdatatype
, il
->defaultdatatype_ptr
, ps
, depth
))
4973 if (il
->dependentfiles_ptr
) {
4974 if(!smb_io_buffer5("dependentfiles", &il
->dependentfiles
, ps
, depth
))
4979 if (il
->previousnames_ptr
) {
4980 if(!smb_io_buffer5("previousnames", &il
->previousnames
, ps
, depth
))
4985 if(!smb_io_unistr2("mfgname", &il
->mfgname
, il
->mfgname_ptr
, ps
, depth
))
4989 if(!smb_io_unistr2("oemurl", &il
->oemurl
, il
->oemurl_ptr
, ps
, depth
))
4993 if(!smb_io_unistr2("hardwareid", &il
->hardwareid
, il
->hardwareid_ptr
, ps
, depth
))
4997 if(!smb_io_unistr2("provider", &il
->provider
, il
->provider_ptr
, ps
, depth
))
5003 /*******************************************************************
5004 convert a buffer of UNICODE strings null terminated
5005 the buffer is terminated by a NULL
5007 convert to an dos codepage array (null terminated)
5009 dynamically allocate memory
5011 ********************************************************************/
5013 static BOOL
uniarray_2_dosarray(BUFFER5
*buf5
, fstring
**ar
)
5022 src
= (char *)buf5
->buffer
;
5023 *ar
= SMB_MALLOC_ARRAY(fstring
, 1);
5028 while (src
< ((char *)buf5
->buffer
) + buf5
->buf_len
*2) {
5029 rpcstr_pull(f
, src
, sizeof(f
)-1, -1, STR_TERMINATE
);
5030 src
= skip_unibuf(src
, 2*buf5
->buf_len
- PTR_DIFF(src
,buf5
->buffer
));
5031 *ar
= SMB_REALLOC_ARRAY(*ar
, fstring
, n
+2);
5035 fstrcpy((*ar
)[n
], f
);
5039 fstrcpy((*ar
)[n
], "");
5044 /*******************************************************************
5045 read a UNICODE array with null terminated strings
5046 and null terminated array
5047 and size of array at beginning
5048 ********************************************************************/
5050 BOOL
smb_io_unibuffer(const char *desc
, UNISTR2
*buffer
, prs_struct
*ps
, int depth
)
5052 if (buffer
==NULL
) return False
;
5055 buffer
->uni_str_len
=buffer
->uni_max_len
;
5057 if(!prs_uint32("buffer_size", ps
, depth
, &buffer
->uni_max_len
))
5060 if(!prs_unistr2(True
, "buffer ", ps
, depth
, buffer
))
5066 /*******************************************************************
5067 ********************************************************************/
5069 BOOL
spool_io_printer_driver_info_level(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL
*il
, prs_struct
*ps
, int depth
)
5071 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level");
5076 if(!prs_uint32("level", ps
, depth
, &il
->level
))
5078 if(!prs_uint32("ptr", ps
, depth
, &il
->ptr
))
5084 switch (il
->level
) {
5086 if(!spool_io_printer_driver_info_level_3("", &il
->info_3
, ps
, depth
))
5090 if(!spool_io_printer_driver_info_level_6("", &il
->info_6
, ps
, depth
))
5100 /*******************************************************************
5101 init a SPOOL_Q_ADDPRINTERDRIVER struct
5102 ******************************************************************/
5104 BOOL
make_spoolss_q_addprinterdriver(TALLOC_CTX
*mem_ctx
,
5105 SPOOL_Q_ADDPRINTERDRIVER
*q_u
, const char* srv_name
,
5106 uint32 level
, PRINTER_DRIVER_CTR
*info
)
5108 DEBUG(5,("make_spoolss_q_addprinterdriver\n"));
5110 if (!srv_name
|| !info
) {
5114 q_u
->server_name_ptr
= 1; /* srv_name is != NULL, see above */
5115 init_unistr2(&q_u
->server_name
, srv_name
, UNI_STR_TERMINATE
);
5119 q_u
->info
.level
= level
;
5120 q_u
->info
.ptr
= 1; /* Info is != NULL, see above */
5123 /* info level 3 is supported by Windows 95/98, WinNT and Win2k */
5125 make_spoolss_driver_info_3(mem_ctx
, &q_u
->info
.info_3
, info
->info3
);
5129 DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level
));
5136 BOOL
make_spoolss_driver_info_3(TALLOC_CTX
*mem_ctx
,
5137 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
**spool_drv_info
,
5138 DRIVER_INFO_3
*info3
)
5141 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*inf
;
5143 if (!(inf
=TALLOC_ZERO_P(mem_ctx
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
)))
5146 inf
->cversion
= info3
->version
;
5147 inf
->name_ptr
= (info3
->name
.buffer
!=NULL
)?1:0;
5148 inf
->environment_ptr
= (info3
->architecture
.buffer
!=NULL
)?1:0;
5149 inf
->driverpath_ptr
= (info3
->driverpath
.buffer
!=NULL
)?1:0;
5150 inf
->datafile_ptr
= (info3
->datafile
.buffer
!=NULL
)?1:0;
5151 inf
->configfile_ptr
= (info3
->configfile
.buffer
!=NULL
)?1:0;
5152 inf
->helpfile_ptr
= (info3
->helpfile
.buffer
!=NULL
)?1:0;
5153 inf
->monitorname_ptr
= (info3
->monitorname
.buffer
!=NULL
)?1:0;
5154 inf
->defaultdatatype_ptr
= (info3
->defaultdatatype
.buffer
!=NULL
)?1:0;
5156 init_unistr2_from_unistr(&inf
->name
, &info3
->name
);
5157 init_unistr2_from_unistr(&inf
->environment
, &info3
->architecture
);
5158 init_unistr2_from_unistr(&inf
->driverpath
, &info3
->driverpath
);
5159 init_unistr2_from_unistr(&inf
->datafile
, &info3
->datafile
);
5160 init_unistr2_from_unistr(&inf
->configfile
, &info3
->configfile
);
5161 init_unistr2_from_unistr(&inf
->helpfile
, &info3
->helpfile
);
5162 init_unistr2_from_unistr(&inf
->monitorname
, &info3
->monitorname
);
5163 init_unistr2_from_unistr(&inf
->defaultdatatype
, &info3
->defaultdatatype
);
5165 if (info3
->dependentfiles
) {
5167 BOOL null_char
= False
;
5168 uint16
*ptr
= info3
->dependentfiles
;
5173 /* the null_char BOOL is used to help locate
5174 two '\0's back to back */
5191 inf
->dependentfiles_ptr
= (info3
->dependentfiles
!= NULL
) ? 1 : 0;
5192 inf
->dependentfilessize
= (info3
->dependentfiles
!= NULL
) ? len
: 0;
5193 if(!make_spoolss_buffer5(mem_ctx
, &inf
->dependentfiles
, len
, info3
->dependentfiles
)) {
5198 *spool_drv_info
= inf
;
5203 /*******************************************************************
5204 make a BUFFER5 struct from a uint16*
5205 ******************************************************************/
5207 BOOL
make_spoolss_buffer5(TALLOC_CTX
*mem_ctx
, BUFFER5
*buf5
, uint32 len
, uint16
*src
)
5210 buf5
->buf_len
= len
;
5212 if((buf5
->buffer
=(uint16
*)TALLOC_MEMDUP(mem_ctx
, src
, sizeof(uint16
)*len
)) == NULL
) {
5213 DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n"));
5223 /*******************************************************************
5224 fill in the prs_struct for a ADDPRINTERDRIVER request PDU
5225 ********************************************************************/
5227 BOOL
spoolss_io_q_addprinterdriver(const char *desc
, SPOOL_Q_ADDPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
5229 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterdriver");
5235 if(!prs_uint32("server_name_ptr", ps
, depth
, &q_u
->server_name_ptr
))
5237 if(!smb_io_unistr2("server_name", &q_u
->server_name
, q_u
->server_name_ptr
, ps
, depth
))
5242 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
5245 if(!spool_io_printer_driver_info_level("", &q_u
->info
, ps
, depth
))
5251 /*******************************************************************
5252 ********************************************************************/
5254 BOOL
spoolss_io_r_addprinterdriver(const char *desc
, SPOOL_R_ADDPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
5256 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterdriver");
5259 if(!prs_werror("status", ps
, depth
, &q_u
->status
))
5265 /*******************************************************************
5266 fill in the prs_struct for a ADDPRINTERDRIVER request PDU
5267 ********************************************************************/
5269 BOOL
spoolss_io_q_addprinterdriverex(const char *desc
, SPOOL_Q_ADDPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
5271 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterdriverex");
5277 if(!prs_uint32("server_name_ptr", ps
, depth
, &q_u
->server_name_ptr
))
5279 if(!smb_io_unistr2("server_name", &q_u
->server_name
, q_u
->server_name_ptr
, ps
, depth
))
5284 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
5287 if(!spool_io_printer_driver_info_level("", &q_u
->info
, ps
, depth
))
5292 if(!prs_uint32("copy flags", ps
, depth
, &q_u
->copy_flags
))
5298 /*******************************************************************
5299 ********************************************************************/
5301 BOOL
spoolss_io_r_addprinterdriverex(const char *desc
, SPOOL_R_ADDPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
5303 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterdriverex");
5306 if(!prs_werror("status", ps
, depth
, &q_u
->status
))
5312 /*******************************************************************
5313 ********************************************************************/
5315 BOOL
uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*uni
,
5316 NT_PRINTER_DRIVER_INFO_LEVEL_3
**asc
)
5318 NT_PRINTER_DRIVER_INFO_LEVEL_3
*d
;
5320 DEBUG(7,("uni_2_asc_printer_driver_3: Converting from UNICODE to ASCII\n"));
5324 *asc
=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_3
);
5332 d
->cversion
=uni
->cversion
;
5334 unistr2_to_ascii(d
->name
, &uni
->name
, sizeof(d
->name
)-1);
5335 unistr2_to_ascii(d
->environment
, &uni
->environment
, sizeof(d
->environment
)-1);
5336 unistr2_to_ascii(d
->driverpath
, &uni
->driverpath
, sizeof(d
->driverpath
)-1);
5337 unistr2_to_ascii(d
->datafile
, &uni
->datafile
, sizeof(d
->datafile
)-1);
5338 unistr2_to_ascii(d
->configfile
, &uni
->configfile
, sizeof(d
->configfile
)-1);
5339 unistr2_to_ascii(d
->helpfile
, &uni
->helpfile
, sizeof(d
->helpfile
)-1);
5340 unistr2_to_ascii(d
->monitorname
, &uni
->monitorname
, sizeof(d
->monitorname
)-1);
5341 unistr2_to_ascii(d
->defaultdatatype
, &uni
->defaultdatatype
, sizeof(d
->defaultdatatype
)-1);
5343 DEBUGADD(8,( "version: %d\n", d
->cversion
));
5344 DEBUGADD(8,( "name: %s\n", d
->name
));
5345 DEBUGADD(8,( "environment: %s\n", d
->environment
));
5346 DEBUGADD(8,( "driverpath: %s\n", d
->driverpath
));
5347 DEBUGADD(8,( "datafile: %s\n", d
->datafile
));
5348 DEBUGADD(8,( "configfile: %s\n", d
->configfile
));
5349 DEBUGADD(8,( "helpfile: %s\n", d
->helpfile
));
5350 DEBUGADD(8,( "monitorname: %s\n", d
->monitorname
));
5351 DEBUGADD(8,( "defaultdatatype: %s\n", d
->defaultdatatype
));
5353 if (uniarray_2_dosarray(&uni
->dependentfiles
, &d
->dependentfiles
))
5360 /*******************************************************************
5361 ********************************************************************/
5362 BOOL
uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
*uni
,
5363 NT_PRINTER_DRIVER_INFO_LEVEL_6
**asc
)
5365 NT_PRINTER_DRIVER_INFO_LEVEL_6
*d
;
5367 DEBUG(7,("uni_2_asc_printer_driver_6: Converting from UNICODE to ASCII\n"));
5371 *asc
=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_6
);
5379 d
->version
=uni
->version
;
5381 unistr2_to_ascii(d
->name
, &uni
->name
, sizeof(d
->name
)-1);
5382 unistr2_to_ascii(d
->environment
, &uni
->environment
, sizeof(d
->environment
)-1);
5383 unistr2_to_ascii(d
->driverpath
, &uni
->driverpath
, sizeof(d
->driverpath
)-1);
5384 unistr2_to_ascii(d
->datafile
, &uni
->datafile
, sizeof(d
->datafile
)-1);
5385 unistr2_to_ascii(d
->configfile
, &uni
->configfile
, sizeof(d
->configfile
)-1);
5386 unistr2_to_ascii(d
->helpfile
, &uni
->helpfile
, sizeof(d
->helpfile
)-1);
5387 unistr2_to_ascii(d
->monitorname
, &uni
->monitorname
, sizeof(d
->monitorname
)-1);
5388 unistr2_to_ascii(d
->defaultdatatype
, &uni
->defaultdatatype
, sizeof(d
->defaultdatatype
)-1);
5390 DEBUGADD(8,( "version: %d\n", d
->version
));
5391 DEBUGADD(8,( "name: %s\n", d
->name
));
5392 DEBUGADD(8,( "environment: %s\n", d
->environment
));
5393 DEBUGADD(8,( "driverpath: %s\n", d
->driverpath
));
5394 DEBUGADD(8,( "datafile: %s\n", d
->datafile
));
5395 DEBUGADD(8,( "configfile: %s\n", d
->configfile
));
5396 DEBUGADD(8,( "helpfile: %s\n", d
->helpfile
));
5397 DEBUGADD(8,( "monitorname: %s\n", d
->monitorname
));
5398 DEBUGADD(8,( "defaultdatatype: %s\n", d
->defaultdatatype
));
5400 if (!uniarray_2_dosarray(&uni
->dependentfiles
, &d
->dependentfiles
))
5402 if (!uniarray_2_dosarray(&uni
->previousnames
, &d
->previousnames
))
5412 BOOL
uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2
*uni
,
5413 NT_PRINTER_INFO_LEVEL_2
*d
)
5415 DEBUG(7,("Converting from UNICODE to ASCII\n"));
5417 d
->attributes
=uni
->attributes
;
5418 d
->priority
=uni
->priority
;
5419 d
->default_priority
=uni
->default_priority
;
5420 d
->starttime
=uni
->starttime
;
5421 d
->untiltime
=uni
->untiltime
;
5422 d
->status
=uni
->status
;
5423 d
->cjobs
=uni
->cjobs
;
5425 unistr2_to_ascii(d
->servername
, &uni
->servername
, sizeof(d
->servername
)-1);
5426 unistr2_to_ascii(d
->printername
, &uni
->printername
, sizeof(d
->printername
)-1);
5427 unistr2_to_ascii(d
->sharename
, &uni
->sharename
, sizeof(d
->sharename
)-1);
5428 unistr2_to_ascii(d
->portname
, &uni
->portname
, sizeof(d
->portname
)-1);
5429 unistr2_to_ascii(d
->drivername
, &uni
->drivername
, sizeof(d
->drivername
)-1);
5430 unistr2_to_ascii(d
->comment
, &uni
->comment
, sizeof(d
->comment
)-1);
5431 unistr2_to_ascii(d
->location
, &uni
->location
, sizeof(d
->location
)-1);
5432 unistr2_to_ascii(d
->sepfile
, &uni
->sepfile
, sizeof(d
->sepfile
)-1);
5433 unistr2_to_ascii(d
->printprocessor
, &uni
->printprocessor
, sizeof(d
->printprocessor
)-1);
5434 unistr2_to_ascii(d
->datatype
, &uni
->datatype
, sizeof(d
->datatype
)-1);
5435 unistr2_to_ascii(d
->parameters
, &uni
->parameters
, sizeof(d
->parameters
)-1);
5440 /*******************************************************************
5442 ********************************************************************/
5444 BOOL
make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR
*q_u
,
5445 fstring servername
, fstring env_name
, uint32 level
,
5446 RPC_BUFFER
*buffer
, uint32 offered
)
5448 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, servername
);
5449 init_buf_unistr2(&q_u
->environment
, &q_u
->environment_ptr
, env_name
);
5453 q_u
->offered
=offered
;
5458 /*******************************************************************
5459 Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure.
5460 ********************************************************************/
5462 BOOL
spoolss_io_q_getprinterdriverdir(const char *desc
, SPOOL_Q_GETPRINTERDRIVERDIR
*q_u
, prs_struct
*ps
, int depth
)
5464 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdriverdir");
5469 if(!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5471 if(!smb_io_unistr2("", &q_u
->name
, q_u
->name_ptr
, ps
, depth
))
5477 if(!prs_uint32("", ps
, depth
, &q_u
->environment_ptr
))
5479 if(!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
5485 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
5488 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5494 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5500 /*******************************************************************
5501 Parse a SPOOL_R_GETPRINTERDRIVERDIR structure.
5502 ********************************************************************/
5504 BOOL
spoolss_io_r_getprinterdriverdir(const char *desc
, SPOOL_R_GETPRINTERDRIVERDIR
*r_u
, prs_struct
*ps
, int depth
)
5506 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdriverdir");
5512 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5518 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5521 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5527 /*******************************************************************
5528 ********************************************************************/
5530 BOOL
spoolss_io_r_enumprintprocessors(const char *desc
, SPOOL_R_ENUMPRINTPROCESSORS
*r_u
, prs_struct
*ps
, int depth
)
5532 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintprocessors");
5538 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5544 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5547 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5550 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5556 /*******************************************************************
5557 ********************************************************************/
5559 BOOL
spoolss_io_q_enumprintprocessors(const char *desc
, SPOOL_Q_ENUMPRINTPROCESSORS
*q_u
, prs_struct
*ps
, int depth
)
5561 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintprocessors");
5567 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5569 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5575 if (!prs_uint32("", ps
, depth
, &q_u
->environment_ptr
))
5577 if (!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
5583 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5586 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5592 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5598 /*******************************************************************
5599 ********************************************************************/
5601 BOOL
spoolss_io_q_addprintprocessor(const char *desc
, SPOOL_Q_ADDPRINTPROCESSOR
*q_u
, prs_struct
*ps
, int depth
)
5603 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprintprocessor");
5609 if (!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
5611 if (!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
5616 if (!smb_io_unistr2("environment", &q_u
->environment
, True
, ps
, depth
))
5621 if (!smb_io_unistr2("path", &q_u
->path
, True
, ps
, depth
))
5626 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5632 /*******************************************************************
5633 ********************************************************************/
5635 BOOL
spoolss_io_r_addprintprocessor(const char *desc
, SPOOL_R_ADDPRINTPROCESSOR
*r_u
, prs_struct
*ps
, int depth
)
5637 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprintproicessor");
5643 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5649 /*******************************************************************
5650 ********************************************************************/
5652 BOOL
spoolss_io_r_enumprintprocdatatypes(const char *desc
, SPOOL_R_ENUMPRINTPROCDATATYPES
*r_u
, prs_struct
*ps
, int depth
)
5654 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintprocdatatypes");
5660 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5666 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5669 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5672 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5678 /*******************************************************************
5679 ********************************************************************/
5681 BOOL
spoolss_io_q_enumprintprocdatatypes(const char *desc
, SPOOL_Q_ENUMPRINTPROCDATATYPES
*q_u
, prs_struct
*ps
, int depth
)
5683 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintprocdatatypes");
5689 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5691 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5697 if (!prs_uint32("processor_ptr", ps
, depth
, &q_u
->processor_ptr
))
5699 if (!smb_io_unistr2("processor", &q_u
->processor
, q_u
->processor_ptr
, ps
, depth
))
5705 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5708 if(!prs_rpcbuffer_p("buffer", ps
, depth
, &q_u
->buffer
))
5714 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5720 /*******************************************************************
5721 Parse a SPOOL_Q_ENUMPRINTMONITORS structure.
5722 ********************************************************************/
5724 BOOL
spoolss_io_q_enumprintmonitors(const char *desc
, SPOOL_Q_ENUMPRINTMONITORS
*q_u
, prs_struct
*ps
, int depth
)
5726 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintmonitors");
5732 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5734 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5740 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5743 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5749 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5755 /*******************************************************************
5756 ********************************************************************/
5758 BOOL
spoolss_io_r_enumprintmonitors(const char *desc
, SPOOL_R_ENUMPRINTMONITORS
*r_u
, prs_struct
*ps
, int depth
)
5760 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintmonitors");
5766 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5772 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5775 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5778 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5784 /*******************************************************************
5785 ********************************************************************/
5787 BOOL
spoolss_io_r_enumprinterdata(const char *desc
, SPOOL_R_ENUMPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
5789 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdata");
5794 if(!prs_uint32("valuesize", ps
, depth
, &r_u
->valuesize
))
5797 if (UNMARSHALLING(ps
) && r_u
->valuesize
) {
5798 r_u
->value
= PRS_ALLOC_MEM(ps
, uint16
, r_u
->valuesize
);
5800 DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata value\n"));
5805 if(!prs_uint16uni(False
, "value", ps
, depth
, r_u
->value
, r_u
->valuesize
))
5811 if(!prs_uint32("realvaluesize", ps
, depth
, &r_u
->realvaluesize
))
5814 if(!prs_uint32("type", ps
, depth
, &r_u
->type
))
5817 if(!prs_uint32("datasize", ps
, depth
, &r_u
->datasize
))
5820 if (UNMARSHALLING(ps
) && r_u
->datasize
) {
5821 r_u
->data
= PRS_ALLOC_MEM(ps
, uint8
, r_u
->datasize
);
5823 DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata data\n"));
5828 if(!prs_uint8s(False
, "data", ps
, depth
, r_u
->data
, r_u
->datasize
))
5833 if(!prs_uint32("realdatasize", ps
, depth
, &r_u
->realdatasize
))
5835 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5841 /*******************************************************************
5842 ********************************************************************/
5844 BOOL
spoolss_io_q_enumprinterdata(const char *desc
, SPOOL_Q_ENUMPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
5846 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdata");
5851 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
5853 if(!prs_uint32("index", ps
, depth
, &q_u
->index
))
5855 if(!prs_uint32("valuesize", ps
, depth
, &q_u
->valuesize
))
5857 if(!prs_uint32("datasize", ps
, depth
, &q_u
->datasize
))
5863 /*******************************************************************
5864 ********************************************************************/
5866 BOOL
make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA
*q_u
,
5867 const POLICY_HND
*hnd
,
5868 uint32 idx
, uint32 valuelen
, uint32 datalen
)
5870 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5872 q_u
->valuesize
=valuelen
;
5873 q_u
->datasize
=datalen
;
5878 /*******************************************************************
5879 ********************************************************************/
5881 BOOL
make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX
*q_u
,
5882 const POLICY_HND
*hnd
, const char *key
,
5885 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5886 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
5892 /*******************************************************************
5893 ********************************************************************/
5894 BOOL
make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA
*q_u
, const POLICY_HND
*hnd
,
5895 char* value
, uint32 data_type
, char* data
, uint32 data_size
)
5897 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5898 q_u
->type
= data_type
;
5899 init_unistr2(&q_u
->value
, value
, UNI_STR_TERMINATE
);
5901 q_u
->max_len
= q_u
->real_len
= data_size
;
5902 q_u
->data
= (unsigned char *)data
;
5907 /*******************************************************************
5908 ********************************************************************/
5909 BOOL
make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX
*q_u
, const POLICY_HND
*hnd
,
5910 char *key
, char* value
, uint32 data_type
, char* data
,
5913 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5914 q_u
->type
= data_type
;
5915 init_unistr2(&q_u
->value
, value
, UNI_STR_TERMINATE
);
5916 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
5918 q_u
->max_len
= q_u
->real_len
= data_size
;
5919 q_u
->data
= (unsigned char *)data
;
5924 /*******************************************************************
5925 ********************************************************************/
5927 BOOL
spoolss_io_q_setprinterdata(const char *desc
, SPOOL_Q_SETPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
5929 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinterdata");
5934 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
5936 if(!smb_io_unistr2("", &q_u
->value
, True
, ps
, depth
))
5942 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
5945 if(!prs_uint32("max_len", ps
, depth
, &q_u
->max_len
))
5955 if (UNMARSHALLING(ps
))
5956 q_u
->data
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->max_len
);
5957 if(q_u
->data
== NULL
)
5959 if(!prs_uint8s(False
,"data", ps
, depth
, q_u
->data
, q_u
->max_len
))
5967 if(!prs_uint32("real_len", ps
, depth
, &q_u
->real_len
))
5973 /*******************************************************************
5974 ********************************************************************/
5976 BOOL
spoolss_io_r_setprinterdata(const char *desc
, SPOOL_R_SETPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
5978 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinterdata");
5983 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5989 /*******************************************************************
5990 ********************************************************************/
5991 BOOL
spoolss_io_q_resetprinter(const char *desc
, SPOOL_Q_RESETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
5993 prs_debug(ps
, depth
, desc
, "spoolss_io_q_resetprinter");
5998 if (!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6001 if (!prs_uint32("datatype_ptr", ps
, depth
, &q_u
->datatype_ptr
))
6004 if (q_u
->datatype_ptr
) {
6005 if (!smb_io_unistr2("datatype", &q_u
->datatype
, q_u
->datatype_ptr
?True
:False
, ps
, depth
))
6009 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
6016 /*******************************************************************
6017 ********************************************************************/
6018 BOOL
spoolss_io_r_resetprinter(const char *desc
, SPOOL_R_RESETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6020 prs_debug(ps
, depth
, desc
, "spoolss_io_r_resetprinter");
6025 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6031 /*******************************************************************
6032 ********************************************************************/
6034 static BOOL
spoolss_io_addform(const char *desc
, FORM
*f
, uint32 ptr
, prs_struct
*ps
, int depth
)
6036 prs_debug(ps
, depth
, desc
, "spoolss_io_addform");
6043 if(!prs_uint32("flags", ps
, depth
, &f
->flags
))
6045 if(!prs_uint32("name_ptr", ps
, depth
, &f
->name_ptr
))
6047 if(!prs_uint32("size_x", ps
, depth
, &f
->size_x
))
6049 if(!prs_uint32("size_y", ps
, depth
, &f
->size_y
))
6051 if(!prs_uint32("left", ps
, depth
, &f
->left
))
6053 if(!prs_uint32("top", ps
, depth
, &f
->top
))
6055 if(!prs_uint32("right", ps
, depth
, &f
->right
))
6057 if(!prs_uint32("bottom", ps
, depth
, &f
->bottom
))
6060 if(!smb_io_unistr2("", &f
->name
, f
->name_ptr
, ps
, depth
))
6067 /*******************************************************************
6068 ********************************************************************/
6070 BOOL
spoolss_io_q_deleteform(const char *desc
, SPOOL_Q_DELETEFORM
*q_u
, prs_struct
*ps
, int depth
)
6072 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteform");
6077 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6079 if(!smb_io_unistr2("form name", &q_u
->name
, True
, ps
, depth
))
6085 /*******************************************************************
6086 ********************************************************************/
6088 BOOL
spoolss_io_r_deleteform(const char *desc
, SPOOL_R_DELETEFORM
*r_u
, prs_struct
*ps
, int depth
)
6090 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteform");
6095 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6101 /*******************************************************************
6102 ********************************************************************/
6104 BOOL
spoolss_io_q_addform(const char *desc
, SPOOL_Q_ADDFORM
*q_u
, prs_struct
*ps
, int depth
)
6106 uint32 useless_ptr
=1;
6107 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addform");
6112 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6114 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6116 if(!prs_uint32("level2", ps
, depth
, &q_u
->level2
))
6121 if(!prs_uint32("useless_ptr", ps
, depth
, &useless_ptr
))
6123 if(!spoolss_io_addform("", &q_u
->form
, useless_ptr
, ps
, depth
))
6130 /*******************************************************************
6131 ********************************************************************/
6133 BOOL
spoolss_io_r_addform(const char *desc
, SPOOL_R_ADDFORM
*r_u
, prs_struct
*ps
, int depth
)
6135 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addform");
6140 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6146 /*******************************************************************
6147 ********************************************************************/
6149 BOOL
spoolss_io_q_setform(const char *desc
, SPOOL_Q_SETFORM
*q_u
, prs_struct
*ps
, int depth
)
6151 uint32 useless_ptr
=1;
6152 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setform");
6157 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6159 if(!smb_io_unistr2("", &q_u
->name
, True
, ps
, depth
))
6165 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6167 if(!prs_uint32("level2", ps
, depth
, &q_u
->level2
))
6172 if(!prs_uint32("useless_ptr", ps
, depth
, &useless_ptr
))
6174 if(!spoolss_io_addform("", &q_u
->form
, useless_ptr
, ps
, depth
))
6181 /*******************************************************************
6182 ********************************************************************/
6184 BOOL
spoolss_io_r_setform(const char *desc
, SPOOL_R_SETFORM
*r_u
, prs_struct
*ps
, int depth
)
6186 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setform");
6191 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6197 /*******************************************************************
6198 Parse a SPOOL_R_GETJOB structure.
6199 ********************************************************************/
6201 BOOL
spoolss_io_r_getjob(const char *desc
, SPOOL_R_GETJOB
*r_u
, prs_struct
*ps
, int depth
)
6203 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getjob");
6209 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
6215 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6218 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6224 /*******************************************************************
6225 Parse a SPOOL_Q_GETJOB structure.
6226 ********************************************************************/
6228 BOOL
spoolss_io_q_getjob(const char *desc
, SPOOL_Q_GETJOB
*q_u
, prs_struct
*ps
, int depth
)
6230 prs_debug(ps
, depth
, desc
, "");
6236 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6238 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
6240 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6243 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
6249 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
6255 void free_devmode(DEVICEMODE
*devmode
)
6257 if (devmode
!=NULL
) {
6258 SAFE_FREE(devmode
->dev_private
);
6263 void free_printer_info_1(PRINTER_INFO_1
*printer
)
6268 void free_printer_info_2(PRINTER_INFO_2
*printer
)
6270 if (printer
!=NULL
) {
6271 free_devmode(printer
->devmode
);
6272 printer
->devmode
= NULL
;
6277 void free_printer_info_3(PRINTER_INFO_3
*printer
)
6282 void free_printer_info_4(PRINTER_INFO_4
*printer
)
6287 void free_printer_info_5(PRINTER_INFO_5
*printer
)
6292 void free_printer_info_6(PRINTER_INFO_6
*printer
)
6297 void free_printer_info_7(PRINTER_INFO_7
*printer
)
6302 void free_job_info_2(JOB_INFO_2
*job
)
6305 free_devmode(job
->devmode
);
6308 /*******************************************************************
6310 ********************************************************************/
6312 BOOL
make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER
*q_u
,
6313 const fstring string
, uint32 printer
, uint32 type
)
6318 init_unistr2(&q_u
->string
, string
, UNI_STR_TERMINATE
);
6320 q_u
->printer
=printer
;
6329 /*******************************************************************
6330 Parse a SPOOL_Q_REPLYOPENPRINTER structure.
6331 ********************************************************************/
6333 BOOL
spoolss_io_q_replyopenprinter(const char *desc
, SPOOL_Q_REPLYOPENPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6335 prs_debug(ps
, depth
, desc
, "spoolss_io_q_replyopenprinter");
6341 if(!smb_io_unistr2("", &q_u
->string
, True
, ps
, depth
))
6347 if(!prs_uint32("printer", ps
, depth
, &q_u
->printer
))
6349 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
6352 if(!prs_uint32("unknown0", ps
, depth
, &q_u
->unknown0
))
6354 if(!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6360 /*******************************************************************
6361 Parse a SPOOL_R_REPLYOPENPRINTER structure.
6362 ********************************************************************/
6364 BOOL
spoolss_io_r_replyopenprinter(const char *desc
, SPOOL_R_REPLYOPENPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6366 prs_debug(ps
, depth
, desc
, "spoolss_io_r_replyopenprinter");
6372 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
6375 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6381 /*******************************************************************
6383 ********************************************************************/
6384 BOOL
make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER
*q_u
, POLICY_HND
*hnd
,
6385 uint32 condition
, uint32 change_id
)
6388 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6390 q_u
->condition
= condition
;
6391 q_u
->change_id
= change_id
;
6394 q_u
->unknown1
= 0x1;
6395 memset(q_u
->unknown2
, 0x0, 5);
6396 q_u
->unknown2
[0] = 0x1;
6401 /*******************************************************************
6402 Parse a SPOOL_Q_ROUTERREPLYPRINTER structure.
6403 ********************************************************************/
6404 BOOL
spoolss_io_q_routerreplyprinter (const char *desc
, SPOOL_Q_ROUTERREPLYPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6407 prs_debug(ps
, depth
, desc
, "spoolss_io_q_routerreplyprinter");
6413 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6416 if (!prs_uint32("condition", ps
, depth
, &q_u
->condition
))
6419 if (!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6422 if (!prs_uint32("change_id", ps
, depth
, &q_u
->change_id
))
6425 if (!prs_uint8s(False
, "dev_private", ps
, depth
, q_u
->unknown2
, 5))
6431 /*******************************************************************
6432 Parse a SPOOL_R_ROUTERREPLYPRINTER structure.
6433 ********************************************************************/
6434 BOOL
spoolss_io_r_routerreplyprinter (const char *desc
, SPOOL_R_ROUTERREPLYPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6436 prs_debug(ps
, depth
, desc
, "spoolss_io_r_routerreplyprinter");
6442 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6448 /*******************************************************************
6450 ********************************************************************/
6452 BOOL
make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER
*q_u
, POLICY_HND
*hnd
)
6457 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6462 /*******************************************************************
6463 Parse a SPOOL_Q_REPLYCLOSEPRINTER structure.
6464 ********************************************************************/
6466 BOOL
spoolss_io_q_replycloseprinter(const char *desc
, SPOOL_Q_REPLYCLOSEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6468 prs_debug(ps
, depth
, desc
, "spoolss_io_q_replycloseprinter");
6474 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6480 /*******************************************************************
6481 Parse a SPOOL_R_REPLYCLOSEPRINTER structure.
6482 ********************************************************************/
6484 BOOL
spoolss_io_r_replycloseprinter(const char *desc
, SPOOL_R_REPLYCLOSEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6486 prs_debug(ps
, depth
, desc
, "spoolss_io_r_replycloseprinter");
6492 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
6495 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6501 #if 0 /* JERRY - not currently used but could be :-) */
6503 /*******************************************************************
6504 Deep copy a SPOOL_NOTIFY_INFO_DATA structure
6505 ******************************************************************/
6506 static BOOL
copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA
*dst
,
6507 SPOOL_NOTIFY_INFO_DATA
*src
, int n
)
6511 memcpy(dst
, src
, sizeof(SPOOL_NOTIFY_INFO_DATA
)*n
);
6513 for (i
=0; i
<n
; i
++) {
6517 if (src
->size
!= POINTER
)
6519 len
= src
->notify_data
.data
.length
;
6520 s
= SMB_MALLOC_ARRAY(uint16
, len
);
6522 DEBUG(0,("copy_spool_notify_info_data: malloc() failed!\n"));
6526 memcpy(s
, src
->notify_data
.data
.string
, len
*2);
6527 dst
->notify_data
.data
.string
= s
;
6533 /*******************************************************************
6534 Deep copy a SPOOL_NOTIFY_INFO structure
6535 ******************************************************************/
6536 static BOOL
copy_spool_notify_info(SPOOL_NOTIFY_INFO
*dst
, SPOOL_NOTIFY_INFO
*src
)
6539 DEBUG(0,("copy_spool_notify_info: NULL destination pointer!\n"));
6543 dst
->version
= src
->version
;
6544 dst
->flags
= src
->flags
;
6545 dst
->count
= src
->count
;
6549 dst
->data
= SMB_MALLOC_ARRAY(SPOOL_NOTIFY_INFO_DATA
, dst
->count
);
6551 DEBUG(10,("copy_spool_notify_info: allocating space for [%d] PRINTER_NOTIFY_INFO_DATA entries\n",
6554 if (dst
->data
== NULL
) {
6555 DEBUG(0,("copy_spool_notify_info: malloc() failed for [%d] entries!\n",
6560 return (copy_spool_notify_info_data(dst
->data
, src
->data
, src
->count
));
6567 /*******************************************************************
6569 ********************************************************************/
6571 BOOL
make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN
*q_u
, POLICY_HND
*hnd
,
6572 uint32 change_low
, uint32 change_high
,
6573 SPOOL_NOTIFY_INFO
*info
)
6578 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6580 q_u
->change_low
=change_low
;
6581 q_u
->change_high
=change_high
;
6586 q_u
->info_ptr
=0x0FF0ADDE;
6588 q_u
->info
.version
=2;
6591 DEBUG(10,("make_spoolss_q_reply_rrpcn: [%d] PRINTER_NOTIFY_INFO_DATA\n",
6593 q_u
->info
.version
= info
->version
;
6594 q_u
->info
.flags
= info
->flags
;
6595 q_u
->info
.count
= info
->count
;
6596 /* pointer field - be careful! */
6597 q_u
->info
.data
= info
->data
;
6600 q_u
->info
.flags
=PRINTER_NOTIFY_INFO_DISCARDED
;
6607 /*******************************************************************
6608 Parse a SPOOL_Q_REPLY_RRPCN structure.
6609 ********************************************************************/
6611 BOOL
spoolss_io_q_reply_rrpcn(const char *desc
, SPOOL_Q_REPLY_RRPCN
*q_u
, prs_struct
*ps
, int depth
)
6613 prs_debug(ps
, depth
, desc
, "spoolss_io_q_reply_rrpcn");
6619 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6622 if (!prs_uint32("change_low", ps
, depth
, &q_u
->change_low
))
6625 if (!prs_uint32("change_high", ps
, depth
, &q_u
->change_high
))
6628 if (!prs_uint32("unknown0", ps
, depth
, &q_u
->unknown0
))
6631 if (!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6634 if (!prs_uint32("info_ptr", ps
, depth
, &q_u
->info_ptr
))
6637 if(q_u
->info_ptr
!=0)
6638 if(!smb_io_notify_info(desc
, &q_u
->info
, ps
, depth
))
6644 /*******************************************************************
6645 Parse a SPOOL_R_REPLY_RRPCN structure.
6646 ********************************************************************/
6648 BOOL
spoolss_io_r_reply_rrpcn(const char *desc
, SPOOL_R_REPLY_RRPCN
*r_u
, prs_struct
*ps
, int depth
)
6650 prs_debug(ps
, depth
, desc
, "spoolss_io_r_reply_rrpcn");
6656 if (!prs_uint32("unknown0", ps
, depth
, &r_u
->unknown0
))
6659 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6665 /*******************************************************************
6667 * called from spoolss_q_getprinterdataex (srv_spoolss.c)
6668 ********************************************************************/
6670 BOOL
spoolss_io_q_getprinterdataex(const char *desc
, SPOOL_Q_GETPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6675 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdataex");
6680 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6684 if (!smb_io_unistr2("keyname", &q_u
->keyname
,True
,ps
,depth
))
6688 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
6692 if (!prs_uint32("size", ps
, depth
, &q_u
->size
))
6698 /*******************************************************************
6699 * write a structure.
6700 * called from spoolss_r_getprinterdataex (srv_spoolss.c)
6701 ********************************************************************/
6703 BOOL
spoolss_io_r_getprinterdataex(const char *desc
, SPOOL_R_GETPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6708 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdataex");
6713 if (!prs_uint32("type", ps
, depth
, &r_u
->type
))
6715 if (!prs_uint32("size", ps
, depth
, &r_u
->size
))
6718 if (UNMARSHALLING(ps
) && r_u
->size
) {
6719 r_u
->data
= PRS_ALLOC_MEM(ps
, unsigned char, r_u
->size
);
6724 if (!prs_uint8s(False
,"data", ps
, depth
, r_u
->data
, r_u
->size
))
6730 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6732 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6738 /*******************************************************************
6740 ********************************************************************/
6742 BOOL
spoolss_io_q_setprinterdataex(const char *desc
, SPOOL_Q_SETPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6744 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinterdataex");
6749 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6751 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6757 if(!smb_io_unistr2("", &q_u
->value
, True
, ps
, depth
))
6763 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
6766 if(!prs_uint32("max_len", ps
, depth
, &q_u
->max_len
))
6776 if (UNMARSHALLING(ps
))
6777 q_u
->data
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->max_len
);
6778 if(q_u
->data
== NULL
)
6780 if(!prs_uint8s(False
,"data", ps
, depth
, q_u
->data
, q_u
->max_len
))
6788 if(!prs_uint32("real_len", ps
, depth
, &q_u
->real_len
))
6794 /*******************************************************************
6795 * write a structure.
6796 ********************************************************************/
6798 BOOL
spoolss_io_r_setprinterdataex(const char *desc
, SPOOL_R_SETPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6800 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinterdataex");
6805 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6811 /*******************************************************************
6813 ********************************************************************/
6814 BOOL
make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY
*q_u
,
6815 POLICY_HND
*hnd
, const char *key
,
6818 DEBUG(5,("make_spoolss_q_enumprinterkey\n"));
6820 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6821 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
6827 /*******************************************************************
6829 ********************************************************************/
6831 BOOL
spoolss_io_q_enumprinterkey(const char *desc
, SPOOL_Q_ENUMPRINTERKEY
*q_u
, prs_struct
*ps
, int depth
)
6833 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterkey");
6838 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6841 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6847 if(!prs_uint32("size", ps
, depth
, &q_u
->size
))
6853 /*******************************************************************
6854 * write a structure.
6855 ********************************************************************/
6857 BOOL
spoolss_io_r_enumprinterkey(const char *desc
, SPOOL_R_ENUMPRINTERKEY
*r_u
, prs_struct
*ps
, int depth
)
6859 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterkey");
6865 if (!smb_io_buffer5("", &r_u
->keys
, ps
, depth
))
6871 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6874 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6880 /*******************************************************************
6882 ********************************************************************/
6884 BOOL
make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY
*q_u
,
6885 POLICY_HND
*hnd
, char *keyname
)
6887 DEBUG(5,("make_spoolss_q_deleteprinterkey\n"));
6889 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6890 init_unistr2(&q_u
->keyname
, keyname
, UNI_STR_TERMINATE
);
6895 /*******************************************************************
6897 ********************************************************************/
6899 BOOL
spoolss_io_q_deleteprinterkey(const char *desc
, SPOOL_Q_DELETEPRINTERKEY
*q_u
, prs_struct
*ps
, int depth
)
6901 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterkey");
6906 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6909 if(!smb_io_unistr2("", &q_u
->keyname
, True
, ps
, depth
))
6915 /*******************************************************************
6916 * write a structure.
6917 ********************************************************************/
6919 BOOL
spoolss_io_r_deleteprinterkey(const char *desc
, SPOOL_R_DELETEPRINTERKEY
*r_u
, prs_struct
*ps
, int depth
)
6921 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterkey");
6927 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6934 /*******************************************************************
6936 ********************************************************************/
6938 BOOL
spoolss_io_q_enumprinterdataex(const char *desc
, SPOOL_Q_ENUMPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6940 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdataex");
6945 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6948 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6954 if(!prs_uint32("size", ps
, depth
, &q_u
->size
))
6960 /*******************************************************************
6961 ********************************************************************/
6963 static BOOL
spoolss_io_printer_enum_values_ctr(const char *desc
, prs_struct
*ps
,
6964 PRINTER_ENUM_VALUES_CTR
*ctr
, int depth
)
6967 uint32 valuename_offset
,
6970 const uint32 basic_unit
= 20; /* size of static portion of enum_values */
6972 prs_debug(ps
, depth
, desc
, "spoolss_io_printer_enum_values_ctr");
6976 * offset data begins at 20 bytes per structure * size_of_array.
6977 * Don't forget the uint32 at the beginning
6980 current_offset
= basic_unit
* ctr
->size_of_array
;
6982 /* first loop to write basic enum_value information */
6984 if (UNMARSHALLING(ps
)) {
6985 ctr
->values
= PRS_ALLOC_MEM(ps
, PRINTER_ENUM_VALUES
, ctr
->size_of_array
);
6990 for (i
=0; i
<ctr
->size_of_array
; i
++) {
6991 valuename_offset
= current_offset
;
6992 if (!prs_uint32("valuename_offset", ps
, depth
, &valuename_offset
))
6995 if (!prs_uint32("value_len", ps
, depth
, &ctr
->values
[i
].value_len
))
6998 if (!prs_uint32("type", ps
, depth
, &ctr
->values
[i
].type
))
7001 data_offset
= ctr
->values
[i
].value_len
+ valuename_offset
;
7003 if (!prs_uint32("data_offset", ps
, depth
, &data_offset
))
7006 if (!prs_uint32("data_len", ps
, depth
, &ctr
->values
[i
].data_len
))
7009 current_offset
= data_offset
+ ctr
->values
[i
].data_len
- basic_unit
;
7010 /* account for 2 byte alignment */
7011 current_offset
+= (current_offset
% 2);
7015 * loop #2 for writing the dynamically size objects; pay
7016 * attention to 2-byte alignment here....
7019 for (i
=0; i
<ctr
->size_of_array
; i
++) {
7021 if (!prs_unistr("valuename", ps
, depth
, &ctr
->values
[i
].valuename
))
7024 if ( ctr
->values
[i
].data_len
) {
7025 if ( UNMARSHALLING(ps
) ) {
7026 ctr
->values
[i
].data
= PRS_ALLOC_MEM(ps
, uint8
, ctr
->values
[i
].data_len
);
7027 if (!ctr
->values
[i
].data
)
7030 if (!prs_uint8s(False
, "data", ps
, depth
, ctr
->values
[i
].data
, ctr
->values
[i
].data_len
))
7034 if ( !prs_align_uint16(ps
) )
7041 /*******************************************************************
7042 * write a structure.
7043 ********************************************************************/
7045 BOOL
spoolss_io_r_enumprinterdataex(const char *desc
, SPOOL_R_ENUMPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
7047 uint32 data_offset
, end_offset
;
7048 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdataex");
7054 if (!prs_uint32("size", ps
, depth
, &r_u
->ctr
.size
))
7057 data_offset
= prs_offset(ps
);
7059 if (!prs_set_offset(ps
, data_offset
+ r_u
->ctr
.size
))
7065 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7068 if(!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
7071 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7074 r_u
->ctr
.size_of_array
= r_u
->returned
;
7076 end_offset
= prs_offset(ps
);
7078 if (!prs_set_offset(ps
, data_offset
))
7082 if (!spoolss_io_printer_enum_values_ctr("", ps
, &r_u
->ctr
, depth
))
7085 if (!prs_set_offset(ps
, end_offset
))
7090 /*******************************************************************
7091 * write a structure.
7092 ********************************************************************/
7095 uint32 GetPrintProcessorDirectory(
7097 [in] unistr2 *environment,
7099 [in,out] RPC_BUFFER buffer,
7100 [in] uint32 offered,
7101 [out] uint32 needed,
7102 [out] uint32 returned
7107 BOOL
make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY
*q_u
, const char *name
, char *environment
, int level
, RPC_BUFFER
*buffer
, uint32 offered
)
7109 DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n"));
7111 init_unistr2(&q_u
->name
, name
, UNI_STR_TERMINATE
);
7112 init_unistr2(&q_u
->environment
, environment
, UNI_STR_TERMINATE
);
7116 q_u
->buffer
= buffer
;
7117 q_u
->offered
= offered
;
7122 BOOL
spoolss_io_q_getprintprocessordirectory(const char *desc
, SPOOL_Q_GETPRINTPROCESSORDIRECTORY
*q_u
, prs_struct
*ps
, int depth
)
7126 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprintprocessordirectory");
7132 if (!prs_uint32("ptr", ps
, depth
, &ptr
))
7136 if(!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
7143 if (!prs_uint32("ptr", ps
, depth
, &ptr
))
7147 if(!smb_io_unistr2("environment", &q_u
->environment
, True
,
7155 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
7158 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
7164 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
7170 /*******************************************************************
7171 * write a structure.
7172 ********************************************************************/
7174 BOOL
spoolss_io_r_getprintprocessordirectory(const char *desc
, SPOOL_R_GETPRINTPROCESSORDIRECTORY
*r_u
, prs_struct
*ps
, int depth
)
7176 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprintprocessordirectory");
7182 if(!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
7188 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7191 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7197 BOOL
smb_io_printprocessordirectory_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCESSOR_DIRECTORY_1
*info
, int depth
)
7199 prs_struct
*ps
=&buffer
->prs
;
7201 prs_debug(ps
, depth
, desc
, "smb_io_printprocessordirectory_1");
7204 buffer
->struct_start
=prs_offset(ps
);
7206 if (!smb_io_unistr(desc
, &info
->name
, ps
, depth
))
7212 /*******************************************************************
7214 ********************************************************************/
7216 BOOL
make_spoolss_q_addform(SPOOL_Q_ADDFORM
*q_u
, POLICY_HND
*handle
,
7217 int level
, FORM
*form
)
7219 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7221 q_u
->level2
= level
;
7222 memcpy(&q_u
->form
, form
, sizeof(FORM
));
7227 /*******************************************************************
7229 ********************************************************************/
7231 BOOL
make_spoolss_q_setform(SPOOL_Q_SETFORM
*q_u
, POLICY_HND
*handle
,
7232 int level
, const char *form_name
, FORM
*form
)
7234 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7236 q_u
->level2
= level
;
7237 memcpy(&q_u
->form
, form
, sizeof(FORM
));
7238 init_unistr2(&q_u
->name
, form_name
, UNI_STR_TERMINATE
);
7243 /*******************************************************************
7245 ********************************************************************/
7247 BOOL
make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM
*q_u
, POLICY_HND
*handle
,
7250 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7251 init_unistr2(&q_u
->name
, form
, UNI_STR_TERMINATE
);
7255 /*******************************************************************
7257 ********************************************************************/
7259 BOOL
make_spoolss_q_getform(SPOOL_Q_GETFORM
*q_u
, POLICY_HND
*handle
,
7260 const char *formname
, uint32 level
,
7261 RPC_BUFFER
*buffer
, uint32 offered
)
7263 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7265 init_unistr2(&q_u
->formname
, formname
, UNI_STR_TERMINATE
);
7267 q_u
->offered
=offered
;
7272 /*******************************************************************
7274 ********************************************************************/
7276 BOOL
make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS
*q_u
, POLICY_HND
*handle
,
7277 uint32 level
, RPC_BUFFER
*buffer
,
7280 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7283 q_u
->offered
=offered
;
7288 /*******************************************************************
7290 ********************************************************************/
7292 BOOL
make_spoolss_q_setjob(SPOOL_Q_SETJOB
*q_u
, POLICY_HND
*handle
,
7293 uint32 jobid
, uint32 level
, uint32 command
)
7295 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7299 /* Hmm - the SPOOL_Q_SETJOB structure has a JOB_INFO ctr in it but
7300 the server side code has it marked as unused. */
7302 q_u
->command
= command
;
7307 /*******************************************************************
7309 ********************************************************************/
7311 BOOL
make_spoolss_q_getjob(SPOOL_Q_GETJOB
*q_u
, POLICY_HND
*handle
,
7312 uint32 jobid
, uint32 level
, RPC_BUFFER
*buffer
,
7315 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7318 q_u
->buffer
= buffer
;
7319 q_u
->offered
= offered
;
7324 /*******************************************************************
7326 ********************************************************************/
7328 BOOL
make_spoolss_q_startpageprinter(SPOOL_Q_STARTPAGEPRINTER
*q_u
,
7331 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7336 /*******************************************************************
7338 ********************************************************************/
7340 BOOL
make_spoolss_q_endpageprinter(SPOOL_Q_ENDPAGEPRINTER
*q_u
,
7343 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7348 /*******************************************************************
7350 ********************************************************************/
7352 BOOL
make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER
*q_u
,
7353 POLICY_HND
*handle
, uint32 level
,
7354 char *docname
, char *outputfile
,
7357 DOC_INFO_CONTAINER
*ctr
= &q_u
->doc_info_container
;
7359 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7365 ctr
->docinfo
.switch_value
= level
;
7367 ctr
->docinfo
.doc_info_1
.p_docname
= docname
? 1 : 0;
7368 ctr
->docinfo
.doc_info_1
.p_outputfile
= outputfile
? 1 : 0;
7369 ctr
->docinfo
.doc_info_1
.p_datatype
= datatype
? 1 : 0;
7371 init_unistr2(&ctr
->docinfo
.doc_info_1
.docname
, docname
, UNI_STR_TERMINATE
);
7372 init_unistr2(&ctr
->docinfo
.doc_info_1
.outputfile
, outputfile
, UNI_STR_TERMINATE
);
7373 init_unistr2(&ctr
->docinfo
.doc_info_1
.datatype
, datatype
, UNI_STR_TERMINATE
);
7377 /* DOC_INFO_2 is only used by Windows 9x and since it
7378 doesn't do printing over RPC we don't have to worry
7381 DEBUG(3, ("unsupported info level %d\n", level
));
7388 /*******************************************************************
7390 ********************************************************************/
7392 BOOL
make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER
*q_u
,
7395 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7400 /*******************************************************************
7402 ********************************************************************/
7404 BOOL
make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER
*q_u
,
7405 POLICY_HND
*handle
, uint32 data_size
,
7408 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7409 q_u
->buffer_size
= q_u
->buffer_size2
= data_size
;
7410 q_u
->buffer
= (unsigned char *)data
;
7414 /*******************************************************************
7416 ********************************************************************/
7418 BOOL
make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA
*q_u
,
7419 POLICY_HND
*handle
, char *valuename
)
7421 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7422 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
7427 /*******************************************************************
7429 ********************************************************************/
7431 BOOL
make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX
*q_u
,
7432 POLICY_HND
*handle
, char *key
,
7435 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7436 init_unistr2(&q_u
->valuename
, value
, UNI_STR_TERMINATE
);
7437 init_unistr2(&q_u
->keyname
, key
, UNI_STR_TERMINATE
);
7442 /*******************************************************************
7444 ********************************************************************/
7446 BOOL
make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX
*q_u
, POLICY_HND
*handle
,
7447 uint32 flags
, uint32 options
, const char *localmachine
,
7448 uint32 printerlocal
, SPOOL_NOTIFY_OPTION
*option
)
7450 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7453 q_u
->options
= options
;
7455 q_u
->localmachine_ptr
= 1;
7457 init_unistr2(&q_u
->localmachine
, localmachine
, UNI_STR_TERMINATE
);
7459 q_u
->printerlocal
= printerlocal
;
7462 q_u
->option_ptr
= 1;
7464 q_u
->option
= option
;
7470 /*******************************************************************
7471 ********************************************************************/
7473 BOOL
spoolss_io_q_xcvdataport(const char *desc
, SPOOL_Q_XCVDATAPORT
*q_u
, prs_struct
*ps
, int depth
)
7475 prs_debug(ps
, depth
, desc
, "spoolss_io_q_xcvdataport");
7481 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
7484 if(!smb_io_unistr2("", &q_u
->dataname
, True
, ps
, depth
))
7490 if(!prs_rpcbuffer("", ps
, depth
, &q_u
->indata
))
7496 if (!prs_uint32("indata_len", ps
, depth
, &q_u
->indata_len
))
7498 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
7500 if (!prs_uint32("unknown", ps
, depth
, &q_u
->unknown
))
7506 /*******************************************************************
7507 ********************************************************************/
7509 BOOL
spoolss_io_r_xcvdataport(const char *desc
, SPOOL_R_XCVDATAPORT
*r_u
, prs_struct
*ps
, int depth
)
7511 prs_debug(ps
, depth
, desc
, "spoolss_io_r_xcvdataport");
7516 if(!prs_rpcbuffer("", ps
, depth
, &r_u
->outdata
))
7522 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7524 if (!prs_uint32("unknown", ps
, depth
, &r_u
->unknown
))
7527 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7533 /*******************************************************************
7534 ********************************************************************/
7536 BOOL
make_monitorui_buf( RPC_BUFFER
*buf
, const char *dllname
)
7543 init_unistr( &string
, dllname
);
7545 if ( !prs_unistr( "ui_dll", &buf
->prs
, 0, &string
) )
7551 /*******************************************************************
7552 ********************************************************************/
7554 #define PORT_DATA_1_PAD 540
7556 static BOOL
smb_io_port_data_1( const char *desc
, RPC_BUFFER
*buf
, int depth
, SPOOL_PORT_DATA_1
*p1
)
7558 prs_struct
*ps
= &buf
->prs
;
7559 uint8 padding
[PORT_DATA_1_PAD
];
7561 prs_debug(ps
, depth
, desc
, "smb_io_port_data_1");
7567 if( !prs_uint16s(True
, "portname", ps
, depth
, p1
->portname
, MAX_PORTNAME
))
7570 if (!prs_uint32("version", ps
, depth
, &p1
->version
))
7572 if (!prs_uint32("protocol", ps
, depth
, &p1
->protocol
))
7574 if (!prs_uint32("size", ps
, depth
, &p1
->size
))
7576 if (!prs_uint32("reserved", ps
, depth
, &p1
->reserved
))
7579 if( !prs_uint16s(True
, "hostaddress", ps
, depth
, p1
->hostaddress
, MAX_NETWORK_NAME
))
7581 if( !prs_uint16s(True
, "snmpcommunity", ps
, depth
, p1
->snmpcommunity
, MAX_SNMP_COMM_NAME
))
7584 if (!prs_uint32("dblspool", ps
, depth
, &p1
->dblspool
))
7587 if( !prs_uint16s(True
, "queue", ps
, depth
, p1
->queue
, MAX_QUEUE_NAME
))
7589 if( !prs_uint16s(True
, "ipaddress", ps
, depth
, p1
->ipaddress
, MAX_IPADDR_STRING
))
7592 if( !prs_uint8s(False
, "", ps
, depth
, padding
, PORT_DATA_1_PAD
))
7595 if (!prs_uint32("port", ps
, depth
, &p1
->port
))
7597 if (!prs_uint32("snmpenabled", ps
, depth
, &p1
->snmpenabled
))
7599 if (!prs_uint32("snmpdevindex", ps
, depth
, &p1
->snmpdevindex
))
7605 /*******************************************************************
7606 ********************************************************************/
7608 BOOL
convert_port_data_1( NT_PORT_DATA_1
*port1
, RPC_BUFFER
*buf
)
7610 SPOOL_PORT_DATA_1 spdata_1
;
7612 ZERO_STRUCT( spdata_1
);
7614 if ( !smb_io_port_data_1( "port_data_1", buf
, 0, &spdata_1
) )
7617 rpcstr_pull(port1
->name
, spdata_1
.portname
, sizeof(port1
->name
), -1, 0);
7618 rpcstr_pull(port1
->queue
, spdata_1
.queue
, sizeof(port1
->queue
), -1, 0);
7619 rpcstr_pull(port1
->hostaddr
, spdata_1
.hostaddress
, sizeof(port1
->hostaddr
), -1, 0);
7621 port1
->port
= spdata_1
.port
;
7623 switch ( spdata_1
.protocol
) {
7625 port1
->protocol
= PORT_PROTOCOL_DIRECT
;
7628 port1
->protocol
= PORT_PROTOCOL_LPR
;
7631 DEBUG(3,("convert_port_data_1: unknown protocol [%d]!\n",
7632 spdata_1
.protocol
));