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 3 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, see <http://www.gnu.org/licenses/>.
27 #define DBGC_CLASS DBGC_RPC_PARSE
30 /*******************************************************************
31 This should be moved in a more generic lib.
32 ********************************************************************/
34 bool spoolss_io_system_time(const char *desc
, prs_struct
*ps
, int depth
, SYSTEMTIME
*systime
)
36 if(!prs_uint16("year", ps
, depth
, &systime
->year
))
38 if(!prs_uint16("month", ps
, depth
, &systime
->month
))
40 if(!prs_uint16("dayofweek", ps
, depth
, &systime
->dayofweek
))
42 if(!prs_uint16("day", ps
, depth
, &systime
->day
))
44 if(!prs_uint16("hour", ps
, depth
, &systime
->hour
))
46 if(!prs_uint16("minute", ps
, depth
, &systime
->minute
))
48 if(!prs_uint16("second", ps
, depth
, &systime
->second
))
50 if(!prs_uint16("milliseconds", ps
, depth
, &systime
->milliseconds
))
56 /*******************************************************************
57 ********************************************************************/
59 bool make_systemtime(SYSTEMTIME
*systime
, struct tm
*unixtime
)
61 systime
->year
=unixtime
->tm_year
+1900;
62 systime
->month
=unixtime
->tm_mon
+1;
63 systime
->dayofweek
=unixtime
->tm_wday
;
64 systime
->day
=unixtime
->tm_mday
;
65 systime
->hour
=unixtime
->tm_hour
;
66 systime
->minute
=unixtime
->tm_min
;
67 systime
->second
=unixtime
->tm_sec
;
68 systime
->milliseconds
=0;
73 /*******************************************************************
74 reads or writes an DOC_INFO structure.
75 ********************************************************************/
77 static bool smb_io_doc_info_1(const char *desc
, DOC_INFO_1
*info_1
, prs_struct
*ps
, int depth
)
79 if (info_1
== NULL
) return False
;
81 prs_debug(ps
, depth
, desc
, "smb_io_doc_info_1");
87 if(!prs_uint32("p_docname", ps
, depth
, &info_1
->p_docname
))
89 if(!prs_uint32("p_outputfile", ps
, depth
, &info_1
->p_outputfile
))
91 if(!prs_uint32("p_datatype", ps
, depth
, &info_1
->p_datatype
))
94 if(!smb_io_unistr2("", &info_1
->docname
, info_1
->p_docname
, ps
, depth
))
96 if(!smb_io_unistr2("", &info_1
->outputfile
, info_1
->p_outputfile
, ps
, depth
))
98 if(!smb_io_unistr2("", &info_1
->datatype
, info_1
->p_datatype
, ps
, depth
))
104 /*******************************************************************
105 reads or writes an DOC_INFO structure.
106 ********************************************************************/
108 static bool smb_io_doc_info(const char *desc
, DOC_INFO
*info
, prs_struct
*ps
, int depth
)
110 uint32 useless_ptr
=0;
112 if (info
== NULL
) return False
;
114 prs_debug(ps
, depth
, desc
, "smb_io_doc_info");
120 if(!prs_uint32("switch_value", ps
, depth
, &info
->switch_value
))
123 if(!prs_uint32("doc_info_X ptr", ps
, depth
, &useless_ptr
))
126 switch (info
->switch_value
)
129 if(!smb_io_doc_info_1("",&info
->doc_info_1
, ps
, depth
))
134 this is just a placeholder
136 MSDN July 1998 says doc_info_2 is only on
137 Windows 95, and as Win95 doesn't do RPC to print
138 this case is nearly impossible
140 Maybe one day with Windows for dishwasher 2037 ...
143 /* smb_io_doc_info_2("",&info->doc_info_2, ps, depth); */
146 DEBUG(0,("Something is obviously wrong somewhere !\n"));
153 /*******************************************************************
154 reads or writes an DOC_INFO_CONTAINER structure.
155 ********************************************************************/
157 static bool smb_io_doc_info_container(const char *desc
, DOC_INFO_CONTAINER
*cont
, prs_struct
*ps
, int depth
)
159 if (cont
== NULL
) return False
;
161 prs_debug(ps
, depth
, desc
, "smb_io_doc_info_container");
167 if(!prs_uint32("level", ps
, depth
, &cont
->level
))
170 if(!smb_io_doc_info("",&cont
->docinfo
, ps
, depth
))
176 /*******************************************************************
177 reads or writes an NOTIFY OPTION TYPE structure.
178 ********************************************************************/
180 /* NOTIFY_OPTION_TYPE and NOTIFY_OPTION_TYPE_DATA are really one
181 structure. The _TYPE structure is really the deferred referrants (i.e
182 the notify fields array) of the _TYPE structure. -tpot */
184 static bool smb_io_notify_option_type(const char *desc
, SPOOL_NOTIFY_OPTION_TYPE
*type
, prs_struct
*ps
, int depth
)
186 prs_debug(ps
, depth
, desc
, "smb_io_notify_option_type");
192 if(!prs_uint16("type", ps
, depth
, &type
->type
))
194 if(!prs_uint16("reserved0", ps
, depth
, &type
->reserved0
))
196 if(!prs_uint32("reserved1", ps
, depth
, &type
->reserved1
))
198 if(!prs_uint32("reserved2", ps
, depth
, &type
->reserved2
))
200 if(!prs_uint32("count", ps
, depth
, &type
->count
))
202 if(!prs_uint32("fields_ptr", ps
, depth
, &type
->fields_ptr
))
208 /*******************************************************************
209 reads or writes an NOTIFY OPTION TYPE DATA.
210 ********************************************************************/
212 static bool smb_io_notify_option_type_data(const char *desc
, SPOOL_NOTIFY_OPTION_TYPE
*type
, prs_struct
*ps
, int depth
)
216 prs_debug(ps
, depth
, desc
, "smb_io_notify_option_type_data");
219 /* if there are no fields just return */
220 if (type
->fields_ptr
==0)
226 if(!prs_uint32("count2", ps
, depth
, &type
->count2
))
229 if (type
->count2
!= type
->count
)
230 DEBUG(4,("What a mess, count was %x now is %x !\n", type
->count
, type
->count2
));
232 if (type
->count2
> MAX_NOTIFY_TYPE_FOR_NOW
) {
236 /* parse the option type data */
237 for(i
=0;i
<type
->count2
;i
++)
238 if(!prs_uint16("fields",ps
,depth
,&type
->fields
[i
]))
243 /*******************************************************************
244 reads or writes an NOTIFY OPTION structure.
245 ********************************************************************/
247 static bool smb_io_notify_option_type_ctr(const char *desc
, SPOOL_NOTIFY_OPTION_TYPE_CTR
*ctr
, prs_struct
*ps
, int depth
)
251 prs_debug(ps
, depth
, desc
, "smb_io_notify_option_type_ctr");
254 if(!prs_uint32("count", ps
, depth
, &ctr
->count
))
258 if (UNMARSHALLING(ps
) && ctr
->count
)
259 if((ctr
->type
=PRS_ALLOC_MEM(ps
,SPOOL_NOTIFY_OPTION_TYPE
,ctr
->count
)) == NULL
)
262 /* the option type struct */
263 for(i
=0;i
<ctr
->count
;i
++)
264 if(!smb_io_notify_option_type("", &ctr
->type
[i
] , ps
, depth
))
267 /* the type associated with the option type struct */
268 for(i
=0;i
<ctr
->count
;i
++)
269 if(!smb_io_notify_option_type_data("", &ctr
->type
[i
] , ps
, depth
))
275 /*******************************************************************
276 reads or writes an NOTIFY OPTION structure.
277 ********************************************************************/
279 static bool smb_io_notify_option(const char *desc
, SPOOL_NOTIFY_OPTION
*option
, prs_struct
*ps
, int depth
)
281 prs_debug(ps
, depth
, desc
, "smb_io_notify_option");
284 if(!prs_uint32("version", ps
, depth
, &option
->version
))
286 if(!prs_uint32("flags", ps
, depth
, &option
->flags
))
288 if(!prs_uint32("count", ps
, depth
, &option
->count
))
290 if(!prs_uint32("option_type_ptr", ps
, depth
, &option
->option_type_ptr
))
293 /* marshalling or unmarshalling, that would work */
294 if (option
->option_type_ptr
!=0) {
295 if(!smb_io_notify_option_type_ctr("", &option
->ctr
,ps
, depth
))
299 option
->ctr
.type
=NULL
;
306 /*******************************************************************
307 reads or writes an NOTIFY INFO DATA structure.
308 ********************************************************************/
310 static bool smb_io_notify_info_data(const char *desc
,SPOOL_NOTIFY_INFO_DATA
*data
, prs_struct
*ps
, int depth
)
312 uint32 useless_ptr
=0x0FF0ADDE;
314 prs_debug(ps
, depth
, desc
, "smb_io_notify_info_data");
319 if(!prs_uint16("type", ps
, depth
, &data
->type
))
321 if(!prs_uint16("field", ps
, depth
, &data
->field
))
324 if(!prs_uint32("how many words", ps
, depth
, &data
->size
))
326 if(!prs_uint32("id", ps
, depth
, &data
->id
))
328 if(!prs_uint32("how many words", ps
, depth
, &data
->size
))
331 switch (data
->enc_type
) {
333 /* One and two value data has two uint32 values */
335 case NOTIFY_ONE_VALUE
:
336 case NOTIFY_TWO_VALUE
:
338 if(!prs_uint32("value[0]", ps
, depth
, &data
->notify_data
.value
[0]))
340 if(!prs_uint32("value[1]", ps
, depth
, &data
->notify_data
.value
[1]))
344 /* Pointers and strings have a string length and a
345 pointer. For a string the length is expressed as
346 the number of uint16 characters plus a trailing
351 if(!prs_uint32("string length", ps
, depth
, &data
->notify_data
.data
.length
))
353 if(!prs_uint32("pointer", ps
, depth
, &useless_ptr
))
360 if(!prs_uint32("string length", ps
, depth
, &data
->notify_data
.data
.length
))
363 if(!prs_uint32("pointer", ps
, depth
, &useless_ptr
))
369 if( !prs_uint32( "sd size", ps
, depth
, &data
->notify_data
.sd
.size
) )
371 if( !prs_uint32( "pointer", ps
, depth
, &useless_ptr
) )
377 DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data\n",
385 /*******************************************************************
386 reads or writes an NOTIFY INFO DATA structure.
387 ********************************************************************/
389 bool smb_io_notify_info_data_strings(const char *desc
,SPOOL_NOTIFY_INFO_DATA
*data
,
390 prs_struct
*ps
, int depth
)
392 prs_debug(ps
, depth
, desc
, "smb_io_notify_info_data_strings");
398 switch(data
->enc_type
) {
400 /* No data for values */
402 case NOTIFY_ONE_VALUE
:
403 case NOTIFY_TWO_VALUE
:
407 /* Strings start with a length in uint16s */
412 data
->notify_data
.data
.length
/= 2;
414 if(!prs_uint32("string length", ps
, depth
, &data
->notify_data
.data
.length
))
417 if (UNMARSHALLING(ps
) && data
->notify_data
.data
.length
) {
418 data
->notify_data
.data
.string
= PRS_ALLOC_MEM(ps
, uint16
,
419 data
->notify_data
.data
.length
);
421 if (!data
->notify_data
.data
.string
)
425 if (!prs_uint16uni(True
, "string", ps
, depth
, data
->notify_data
.data
.string
,
426 data
->notify_data
.data
.length
))
430 data
->notify_data
.data
.length
*= 2;
436 if (UNMARSHALLING(ps
) && data
->notify_data
.data
.length
) {
437 data
->notify_data
.data
.string
= PRS_ALLOC_MEM(ps
, uint16
,
438 data
->notify_data
.data
.length
);
440 if (!data
->notify_data
.data
.string
)
444 if(!prs_uint8s(True
,"buffer",ps
,depth
,(uint8
*)data
->notify_data
.data
.string
,data
->notify_data
.data
.length
))
450 if( !prs_uint32("secdesc size ", ps
, depth
, &data
->notify_data
.sd
.size
) )
452 if ( !sec_io_desc( "sec_desc", &data
->notify_data
.sd
.desc
, ps
, depth
) )
457 DEBUG(3, ("invalid enc_type %d for smb_io_notify_info_data_strings\n",
463 if (isvalue
==False
) {
465 /* length of string in unicode include \0 */
466 x
=data
->notify_data
.data
.length
+1;
468 if (data
->field
!= 16)
469 if(!prs_uint32("string length", ps
, depth
, &x
))
472 if (MARSHALLING(ps
)) {
473 /* These are already in little endian format. Don't byte swap. */
476 /* No memory allocated for this string
477 therefore following the data.string
478 pointer is a bad idea. Use a pointer to
479 the uint32 length union member to
480 provide a source for a unicode NULL */
482 if(!prs_uint8s(True
,"string",ps
,depth
, (uint8
*)&data
->notify_data
.data
.length
,x
*2))
486 if (data
->field
== 16)
489 if(!prs_uint16uni(True
,"string",ps
,depth
,data
->notify_data
.data
.string
,x
))
494 /* Tallocate memory for string */
497 data
->notify_data
.data
.string
= PRS_ALLOC_MEM(ps
, uint16
, x
* 2);
498 if (!data
->notify_data
.data
.string
)
501 data
->notify_data
.data
.string
= NULL
;
504 if(!prs_uint16uni(True
,"string",ps
,depth
,data
->notify_data
.data
.string
,x
))
512 /* Win2k does not seem to put this parse align here */
520 /*******************************************************************
521 reads or writes an NOTIFY INFO structure.
522 ********************************************************************/
524 static bool smb_io_notify_info(const char *desc
, SPOOL_NOTIFY_INFO
*info
, prs_struct
*ps
, int depth
)
528 prs_debug(ps
, depth
, desc
, "smb_io_notify_info");
534 if(!prs_uint32("count", ps
, depth
, &info
->count
))
536 if(!prs_uint32("version", ps
, depth
, &info
->version
))
538 if(!prs_uint32("flags", ps
, depth
, &info
->flags
))
540 if(!prs_uint32("count", ps
, depth
, &info
->count
))
543 for (i
=0;i
<info
->count
;i
++) {
544 if(!smb_io_notify_info_data(desc
, &info
->data
[i
], ps
, depth
))
548 /* now do the strings at the end of the stream */
549 for (i
=0;i
<info
->count
;i
++) {
550 if(!smb_io_notify_info_data_strings(desc
, &info
->data
[i
], ps
, depth
))
557 /*******************************************************************
558 ********************************************************************/
560 bool spool_io_user_level_1( const char *desc
, prs_struct
*ps
, int depth
, SPOOL_USER_1
*q_u
)
562 prs_debug(ps
, depth
, desc
, "");
568 if (!prs_uint32("size", ps
, depth
, &q_u
->size
))
571 if (!prs_io_unistr2_p("", ps
, depth
, &q_u
->client_name
))
573 if (!prs_io_unistr2_p("", ps
, depth
, &q_u
->user_name
))
576 if (!prs_uint32("build", ps
, depth
, &q_u
->build
))
578 if (!prs_uint32("major", ps
, depth
, &q_u
->major
))
580 if (!prs_uint32("minor", ps
, depth
, &q_u
->minor
))
582 if (!prs_uint32("processor", ps
, depth
, &q_u
->processor
))
585 if (!prs_io_unistr2("", ps
, depth
, q_u
->client_name
))
590 if (!prs_io_unistr2("", ps
, depth
, q_u
->user_name
))
596 /*******************************************************************
597 ********************************************************************/
599 static bool spool_io_user_level(const char *desc
, SPOOL_USER_CTR
*q_u
, prs_struct
*ps
, int depth
)
604 prs_debug(ps
, depth
, desc
, "spool_io_user_level");
610 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
613 switch ( q_u
->level
)
616 if ( !prs_pointer( "" , ps
, depth
, (void*)&q_u
->user
.user1
,
617 sizeof(SPOOL_USER_1
), (PRS_POINTER_CAST
)spool_io_user_level_1
))
629 /*******************************************************************
630 * read or write a DEVICEMODE struct.
631 * on reading allocate memory for the private member
632 ********************************************************************/
634 #define DM_NUM_OPTIONAL_FIELDS 8
636 bool spoolss_io_devmode(const char *desc
, prs_struct
*ps
, int depth
, DEVICEMODE
*devmode
)
638 int available_space
; /* size of the device mode left to parse */
639 /* only important on unmarshalling */
641 uint16
*unistr_buffer
;
644 struct optional_fields
{
647 } opt_fields
[DM_NUM_OPTIONAL_FIELDS
] = {
648 { "icmmethod", NULL
},
649 { "icmintent", NULL
},
650 { "mediatype", NULL
},
651 { "dithertype", NULL
},
652 { "reserved1", NULL
},
653 { "reserved2", NULL
},
654 { "panningwidth", NULL
},
655 { "panningheight", NULL
}
658 /* assign at run time to keep non-gcc compilers happy */
660 opt_fields
[0].field
= &devmode
->icmmethod
;
661 opt_fields
[1].field
= &devmode
->icmintent
;
662 opt_fields
[2].field
= &devmode
->mediatype
;
663 opt_fields
[3].field
= &devmode
->dithertype
;
664 opt_fields
[4].field
= &devmode
->reserved1
;
665 opt_fields
[5].field
= &devmode
->reserved2
;
666 opt_fields
[6].field
= &devmode
->panningwidth
;
667 opt_fields
[7].field
= &devmode
->panningheight
;
670 prs_debug(ps
, depth
, desc
, "spoolss_io_devmode");
673 if (UNMARSHALLING(ps
)) {
674 devmode
->devicename
.buffer
= PRS_ALLOC_MEM(ps
, uint16
, MAXDEVICENAME
);
675 if (devmode
->devicename
.buffer
== NULL
)
677 unistr_buffer
= devmode
->devicename
.buffer
;
680 /* devicename is a static sized string but the buffer we set is not */
681 unistr_buffer
= PRS_ALLOC_MEM(ps
, uint16
, MAXDEVICENAME
);
682 memset( unistr_buffer
, 0x0, MAXDEVICENAME
);
683 for ( j
=0; devmode
->devicename
.buffer
[j
]; j
++ )
684 unistr_buffer
[j
] = devmode
->devicename
.buffer
[j
];
687 if (!prs_uint16uni(True
,"devicename", ps
, depth
, unistr_buffer
, MAXDEVICENAME
))
690 if (!prs_uint16("specversion", ps
, depth
, &devmode
->specversion
))
693 if (!prs_uint16("driverversion", ps
, depth
, &devmode
->driverversion
))
695 if (!prs_uint16("size", ps
, depth
, &devmode
->size
))
697 if (!prs_uint16("driverextra", ps
, depth
, &devmode
->driverextra
))
699 if (!prs_uint32("fields", ps
, depth
, &devmode
->fields
))
701 if (!prs_uint16("orientation", ps
, depth
, &devmode
->orientation
))
703 if (!prs_uint16("papersize", ps
, depth
, &devmode
->papersize
))
705 if (!prs_uint16("paperlength", ps
, depth
, &devmode
->paperlength
))
707 if (!prs_uint16("paperwidth", ps
, depth
, &devmode
->paperwidth
))
709 if (!prs_uint16("scale", ps
, depth
, &devmode
->scale
))
711 if (!prs_uint16("copies", ps
, depth
, &devmode
->copies
))
713 if (!prs_uint16("defaultsource", ps
, depth
, &devmode
->defaultsource
))
715 if (!prs_uint16("printquality", ps
, depth
, &devmode
->printquality
))
717 if (!prs_uint16("color", ps
, depth
, &devmode
->color
))
719 if (!prs_uint16("duplex", ps
, depth
, &devmode
->duplex
))
721 if (!prs_uint16("yresolution", ps
, depth
, &devmode
->yresolution
))
723 if (!prs_uint16("ttoption", ps
, depth
, &devmode
->ttoption
))
725 if (!prs_uint16("collate", ps
, depth
, &devmode
->collate
))
728 if (UNMARSHALLING(ps
)) {
729 devmode
->formname
.buffer
= PRS_ALLOC_MEM(ps
, uint16
, MAXDEVICENAME
);
730 if (devmode
->formname
.buffer
== NULL
)
732 unistr_buffer
= devmode
->formname
.buffer
;
735 /* devicename is a static sized string but the buffer we set is not */
736 unistr_buffer
= PRS_ALLOC_MEM(ps
, uint16
, MAXDEVICENAME
);
737 memset( unistr_buffer
, 0x0, MAXDEVICENAME
);
738 for ( j
=0; devmode
->formname
.buffer
[j
]; j
++ )
739 unistr_buffer
[j
] = devmode
->formname
.buffer
[j
];
742 if (!prs_uint16uni(True
, "formname", ps
, depth
, unistr_buffer
, MAXDEVICENAME
))
744 if (!prs_uint16("logpixels", ps
, depth
, &devmode
->logpixels
))
746 if (!prs_uint32("bitsperpel", ps
, depth
, &devmode
->bitsperpel
))
748 if (!prs_uint32("pelswidth", ps
, depth
, &devmode
->pelswidth
))
750 if (!prs_uint32("pelsheight", ps
, depth
, &devmode
->pelsheight
))
752 if (!prs_uint32("displayflags", ps
, depth
, &devmode
->displayflags
))
754 if (!prs_uint32("displayfrequency", ps
, depth
, &devmode
->displayfrequency
))
757 * every device mode I've ever seen on the wire at least has up
758 * to the displayfrequency field. --jerry (05-09-2002)
761 /* add uint32's + uint16's + two UNICODE strings */
763 available_space
= devmode
->size
- (sizeof(uint32
)*6 + sizeof(uint16
)*18 + sizeof(uint16
)*64);
765 /* Sanity check - we only have uint32's left tp parse */
767 if ( available_space
&& ((available_space
% sizeof(uint32
)) != 0) ) {
768 DEBUG(0,("spoolss_io_devmode: available_space [%d] no in multiple of 4 bytes (size = %d)!\n",
769 available_space
, devmode
->size
));
770 DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
775 * Conditional parsing. Assume that the DeviceMode has been
776 * zero'd by the caller.
779 while ((available_space
> 0) && (i
< DM_NUM_OPTIONAL_FIELDS
))
781 DEBUG(11, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space
));
782 if (!prs_uint32(opt_fields
[i
].name
, ps
, depth
, opt_fields
[i
].field
))
784 available_space
-= sizeof(uint32
);
788 /* Sanity Check - we should no available space at this point unless
789 MS changes the device mode structure */
791 if (available_space
) {
792 DEBUG(0,("spoolss_io_devmode: I've parsed all I know and there is still stuff left|\n"));
793 DEBUG(0,("spoolss_io_devmode: available_space = [%d], devmode_size = [%d]!\n",
794 available_space
, devmode
->size
));
795 DEBUG(0,("spoolss_io_devmode: please report to samba-technical@samba.org!\n"));
800 if (devmode
->driverextra
!=0) {
801 if (UNMARSHALLING(ps
)) {
802 devmode
->dev_private
=PRS_ALLOC_MEM(ps
, uint8
, devmode
->driverextra
);
803 if(devmode
->dev_private
== NULL
)
805 DEBUG(7,("spoolss_io_devmode: allocated memory [%d] for dev_private\n",devmode
->driverextra
));
808 DEBUG(7,("spoolss_io_devmode: parsing [%d] bytes of dev_private\n",devmode
->driverextra
));
809 if (!prs_uint8s(False
, "dev_private", ps
, depth
,
810 devmode
->dev_private
, devmode
->driverextra
))
817 /*******************************************************************
818 Read or write a DEVICEMODE container
819 ********************************************************************/
821 static bool spoolss_io_devmode_cont(const char *desc
, DEVMODE_CTR
*dm_c
, prs_struct
*ps
, int depth
)
826 prs_debug(ps
, depth
, desc
, "spoolss_io_devmode_cont");
832 if (!prs_uint32("size", ps
, depth
, &dm_c
->size
))
835 if (!prs_uint32("devmode_ptr", ps
, depth
, &dm_c
->devmode_ptr
))
838 if (dm_c
->size
==0 || dm_c
->devmode_ptr
==0) {
839 if (UNMARSHALLING(ps
))
840 /* if while reading there is no DEVMODE ... */
845 /* so we have a DEVICEMODE to follow */
846 if (UNMARSHALLING(ps
)) {
847 DEBUG(9,("Allocating memory for spoolss_io_devmode\n"));
848 dm_c
->devmode
=PRS_ALLOC_MEM(ps
,DEVICEMODE
,1);
849 if(dm_c
->devmode
== NULL
)
853 /* this is bad code, shouldn't be there */
854 if (!prs_uint32("size", ps
, depth
, &dm_c
->size
))
857 if (!spoolss_io_devmode(desc
, ps
, depth
, dm_c
->devmode
))
863 /*******************************************************************
864 ********************************************************************/
866 static bool spoolss_io_printer_default(const char *desc
, PRINTER_DEFAULT
*pd
, prs_struct
*ps
, int depth
)
871 prs_debug(ps
, depth
, desc
, "spoolss_io_printer_default");
874 if (!prs_uint32("datatype_ptr", ps
, depth
, &pd
->datatype_ptr
))
877 if (!smb_io_unistr2("datatype", &pd
->datatype
, pd
->datatype_ptr
, ps
,depth
))
883 if (!spoolss_io_devmode_cont("", &pd
->devmode_cont
, ps
, depth
))
889 if (!prs_uint32("access_required", ps
, depth
, &pd
->access_required
))
895 /*******************************************************************
897 ********************************************************************/
899 bool make_spoolss_q_open_printer_ex(SPOOL_Q_OPEN_PRINTER_EX
*q_u
,
900 const fstring printername
,
901 const fstring datatype
,
902 uint32 access_required
,
903 const fstring clientname
,
904 const fstring user_name
)
906 DEBUG(5,("make_spoolss_q_open_printer_ex\n"));
908 q_u
->printername
= TALLOC_P( talloc_tos(), UNISTR2
);
909 if (!q_u
->printername
) {
912 init_unistr2(q_u
->printername
, printername
, UNI_STR_TERMINATE
);
914 q_u
->printer_default
.datatype_ptr
= 0;
916 q_u
->printer_default
.devmode_cont
.size
=0;
917 q_u
->printer_default
.devmode_cont
.devmode_ptr
=0;
918 q_u
->printer_default
.devmode_cont
.devmode
=NULL
;
919 q_u
->printer_default
.access_required
=access_required
;
921 q_u
->user_switch
= 1;
923 q_u
->user_ctr
.level
= 1;
924 q_u
->user_ctr
.user
.user1
= TALLOC_P( talloc_tos(), SPOOL_USER_1
);
925 if (!q_u
->user_ctr
.user
.user1
) {
928 q_u
->user_ctr
.user
.user1
->size
= strlen(clientname
) + strlen(user_name
) + 10;
929 q_u
->user_ctr
.user
.user1
->build
= 1381;
930 q_u
->user_ctr
.user
.user1
->major
= 2;
931 q_u
->user_ctr
.user
.user1
->minor
= 0;
932 q_u
->user_ctr
.user
.user1
->processor
= 0;
934 q_u
->user_ctr
.user
.user1
->client_name
= TALLOC_P( talloc_tos(), UNISTR2
);
935 if (!q_u
->user_ctr
.user
.user1
->client_name
) {
938 q_u
->user_ctr
.user
.user1
->user_name
= TALLOC_P( talloc_tos(), UNISTR2
);
939 if (!q_u
->user_ctr
.user
.user1
->user_name
) {
943 init_unistr2(q_u
->user_ctr
.user
.user1
->client_name
, clientname
, UNI_STR_TERMINATE
);
944 init_unistr2(q_u
->user_ctr
.user
.user1
->user_name
, user_name
, UNI_STR_TERMINATE
);
949 /*******************************************************************
951 ********************************************************************/
953 bool make_spoolss_q_addprinterex( TALLOC_CTX
*mem_ctx
, SPOOL_Q_ADDPRINTEREX
*q_u
,
954 const char *srv_name
, const char* clientname
, const char* user_name
,
955 uint32 level
, PRINTER_INFO_CTR
*ctr
)
957 DEBUG(5,("make_spoolss_q_addprinterex\n"));
959 if (!ctr
|| !ctr
->printers_2
)
964 q_u
->server_name
= TALLOC_P( mem_ctx
, UNISTR2
);
965 if (!q_u
->server_name
) {
968 init_unistr2(q_u
->server_name
, srv_name
, UNI_FLAGS_NONE
);
972 q_u
->info
.level
= level
;
973 q_u
->info
.info_ptr
= (ctr
->printers_2
!=NULL
)?1:0;
976 /* init q_u->info.info2 from *info */
977 if (!make_spoolss_printer_info_2(mem_ctx
, &q_u
->info
.info_2
, ctr
->printers_2
)) {
978 DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n"));
988 q_u
->user_ctr
.level
= 1;
989 q_u
->user_ctr
.user
.user1
= TALLOC_P( talloc_tos(), SPOOL_USER_1
);
990 if (!q_u
->user_ctr
.user
.user1
) {
993 q_u
->user_ctr
.user
.user1
->build
= 1381;
994 q_u
->user_ctr
.user
.user1
->major
= 2;
995 q_u
->user_ctr
.user
.user1
->minor
= 0;
996 q_u
->user_ctr
.user
.user1
->processor
= 0;
998 q_u
->user_ctr
.user
.user1
->client_name
= TALLOC_P( mem_ctx
, UNISTR2
);
999 if (!q_u
->user_ctr
.user
.user1
->client_name
) {
1002 q_u
->user_ctr
.user
.user1
->user_name
= TALLOC_P( mem_ctx
, UNISTR2
);
1003 if (!q_u
->user_ctr
.user
.user1
->user_name
) {
1006 init_unistr2(q_u
->user_ctr
.user
.user1
->client_name
, clientname
, UNI_STR_TERMINATE
);
1007 init_unistr2(q_u
->user_ctr
.user
.user1
->user_name
, user_name
, UNI_STR_TERMINATE
);
1009 q_u
->user_ctr
.user
.user1
->size
= q_u
->user_ctr
.user
.user1
->user_name
->uni_str_len
+
1010 q_u
->user_ctr
.user
.user1
->client_name
->uni_str_len
+ 2;
1015 /*******************************************************************
1016 create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct
1017 *******************************************************************/
1019 bool make_spoolss_printer_info_2(TALLOC_CTX
*ctx
, SPOOL_PRINTER_INFO_LEVEL_2
**spool_info2
,
1020 PRINTER_INFO_2
*info
)
1023 SPOOL_PRINTER_INFO_LEVEL_2
*inf
;
1025 /* allocate the necessary memory */
1026 if (!(inf
=TALLOC_P(ctx
, SPOOL_PRINTER_INFO_LEVEL_2
))) {
1027 DEBUG(0,("make_spoolss_printer_info_2: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_2 sruct!\n"));
1031 inf
->servername_ptr
= (info
->servername
.buffer
!=NULL
)?1:0;
1032 inf
->printername_ptr
= (info
->printername
.buffer
!=NULL
)?1:0;
1033 inf
->sharename_ptr
= (info
->sharename
.buffer
!=NULL
)?1:0;
1034 inf
->portname_ptr
= (info
->portname
.buffer
!=NULL
)?1:0;
1035 inf
->drivername_ptr
= (info
->drivername
.buffer
!=NULL
)?1:0;
1036 inf
->comment_ptr
= (info
->comment
.buffer
!=NULL
)?1:0;
1037 inf
->location_ptr
= (info
->location
.buffer
!=NULL
)?1:0;
1038 inf
->devmode_ptr
= (info
->devmode
!=NULL
)?1:0;
1039 inf
->sepfile_ptr
= (info
->sepfile
.buffer
!=NULL
)?1:0;
1040 inf
->printprocessor_ptr
= (info
->printprocessor
.buffer
!=NULL
)?1:0;
1041 inf
->datatype_ptr
= (info
->datatype
.buffer
!=NULL
)?1:0;
1042 inf
->parameters_ptr
= (info
->parameters
.buffer
!=NULL
)?1:0;
1043 inf
->secdesc_ptr
= (info
->secdesc
!=NULL
)?1:0;
1044 inf
->attributes
= info
->attributes
;
1045 inf
->priority
= info
->priority
;
1046 inf
->default_priority
= info
->defaultpriority
;
1047 inf
->starttime
= info
->starttime
;
1048 inf
->untiltime
= info
->untiltime
;
1049 inf
->cjobs
= info
->cjobs
;
1050 inf
->averageppm
= info
->averageppm
;
1051 init_unistr2_from_unistr(inf
, &inf
->servername
, &info
->servername
);
1052 init_unistr2_from_unistr(inf
, &inf
->printername
, &info
->printername
);
1053 init_unistr2_from_unistr(inf
, &inf
->sharename
, &info
->sharename
);
1054 init_unistr2_from_unistr(inf
, &inf
->portname
, &info
->portname
);
1055 init_unistr2_from_unistr(inf
, &inf
->drivername
, &info
->drivername
);
1056 init_unistr2_from_unistr(inf
, &inf
->comment
, &info
->comment
);
1057 init_unistr2_from_unistr(inf
, &inf
->location
, &info
->location
);
1058 init_unistr2_from_unistr(inf
, &inf
->sepfile
, &info
->sepfile
);
1059 init_unistr2_from_unistr(inf
, &inf
->printprocessor
, &info
->printprocessor
);
1060 init_unistr2_from_unistr(inf
, &inf
->datatype
, &info
->datatype
);
1061 init_unistr2_from_unistr(inf
, &inf
->parameters
, &info
->parameters
);
1062 init_unistr2_from_unistr(inf
, &inf
->datatype
, &info
->datatype
);
1069 /*******************************************************************
1070 create a SPOOL_PRINTER_INFO_3 struct from a PRINTER_INFO_3 struct
1071 *******************************************************************/
1073 bool make_spoolss_printer_info_3(TALLOC_CTX
*mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_3
**spool_info3
,
1074 PRINTER_INFO_3
*info
)
1077 SPOOL_PRINTER_INFO_LEVEL_3
*inf
;
1079 /* allocate the necessary memory */
1080 if (!(inf
=TALLOC_P(mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_3
))) {
1081 DEBUG(0,("make_spoolss_printer_info_3: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_3 sruct!\n"));
1085 inf
->secdesc_ptr
= (info
->secdesc
!=NULL
)?1:0;
1092 /*******************************************************************
1093 create a SPOOL_PRINTER_INFO_7 struct from a PRINTER_INFO_7 struct
1094 *******************************************************************/
1096 bool make_spoolss_printer_info_7(TALLOC_CTX
*mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_7
**spool_info7
,
1097 PRINTER_INFO_7
*info
)
1100 SPOOL_PRINTER_INFO_LEVEL_7
*inf
;
1102 /* allocate the necessary memory */
1103 if (!(inf
=TALLOC_P(mem_ctx
, SPOOL_PRINTER_INFO_LEVEL_7
))) {
1104 DEBUG(0,("make_spoolss_printer_info_7: Unable to allocate SPOOL_PRINTER_INFO_LEVEL_7 struct!\n"));
1108 inf
->guid_ptr
= (info
->guid
.buffer
!=NULL
)?1:0;
1109 inf
->action
= info
->action
;
1110 init_unistr2_from_unistr(inf
, &inf
->guid
, &info
->guid
);
1118 /*******************************************************************
1120 * called from spoolss_q_open_printer_ex (srv_spoolss.c)
1121 ********************************************************************/
1123 bool spoolss_io_q_open_printer(const char *desc
, SPOOL_Q_OPEN_PRINTER
*q_u
, prs_struct
*ps
, int depth
)
1128 prs_debug(ps
, depth
, desc
, "spoolss_io_q_open_printer");
1134 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->printername
))
1136 if (!prs_io_unistr2("printername", ps
, depth
, q_u
->printername
))
1142 if (!spoolss_io_printer_default("", &q_u
->printer_default
, ps
, depth
))
1148 /*******************************************************************
1149 * write a structure.
1150 * called from static spoolss_r_open_printer_ex (srv_spoolss.c)
1151 * called from spoolss_open_printer_ex (cli_spoolss.c)
1152 ********************************************************************/
1154 bool spoolss_io_r_open_printer(const char *desc
, SPOOL_R_OPEN_PRINTER
*r_u
, prs_struct
*ps
, int depth
)
1156 if (r_u
== NULL
) return False
;
1158 prs_debug(ps
, depth
, desc
, "spoolss_io_r_open_printer");
1164 if (!smb_io_pol_hnd("printer handle",&(r_u
->handle
),ps
,depth
))
1167 if (!prs_werror("status", ps
, depth
, &(r_u
->status
)))
1174 /*******************************************************************
1176 * called from spoolss_q_open_printer_ex (srv_spoolss.c)
1177 ********************************************************************/
1179 bool spoolss_io_q_open_printer_ex(const char *desc
, SPOOL_Q_OPEN_PRINTER_EX
*q_u
, prs_struct
*ps
, int depth
)
1184 prs_debug(ps
, depth
, desc
, "spoolss_io_q_open_printer_ex");
1190 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->printername
))
1192 if (!prs_io_unistr2("printername", ps
, depth
, q_u
->printername
))
1198 if (!spoolss_io_printer_default("", &q_u
->printer_default
, ps
, depth
))
1201 if (!prs_uint32("user_switch", ps
, depth
, &q_u
->user_switch
))
1203 if (!spool_io_user_level("", &q_u
->user_ctr
, ps
, depth
))
1209 /*******************************************************************
1210 * write a structure.
1211 * called from static spoolss_r_open_printer_ex (srv_spoolss.c)
1212 * called from spoolss_open_printer_ex (cli_spoolss.c)
1213 ********************************************************************/
1215 bool spoolss_io_r_open_printer_ex(const char *desc
, SPOOL_R_OPEN_PRINTER_EX
*r_u
, prs_struct
*ps
, int depth
)
1217 if (r_u
== NULL
) return False
;
1219 prs_debug(ps
, depth
, desc
, "spoolss_io_r_open_printer_ex");
1225 if (!smb_io_pol_hnd("printer handle",&(r_u
->handle
),ps
,depth
))
1228 if (!prs_werror("status", ps
, depth
, &(r_u
->status
)))
1234 /*******************************************************************
1236 ********************************************************************/
1237 bool make_spoolss_q_deleteprinterdriverex( TALLOC_CTX
*mem_ctx
,
1238 SPOOL_Q_DELETEPRINTERDRIVEREX
*q_u
,
1244 DEBUG(5,("make_spoolss_q_deleteprinterdriverex\n"));
1246 q_u
->server_ptr
= (server
!=NULL
)?1:0;
1247 q_u
->delete_flags
= DPD_DELETE_UNUSED_FILES
;
1249 /* these must be NULL terminated or else NT4 will
1250 complain about invalid parameters --jerry */
1251 init_unistr2(&q_u
->server
, server
, UNI_STR_TERMINATE
);
1252 init_unistr2(&q_u
->arch
, arch
, UNI_STR_TERMINATE
);
1253 init_unistr2(&q_u
->driver
, driver
, UNI_STR_TERMINATE
);
1256 q_u
->delete_flags
|= DPD_DELETE_SPECIFIC_VERSION
;
1257 q_u
->version
= version
;
1264 /*******************************************************************
1266 ********************************************************************/
1267 bool make_spoolss_q_deleteprinterdriver(
1268 TALLOC_CTX
*mem_ctx
,
1269 SPOOL_Q_DELETEPRINTERDRIVER
*q_u
,
1275 DEBUG(5,("make_spoolss_q_deleteprinterdriver\n"));
1277 q_u
->server_ptr
= (server
!=NULL
)?1:0;
1279 /* these must be NULL terminated or else NT4 will
1280 complain about invalid parameters --jerry */
1281 init_unistr2(&q_u
->server
, server
, UNI_STR_TERMINATE
);
1282 init_unistr2(&q_u
->arch
, arch
, UNI_STR_TERMINATE
);
1283 init_unistr2(&q_u
->driver
, driver
, UNI_STR_TERMINATE
);
1288 /*******************************************************************
1290 ********************************************************************/
1292 bool make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA
*q_u
,
1293 const POLICY_HND
*handle
,
1294 const char *valuename
, uint32 size
)
1296 if (q_u
== NULL
) return False
;
1298 DEBUG(5,("make_spoolss_q_getprinterdata\n"));
1300 q_u
->handle
= *handle
;
1301 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
1307 /*******************************************************************
1309 ********************************************************************/
1311 bool make_spoolss_q_getprinterdataex(SPOOL_Q_GETPRINTERDATAEX
*q_u
,
1312 const POLICY_HND
*handle
,
1313 const char *keyname
,
1314 const char *valuename
, uint32 size
)
1316 if (q_u
== NULL
) return False
;
1318 DEBUG(5,("make_spoolss_q_getprinterdataex\n"));
1320 q_u
->handle
= *handle
;
1321 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
1322 init_unistr2(&q_u
->keyname
, keyname
, UNI_STR_TERMINATE
);
1328 /*******************************************************************
1330 * called from spoolss_q_getprinterdata (srv_spoolss.c)
1331 ********************************************************************/
1333 bool spoolss_io_q_getprinterdata(const char *desc
, SPOOL_Q_GETPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
1338 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdata");
1343 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1347 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
1351 if (!prs_uint32("size", ps
, depth
, &q_u
->size
))
1357 /*******************************************************************
1359 * called from spoolss_q_deleteprinterdata (srv_spoolss.c)
1360 ********************************************************************/
1362 bool spoolss_io_q_deleteprinterdata(const char *desc
, SPOOL_Q_DELETEPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
1367 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdata");
1372 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1376 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
1382 /*******************************************************************
1383 * write a structure.
1384 * called from spoolss_r_deleteprinterdata (srv_spoolss.c)
1385 ********************************************************************/
1387 bool spoolss_io_r_deleteprinterdata(const char *desc
, SPOOL_R_DELETEPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
1389 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdata");
1391 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1397 /*******************************************************************
1399 * called from spoolss_q_deleteprinterdataex (srv_spoolss.c)
1400 ********************************************************************/
1402 bool spoolss_io_q_deleteprinterdataex(const char *desc
, SPOOL_Q_DELETEPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
1407 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdataex");
1412 if (!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
1415 if (!smb_io_unistr2("keyname ", &q_u
->keyname
, True
, ps
, depth
))
1417 if (!smb_io_unistr2("valuename", &q_u
->valuename
, True
, ps
, depth
))
1423 /*******************************************************************
1424 * write a structure.
1425 * called from spoolss_r_deleteprinterdataex (srv_spoolss.c)
1426 ********************************************************************/
1428 bool spoolss_io_r_deleteprinterdataex(const char *desc
, SPOOL_R_DELETEPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
1430 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdataex");
1433 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1439 /*******************************************************************
1440 * write a structure.
1441 * called from spoolss_r_getprinterdata (srv_spoolss.c)
1442 ********************************************************************/
1444 bool spoolss_io_r_getprinterdata(const char *desc
, SPOOL_R_GETPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
1449 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdata");
1454 if (!prs_uint32("type", ps
, depth
, &r_u
->type
))
1456 if (!prs_uint32("size", ps
, depth
, &r_u
->size
))
1459 if (UNMARSHALLING(ps
) && r_u
->size
) {
1460 r_u
->data
= PRS_ALLOC_MEM(ps
, unsigned char, r_u
->size
);
1465 if (!prs_uint8s( False
, "data", ps
, depth
, r_u
->data
, r_u
->size
))
1471 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
1473 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1479 /*******************************************************************
1481 * called from api_spoolss_deleteprinterdriver (srv_spoolss.c)
1482 * called from spoolss_deleteprinterdriver (cli_spoolss.c)
1483 ********************************************************************/
1485 bool spoolss_io_q_deleteprinterdriver(const char *desc
, SPOOL_Q_DELETEPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
1487 if (q_u
== NULL
) return False
;
1489 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdriver");
1495 if(!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
1497 if(!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
1499 if(!smb_io_unistr2("arch", &q_u
->arch
, True
, ps
, depth
))
1501 if(!smb_io_unistr2("driver", &q_u
->driver
, True
, ps
, depth
))
1509 /*******************************************************************
1510 * write a structure.
1511 ********************************************************************/
1512 bool spoolss_io_r_deleteprinterdriver(const char *desc
, SPOOL_R_DELETEPRINTERDRIVER
*r_u
, prs_struct
*ps
, int depth
)
1514 if (r_u
== NULL
) return False
;
1516 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdriver");
1522 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1529 /*******************************************************************
1531 * called from api_spoolss_deleteprinterdriver (srv_spoolss.c)
1532 * called from spoolss_deleteprinterdriver (cli_spoolss.c)
1533 ********************************************************************/
1535 bool spoolss_io_q_deleteprinterdriverex(const char *desc
, SPOOL_Q_DELETEPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
1537 if (q_u
== NULL
) return False
;
1539 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterdriverex");
1545 if(!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
1547 if(!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
1549 if(!smb_io_unistr2("arch", &q_u
->arch
, True
, ps
, depth
))
1551 if(!smb_io_unistr2("driver", &q_u
->driver
, True
, ps
, depth
))
1557 if(!prs_uint32("delete_flags ", ps
, depth
, &q_u
->delete_flags
))
1559 if(!prs_uint32("version ", ps
, depth
, &q_u
->version
))
1567 /*******************************************************************
1568 * write a structure.
1569 ********************************************************************/
1570 bool spoolss_io_r_deleteprinterdriverex(const char *desc
, SPOOL_R_DELETEPRINTERDRIVEREX
*r_u
, prs_struct
*ps
, int depth
)
1572 if (r_u
== NULL
) return False
;
1574 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterdriverex");
1580 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
1587 /*******************************************************************
1589 * called from spoolss_q_startdocprinter (srv_spoolss.c)
1590 ********************************************************************/
1592 bool spoolss_io_q_startdocprinter(const char *desc
, SPOOL_Q_STARTDOCPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1594 if (q_u
== NULL
) return False
;
1596 prs_debug(ps
, depth
, desc
, "spoolss_io_q_startdocprinter");
1602 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1605 if(!smb_io_doc_info_container("",&q_u
->doc_info_container
, ps
, depth
))
1611 /*******************************************************************
1612 * write a structure.
1613 * called from spoolss_r_startdocprinter (srv_spoolss.c)
1614 ********************************************************************/
1616 bool spoolss_io_r_startdocprinter(const char *desc
, SPOOL_R_STARTDOCPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1618 prs_debug(ps
, depth
, desc
, "spoolss_io_r_startdocprinter");
1620 if(!prs_uint32("jobid", ps
, depth
, &r_u
->jobid
))
1622 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1628 /*******************************************************************
1630 * called from spoolss_q_enddocprinter (srv_spoolss.c)
1631 ********************************************************************/
1633 bool spoolss_io_q_enddocprinter(const char *desc
, SPOOL_Q_ENDDOCPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1635 if (q_u
== NULL
) return False
;
1637 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enddocprinter");
1643 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1649 /*******************************************************************
1650 * write a structure.
1651 * called from spoolss_r_enddocprinter (srv_spoolss.c)
1652 ********************************************************************/
1654 bool spoolss_io_r_enddocprinter(const char *desc
, SPOOL_R_ENDDOCPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1656 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enddocprinter");
1658 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1664 /*******************************************************************
1666 * called from spoolss_q_writeprinter (srv_spoolss.c)
1667 ********************************************************************/
1669 bool spoolss_io_q_writeprinter(const char *desc
, SPOOL_Q_WRITEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
1671 if (q_u
== NULL
) return False
;
1673 prs_debug(ps
, depth
, desc
, "spoolss_io_q_writeprinter");
1679 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1681 if(!prs_uint32("buffer_size", ps
, depth
, &q_u
->buffer_size
))
1684 if (q_u
->buffer_size
!=0)
1686 if (UNMARSHALLING(ps
))
1687 q_u
->buffer
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->buffer_size
);
1688 if(q_u
->buffer
== NULL
)
1690 if(!prs_uint8s(True
, "buffer", ps
, depth
, q_u
->buffer
, q_u
->buffer_size
))
1695 if(!prs_uint32("buffer_size2", ps
, depth
, &q_u
->buffer_size2
))
1701 /*******************************************************************
1702 * write a structure.
1703 * called from spoolss_r_writeprinter (srv_spoolss.c)
1704 ********************************************************************/
1706 bool spoolss_io_r_writeprinter(const char *desc
, SPOOL_R_WRITEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
1708 prs_debug(ps
, depth
, desc
, "spoolss_io_r_writeprinter");
1710 if(!prs_uint32("buffer_written", ps
, depth
, &r_u
->buffer_written
))
1712 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1718 /*******************************************************************
1720 * called from spoolss_q_rffpcnex (srv_spoolss.c)
1721 ********************************************************************/
1723 bool spoolss_io_q_rffpcnex(const char *desc
, SPOOL_Q_RFFPCNEX
*q_u
, prs_struct
*ps
, int depth
)
1725 prs_debug(ps
, depth
, desc
, "spoolss_io_q_rffpcnex");
1731 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
1733 if(!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
1735 if(!prs_uint32("options", ps
, depth
, &q_u
->options
))
1737 if(!prs_uint32("localmachine_ptr", ps
, depth
, &q_u
->localmachine_ptr
))
1739 if(!smb_io_unistr2("localmachine", &q_u
->localmachine
, q_u
->localmachine_ptr
, ps
, depth
))
1745 if(!prs_uint32("printerlocal", ps
, depth
, &q_u
->printerlocal
))
1748 if(!prs_uint32("option_ptr", ps
, depth
, &q_u
->option_ptr
))
1751 if (q_u
->option_ptr
!=0) {
1753 if (UNMARSHALLING(ps
))
1754 if((q_u
->option
=PRS_ALLOC_MEM(ps
,SPOOL_NOTIFY_OPTION
,1)) == NULL
)
1757 if(!smb_io_notify_option("notify option", q_u
->option
, ps
, depth
))
1764 /*******************************************************************
1765 * write a structure.
1766 * called from spoolss_r_rffpcnex (srv_spoolss.c)
1767 ********************************************************************/
1769 bool spoolss_io_r_rffpcnex(const char *desc
, SPOOL_R_RFFPCNEX
*r_u
, prs_struct
*ps
, int depth
)
1771 prs_debug(ps
, depth
, desc
, "spoolss_io_r_rffpcnex");
1774 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1780 /*******************************************************************
1782 * called from spoolss_q_rfnpcnex (srv_spoolss.c)
1783 ********************************************************************/
1785 bool spoolss_io_q_rfnpcnex(const char *desc
, SPOOL_Q_RFNPCNEX
*q_u
, prs_struct
*ps
, int depth
)
1787 prs_debug(ps
, depth
, desc
, "spoolss_io_q_rfnpcnex");
1793 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
1796 if(!prs_uint32("change", ps
, depth
, &q_u
->change
))
1799 if(!prs_uint32("option_ptr", ps
, depth
, &q_u
->option_ptr
))
1802 if (q_u
->option_ptr
!=0) {
1804 if (UNMARSHALLING(ps
))
1805 if((q_u
->option
=PRS_ALLOC_MEM(ps
,SPOOL_NOTIFY_OPTION
,1)) == NULL
)
1808 if(!smb_io_notify_option("notify option", q_u
->option
, ps
, depth
))
1815 /*******************************************************************
1816 * write a structure.
1817 * called from spoolss_r_rfnpcnex (srv_spoolss.c)
1818 ********************************************************************/
1820 bool spoolss_io_r_rfnpcnex(const char *desc
, SPOOL_R_RFNPCNEX
*r_u
, prs_struct
*ps
, int depth
)
1822 prs_debug(ps
, depth
, desc
, "spoolss_io_r_rfnpcnex");
1828 if (!prs_uint32("info_ptr", ps
, depth
, &r_u
->info_ptr
))
1831 if(!smb_io_notify_info("notify info", &r_u
->info
,ps
,depth
))
1836 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
1842 /*******************************************************************
1843 * return the length of a uint16 (obvious, but the code is clean)
1844 ********************************************************************/
1846 static uint32
size_of_uint16(uint16
*value
)
1848 return (sizeof(*value
));
1851 /*******************************************************************
1852 * return the length of a uint32 (obvious, but the code is clean)
1853 ********************************************************************/
1855 static uint32
size_of_uint32(uint32
*value
)
1857 return (sizeof(*value
));
1860 /*******************************************************************
1861 * return the length of a NTTIME (obvious, but the code is clean)
1862 ********************************************************************/
1864 static uint32
size_of_nttime(NTTIME
*value
)
1866 return (sizeof(*value
));
1869 /*******************************************************************
1870 * return the length of a uint32 (obvious, but the code is clean)
1871 ********************************************************************/
1873 static uint32
size_of_device_mode(DEVICEMODE
*devmode
)
1878 return (4+devmode
->size
+devmode
->driverextra
);
1881 /*******************************************************************
1882 * return the length of a uint32 (obvious, but the code is clean)
1883 ********************************************************************/
1885 static uint32
size_of_systemtime(SYSTEMTIME
*systime
)
1890 return (sizeof(SYSTEMTIME
) +4);
1893 /*******************************************************************
1894 Parse a DEVMODE structure and its relative pointer.
1895 ********************************************************************/
1897 static bool smb_io_reldevmode(const char *desc
, RPC_BUFFER
*buffer
, int depth
, DEVICEMODE
**devmode
)
1899 prs_struct
*ps
=&buffer
->prs
;
1901 prs_debug(ps
, depth
, desc
, "smb_io_reldevmode");
1904 if (MARSHALLING(ps
)) {
1905 uint32 struct_offset
= prs_offset(ps
);
1906 uint32 relative_offset
;
1908 if (*devmode
== NULL
) {
1910 if (!prs_uint32("offset", ps
, depth
, &relative_offset
))
1912 DEBUG(8, ("boing, the devmode was NULL\n"));
1917 buffer
->string_at_end
-= ((*devmode
)->size
+ (*devmode
)->driverextra
);
1919 /* mz: we have to align the device mode for VISTA */
1920 if (buffer
->string_at_end
% 4) {
1921 buffer
->string_at_end
+= 4 - (buffer
->string_at_end
% 4);
1924 if(!prs_set_offset(ps
, buffer
->string_at_end
))
1927 /* write the DEVMODE */
1928 if (!spoolss_io_devmode(desc
, ps
, depth
, *devmode
))
1931 if(!prs_set_offset(ps
, struct_offset
))
1934 relative_offset
=buffer
->string_at_end
- buffer
->struct_start
;
1935 /* write its offset */
1936 if (!prs_uint32("offset", ps
, depth
, &relative_offset
))
1942 /* read the offset */
1943 if (!prs_uint32("offset", ps
, depth
, &buffer
->string_at_end
))
1945 if (buffer
->string_at_end
== 0) {
1950 old_offset
= prs_offset(ps
);
1951 if(!prs_set_offset(ps
, buffer
->string_at_end
+ buffer
->struct_start
))
1954 /* read the string */
1955 if((*devmode
=PRS_ALLOC_MEM(ps
,DEVICEMODE
,1)) == NULL
)
1957 if (!spoolss_io_devmode(desc
, ps
, depth
, *devmode
))
1960 if(!prs_set_offset(ps
, old_offset
))
1966 /*******************************************************************
1967 Parse a PRINTER_INFO_0 structure.
1968 ********************************************************************/
1970 bool smb_io_printer_info_0(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_0
*info
, int depth
)
1972 prs_struct
*ps
=&buffer
->prs
;
1974 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_0");
1977 buffer
->struct_start
=prs_offset(ps
);
1979 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
1981 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
1984 if(!prs_uint32("cjobs", ps
, depth
, &info
->cjobs
))
1986 if(!prs_uint32("total_jobs", ps
, depth
, &info
->total_jobs
))
1988 if(!prs_uint32("total_bytes", ps
, depth
, &info
->total_bytes
))
1991 if(!prs_uint16("year", ps
, depth
, &info
->year
))
1993 if(!prs_uint16("month", ps
, depth
, &info
->month
))
1995 if(!prs_uint16("dayofweek", ps
, depth
, &info
->dayofweek
))
1997 if(!prs_uint16("day", ps
, depth
, &info
->day
))
1999 if(!prs_uint16("hour", ps
, depth
, &info
->hour
))
2001 if(!prs_uint16("minute", ps
, depth
, &info
->minute
))
2003 if(!prs_uint16("second", ps
, depth
, &info
->second
))
2005 if(!prs_uint16("milliseconds", ps
, depth
, &info
->milliseconds
))
2008 if(!prs_uint32("global_counter", ps
, depth
, &info
->global_counter
))
2010 if(!prs_uint32("total_pages", ps
, depth
, &info
->total_pages
))
2013 if(!prs_uint16("major_version", ps
, depth
, &info
->major_version
))
2015 if(!prs_uint16("build_version", ps
, depth
, &info
->build_version
))
2017 if(!prs_uint32("unknown7", ps
, depth
, &info
->unknown7
))
2019 if(!prs_uint32("unknown8", ps
, depth
, &info
->unknown8
))
2021 if(!prs_uint32("unknown9", ps
, depth
, &info
->unknown9
))
2023 if(!prs_uint32("session_counter", ps
, depth
, &info
->session_counter
))
2025 if(!prs_uint32("unknown11", ps
, depth
, &info
->unknown11
))
2027 if(!prs_uint32("printer_errors", ps
, depth
, &info
->printer_errors
))
2029 if(!prs_uint32("unknown13", ps
, depth
, &info
->unknown13
))
2031 if(!prs_uint32("unknown14", ps
, depth
, &info
->unknown14
))
2033 if(!prs_uint32("unknown15", ps
, depth
, &info
->unknown15
))
2035 if(!prs_uint32("unknown16", ps
, depth
, &info
->unknown16
))
2037 if(!prs_uint32("change_id", ps
, depth
, &info
->change_id
))
2039 if(!prs_uint32("unknown18", ps
, depth
, &info
->unknown18
))
2041 if(!prs_uint32("status" , ps
, depth
, &info
->status
))
2043 if(!prs_uint32("unknown20", ps
, depth
, &info
->unknown20
))
2045 if(!prs_uint32("c_setprinter", ps
, depth
, &info
->c_setprinter
))
2047 if(!prs_uint16("unknown22", ps
, depth
, &info
->unknown22
))
2049 if(!prs_uint16("unknown23", ps
, depth
, &info
->unknown23
))
2051 if(!prs_uint16("unknown24", ps
, depth
, &info
->unknown24
))
2053 if(!prs_uint16("unknown25", ps
, depth
, &info
->unknown25
))
2055 if(!prs_uint16("unknown26", ps
, depth
, &info
->unknown26
))
2057 if(!prs_uint16("unknown27", ps
, depth
, &info
->unknown27
))
2059 if(!prs_uint16("unknown28", ps
, depth
, &info
->unknown28
))
2061 if(!prs_uint16("unknown29", ps
, depth
, &info
->unknown29
))
2067 /*******************************************************************
2068 Parse a PRINTER_INFO_1 structure.
2069 ********************************************************************/
2071 bool smb_io_printer_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_1
*info
, int depth
)
2073 prs_struct
*ps
=&buffer
->prs
;
2075 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_1");
2078 buffer
->struct_start
=prs_offset(ps
);
2080 if (!prs_uint32("flags", ps
, depth
, &info
->flags
))
2082 if (!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2084 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2086 if (!smb_io_relstr("comment", buffer
, depth
, &info
->comment
))
2092 /*******************************************************************
2093 Parse a PRINTER_INFO_2 structure.
2094 ********************************************************************/
2096 bool smb_io_printer_info_2(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_2
*info
, int depth
)
2098 prs_struct
*ps
=&buffer
->prs
;
2099 uint32 dm_offset
, sd_offset
, current_offset
;
2100 uint32 dummy_value
= 0, has_secdesc
= 0;
2102 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_2");
2105 buffer
->struct_start
=prs_offset(ps
);
2107 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
2109 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2111 if (!smb_io_relstr("sharename", buffer
, depth
, &info
->sharename
))
2113 if (!smb_io_relstr("portname", buffer
, depth
, &info
->portname
))
2115 if (!smb_io_relstr("drivername", buffer
, depth
, &info
->drivername
))
2117 if (!smb_io_relstr("comment", buffer
, depth
, &info
->comment
))
2119 if (!smb_io_relstr("location", buffer
, depth
, &info
->location
))
2122 /* save current offset and wind forwared by a uint32 */
2123 dm_offset
= prs_offset(ps
);
2124 if (!prs_uint32("devmode", ps
, depth
, &dummy_value
))
2127 if (!smb_io_relstr("sepfile", buffer
, depth
, &info
->sepfile
))
2129 if (!smb_io_relstr("printprocessor", buffer
, depth
, &info
->printprocessor
))
2131 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2133 if (!smb_io_relstr("parameters", buffer
, depth
, &info
->parameters
))
2136 /* save current offset for the sec_desc */
2137 sd_offset
= prs_offset(ps
);
2138 if (!prs_uint32("sec_desc", ps
, depth
, &has_secdesc
))
2142 /* save current location so we can pick back up here */
2143 current_offset
= prs_offset(ps
);
2145 /* parse the devmode */
2146 if (!prs_set_offset(ps
, dm_offset
))
2148 if (!smb_io_reldevmode("devmode", buffer
, depth
, &info
->devmode
))
2151 /* parse the sec_desc */
2152 if (info
->secdesc
) {
2153 if (!prs_set_offset(ps
, sd_offset
))
2155 if (!smb_io_relsecdesc("secdesc", buffer
, depth
, &info
->secdesc
))
2159 /* pick up where we left off */
2160 if (!prs_set_offset(ps
, current_offset
))
2163 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2165 if (!prs_uint32("priority", ps
, depth
, &info
->priority
))
2167 if (!prs_uint32("defpriority", ps
, depth
, &info
->defaultpriority
))
2169 if (!prs_uint32("starttime", ps
, depth
, &info
->starttime
))
2171 if (!prs_uint32("untiltime", ps
, depth
, &info
->untiltime
))
2173 if (!prs_uint32("status", ps
, depth
, &info
->status
))
2175 if (!prs_uint32("jobs", ps
, depth
, &info
->cjobs
))
2177 if (!prs_uint32("averageppm", ps
, depth
, &info
->averageppm
))
2183 /*******************************************************************
2184 Parse a PRINTER_INFO_3 structure.
2185 ********************************************************************/
2187 bool smb_io_printer_info_3(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_3
*info
, int depth
)
2190 prs_struct
*ps
=&buffer
->prs
;
2192 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_3");
2195 buffer
->struct_start
=prs_offset(ps
);
2197 if (MARSHALLING(ps
)) {
2198 /* Ensure the SD is 8 byte aligned in the buffer. */
2199 uint32 start
= prs_offset(ps
); /* Remember the start position. */
2202 /* Write a dummy value. */
2203 if (!prs_uint32("offset", ps
, depth
, &off_val
))
2207 if (!prs_align_uint64(ps
))
2210 /* Remember where we must seek back to write the SD. */
2211 offset
= prs_offset(ps
);
2213 /* Calculate the real offset for the SD. */
2215 off_val
= offset
- start
;
2217 /* Seek back to where we store the SD offset & store. */
2218 prs_set_offset(ps
, start
);
2219 if (!prs_uint32("offset", ps
, depth
, &off_val
))
2222 /* Return to after the 8 byte align. */
2223 prs_set_offset(ps
, offset
);
2226 if (!prs_uint32("offset", ps
, depth
, &offset
))
2228 /* Seek within the buffer. */
2229 if (!prs_set_offset(ps
, offset
))
2232 if (!sec_io_desc("sec_desc", &info
->secdesc
, ps
, depth
))
2238 /*******************************************************************
2239 Parse a PRINTER_INFO_4 structure.
2240 ********************************************************************/
2242 bool smb_io_printer_info_4(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_4
*info
, int depth
)
2244 prs_struct
*ps
=&buffer
->prs
;
2246 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_4");
2249 buffer
->struct_start
=prs_offset(ps
);
2251 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2253 if (!smb_io_relstr("servername", buffer
, depth
, &info
->servername
))
2255 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2260 /*******************************************************************
2261 Parse a PRINTER_INFO_5 structure.
2262 ********************************************************************/
2264 bool smb_io_printer_info_5(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_5
*info
, int depth
)
2266 prs_struct
*ps
=&buffer
->prs
;
2268 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_5");
2271 buffer
->struct_start
=prs_offset(ps
);
2273 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2275 if (!smb_io_relstr("portname", buffer
, depth
, &info
->portname
))
2277 if (!prs_uint32("attributes", ps
, depth
, &info
->attributes
))
2279 if (!prs_uint32("device_not_selected_timeout", ps
, depth
, &info
->device_not_selected_timeout
))
2281 if (!prs_uint32("transmission_retry_timeout", ps
, depth
, &info
->transmission_retry_timeout
))
2286 /*******************************************************************
2287 Parse a PRINTER_INFO_6 structure.
2288 ********************************************************************/
2290 bool smb_io_printer_info_6(const char *desc
, RPC_BUFFER
*buffer
,
2291 PRINTER_INFO_6
*info
, int depth
)
2293 prs_struct
*ps
=&buffer
->prs
;
2295 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_6");
2298 if (!prs_uint32("status", ps
, depth
, &info
->status
))
2304 /*******************************************************************
2305 Parse a PRINTER_INFO_7 structure.
2306 ********************************************************************/
2308 bool smb_io_printer_info_7(const char *desc
, RPC_BUFFER
*buffer
, PRINTER_INFO_7
*info
, int depth
)
2310 prs_struct
*ps
=&buffer
->prs
;
2312 prs_debug(ps
, depth
, desc
, "smb_io_printer_info_7");
2315 buffer
->struct_start
=prs_offset(ps
);
2317 if (!smb_io_relstr("guid", buffer
, depth
, &info
->guid
))
2319 if (!prs_uint32("action", ps
, depth
, &info
->action
))
2324 /*******************************************************************
2325 Parse a PORT_INFO_1 structure.
2326 ********************************************************************/
2328 bool smb_io_port_info_1(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_1
*info
, int depth
)
2330 prs_struct
*ps
=&buffer
->prs
;
2332 prs_debug(ps
, depth
, desc
, "smb_io_port_info_1");
2335 buffer
->struct_start
=prs_offset(ps
);
2337 if (!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2343 /*******************************************************************
2344 Parse a PORT_INFO_2 structure.
2345 ********************************************************************/
2347 bool smb_io_port_info_2(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_2
*info
, int depth
)
2349 prs_struct
*ps
=&buffer
->prs
;
2351 prs_debug(ps
, depth
, desc
, "smb_io_port_info_2");
2354 buffer
->struct_start
=prs_offset(ps
);
2356 if (!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2358 if (!smb_io_relstr("monitor_name", buffer
, depth
, &info
->monitor_name
))
2360 if (!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2362 if (!prs_uint32("port_type", ps
, depth
, &info
->port_type
))
2364 if (!prs_uint32("reserved", ps
, depth
, &info
->reserved
))
2370 /*******************************************************************
2371 Parse a DRIVER_INFO_1 structure.
2372 ********************************************************************/
2374 bool smb_io_printer_driver_info_1(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_1
*info
, int depth
)
2376 prs_struct
*ps
=&buffer
->prs
;
2378 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_1");
2381 buffer
->struct_start
=prs_offset(ps
);
2383 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2389 /*******************************************************************
2390 Parse a DRIVER_INFO_2 structure.
2391 ********************************************************************/
2393 bool smb_io_printer_driver_info_2(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_2
*info
, int depth
)
2395 prs_struct
*ps
=&buffer
->prs
;
2397 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_2");
2400 buffer
->struct_start
=prs_offset(ps
);
2402 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2404 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2406 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2408 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2410 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2412 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2418 /*******************************************************************
2419 Parse a DRIVER_INFO_3 structure.
2420 ********************************************************************/
2422 bool smb_io_printer_driver_info_3(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_3
*info
, int depth
)
2424 prs_struct
*ps
=&buffer
->prs
;
2426 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_3");
2429 buffer
->struct_start
=prs_offset(ps
);
2431 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2433 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2435 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2437 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2439 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2441 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2443 if (!smb_io_relstr("helpfile", buffer
, depth
, &info
->helpfile
))
2446 if (!smb_io_relarraystr("dependentfiles", buffer
, depth
, &info
->dependentfiles
))
2449 if (!smb_io_relstr("monitorname", buffer
, depth
, &info
->monitorname
))
2451 if (!smb_io_relstr("defaultdatatype", buffer
, depth
, &info
->defaultdatatype
))
2457 /*******************************************************************
2458 Parse a DRIVER_INFO_6 structure.
2459 ********************************************************************/
2461 bool smb_io_printer_driver_info_6(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_INFO_6
*info
, int depth
)
2463 prs_struct
*ps
=&buffer
->prs
;
2465 prs_debug(ps
, depth
, desc
, "smb_io_printer_driver_info_6");
2468 buffer
->struct_start
=prs_offset(ps
);
2470 if (!prs_uint32("version", ps
, depth
, &info
->version
))
2472 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2474 if (!smb_io_relstr("architecture", buffer
, depth
, &info
->architecture
))
2476 if (!smb_io_relstr("driverpath", buffer
, depth
, &info
->driverpath
))
2478 if (!smb_io_relstr("datafile", buffer
, depth
, &info
->datafile
))
2480 if (!smb_io_relstr("configfile", buffer
, depth
, &info
->configfile
))
2482 if (!smb_io_relstr("helpfile", buffer
, depth
, &info
->helpfile
))
2485 if (!smb_io_relarraystr("dependentfiles", buffer
, depth
, &info
->dependentfiles
))
2488 if (!smb_io_relstr("monitorname", buffer
, depth
, &info
->monitorname
))
2490 if (!smb_io_relstr("defaultdatatype", buffer
, depth
, &info
->defaultdatatype
))
2493 if (!smb_io_relarraystr("previousdrivernames", buffer
, depth
, &info
->previousdrivernames
))
2496 if (!prs_uint64("date", ps
, depth
, &info
->driver_date
))
2499 if (!prs_uint32("padding", ps
, depth
, &info
->padding
))
2502 if (!prs_uint32("driver_version_low", ps
, depth
, &info
->driver_version_low
))
2505 if (!prs_uint32("driver_version_high", ps
, depth
, &info
->driver_version_high
))
2508 if (!smb_io_relstr("mfgname", buffer
, depth
, &info
->mfgname
))
2510 if (!smb_io_relstr("oem_url", buffer
, depth
, &info
->oem_url
))
2512 if (!smb_io_relstr("hardware_id", buffer
, depth
, &info
->hardware_id
))
2514 if (!smb_io_relstr("provider", buffer
, depth
, &info
->provider
))
2520 /*******************************************************************
2521 Parse a JOB_INFO_1 structure.
2522 ********************************************************************/
2524 bool smb_io_job_info_1(const char *desc
, RPC_BUFFER
*buffer
, JOB_INFO_1
*info
, int depth
)
2526 prs_struct
*ps
=&buffer
->prs
;
2528 prs_debug(ps
, depth
, desc
, "smb_io_job_info_1");
2531 buffer
->struct_start
=prs_offset(ps
);
2533 if (!prs_uint32("jobid", ps
, depth
, &info
->jobid
))
2535 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2537 if (!smb_io_relstr("machinename", buffer
, depth
, &info
->machinename
))
2539 if (!smb_io_relstr("username", buffer
, depth
, &info
->username
))
2541 if (!smb_io_relstr("document", buffer
, depth
, &info
->document
))
2543 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2545 if (!smb_io_relstr("text_status", buffer
, depth
, &info
->text_status
))
2547 if (!prs_uint32("status", ps
, depth
, &info
->status
))
2549 if (!prs_uint32("priority", ps
, depth
, &info
->priority
))
2551 if (!prs_uint32("position", ps
, depth
, &info
->position
))
2553 if (!prs_uint32("totalpages", ps
, depth
, &info
->totalpages
))
2555 if (!prs_uint32("pagesprinted", ps
, depth
, &info
->pagesprinted
))
2557 if (!spoolss_io_system_time("submitted", ps
, depth
, &info
->submitted
))
2563 /*******************************************************************
2564 Parse a JOB_INFO_2 structure.
2565 ********************************************************************/
2567 bool smb_io_job_info_2(const char *desc
, RPC_BUFFER
*buffer
, JOB_INFO_2
*info
, int depth
)
2570 prs_struct
*ps
=&buffer
->prs
;
2572 prs_debug(ps
, depth
, desc
, "smb_io_job_info_2");
2575 buffer
->struct_start
=prs_offset(ps
);
2577 if (!prs_uint32("jobid",ps
, depth
, &info
->jobid
))
2579 if (!smb_io_relstr("printername", buffer
, depth
, &info
->printername
))
2581 if (!smb_io_relstr("machinename", buffer
, depth
, &info
->machinename
))
2583 if (!smb_io_relstr("username", buffer
, depth
, &info
->username
))
2585 if (!smb_io_relstr("document", buffer
, depth
, &info
->document
))
2587 if (!smb_io_relstr("notifyname", buffer
, depth
, &info
->notifyname
))
2589 if (!smb_io_relstr("datatype", buffer
, depth
, &info
->datatype
))
2592 if (!smb_io_relstr("printprocessor", buffer
, depth
, &info
->printprocessor
))
2594 if (!smb_io_relstr("parameters", buffer
, depth
, &info
->parameters
))
2596 if (!smb_io_relstr("drivername", buffer
, depth
, &info
->drivername
))
2598 if (!smb_io_reldevmode("devmode", buffer
, depth
, &info
->devmode
))
2600 if (!smb_io_relstr("text_status", buffer
, depth
, &info
->text_status
))
2603 /* SEC_DESC sec_desc;*/
2604 if (!prs_uint32("Hack! sec desc", ps
, depth
, &pipo
))
2607 if (!prs_uint32("status",ps
, depth
, &info
->status
))
2609 if (!prs_uint32("priority",ps
, depth
, &info
->priority
))
2611 if (!prs_uint32("position",ps
, depth
, &info
->position
))
2613 if (!prs_uint32("starttime",ps
, depth
, &info
->starttime
))
2615 if (!prs_uint32("untiltime",ps
, depth
, &info
->untiltime
))
2617 if (!prs_uint32("totalpages",ps
, depth
, &info
->totalpages
))
2619 if (!prs_uint32("size",ps
, depth
, &info
->size
))
2621 if (!spoolss_io_system_time("submitted", ps
, depth
, &info
->submitted
) )
2623 if (!prs_uint32("timeelapsed",ps
, depth
, &info
->timeelapsed
))
2625 if (!prs_uint32("pagesprinted",ps
, depth
, &info
->pagesprinted
))
2631 /*******************************************************************
2632 ********************************************************************/
2634 bool smb_io_form_1(const char *desc
, RPC_BUFFER
*buffer
, FORM_1
*info
, int depth
)
2636 prs_struct
*ps
=&buffer
->prs
;
2638 prs_debug(ps
, depth
, desc
, "smb_io_form_1");
2641 buffer
->struct_start
=prs_offset(ps
);
2643 if (!prs_uint32("flag", ps
, depth
, &info
->flag
))
2646 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2649 if (!prs_uint32("width", ps
, depth
, &info
->width
))
2651 if (!prs_uint32("length", ps
, depth
, &info
->length
))
2653 if (!prs_uint32("left", ps
, depth
, &info
->left
))
2655 if (!prs_uint32("top", ps
, depth
, &info
->top
))
2657 if (!prs_uint32("right", ps
, depth
, &info
->right
))
2659 if (!prs_uint32("bottom", ps
, depth
, &info
->bottom
))
2667 /*******************************************************************
2668 Parse a DRIVER_DIRECTORY_1 structure.
2669 ********************************************************************/
2671 bool smb_io_driverdir_1(const char *desc
, RPC_BUFFER
*buffer
, DRIVER_DIRECTORY_1
*info
, int depth
)
2673 prs_struct
*ps
=&buffer
->prs
;
2675 prs_debug(ps
, depth
, desc
, "smb_io_driverdir_1");
2678 buffer
->struct_start
=prs_offset(ps
);
2680 if (!smb_io_unistr(desc
, &info
->name
, ps
, depth
))
2686 /*******************************************************************
2687 Parse a PORT_INFO_1 structure.
2688 ********************************************************************/
2690 bool smb_io_port_1(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_1
*info
, int depth
)
2692 prs_struct
*ps
=&buffer
->prs
;
2694 prs_debug(ps
, depth
, desc
, "smb_io_port_1");
2697 buffer
->struct_start
=prs_offset(ps
);
2699 if(!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2705 /*******************************************************************
2706 Parse a PORT_INFO_2 structure.
2707 ********************************************************************/
2709 bool smb_io_port_2(const char *desc
, RPC_BUFFER
*buffer
, PORT_INFO_2
*info
, int depth
)
2711 prs_struct
*ps
=&buffer
->prs
;
2713 prs_debug(ps
, depth
, desc
, "smb_io_port_2");
2716 buffer
->struct_start
=prs_offset(ps
);
2718 if(!smb_io_relstr("port_name", buffer
, depth
, &info
->port_name
))
2720 if(!smb_io_relstr("monitor_name", buffer
, depth
, &info
->monitor_name
))
2722 if(!smb_io_relstr("description", buffer
, depth
, &info
->description
))
2724 if(!prs_uint32("port_type", ps
, depth
, &info
->port_type
))
2726 if(!prs_uint32("reserved", ps
, depth
, &info
->reserved
))
2732 /*******************************************************************
2733 ********************************************************************/
2735 bool smb_io_printprocessor_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCESSOR_1
*info
, int depth
)
2737 prs_struct
*ps
=&buffer
->prs
;
2739 prs_debug(ps
, depth
, desc
, "smb_io_printprocessor_info_1");
2742 buffer
->struct_start
=prs_offset(ps
);
2744 if (smb_io_relstr("name", buffer
, depth
, &info
->name
))
2750 /*******************************************************************
2751 ********************************************************************/
2753 bool smb_io_printprocdatatype_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCDATATYPE_1
*info
, int depth
)
2755 prs_struct
*ps
=&buffer
->prs
;
2757 prs_debug(ps
, depth
, desc
, "smb_io_printprocdatatype_info_1");
2760 buffer
->struct_start
=prs_offset(ps
);
2762 if (smb_io_relstr("name", buffer
, depth
, &info
->name
))
2768 /*******************************************************************
2769 ********************************************************************/
2771 bool smb_io_printmonitor_info_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTMONITOR_1
*info
, int depth
)
2773 prs_struct
*ps
=&buffer
->prs
;
2775 prs_debug(ps
, depth
, desc
, "smb_io_printmonitor_info_1");
2778 buffer
->struct_start
=prs_offset(ps
);
2780 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2786 /*******************************************************************
2787 ********************************************************************/
2789 bool smb_io_printmonitor_info_2(const char *desc
, RPC_BUFFER
*buffer
, PRINTMONITOR_2
*info
, int depth
)
2791 prs_struct
*ps
=&buffer
->prs
;
2793 prs_debug(ps
, depth
, desc
, "smb_io_printmonitor_info_2");
2796 buffer
->struct_start
=prs_offset(ps
);
2798 if (!smb_io_relstr("name", buffer
, depth
, &info
->name
))
2800 if (!smb_io_relstr("environment", buffer
, depth
, &info
->environment
))
2802 if (!smb_io_relstr("dll_name", buffer
, depth
, &info
->dll_name
))
2808 /*******************************************************************
2809 return the size required by a struct in the stream
2810 ********************************************************************/
2812 uint32
spoolss_size_printer_info_0(PRINTER_INFO_0
*info
)
2816 size
+=size_of_relative_string( &info
->printername
);
2817 size
+=size_of_relative_string( &info
->servername
);
2819 size
+=size_of_uint32( &info
->cjobs
);
2820 size
+=size_of_uint32( &info
->total_jobs
);
2821 size
+=size_of_uint32( &info
->total_bytes
);
2823 size
+=size_of_uint16( &info
->year
);
2824 size
+=size_of_uint16( &info
->month
);
2825 size
+=size_of_uint16( &info
->dayofweek
);
2826 size
+=size_of_uint16( &info
->day
);
2827 size
+=size_of_uint16( &info
->hour
);
2828 size
+=size_of_uint16( &info
->minute
);
2829 size
+=size_of_uint16( &info
->second
);
2830 size
+=size_of_uint16( &info
->milliseconds
);
2832 size
+=size_of_uint32( &info
->global_counter
);
2833 size
+=size_of_uint32( &info
->total_pages
);
2835 size
+=size_of_uint16( &info
->major_version
);
2836 size
+=size_of_uint16( &info
->build_version
);
2838 size
+=size_of_uint32( &info
->unknown7
);
2839 size
+=size_of_uint32( &info
->unknown8
);
2840 size
+=size_of_uint32( &info
->unknown9
);
2841 size
+=size_of_uint32( &info
->session_counter
);
2842 size
+=size_of_uint32( &info
->unknown11
);
2843 size
+=size_of_uint32( &info
->printer_errors
);
2844 size
+=size_of_uint32( &info
->unknown13
);
2845 size
+=size_of_uint32( &info
->unknown14
);
2846 size
+=size_of_uint32( &info
->unknown15
);
2847 size
+=size_of_uint32( &info
->unknown16
);
2848 size
+=size_of_uint32( &info
->change_id
);
2849 size
+=size_of_uint32( &info
->unknown18
);
2850 size
+=size_of_uint32( &info
->status
);
2851 size
+=size_of_uint32( &info
->unknown20
);
2852 size
+=size_of_uint32( &info
->c_setprinter
);
2854 size
+=size_of_uint16( &info
->unknown22
);
2855 size
+=size_of_uint16( &info
->unknown23
);
2856 size
+=size_of_uint16( &info
->unknown24
);
2857 size
+=size_of_uint16( &info
->unknown25
);
2858 size
+=size_of_uint16( &info
->unknown26
);
2859 size
+=size_of_uint16( &info
->unknown27
);
2860 size
+=size_of_uint16( &info
->unknown28
);
2861 size
+=size_of_uint16( &info
->unknown29
);
2866 /*******************************************************************
2867 return the size required by a struct in the stream
2868 ********************************************************************/
2870 uint32
spoolss_size_printer_info_1(PRINTER_INFO_1
*info
)
2874 size
+=size_of_uint32( &info
->flags
);
2875 size
+=size_of_relative_string( &info
->description
);
2876 size
+=size_of_relative_string( &info
->name
);
2877 size
+=size_of_relative_string( &info
->comment
);
2882 /*******************************************************************
2883 return the size required by a struct in the stream
2884 ********************************************************************/
2886 uint32
spoolss_size_printer_info_2(PRINTER_INFO_2
*info
)
2892 size
+= ndr_size_security_descriptor( info
->secdesc
, NULL
, 0 );
2894 size
+=size_of_device_mode( info
->devmode
);
2896 size
+=size_of_relative_string( &info
->servername
);
2897 size
+=size_of_relative_string( &info
->printername
);
2898 size
+=size_of_relative_string( &info
->sharename
);
2899 size
+=size_of_relative_string( &info
->portname
);
2900 size
+=size_of_relative_string( &info
->drivername
);
2901 size
+=size_of_relative_string( &info
->comment
);
2902 size
+=size_of_relative_string( &info
->location
);
2904 size
+=size_of_relative_string( &info
->sepfile
);
2905 size
+=size_of_relative_string( &info
->printprocessor
);
2906 size
+=size_of_relative_string( &info
->datatype
);
2907 size
+=size_of_relative_string( &info
->parameters
);
2909 size
+=size_of_uint32( &info
->attributes
);
2910 size
+=size_of_uint32( &info
->priority
);
2911 size
+=size_of_uint32( &info
->defaultpriority
);
2912 size
+=size_of_uint32( &info
->starttime
);
2913 size
+=size_of_uint32( &info
->untiltime
);
2914 size
+=size_of_uint32( &info
->status
);
2915 size
+=size_of_uint32( &info
->cjobs
);
2916 size
+=size_of_uint32( &info
->averageppm
);
2919 * add any adjustments for alignment. This is
2920 * not optimal since we could be calling this
2921 * function from a loop (e.g. enumprinters), but
2922 * it is easier to maintain the calculation here and
2923 * not place the burden on the caller to remember. --jerry
2925 if ((size
% 4) != 0)
2926 size
+= 4 - (size
% 4);
2931 /*******************************************************************
2932 return the size required by a struct in the stream
2933 ********************************************************************/
2935 uint32
spoolss_size_printer_info_4(PRINTER_INFO_4
*info
)
2939 size
+=size_of_relative_string( &info
->printername
);
2940 size
+=size_of_relative_string( &info
->servername
);
2942 size
+=size_of_uint32( &info
->attributes
);
2946 /*******************************************************************
2947 return the size required by a struct in the stream
2948 ********************************************************************/
2950 uint32
spoolss_size_printer_info_5(PRINTER_INFO_5
*info
)
2954 size
+=size_of_relative_string( &info
->printername
);
2955 size
+=size_of_relative_string( &info
->portname
);
2957 size
+=size_of_uint32( &info
->attributes
);
2958 size
+=size_of_uint32( &info
->device_not_selected_timeout
);
2959 size
+=size_of_uint32( &info
->transmission_retry_timeout
);
2963 /*******************************************************************
2964 return the size required by a struct in the stream
2965 ********************************************************************/
2967 uint32
spoolss_size_printer_info_6(PRINTER_INFO_6
*info
)
2969 return sizeof(uint32
);
2972 /*******************************************************************
2973 return the size required by a struct in the stream
2974 ********************************************************************/
2976 uint32
spoolss_size_printer_info_3(PRINTER_INFO_3
*info
)
2978 /* The 8 is for the self relative pointer - 8 byte aligned.. */
2979 return 8 + (uint32
)ndr_size_security_descriptor( info
->secdesc
, NULL
, 0 );
2982 /*******************************************************************
2983 return the size required by a struct in the stream
2984 ********************************************************************/
2986 uint32
spoolss_size_printer_info_7(PRINTER_INFO_7
*info
)
2990 size
+=size_of_relative_string( &info
->guid
);
2991 size
+=size_of_uint32( &info
->action
);
2995 /*******************************************************************
2996 return the size required by a struct in the stream
2997 ********************************************************************/
2999 uint32
spoolss_size_printer_driver_info_1(DRIVER_INFO_1
*info
)
3002 size
+=size_of_relative_string( &info
->name
);
3007 /*******************************************************************
3008 return the size required by a struct in the stream
3009 ********************************************************************/
3011 uint32
spoolss_size_printer_driver_info_2(DRIVER_INFO_2
*info
)
3014 size
+=size_of_uint32( &info
->version
);
3015 size
+=size_of_relative_string( &info
->name
);
3016 size
+=size_of_relative_string( &info
->architecture
);
3017 size
+=size_of_relative_string( &info
->driverpath
);
3018 size
+=size_of_relative_string( &info
->datafile
);
3019 size
+=size_of_relative_string( &info
->configfile
);
3024 /*******************************************************************
3025 return the size required by a string array.
3026 ********************************************************************/
3028 uint32
spoolss_size_string_array(uint16
*string
)
3033 for (i
=0; (string
[i
]!=0x0000) || (string
[i
+1]!=0x0000); i
++);
3035 i
=i
+2; /* to count all chars including the leading zero */
3036 i
=2*i
; /* because we need the value in bytes */
3037 i
=i
+4; /* the offset pointer size */
3042 /*******************************************************************
3043 return the size required by a struct in the stream
3044 ********************************************************************/
3046 uint32
spoolss_size_printer_driver_info_3(DRIVER_INFO_3
*info
)
3050 size
+=size_of_uint32( &info
->version
);
3051 size
+=size_of_relative_string( &info
->name
);
3052 size
+=size_of_relative_string( &info
->architecture
);
3053 size
+=size_of_relative_string( &info
->driverpath
);
3054 size
+=size_of_relative_string( &info
->datafile
);
3055 size
+=size_of_relative_string( &info
->configfile
);
3056 size
+=size_of_relative_string( &info
->helpfile
);
3057 size
+=size_of_relative_string( &info
->monitorname
);
3058 size
+=size_of_relative_string( &info
->defaultdatatype
);
3060 size
+=spoolss_size_string_array(info
->dependentfiles
);
3065 /*******************************************************************
3066 return the size required by a struct in the stream
3067 ********************************************************************/
3069 uint32
spoolss_size_printer_driver_info_6(DRIVER_INFO_6
*info
)
3073 size
+=size_of_uint32( &info
->version
);
3074 size
+=size_of_relative_string( &info
->name
);
3075 size
+=size_of_relative_string( &info
->architecture
);
3076 size
+=size_of_relative_string( &info
->driverpath
);
3077 size
+=size_of_relative_string( &info
->datafile
);
3078 size
+=size_of_relative_string( &info
->configfile
);
3079 size
+=size_of_relative_string( &info
->helpfile
);
3081 size
+=spoolss_size_string_array(info
->dependentfiles
);
3083 size
+=size_of_relative_string( &info
->monitorname
);
3084 size
+=size_of_relative_string( &info
->defaultdatatype
);
3086 size
+=spoolss_size_string_array(info
->previousdrivernames
);
3088 size
+=size_of_nttime(&info
->driver_date
);
3089 size
+=size_of_uint32( &info
->padding
);
3090 size
+=size_of_uint32( &info
->driver_version_low
);
3091 size
+=size_of_uint32( &info
->driver_version_high
);
3092 size
+=size_of_relative_string( &info
->mfgname
);
3093 size
+=size_of_relative_string( &info
->oem_url
);
3094 size
+=size_of_relative_string( &info
->hardware_id
);
3095 size
+=size_of_relative_string( &info
->provider
);
3100 /*******************************************************************
3101 return the size required by a struct in the stream
3102 ********************************************************************/
3104 uint32
spoolss_size_job_info_1(JOB_INFO_1
*info
)
3107 size
+=size_of_uint32( &info
->jobid
);
3108 size
+=size_of_relative_string( &info
->printername
);
3109 size
+=size_of_relative_string( &info
->machinename
);
3110 size
+=size_of_relative_string( &info
->username
);
3111 size
+=size_of_relative_string( &info
->document
);
3112 size
+=size_of_relative_string( &info
->datatype
);
3113 size
+=size_of_relative_string( &info
->text_status
);
3114 size
+=size_of_uint32( &info
->status
);
3115 size
+=size_of_uint32( &info
->priority
);
3116 size
+=size_of_uint32( &info
->position
);
3117 size
+=size_of_uint32( &info
->totalpages
);
3118 size
+=size_of_uint32( &info
->pagesprinted
);
3119 size
+=size_of_systemtime( &info
->submitted
);
3124 /*******************************************************************
3125 return the size required by a struct in the stream
3126 ********************************************************************/
3128 uint32
spoolss_size_job_info_2(JOB_INFO_2
*info
)
3132 size
+=4; /* size of sec desc ptr */
3134 size
+=size_of_uint32( &info
->jobid
);
3135 size
+=size_of_relative_string( &info
->printername
);
3136 size
+=size_of_relative_string( &info
->machinename
);
3137 size
+=size_of_relative_string( &info
->username
);
3138 size
+=size_of_relative_string( &info
->document
);
3139 size
+=size_of_relative_string( &info
->notifyname
);
3140 size
+=size_of_relative_string( &info
->datatype
);
3141 size
+=size_of_relative_string( &info
->printprocessor
);
3142 size
+=size_of_relative_string( &info
->parameters
);
3143 size
+=size_of_relative_string( &info
->drivername
);
3144 size
+=size_of_device_mode( info
->devmode
);
3145 size
+=size_of_relative_string( &info
->text_status
);
3146 /* SEC_DESC sec_desc;*/
3147 size
+=size_of_uint32( &info
->status
);
3148 size
+=size_of_uint32( &info
->priority
);
3149 size
+=size_of_uint32( &info
->position
);
3150 size
+=size_of_uint32( &info
->starttime
);
3151 size
+=size_of_uint32( &info
->untiltime
);
3152 size
+=size_of_uint32( &info
->totalpages
);
3153 size
+=size_of_uint32( &info
->size
);
3154 size
+=size_of_systemtime( &info
->submitted
);
3155 size
+=size_of_uint32( &info
->timeelapsed
);
3156 size
+=size_of_uint32( &info
->pagesprinted
);
3161 /*******************************************************************
3162 return the size required by a struct in the stream
3163 ********************************************************************/
3165 uint32
spoolss_size_form_1(FORM_1
*info
)
3169 size
+=size_of_uint32( &info
->flag
);
3170 size
+=size_of_relative_string( &info
->name
);
3171 size
+=size_of_uint32( &info
->width
);
3172 size
+=size_of_uint32( &info
->length
);
3173 size
+=size_of_uint32( &info
->left
);
3174 size
+=size_of_uint32( &info
->top
);
3175 size
+=size_of_uint32( &info
->right
);
3176 size
+=size_of_uint32( &info
->bottom
);
3181 /*******************************************************************
3182 return the size required by a struct in the stream
3183 ********************************************************************/
3185 uint32
spoolss_size_port_info_1(PORT_INFO_1
*info
)
3189 size
+=size_of_relative_string( &info
->port_name
);
3194 /*******************************************************************
3195 return the size required by a struct in the stream
3196 ********************************************************************/
3198 uint32
spoolss_size_driverdir_info_1(DRIVER_DIRECTORY_1
*info
)
3202 size
=str_len_uni(&info
->name
); /* the string length */
3203 size
=size
+1; /* add the leading zero */
3204 size
=size
*2; /* convert in char */
3209 /*******************************************************************
3210 return the size required by a struct in the stream
3211 ********************************************************************/
3213 uint32
spoolss_size_printprocessordirectory_info_1(PRINTPROCESSOR_DIRECTORY_1
*info
)
3217 size
=str_len_uni(&info
->name
); /* the string length */
3218 size
=size
+1; /* add the leading zero */
3219 size
=size
*2; /* convert in char */
3224 /*******************************************************************
3225 return the size required by a struct in the stream
3226 ********************************************************************/
3228 uint32
spoolss_size_port_info_2(PORT_INFO_2
*info
)
3232 size
+=size_of_relative_string( &info
->port_name
);
3233 size
+=size_of_relative_string( &info
->monitor_name
);
3234 size
+=size_of_relative_string( &info
->description
);
3236 size
+=size_of_uint32( &info
->port_type
);
3237 size
+=size_of_uint32( &info
->reserved
);
3242 /*******************************************************************
3243 return the size required by a struct in the stream
3244 ********************************************************************/
3246 uint32
spoolss_size_printprocessor_info_1(PRINTPROCESSOR_1
*info
)
3249 size
+=size_of_relative_string( &info
->name
);
3254 /*******************************************************************
3255 return the size required by a struct in the stream
3256 ********************************************************************/
3258 uint32
spoolss_size_printprocdatatype_info_1(PRINTPROCDATATYPE_1
*info
)
3261 size
+=size_of_relative_string( &info
->name
);
3266 /*******************************************************************
3267 return the size required by a struct in the stream
3268 ********************************************************************/
3269 uint32
spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES
*p
)
3276 /* uint32(offset) + uint32(length) + length) */
3277 size
+= (size_of_uint32(&p
->value_len
)*2) + p
->value_len
;
3278 size
+= (size_of_uint32(&p
->data_len
)*2) + p
->data_len
+ (p
->data_len
%2) ;
3280 size
+= size_of_uint32(&p
->type
);
3285 /*******************************************************************
3286 return the size required by a struct in the stream
3287 ********************************************************************/
3289 uint32
spoolss_size_printmonitor_info_1(PRINTMONITOR_1
*info
)
3292 size
+=size_of_relative_string( &info
->name
);
3297 /*******************************************************************
3298 return the size required by a struct in the stream
3299 ********************************************************************/
3301 uint32
spoolss_size_printmonitor_info_2(PRINTMONITOR_2
*info
)
3304 size
+=size_of_relative_string( &info
->name
);
3305 size
+=size_of_relative_string( &info
->environment
);
3306 size
+=size_of_relative_string( &info
->dll_name
);
3311 /*******************************************************************
3313 ********************************************************************/
3315 bool make_spoolss_q_getprinterdriver2(SPOOL_Q_GETPRINTERDRIVER2
*q_u
,
3316 const POLICY_HND
*hnd
,
3317 const fstring architecture
,
3318 uint32 level
, uint32 clientmajor
, uint32 clientminor
,
3319 RPC_BUFFER
*buffer
, uint32 offered
)
3324 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3326 init_buf_unistr2(&q_u
->architecture
, &q_u
->architecture_ptr
, architecture
);
3329 q_u
->clientmajorversion
=clientmajor
;
3330 q_u
->clientminorversion
=clientminor
;
3333 q_u
->offered
=offered
;
3338 /*******************************************************************
3340 * called from spoolss_getprinterdriver2 (srv_spoolss.c)
3341 ********************************************************************/
3343 bool spoolss_io_q_getprinterdriver2(const char *desc
, SPOOL_Q_GETPRINTERDRIVER2
*q_u
, prs_struct
*ps
, int depth
)
3345 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdriver2");
3351 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3353 if(!prs_uint32("architecture_ptr", ps
, depth
, &q_u
->architecture_ptr
))
3355 if(!smb_io_unistr2("architecture", &q_u
->architecture
, q_u
->architecture_ptr
, ps
, depth
))
3360 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3363 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3369 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3372 if(!prs_uint32("clientmajorversion", ps
, depth
, &q_u
->clientmajorversion
))
3374 if(!prs_uint32("clientminorversion", ps
, depth
, &q_u
->clientminorversion
))
3380 /*******************************************************************
3382 * called from spoolss_getprinterdriver2 (srv_spoolss.c)
3383 ********************************************************************/
3385 bool spoolss_io_r_getprinterdriver2(const char *desc
, SPOOL_R_GETPRINTERDRIVER2
*r_u
, prs_struct
*ps
, int depth
)
3387 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdriver2");
3393 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3398 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3400 if (!prs_uint32("servermajorversion", ps
, depth
, &r_u
->servermajorversion
))
3402 if (!prs_uint32("serverminorversion", ps
, depth
, &r_u
->serverminorversion
))
3404 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3410 /*******************************************************************
3412 ********************************************************************/
3414 bool make_spoolss_q_enumprinters(
3415 SPOOL_Q_ENUMPRINTERS
*q_u
,
3425 q_u
->servername_ptr
= (servername
!= NULL
) ? 1 : 0;
3426 init_buf_unistr2(&q_u
->servername
, &q_u
->servername_ptr
, servername
);
3430 q_u
->offered
=offered
;
3435 /*******************************************************************
3437 ********************************************************************/
3439 bool make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS
*q_u
,
3440 fstring servername
, uint32 level
,
3441 RPC_BUFFER
*buffer
, uint32 offered
)
3443 q_u
->name_ptr
= (servername
!= NULL
) ? 1 : 0;
3444 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, servername
);
3448 q_u
->offered
=offered
;
3453 /*******************************************************************
3455 * called from spoolss_enumprinters (srv_spoolss.c)
3456 ********************************************************************/
3458 bool spoolss_io_q_enumprinters(const char *desc
, SPOOL_Q_ENUMPRINTERS
*q_u
, prs_struct
*ps
, int depth
)
3460 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinters");
3466 if (!prs_uint32("flags", ps
, depth
, &q_u
->flags
))
3468 if (!prs_uint32("servername_ptr", ps
, depth
, &q_u
->servername_ptr
))
3471 if (!smb_io_unistr2("", &q_u
->servername
, q_u
->servername_ptr
, ps
, depth
))
3476 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
3479 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3484 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3490 /*******************************************************************
3491 Parse a SPOOL_R_ENUMPRINTERS structure.
3492 ********************************************************************/
3494 bool spoolss_io_r_enumprinters(const char *desc
, SPOOL_R_ENUMPRINTERS
*r_u
, prs_struct
*ps
, int depth
)
3496 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinters");
3502 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3508 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3511 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
3514 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3520 /*******************************************************************
3521 * write a structure.
3522 * called from spoolss_r_enum_printers (srv_spoolss.c)
3524 ********************************************************************/
3526 bool spoolss_io_r_getprinter(const char *desc
, SPOOL_R_GETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
3528 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinter");
3534 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3540 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3543 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3549 /*******************************************************************
3551 * called from spoolss_getprinter (srv_spoolss.c)
3552 ********************************************************************/
3554 bool spoolss_io_q_getprinter(const char *desc
, SPOOL_Q_GETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
3556 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinter");
3562 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3564 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
3567 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3572 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3578 /*******************************************************************
3580 ********************************************************************/
3582 bool make_spoolss_q_getprinter(
3583 TALLOC_CTX
*mem_ctx
,
3584 SPOOL_Q_GETPRINTER
*q_u
,
3585 const POLICY_HND
*hnd
,
3595 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3599 q_u
->offered
=offered
;
3604 /*******************************************************************
3606 ********************************************************************/
3607 bool make_spoolss_q_setprinter(TALLOC_CTX
*mem_ctx
, SPOOL_Q_SETPRINTER
*q_u
,
3608 const POLICY_HND
*hnd
, uint32 level
, PRINTER_INFO_CTR
*info
,
3612 DEVICEMODE
*devmode
;
3617 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3620 q_u
->info
.level
= level
;
3621 q_u
->info
.info_ptr
= 1; /* Info is != NULL, see above */
3624 /* There's no such thing as a setprinter level 1 */
3627 secdesc
= info
->printers_2
->secdesc
;
3628 devmode
= info
->printers_2
->devmode
;
3630 make_spoolss_printer_info_2 (mem_ctx
, &q_u
->info
.info_2
, info
->printers_2
);
3631 #if 1 /* JERRY TEST */
3632 q_u
->secdesc_ctr
= SMB_MALLOC_P(SEC_DESC_BUF
);
3633 if (!q_u
->secdesc_ctr
)
3635 q_u
->secdesc_ctr
->sd
= secdesc
;
3636 q_u
->secdesc_ctr
->sd_size
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3638 q_u
->devmode_ctr
.devmode_ptr
= (devmode
!= NULL
) ? 1 : 0;
3639 q_u
->devmode_ctr
.size
= (devmode
!= NULL
) ? sizeof(DEVICEMODE
) + (3*sizeof(uint32
)) : 0;
3640 q_u
->devmode_ctr
.devmode
= devmode
;
3642 q_u
->secdesc_ctr
= NULL
;
3644 q_u
->devmode_ctr
.devmode_ptr
= 0;
3645 q_u
->devmode_ctr
.size
= 0;
3646 q_u
->devmode_ctr
.devmode
= NULL
;
3650 secdesc
= info
->printers_3
->secdesc
;
3652 make_spoolss_printer_info_3 (mem_ctx
, &q_u
->info
.info_3
, info
->printers_3
);
3654 q_u
->secdesc_ctr
= SMB_MALLOC_P(SEC_DESC_BUF
);
3655 if (!q_u
->secdesc_ctr
)
3657 q_u
->secdesc_ctr
->sd_size
= (secdesc
) ? sizeof(SEC_DESC
) + (2*sizeof(uint32
)) : 0;
3658 q_u
->secdesc_ctr
->sd
= secdesc
;
3662 make_spoolss_printer_info_7 (mem_ctx
, &q_u
->info
.info_7
, info
->printers_7
);
3666 DEBUG(0,("make_spoolss_q_setprinter: Unknown info level [%d]\n", level
));
3671 q_u
->command
= command
;
3677 /*******************************************************************
3678 ********************************************************************/
3680 bool spoolss_io_r_setprinter(const char *desc
, SPOOL_R_SETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
3682 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinter");
3688 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3694 /*******************************************************************
3695 Marshall/unmarshall a SPOOL_Q_SETPRINTER struct.
3696 ********************************************************************/
3698 bool spoolss_io_q_setprinter(const char *desc
, SPOOL_Q_SETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
3700 uint32 ptr_sec_desc
= 0;
3702 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinter");
3708 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
,ps
, depth
))
3710 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3713 /* check for supported levels and structures we know about */
3715 switch ( q_u
->level
) {
3720 /* supported levels */
3723 DEBUG(0,("spoolss_io_q_setprinter: unsupported printer info level [%d]\n",
3729 if(!spool_io_printer_info_level("", &q_u
->info
, ps
, depth
))
3732 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
3742 ptr_sec_desc
= q_u
->info
.info_2
->secdesc_ptr
;
3747 /* FIXME ! Our parsing here is wrong I think,
3748 * but for a level3 it makes no sense for
3749 * ptr_sec_desc to be NULL. JRA. Based on
3750 * a Vista sniff from Martin Zielinski <mz@seh.de>.
3752 if (UNMARSHALLING(ps
)) {
3755 ptr_sec_desc
= q_u
->info
.info_3
->secdesc_ptr
;
3762 if (!sec_io_desc_buf(desc
, &q_u
->secdesc_ctr
, ps
, depth
))
3767 /* Parse a NULL security descriptor. This should really
3768 happen inside the sec_io_desc_buf() function. */
3770 prs_debug(ps
, depth
, "", "sec_io_desc_buf");
3771 if (!prs_uint32("size", ps
, depth
+ 1, &dummy
))
3773 if (!prs_uint32("ptr", ps
, depth
+ 1, &dummy
))
3777 if(!prs_uint32("command", ps
, depth
, &q_u
->command
))
3783 /*******************************************************************
3784 ********************************************************************/
3786 bool spoolss_io_r_fcpn(const char *desc
, SPOOL_R_FCPN
*r_u
, prs_struct
*ps
, int depth
)
3788 prs_debug(ps
, depth
, desc
, "spoolss_io_r_fcpn");
3794 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3800 /*******************************************************************
3801 ********************************************************************/
3803 bool spoolss_io_q_fcpn(const char *desc
, SPOOL_Q_FCPN
*q_u
, prs_struct
*ps
, int depth
)
3806 prs_debug(ps
, depth
, desc
, "spoolss_io_q_fcpn");
3812 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
3819 /*******************************************************************
3820 ********************************************************************/
3822 bool spoolss_io_r_addjob(const char *desc
, SPOOL_R_ADDJOB
*r_u
, prs_struct
*ps
, int depth
)
3824 prs_debug(ps
, depth
, desc
, "");
3830 if(!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3836 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3839 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3845 /*******************************************************************
3846 ********************************************************************/
3848 bool spoolss_io_q_addjob(const char *desc
, SPOOL_Q_ADDJOB
*q_u
, prs_struct
*ps
, int depth
)
3850 prs_debug(ps
, depth
, desc
, "");
3856 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
3858 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
3861 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3867 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3873 /*******************************************************************
3874 ********************************************************************/
3876 bool spoolss_io_r_enumjobs(const char *desc
, SPOOL_R_ENUMJOBS
*r_u
, prs_struct
*ps
, int depth
)
3878 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumjobs");
3884 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
3890 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
3893 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
3896 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
3902 /*******************************************************************
3903 ********************************************************************/
3905 bool make_spoolss_q_enumjobs(SPOOL_Q_ENUMJOBS
*q_u
, const POLICY_HND
*hnd
,
3916 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
3917 q_u
->firstjob
= firstjob
;
3918 q_u
->numofjobs
= numofjobs
;
3920 q_u
->buffer
= buffer
;
3921 q_u
->offered
= offered
;
3925 /*******************************************************************
3926 ********************************************************************/
3928 bool spoolss_io_q_enumjobs(const char *desc
, SPOOL_Q_ENUMJOBS
*q_u
, prs_struct
*ps
, int depth
)
3930 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumjobs");
3936 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
, ps
, depth
))
3939 if (!prs_uint32("firstjob", ps
, depth
, &q_u
->firstjob
))
3941 if (!prs_uint32("numofjobs", ps
, depth
, &q_u
->numofjobs
))
3943 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
3946 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
3952 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
3958 /*******************************************************************
3959 ********************************************************************/
3961 bool spoolss_io_r_schedulejob(const char *desc
, SPOOL_R_SCHEDULEJOB
*r_u
, prs_struct
*ps
, int depth
)
3963 prs_debug(ps
, depth
, desc
, "spoolss_io_r_schedulejob");
3969 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
3975 /*******************************************************************
3976 ********************************************************************/
3978 bool spoolss_io_q_schedulejob(const char *desc
, SPOOL_Q_SCHEDULEJOB
*q_u
, prs_struct
*ps
, int depth
)
3980 prs_debug(ps
, depth
, desc
, "spoolss_io_q_schedulejob");
3986 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
3988 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
3994 /*******************************************************************
3995 ********************************************************************/
3997 bool spoolss_io_r_setjob(const char *desc
, SPOOL_R_SETJOB
*r_u
, prs_struct
*ps
, int depth
)
3999 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setjob");
4005 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4011 /*******************************************************************
4012 ********************************************************************/
4014 bool spoolss_io_q_setjob(const char *desc
, SPOOL_Q_SETJOB
*q_u
, prs_struct
*ps
, int depth
)
4016 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setjob");
4022 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4024 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
4027 * level is usually 0. If (level!=0) then I'm in trouble !
4028 * I will try to generate setjob command with level!=0, one day.
4030 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
4032 if(!prs_uint32("command", ps
, depth
, &q_u
->command
))
4038 /*******************************************************************
4039 Parse a SPOOL_R_ENUMPRINTERDRIVERS structure.
4040 ********************************************************************/
4042 bool spoolss_io_r_enumprinterdrivers(const char *desc
, SPOOL_R_ENUMPRINTERDRIVERS
*r_u
, prs_struct
*ps
, int depth
)
4044 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdrivers");
4050 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4056 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4059 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4062 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4068 /*******************************************************************
4070 ********************************************************************/
4072 bool make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS
*q_u
,
4074 const char *environment
,
4076 RPC_BUFFER
*buffer
, uint32 offered
)
4078 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, name
);
4079 init_buf_unistr2(&q_u
->environment
, &q_u
->environment_ptr
, environment
);
4083 q_u
->offered
=offered
;
4088 /*******************************************************************
4089 Parse a SPOOL_Q_ENUMPRINTERDRIVERS structure.
4090 ********************************************************************/
4092 bool spoolss_io_q_enumprinterdrivers(const char *desc
, SPOOL_Q_ENUMPRINTERDRIVERS
*q_u
, prs_struct
*ps
, int depth
)
4095 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdrivers");
4101 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
4103 if (!smb_io_unistr2("", &q_u
->name
, q_u
->name_ptr
,ps
, depth
))
4108 if (!prs_uint32("environment_ptr", ps
, depth
, &q_u
->environment_ptr
))
4110 if (!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
4115 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4118 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4124 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4130 /*******************************************************************
4131 ********************************************************************/
4133 bool spoolss_io_q_enumforms(const char *desc
, SPOOL_Q_ENUMFORMS
*q_u
, prs_struct
*ps
, int depth
)
4136 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumforms");
4141 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4143 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4146 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4151 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4157 /*******************************************************************
4158 ********************************************************************/
4160 bool spoolss_io_r_enumforms(const char *desc
, SPOOL_R_ENUMFORMS
*r_u
, prs_struct
*ps
, int depth
)
4162 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumforms");
4168 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4174 if (!prs_uint32("size of buffer needed", ps
, depth
, &r_u
->needed
))
4177 if (!prs_uint32("numofforms", ps
, depth
, &r_u
->numofforms
))
4180 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4186 /*******************************************************************
4187 ********************************************************************/
4189 bool spoolss_io_q_getform(const char *desc
, SPOOL_Q_GETFORM
*q_u
, prs_struct
*ps
, int depth
)
4192 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getform");
4197 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
4199 if (!smb_io_unistr2("", &q_u
->formname
,True
,ps
,depth
))
4205 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4208 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4213 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4219 /*******************************************************************
4220 ********************************************************************/
4222 bool spoolss_io_r_getform(const char *desc
, SPOOL_R_GETFORM
*r_u
, prs_struct
*ps
, int depth
)
4224 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getform");
4230 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4236 if (!prs_uint32("size of buffer needed", ps
, depth
, &r_u
->needed
))
4239 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4245 /*******************************************************************
4246 Parse a SPOOL_R_ENUMPORTS structure.
4247 ********************************************************************/
4249 bool spoolss_io_r_enumports(const char *desc
, SPOOL_R_ENUMPORTS
*r_u
, prs_struct
*ps
, int depth
)
4251 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumports");
4257 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
4263 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
4266 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
4269 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
4275 /*******************************************************************
4276 ********************************************************************/
4278 bool spoolss_io_q_enumports(const char *desc
, SPOOL_Q_ENUMPORTS
*q_u
, prs_struct
*ps
, int depth
)
4280 prs_debug(ps
, depth
, desc
, "");
4286 if (!prs_uint32("", ps
, depth
, &q_u
->name_ptr
))
4288 if (!smb_io_unistr2("", &q_u
->name
,True
,ps
,depth
))
4293 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
4296 if (!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
4301 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
4307 /*******************************************************************
4308 Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure.
4309 ********************************************************************/
4311 bool spool_io_printer_info_level_1(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_1
*il
, prs_struct
*ps
, int depth
)
4313 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_1");
4319 if(!prs_uint32("flags", ps
, depth
, &il
->flags
))
4321 if(!prs_uint32("description_ptr", ps
, depth
, &il
->description_ptr
))
4323 if(!prs_uint32("name_ptr", ps
, depth
, &il
->name_ptr
))
4325 if(!prs_uint32("comment_ptr", ps
, depth
, &il
->comment_ptr
))
4328 if(!smb_io_unistr2("description", &il
->description
, il
->description_ptr
, ps
, depth
))
4330 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4332 if(!smb_io_unistr2("comment", &il
->comment
, il
->comment_ptr
, ps
, depth
))
4338 /*******************************************************************
4339 Parse a SPOOL_PRINTER_INFO_LEVEL_3 structure.
4340 ********************************************************************/
4342 bool spool_io_printer_info_level_3(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_3
*il
, prs_struct
*ps
, int depth
)
4344 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_3");
4350 if(!prs_uint32("secdesc_ptr", ps
, depth
, &il
->secdesc_ptr
))
4356 /*******************************************************************
4357 Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure.
4358 ********************************************************************/
4360 bool spool_io_printer_info_level_2(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_2
*il
, prs_struct
*ps
, int depth
)
4362 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_2");
4368 if(!prs_uint32("servername_ptr", ps
, depth
, &il
->servername_ptr
))
4370 if(!prs_uint32("printername_ptr", ps
, depth
, &il
->printername_ptr
))
4372 if(!prs_uint32("sharename_ptr", ps
, depth
, &il
->sharename_ptr
))
4374 if(!prs_uint32("portname_ptr", ps
, depth
, &il
->portname_ptr
))
4377 if(!prs_uint32("drivername_ptr", ps
, depth
, &il
->drivername_ptr
))
4379 if(!prs_uint32("comment_ptr", ps
, depth
, &il
->comment_ptr
))
4381 if(!prs_uint32("location_ptr", ps
, depth
, &il
->location_ptr
))
4383 if(!prs_uint32("devmode_ptr", ps
, depth
, &il
->devmode_ptr
))
4385 if(!prs_uint32("sepfile_ptr", ps
, depth
, &il
->sepfile_ptr
))
4387 if(!prs_uint32("printprocessor_ptr", ps
, depth
, &il
->printprocessor_ptr
))
4389 if(!prs_uint32("datatype_ptr", ps
, depth
, &il
->datatype_ptr
))
4391 if(!prs_uint32("parameters_ptr", ps
, depth
, &il
->parameters_ptr
))
4393 if(!prs_uint32("secdesc_ptr", ps
, depth
, &il
->secdesc_ptr
))
4396 if(!prs_uint32("attributes", ps
, depth
, &il
->attributes
))
4398 if(!prs_uint32("priority", ps
, depth
, &il
->priority
))
4400 if(!prs_uint32("default_priority", ps
, depth
, &il
->default_priority
))
4402 if(!prs_uint32("starttime", ps
, depth
, &il
->starttime
))
4404 if(!prs_uint32("untiltime", ps
, depth
, &il
->untiltime
))
4406 if(!prs_uint32("status", ps
, depth
, &il
->status
))
4408 if(!prs_uint32("cjobs", ps
, depth
, &il
->cjobs
))
4410 if(!prs_uint32("averageppm", ps
, depth
, &il
->averageppm
))
4413 if(!smb_io_unistr2("servername", &il
->servername
, il
->servername_ptr
, ps
, depth
))
4415 if(!smb_io_unistr2("printername", &il
->printername
, il
->printername_ptr
, ps
, depth
))
4417 if(!smb_io_unistr2("sharename", &il
->sharename
, il
->sharename_ptr
, ps
, depth
))
4419 if(!smb_io_unistr2("portname", &il
->portname
, il
->portname_ptr
, ps
, depth
))
4421 if(!smb_io_unistr2("drivername", &il
->drivername
, il
->drivername_ptr
, ps
, depth
))
4423 if(!smb_io_unistr2("comment", &il
->comment
, il
->comment_ptr
, ps
, depth
))
4425 if(!smb_io_unistr2("location", &il
->location
, il
->location_ptr
, ps
, depth
))
4427 if(!smb_io_unistr2("sepfile", &il
->sepfile
, il
->sepfile_ptr
, ps
, depth
))
4429 if(!smb_io_unistr2("printprocessor", &il
->printprocessor
, il
->printprocessor_ptr
, ps
, depth
))
4431 if(!smb_io_unistr2("datatype", &il
->datatype
, il
->datatype_ptr
, ps
, depth
))
4433 if(!smb_io_unistr2("parameters", &il
->parameters
, il
->parameters_ptr
, ps
, depth
))
4439 bool spool_io_printer_info_level_7(const char *desc
, SPOOL_PRINTER_INFO_LEVEL_7
*il
, prs_struct
*ps
, int depth
)
4441 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level_7");
4447 if(!prs_uint32("guid_ptr", ps
, depth
, &il
->guid_ptr
))
4449 if(!prs_uint32("action", ps
, depth
, &il
->action
))
4452 if(!smb_io_unistr2("servername", &il
->guid
, il
->guid_ptr
, ps
, depth
))
4457 /*******************************************************************
4458 ********************************************************************/
4460 bool spool_io_printer_info_level(const char *desc
, SPOOL_PRINTER_INFO_LEVEL
*il
, prs_struct
*ps
, int depth
)
4462 prs_debug(ps
, depth
, desc
, "spool_io_printer_info_level");
4467 if(!prs_uint32("level", ps
, depth
, &il
->level
))
4469 if(!prs_uint32("info_ptr", ps
, depth
, &il
->info_ptr
))
4472 /* if no struct inside just return */
4473 if (il
->info_ptr
==0) {
4474 if (UNMARSHALLING(ps
)) {
4481 switch (il
->level
) {
4483 * level 0 is used by setprinter when managing the queue
4484 * (hold, stop, start a queue)
4488 /* DOCUMENT ME!!! What is level 1 used for? */
4491 if (UNMARSHALLING(ps
)) {
4492 if ((il
->info_1
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_1
,1)) == NULL
)
4495 if (!spool_io_printer_info_level_1("", il
->info_1
, ps
, depth
))
4500 * level 2 is used by addprinter
4501 * and by setprinter when updating printer's info
4504 if (UNMARSHALLING(ps
)) {
4505 if ((il
->info_2
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_2
,1)) == NULL
)
4508 if (!spool_io_printer_info_level_2("", il
->info_2
, ps
, depth
))
4511 /* DOCUMENT ME!!! What is level 3 used for? */
4514 if (UNMARSHALLING(ps
)) {
4515 if ((il
->info_3
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_3
,1)) == NULL
)
4518 if (!spool_io_printer_info_level_3("", il
->info_3
, ps
, depth
))
4523 if (UNMARSHALLING(ps
))
4524 if ((il
->info_7
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_INFO_LEVEL_7
,1)) == NULL
)
4526 if (!spool_io_printer_info_level_7("", il
->info_7
, ps
, depth
))
4534 /*******************************************************************
4535 ********************************************************************/
4537 bool spoolss_io_q_addprinterex(const char *desc
, SPOOL_Q_ADDPRINTEREX
*q_u
, prs_struct
*ps
, int depth
)
4539 uint32 ptr_sec_desc
= 0;
4541 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterex");
4547 if (!prs_io_unistr2_p("ptr", ps
, depth
, &q_u
->server_name
))
4549 if (!prs_io_unistr2("servername", ps
, depth
, q_u
->server_name
))
4555 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
4558 if(!spool_io_printer_info_level("", &q_u
->info
, ps
, depth
))
4561 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
4567 switch (q_u
->level
) {
4569 ptr_sec_desc
= q_u
->info
.info_2
->secdesc_ptr
;
4572 ptr_sec_desc
= q_u
->info
.info_3
->secdesc_ptr
;
4576 if (!sec_io_desc_buf(desc
, &q_u
->secdesc_ctr
, ps
, depth
))
4581 /* Parse a NULL security descriptor. This should really
4582 happen inside the sec_io_desc_buf() function. */
4584 prs_debug(ps
, depth
, "", "sec_io_desc_buf");
4585 if (!prs_uint32("size", ps
, depth
+ 1, &dummy
))
4587 if (!prs_uint32("ptr", ps
, depth
+ 1, &dummy
))
4591 if(!prs_uint32("user_switch", ps
, depth
, &q_u
->user_switch
))
4593 if(!spool_io_user_level("", &q_u
->user_ctr
, ps
, depth
))
4599 /*******************************************************************
4600 ********************************************************************/
4602 bool spoolss_io_r_addprinterex(const char *desc
, SPOOL_R_ADDPRINTEREX
*r_u
,
4603 prs_struct
*ps
, int depth
)
4605 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterex");
4608 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
4611 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
4617 /*******************************************************************
4618 ********************************************************************/
4620 bool spool_io_printer_driver_info_level_3(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
**q_u
,
4621 prs_struct
*ps
, int depth
)
4623 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*il
;
4625 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level_3");
4629 if (UNMARSHALLING(ps
)) {
4630 il
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
,1);
4642 if(!prs_uint32("cversion", ps
, depth
, &il
->cversion
))
4644 if(!prs_uint32("name", ps
, depth
, &il
->name_ptr
))
4646 if(!prs_uint32("environment", ps
, depth
, &il
->environment_ptr
))
4648 if(!prs_uint32("driverpath", ps
, depth
, &il
->driverpath_ptr
))
4650 if(!prs_uint32("datafile", ps
, depth
, &il
->datafile_ptr
))
4652 if(!prs_uint32("configfile", ps
, depth
, &il
->configfile_ptr
))
4654 if(!prs_uint32("helpfile", ps
, depth
, &il
->helpfile_ptr
))
4656 if(!prs_uint32("monitorname", ps
, depth
, &il
->monitorname_ptr
))
4658 if(!prs_uint32("defaultdatatype", ps
, depth
, &il
->defaultdatatype_ptr
))
4660 if(!prs_uint32("dependentfilessize", ps
, depth
, &il
->dependentfilessize
))
4662 if(!prs_uint32("dependentfiles", ps
, depth
, &il
->dependentfiles_ptr
))
4668 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4670 if(!smb_io_unistr2("environment", &il
->environment
, il
->environment_ptr
, ps
, depth
))
4672 if(!smb_io_unistr2("driverpath", &il
->driverpath
, il
->driverpath_ptr
, ps
, depth
))
4674 if(!smb_io_unistr2("datafile", &il
->datafile
, il
->datafile_ptr
, ps
, depth
))
4676 if(!smb_io_unistr2("configfile", &il
->configfile
, il
->configfile_ptr
, ps
, depth
))
4678 if(!smb_io_unistr2("helpfile", &il
->helpfile
, il
->helpfile_ptr
, ps
, depth
))
4680 if(!smb_io_unistr2("monitorname", &il
->monitorname
, il
->monitorname_ptr
, ps
, depth
))
4682 if(!smb_io_unistr2("defaultdatatype", &il
->defaultdatatype
, il
->defaultdatatype_ptr
, ps
, depth
))
4688 if (il
->dependentfiles_ptr
)
4689 smb_io_buffer5("", &il
->dependentfiles
, ps
, depth
);
4694 /*******************************************************************
4695 parse a SPOOL_PRINTER_DRIVER_INFO_LEVEL_6 structure
4696 ********************************************************************/
4698 bool spool_io_printer_driver_info_level_6(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
**q_u
,
4699 prs_struct
*ps
, int depth
)
4701 SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
*il
;
4703 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level_6");
4707 if (UNMARSHALLING(ps
)) {
4708 il
=PRS_ALLOC_MEM(ps
,SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
,1);
4721 * I know this seems weird, but I have no other explanation.
4722 * This is observed behavior on both NT4 and 2K servers.
4726 if (!prs_align_uint64(ps
))
4729 /* parse the main elements the packet */
4731 if(!prs_uint32("cversion ", ps
, depth
, &il
->version
))
4733 if(!prs_uint32("name ", ps
, depth
, &il
->name_ptr
))
4735 if(!prs_uint32("environment ", ps
, depth
, &il
->environment_ptr
))
4737 if(!prs_uint32("driverpath ", ps
, depth
, &il
->driverpath_ptr
))
4739 if(!prs_uint32("datafile ", ps
, depth
, &il
->datafile_ptr
))
4741 if(!prs_uint32("configfile ", ps
, depth
, &il
->configfile_ptr
))
4743 if(!prs_uint32("helpfile ", ps
, depth
, &il
->helpfile_ptr
))
4745 if(!prs_uint32("monitorname ", ps
, depth
, &il
->monitorname_ptr
))
4747 if(!prs_uint32("defaultdatatype", ps
, depth
, &il
->defaultdatatype_ptr
))
4749 if(!prs_uint32("dependentfiles ", ps
, depth
, &il
->dependentfiles_len
))
4751 if(!prs_uint32("dependentfiles ", ps
, depth
, &il
->dependentfiles_ptr
))
4753 if(!prs_uint32("previousnames ", ps
, depth
, &il
->previousnames_len
))
4755 if(!prs_uint32("previousnames ", ps
, depth
, &il
->previousnames_ptr
))
4757 if(!smb_io_time("driverdate ", &il
->driverdate
, ps
, depth
))
4759 if(!prs_uint32("dummy4 ", ps
, depth
, &il
->dummy4
))
4761 if(!prs_uint64("driverversion ", ps
, depth
, &il
->driverversion
))
4763 if(!prs_uint32("mfgname ", ps
, depth
, &il
->mfgname_ptr
))
4765 if(!prs_uint32("oemurl ", ps
, depth
, &il
->oemurl_ptr
))
4767 if(!prs_uint32("hardwareid ", ps
, depth
, &il
->hardwareid_ptr
))
4769 if(!prs_uint32("provider ", ps
, depth
, &il
->provider_ptr
))
4772 /* parse the structures in the packet */
4774 if(!smb_io_unistr2("name", &il
->name
, il
->name_ptr
, ps
, depth
))
4779 if(!smb_io_unistr2("environment", &il
->environment
, il
->environment_ptr
, ps
, depth
))
4784 if(!smb_io_unistr2("driverpath", &il
->driverpath
, il
->driverpath_ptr
, ps
, depth
))
4789 if(!smb_io_unistr2("datafile", &il
->datafile
, il
->datafile_ptr
, ps
, depth
))
4794 if(!smb_io_unistr2("configfile", &il
->configfile
, il
->configfile_ptr
, ps
, depth
))
4799 if(!smb_io_unistr2("helpfile", &il
->helpfile
, il
->helpfile_ptr
, ps
, depth
))
4804 if(!smb_io_unistr2("monitorname", &il
->monitorname
, il
->monitorname_ptr
, ps
, depth
))
4809 if(!smb_io_unistr2("defaultdatatype", &il
->defaultdatatype
, il
->defaultdatatype_ptr
, ps
, depth
))
4813 if (il
->dependentfiles_ptr
) {
4814 if(!smb_io_buffer5("dependentfiles", &il
->dependentfiles
, ps
, depth
))
4819 if (il
->previousnames_ptr
) {
4820 if(!smb_io_buffer5("previousnames", &il
->previousnames
, ps
, depth
))
4825 if(!smb_io_unistr2("mfgname", &il
->mfgname
, il
->mfgname_ptr
, ps
, depth
))
4829 if(!smb_io_unistr2("oemurl", &il
->oemurl
, il
->oemurl_ptr
, ps
, depth
))
4833 if(!smb_io_unistr2("hardwareid", &il
->hardwareid
, il
->hardwareid_ptr
, ps
, depth
))
4837 if(!smb_io_unistr2("provider", &il
->provider
, il
->provider_ptr
, ps
, depth
))
4843 /*******************************************************************
4844 convert a buffer of UNICODE strings null terminated
4845 the buffer is terminated by a NULL
4847 convert to an dos codepage array (null terminated)
4849 dynamically allocate memory
4851 ********************************************************************/
4853 static bool uniarray_2_dosarray(BUFFER5
*buf5
, fstring
**ar
)
4862 src
= (char *)buf5
->buffer
;
4863 *ar
= SMB_MALLOC_ARRAY(fstring
, 1);
4868 while (src
< ((char *)buf5
->buffer
) + buf5
->buf_len
*2) {
4869 rpcstr_pull(f
, src
, sizeof(f
)-1, -1, STR_TERMINATE
);
4870 src
= skip_unibuf(src
, 2*buf5
->buf_len
- PTR_DIFF(src
,buf5
->buffer
));
4871 *ar
= SMB_REALLOC_ARRAY(*ar
, fstring
, n
+2);
4875 fstrcpy((*ar
)[n
], f
);
4879 fstrcpy((*ar
)[n
], "");
4884 /*******************************************************************
4885 read a UNICODE array with null terminated strings
4886 and null terminated array
4887 and size of array at beginning
4888 ********************************************************************/
4890 bool smb_io_unibuffer(const char *desc
, UNISTR2
*buffer
, prs_struct
*ps
, int depth
)
4892 if (buffer
==NULL
) return False
;
4895 buffer
->uni_str_len
=buffer
->uni_max_len
;
4897 if(!prs_uint32("buffer_size", ps
, depth
, &buffer
->uni_max_len
))
4900 if(!prs_unistr2(True
, "buffer ", ps
, depth
, buffer
))
4906 /*******************************************************************
4907 ********************************************************************/
4909 bool spool_io_printer_driver_info_level(const char *desc
, SPOOL_PRINTER_DRIVER_INFO_LEVEL
*il
, prs_struct
*ps
, int depth
)
4911 prs_debug(ps
, depth
, desc
, "spool_io_printer_driver_info_level");
4916 if(!prs_uint32("level", ps
, depth
, &il
->level
))
4918 if(!prs_uint32("ptr", ps
, depth
, &il
->ptr
))
4924 switch (il
->level
) {
4926 if(!spool_io_printer_driver_info_level_3("", &il
->info_3
, ps
, depth
))
4930 if(!spool_io_printer_driver_info_level_6("", &il
->info_6
, ps
, depth
))
4940 /*******************************************************************
4941 init a SPOOL_Q_ADDPRINTERDRIVER struct
4942 ******************************************************************/
4944 bool make_spoolss_q_addprinterdriver(TALLOC_CTX
*mem_ctx
,
4945 SPOOL_Q_ADDPRINTERDRIVER
*q_u
, const char* srv_name
,
4946 uint32 level
, PRINTER_DRIVER_CTR
*info
)
4948 DEBUG(5,("make_spoolss_q_addprinterdriver\n"));
4950 if (!srv_name
|| !info
) {
4954 q_u
->server_name_ptr
= 1; /* srv_name is != NULL, see above */
4955 init_unistr2(&q_u
->server_name
, srv_name
, UNI_STR_TERMINATE
);
4959 q_u
->info
.level
= level
;
4960 q_u
->info
.ptr
= 1; /* Info is != NULL, see above */
4963 /* info level 3 is supported by Windows 95/98, WinNT and Win2k */
4965 make_spoolss_driver_info_3(mem_ctx
, &q_u
->info
.info_3
, info
->info3
);
4969 DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level
));
4976 bool make_spoolss_driver_info_3(TALLOC_CTX
*mem_ctx
,
4977 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
**spool_drv_info
,
4978 DRIVER_INFO_3
*info3
)
4981 SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*inf
;
4983 if (!(inf
=TALLOC_ZERO_P(mem_ctx
, SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
)))
4986 inf
->cversion
= info3
->version
;
4987 inf
->name_ptr
= (info3
->name
.buffer
!=NULL
)?1:0;
4988 inf
->environment_ptr
= (info3
->architecture
.buffer
!=NULL
)?1:0;
4989 inf
->driverpath_ptr
= (info3
->driverpath
.buffer
!=NULL
)?1:0;
4990 inf
->datafile_ptr
= (info3
->datafile
.buffer
!=NULL
)?1:0;
4991 inf
->configfile_ptr
= (info3
->configfile
.buffer
!=NULL
)?1:0;
4992 inf
->helpfile_ptr
= (info3
->helpfile
.buffer
!=NULL
)?1:0;
4993 inf
->monitorname_ptr
= (info3
->monitorname
.buffer
!=NULL
)?1:0;
4994 inf
->defaultdatatype_ptr
= (info3
->defaultdatatype
.buffer
!=NULL
)?1:0;
4996 init_unistr2_from_unistr(inf
, &inf
->name
, &info3
->name
);
4997 init_unistr2_from_unistr(inf
, &inf
->environment
, &info3
->architecture
);
4998 init_unistr2_from_unistr(inf
, &inf
->driverpath
, &info3
->driverpath
);
4999 init_unistr2_from_unistr(inf
, &inf
->datafile
, &info3
->datafile
);
5000 init_unistr2_from_unistr(inf
, &inf
->configfile
, &info3
->configfile
);
5001 init_unistr2_from_unistr(inf
, &inf
->helpfile
, &info3
->helpfile
);
5002 init_unistr2_from_unistr(inf
, &inf
->monitorname
, &info3
->monitorname
);
5003 init_unistr2_from_unistr(inf
, &inf
->defaultdatatype
, &info3
->defaultdatatype
);
5005 if (info3
->dependentfiles
) {
5007 bool null_char
= False
;
5008 uint16
*ptr
= info3
->dependentfiles
;
5013 /* the null_char bool is used to help locate
5014 two '\0's back to back */
5031 inf
->dependentfiles_ptr
= (info3
->dependentfiles
!= NULL
) ? 1 : 0;
5032 inf
->dependentfilessize
= (info3
->dependentfiles
!= NULL
) ? len
: 0;
5033 if(!make_spoolss_buffer5(mem_ctx
, &inf
->dependentfiles
, len
, info3
->dependentfiles
)) {
5038 *spool_drv_info
= inf
;
5043 /*******************************************************************
5044 make a BUFFER5 struct from a uint16*
5045 ******************************************************************/
5047 bool make_spoolss_buffer5(TALLOC_CTX
*mem_ctx
, BUFFER5
*buf5
, uint32 len
, uint16
*src
)
5050 buf5
->buf_len
= len
;
5053 if((buf5
->buffer
=(uint16
*)TALLOC_MEMDUP(mem_ctx
, src
, sizeof(uint16
)*len
)) == NULL
) {
5054 DEBUG(0,("make_spoolss_buffer5: Unable to malloc memory for buffer!\n"));
5058 buf5
->buffer
= NULL
;
5067 /*******************************************************************
5068 fill in the prs_struct for a ADDPRINTERDRIVER request PDU
5069 ********************************************************************/
5071 bool spoolss_io_q_addprinterdriver(const char *desc
, SPOOL_Q_ADDPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
5073 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterdriver");
5079 if(!prs_uint32("server_name_ptr", ps
, depth
, &q_u
->server_name_ptr
))
5081 if(!smb_io_unistr2("server_name", &q_u
->server_name
, q_u
->server_name_ptr
, ps
, depth
))
5086 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
5089 if(!spool_io_printer_driver_info_level("", &q_u
->info
, ps
, depth
))
5095 /*******************************************************************
5096 ********************************************************************/
5098 bool spoolss_io_r_addprinterdriver(const char *desc
, SPOOL_R_ADDPRINTERDRIVER
*q_u
, prs_struct
*ps
, int depth
)
5100 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterdriver");
5103 if(!prs_werror("status", ps
, depth
, &q_u
->status
))
5109 /*******************************************************************
5110 fill in the prs_struct for a ADDPRINTERDRIVER request PDU
5111 ********************************************************************/
5113 bool spoolss_io_q_addprinterdriverex(const char *desc
, SPOOL_Q_ADDPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
5115 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprinterdriverex");
5121 if(!prs_uint32("server_name_ptr", ps
, depth
, &q_u
->server_name_ptr
))
5123 if(!smb_io_unistr2("server_name", &q_u
->server_name
, q_u
->server_name_ptr
, ps
, depth
))
5128 if(!prs_uint32("info_level", ps
, depth
, &q_u
->level
))
5131 if(!spool_io_printer_driver_info_level("", &q_u
->info
, ps
, depth
))
5136 if(!prs_uint32("copy flags", ps
, depth
, &q_u
->copy_flags
))
5142 /*******************************************************************
5143 ********************************************************************/
5145 bool spoolss_io_r_addprinterdriverex(const char *desc
, SPOOL_R_ADDPRINTERDRIVEREX
*q_u
, prs_struct
*ps
, int depth
)
5147 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprinterdriverex");
5150 if(!prs_werror("status", ps
, depth
, &q_u
->status
))
5156 /*******************************************************************
5157 ********************************************************************/
5159 bool uni_2_asc_printer_driver_3(SPOOL_PRINTER_DRIVER_INFO_LEVEL_3
*uni
,
5160 NT_PRINTER_DRIVER_INFO_LEVEL_3
**asc
)
5162 NT_PRINTER_DRIVER_INFO_LEVEL_3
*d
;
5164 DEBUG(7,("uni_2_asc_printer_driver_3: Converting from UNICODE to ASCII\n"));
5168 *asc
=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_3
);
5176 d
->cversion
=uni
->cversion
;
5178 unistr2_to_ascii(d
->name
, &uni
->name
, sizeof(d
->name
));
5179 unistr2_to_ascii(d
->environment
, &uni
->environment
, sizeof(d
->environment
));
5180 unistr2_to_ascii(d
->driverpath
, &uni
->driverpath
, sizeof(d
->driverpath
));
5181 unistr2_to_ascii(d
->datafile
, &uni
->datafile
, sizeof(d
->datafile
));
5182 unistr2_to_ascii(d
->configfile
, &uni
->configfile
, sizeof(d
->configfile
));
5183 unistr2_to_ascii(d
->helpfile
, &uni
->helpfile
, sizeof(d
->helpfile
));
5184 unistr2_to_ascii(d
->monitorname
, &uni
->monitorname
, sizeof(d
->monitorname
));
5185 unistr2_to_ascii(d
->defaultdatatype
, &uni
->defaultdatatype
, sizeof(d
->defaultdatatype
));
5187 DEBUGADD(8,( "version: %d\n", d
->cversion
));
5188 DEBUGADD(8,( "name: %s\n", d
->name
));
5189 DEBUGADD(8,( "environment: %s\n", d
->environment
));
5190 DEBUGADD(8,( "driverpath: %s\n", d
->driverpath
));
5191 DEBUGADD(8,( "datafile: %s\n", d
->datafile
));
5192 DEBUGADD(8,( "configfile: %s\n", d
->configfile
));
5193 DEBUGADD(8,( "helpfile: %s\n", d
->helpfile
));
5194 DEBUGADD(8,( "monitorname: %s\n", d
->monitorname
));
5195 DEBUGADD(8,( "defaultdatatype: %s\n", d
->defaultdatatype
));
5197 if (uniarray_2_dosarray(&uni
->dependentfiles
, &d
->dependentfiles
))
5204 /*******************************************************************
5205 ********************************************************************/
5206 bool uni_2_asc_printer_driver_6(SPOOL_PRINTER_DRIVER_INFO_LEVEL_6
*uni
,
5207 NT_PRINTER_DRIVER_INFO_LEVEL_6
**asc
)
5209 NT_PRINTER_DRIVER_INFO_LEVEL_6
*d
;
5211 DEBUG(7,("uni_2_asc_printer_driver_6: Converting from UNICODE to ASCII\n"));
5215 *asc
=SMB_MALLOC_P(NT_PRINTER_DRIVER_INFO_LEVEL_6
);
5223 d
->version
=uni
->version
;
5225 unistr2_to_ascii(d
->name
, &uni
->name
, sizeof(d
->name
));
5226 unistr2_to_ascii(d
->environment
, &uni
->environment
, sizeof(d
->environment
));
5227 unistr2_to_ascii(d
->driverpath
, &uni
->driverpath
, sizeof(d
->driverpath
));
5228 unistr2_to_ascii(d
->datafile
, &uni
->datafile
, sizeof(d
->datafile
));
5229 unistr2_to_ascii(d
->configfile
, &uni
->configfile
, sizeof(d
->configfile
));
5230 unistr2_to_ascii(d
->helpfile
, &uni
->helpfile
, sizeof(d
->helpfile
));
5231 unistr2_to_ascii(d
->monitorname
, &uni
->monitorname
, sizeof(d
->monitorname
));
5232 unistr2_to_ascii(d
->defaultdatatype
, &uni
->defaultdatatype
, sizeof(d
->defaultdatatype
));
5234 DEBUGADD(8,( "version: %d\n", d
->version
));
5235 DEBUGADD(8,( "name: %s\n", d
->name
));
5236 DEBUGADD(8,( "environment: %s\n", d
->environment
));
5237 DEBUGADD(8,( "driverpath: %s\n", d
->driverpath
));
5238 DEBUGADD(8,( "datafile: %s\n", d
->datafile
));
5239 DEBUGADD(8,( "configfile: %s\n", d
->configfile
));
5240 DEBUGADD(8,( "helpfile: %s\n", d
->helpfile
));
5241 DEBUGADD(8,( "monitorname: %s\n", d
->monitorname
));
5242 DEBUGADD(8,( "defaultdatatype: %s\n", d
->defaultdatatype
));
5244 if (!uniarray_2_dosarray(&uni
->dependentfiles
, &d
->dependentfiles
))
5246 if (!uniarray_2_dosarray(&uni
->previousnames
, &d
->previousnames
))
5256 bool uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2
*uni
,
5257 NT_PRINTER_INFO_LEVEL_2
*d
)
5259 DEBUG(7,("Converting from UNICODE to ASCII\n"));
5261 d
->attributes
=uni
->attributes
;
5262 d
->priority
=uni
->priority
;
5263 d
->default_priority
=uni
->default_priority
;
5264 d
->starttime
=uni
->starttime
;
5265 d
->untiltime
=uni
->untiltime
;
5266 d
->status
=uni
->status
;
5267 d
->cjobs
=uni
->cjobs
;
5269 unistr2_to_ascii(d
->servername
, &uni
->servername
, sizeof(d
->servername
));
5270 unistr2_to_ascii(d
->printername
, &uni
->printername
, sizeof(d
->printername
));
5271 unistr2_to_ascii(d
->sharename
, &uni
->sharename
, sizeof(d
->sharename
));
5272 unistr2_to_ascii(d
->portname
, &uni
->portname
, sizeof(d
->portname
));
5273 unistr2_to_ascii(d
->drivername
, &uni
->drivername
, sizeof(d
->drivername
));
5274 unistr2_to_ascii(d
->comment
, &uni
->comment
, sizeof(d
->comment
));
5275 unistr2_to_ascii(d
->location
, &uni
->location
, sizeof(d
->location
));
5276 unistr2_to_ascii(d
->sepfile
, &uni
->sepfile
, sizeof(d
->sepfile
));
5277 unistr2_to_ascii(d
->printprocessor
, &uni
->printprocessor
, sizeof(d
->printprocessor
));
5278 unistr2_to_ascii(d
->datatype
, &uni
->datatype
, sizeof(d
->datatype
));
5279 unistr2_to_ascii(d
->parameters
, &uni
->parameters
, sizeof(d
->parameters
));
5284 /*******************************************************************
5286 ********************************************************************/
5288 bool make_spoolss_q_getprinterdriverdir(SPOOL_Q_GETPRINTERDRIVERDIR
*q_u
,
5289 fstring servername
, fstring env_name
, uint32 level
,
5290 RPC_BUFFER
*buffer
, uint32 offered
)
5292 init_buf_unistr2(&q_u
->name
, &q_u
->name_ptr
, servername
);
5293 init_buf_unistr2(&q_u
->environment
, &q_u
->environment_ptr
, env_name
);
5297 q_u
->offered
=offered
;
5302 /*******************************************************************
5303 Parse a SPOOL_Q_GETPRINTERDRIVERDIR structure.
5304 ********************************************************************/
5306 bool spoolss_io_q_getprinterdriverdir(const char *desc
, SPOOL_Q_GETPRINTERDRIVERDIR
*q_u
, prs_struct
*ps
, int depth
)
5308 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdriverdir");
5313 if(!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5315 if(!smb_io_unistr2("", &q_u
->name
, q_u
->name_ptr
, ps
, depth
))
5321 if(!prs_uint32("", ps
, depth
, &q_u
->environment_ptr
))
5323 if(!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
5329 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
5332 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5338 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5344 /*******************************************************************
5345 Parse a SPOOL_R_GETPRINTERDRIVERDIR structure.
5346 ********************************************************************/
5348 bool spoolss_io_r_getprinterdriverdir(const char *desc
, SPOOL_R_GETPRINTERDRIVERDIR
*r_u
, prs_struct
*ps
, int depth
)
5350 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdriverdir");
5356 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5362 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5365 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5371 /*******************************************************************
5372 ********************************************************************/
5374 bool spoolss_io_r_enumprintprocessors(const char *desc
, SPOOL_R_ENUMPRINTPROCESSORS
*r_u
, prs_struct
*ps
, int depth
)
5376 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintprocessors");
5382 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5388 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5391 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5394 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5400 /*******************************************************************
5401 ********************************************************************/
5403 bool spoolss_io_q_enumprintprocessors(const char *desc
, SPOOL_Q_ENUMPRINTPROCESSORS
*q_u
, prs_struct
*ps
, int depth
)
5405 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintprocessors");
5411 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5413 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5419 if (!prs_uint32("", ps
, depth
, &q_u
->environment_ptr
))
5421 if (!smb_io_unistr2("", &q_u
->environment
, q_u
->environment_ptr
, ps
, depth
))
5427 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5430 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5436 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5442 /*******************************************************************
5443 ********************************************************************/
5445 bool spoolss_io_q_addprintprocessor(const char *desc
, SPOOL_Q_ADDPRINTPROCESSOR
*q_u
, prs_struct
*ps
, int depth
)
5447 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addprintprocessor");
5453 if (!prs_uint32("server_ptr", ps
, depth
, &q_u
->server_ptr
))
5455 if (!smb_io_unistr2("server", &q_u
->server
, q_u
->server_ptr
, ps
, depth
))
5460 if (!smb_io_unistr2("environment", &q_u
->environment
, True
, ps
, depth
))
5465 if (!smb_io_unistr2("path", &q_u
->path
, True
, ps
, depth
))
5470 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5476 /*******************************************************************
5477 ********************************************************************/
5479 bool spoolss_io_r_addprintprocessor(const char *desc
, SPOOL_R_ADDPRINTPROCESSOR
*r_u
, prs_struct
*ps
, int depth
)
5481 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addprintproicessor");
5487 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5493 /*******************************************************************
5494 ********************************************************************/
5496 bool spoolss_io_r_enumprintprocdatatypes(const char *desc
, SPOOL_R_ENUMPRINTPROCDATATYPES
*r_u
, prs_struct
*ps
, int depth
)
5498 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintprocdatatypes");
5504 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5510 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5513 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5516 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5522 /*******************************************************************
5523 ********************************************************************/
5525 bool spoolss_io_q_enumprintprocdatatypes(const char *desc
, SPOOL_Q_ENUMPRINTPROCDATATYPES
*q_u
, prs_struct
*ps
, int depth
)
5527 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintprocdatatypes");
5533 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5535 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5541 if (!prs_uint32("processor_ptr", ps
, depth
, &q_u
->processor_ptr
))
5543 if (!smb_io_unistr2("processor", &q_u
->processor
, q_u
->processor_ptr
, ps
, depth
))
5549 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5552 if(!prs_rpcbuffer_p("buffer", ps
, depth
, &q_u
->buffer
))
5558 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5564 /*******************************************************************
5565 Parse a SPOOL_Q_ENUMPRINTMONITORS structure.
5566 ********************************************************************/
5568 bool spoolss_io_q_enumprintmonitors(const char *desc
, SPOOL_Q_ENUMPRINTMONITORS
*q_u
, prs_struct
*ps
, int depth
)
5570 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprintmonitors");
5576 if (!prs_uint32("name_ptr", ps
, depth
, &q_u
->name_ptr
))
5578 if (!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
5584 if (!prs_uint32("level", ps
, depth
, &q_u
->level
))
5587 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
5593 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
5599 /*******************************************************************
5600 ********************************************************************/
5602 bool spoolss_io_r_enumprintmonitors(const char *desc
, SPOOL_R_ENUMPRINTMONITORS
*r_u
, prs_struct
*ps
, int depth
)
5604 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprintmonitors");
5610 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
5616 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
5619 if (!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
5622 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
5628 /*******************************************************************
5629 ********************************************************************/
5631 bool spoolss_io_r_enumprinterdata(const char *desc
, SPOOL_R_ENUMPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
5633 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdata");
5638 if(!prs_uint32("valuesize", ps
, depth
, &r_u
->valuesize
))
5641 if (UNMARSHALLING(ps
) && r_u
->valuesize
) {
5642 r_u
->value
= PRS_ALLOC_MEM(ps
, uint16
, r_u
->valuesize
);
5644 DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata value\n"));
5649 if(!prs_uint16uni(False
, "value", ps
, depth
, r_u
->value
, r_u
->valuesize
))
5655 if(!prs_uint32("realvaluesize", ps
, depth
, &r_u
->realvaluesize
))
5658 if(!prs_uint32("type", ps
, depth
, &r_u
->type
))
5661 if(!prs_uint32("datasize", ps
, depth
, &r_u
->datasize
))
5664 if (UNMARSHALLING(ps
) && r_u
->datasize
) {
5665 r_u
->data
= PRS_ALLOC_MEM(ps
, uint8
, r_u
->datasize
);
5667 DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata data\n"));
5672 if(!prs_uint8s(False
, "data", ps
, depth
, r_u
->data
, r_u
->datasize
))
5677 if(!prs_uint32("realdatasize", ps
, depth
, &r_u
->realdatasize
))
5679 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5685 /*******************************************************************
5686 ********************************************************************/
5688 bool spoolss_io_q_enumprinterdata(const char *desc
, SPOOL_Q_ENUMPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
5690 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdata");
5695 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
5697 if(!prs_uint32("index", ps
, depth
, &q_u
->index
))
5699 if(!prs_uint32("valuesize", ps
, depth
, &q_u
->valuesize
))
5701 if(!prs_uint32("datasize", ps
, depth
, &q_u
->datasize
))
5707 /*******************************************************************
5708 ********************************************************************/
5710 bool make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA
*q_u
,
5711 const POLICY_HND
*hnd
,
5712 uint32 idx
, uint32 valuelen
, uint32 datalen
)
5714 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5716 q_u
->valuesize
=valuelen
;
5717 q_u
->datasize
=datalen
;
5722 /*******************************************************************
5723 ********************************************************************/
5725 bool make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX
*q_u
,
5726 const POLICY_HND
*hnd
, const char *key
,
5729 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5730 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
5736 /*******************************************************************
5737 ********************************************************************/
5738 bool make_spoolss_q_setprinterdata(SPOOL_Q_SETPRINTERDATA
*q_u
, const POLICY_HND
*hnd
,
5739 char* value
, uint32 data_type
, char* data
, uint32 data_size
)
5741 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5742 q_u
->type
= data_type
;
5743 init_unistr2(&q_u
->value
, value
, UNI_STR_TERMINATE
);
5745 q_u
->max_len
= q_u
->real_len
= data_size
;
5746 q_u
->data
= (unsigned char *)data
;
5751 /*******************************************************************
5752 ********************************************************************/
5753 bool make_spoolss_q_setprinterdataex(SPOOL_Q_SETPRINTERDATAEX
*q_u
, const POLICY_HND
*hnd
,
5754 char *key
, char* value
, uint32 data_type
, char* data
,
5757 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
5758 q_u
->type
= data_type
;
5759 init_unistr2(&q_u
->value
, value
, UNI_STR_TERMINATE
);
5760 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
5762 q_u
->max_len
= q_u
->real_len
= data_size
;
5763 q_u
->data
= (unsigned char *)data
;
5768 /*******************************************************************
5769 ********************************************************************/
5771 bool spoolss_io_q_setprinterdata(const char *desc
, SPOOL_Q_SETPRINTERDATA
*q_u
, prs_struct
*ps
, int depth
)
5773 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinterdata");
5778 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
5780 if(!smb_io_unistr2("", &q_u
->value
, True
, ps
, depth
))
5786 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
5789 if(!prs_uint32("max_len", ps
, depth
, &q_u
->max_len
))
5799 if (UNMARSHALLING(ps
))
5800 q_u
->data
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->max_len
);
5801 if(q_u
->data
== NULL
)
5803 if(!prs_uint8s(False
,"data", ps
, depth
, q_u
->data
, q_u
->max_len
))
5811 if(!prs_uint32("real_len", ps
, depth
, &q_u
->real_len
))
5817 /*******************************************************************
5818 ********************************************************************/
5820 bool spoolss_io_r_setprinterdata(const char *desc
, SPOOL_R_SETPRINTERDATA
*r_u
, prs_struct
*ps
, int depth
)
5822 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinterdata");
5827 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5833 /*******************************************************************
5834 ********************************************************************/
5835 bool spoolss_io_q_resetprinter(const char *desc
, SPOOL_Q_RESETPRINTER
*q_u
, prs_struct
*ps
, int depth
)
5837 prs_debug(ps
, depth
, desc
, "spoolss_io_q_resetprinter");
5842 if (!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
5845 if (!prs_uint32("datatype_ptr", ps
, depth
, &q_u
->datatype_ptr
))
5848 if (q_u
->datatype_ptr
) {
5849 if (!smb_io_unistr2("datatype", &q_u
->datatype
, q_u
->datatype_ptr
?True
:False
, ps
, depth
))
5853 if (!spoolss_io_devmode_cont(desc
, &q_u
->devmode_ctr
, ps
, depth
))
5860 /*******************************************************************
5861 ********************************************************************/
5862 bool spoolss_io_r_resetprinter(const char *desc
, SPOOL_R_RESETPRINTER
*r_u
, prs_struct
*ps
, int depth
)
5864 prs_debug(ps
, depth
, desc
, "spoolss_io_r_resetprinter");
5869 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5875 /*******************************************************************
5876 ********************************************************************/
5878 static bool spoolss_io_addform(const char *desc
, FORM
*f
, uint32 ptr
, prs_struct
*ps
, int depth
)
5880 prs_debug(ps
, depth
, desc
, "spoolss_io_addform");
5887 if(!prs_uint32("flags", ps
, depth
, &f
->flags
))
5889 if(!prs_uint32("name_ptr", ps
, depth
, &f
->name_ptr
))
5891 if(!prs_uint32("size_x", ps
, depth
, &f
->size_x
))
5893 if(!prs_uint32("size_y", ps
, depth
, &f
->size_y
))
5895 if(!prs_uint32("left", ps
, depth
, &f
->left
))
5897 if(!prs_uint32("top", ps
, depth
, &f
->top
))
5899 if(!prs_uint32("right", ps
, depth
, &f
->right
))
5901 if(!prs_uint32("bottom", ps
, depth
, &f
->bottom
))
5904 if(!smb_io_unistr2("", &f
->name
, f
->name_ptr
, ps
, depth
))
5911 /*******************************************************************
5912 ********************************************************************/
5914 bool spoolss_io_q_deleteform(const char *desc
, SPOOL_Q_DELETEFORM
*q_u
, prs_struct
*ps
, int depth
)
5916 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteform");
5921 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
5923 if(!smb_io_unistr2("form name", &q_u
->name
, True
, ps
, depth
))
5929 /*******************************************************************
5930 ********************************************************************/
5932 bool spoolss_io_r_deleteform(const char *desc
, SPOOL_R_DELETEFORM
*r_u
, prs_struct
*ps
, int depth
)
5934 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteform");
5939 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5945 /*******************************************************************
5946 ********************************************************************/
5948 bool spoolss_io_q_addform(const char *desc
, SPOOL_Q_ADDFORM
*q_u
, prs_struct
*ps
, int depth
)
5950 uint32 useless_ptr
=1;
5951 prs_debug(ps
, depth
, desc
, "spoolss_io_q_addform");
5956 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
5958 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
5960 if(!prs_uint32("level2", ps
, depth
, &q_u
->level2
))
5965 if(!prs_uint32("useless_ptr", ps
, depth
, &useless_ptr
))
5967 if(!spoolss_io_addform("", &q_u
->form
, useless_ptr
, ps
, depth
))
5974 /*******************************************************************
5975 ********************************************************************/
5977 bool spoolss_io_r_addform(const char *desc
, SPOOL_R_ADDFORM
*r_u
, prs_struct
*ps
, int depth
)
5979 prs_debug(ps
, depth
, desc
, "spoolss_io_r_addform");
5984 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
5990 /*******************************************************************
5991 ********************************************************************/
5993 bool spoolss_io_q_setform(const char *desc
, SPOOL_Q_SETFORM
*q_u
, prs_struct
*ps
, int depth
)
5995 uint32 useless_ptr
=1;
5996 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setform");
6001 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6003 if(!smb_io_unistr2("", &q_u
->name
, True
, ps
, depth
))
6009 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6011 if(!prs_uint32("level2", ps
, depth
, &q_u
->level2
))
6016 if(!prs_uint32("useless_ptr", ps
, depth
, &useless_ptr
))
6018 if(!spoolss_io_addform("", &q_u
->form
, useless_ptr
, ps
, depth
))
6025 /*******************************************************************
6026 ********************************************************************/
6028 bool spoolss_io_r_setform(const char *desc
, SPOOL_R_SETFORM
*r_u
, prs_struct
*ps
, int depth
)
6030 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setform");
6035 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6041 /*******************************************************************
6042 Parse a SPOOL_R_GETJOB structure.
6043 ********************************************************************/
6045 bool spoolss_io_r_getjob(const char *desc
, SPOOL_R_GETJOB
*r_u
, prs_struct
*ps
, int depth
)
6047 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getjob");
6053 if (!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
6059 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6062 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6068 /*******************************************************************
6069 Parse a SPOOL_Q_GETJOB structure.
6070 ********************************************************************/
6072 bool spoolss_io_q_getjob(const char *desc
, SPOOL_Q_GETJOB
*q_u
, prs_struct
*ps
, int depth
)
6074 prs_debug(ps
, depth
, desc
, "");
6080 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6082 if(!prs_uint32("jobid", ps
, depth
, &q_u
->jobid
))
6084 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
6087 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
6093 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
6099 void free_devmode(DEVICEMODE
*devmode
)
6101 if (devmode
!=NULL
) {
6102 SAFE_FREE(devmode
->dev_private
);
6107 void free_printer_info_1(PRINTER_INFO_1
*printer
)
6112 void free_printer_info_2(PRINTER_INFO_2
*printer
)
6114 if (printer
!=NULL
) {
6115 free_devmode(printer
->devmode
);
6116 printer
->devmode
= NULL
;
6121 void free_printer_info_3(PRINTER_INFO_3
*printer
)
6126 void free_printer_info_4(PRINTER_INFO_4
*printer
)
6131 void free_printer_info_5(PRINTER_INFO_5
*printer
)
6136 void free_printer_info_6(PRINTER_INFO_6
*printer
)
6141 void free_printer_info_7(PRINTER_INFO_7
*printer
)
6146 void free_job_info_2(JOB_INFO_2
*job
)
6149 free_devmode(job
->devmode
);
6152 /*******************************************************************
6154 ********************************************************************/
6156 bool make_spoolss_q_replyopenprinter(SPOOL_Q_REPLYOPENPRINTER
*q_u
,
6157 const fstring string
, uint32 printer
, uint32 type
)
6162 init_unistr2(&q_u
->string
, string
, UNI_STR_TERMINATE
);
6164 q_u
->printer
=printer
;
6173 /*******************************************************************
6174 Parse a SPOOL_Q_REPLYOPENPRINTER structure.
6175 ********************************************************************/
6177 bool spoolss_io_q_replyopenprinter(const char *desc
, SPOOL_Q_REPLYOPENPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6179 prs_debug(ps
, depth
, desc
, "spoolss_io_q_replyopenprinter");
6185 if(!smb_io_unistr2("", &q_u
->string
, True
, ps
, depth
))
6191 if(!prs_uint32("printer", ps
, depth
, &q_u
->printer
))
6193 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
6196 if(!prs_uint32("unknown0", ps
, depth
, &q_u
->unknown0
))
6198 if(!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6204 /*******************************************************************
6205 Parse a SPOOL_R_REPLYOPENPRINTER structure.
6206 ********************************************************************/
6208 bool spoolss_io_r_replyopenprinter(const char *desc
, SPOOL_R_REPLYOPENPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6210 prs_debug(ps
, depth
, desc
, "spoolss_io_r_replyopenprinter");
6216 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
6219 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6225 /*******************************************************************
6227 ********************************************************************/
6228 bool make_spoolss_q_routerreplyprinter(SPOOL_Q_ROUTERREPLYPRINTER
*q_u
, POLICY_HND
*hnd
,
6229 uint32 condition
, uint32 change_id
)
6232 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6234 q_u
->condition
= condition
;
6235 q_u
->change_id
= change_id
;
6238 q_u
->unknown1
= 0x1;
6239 memset(q_u
->unknown2
, 0x0, 5);
6240 q_u
->unknown2
[0] = 0x1;
6245 /*******************************************************************
6246 Parse a SPOOL_Q_ROUTERREPLYPRINTER structure.
6247 ********************************************************************/
6248 bool spoolss_io_q_routerreplyprinter (const char *desc
, SPOOL_Q_ROUTERREPLYPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6251 prs_debug(ps
, depth
, desc
, "spoolss_io_q_routerreplyprinter");
6257 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6260 if (!prs_uint32("condition", ps
, depth
, &q_u
->condition
))
6263 if (!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6266 if (!prs_uint32("change_id", ps
, depth
, &q_u
->change_id
))
6269 if (!prs_uint8s(False
, "dev_private", ps
, depth
, q_u
->unknown2
, 5))
6275 /*******************************************************************
6276 Parse a SPOOL_R_ROUTERREPLYPRINTER structure.
6277 ********************************************************************/
6278 bool spoolss_io_r_routerreplyprinter (const char *desc
, SPOOL_R_ROUTERREPLYPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6280 prs_debug(ps
, depth
, desc
, "spoolss_io_r_routerreplyprinter");
6286 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6292 /*******************************************************************
6294 ********************************************************************/
6296 bool make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER
*q_u
, POLICY_HND
*hnd
)
6301 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6306 /*******************************************************************
6307 Parse a SPOOL_Q_REPLYCLOSEPRINTER structure.
6308 ********************************************************************/
6310 bool spoolss_io_q_replycloseprinter(const char *desc
, SPOOL_Q_REPLYCLOSEPRINTER
*q_u
, prs_struct
*ps
, int depth
)
6312 prs_debug(ps
, depth
, desc
, "spoolss_io_q_replycloseprinter");
6318 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6324 /*******************************************************************
6325 Parse a SPOOL_R_REPLYCLOSEPRINTER structure.
6326 ********************************************************************/
6328 bool spoolss_io_r_replycloseprinter(const char *desc
, SPOOL_R_REPLYCLOSEPRINTER
*r_u
, prs_struct
*ps
, int depth
)
6330 prs_debug(ps
, depth
, desc
, "spoolss_io_r_replycloseprinter");
6336 if(!smb_io_pol_hnd("printer handle",&r_u
->handle
,ps
,depth
))
6339 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6345 #if 0 /* JERRY - not currently used but could be :-) */
6347 /*******************************************************************
6348 Deep copy a SPOOL_NOTIFY_INFO_DATA structure
6349 ******************************************************************/
6350 static bool copy_spool_notify_info_data(SPOOL_NOTIFY_INFO_DATA
*dst
,
6351 SPOOL_NOTIFY_INFO_DATA
*src
, int n
)
6355 memcpy(dst
, src
, sizeof(SPOOL_NOTIFY_INFO_DATA
)*n
);
6357 for (i
=0; i
<n
; i
++) {
6361 if (src
->size
!= POINTER
)
6363 len
= src
->notify_data
.data
.length
;
6364 s
= SMB_MALLOC_ARRAY(uint16
, len
);
6366 DEBUG(0,("copy_spool_notify_info_data: malloc() failed!\n"));
6370 memcpy(s
, src
->notify_data
.data
.string
, len
*2);
6371 dst
->notify_data
.data
.string
= s
;
6377 /*******************************************************************
6378 Deep copy a SPOOL_NOTIFY_INFO structure
6379 ******************************************************************/
6380 static bool copy_spool_notify_info(SPOOL_NOTIFY_INFO
*dst
, SPOOL_NOTIFY_INFO
*src
)
6383 DEBUG(0,("copy_spool_notify_info: NULL destination pointer!\n"));
6387 dst
->version
= src
->version
;
6388 dst
->flags
= src
->flags
;
6389 dst
->count
= src
->count
;
6393 dst
->data
= SMB_MALLOC_ARRAY(SPOOL_NOTIFY_INFO_DATA
, dst
->count
);
6395 DEBUG(10,("copy_spool_notify_info: allocating space for [%d] PRINTER_NOTIFY_INFO_DATA entries\n",
6398 if (dst
->data
== NULL
) {
6399 DEBUG(0,("copy_spool_notify_info: malloc() failed for [%d] entries!\n",
6404 return (copy_spool_notify_info_data(dst
->data
, src
->data
, src
->count
));
6411 /*******************************************************************
6413 ********************************************************************/
6415 bool make_spoolss_q_reply_rrpcn(SPOOL_Q_REPLY_RRPCN
*q_u
, POLICY_HND
*hnd
,
6416 uint32 change_low
, uint32 change_high
,
6417 SPOOL_NOTIFY_INFO
*info
)
6422 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6424 q_u
->change_low
=change_low
;
6425 q_u
->change_high
=change_high
;
6430 q_u
->info_ptr
=0x0FF0ADDE;
6432 q_u
->info
.version
=2;
6435 DEBUG(10,("make_spoolss_q_reply_rrpcn: [%d] PRINTER_NOTIFY_INFO_DATA\n",
6437 q_u
->info
.version
= info
->version
;
6438 q_u
->info
.flags
= info
->flags
;
6439 q_u
->info
.count
= info
->count
;
6440 /* pointer field - be careful! */
6441 q_u
->info
.data
= info
->data
;
6444 q_u
->info
.flags
=PRINTER_NOTIFY_INFO_DISCARDED
;
6451 /*******************************************************************
6452 Parse a SPOOL_Q_REPLY_RRPCN structure.
6453 ********************************************************************/
6455 bool spoolss_io_q_reply_rrpcn(const char *desc
, SPOOL_Q_REPLY_RRPCN
*q_u
, prs_struct
*ps
, int depth
)
6457 prs_debug(ps
, depth
, desc
, "spoolss_io_q_reply_rrpcn");
6463 if(!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6466 if (!prs_uint32("change_low", ps
, depth
, &q_u
->change_low
))
6469 if (!prs_uint32("change_high", ps
, depth
, &q_u
->change_high
))
6472 if (!prs_uint32("unknown0", ps
, depth
, &q_u
->unknown0
))
6475 if (!prs_uint32("unknown1", ps
, depth
, &q_u
->unknown1
))
6478 if (!prs_uint32("info_ptr", ps
, depth
, &q_u
->info_ptr
))
6481 if(q_u
->info_ptr
!=0)
6482 if(!smb_io_notify_info(desc
, &q_u
->info
, ps
, depth
))
6488 /*******************************************************************
6489 Parse a SPOOL_R_REPLY_RRPCN structure.
6490 ********************************************************************/
6492 bool spoolss_io_r_reply_rrpcn(const char *desc
, SPOOL_R_REPLY_RRPCN
*r_u
, prs_struct
*ps
, int depth
)
6494 prs_debug(ps
, depth
, desc
, "spoolss_io_r_reply_rrpcn");
6500 if (!prs_uint32("unknown0", ps
, depth
, &r_u
->unknown0
))
6503 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6509 /*******************************************************************
6511 * called from spoolss_q_getprinterdataex (srv_spoolss.c)
6512 ********************************************************************/
6514 bool spoolss_io_q_getprinterdataex(const char *desc
, SPOOL_Q_GETPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6519 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprinterdataex");
6524 if (!smb_io_pol_hnd("printer handle",&q_u
->handle
,ps
,depth
))
6528 if (!smb_io_unistr2("keyname", &q_u
->keyname
,True
,ps
,depth
))
6532 if (!smb_io_unistr2("valuename", &q_u
->valuename
,True
,ps
,depth
))
6536 if (!prs_uint32("size", ps
, depth
, &q_u
->size
))
6542 /*******************************************************************
6543 * write a structure.
6544 * called from spoolss_r_getprinterdataex (srv_spoolss.c)
6545 ********************************************************************/
6547 bool spoolss_io_r_getprinterdataex(const char *desc
, SPOOL_R_GETPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6552 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprinterdataex");
6557 if (!prs_uint32("type", ps
, depth
, &r_u
->type
))
6559 if (!prs_uint32("size", ps
, depth
, &r_u
->size
))
6562 if (UNMARSHALLING(ps
) && r_u
->size
) {
6563 r_u
->data
= PRS_ALLOC_MEM(ps
, unsigned char, r_u
->size
);
6568 if (!prs_uint8s(False
,"data", ps
, depth
, r_u
->data
, r_u
->size
))
6574 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6576 if (!prs_werror("status", ps
, depth
, &r_u
->status
))
6582 /*******************************************************************
6584 ********************************************************************/
6586 bool spoolss_io_q_setprinterdataex(const char *desc
, SPOOL_Q_SETPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6588 prs_debug(ps
, depth
, desc
, "spoolss_io_q_setprinterdataex");
6593 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6595 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6601 if(!smb_io_unistr2("", &q_u
->value
, True
, ps
, depth
))
6607 if(!prs_uint32("type", ps
, depth
, &q_u
->type
))
6610 if(!prs_uint32("max_len", ps
, depth
, &q_u
->max_len
))
6620 if (UNMARSHALLING(ps
))
6621 q_u
->data
=PRS_ALLOC_MEM(ps
, uint8
, q_u
->max_len
);
6622 if(q_u
->data
== NULL
)
6624 if(!prs_uint8s(False
,"data", ps
, depth
, q_u
->data
, q_u
->max_len
))
6632 if(!prs_uint32("real_len", ps
, depth
, &q_u
->real_len
))
6638 /*******************************************************************
6639 * write a structure.
6640 ********************************************************************/
6642 bool spoolss_io_r_setprinterdataex(const char *desc
, SPOOL_R_SETPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6644 prs_debug(ps
, depth
, desc
, "spoolss_io_r_setprinterdataex");
6649 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6655 /*******************************************************************
6657 ********************************************************************/
6658 bool make_spoolss_q_enumprinterkey(SPOOL_Q_ENUMPRINTERKEY
*q_u
,
6659 POLICY_HND
*hnd
, const char *key
,
6662 DEBUG(5,("make_spoolss_q_enumprinterkey\n"));
6664 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6665 init_unistr2(&q_u
->key
, key
, UNI_STR_TERMINATE
);
6671 /*******************************************************************
6673 ********************************************************************/
6675 bool spoolss_io_q_enumprinterkey(const char *desc
, SPOOL_Q_ENUMPRINTERKEY
*q_u
, prs_struct
*ps
, int depth
)
6677 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterkey");
6682 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6685 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6691 if(!prs_uint32("size", ps
, depth
, &q_u
->size
))
6697 /*******************************************************************
6698 * write a structure.
6699 ********************************************************************/
6701 bool spoolss_io_r_enumprinterkey(const char *desc
, SPOOL_R_ENUMPRINTERKEY
*r_u
, prs_struct
*ps
, int depth
)
6703 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterkey");
6709 if (!smb_io_buffer5("", &r_u
->keys
, ps
, depth
))
6715 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6718 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6724 /*******************************************************************
6726 ********************************************************************/
6728 bool make_spoolss_q_deleteprinterkey(SPOOL_Q_DELETEPRINTERKEY
*q_u
,
6729 POLICY_HND
*hnd
, char *keyname
)
6731 DEBUG(5,("make_spoolss_q_deleteprinterkey\n"));
6733 memcpy(&q_u
->handle
, hnd
, sizeof(q_u
->handle
));
6734 init_unistr2(&q_u
->keyname
, keyname
, UNI_STR_TERMINATE
);
6739 /*******************************************************************
6741 ********************************************************************/
6743 bool spoolss_io_q_deleteprinterkey(const char *desc
, SPOOL_Q_DELETEPRINTERKEY
*q_u
, prs_struct
*ps
, int depth
)
6745 prs_debug(ps
, depth
, desc
, "spoolss_io_q_deleteprinterkey");
6750 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6753 if(!smb_io_unistr2("", &q_u
->keyname
, True
, ps
, depth
))
6759 /*******************************************************************
6760 * write a structure.
6761 ********************************************************************/
6763 bool spoolss_io_r_deleteprinterkey(const char *desc
, SPOOL_R_DELETEPRINTERKEY
*r_u
, prs_struct
*ps
, int depth
)
6765 prs_debug(ps
, depth
, desc
, "spoolss_io_r_deleteprinterkey");
6771 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6778 /*******************************************************************
6780 ********************************************************************/
6782 bool spoolss_io_q_enumprinterdataex(const char *desc
, SPOOL_Q_ENUMPRINTERDATAEX
*q_u
, prs_struct
*ps
, int depth
)
6784 prs_debug(ps
, depth
, desc
, "spoolss_io_q_enumprinterdataex");
6789 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
6792 if(!smb_io_unistr2("", &q_u
->key
, True
, ps
, depth
))
6798 if(!prs_uint32("size", ps
, depth
, &q_u
->size
))
6804 /*******************************************************************
6805 ********************************************************************/
6807 static bool spoolss_io_printer_enum_values_ctr(const char *desc
, prs_struct
*ps
,
6808 PRINTER_ENUM_VALUES_CTR
*ctr
, int depth
)
6811 uint32 valuename_offset
,
6814 const uint32 basic_unit
= 20; /* size of static portion of enum_values */
6816 prs_debug(ps
, depth
, desc
, "spoolss_io_printer_enum_values_ctr");
6820 * offset data begins at 20 bytes per structure * size_of_array.
6821 * Don't forget the uint32 at the beginning
6824 current_offset
= basic_unit
* ctr
->size_of_array
;
6826 /* first loop to write basic enum_value information */
6828 if (UNMARSHALLING(ps
) && ctr
->size_of_array
) {
6829 ctr
->values
= PRS_ALLOC_MEM(ps
, PRINTER_ENUM_VALUES
, ctr
->size_of_array
);
6834 for (i
=0; i
<ctr
->size_of_array
; i
++) {
6835 uint32 base_offset
, return_offset
;
6837 base_offset
= prs_offset(ps
);
6839 valuename_offset
= current_offset
;
6840 if (!prs_uint32("valuename_offset", ps
, depth
, &valuename_offset
))
6843 /* Read or write the value. */
6845 return_offset
= prs_offset(ps
);
6847 if (!prs_set_offset(ps
, base_offset
+ valuename_offset
)) {
6851 if (!prs_unistr("valuename", ps
, depth
, &ctr
->values
[i
].valuename
))
6855 if (!prs_set_offset(ps
, return_offset
))
6858 if (!prs_uint32("value_len", ps
, depth
, &ctr
->values
[i
].value_len
))
6861 if (!prs_uint32("type", ps
, depth
, &ctr
->values
[i
].type
))
6864 data_offset
= ctr
->values
[i
].value_len
+ valuename_offset
;
6866 if (!prs_uint32("data_offset", ps
, depth
, &data_offset
))
6869 if (!prs_uint32("data_len", ps
, depth
, &ctr
->values
[i
].data_len
))
6872 /* Read or write the data. */
6874 return_offset
= prs_offset(ps
);
6876 if (!prs_set_offset(ps
, base_offset
+ data_offset
)) {
6880 if ( ctr
->values
[i
].data_len
) {
6881 if ( UNMARSHALLING(ps
) ) {
6882 ctr
->values
[i
].data
= PRS_ALLOC_MEM(ps
, uint8
, ctr
->values
[i
].data_len
);
6883 if (!ctr
->values
[i
].data
)
6886 if (!prs_uint8s(False
, "data", ps
, depth
, ctr
->values
[i
].data
, ctr
->values
[i
].data_len
))
6890 current_offset
= data_offset
+ ctr
->values
[i
].data_len
- basic_unit
;
6891 /* account for 2 byte alignment */
6892 current_offset
+= (current_offset
% 2);
6894 /* Remember how far we got. */
6895 data_offset
= prs_offset(ps
);
6898 if (!prs_set_offset(ps
, return_offset
))
6903 /* Go to the last data offset we got to. */
6905 if (!prs_set_offset(ps
, data_offset
))
6908 /* And ensure we're 2 byte aligned. */
6910 if ( !prs_align_uint16(ps
) )
6916 /*******************************************************************
6917 * write a structure.
6918 ********************************************************************/
6920 bool spoolss_io_r_enumprinterdataex(const char *desc
, SPOOL_R_ENUMPRINTERDATAEX
*r_u
, prs_struct
*ps
, int depth
)
6922 uint32 data_offset
, end_offset
;
6923 prs_debug(ps
, depth
, desc
, "spoolss_io_r_enumprinterdataex");
6929 if (!prs_uint32("size", ps
, depth
, &r_u
->ctr
.size
))
6932 data_offset
= prs_offset(ps
);
6934 if (!prs_set_offset(ps
, data_offset
+ r_u
->ctr
.size
))
6940 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
6943 if(!prs_uint32("returned", ps
, depth
, &r_u
->returned
))
6946 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
6949 r_u
->ctr
.size_of_array
= r_u
->returned
;
6951 end_offset
= prs_offset(ps
);
6953 if (!prs_set_offset(ps
, data_offset
))
6957 if (!spoolss_io_printer_enum_values_ctr("", ps
, &r_u
->ctr
, depth
))
6960 if (!prs_set_offset(ps
, end_offset
))
6965 /*******************************************************************
6966 * write a structure.
6967 ********************************************************************/
6970 uint32 GetPrintProcessorDirectory(
6972 [in] unistr2 *environment,
6974 [in,out] RPC_BUFFER buffer,
6975 [in] uint32 offered,
6976 [out] uint32 needed,
6977 [out] uint32 returned
6982 bool make_spoolss_q_getprintprocessordirectory(SPOOL_Q_GETPRINTPROCESSORDIRECTORY
*q_u
, const char *name
, char *environment
, int level
, RPC_BUFFER
*buffer
, uint32 offered
)
6984 DEBUG(5,("make_spoolss_q_getprintprocessordirectory\n"));
6986 init_unistr2(&q_u
->name
, name
, UNI_STR_TERMINATE
);
6987 init_unistr2(&q_u
->environment
, environment
, UNI_STR_TERMINATE
);
6991 q_u
->buffer
= buffer
;
6992 q_u
->offered
= offered
;
6997 bool spoolss_io_q_getprintprocessordirectory(const char *desc
, SPOOL_Q_GETPRINTPROCESSORDIRECTORY
*q_u
, prs_struct
*ps
, int depth
)
7001 prs_debug(ps
, depth
, desc
, "spoolss_io_q_getprintprocessordirectory");
7007 if (!prs_uint32("ptr", ps
, depth
, &ptr
))
7011 if(!smb_io_unistr2("name", &q_u
->name
, True
, ps
, depth
))
7018 if (!prs_uint32("ptr", ps
, depth
, &ptr
))
7022 if(!smb_io_unistr2("environment", &q_u
->environment
, True
,
7030 if(!prs_uint32("level", ps
, depth
, &q_u
->level
))
7033 if(!prs_rpcbuffer_p("", ps
, depth
, &q_u
->buffer
))
7039 if(!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
7045 /*******************************************************************
7046 * write a structure.
7047 ********************************************************************/
7049 bool spoolss_io_r_getprintprocessordirectory(const char *desc
, SPOOL_R_GETPRINTPROCESSORDIRECTORY
*r_u
, prs_struct
*ps
, int depth
)
7051 prs_debug(ps
, depth
, desc
, "spoolss_io_r_getprintprocessordirectory");
7057 if(!prs_rpcbuffer_p("", ps
, depth
, &r_u
->buffer
))
7063 if(!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7066 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7072 bool smb_io_printprocessordirectory_1(const char *desc
, RPC_BUFFER
*buffer
, PRINTPROCESSOR_DIRECTORY_1
*info
, int depth
)
7074 prs_struct
*ps
=&buffer
->prs
;
7076 prs_debug(ps
, depth
, desc
, "smb_io_printprocessordirectory_1");
7079 buffer
->struct_start
=prs_offset(ps
);
7081 if (!smb_io_unistr(desc
, &info
->name
, ps
, depth
))
7087 /*******************************************************************
7089 ********************************************************************/
7091 bool make_spoolss_q_addform(SPOOL_Q_ADDFORM
*q_u
, POLICY_HND
*handle
,
7092 int level
, FORM
*form
)
7094 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7096 q_u
->level2
= level
;
7097 memcpy(&q_u
->form
, form
, sizeof(FORM
));
7102 /*******************************************************************
7104 ********************************************************************/
7106 bool make_spoolss_q_setform(SPOOL_Q_SETFORM
*q_u
, POLICY_HND
*handle
,
7107 int level
, const char *form_name
, FORM
*form
)
7109 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7111 q_u
->level2
= level
;
7112 memcpy(&q_u
->form
, form
, sizeof(FORM
));
7113 init_unistr2(&q_u
->name
, form_name
, UNI_STR_TERMINATE
);
7118 /*******************************************************************
7120 ********************************************************************/
7122 bool make_spoolss_q_deleteform(SPOOL_Q_DELETEFORM
*q_u
, POLICY_HND
*handle
,
7125 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7126 init_unistr2(&q_u
->name
, form
, UNI_STR_TERMINATE
);
7130 /*******************************************************************
7132 ********************************************************************/
7134 bool make_spoolss_q_getform(SPOOL_Q_GETFORM
*q_u
, POLICY_HND
*handle
,
7135 const char *formname
, uint32 level
,
7136 RPC_BUFFER
*buffer
, uint32 offered
)
7138 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7140 init_unistr2(&q_u
->formname
, formname
, UNI_STR_TERMINATE
);
7142 q_u
->offered
=offered
;
7147 /*******************************************************************
7149 ********************************************************************/
7151 bool make_spoolss_q_enumforms(SPOOL_Q_ENUMFORMS
*q_u
, POLICY_HND
*handle
,
7152 uint32 level
, RPC_BUFFER
*buffer
,
7155 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7158 q_u
->offered
=offered
;
7163 /*******************************************************************
7165 ********************************************************************/
7167 bool make_spoolss_q_setjob(SPOOL_Q_SETJOB
*q_u
, POLICY_HND
*handle
,
7168 uint32 jobid
, uint32 level
, uint32 command
)
7170 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7174 /* Hmm - the SPOOL_Q_SETJOB structure has a JOB_INFO ctr in it but
7175 the server side code has it marked as unused. */
7177 q_u
->command
= command
;
7182 /*******************************************************************
7184 ********************************************************************/
7186 bool make_spoolss_q_getjob(SPOOL_Q_GETJOB
*q_u
, POLICY_HND
*handle
,
7187 uint32 jobid
, uint32 level
, RPC_BUFFER
*buffer
,
7190 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7193 q_u
->buffer
= buffer
;
7194 q_u
->offered
= offered
;
7199 /*******************************************************************
7201 ********************************************************************/
7203 bool make_spoolss_q_startdocprinter(SPOOL_Q_STARTDOCPRINTER
*q_u
,
7204 POLICY_HND
*handle
, uint32 level
,
7205 char *docname
, char *outputfile
,
7208 DOC_INFO_CONTAINER
*ctr
= &q_u
->doc_info_container
;
7210 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7216 ctr
->docinfo
.switch_value
= level
;
7218 ctr
->docinfo
.doc_info_1
.p_docname
= docname
? 1 : 0;
7219 ctr
->docinfo
.doc_info_1
.p_outputfile
= outputfile
? 1 : 0;
7220 ctr
->docinfo
.doc_info_1
.p_datatype
= datatype
? 1 : 0;
7222 init_unistr2(&ctr
->docinfo
.doc_info_1
.docname
, docname
, UNI_STR_TERMINATE
);
7223 init_unistr2(&ctr
->docinfo
.doc_info_1
.outputfile
, outputfile
, UNI_STR_TERMINATE
);
7224 init_unistr2(&ctr
->docinfo
.doc_info_1
.datatype
, datatype
, UNI_STR_TERMINATE
);
7228 /* DOC_INFO_2 is only used by Windows 9x and since it
7229 doesn't do printing over RPC we don't have to worry
7232 DEBUG(3, ("unsupported info level %d\n", level
));
7239 /*******************************************************************
7241 ********************************************************************/
7243 bool make_spoolss_q_enddocprinter(SPOOL_Q_ENDDOCPRINTER
*q_u
,
7246 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7251 /*******************************************************************
7253 ********************************************************************/
7255 bool make_spoolss_q_writeprinter(SPOOL_Q_WRITEPRINTER
*q_u
,
7256 POLICY_HND
*handle
, uint32 data_size
,
7259 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7260 q_u
->buffer_size
= q_u
->buffer_size2
= data_size
;
7261 q_u
->buffer
= (unsigned char *)data
;
7265 /*******************************************************************
7267 ********************************************************************/
7269 bool make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA
*q_u
,
7270 POLICY_HND
*handle
, char *valuename
)
7272 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7273 init_unistr2(&q_u
->valuename
, valuename
, UNI_STR_TERMINATE
);
7278 /*******************************************************************
7280 ********************************************************************/
7282 bool make_spoolss_q_deleteprinterdataex(SPOOL_Q_DELETEPRINTERDATAEX
*q_u
,
7283 POLICY_HND
*handle
, char *key
,
7286 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7287 init_unistr2(&q_u
->valuename
, value
, UNI_STR_TERMINATE
);
7288 init_unistr2(&q_u
->keyname
, key
, UNI_STR_TERMINATE
);
7293 /*******************************************************************
7295 ********************************************************************/
7297 bool make_spoolss_q_rffpcnex(SPOOL_Q_RFFPCNEX
*q_u
, POLICY_HND
*handle
,
7298 uint32 flags
, uint32 options
, const char *localmachine
,
7299 uint32 printerlocal
, SPOOL_NOTIFY_OPTION
*option
)
7301 memcpy(&q_u
->handle
, handle
, sizeof(POLICY_HND
));
7304 q_u
->options
= options
;
7306 q_u
->localmachine_ptr
= 1;
7308 init_unistr2(&q_u
->localmachine
, localmachine
, UNI_STR_TERMINATE
);
7310 q_u
->printerlocal
= printerlocal
;
7313 q_u
->option_ptr
= 1;
7315 q_u
->option
= option
;
7321 /*******************************************************************
7322 ********************************************************************/
7324 bool spoolss_io_q_xcvdataport(const char *desc
, SPOOL_Q_XCVDATAPORT
*q_u
, prs_struct
*ps
, int depth
)
7326 prs_debug(ps
, depth
, desc
, "spoolss_io_q_xcvdataport");
7332 if(!smb_io_pol_hnd("printer handle", &q_u
->handle
, ps
, depth
))
7335 if(!smb_io_unistr2("", &q_u
->dataname
, True
, ps
, depth
))
7341 if(!prs_rpcbuffer("", ps
, depth
, &q_u
->indata
))
7347 if (!prs_uint32("indata_len", ps
, depth
, &q_u
->indata_len
))
7349 if (!prs_uint32("offered", ps
, depth
, &q_u
->offered
))
7351 if (!prs_uint32("unknown", ps
, depth
, &q_u
->unknown
))
7357 /*******************************************************************
7358 ********************************************************************/
7360 bool spoolss_io_r_xcvdataport(const char *desc
, SPOOL_R_XCVDATAPORT
*r_u
, prs_struct
*ps
, int depth
)
7362 prs_debug(ps
, depth
, desc
, "spoolss_io_r_xcvdataport");
7367 if(!prs_rpcbuffer("", ps
, depth
, &r_u
->outdata
))
7373 if (!prs_uint32("needed", ps
, depth
, &r_u
->needed
))
7375 if (!prs_uint32("unknown", ps
, depth
, &r_u
->unknown
))
7378 if(!prs_werror("status", ps
, depth
, &r_u
->status
))
7384 /*******************************************************************
7385 ********************************************************************/
7387 bool make_monitorui_buf( RPC_BUFFER
*buf
, const char *dllname
)
7394 init_unistr( &string
, dllname
);
7396 if ( !prs_unistr( "ui_dll", &buf
->prs
, 0, &string
) )
7402 /*******************************************************************
7403 ********************************************************************/
7405 #define PORT_DATA_1_PAD 540
7407 static bool smb_io_port_data_1( const char *desc
, RPC_BUFFER
*buf
, int depth
, SPOOL_PORT_DATA_1
*p1
)
7409 prs_struct
*ps
= &buf
->prs
;
7410 uint8 padding
[PORT_DATA_1_PAD
];
7412 prs_debug(ps
, depth
, desc
, "smb_io_port_data_1");
7418 if( !prs_uint16s(True
, "portname", ps
, depth
, p1
->portname
, MAX_PORTNAME
))
7421 if (!prs_uint32("version", ps
, depth
, &p1
->version
))
7423 if (!prs_uint32("protocol", ps
, depth
, &p1
->protocol
))
7425 if (!prs_uint32("size", ps
, depth
, &p1
->size
))
7427 if (!prs_uint32("reserved", ps
, depth
, &p1
->reserved
))
7430 if( !prs_uint16s(True
, "hostaddress", ps
, depth
, p1
->hostaddress
, MAX_NETWORK_NAME
))
7432 if( !prs_uint16s(True
, "snmpcommunity", ps
, depth
, p1
->snmpcommunity
, MAX_SNMP_COMM_NAME
))
7435 if (!prs_uint32("dblspool", ps
, depth
, &p1
->dblspool
))
7438 if( !prs_uint16s(True
, "queue", ps
, depth
, p1
->queue
, MAX_QUEUE_NAME
))
7440 if( !prs_uint16s(True
, "ipaddress", ps
, depth
, p1
->ipaddress
, MAX_IPADDR_STRING
))
7443 if( !prs_uint8s(False
, "", ps
, depth
, padding
, PORT_DATA_1_PAD
))
7446 if (!prs_uint32("port", ps
, depth
, &p1
->port
))
7448 if (!prs_uint32("snmpenabled", ps
, depth
, &p1
->snmpenabled
))
7450 if (!prs_uint32("snmpdevindex", ps
, depth
, &p1
->snmpdevindex
))
7456 /*******************************************************************
7457 ********************************************************************/
7459 bool convert_port_data_1( NT_PORT_DATA_1
*port1
, RPC_BUFFER
*buf
)
7461 SPOOL_PORT_DATA_1 spdata_1
;
7463 ZERO_STRUCT( spdata_1
);
7465 if ( !smb_io_port_data_1( "port_data_1", buf
, 0, &spdata_1
) )
7468 rpcstr_pull(port1
->name
, spdata_1
.portname
, sizeof(port1
->name
), -1, 0);
7469 rpcstr_pull(port1
->queue
, spdata_1
.queue
, sizeof(port1
->queue
), -1, 0);
7470 rpcstr_pull(port1
->hostaddr
, spdata_1
.hostaddress
, sizeof(port1
->hostaddr
), -1, 0);
7472 port1
->port
= spdata_1
.port
;
7474 switch ( spdata_1
.protocol
) {
7476 port1
->protocol
= PORT_PROTOCOL_DIRECT
;
7479 port1
->protocol
= PORT_PROTOCOL_LPR
;
7482 DEBUG(3,("convert_port_data_1: unknown protocol [%d]!\n",
7483 spdata_1
.protocol
));