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_7 structure.
2456 ********************************************************************/
2458 BOOL
smb_io_printer_info_7(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_7
*info
, int depth
)
2460 prs_struct
*ps
=&buffer
->prs
;
2462 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_7");
2465 buffer
->struct_start
=prs_offset(ps
);
2467 if (!smb_io_relstr("guid", buffer
, depth
, &info
->guid
))
2469 if (!prs_uint32("action", ps
, depth
, &info
->action
))
2474 /*******************************************************************
2475 Parse a PORT_INFO_1 structure.
2476 ********************************************************************/
2478 BOOL
smb_io_port_info_1(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_1
*info
, int depth
)
2480 prs_struct
*ps
=&buffer
->prs
;
2482 prs_debug(ps
, depth
, desc
, "smb_io_port_info_1");
2485 buffer
->struct_start
=prs_offset(ps
);
2487 if (!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2493 /*******************************************************************
2494 Parse a PORT_INFO_2 structure.
2495 ********************************************************************/
2497 BOOL
smb_io_port_info_2(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_2
*info
, int depth
)
2499 prs_struct
*ps
=&buffer
->prs
;
2501 prs_debug(ps
, depth
, desc
, "smb_io_port_info_2");
2504 buffer
->struct_start
=prs_offset(ps
);
2506 if (!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2508 if (!smb_io_relstr("monitor_name", buffer
, depth
, &info
->monitor_name
))
2510 if (!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2512 if (!prs_uint32("port_type", ps
, depth
, &info
->port_type
))
2514 if (!prs_uint32("reserved", ps
, depth
, &info
->reserved
))
2520 /*******************************************************************
2521 Parse a DRIVER_INFO_1 structure.
2522 ********************************************************************/
2524 BOOL
smb_io_printer_driver_info_1(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_1
*info
, int depth
)
2526 prs_struct
*ps
=&buffer
->prs
;
2528 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_1");
2531 buffer
->struct_start
=prs_offset(ps
);
2533 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2539 /*******************************************************************
2540 Parse a DRIVER_INFO_2 structure.
2541 ********************************************************************/
2543 BOOL
smb_io_printer_driver_info_2(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_2
*info
, int depth
)
2545 prs_struct
*ps
=&buffer
->prs
;
2547 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_2");
2550 buffer
->struct_start
=prs_offset(ps
);
2552 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2554 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2556 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2558 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2560 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2562 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2568 /*******************************************************************
2569 Parse a DRIVER_INFO_3 structure.
2570 ********************************************************************/
2572 BOOL
smb_io_printer_driver_info_3(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_3
*info
, int depth
)
2574 prs_struct
*ps
=&buffer
->prs
;
2576 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_3");
2579 buffer
->struct_start
=prs_offset(ps
);
2581 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2583 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2585 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2587 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2589 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2591 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2593 if (!smb_io_relstr("helpfile", buffer
, depth
, &info
->helpfile
))
2596 if (!smb_io_relarraystr("dependentfiles", buffer
, depth
, &info
->dependentfiles
))
2599 if (!smb_io_relstr("monitorname", buffer
, depth
, &info
->monitorname
))
2601 if (!smb_io_relstr("defaultdatatype", buffer
, depth
, &info
->defaultdatatype
))
2607 /*******************************************************************
2608 Parse a DRIVER_INFO_6 structure.
2609 ********************************************************************/
2611 BOOL
smb_io_printer_driver_info_6(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_6
*info
, int depth
)
2613 prs_struct
*ps
=&buffer
->prs
;
2615 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_6");
2618 buffer
->struct_start
=prs_offset(ps
);
2620 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2622 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2624 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2626 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2628 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2630 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2632 if (!smb_io_relstr("helpfile", buffer
, depth
, &info
->helpfile
))
2635 if (!smb_io_relarraystr("dependentfiles", buffer
, depth
, &info
->dependentfiles
))
2638 if (!smb_io_relstr("monitorname", buffer
, depth
, &info
->monitorname
))
2640 if (!smb_io_relstr("defaultdatatype", buffer
, depth
, &info
->defaultdatatype
))
2643 if (!smb_io_relarraystr("previousdrivernames", buffer
, depth
, &info
->previousdrivernames
))
2646 if (!prs_uint64("date", ps
, depth
, &info
->driver_date
))
2649 if (!prs_uint32("padding", ps
, depth
, &info
->padding
))
2652 if (!prs_uint32("driver_version_low", ps
, depth
, &info
->driver_version_low
))
2655 if (!prs_uint32("driver_version_high", ps
, depth
, &info
->driver_version_high
))
2658 if (!smb_io_relstr("mfgname", buffer
, depth
, &info
->mfgname
))
2660 if (!smb_io_relstr("oem_url", buffer
, depth
, &info
->oem_url
))
2662 if (!smb_io_relstr("hardware_id", buffer
, depth
, &info
->hardware_id
))
2664 if (!smb_io_relstr("provider", buffer
, depth
, &info
->provider
))
2670 /*******************************************************************
2671 Parse a JOB_INFO_1 structure.
2672 ********************************************************************/
2674 BOOL
smb_io_job_info_1(const char *desc
, RPC_BUFFER
*buffer
, JOB_INFO_1
*info
, int depth
)
2676 prs_struct
*ps
=&buffer
->prs
;
2678 prs_debug(ps
, depth
, desc
, "smb_io_job_info_1");
2681 buffer
->struct_start
=prs_offset(ps
);
2683 if (!prs_uint32("jobid", ps
, depth
, &info
->jobid
))
2685 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2687 if (!smb_io_relstr("machinename", buffer
, depth
, &info
->machinename
))
2689 if (!smb_io_relstr("username", buffer
, depth
, &info
->username
))
2691 if (!smb_io_relstr("document", buffer
, depth
, &info
->document
))
2693 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2695 if (!smb_io_relstr("text_status", buffer
, depth
, &info
->text_status
))
2697 if (!prs_uint32("status", ps
, depth
, &info
->status
))
2699 if (!prs_uint32("priority", ps
, depth
, &info
->priority
))
2701 if (!prs_uint32("position", ps
, depth
, &info
->position
))
2703 if (!prs_uint32("totalpages", ps
, depth
, &info
->totalpages
))
2705 if (!prs_uint32("pagesprinted", ps
, depth
, &info
->pagesprinted
))
2707 if (!spoolss_io_system_time("submitted", ps
, depth
, &info
->submitted
))
2713 /*******************************************************************
2714 Parse a JOB_INFO_2 structure.
2715 ********************************************************************/
2717 BOOL
smb_io_job_info_2(const char *desc
, RPC_BUFFER
*buffer
, JOB_INFO_2
*info
, int depth
)
2720 prs_struct
*ps
=&buffer
->prs
;
2722 prs_debug(ps
, depth
, desc
, "smb_io_job_info_2");
2725 buffer
->struct_start
=prs_offset(ps
);
2727 if (!prs_uint32("jobid",ps
, depth
, &info
->jobid
))
2729 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2731 if (!smb_io_relstr("machinename", buffer
, depth
, &info
->machinename
))
2733 if (!smb_io_relstr("username", buffer
, depth
, &info
->username
))
2735 if (!smb_io_relstr("document", buffer
, depth
, &info
->document
))
2737 if (!smb_io_relstr("notifyname", buffer
, depth
, &info
->notifyname
))
2739 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2742 if (!smb_io_relstr("printprocessor", buffer
, depth
, &info
->printprocessor
))
2744 if (!smb_io_relstr("parameters", buffer
, depth
, &info
->parameters
))
2746 if (!smb_io_relstr("drivername", buffer
, depth
, &info
->drivername
))
2748 if (!smb_io_reldevmode("devmode", buffer
, depth
, &info
->devmode
))
2750 if (!smb_io_relstr("text_status", buffer
, depth
, &info
->text_status
))
2753 /* SEC_DESC sec_desc;*/
2754 if (!prs_uint32("Hack! sec desc", ps
, depth
, &pipo
))
2757 if (!prs_uint32("status",ps
, depth
, &info
->status
))
2759 if (!prs_uint32("priority",ps
, depth
, &info
->priority
))
2761 if (!prs_uint32("position",ps
, depth
, &info
->position
))
2763 if (!prs_uint32("starttime",ps
, depth
, &info
->starttime
))
2765 if (!prs_uint32("untiltime",ps
, depth
, &info
->untiltime
))
2767 if (!prs_uint32("totalpages",ps
, depth
, &info
->totalpages
))
2769 if (!prs_uint32("size",ps
, depth
, &info
->size
))
2771 if (!spoolss_io_system_time("submitted", ps
, depth
, &info
->submitted
) )
2773 if (!prs_uint32("timeelapsed",ps
, depth
, &info
->timeelapsed
))
2775 if (!prs_uint32("pagesprinted",ps
, depth
, &info
->pagesprinted
))
2781 /*******************************************************************
2782 ********************************************************************/
2784 BOOL
smb_io_form_1(const char *desc
, RPC_BUFFER
*buffer
, FORM_1
*info
, int depth
)
2786 prs_struct
*ps
=&buffer
->prs
;
2788 prs_debug(ps
, depth
, desc
, "smb_io_form_1");
2791 buffer
->struct_start
=prs_offset(ps
);
2793 if (!prs_uint32("flag", ps
, depth
, &info
->flag
))
2796 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2799 if (!prs_uint32("width", ps
, depth
, &info
->width
))
2801 if (!prs_uint32("length", ps
, depth
, &info
->length
))
2803 if (!prs_uint32("left", ps
, depth
, &info
->left
))
2805 if (!prs_uint32("top", ps
, depth
, &info
->top
))
2807 if (!prs_uint32("right", ps
, depth
, &info
->right
))
2809 if (!prs_uint32("bottom", ps
, depth
, &info
->bottom
))
2817 /*******************************************************************
2818 Parse a DRIVER_DIRECTORY_1 structure.
2819 ********************************************************************/
2821 BOOL
smb_io_driverdir_1(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_DIRECTORY_1
*info
, int depth
)
2823 prs_struct
*ps
=&buffer
->prs
;
2825 prs_debug(ps
, depth
, desc
, "smb_io_driverdir_1");
2828 buffer
->struct_start
=prs_offset(ps
);
2830 if (!smb_io_unistr(desc
, &info
->name
, ps
, depth
))
2836 /*******************************************************************
2837 Parse a PORT_INFO_1 structure.
2838 ********************************************************************/
2840 BOOL
smb_io_port_1(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_1
*info
, int depth
)
2842 prs_struct
*ps
=&buffer
->prs
;
2844 prs_debug(ps
, depth
, desc
, "smb_io_port_1");
2847 buffer
->struct_start
=prs_offset(ps
);
2849 if(!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2855 /*******************************************************************
2856 Parse a PORT_INFO_2 structure.
2857 ********************************************************************/
2859 BOOL
smb_io_port_2(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_2
*info
, int depth
)
2861 prs_struct
*ps
=&buffer
->prs
;
2863 prs_debug(ps
, depth
, desc
, "smb_io_port_2");
2866 buffer
->struct_start
=prs_offset(ps
);
2868 if(!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2870 if(!smb_io_relstr("monitor_name", buffer
, depth
, &info
->monitor_name
))
2872 if(!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2874 if(!prs_uint32("port_type", ps
, depth
, &info
->port_type
))
2876 if(!prs_uint32("reserved", ps
, depth
, &info
->reserved
))
2882 /*******************************************************************
2883 ********************************************************************/
2885 BOOL
smb_io_printprocessor_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCESSOR_1
*info
, int depth
)
2887 prs_struct
*ps
=&buffer
->prs
;
2889 prs_debug(ps
, depth
, desc
, "smb_io_printprocessor_info_1");
2892 buffer
->struct_start
=prs_offset(ps
);
2894 if (smb_io_relstr("name", buffer
, depth
, &info
->name
))
2900 /*******************************************************************
2901 ********************************************************************/
2903 BOOL
smb_io_printprocdatatype_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCDATATYPE_1
*info
, int depth
)
2905 prs_struct
*ps
=&buffer
->prs
;
2907 prs_debug(ps
, depth
, desc
, "smb_io_printprocdatatype_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_printmonitor_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTMONITOR_1
*info
, int depth
)
2923 prs_struct
*ps
=&buffer
->prs
;
2925 prs_debug(ps
, depth
, desc
, "smb_io_printmonitor_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_2(const char *desc
, RPC_BUFFER
*buffer
, PRINTMONITOR_2
*info
, int depth
)
2941 prs_struct
*ps
=&buffer
->prs
;
2943 prs_debug(ps
, depth
, desc
, "smb_io_printmonitor_info_2");
2946 buffer
->struct_start
=prs_offset(ps
);
2948 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2950 if (!smb_io_relstr("environment", buffer
, depth
, &info
->environment
))
2952 if (!smb_io_relstr("dll_name", buffer
, depth
, &info
->dll_name
))
2958 /*******************************************************************
2959 return the size required by a struct in the stream
2960 ********************************************************************/
2962 uint32
spoolss_size_printer_info_0(PRINTER_INFO_0
*info
)
2966 size
+=size_of_relative_string( &info
->printername
);
2967 size
+=size_of_relative_string( &info
->servername
);
2969 size
+=size_of_uint32( &info
->cjobs
);
2970 size
+=size_of_uint32( &info
->total_jobs
);
2971 size
+=size_of_uint32( &info
->total_bytes
);
2973 size
+=size_of_uint16( &info
->year
);
2974 size
+=size_of_uint16( &info
->month
);
2975 size
+=size_of_uint16( &info
->dayofweek
);
2976 size
+=size_of_uint16( &info
->day
);
2977 size
+=size_of_uint16( &info
->hour
);
2978 size
+=size_of_uint16( &info
->minute
);
2979 size
+=size_of_uint16( &info
->second
);
2980 size
+=size_of_uint16( &info
->milliseconds
);
2982 size
+=size_of_uint32( &info
->global_counter
);
2983 size
+=size_of_uint32( &info
->total_pages
);
2985 size
+=size_of_uint16( &info
->major_version
);
2986 size
+=size_of_uint16( &info
->build_version
);
2988 size
+=size_of_uint32( &info
->unknown7
);
2989 size
+=size_of_uint32( &info
->unknown8
);
2990 size
+=size_of_uint32( &info
->unknown9
);
2991 size
+=size_of_uint32( &info
->session_counter
);
2992 size
+=size_of_uint32( &info
->unknown11
);
2993 size
+=size_of_uint32( &info
->printer_errors
);
2994 size
+=size_of_uint32( &info
->unknown13
);
2995 size
+=size_of_uint32( &info
->unknown14
);
2996 size
+=size_of_uint32( &info
->unknown15
);
2997 size
+=size_of_uint32( &info
->unknown16
);
2998 size
+=size_of_uint32( &info
->change_id
);
2999 size
+=size_of_uint32( &info
->unknown18
);
3000 size
+=size_of_uint32( &info
->status
);
3001 size
+=size_of_uint32( &info
->unknown20
);
3002 size
+=size_of_uint32( &info
->c_setprinter
);
3004 size
+=size_of_uint16( &info
->unknown22
);
3005 size
+=size_of_uint16( &info
->unknown23
);
3006 size
+=size_of_uint16( &info
->unknown24
);
3007 size
+=size_of_uint16( &info
->unknown25
);
3008 size
+=size_of_uint16( &info
->unknown26
);
3009 size
+=size_of_uint16( &info
->unknown27
);
3010 size
+=size_of_uint16( &info
->unknown28
);
3011 size
+=size_of_uint16( &info
->unknown29
);
3016 /*******************************************************************
3017 return the size required by a struct in the stream
3018 ********************************************************************/
3020 uint32
spoolss_size_printer_info_1(PRINTER_INFO_1
*info
)
3024 size
+=size_of_uint32( &info
->flags
);
3025 size
+=size_of_relative_string( &info
->description
);
3026 size
+=size_of_relative_string( &info
->name
);
3027 size
+=size_of_relative_string( &info
->comment
);
3032 /*******************************************************************
3033 return the size required by a struct in the stream
3034 ********************************************************************/
3036 uint32
spoolss_size_printer_info_2(PRINTER_INFO_2
*info
)
3042 size
+= sec_desc_size( info
->secdesc
);
3044 size
+=size_of_device_mode( info
->devmode
);
3046 size
+=size_of_relative_string( &info
->servername
);
3047 size
+=size_of_relative_string( &info
->printername
);
3048 size
+=size_of_relative_string( &info
->sharename
);
3049 size
+=size_of_relative_string( &info
->portname
);
3050 size
+=size_of_relative_string( &info
->drivername
);
3051 size
+=size_of_relative_string( &info
->comment
);
3052 size
+=size_of_relative_string( &info
->location
);
3054 size
+=size_of_relative_string( &info
->sepfile
);
3055 size
+=size_of_relative_string( &info
->printprocessor
);
3056 size
+=size_of_relative_string( &info
->datatype
);
3057 size
+=size_of_relative_string( &info
->parameters
);
3059 size
+=size_of_uint32( &info
->attributes
);
3060 size
+=size_of_uint32( &info
->priority
);
3061 size
+=size_of_uint32( &info
->defaultpriority
);
3062 size
+=size_of_uint32( &info
->starttime
);
3063 size
+=size_of_uint32( &info
->untiltime
);
3064 size
+=size_of_uint32( &info
->status
);
3065 size
+=size_of_uint32( &info
->cjobs
);
3066 size
+=size_of_uint32( &info
->averageppm
);
3069 * add any adjustments for alignment. This is
3070 * not optimal since we could be calling this
3071 * function from a loop (e.g. enumprinters), but
3072 * it is easier to maintain the calculation here and
3073 * not place the burden on the caller to remember. --jerry
3075 if ((size
% 4) != 0)
3076 size
+= 4 - (size
% 4);
3081 /*******************************************************************
3082 return the size required by a struct in the stream
3083 ********************************************************************/
3085 uint32
spoolss_size_printer_info_4(PRINTER_INFO_4
*info
)
3089 size
+=size_of_relative_string( &info
->printername
);
3090 size
+=size_of_relative_string( &info
->servername
);
3092 size
+=size_of_uint32( &info
->attributes
);
3096 /*******************************************************************
3097 return the size required by a struct in the stream
3098 ********************************************************************/
3100 uint32
spoolss_size_printer_info_5(PRINTER_INFO_5
*info
)
3104 size
+=size_of_relative_string( &info
->printername
);
3105 size
+=size_of_relative_string( &info
->portname
);
3107 size
+=size_of_uint32( &info
->attributes
);
3108 size
+=size_of_uint32( &info
->device_not_selected_timeout
);
3109 size
+=size_of_uint32( &info
->transmission_retry_timeout
);
3114 /*******************************************************************
3115 return the size required by a struct in the stream
3116 ********************************************************************/
3118 uint32
spoolss_size_printer_info_3(PRINTER_INFO_3
*info
)
3120 /* The 4 is for the self relative pointer.. */
3121 /* JRA !!!! TESTME - WHAT ABOUT prs_align.... !!! */
3122 return 4 + (uint32
)sec_desc_size( info
->secdesc
);
3125 /*******************************************************************
3126 return the size required by a struct in the stream
3127 ********************************************************************/
3129 uint32
spoolss_size_printer_info_7(PRINTER_INFO_7
*info
)
3133 size
+=size_of_relative_string( &info
->guid
);
3134 size
+=size_of_uint32( &info
->action
);
3138 /*******************************************************************
3139 return the size required by a struct in the stream
3140 ********************************************************************/
3142 uint32
spoolss_size_printer_driver_info_1(DRIVER_INFO_1
*info
)
3145 size
+=size_of_relative_string( &info
->name
);
3150 /*******************************************************************
3151 return the size required by a struct in the stream
3152 ********************************************************************/
3154 uint32
spoolss_size_printer_driver_info_2(DRIVER_INFO_2
*info
)
3157 size
+=size_of_uint32( &info
->version
);
3158 size
+=size_of_relative_string( &info
->name
);
3159 size
+=size_of_relative_string( &info
->architecture
);
3160 size
+=size_of_relative_string( &info
->driverpath
);
3161 size
+=size_of_relative_string( &info
->datafile
);
3162 size
+=size_of_relative_string( &info
->configfile
);
3167 /*******************************************************************
3168 return the size required by a string array.
3169 ********************************************************************/
3171 uint32
spoolss_size_string_array(uint16
*string
)
3176 for (i
=0; (string
[i
]!=0x0000) || (string
[i
+1]!=0x0000); i
++);
3178 i
=i
+2; /* to count all chars including the leading zero */
3179 i
=2*i
; /* because we need the value in bytes */
3180 i
=i
+4; /* the offset pointer size */
3185 /*******************************************************************
3186 return the size required by a struct in the stream
3187 ********************************************************************/
3189 uint32
spoolss_size_printer_driver_info_3(DRIVER_INFO_3
*info
)
3193 size
+=size_of_uint32( &info
->version
);
3194 size
+=size_of_relative_string( &info
->name
);
3195 size
+=size_of_relative_string( &info
->architecture
);
3196 size
+=size_of_relative_string( &info
->driverpath
);
3197 size
+=size_of_relative_string( &info
->datafile
);
3198 size
+=size_of_relative_string( &info
->configfile
);
3199 size
+=size_of_relative_string( &info
->helpfile
);
3200 size
+=size_of_relative_string( &info
->monitorname
);
3201 size
+=size_of_relative_string( &info
->defaultdatatype
);
3203 size
+=spoolss_size_string_array(info
->dependentfiles
);
3208 /*******************************************************************
3209 return the size required by a struct in the stream
3210 ********************************************************************/
3212 uint32
spoolss_size_printer_driver_info_6(DRIVER_INFO_6
*info
)
3216 size
+=size_of_uint32( &info
->version
);
3217 size
+=size_of_relative_string( &info
->name
);
3218 size
+=size_of_relative_string( &info
->architecture
);
3219 size
+=size_of_relative_string( &info
->driverpath
);
3220 size
+=size_of_relative_string( &info
->datafile
);
3221 size
+=size_of_relative_string( &info
->configfile
);
3222 size
+=size_of_relative_string( &info
->helpfile
);
3224 size
+=spoolss_size_string_array(info
->dependentfiles
);
3226 size
+=size_of_relative_string( &info
->monitorname
);
3227 size
+=size_of_relative_string( &info
->defaultdatatype
);
3229 size
+=spoolss_size_string_array(info
->previousdrivernames
);
3231 size
+=size_of_nttime(&info
->driver_date
);
3232 size
+=size_of_uint32( &info
->padding
);
3233 size
+=size_of_uint32( &info
->driver_version_low
);
3234 size
+=size_of_uint32( &info
->driver_version_high
);
3235 size
+=size_of_relative_string( &info
->mfgname
);
3236 size
+=size_of_relative_string( &info
->oem_url
);
3237 size
+=size_of_relative_string( &info
->hardware_id
);
3238 size
+=size_of_relative_string( &info
->provider
);
3243 /*******************************************************************
3244 return the size required by a struct in the stream
3245 ********************************************************************/
3247 uint32
spoolss_size_job_info_1(JOB_INFO_1
*info
)
3250 size
+=size_of_uint32( &info
->jobid
);
3251 size
+=size_of_relative_string( &info
->printername
);
3252 size
+=size_of_relative_string( &info
->machinename
);
3253 size
+=size_of_relative_string( &info
->username
);
3254 size
+=size_of_relative_string( &info
->document
);
3255 size
+=size_of_relative_string( &info
->datatype
);
3256 size
+=size_of_relative_string( &info
->text_status
);
3257 size
+=size_of_uint32( &info
->status
);
3258 size
+=size_of_uint32( &info
->priority
);
3259 size
+=size_of_uint32( &info
->position
);
3260 size
+=size_of_uint32( &info
->totalpages
);
3261 size
+=size_of_uint32( &info
->pagesprinted
);
3262 size
+=size_of_systemtime( &info
->submitted
);
3267 /*******************************************************************
3268 return the size required by a struct in the stream
3269 ********************************************************************/
3271 uint32
spoolss_size_job_info_2(JOB_INFO_2
*info
)
3275 size
+=4; /* size of sec desc ptr */
3277 size
+=size_of_uint32( &info
->jobid
);
3278 size
+=size_of_relative_string( &info
->printername
);
3279 size
+=size_of_relative_string( &info
->machinename
);
3280 size
+=size_of_relative_string( &info
->username
);
3281 size
+=size_of_relative_string( &info
->document
);
3282 size
+=size_of_relative_string( &info
->notifyname
);
3283 size
+=size_of_relative_string( &info
->datatype
);
3284 size
+=size_of_relative_string( &info
->printprocessor
);
3285 size
+=size_of_relative_string( &info
->parameters
);
3286 size
+=size_of_relative_string( &info
->drivername
);
3287 size
+=size_of_device_mode( info
->devmode
);
3288 size
+=size_of_relative_string( &info
->text_status
);
3289 /* SEC_DESC sec_desc;*/
3290 size
+=size_of_uint32( &info
->status
);
3291 size
+=size_of_uint32( &info
->priority
);
3292 size
+=size_of_uint32( &info
->position
);
3293 size
+=size_of_uint32( &info
->starttime
);
3294 size
+=size_of_uint32( &info
->untiltime
);
3295 size
+=size_of_uint32( &info
->totalpages
);
3296 size
+=size_of_uint32( &info
->size
);
3297 size
+=size_of_systemtime( &info
->submitted
);
3298 size
+=size_of_uint32( &info
->timeelapsed
);
3299 size
+=size_of_uint32( &info
->pagesprinted
);
3304 /*******************************************************************
3305 return the size required by a struct in the stream
3306 ********************************************************************/
3308 uint32
spoolss_size_form_1(FORM_1
*info
)
3312 size
+=size_of_uint32( &info
->flag
);
3313 size
+=size_of_relative_string( &info
->name
);
3314 size
+=size_of_uint32( &info
->width
);
3315 size
+=size_of_uint32( &info
->length
);
3316 size
+=size_of_uint32( &info
->left
);
3317 size
+=size_of_uint32( &info
->top
);
3318 size
+=size_of_uint32( &info
->right
);
3319 size
+=size_of_uint32( &info
->bottom
);
3324 /*******************************************************************
3325 return the size required by a struct in the stream
3326 ********************************************************************/
3328 uint32
spoolss_size_port_info_1(PORT_INFO_1
*info
)
3332 size
+=size_of_relative_string( &info
->port_name
);
3337 /*******************************************************************
3338 return the size required by a struct in the stream
3339 ********************************************************************/
3341 uint32
spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1
*info
)
3345 size
=str_len_uni(&info
->name
); /* the string length */
3346 size
=size
+1; /* add the leading zero */
3347 size
=size
*2; /* convert in char */
3352 /*******************************************************************
3353 return the size required by a struct in the stream
3354 ********************************************************************/
3356 uint32
spoolss_size_printprocessordirectory_info_1(PRINTPROCESSOR_DIRECTORY_1
*info
)
3360 size
=str_len_uni(&info
->name
); /* the string length */
3361 size
=size
+1; /* add the leading zero */
3362 size
=size
*2; /* convert in char */
3367 /*******************************************************************
3368 return the size required by a struct in the stream
3369 ********************************************************************/
3371 uint32
spoolss_size_port_info_2(PORT_INFO_2
*info
)
3375 size
+=size_of_relative_string( &info
->port_name
);
3376 size
+=size_of_relative_string( &info
->monitor_name
);
3377 size
+=size_of_relative_string( &info
->description
);
3379 size
+=size_of_uint32( &info
->port_type
);
3380 size
+=size_of_uint32( &info
->reserved
);
3385 /*******************************************************************
3386 return the size required by a struct in the stream
3387 ********************************************************************/
3389 uint32
spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1
*info
)
3392 size
+=size_of_relative_string( &info
->name
);
3397 /*******************************************************************
3398 return the size required by a struct in the stream
3399 ********************************************************************/
3401 uint32
spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1
*info
)
3404 size
+=size_of_relative_string( &info
->name
);
3409 /*******************************************************************
3410 return the size required by a struct in the stream
3411 ********************************************************************/
3412 uint32
spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES
*p
)
3419 /* uint32(offset) + uint32(length) + length) */
3420 size
+= (size_of_uint32(&p
->value_len
)*2) + p
->value_len
;
3421 size
+= (size_of_uint32(&p
->data_len
)*2) + p
->data_len
+ (p
->data_len
%2) ;
3423 size
+= size_of_uint32(&p
->type
);
3428 /*******************************************************************
3429 return the size required by a struct in the stream
3430 ********************************************************************/
3432 uint32
spoolss_size_printmonitor_info_1(PRINTMONITOR_1
*info
)
3435 size
+=size_of_relative_string( &info
->name
);
3440 /*******************************************************************
3441 return the size required by a struct in the stream
3442 ********************************************************************/
3444 uint32
spoolss_size_printmonitor_info_2(PRINTMONITOR_2
*info
)
3447 size
+=size_of_relative_string( &info
->name
);
3448 size
+=size_of_relative_string( &info
->environment
);
3449 size
+=size_of_relative_string( &info
->dll_name
);
3454 /*******************************************************************
3456 ********************************************************************/
3458 BOOL
make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2
*q_u
,
3459 const POLICY_HND
*hnd
,
3460 const fstring architecture
,
3461 uint32 level
, uint32 clientmajor
, uint32 clientminor
,
3462 RPC_BUFFER
*buffer
, uint32 offered
)
3467 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3469 init_buf_unistr2(&q_u
->architecture
, &q_u
->architecture_ptr
, architecture
);
3472 q_u
->clientmajorversion
=clientmajor
;
3473 q_u
->clientminorversion
=clientminor
;
3476 q_u
->offered
=offered
;
3481 /*******************************************************************
3483 * called from spoolss_getprinterdriver2 (srv_spoolss.c)
3484 ********************************************************************/
3486 BOOL
spoolss_io_q_getprinterdriver2(const char *desc
, SPOOL_Q_GETPRINTERDRIVER2
*q_u
, prs_struct
*ps
, int depth
)
3488 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdriver2");
3494 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3496 if(!prs_uint32("architecture_ptr", ps
, depth
, &q_u
->architecture_ptr
))
3498 if(!smb_io_unistr2("architecture", &q_u
->architecture
, q_u
->architecture_ptr
, ps
, depth
))
3503 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3506 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3512 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3515 if(!prs_uint32("clientmajorversion", ps
, depth
, &q_u
->clientmajorversion
))
3517 if(!prs_uint32("clientminorversion", ps
, depth
, &q_u
->clientminorversion
))
3523 /*******************************************************************
3525 * called from spoolss_getprinterdriver2 (srv_spoolss.c)
3526 ********************************************************************/
3528 BOOL
spoolss_io_r_getprinterdriver2(const char *desc
, SPOOL_R_GETPRINTERDRIVER2
*r_u
, prs_struct
*ps
, int depth
)
3530 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdriver2");
3536 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3541 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3543 if (!prs_uint32("servermajorversion", ps
, depth
, &r_u
->servermajorversion
))
3545 if (!prs_uint32("serverminorversion", ps
, depth
, &r_u
->serverminorversion
))
3547 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3553 /*******************************************************************
3555 ********************************************************************/
3557 BOOL
make_spoolss_q_enumprinters(
3558 SPOOL_Q_ENUMPRINTERS
*q_u
,
3568 q_u
->servername_ptr
= (servername
!= NULL
) ? 1 : 0;
3569 init_buf_unistr2(&q_u
->servername
, &q_u
->servername_ptr
, servername
);
3573 q_u
->offered
=offered
;
3578 /*******************************************************************
3580 ********************************************************************/
3582 BOOL
make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS
*q_u
,
3583 fstring servername
, uint32 level
,
3584 RPC_BUFFER
*buffer
, uint32 offered
)
3586 q_u
->name_ptr
= (servername
!= NULL
) ? 1 : 0;
3587 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, servername
);
3591 q_u
->offered
=offered
;
3596 /*******************************************************************
3598 * called from spoolss_enumprinters (srv_spoolss.c)
3599 ********************************************************************/
3601 BOOL
spoolss_io_q_enumprinters(const char *desc
, SPOOL_Q_ENUMPRINTERS
*q_u
, prs_struct
*ps
, int depth
)
3603 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinters");
3609 if (!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
3611 if (!prs_uint32("servername_ptr", ps
, depth
, &q_u
->servername_ptr
))
3614 if (!smb_io_unistr2("", &q_u
->servername
, q_u
->servername_ptr
, ps
, depth
))
3619 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
3622 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3627 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3633 /*******************************************************************
3634 Parse a SPOOL_R_ENUMPRINTERS structure.
3635 ********************************************************************/
3637 BOOL
spoolss_io_r_enumprinters(const char *desc
, SPOOL_R_ENUMPRINTERS
*r_u
, prs_struct
*ps
, int depth
)
3639 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinters");
3645 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3651 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3654 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
3657 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3663 /*******************************************************************
3664 * write a structure.
3665 * called from spoolss_r_enum_printers (srv_spoolss.c)
3667 ********************************************************************/
3669 BOOL
spoolss_io_r_getprinter(const char *desc
, SPOOL_R_GETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
3671 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinter");
3677 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3683 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3686 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3692 /*******************************************************************
3694 * called from spoolss_getprinter (srv_spoolss.c)
3695 ********************************************************************/
3697 BOOL
spoolss_io_q_getprinter(const char *desc
, SPOOL_Q_GETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
3699 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinter");
3705 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3707 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
3710 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3715 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3721 /*******************************************************************
3723 ********************************************************************/
3725 BOOL
make_spoolss_q_getprinter(
3726 TALLOC_CTX
*mem_ctx
,
3727 SPOOL_Q_GETPRINTER
*q_u
,
3728 const POLICY_HND
*hnd
,
3738 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3742 q_u
->offered
=offered
;
3747 /*******************************************************************
3749 ********************************************************************/
3750 BOOL
make_spoolss_q_setprinter(TALLOC_CTX
*mem_ctx
, SPOOL_Q_SETPRINTER
*q_u
,
3751 const POLICY_HND
*hnd
, uint32 level
, PRINTER_INFO_CTR
*info
,
3755 DEVICEMODE
*devmode
;
3760 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3763 q_u
->info
.level
= level
;
3764 q_u
->info
.info_ptr
= 1; /* Info is != NULL, see above */
3767 /* There's no such thing as a setprinter level 1 */
3770 secdesc
= info
->printers_2
->secdesc
;
3771 devmode
= info
->printers_2
->devmode
;
3773 make_spoolss_printer_info_2 (mem_ctx
, &q_u
->info
.info_2
, info
->printers_2
);
3774 #if 1 /* JERRY TEST */
3775 q_u
->secdesc_ctr
= SMB_MALLOC_P(SEC_DESC_BUF
);
3776 if (!q_u
->secdesc_ctr
)
3778 q_u
->secdesc_ctr
->sd
= secdesc
;
3779 q_u
->secdesc_ctr
->sd_size
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3781 q_u
->devmode_ctr
.devmode_ptr
= (devmode
!= NULL
) ? 1 : 0;
3782 q_u
->devmode_ctr
.size
= (devmode
!= NULL
) ? sizeof(DEVICEMODE
) + (3*sizeof(uint32
)) : 0;
3783 q_u
->devmode_ctr
.devmode
= devmode
;
3785 q_u
->secdesc_ctr
= NULL
;
3787 q_u
->devmode_ctr
.devmode_ptr
= 0;
3788 q_u
->devmode_ctr
.size
= 0;
3789 q_u
->devmode_ctr
.devmode
= NULL
;
3793 secdesc
= info
->printers_3
->secdesc
;
3795 make_spoolss_printer_info_3 (mem_ctx
, &q_u
->info
.info_3
, info
->printers_3
);
3797 q_u
->secdesc_ctr
= SMB_MALLOC_P(SEC_DESC_BUF
);
3798 if (!q_u
->secdesc_ctr
)
3800 q_u
->secdesc_ctr
->sd_size
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3801 q_u
->secdesc_ctr
->sd
= secdesc
;
3805 make_spoolss_printer_info_7 (mem_ctx
, &q_u
->info
.info_7
, info
->printers_7
);
3809 DEBUG(0,("make_spoolss_q_setprinter: Unknown info level [%d]\n", level
));
3814 q_u
->command
= command
;
3820 /*******************************************************************
3821 ********************************************************************/
3823 BOOL
spoolss_io_r_setprinter(const char *desc
, SPOOL_R_SETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
3825 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinter");
3831 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3837 /*******************************************************************
3838 Marshall/unmarshall a SPOOL_Q_SETPRINTER struct.
3839 ********************************************************************/
3841 BOOL
spoolss_io_q_setprinter(const char *desc
, SPOOL_Q_SETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
3843 uint32 ptr_sec_desc
= 0;
3845 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinter");
3851 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
,ps
, depth
))
3853 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3856 /* check for supported levels and structures we know about */
3858 switch ( q_u
->level
) {
3863 /* supported levels */
3866 DEBUG(0,("spoolss_io_q_setprinter: unsupported printer info level [%d]\n",
3872 if(!spool_io_printer_info_level("", &q_u
->info
, ps
, depth
))
3875 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
3885 ptr_sec_desc
= q_u
->info
.info_2
->secdesc_ptr
;
3890 ptr_sec_desc
= q_u
->info
.info_3
->secdesc_ptr
;
3896 if (!sec_io_desc_buf(desc
, &q_u
->secdesc_ctr
, ps
, depth
))
3901 /* Parse a NULL security descriptor. This should really
3902 happen inside the sec_io_desc_buf() function. */
3904 prs_debug(ps
, depth
, "", "sec_io_desc_buf");
3905 if (!prs_uint32("size", ps
, depth
+ 1, &dummy
))
3907 if (!prs_uint32("ptr", ps
, depth
+ 1, &dummy
)) return
3911 if(!prs_uint32("command", ps
, depth
, &q_u
->command
))
3917 /*******************************************************************
3918 ********************************************************************/
3920 BOOL
spoolss_io_r_fcpn(const char *desc
, SPOOL_R_FCPN
*r_u
, prs_struct
*ps
, int depth
)
3922 prs_debug(ps
, depth
, desc
, "spoolss_io_r_fcpn");
3928 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3934 /*******************************************************************
3935 ********************************************************************/
3937 BOOL
spoolss_io_q_fcpn(const char *desc
, SPOOL_Q_FCPN
*q_u
, prs_struct
*ps
, int depth
)
3940 prs_debug(ps
, depth
, desc
, "spoolss_io_q_fcpn");
3946 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
3953 /*******************************************************************
3954 ********************************************************************/
3956 BOOL
spoolss_io_r_addjob(const char *desc
, SPOOL_R_ADDJOB
*r_u
, prs_struct
*ps
, int depth
)
3958 prs_debug(ps
, depth
, desc
, "");
3964 if(!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3970 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3973 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3979 /*******************************************************************
3980 ********************************************************************/
3982 BOOL
spoolss_io_q_addjob(const char *desc
, SPOOL_Q_ADDJOB
*q_u
, prs_struct
*ps
, int depth
)
3984 prs_debug(ps
, depth
, desc
, "");
3990 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3992 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3995 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4001 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4007 /*******************************************************************
4008 ********************************************************************/
4010 BOOL
spoolss_io_r_enumjobs(const char *desc
, SPOOL_R_ENUMJOBS
*r_u
, prs_struct
*ps
, int depth
)
4012 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumjobs");
4018 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4024 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4027 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4030 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4036 /*******************************************************************
4037 ********************************************************************/
4039 BOOL
make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS
*q_u
, const POLICY_HND
*hnd
,
4050 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
4051 q_u
->firstjob
= firstjob
;
4052 q_u
->numofjobs
= numofjobs
;
4054 q_u
->buffer
= buffer
;
4055 q_u
->offered
= offered
;
4059 /*******************************************************************
4060 ********************************************************************/
4062 BOOL
spoolss_io_q_enumjobs(const char *desc
, SPOOL_Q_ENUMJOBS
*q_u
, prs_struct
*ps
, int depth
)
4064 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumjobs");
4070 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
, ps
, depth
))
4073 if (!prs_uint32("firstjob", ps
, depth
, &q_u
->firstjob
))
4075 if (!prs_uint32("numofjobs", ps
, depth
, &q_u
->numofjobs
))
4077 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4080 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4086 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4092 /*******************************************************************
4093 ********************************************************************/
4095 BOOL
spoolss_io_r_schedulejob(const char *desc
, SPOOL_R_SCHEDULEJOB
*r_u
, prs_struct
*ps
, int depth
)
4097 prs_debug(ps
, depth
, desc
, "spoolss_io_r_schedulejob");
4103 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4109 /*******************************************************************
4110 ********************************************************************/
4112 BOOL
spoolss_io_q_schedulejob(const char *desc
, SPOOL_Q_SCHEDULEJOB
*q_u
, prs_struct
*ps
, int depth
)
4114 prs_debug(ps
, depth
, desc
, "spoolss_io_q_schedulejob");
4120 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4122 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
4128 /*******************************************************************
4129 ********************************************************************/
4131 BOOL
spoolss_io_r_setjob(const char *desc
, SPOOL_R_SETJOB
*r_u
, prs_struct
*ps
, int depth
)
4133 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setjob");
4139 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4145 /*******************************************************************
4146 ********************************************************************/
4148 BOOL
spoolss_io_q_setjob(const char *desc
, SPOOL_Q_SETJOB
*q_u
, prs_struct
*ps
, int depth
)
4150 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setjob");
4156 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4158 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
4161 * level is usually 0. If (level!=0) then I'm in trouble !
4162 * I will try to generate setjob command with level!=0, one day.
4164 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
4166 if(!prs_uint32("command", ps
, depth
, &q_u
->command
))
4172 /*******************************************************************
4173 Parse a SPOOL_R_ENUMPRINTERDRIVERS structure.
4174 ********************************************************************/
4176 BOOL
spoolss_io_r_enumprinterdrivers(const char *desc
, SPOOL_R_ENUMPRINTERDRIVERS
*r_u
, prs_struct
*ps
, int depth
)
4178 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdrivers");
4184 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4190 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4193 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4196 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4202 /*******************************************************************
4204 ********************************************************************/
4206 BOOL
make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS
*q_u
,
4208 const char *environment
,
4210 RPC_BUFFER
*buffer
, uint32 offered
)
4212 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, name
);
4213 init_buf_unistr2(&q_u
->environment
, &q_u
->environment_ptr
, environment
);
4217 q_u
->offered
=offered
;
4222 /*******************************************************************
4223 Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure.
4224 ********************************************************************/
4226 BOOL
spoolss_io_q_enumprinterdrivers(const char *desc
, SPOOL_Q_ENUMPRINTERDRIVERS
*q_u
, prs_struct
*ps
, int depth
)
4229 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdrivers");
4235 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
4237 if (!smb_io_unistr2("", &q_u
->name
, q_u
->name_ptr
,ps
, depth
))
4242 if (!prs_uint32("environment_ptr", ps
, depth
, &q_u
->environment_ptr
))
4244 if (!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
4249 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4252 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4258 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4264 /*******************************************************************
4265 ********************************************************************/
4267 BOOL
spoolss_io_q_enumforms(const char *desc
, SPOOL_Q_ENUMFORMS
*q_u
, prs_struct
*ps
, int depth
)
4270 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumforms");
4275 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4277 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4280 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4285 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4291 /*******************************************************************
4292 ********************************************************************/
4294 BOOL
spoolss_io_r_enumforms(const char *desc
, SPOOL_R_ENUMFORMS
*r_u
, prs_struct
*ps
, int depth
)
4296 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumforms");
4302 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4308 if (!prs_uint32("size of buffer needed", ps
, depth
, &r_u
->needed
))
4311 if (!prs_uint32("numofforms", ps
, depth
, &r_u
->numofforms
))
4314 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4320 /*******************************************************************
4321 ********************************************************************/
4323 BOOL
spoolss_io_q_getform(const char *desc
, SPOOL_Q_GETFORM
*q_u
, prs_struct
*ps
, int depth
)
4326 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getform");
4331 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4333 if (!smb_io_unistr2("", &q_u
->formname
,True
,ps
,depth
))
4339 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4342 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4347 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4353 /*******************************************************************
4354 ********************************************************************/
4356 BOOL
spoolss_io_r_getform(const char *desc
, SPOOL_R_GETFORM
*r_u
, prs_struct
*ps
, int depth
)
4358 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getform");
4364 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4370 if (!prs_uint32("size of buffer needed", ps
, depth
, &r_u
->needed
))
4373 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4379 /*******************************************************************
4380 Parse a SPOOL_R_ENUMPORTS structure.
4381 ********************************************************************/
4383 BOOL
spoolss_io_r_enumports(const char *desc
, SPOOL_R_ENUMPORTS
*r_u
, prs_struct
*ps
, int depth
)
4385 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumports");
4391 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4397 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4400 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4403 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4409 /*******************************************************************
4410 ********************************************************************/
4412 BOOL
spoolss_io_q_enumports(const char *desc
, SPOOL_Q_ENUMPORTS
*q_u
, prs_struct
*ps
, int depth
)
4414 prs_debug(ps
, depth
, desc
, "");
4420 if (!prs_uint32("", ps
, depth
, &q_u
->name_ptr
))
4422 if (!smb_io_unistr2("", &q_u
->name
,True
,ps
,depth
))
4427 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4430 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4435 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4441 /*******************************************************************
4442 Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure.
4443 ********************************************************************/
4445 BOOL
spool_io_printer_info_level_1(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_1
*il
, prs_struct
*ps
, int depth
)
4447 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_1");
4453 if(!prs_uint32("flags", ps
, depth
, &il
->flags
))
4455 if(!prs_uint32("description_ptr", ps
, depth
, &il
->description_ptr
))
4457 if(!prs_uint32("name_ptr", ps
, depth
, &il
->name_ptr
))
4459 if(!prs_uint32("comment_ptr", ps
, depth
, &il
->comment_ptr
))
4462 if(!smb_io_unistr2("description", &il
->description
, il
->description_ptr
, ps
, depth
))
4464 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4466 if(!smb_io_unistr2("comment", &il
->comment
, il
->comment_ptr
, ps
, depth
))
4472 /*******************************************************************
4473 Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure.
4474 ********************************************************************/
4476 BOOL
spool_io_printer_info_level_3(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_3
*il
, prs_struct
*ps
, int depth
)
4478 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_3");
4484 if(!prs_uint32("secdesc_ptr", ps
, depth
, &il
->secdesc_ptr
))
4490 /*******************************************************************
4491 Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure.
4492 ********************************************************************/
4494 BOOL
spool_io_printer_info_level_2(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_2
*il
, prs_struct
*ps
, int depth
)
4496 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_2");
4502 if(!prs_uint32("servername_ptr", ps
, depth
, &il
->servername_ptr
))
4504 if(!prs_uint32("printername_ptr", ps
, depth
, &il
->printername_ptr
))
4506 if(!prs_uint32("sharename_ptr", ps
, depth
, &il
->sharename_ptr
))
4508 if(!prs_uint32("portname_ptr", ps
, depth
, &il
->portname_ptr
))
4511 if(!prs_uint32("drivername_ptr", ps
, depth
, &il
->drivername_ptr
))
4513 if(!prs_uint32("comment_ptr", ps
, depth
, &il
->comment_ptr
))
4515 if(!prs_uint32("location_ptr", ps
, depth
, &il
->location_ptr
))
4517 if(!prs_uint32("devmode_ptr", ps
, depth
, &il
->devmode_ptr
))
4519 if(!prs_uint32("sepfile_ptr", ps
, depth
, &il
->sepfile_ptr
))
4521 if(!prs_uint32("printprocessor_ptr", ps
, depth
, &il
->printprocessor_ptr
))
4523 if(!prs_uint32("datatype_ptr", ps
, depth
, &il
->datatype_ptr
))
4525 if(!prs_uint32("parameters_ptr", ps
, depth
, &il
->parameters_ptr
))
4527 if(!prs_uint32("secdesc_ptr", ps
, depth
, &il
->secdesc_ptr
))
4530 if(!prs_uint32("attributes", ps
, depth
, &il
->attributes
))
4532 if(!prs_uint32("priority", ps
, depth
, &il
->priority
))
4534 if(!prs_uint32("default_priority", ps
, depth
, &il
->default_priority
))
4536 if(!prs_uint32("starttime", ps
, depth
, &il
->starttime
))
4538 if(!prs_uint32("untiltime", ps
, depth
, &il
->untiltime
))
4540 if(!prs_uint32("status", ps
, depth
, &il
->status
))
4542 if(!prs_uint32("cjobs", ps
, depth
, &il
->cjobs
))
4544 if(!prs_uint32("averageppm", ps
, depth
, &il
->averageppm
))
4547 if(!smb_io_unistr2("servername", &il
->servername
, il
->servername_ptr
, ps
, depth
))
4549 if(!smb_io_unistr2("printername", &il
->printername
, il
->printername_ptr
, ps
, depth
))
4551 if(!smb_io_unistr2("sharename", &il
->sharename
, il
->sharename_ptr
, ps
, depth
))
4553 if(!smb_io_unistr2("portname", &il
->portname
, il
->portname_ptr
, ps
, depth
))
4555 if(!smb_io_unistr2("drivername", &il
->drivername
, il
->drivername_ptr
, ps
, depth
))
4557 if(!smb_io_unistr2("comment", &il
->comment
, il
->comment_ptr
, ps
, depth
))
4559 if(!smb_io_unistr2("location", &il
->location
, il
->location_ptr
, ps
, depth
))
4561 if(!smb_io_unistr2("sepfile", &il
->sepfile
, il
->sepfile_ptr
, ps
, depth
))
4563 if(!smb_io_unistr2("printprocessor", &il
->printprocessor
, il
->printprocessor_ptr
, ps
, depth
))
4565 if(!smb_io_unistr2("datatype", &il
->datatype
, il
->datatype_ptr
, ps
, depth
))
4567 if(!smb_io_unistr2("parameters", &il
->parameters
, il
->parameters_ptr
, ps
, depth
))
4573 BOOL
spool_io_printer_info_level_7(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_7
*il
, prs_struct
*ps
, int depth
)
4575 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_7");
4581 if(!prs_uint32("guid_ptr", ps
, depth
, &il
->guid_ptr
))
4583 if(!prs_uint32("action", ps
, depth
, &il
->action
))
4586 if(!smb_io_unistr2("servername", &il
->guid
, il
->guid_ptr
, ps
, depth
))
4591 /*******************************************************************
4592 ********************************************************************/
4594 BOOL
spool_io_printer_info_level(const char *desc
, SPOOL_PRINTER_INFO_LEVEL
*il
, prs_struct
*ps
, int depth
)
4596 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level");
4601 if(!prs_uint32("level", ps
, depth
, &il
->level
))
4603 if(!prs_uint32("info_ptr", ps
, depth
, &il
->info_ptr
))
4606 /* if no struct inside just return */
4607 if (il
->info_ptr
==0) {
4608 if (UNMARSHALLING(ps
)) {
4615 switch (il
->level
) {
4617 * level 0 is used by setprinter when managing the queue
4618 * (hold, stop, start a queue)
4622 /* DOCUMENT ME!!! What is level 1 used for? */
4625 if (UNMARSHALLING(ps
)) {
4626 if ((il
->info_1
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_1
,1)) == NULL
)
4629 if (!spool_io_printer_info_level_1("", il
->info_1
, ps
, depth
))
4634 * level 2 is used by addprinter
4635 * and by setprinter when updating printer's info
4638 if (UNMARSHALLING(ps
)) {
4639 if ((il
->info_2
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_2
,1)) == NULL
)
4642 if (!spool_io_printer_info_level_2("", il
->info_2
, ps
, depth
))
4645 /* DOCUMENT ME!!! What is level 3 used for? */
4648 if (UNMARSHALLING(ps
)) {
4649 if ((il
->info_3
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_3
,1)) == NULL
)
4652 if (!spool_io_printer_info_level_3("", il
->info_3
, ps
, depth
))
4657 if (UNMARSHALLING(ps
))
4658 if ((il
->info_7
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_7
,1)) == NULL
)
4660 if (!spool_io_printer_info_level_7("", il
->info_7
, ps
, depth
))
4668 /*******************************************************************
4669 ********************************************************************/
4671 BOOL
spoolss_io_q_addprinterex(const char *desc
, SPOOL_Q_ADDPRINTEREX
*q_u
, prs_struct
*ps
, int depth
)
4673 uint32 ptr_sec_desc
= 0;
4675 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterex");
4681 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->server_name
))
4683 if (!prs_io_unistr2("servername", ps
, depth
, q_u
->server_name
))
4689 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
4692 if(!spool_io_printer_info_level("", &q_u
->info
, ps
, depth
))
4695 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
4701 switch (q_u
->level
) {
4703 ptr_sec_desc
= q_u
->info
.info_2
->secdesc_ptr
;
4706 ptr_sec_desc
= q_u
->info
.info_3
->secdesc_ptr
;
4710 if (!sec_io_desc_buf(desc
, &q_u
->secdesc_ctr
, ps
, depth
))
4715 /* Parse a NULL security descriptor. This should really
4716 happen inside the sec_io_desc_buf() function. */
4718 prs_debug(ps
, depth
, "", "sec_io_desc_buf");
4719 if (!prs_uint32("size", ps
, depth
+ 1, &dummy
))
4721 if (!prs_uint32("ptr", ps
, depth
+ 1, &dummy
))
4725 if(!prs_uint32("user_switch", ps
, depth
, &q_u
->user_switch
))
4727 if(!spool_io_user_level("", &q_u
->user_ctr
, ps
, depth
))
4733 /*******************************************************************
4734 ********************************************************************/
4736 BOOL
spoolss_io_r_addprinterex(const char *desc
, SPOOL_R_ADDPRINTEREX
*r_u
,
4737 prs_struct
*ps
, int depth
)
4739 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterex");
4742 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
4745 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4751 /*******************************************************************
4752 ********************************************************************/
4754 BOOL
spool_io_printer_driver_info_level_3(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
**q_u
,
4755 prs_struct
*ps
, int depth
)
4757 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*il
;
4759 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level_3");
4763 if (UNMARSHALLING(ps
)) {
4764 il
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
,1);
4776 if(!prs_uint32("cversion", ps
, depth
, &il
->cversion
))
4778 if(!prs_uint32("name", ps
, depth
, &il
->name_ptr
))
4780 if(!prs_uint32("environment", ps
, depth
, &il
->environment_ptr
))
4782 if(!prs_uint32("driverpath", ps
, depth
, &il
->driverpath_ptr
))
4784 if(!prs_uint32("datafile", ps
, depth
, &il
->datafile_ptr
))
4786 if(!prs_uint32("configfile", ps
, depth
, &il
->configfile_ptr
))
4788 if(!prs_uint32("helpfile", ps
, depth
, &il
->helpfile_ptr
))
4790 if(!prs_uint32("monitorname", ps
, depth
, &il
->monitorname_ptr
))
4792 if(!prs_uint32("defaultdatatype", ps
, depth
, &il
->defaultdatatype_ptr
))
4794 if(!prs_uint32("dependentfilessize", ps
, depth
, &il
->dependentfilessize
))
4796 if(!prs_uint32("dependentfiles", ps
, depth
, &il
->dependentfiles_ptr
))
4802 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4804 if(!smb_io_unistr2("environment", &il
->environment
, il
->environment_ptr
, ps
, depth
))
4806 if(!smb_io_unistr2("driverpath", &il
->driverpath
, il
->driverpath_ptr
, ps
, depth
))
4808 if(!smb_io_unistr2("datafile", &il
->datafile
, il
->datafile_ptr
, ps
, depth
))
4810 if(!smb_io_unistr2("configfile", &il
->configfile
, il
->configfile_ptr
, ps
, depth
))
4812 if(!smb_io_unistr2("helpfile", &il
->helpfile
, il
->helpfile_ptr
, ps
, depth
))
4814 if(!smb_io_unistr2("monitorname", &il
->monitorname
, il
->monitorname_ptr
, ps
, depth
))
4816 if(!smb_io_unistr2("defaultdatatype", &il
->defaultdatatype
, il
->defaultdatatype_ptr
, ps
, depth
))
4822 if (il
->dependentfiles_ptr
)
4823 smb_io_buffer5("", &il
->dependentfiles
, ps
, depth
);
4828 /*******************************************************************
4829 parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure
4830 ********************************************************************/
4832 BOOL
spool_io_printer_driver_info_level_6(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
**q_u
,
4833 prs_struct
*ps
, int depth
)
4835 SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
*il
;
4837 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level_6");
4841 if (UNMARSHALLING(ps
)) {
4842 il
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
,1);
4855 * I know this seems weird, but I have no other explanation.
4856 * This is observed behavior on both NT4 and 2K servers.
4860 if (!prs_align_uint64(ps
))
4863 /* parse the main elements the packet */
4865 if(!prs_uint32("cversion ", ps
, depth
, &il
->version
))
4867 if(!prs_uint32("name ", ps
, depth
, &il
->name_ptr
))
4869 if(!prs_uint32("environment ", ps
, depth
, &il
->environment_ptr
))
4871 if(!prs_uint32("driverpath ", ps
, depth
, &il
->driverpath_ptr
))
4873 if(!prs_uint32("datafile ", ps
, depth
, &il
->datafile_ptr
))
4875 if(!prs_uint32("configfile ", ps
, depth
, &il
->configfile_ptr
))
4877 if(!prs_uint32("helpfile ", ps
, depth
, &il
->helpfile_ptr
))
4879 if(!prs_uint32("monitorname ", ps
, depth
, &il
->monitorname_ptr
))
4881 if(!prs_uint32("defaultdatatype", ps
, depth
, &il
->defaultdatatype_ptr
))
4883 if(!prs_uint32("dependentfiles ", ps
, depth
, &il
->dependentfiles_len
))
4885 if(!prs_uint32("dependentfiles ", ps
, depth
, &il
->dependentfiles_ptr
))
4887 if(!prs_uint32("previousnames ", ps
, depth
, &il
->previousnames_len
))
4889 if(!prs_uint32("previousnames ", ps
, depth
, &il
->previousnames_ptr
))
4891 if(!smb_io_time("driverdate ", &il
->driverdate
, ps
, depth
))
4893 if(!prs_uint32("dummy4 ", ps
, depth
, &il
->dummy4
))
4895 if(!prs_uint64("driverversion ", ps
, depth
, &il
->driverversion
))
4897 if(!prs_uint32("mfgname ", ps
, depth
, &il
->mfgname_ptr
))
4899 if(!prs_uint32("oemurl ", ps
, depth
, &il
->oemurl_ptr
))
4901 if(!prs_uint32("hardwareid ", ps
, depth
, &il
->hardwareid_ptr
))
4903 if(!prs_uint32("provider ", ps
, depth
, &il
->provider_ptr
))
4906 /* parse the structures in the packet */
4908 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4913 if(!smb_io_unistr2("environment", &il
->environment
, il
->environment_ptr
, ps
, depth
))
4918 if(!smb_io_unistr2("driverpath", &il
->driverpath
, il
->driverpath_ptr
, ps
, depth
))
4923 if(!smb_io_unistr2("datafile", &il
->datafile
, il
->datafile_ptr
, ps
, depth
))
4928 if(!smb_io_unistr2("configfile", &il
->configfile
, il
->configfile_ptr
, ps
, depth
))
4933 if(!smb_io_unistr2("helpfile", &il
->helpfile
, il
->helpfile_ptr
, ps
, depth
))
4938 if(!smb_io_unistr2("monitorname", &il
->monitorname
, il
->monitorname_ptr
, ps
, depth
))
4943 if(!smb_io_unistr2("defaultdatatype", &il
->defaultdatatype
, il
->defaultdatatype_ptr
, ps
, depth
))
4947 if (il
->dependentfiles_ptr
) {
4948 if(!smb_io_buffer5("dependentfiles", &il
->dependentfiles
, ps
, depth
))
4953 if (il
->previousnames_ptr
) {
4954 if(!smb_io_buffer5("previousnames", &il
->previousnames
, ps
, depth
))
4959 if(!smb_io_unistr2("mfgname", &il
->mfgname
, il
->mfgname_ptr
, ps
, depth
))
4963 if(!smb_io_unistr2("oemurl", &il
->oemurl
, il
->oemurl_ptr
, ps
, depth
))
4967 if(!smb_io_unistr2("hardwareid", &il
->hardwareid
, il
->hardwareid_ptr
, ps
, depth
))
4971 if(!smb_io_unistr2("provider", &il
->provider
, il
->provider_ptr
, ps
, depth
))
4977 /*******************************************************************
4978 convert a buffer of UNICODE strings null terminated
4979 the buffer is terminated by a NULL
4981 convert to an dos codepage array (null terminated)
4983 dynamically allocate memory
4985 ********************************************************************/
4987 static BOOL
uniarray_2_dosarray(BUFFER5
*buf5
, fstring
**ar
)
4996 src
= (char *)buf5
->buffer
;
4997 *ar
= SMB_MALLOC_ARRAY(fstring
, 1);
5002 while (src
< ((char *)buf5
->buffer
) + buf5
->buf_len
*2) {
5003 rpcstr_pull(f
, src
, sizeof(f
)-1, -1, STR_TERMINATE
);
5004 src
= skip_unibuf(src
, 2*buf5
->buf_len
- PTR_DIFF(src
,buf5
->buffer
));
5005 *ar
= SMB_REALLOC_ARRAY(*ar
, fstring
, n
+2);
5009 fstrcpy((*ar
)[n
], f
);
5013 fstrcpy((*ar
)[n
], "");
5018 /*******************************************************************
5019 read a UNICODE array with null terminated strings
5020 and null terminated array
5021 and size of array at beginning
5022 ********************************************************************/
5024 BOOL
smb_io_unibuffer(const char *desc
, UNISTR2
*buffer
, prs_struct
*ps
, int depth
)
5026 if (buffer
==NULL
) return False
;
5029 buffer
->uni_str_len
=buffer
->uni_max_len
;
5031 if(!prs_uint32("buffer_size", ps
, depth
, &buffer
->uni_max_len
))
5034 if(!prs_unistr2(True
, "buffer ", ps
, depth
, buffer
))
5040 /*******************************************************************
5041 ********************************************************************/
5043 BOOL
spool_io_printer_driver_info_level(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL
*il
, prs_struct
*ps
, int depth
)
5045 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level");
5050 if(!prs_uint32("level", ps
, depth
, &il
->level
))
5052 if(!prs_uint32("ptr", ps
, depth
, &il
->ptr
))
5058 switch (il
->level
) {
5060 if(!spool_io_printer_driver_info_level_3("", &il
->info_3
, ps
, depth
))
5064 if(!spool_io_printer_driver_info_level_6("", &il
->info_6
, ps
, depth
))
5074 /*******************************************************************
5075 init a SPOOL_Q_ADDPRINTERDRIVER struct
5076 ******************************************************************/
5078 BOOL
make_spoolss_q_addprinterdriver(TALLOC_CTX
*mem_ctx
,
5079 SPOOL_Q_ADDPRINTERDRIVER
*q_u
, const char* srv_name
,
5080 uint32 level
, PRINTER_DRIVER_CTR
*info
)
5082 DEBUG(5,("make_spoolss_q_addprinterdriver\n"));
5084 if (!srv_name
|| !info
) {
5088 q_u
->server_name_ptr
= 1; /* srv_name is != NULL, see above */
5089 init_unistr2(&q_u
->server_name
, srv_name
, UNI_STR_TERMINATE
);
5093 q_u
->info
.level
= level
;
5094 q_u
->info
.ptr
= 1; /* Info is != NULL, see above */
5097 /* info level 3 is supported by Windows 95/98, WinNT and Win2k */
5099 make_spoolss_driver_info_3(mem_ctx
, &q_u
->info
.info_3
, info
->info3
);
5103 DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level
));
5110 BOOL
make_spoolss_driver_info_3(TALLOC_CTX
*mem_ctx
,
5111 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
**spool_drv_info
,
5112 DRIVER_INFO_3
*info3
)
5115 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*inf
;
5117 if (!(inf
=TALLOC_ZERO_P(mem_ctx
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
)))
5120 inf
->cversion
= info3
->version
;
5121 inf
->name_ptr
= (info3
->name
.buffer
!=NULL
)?1:0;
5122 inf
->environment_ptr
= (info3
->architecture
.buffer
!=NULL
)?1:0;
5123 inf
->driverpath_ptr
= (info3
->driverpath
.buffer
!=NULL
)?1:0;
5124 inf
->datafile_ptr
= (info3
->datafile
.buffer
!=NULL
)?1:0;
5125 inf
->configfile_ptr
= (info3
->configfile
.buffer
!=NULL
)?1:0;
5126 inf
->helpfile_ptr
= (info3
->helpfile
.buffer
!=NULL
)?1:0;
5127 inf
->monitorname_ptr
= (info3
->monitorname
.buffer
!=NULL
)?1:0;
5128 inf
->defaultdatatype_ptr
= (info3
->defaultdatatype
.buffer
!=NULL
)?1:0;
5130 init_unistr2_from_unistr(&inf
->name
, &info3
->name
);
5131 init_unistr2_from_unistr(&inf
->environment
, &info3
->architecture
);
5132 init_unistr2_from_unistr(&inf
->driverpath
, &info3
->driverpath
);
5133 init_unistr2_from_unistr(&inf
->datafile
, &info3
->datafile
);
5134 init_unistr2_from_unistr(&inf
->configfile
, &info3
->configfile
);
5135 init_unistr2_from_unistr(&inf
->helpfile
, &info3
->helpfile
);
5136 init_unistr2_from_unistr(&inf
->monitorname
, &info3
->monitorname
);
5137 init_unistr2_from_unistr(&inf
->defaultdatatype
, &info3
->defaultdatatype
);
5139 if (info3
->dependentfiles
) {
5141 BOOL null_char
= False
;
5142 uint16
*ptr
= info3
->dependentfiles
;
5147 /* the null_char BOOL is used to help locate
5148 two '\0's back to back */
5165 inf
->dependentfiles_ptr
= (info3
->dependentfiles
!= NULL
) ? 1 : 0;
5166 inf
->dependentfilessize
= (info3
->dependentfiles
!= NULL
) ? len
: 0;
5167 if(!make_spoolss_buffer5(mem_ctx
, &inf
->dependentfiles
, len
, info3
->dependentfiles
)) {
5172 *spool_drv_info
= inf
;
5177 /*******************************************************************
5178 make a BUFFER5 struct from a uint16*
5179 ******************************************************************/
5181 BOOL
make_spoolss_buffer5(TALLOC_CTX
*mem_ctx
, BUFFER5
*buf5
, uint32 len
, uint16
*src
)
5184 buf5
->buf_len
= len
;
5186 if((buf5
->buffer
=(uint16
*)TALLOC_MEMDUP(mem_ctx
, src
, sizeof(uint16
)*len
)) == NULL
) {
5187 DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n"));
5197 /*******************************************************************
5198 fill in the prs_struct for a ADDPRINTERDRIVER request PDU
5199 ********************************************************************/
5201 BOOL
spoolss_io_q_addprinterdriver(const char *desc
, SPOOL_Q_ADDPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
5203 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterdriver");
5209 if(!prs_uint32("server_name_ptr", ps
, depth
, &q_u
->server_name_ptr
))
5211 if(!smb_io_unistr2("server_name", &q_u
->server_name
, q_u
->server_name_ptr
, ps
, depth
))
5216 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
5219 if(!spool_io_printer_driver_info_level("", &q_u
->info
, ps
, depth
))
5225 /*******************************************************************
5226 ********************************************************************/
5228 BOOL
spoolss_io_r_addprinterdriver(const char *desc
, SPOOL_R_ADDPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
5230 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterdriver");
5233 if(!prs_werror("status", ps
, depth
, &q_u
->status
))
5239 /*******************************************************************
5240 fill in the prs_struct for a ADDPRINTERDRIVER request PDU
5241 ********************************************************************/
5243 BOOL
spoolss_io_q_addprinterdriverex(const char *desc
, SPOOL_Q_ADDPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
5245 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterdriverex");
5251 if(!prs_uint32("server_name_ptr", ps
, depth
, &q_u
->server_name_ptr
))
5253 if(!smb_io_unistr2("server_name", &q_u
->server_name
, q_u
->server_name_ptr
, ps
, depth
))
5258 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
5261 if(!spool_io_printer_driver_info_level("", &q_u
->info
, ps
, depth
))
5266 if(!prs_uint32("copy flags", ps
, depth
, &q_u
->copy_flags
))
5272 /*******************************************************************
5273 ********************************************************************/
5275 BOOL
spoolss_io_r_addprinterdriverex(const char *desc
, SPOOL_R_ADDPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
5277 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterdriverex");
5280 if(!prs_werror("status", ps
, depth
, &q_u
->status
))
5286 /*******************************************************************
5287 ********************************************************************/
5289 BOOL
uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*uni
,
5290 NT_PRINTER_DRIVER_INFO_LEVEL_3
**asc
)
5292 NT_PRINTER_DRIVER_INFO_LEVEL_3
*d
;
5294 DEBUG(7,("uni_2_asc_printer_driver_3: Converting from UNICODE to ASCII\n"));
5298 *asc
=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_3
);
5306 d
->cversion
=uni
->cversion
;
5308 unistr2_to_ascii(d
->name
, &uni
->name
, sizeof(d
->name
)-1);
5309 unistr2_to_ascii(d
->environment
, &uni
->environment
, sizeof(d
->environment
)-1);
5310 unistr2_to_ascii(d
->driverpath
, &uni
->driverpath
, sizeof(d
->driverpath
)-1);
5311 unistr2_to_ascii(d
->datafile
, &uni
->datafile
, sizeof(d
->datafile
)-1);
5312 unistr2_to_ascii(d
->configfile
, &uni
->configfile
, sizeof(d
->configfile
)-1);
5313 unistr2_to_ascii(d
->helpfile
, &uni
->helpfile
, sizeof(d
->helpfile
)-1);
5314 unistr2_to_ascii(d
->monitorname
, &uni
->monitorname
, sizeof(d
->monitorname
)-1);
5315 unistr2_to_ascii(d
->defaultdatatype
, &uni
->defaultdatatype
, sizeof(d
->defaultdatatype
)-1);
5317 DEBUGADD(8,( "version: %d\n", d
->cversion
));
5318 DEBUGADD(8,( "name: %s\n", d
->name
));
5319 DEBUGADD(8,( "environment: %s\n", d
->environment
));
5320 DEBUGADD(8,( "driverpath: %s\n", d
->driverpath
));
5321 DEBUGADD(8,( "datafile: %s\n", d
->datafile
));
5322 DEBUGADD(8,( "configfile: %s\n", d
->configfile
));
5323 DEBUGADD(8,( "helpfile: %s\n", d
->helpfile
));
5324 DEBUGADD(8,( "monitorname: %s\n", d
->monitorname
));
5325 DEBUGADD(8,( "defaultdatatype: %s\n", d
->defaultdatatype
));
5327 if (uniarray_2_dosarray(&uni
->dependentfiles
, &d
->dependentfiles
))
5334 /*******************************************************************
5335 ********************************************************************/
5336 BOOL
uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
*uni
,
5337 NT_PRINTER_DRIVER_INFO_LEVEL_6
**asc
)
5339 NT_PRINTER_DRIVER_INFO_LEVEL_6
*d
;
5341 DEBUG(7,("uni_2_asc_printer_driver_6: Converting from UNICODE to ASCII\n"));
5345 *asc
=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_6
);
5353 d
->version
=uni
->version
;
5355 unistr2_to_ascii(d
->name
, &uni
->name
, sizeof(d
->name
)-1);
5356 unistr2_to_ascii(d
->environment
, &uni
->environment
, sizeof(d
->environment
)-1);
5357 unistr2_to_ascii(d
->driverpath
, &uni
->driverpath
, sizeof(d
->driverpath
)-1);
5358 unistr2_to_ascii(d
->datafile
, &uni
->datafile
, sizeof(d
->datafile
)-1);
5359 unistr2_to_ascii(d
->configfile
, &uni
->configfile
, sizeof(d
->configfile
)-1);
5360 unistr2_to_ascii(d
->helpfile
, &uni
->helpfile
, sizeof(d
->helpfile
)-1);
5361 unistr2_to_ascii(d
->monitorname
, &uni
->monitorname
, sizeof(d
->monitorname
)-1);
5362 unistr2_to_ascii(d
->defaultdatatype
, &uni
->defaultdatatype
, sizeof(d
->defaultdatatype
)-1);
5364 DEBUGADD(8,( "version: %d\n", d
->version
));
5365 DEBUGADD(8,( "name: %s\n", d
->name
));
5366 DEBUGADD(8,( "environment: %s\n", d
->environment
));
5367 DEBUGADD(8,( "driverpath: %s\n", d
->driverpath
));
5368 DEBUGADD(8,( "datafile: %s\n", d
->datafile
));
5369 DEBUGADD(8,( "configfile: %s\n", d
->configfile
));
5370 DEBUGADD(8,( "helpfile: %s\n", d
->helpfile
));
5371 DEBUGADD(8,( "monitorname: %s\n", d
->monitorname
));
5372 DEBUGADD(8,( "defaultdatatype: %s\n", d
->defaultdatatype
));
5374 if (!uniarray_2_dosarray(&uni
->dependentfiles
, &d
->dependentfiles
))
5376 if (!uniarray_2_dosarray(&uni
->previousnames
, &d
->previousnames
))
5386 BOOL
uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2
*uni
,
5387 NT_PRINTER_INFO_LEVEL_2
*d
)
5389 DEBUG(7,("Converting from UNICODE to ASCII\n"));
5391 d
->attributes
=uni
->attributes
;
5392 d
->priority
=uni
->priority
;
5393 d
->default_priority
=uni
->default_priority
;
5394 d
->starttime
=uni
->starttime
;
5395 d
->untiltime
=uni
->untiltime
;
5396 d
->status
=uni
->status
;
5397 d
->cjobs
=uni
->cjobs
;
5399 unistr2_to_ascii(d
->servername
, &uni
->servername
, sizeof(d
->servername
)-1);
5400 unistr2_to_ascii(d
->printername
, &uni
->printername
, sizeof(d
->printername
)-1);
5401 unistr2_to_ascii(d
->sharename
, &uni
->sharename
, sizeof(d
->sharename
)-1);
5402 unistr2_to_ascii(d
->portname
, &uni
->portname
, sizeof(d
->portname
)-1);
5403 unistr2_to_ascii(d
->drivername
, &uni
->drivername
, sizeof(d
->drivername
)-1);
5404 unistr2_to_ascii(d
->comment
, &uni
->comment
, sizeof(d
->comment
)-1);
5405 unistr2_to_ascii(d
->location
, &uni
->location
, sizeof(d
->location
)-1);
5406 unistr2_to_ascii(d
->sepfile
, &uni
->sepfile
, sizeof(d
->sepfile
)-1);
5407 unistr2_to_ascii(d
->printprocessor
, &uni
->printprocessor
, sizeof(d
->printprocessor
)-1);
5408 unistr2_to_ascii(d
->datatype
, &uni
->datatype
, sizeof(d
->datatype
)-1);
5409 unistr2_to_ascii(d
->parameters
, &uni
->parameters
, sizeof(d
->parameters
)-1);
5414 /*******************************************************************
5416 ********************************************************************/
5418 BOOL
make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR
*q_u
,
5419 fstring servername
, fstring env_name
, uint32 level
,
5420 RPC_BUFFER
*buffer
, uint32 offered
)
5422 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, servername
);
5423 init_buf_unistr2(&q_u
->environment
, &q_u
->environment_ptr
, env_name
);
5427 q_u
->offered
=offered
;
5432 /*******************************************************************
5433 Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure.
5434 ********************************************************************/
5436 BOOL
spoolss_io_q_getprinterdriverdir(const char *desc
, SPOOL_Q_GETPRINTERDRIVERDIR
*q_u
, prs_struct
*ps
, int depth
)
5438 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdriverdir");
5443 if(!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5445 if(!smb_io_unistr2("", &q_u
->name
, q_u
->name_ptr
, ps
, depth
))
5451 if(!prs_uint32("", ps
, depth
, &q_u
->environment_ptr
))
5453 if(!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
5459 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
5462 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5468 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5474 /*******************************************************************
5475 Parse a SPOOL_R_GETPRINTERDRIVERDIR structure.
5476 ********************************************************************/
5478 BOOL
spoolss_io_r_getprinterdriverdir(const char *desc
, SPOOL_R_GETPRINTERDRIVERDIR
*r_u
, prs_struct
*ps
, int depth
)
5480 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdriverdir");
5486 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5492 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5495 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5501 /*******************************************************************
5502 ********************************************************************/
5504 BOOL
spoolss_io_r_enumprintprocessors(const char *desc
, SPOOL_R_ENUMPRINTPROCESSORS
*r_u
, prs_struct
*ps
, int depth
)
5506 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintprocessors");
5512 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5518 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5521 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5524 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5530 /*******************************************************************
5531 ********************************************************************/
5533 BOOL
spoolss_io_q_enumprintprocessors(const char *desc
, SPOOL_Q_ENUMPRINTPROCESSORS
*q_u
, prs_struct
*ps
, int depth
)
5535 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintprocessors");
5541 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5543 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5549 if (!prs_uint32("", ps
, depth
, &q_u
->environment_ptr
))
5551 if (!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
5557 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5560 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5566 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5572 /*******************************************************************
5573 ********************************************************************/
5575 BOOL
spoolss_io_q_addprintprocessor(const char *desc
, SPOOL_Q_ADDPRINTPROCESSOR
*q_u
, prs_struct
*ps
, int depth
)
5577 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprintprocessor");
5583 if (!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
5585 if (!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
5590 if (!smb_io_unistr2("environment", &q_u
->environment
, True
, ps
, depth
))
5595 if (!smb_io_unistr2("path", &q_u
->path
, True
, ps
, depth
))
5600 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5606 /*******************************************************************
5607 ********************************************************************/
5609 BOOL
spoolss_io_r_addprintprocessor(const char *desc
, SPOOL_R_ADDPRINTPROCESSOR
*r_u
, prs_struct
*ps
, int depth
)
5611 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprintproicessor");
5617 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5623 /*******************************************************************
5624 ********************************************************************/
5626 BOOL
spoolss_io_r_enumprintprocdatatypes(const char *desc
, SPOOL_R_ENUMPRINTPROCDATATYPES
*r_u
, prs_struct
*ps
, int depth
)
5628 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintprocdatatypes");
5634 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5640 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5643 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5646 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5652 /*******************************************************************
5653 ********************************************************************/
5655 BOOL
spoolss_io_q_enumprintprocdatatypes(const char *desc
, SPOOL_Q_ENUMPRINTPROCDATATYPES
*q_u
, prs_struct
*ps
, int depth
)
5657 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintprocdatatypes");
5663 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5665 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5671 if (!prs_uint32("processor_ptr", ps
, depth
, &q_u
->processor_ptr
))
5673 if (!smb_io_unistr2("processor", &q_u
->processor
, q_u
->processor_ptr
, ps
, depth
))
5679 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5682 if(!prs_rpcbuffer_p("buffer", ps
, depth
, &q_u
->buffer
))
5688 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5694 /*******************************************************************
5695 Parse a SPOOL_Q_ENUMPRINTMONITORS structure.
5696 ********************************************************************/
5698 BOOL
spoolss_io_q_enumprintmonitors(const char *desc
, SPOOL_Q_ENUMPRINTMONITORS
*q_u
, prs_struct
*ps
, int depth
)
5700 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintmonitors");
5706 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5708 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5714 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5717 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5723 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5729 /*******************************************************************
5730 ********************************************************************/
5732 BOOL
spoolss_io_r_enumprintmonitors(const char *desc
, SPOOL_R_ENUMPRINTMONITORS
*r_u
, prs_struct
*ps
, int depth
)
5734 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintmonitors");
5740 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5746 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5749 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5752 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5758 /*******************************************************************
5759 ********************************************************************/
5761 BOOL
spoolss_io_r_enumprinterdata(const char *desc
, SPOOL_R_ENUMPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
5763 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdata");
5768 if(!prs_uint32("valuesize", ps
, depth
, &r_u
->valuesize
))
5771 if (UNMARSHALLING(ps
) && r_u
->valuesize
) {
5772 r_u
->value
= PRS_ALLOC_MEM(ps
, uint16
, r_u
->valuesize
);
5774 DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata value\n"));
5779 if(!prs_uint16uni(False
, "value", ps
, depth
, r_u
->value
, r_u
->valuesize
))
5785 if(!prs_uint32("realvaluesize", ps
, depth
, &r_u
->realvaluesize
))
5788 if(!prs_uint32("type", ps
, depth
, &r_u
->type
))
5791 if(!prs_uint32("datasize", ps
, depth
, &r_u
->datasize
))
5794 if (UNMARSHALLING(ps
) && r_u
->datasize
) {
5795 r_u
->data
= PRS_ALLOC_MEM(ps
, uint8
, r_u
->datasize
);
5797 DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata data\n"));
5802 if(!prs_uint8s(False
, "data", ps
, depth
, r_u
->data
, r_u
->datasize
))
5807 if(!prs_uint32("realdatasize", ps
, depth
, &r_u
->realdatasize
))
5809 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5815 /*******************************************************************
5816 ********************************************************************/
5818 BOOL
spoolss_io_q_enumprinterdata(const char *desc
, SPOOL_Q_ENUMPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
5820 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdata");
5825 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
5827 if(!prs_uint32("index", ps
, depth
, &q_u
->index
))
5829 if(!prs_uint32("valuesize", ps
, depth
, &q_u
->valuesize
))
5831 if(!prs_uint32("datasize", ps
, depth
, &q_u
->datasize
))
5837 /*******************************************************************
5838 ********************************************************************/
5840 BOOL
make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA
*q_u
,
5841 const POLICY_HND
*hnd
,
5842 uint32 idx
, uint32 valuelen
, uint32 datalen
)
5844 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5846 q_u
->valuesize
=valuelen
;
5847 q_u
->datasize
=datalen
;
5852 /*******************************************************************
5853 ********************************************************************/
5855 BOOL
make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX
*q_u
,
5856 const POLICY_HND
*hnd
, const char *key
,
5859 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5860 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
5866 /*******************************************************************
5867 ********************************************************************/
5868 BOOL
make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA
*q_u
, const POLICY_HND
*hnd
,
5869 char* value
, uint32 data_type
, char* data
, uint32 data_size
)
5871 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5872 q_u
->type
= data_type
;
5873 init_unistr2(&q_u
->value
, value
, UNI_STR_TERMINATE
);
5875 q_u
->max_len
= q_u
->real_len
= data_size
;
5876 q_u
->data
= (unsigned char *)data
;
5881 /*******************************************************************
5882 ********************************************************************/
5883 BOOL
make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX
*q_u
, const POLICY_HND
*hnd
,
5884 char *key
, char* value
, uint32 data_type
, char* data
,
5887 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5888 q_u
->type
= data_type
;
5889 init_unistr2(&q_u
->value
, value
, UNI_STR_TERMINATE
);
5890 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
5892 q_u
->max_len
= q_u
->real_len
= data_size
;
5893 q_u
->data
= (unsigned char *)data
;
5898 /*******************************************************************
5899 ********************************************************************/
5901 BOOL
spoolss_io_q_setprinterdata(const char *desc
, SPOOL_Q_SETPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
5903 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinterdata");
5908 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
5910 if(!smb_io_unistr2("", &q_u
->value
, True
, ps
, depth
))
5916 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
5919 if(!prs_uint32("max_len", ps
, depth
, &q_u
->max_len
))
5929 if (UNMARSHALLING(ps
))
5930 q_u
->data
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->max_len
);
5931 if(q_u
->data
== NULL
)
5933 if(!prs_uint8s(False
,"data", ps
, depth
, q_u
->data
, q_u
->max_len
))
5941 if(!prs_uint32("real_len", ps
, depth
, &q_u
->real_len
))
5947 /*******************************************************************
5948 ********************************************************************/
5950 BOOL
spoolss_io_r_setprinterdata(const char *desc
, SPOOL_R_SETPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
5952 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinterdata");
5957 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5963 /*******************************************************************
5964 ********************************************************************/
5965 BOOL
spoolss_io_q_resetprinter(const char *desc
, SPOOL_Q_RESETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
5967 prs_debug(ps
, depth
, desc
, "spoolss_io_q_resetprinter");
5972 if (!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
5975 if (!prs_uint32("datatype_ptr", ps
, depth
, &q_u
->datatype_ptr
))
5978 if (q_u
->datatype_ptr
) {
5979 if (!smb_io_unistr2("datatype", &q_u
->datatype
, q_u
->datatype_ptr
?True
:False
, ps
, depth
))
5983 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
5990 /*******************************************************************
5991 ********************************************************************/
5992 BOOL
spoolss_io_r_resetprinter(const char *desc
, SPOOL_R_RESETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
5994 prs_debug(ps
, depth
, desc
, "spoolss_io_r_resetprinter");
5999 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6005 /*******************************************************************
6006 ********************************************************************/
6008 static BOOL
spoolss_io_addform(const char *desc
, FORM
*f
, uint32 ptr
, prs_struct
*ps
, int depth
)
6010 prs_debug(ps
, depth
, desc
, "spoolss_io_addform");
6017 if(!prs_uint32("flags", ps
, depth
, &f
->flags
))
6019 if(!prs_uint32("name_ptr", ps
, depth
, &f
->name_ptr
))
6021 if(!prs_uint32("size_x", ps
, depth
, &f
->size_x
))
6023 if(!prs_uint32("size_y", ps
, depth
, &f
->size_y
))
6025 if(!prs_uint32("left", ps
, depth
, &f
->left
))
6027 if(!prs_uint32("top", ps
, depth
, &f
->top
))
6029 if(!prs_uint32("right", ps
, depth
, &f
->right
))
6031 if(!prs_uint32("bottom", ps
, depth
, &f
->bottom
))
6034 if(!smb_io_unistr2("", &f
->name
, f
->name_ptr
, ps
, depth
))
6041 /*******************************************************************
6042 ********************************************************************/
6044 BOOL
spoolss_io_q_deleteform(const char *desc
, SPOOL_Q_DELETEFORM
*q_u
, prs_struct
*ps
, int depth
)
6046 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteform");
6051 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6053 if(!smb_io_unistr2("form name", &q_u
->name
, True
, ps
, depth
))
6059 /*******************************************************************
6060 ********************************************************************/
6062 BOOL
spoolss_io_r_deleteform(const char *desc
, SPOOL_R_DELETEFORM
*r_u
, prs_struct
*ps
, int depth
)
6064 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteform");
6069 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6075 /*******************************************************************
6076 ********************************************************************/
6078 BOOL
spoolss_io_q_addform(const char *desc
, SPOOL_Q_ADDFORM
*q_u
, prs_struct
*ps
, int depth
)
6080 uint32 useless_ptr
=1;
6081 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addform");
6086 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6088 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6090 if(!prs_uint32("level2", ps
, depth
, &q_u
->level2
))
6095 if(!prs_uint32("useless_ptr", ps
, depth
, &useless_ptr
))
6097 if(!spoolss_io_addform("", &q_u
->form
, useless_ptr
, ps
, depth
))
6104 /*******************************************************************
6105 ********************************************************************/
6107 BOOL
spoolss_io_r_addform(const char *desc
, SPOOL_R_ADDFORM
*r_u
, prs_struct
*ps
, int depth
)
6109 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addform");
6114 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6120 /*******************************************************************
6121 ********************************************************************/
6123 BOOL
spoolss_io_q_setform(const char *desc
, SPOOL_Q_SETFORM
*q_u
, prs_struct
*ps
, int depth
)
6125 uint32 useless_ptr
=1;
6126 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setform");
6131 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6133 if(!smb_io_unistr2("", &q_u
->name
, True
, ps
, depth
))
6139 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6141 if(!prs_uint32("level2", ps
, depth
, &q_u
->level2
))
6146 if(!prs_uint32("useless_ptr", ps
, depth
, &useless_ptr
))
6148 if(!spoolss_io_addform("", &q_u
->form
, useless_ptr
, ps
, depth
))
6155 /*******************************************************************
6156 ********************************************************************/
6158 BOOL
spoolss_io_r_setform(const char *desc
, SPOOL_R_SETFORM
*r_u
, prs_struct
*ps
, int depth
)
6160 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setform");
6165 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6171 /*******************************************************************
6172 Parse a SPOOL_R_GETJOB structure.
6173 ********************************************************************/
6175 BOOL
spoolss_io_r_getjob(const char *desc
, SPOOL_R_GETJOB
*r_u
, prs_struct
*ps
, int depth
)
6177 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getjob");
6183 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
6189 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6192 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6198 /*******************************************************************
6199 Parse a SPOOL_Q_GETJOB structure.
6200 ********************************************************************/
6202 BOOL
spoolss_io_q_getjob(const char *desc
, SPOOL_Q_GETJOB
*q_u
, prs_struct
*ps
, int depth
)
6204 prs_debug(ps
, depth
, desc
, "");
6210 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6212 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
6214 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6217 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
6223 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
6229 void free_devmode(DEVICEMODE
*devmode
)
6231 if (devmode
!=NULL
) {
6232 SAFE_FREE(devmode
->dev_private
);
6237 void free_printer_info_1(PRINTER_INFO_1
*printer
)
6242 void free_printer_info_2(PRINTER_INFO_2
*printer
)
6244 if (printer
!=NULL
) {
6245 free_devmode(printer
->devmode
);
6246 printer
->devmode
= NULL
;
6251 void free_printer_info_3(PRINTER_INFO_3
*printer
)
6256 void free_printer_info_4(PRINTER_INFO_4
*printer
)
6261 void free_printer_info_5(PRINTER_INFO_5
*printer
)
6266 void free_printer_info_7(PRINTER_INFO_7
*printer
)
6271 void free_job_info_2(JOB_INFO_2
*job
)
6274 free_devmode(job
->devmode
);
6277 /*******************************************************************
6279 ********************************************************************/
6281 BOOL
make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER
*q_u
,
6282 const fstring string
, uint32 printer
, uint32 type
)
6287 init_unistr2(&q_u
->string
, string
, UNI_STR_TERMINATE
);
6289 q_u
->printer
=printer
;
6298 /*******************************************************************
6299 Parse a SPOOL_Q_REPLYOPENPRINTER structure.
6300 ********************************************************************/
6302 BOOL
spoolss_io_q_replyopenprinter(const char *desc
, SPOOL_Q_REPLYOPENPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6304 prs_debug(ps
, depth
, desc
, "spoolss_io_q_replyopenprinter");
6310 if(!smb_io_unistr2("", &q_u
->string
, True
, ps
, depth
))
6316 if(!prs_uint32("printer", ps
, depth
, &q_u
->printer
))
6318 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
6321 if(!prs_uint32("unknown0", ps
, depth
, &q_u
->unknown0
))
6323 if(!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6329 /*******************************************************************
6330 Parse a SPOOL_R_REPLYOPENPRINTER structure.
6331 ********************************************************************/
6333 BOOL
spoolss_io_r_replyopenprinter(const char *desc
, SPOOL_R_REPLYOPENPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6335 prs_debug(ps
, depth
, desc
, "spoolss_io_r_replyopenprinter");
6341 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
6344 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6350 /*******************************************************************
6352 ********************************************************************/
6353 BOOL
make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER
*q_u
, POLICY_HND
*hnd
,
6354 uint32 condition
, uint32 change_id
)
6357 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6359 q_u
->condition
= condition
;
6360 q_u
->change_id
= change_id
;
6363 q_u
->unknown1
= 0x1;
6364 memset(q_u
->unknown2
, 0x0, 5);
6365 q_u
->unknown2
[0] = 0x1;
6370 /*******************************************************************
6371 Parse a SPOOL_Q_ROUTERREPLYPRINTER structure.
6372 ********************************************************************/
6373 BOOL
spoolss_io_q_routerreplyprinter (const char *desc
, SPOOL_Q_ROUTERREPLYPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6376 prs_debug(ps
, depth
, desc
, "spoolss_io_q_routerreplyprinter");
6382 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6385 if (!prs_uint32("condition", ps
, depth
, &q_u
->condition
))
6388 if (!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6391 if (!prs_uint32("change_id", ps
, depth
, &q_u
->change_id
))
6394 if (!prs_uint8s(False
, "dev_private", ps
, depth
, q_u
->unknown2
, 5))
6400 /*******************************************************************
6401 Parse a SPOOL_R_ROUTERREPLYPRINTER structure.
6402 ********************************************************************/
6403 BOOL
spoolss_io_r_routerreplyprinter (const char *desc
, SPOOL_R_ROUTERREPLYPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6405 prs_debug(ps
, depth
, desc
, "spoolss_io_r_routerreplyprinter");
6411 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6417 /*******************************************************************
6419 ********************************************************************/
6421 BOOL
make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER
*q_u
, POLICY_HND
*hnd
)
6426 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6431 /*******************************************************************
6432 Parse a SPOOL_Q_REPLYCLOSEPRINTER structure.
6433 ********************************************************************/
6435 BOOL
spoolss_io_q_replycloseprinter(const char *desc
, SPOOL_Q_REPLYCLOSEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6437 prs_debug(ps
, depth
, desc
, "spoolss_io_q_replycloseprinter");
6443 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6449 /*******************************************************************
6450 Parse a SPOOL_R_REPLYCLOSEPRINTER structure.
6451 ********************************************************************/
6453 BOOL
spoolss_io_r_replycloseprinter(const char *desc
, SPOOL_R_REPLYCLOSEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6455 prs_debug(ps
, depth
, desc
, "spoolss_io_r_replycloseprinter");
6461 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
6464 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6470 #if 0 /* JERRY - not currently used but could be :-) */
6472 /*******************************************************************
6473 Deep copy a SPOOL_NOTIFY_INFO_DATA structure
6474 ******************************************************************/
6475 static BOOL
copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA
*dst
,
6476 SPOOL_NOTIFY_INFO_DATA
*src
, int n
)
6480 memcpy(dst
, src
, sizeof(SPOOL_NOTIFY_INFO_DATA
)*n
);
6482 for (i
=0; i
<n
; i
++) {
6486 if (src
->size
!= POINTER
)
6488 len
= src
->notify_data
.data
.length
;
6489 s
= SMB_MALLOC_ARRAY(uint16
, len
);
6491 DEBUG(0,("copy_spool_notify_info_data: malloc() failed!\n"));
6495 memcpy(s
, src
->notify_data
.data
.string
, len
*2);
6496 dst
->notify_data
.data
.string
= s
;
6502 /*******************************************************************
6503 Deep copy a SPOOL_NOTIFY_INFO structure
6504 ******************************************************************/
6505 static BOOL
copy_spool_notify_info(SPOOL_NOTIFY_INFO
*dst
, SPOOL_NOTIFY_INFO
*src
)
6508 DEBUG(0,("copy_spool_notify_info: NULL destination pointer!\n"));
6512 dst
->version
= src
->version
;
6513 dst
->flags
= src
->flags
;
6514 dst
->count
= src
->count
;
6518 dst
->data
= SMB_MALLOC_ARRAY(SPOOL_NOTIFY_INFO_DATA
, dst
->count
);
6520 DEBUG(10,("copy_spool_notify_info: allocating space for [%d] PRINTER_NOTIFY_INFO_DATA entries\n",
6523 if (dst
->data
== NULL
) {
6524 DEBUG(0,("copy_spool_notify_info: malloc() failed for [%d] entries!\n",
6529 return (copy_spool_notify_info_data(dst
->data
, src
->data
, src
->count
));
6536 /*******************************************************************
6538 ********************************************************************/
6540 BOOL
make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN
*q_u
, POLICY_HND
*hnd
,
6541 uint32 change_low
, uint32 change_high
,
6542 SPOOL_NOTIFY_INFO
*info
)
6547 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6549 q_u
->change_low
=change_low
;
6550 q_u
->change_high
=change_high
;
6555 q_u
->info_ptr
=0x0FF0ADDE;
6557 q_u
->info
.version
=2;
6560 DEBUG(10,("make_spoolss_q_reply_rrpcn: [%d] PRINTER_NOTIFY_INFO_DATA\n",
6562 q_u
->info
.version
= info
->version
;
6563 q_u
->info
.flags
= info
->flags
;
6564 q_u
->info
.count
= info
->count
;
6565 /* pointer field - be careful! */
6566 q_u
->info
.data
= info
->data
;
6569 q_u
->info
.flags
=PRINTER_NOTIFY_INFO_DISCARDED
;
6576 /*******************************************************************
6577 Parse a SPOOL_Q_REPLY_RRPCN structure.
6578 ********************************************************************/
6580 BOOL
spoolss_io_q_reply_rrpcn(const char *desc
, SPOOL_Q_REPLY_RRPCN
*q_u
, prs_struct
*ps
, int depth
)
6582 prs_debug(ps
, depth
, desc
, "spoolss_io_q_reply_rrpcn");
6588 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6591 if (!prs_uint32("change_low", ps
, depth
, &q_u
->change_low
))
6594 if (!prs_uint32("change_high", ps
, depth
, &q_u
->change_high
))
6597 if (!prs_uint32("unknown0", ps
, depth
, &q_u
->unknown0
))
6600 if (!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6603 if (!prs_uint32("info_ptr", ps
, depth
, &q_u
->info_ptr
))
6606 if(q_u
->info_ptr
!=0)
6607 if(!smb_io_notify_info(desc
, &q_u
->info
, ps
, depth
))
6613 /*******************************************************************
6614 Parse a SPOOL_R_REPLY_RRPCN structure.
6615 ********************************************************************/
6617 BOOL
spoolss_io_r_reply_rrpcn(const char *desc
, SPOOL_R_REPLY_RRPCN
*r_u
, prs_struct
*ps
, int depth
)
6619 prs_debug(ps
, depth
, desc
, "spoolss_io_r_reply_rrpcn");
6625 if (!prs_uint32("unknown0", ps
, depth
, &r_u
->unknown0
))
6628 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6634 /*******************************************************************
6636 * called from spoolss_q_getprinterdataex (srv_spoolss.c)
6637 ********************************************************************/
6639 BOOL
spoolss_io_q_getprinterdataex(const char *desc
, SPOOL_Q_GETPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6644 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdataex");
6649 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6653 if (!smb_io_unistr2("keyname", &q_u
->keyname
,True
,ps
,depth
))
6657 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
6661 if (!prs_uint32("size", ps
, depth
, &q_u
->size
))
6667 /*******************************************************************
6668 * write a structure.
6669 * called from spoolss_r_getprinterdataex (srv_spoolss.c)
6670 ********************************************************************/
6672 BOOL
spoolss_io_r_getprinterdataex(const char *desc
, SPOOL_R_GETPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6677 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdataex");
6682 if (!prs_uint32("type", ps
, depth
, &r_u
->type
))
6684 if (!prs_uint32("size", ps
, depth
, &r_u
->size
))
6687 if (UNMARSHALLING(ps
) && r_u
->size
) {
6688 r_u
->data
= PRS_ALLOC_MEM(ps
, unsigned char, r_u
->size
);
6693 if (!prs_uint8s(False
,"data", ps
, depth
, r_u
->data
, r_u
->size
))
6699 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6701 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6707 /*******************************************************************
6709 ********************************************************************/
6711 BOOL
spoolss_io_q_setprinterdataex(const char *desc
, SPOOL_Q_SETPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6713 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinterdataex");
6718 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6720 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6726 if(!smb_io_unistr2("", &q_u
->value
, True
, ps
, depth
))
6732 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
6735 if(!prs_uint32("max_len", ps
, depth
, &q_u
->max_len
))
6745 if (UNMARSHALLING(ps
))
6746 q_u
->data
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->max_len
);
6747 if(q_u
->data
== NULL
)
6749 if(!prs_uint8s(False
,"data", ps
, depth
, q_u
->data
, q_u
->max_len
))
6757 if(!prs_uint32("real_len", ps
, depth
, &q_u
->real_len
))
6763 /*******************************************************************
6764 * write a structure.
6765 ********************************************************************/
6767 BOOL
spoolss_io_r_setprinterdataex(const char *desc
, SPOOL_R_SETPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6769 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinterdataex");
6774 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6780 /*******************************************************************
6782 ********************************************************************/
6783 BOOL
make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY
*q_u
,
6784 POLICY_HND
*hnd
, const char *key
,
6787 DEBUG(5,("make_spoolss_q_enumprinterkey\n"));
6789 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6790 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
6796 /*******************************************************************
6798 ********************************************************************/
6800 BOOL
spoolss_io_q_enumprinterkey(const char *desc
, SPOOL_Q_ENUMPRINTERKEY
*q_u
, prs_struct
*ps
, int depth
)
6802 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterkey");
6807 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6810 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6816 if(!prs_uint32("size", ps
, depth
, &q_u
->size
))
6822 /*******************************************************************
6823 * write a structure.
6824 ********************************************************************/
6826 BOOL
spoolss_io_r_enumprinterkey(const char *desc
, SPOOL_R_ENUMPRINTERKEY
*r_u
, prs_struct
*ps
, int depth
)
6828 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterkey");
6834 if (!smb_io_buffer5("", &r_u
->keys
, ps
, depth
))
6840 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6843 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6849 /*******************************************************************
6851 ********************************************************************/
6853 BOOL
make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY
*q_u
,
6854 POLICY_HND
*hnd
, char *keyname
)
6856 DEBUG(5,("make_spoolss_q_deleteprinterkey\n"));
6858 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6859 init_unistr2(&q_u
->keyname
, keyname
, UNI_STR_TERMINATE
);
6864 /*******************************************************************
6866 ********************************************************************/
6868 BOOL
spoolss_io_q_deleteprinterkey(const char *desc
, SPOOL_Q_DELETEPRINTERKEY
*q_u
, prs_struct
*ps
, int depth
)
6870 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterkey");
6875 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6878 if(!smb_io_unistr2("", &q_u
->keyname
, True
, ps
, depth
))
6884 /*******************************************************************
6885 * write a structure.
6886 ********************************************************************/
6888 BOOL
spoolss_io_r_deleteprinterkey(const char *desc
, SPOOL_R_DELETEPRINTERKEY
*r_u
, prs_struct
*ps
, int depth
)
6890 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterkey");
6896 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6903 /*******************************************************************
6905 ********************************************************************/
6907 BOOL
spoolss_io_q_enumprinterdataex(const char *desc
, SPOOL_Q_ENUMPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6909 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdataex");
6914 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6917 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6923 if(!prs_uint32("size", ps
, depth
, &q_u
->size
))
6929 /*******************************************************************
6930 ********************************************************************/
6932 static BOOL
spoolss_io_printer_enum_values_ctr(const char *desc
, prs_struct
*ps
,
6933 PRINTER_ENUM_VALUES_CTR
*ctr
, int depth
)
6936 uint32 valuename_offset
,
6939 const uint32 basic_unit
= 20; /* size of static portion of enum_values */
6941 prs_debug(ps
, depth
, desc
, "spoolss_io_printer_enum_values_ctr");
6945 * offset data begins at 20 bytes per structure * size_of_array.
6946 * Don't forget the uint32 at the beginning
6949 current_offset
= basic_unit
* ctr
->size_of_array
;
6951 /* first loop to write basic enum_value information */
6953 if (UNMARSHALLING(ps
)) {
6954 ctr
->values
= PRS_ALLOC_MEM(ps
, PRINTER_ENUM_VALUES
, ctr
->size_of_array
);
6959 for (i
=0; i
<ctr
->size_of_array
; i
++) {
6960 valuename_offset
= current_offset
;
6961 if (!prs_uint32("valuename_offset", ps
, depth
, &valuename_offset
))
6964 if (!prs_uint32("value_len", ps
, depth
, &ctr
->values
[i
].value_len
))
6967 if (!prs_uint32("type", ps
, depth
, &ctr
->values
[i
].type
))
6970 data_offset
= ctr
->values
[i
].value_len
+ valuename_offset
;
6972 if (!prs_uint32("data_offset", ps
, depth
, &data_offset
))
6975 if (!prs_uint32("data_len", ps
, depth
, &ctr
->values
[i
].data_len
))
6978 current_offset
= data_offset
+ ctr
->values
[i
].data_len
- basic_unit
;
6979 /* account for 2 byte alignment */
6980 current_offset
+= (current_offset
% 2);
6984 * loop #2 for writing the dynamically size objects; pay
6985 * attention to 2-byte alignment here....
6988 for (i
=0; i
<ctr
->size_of_array
; i
++) {
6990 if (!prs_unistr("valuename", ps
, depth
, &ctr
->values
[i
].valuename
))
6993 if ( ctr
->values
[i
].data_len
) {
6994 if ( UNMARSHALLING(ps
) ) {
6995 ctr
->values
[i
].data
= PRS_ALLOC_MEM(ps
, uint8
, ctr
->values
[i
].data_len
);
6996 if (!ctr
->values
[i
].data
)
6999 if (!prs_uint8s(False
, "data", ps
, depth
, ctr
->values
[i
].data
, ctr
->values
[i
].data_len
))
7003 if ( !prs_align_uint16(ps
) )
7010 /*******************************************************************
7011 * write a structure.
7012 ********************************************************************/
7014 BOOL
spoolss_io_r_enumprinterdataex(const char *desc
, SPOOL_R_ENUMPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
7016 uint32 data_offset
, end_offset
;
7017 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdataex");
7023 if (!prs_uint32("size", ps
, depth
, &r_u
->ctr
.size
))
7026 data_offset
= prs_offset(ps
);
7028 if (!prs_set_offset(ps
, data_offset
+ r_u
->ctr
.size
))
7034 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7037 if(!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
7040 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7043 r_u
->ctr
.size_of_array
= r_u
->returned
;
7045 end_offset
= prs_offset(ps
);
7047 if (!prs_set_offset(ps
, data_offset
))
7051 if (!spoolss_io_printer_enum_values_ctr("", ps
, &r_u
->ctr
, depth
))
7054 if (!prs_set_offset(ps
, end_offset
))
7059 /*******************************************************************
7060 * write a structure.
7061 ********************************************************************/
7064 uint32 GetPrintProcessorDirectory(
7066 [in] unistr2 *environment,
7068 [in,out] RPC_BUFFER buffer,
7069 [in] uint32 offered,
7070 [out] uint32 needed,
7071 [out] uint32 returned
7076 BOOL
make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY
*q_u
, const char *name
, char *environment
, int level
, RPC_BUFFER
*buffer
, uint32 offered
)
7078 DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n"));
7080 init_unistr2(&q_u
->name
, name
, UNI_STR_TERMINATE
);
7081 init_unistr2(&q_u
->environment
, environment
, UNI_STR_TERMINATE
);
7085 q_u
->buffer
= buffer
;
7086 q_u
->offered
= offered
;
7091 BOOL
spoolss_io_q_getprintprocessordirectory(const char *desc
, SPOOL_Q_GETPRINTPROCESSORDIRECTORY
*q_u
, prs_struct
*ps
, int depth
)
7095 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprintprocessordirectory");
7101 if (!prs_uint32("ptr", ps
, depth
, &ptr
))
7105 if(!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
7112 if (!prs_uint32("ptr", ps
, depth
, &ptr
))
7116 if(!smb_io_unistr2("environment", &q_u
->environment
, True
,
7124 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
7127 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
7133 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
7139 /*******************************************************************
7140 * write a structure.
7141 ********************************************************************/
7143 BOOL
spoolss_io_r_getprintprocessordirectory(const char *desc
, SPOOL_R_GETPRINTPROCESSORDIRECTORY
*r_u
, prs_struct
*ps
, int depth
)
7145 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprintprocessordirectory");
7151 if(!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
7157 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7160 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7166 BOOL
smb_io_printprocessordirectory_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCESSOR_DIRECTORY_1
*info
, int depth
)
7168 prs_struct
*ps
=&buffer
->prs
;
7170 prs_debug(ps
, depth
, desc
, "smb_io_printprocessordirectory_1");
7173 buffer
->struct_start
=prs_offset(ps
);
7175 if (!smb_io_unistr(desc
, &info
->name
, ps
, depth
))
7181 /*******************************************************************
7183 ********************************************************************/
7185 BOOL
make_spoolss_q_addform(SPOOL_Q_ADDFORM
*q_u
, POLICY_HND
*handle
,
7186 int level
, FORM
*form
)
7188 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7190 q_u
->level2
= level
;
7191 memcpy(&q_u
->form
, form
, sizeof(FORM
));
7196 /*******************************************************************
7198 ********************************************************************/
7200 BOOL
make_spoolss_q_setform(SPOOL_Q_SETFORM
*q_u
, POLICY_HND
*handle
,
7201 int level
, const char *form_name
, FORM
*form
)
7203 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7205 q_u
->level2
= level
;
7206 memcpy(&q_u
->form
, form
, sizeof(FORM
));
7207 init_unistr2(&q_u
->name
, form_name
, UNI_STR_TERMINATE
);
7212 /*******************************************************************
7214 ********************************************************************/
7216 BOOL
make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM
*q_u
, POLICY_HND
*handle
,
7219 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7220 init_unistr2(&q_u
->name
, form
, UNI_STR_TERMINATE
);
7224 /*******************************************************************
7226 ********************************************************************/
7228 BOOL
make_spoolss_q_getform(SPOOL_Q_GETFORM
*q_u
, POLICY_HND
*handle
,
7229 const char *formname
, uint32 level
,
7230 RPC_BUFFER
*buffer
, uint32 offered
)
7232 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7234 init_unistr2(&q_u
->formname
, formname
, UNI_STR_TERMINATE
);
7236 q_u
->offered
=offered
;
7241 /*******************************************************************
7243 ********************************************************************/
7245 BOOL
make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS
*q_u
, POLICY_HND
*handle
,
7246 uint32 level
, RPC_BUFFER
*buffer
,
7249 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7252 q_u
->offered
=offered
;
7257 /*******************************************************************
7259 ********************************************************************/
7261 BOOL
make_spoolss_q_setjob(SPOOL_Q_SETJOB
*q_u
, POLICY_HND
*handle
,
7262 uint32 jobid
, uint32 level
, uint32 command
)
7264 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7268 /* Hmm - the SPOOL_Q_SETJOB structure has a JOB_INFO ctr in it but
7269 the server side code has it marked as unused. */
7271 q_u
->command
= command
;
7276 /*******************************************************************
7278 ********************************************************************/
7280 BOOL
make_spoolss_q_getjob(SPOOL_Q_GETJOB
*q_u
, POLICY_HND
*handle
,
7281 uint32 jobid
, uint32 level
, RPC_BUFFER
*buffer
,
7284 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7287 q_u
->buffer
= buffer
;
7288 q_u
->offered
= offered
;
7293 /*******************************************************************
7295 ********************************************************************/
7297 BOOL
make_spoolss_q_startpageprinter(SPOOL_Q_STARTPAGEPRINTER
*q_u
,
7300 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7305 /*******************************************************************
7307 ********************************************************************/
7309 BOOL
make_spoolss_q_endpageprinter(SPOOL_Q_ENDPAGEPRINTER
*q_u
,
7312 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7317 /*******************************************************************
7319 ********************************************************************/
7321 BOOL
make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER
*q_u
,
7322 POLICY_HND
*handle
, uint32 level
,
7323 char *docname
, char *outputfile
,
7326 DOC_INFO_CONTAINER
*ctr
= &q_u
->doc_info_container
;
7328 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7334 ctr
->docinfo
.switch_value
= level
;
7336 ctr
->docinfo
.doc_info_1
.p_docname
= docname
? 1 : 0;
7337 ctr
->docinfo
.doc_info_1
.p_outputfile
= outputfile
? 1 : 0;
7338 ctr
->docinfo
.doc_info_1
.p_datatype
= datatype
? 1 : 0;
7340 init_unistr2(&ctr
->docinfo
.doc_info_1
.docname
, docname
, UNI_STR_TERMINATE
);
7341 init_unistr2(&ctr
->docinfo
.doc_info_1
.outputfile
, outputfile
, UNI_STR_TERMINATE
);
7342 init_unistr2(&ctr
->docinfo
.doc_info_1
.datatype
, datatype
, UNI_STR_TERMINATE
);
7346 /* DOC_INFO_2 is only used by Windows 9x and since it
7347 doesn't do printing over RPC we don't have to worry
7350 DEBUG(3, ("unsupported info level %d\n", level
));
7357 /*******************************************************************
7359 ********************************************************************/
7361 BOOL
make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER
*q_u
,
7364 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7369 /*******************************************************************
7371 ********************************************************************/
7373 BOOL
make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER
*q_u
,
7374 POLICY_HND
*handle
, uint32 data_size
,
7377 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7378 q_u
->buffer_size
= q_u
->buffer_size2
= data_size
;
7379 q_u
->buffer
= (unsigned char *)data
;
7383 /*******************************************************************
7385 ********************************************************************/
7387 BOOL
make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA
*q_u
,
7388 POLICY_HND
*handle
, char *valuename
)
7390 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7391 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
7396 /*******************************************************************
7398 ********************************************************************/
7400 BOOL
make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX
*q_u
,
7401 POLICY_HND
*handle
, char *key
,
7404 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7405 init_unistr2(&q_u
->valuename
, value
, UNI_STR_TERMINATE
);
7406 init_unistr2(&q_u
->keyname
, key
, UNI_STR_TERMINATE
);
7411 /*******************************************************************
7413 ********************************************************************/
7415 BOOL
make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX
*q_u
, POLICY_HND
*handle
,
7416 uint32 flags
, uint32 options
, const char *localmachine
,
7417 uint32 printerlocal
, SPOOL_NOTIFY_OPTION
*option
)
7419 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7422 q_u
->options
= options
;
7424 q_u
->localmachine_ptr
= 1;
7426 init_unistr2(&q_u
->localmachine
, localmachine
, UNI_STR_TERMINATE
);
7428 q_u
->printerlocal
= printerlocal
;
7431 q_u
->option_ptr
= 1;
7433 q_u
->option
= option
;
7439 /*******************************************************************
7440 ********************************************************************/
7442 BOOL
spoolss_io_q_xcvdataport(const char *desc
, SPOOL_Q_XCVDATAPORT
*q_u
, prs_struct
*ps
, int depth
)
7444 prs_debug(ps
, depth
, desc
, "spoolss_io_q_xcvdataport");
7450 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
7453 if(!smb_io_unistr2("", &q_u
->dataname
, True
, ps
, depth
))
7459 if(!prs_rpcbuffer("", ps
, depth
, &q_u
->indata
))
7465 if (!prs_uint32("indata_len", ps
, depth
, &q_u
->indata_len
))
7467 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
7469 if (!prs_uint32("unknown", ps
, depth
, &q_u
->unknown
))
7475 /*******************************************************************
7476 ********************************************************************/
7478 BOOL
spoolss_io_r_xcvdataport(const char *desc
, SPOOL_R_XCVDATAPORT
*r_u
, prs_struct
*ps
, int depth
)
7480 prs_debug(ps
, depth
, desc
, "spoolss_io_r_xcvdataport");
7485 if(!prs_rpcbuffer("", ps
, depth
, &r_u
->outdata
))
7491 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7493 if (!prs_uint32("unknown", ps
, depth
, &r_u
->unknown
))
7496 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7502 /*******************************************************************
7503 ********************************************************************/
7505 BOOL
make_monitorui_buf( RPC_BUFFER
*buf
, const char *dllname
)
7512 init_unistr( &string
, dllname
);
7514 if ( !prs_unistr( "ui_dll", &buf
->prs
, 0, &string
) )
7520 /*******************************************************************
7521 ********************************************************************/
7523 #define PORT_DATA_1_PAD 540
7525 static BOOL
smb_io_port_data_1( const char *desc
, RPC_BUFFER
*buf
, int depth
, SPOOL_PORT_DATA_1
*p1
)
7527 prs_struct
*ps
= &buf
->prs
;
7528 uint8 padding
[PORT_DATA_1_PAD
];
7530 prs_debug(ps
, depth
, desc
, "smb_io_port_data_1");
7536 if( !prs_uint16s(True
, "portname", ps
, depth
, p1
->portname
, MAX_PORTNAME
))
7539 if (!prs_uint32("version", ps
, depth
, &p1
->version
))
7541 if (!prs_uint32("protocol", ps
, depth
, &p1
->protocol
))
7543 if (!prs_uint32("size", ps
, depth
, &p1
->size
))
7545 if (!prs_uint32("reserved", ps
, depth
, &p1
->reserved
))
7548 if( !prs_uint16s(True
, "hostaddress", ps
, depth
, p1
->hostaddress
, MAX_NETWORK_NAME
))
7550 if( !prs_uint16s(True
, "snmpcommunity", ps
, depth
, p1
->snmpcommunity
, MAX_SNMP_COMM_NAME
))
7553 if (!prs_uint32("dblspool", ps
, depth
, &p1
->dblspool
))
7556 if( !prs_uint16s(True
, "queue", ps
, depth
, p1
->queue
, MAX_QUEUE_NAME
))
7558 if( !prs_uint16s(True
, "ipaddress", ps
, depth
, p1
->ipaddress
, MAX_IPADDR_STRING
))
7561 if( !prs_uint8s(False
, "", ps
, depth
, padding
, PORT_DATA_1_PAD
))
7564 if (!prs_uint32("port", ps
, depth
, &p1
->port
))
7566 if (!prs_uint32("snmpenabled", ps
, depth
, &p1
->snmpenabled
))
7568 if (!prs_uint32("snmpdevindex", ps
, depth
, &p1
->snmpdevindex
))
7574 /*******************************************************************
7575 ********************************************************************/
7577 BOOL
convert_port_data_1( NT_PORT_DATA_1
*port1
, RPC_BUFFER
*buf
)
7579 SPOOL_PORT_DATA_1 spdata_1
;
7581 ZERO_STRUCT( spdata_1
);
7583 if ( !smb_io_port_data_1( "port_data_1", buf
, 0, &spdata_1
) )
7586 rpcstr_pull(port1
->name
, spdata_1
.portname
, sizeof(port1
->name
), -1, 0);
7587 rpcstr_pull(port1
->queue
, spdata_1
.queue
, sizeof(port1
->queue
), -1, 0);
7588 rpcstr_pull(port1
->hostaddr
, spdata_1
.hostaddress
, sizeof(port1
->hostaddr
), -1, 0);
7590 port1
->port
= spdata_1
.port
;
7592 switch ( spdata_1
.protocol
) {
7594 port1
->protocol
= PORT_PROTOCOL_DIRECT
;
7597 port1
->protocol
= PORT_PROTOCOL_LPR
;
7600 DEBUG(3,("convert_port_data_1: unknown protocol [%d]!\n",
7601 spdata_1
.protocol
));