dcerpc-netlogon: maintain netlogon_auth_vars for NetrServerAuthenticateKerberos
[wireshark-sm.git] / epan / dissectors / packet-dcerpc-spoolss.c
blobd0216d2c05658a180d0e4679d88cd32e2b5d28b9
1 /* packet-dcerpc-spoolss.c
2 * Routines for SMB \PIPE\spoolss packet disassembly
3 * Copyright 2001-2003, Tim Potter <tpot@samba.org>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
12 /* TODO list:
14 - audit of item lengths
18 #include "config.h"
21 #include <epan/packet.h>
22 #include <epan/expert.h>
23 #include <epan/tfs.h>
24 #include "packet-dcerpc.h"
25 #include "packet-dcerpc-nt.h"
26 #include "packet-dcerpc-spoolss.h"
27 #include "packet-windows-common.h"
29 void proto_register_dcerpc_spoolss(void);
30 void proto_reg_handoff_dcerpc_spoolss(void);
32 /* GetPrinterDriver2 */
34 static int hf_clientmajorversion;
35 static int hf_clientminorversion;
36 static int hf_servermajorversion;
37 static int hf_serverminorversion;
38 static int hf_driverpath;
39 static int hf_datafile;
40 static int hf_configfile;
41 static int hf_helpfile;
42 static int hf_monitorname;
43 static int hf_defaultdatatype;
44 static int hf_driverinfo_cversion;
45 static int hf_dependentfiles;
46 static int hf_previousdrivernames;
47 static int hf_color_profiles;
48 static int hf_core_driver_dependencies;
49 static int hf_driverdate;
50 static int hf_min_inbox_driverdate;
51 static int hf_padding;
52 static int hf_driver_version_low;
53 static int hf_driver_version_high;
54 static int hf_min_inbox_driver_version_low;
55 static int hf_min_inbox_driver_version_high;
56 static int hf_mfgname;
57 static int hf_oemurl;
58 static int hf_hardwareid;
59 static int hf_provider;
61 /* GetPrinter */
63 /* Times */
65 static int hf_start_time;
66 static int hf_end_time;
67 static int hf_elapsed_time;
68 static int hf_device_not_selected_timeout;
69 static int hf_transmission_retry_timeout;
71 /****************************************************************************/
74 * New hf index values - I'm in the process of doing a bit of a cleanup -tpot
77 static int hf_opnum;
78 static int hf_hnd;
79 static int hf_rc;
80 static int hf_hresult;
81 static int hf_offered;
82 static int hf_needed;
83 static int hf_returned;
84 static int hf_buffer_size;
85 static int hf_buffer_data;
86 static int hf_string_parm_size;
87 static int hf_string_parm_data;
88 static int hf_offset;
89 static int hf_level;
90 static int hf_access_required;
92 static int hf_printername;
93 static int hf_machinename;
94 static int hf_notifyname;
95 static int hf_printerdesc;
96 static int hf_printercomment;
97 static int hf_servername;
98 static int hf_sharename;
99 static int hf_portname;
100 static int hf_printerlocation;
101 static int hf_drivername;
102 static int hf_environment;
103 static int hf_username;
104 static int hf_documentname;
105 static int hf_outputfile;
106 static int hf_datatype;
107 static int hf_textstatus;
108 static int hf_sepfile;
109 static int hf_printprocessor;
110 static int hf_vendor_setup;
111 static int hf_inf_path;
112 static int hf_parameters;
113 static int hf_core_printer_driver_ids;
114 static int hf_core_driver_guid;
115 static int hf_core_driver_size;
116 static int hf_driver_version;
117 static int hf_core_printer_driver_count;
118 static int hf_package_id;
119 static int hf_language;
120 static int hf_driver_package_cab_size;
122 /* Printer information */
124 static int hf_printer_cjobs;
125 static int hf_printer_total_jobs;
126 static int hf_printer_total_bytes;
127 static int hf_printer_global_counter;
128 static int hf_printer_total_pages;
129 static int hf_printer_major_version;
130 static int hf_printer_build_version;
131 static int hf_printer_unk7;
132 static int hf_printer_unk8;
133 static int hf_printer_unk9;
134 static int hf_printer_session_ctr;
135 static int hf_printer_unk11;
136 static int hf_printer_printer_errors;
137 static int hf_printer_unk13;
138 static int hf_printer_unk14;
139 static int hf_printer_unk15;
140 static int hf_printer_unk16;
141 static int hf_printer_changeid;
142 static int hf_printer_unk18;
143 static int hf_printer_unk20;
144 static int hf_printer_c_setprinter;
145 static int hf_printer_unk22;
146 static int hf_printer_unk23;
147 static int hf_printer_unk24;
148 static int hf_printer_unk25;
149 static int hf_printer_unk26;
150 static int hf_printer_unk27;
151 static int hf_printer_unk28;
152 static int hf_printer_unk29;
153 static int hf_printer_flags;
154 static int hf_printer_priority;
155 static int hf_printer_default_priority;
156 static int hf_printer_jobs;
157 static int hf_printer_averageppm;
158 static int hf_printer_guid;
159 static int hf_printer_action;
161 /* Printer data */
163 static int hf_printerdata;
164 static int hf_printerdata_key;
165 static int hf_printerdata_value;
166 static int hf_printerdata_type;
167 static int hf_printerdata_size; /* Length of printer data */
168 static int hf_printerdata_data;
169 static int hf_printerdata_data_sz;
170 static int hf_printerdata_data_dword;
172 /* Devicemode */
174 static int hf_devmodectr_size;
176 static int hf_devmode;
177 static int hf_devmode_size;
178 static int hf_devmode_spec_version;
179 static int hf_devmode_driver_version;
180 static int hf_devmode_size2;
181 static int hf_devmode_driver_extra_len;
182 static int hf_devmode_fields;
183 static int hf_devmode_orientation;
184 static int hf_devmode_paper_size;
185 static int hf_devmode_paper_width;
186 static int hf_devmode_paper_length;
187 static int hf_devmode_scale;
188 static int hf_devmode_copies;
189 static int hf_devmode_default_source;
190 static int hf_devmode_print_quality;
191 static int hf_devmode_color;
192 static int hf_devmode_duplex;
193 static int hf_devmode_y_resolution;
194 static int hf_devmode_tt_option;
195 static int hf_devmode_collate;
196 static int hf_devmode_log_pixels;
197 static int hf_devmode_bits_per_pel;
198 static int hf_devmode_pels_width;
199 static int hf_devmode_pels_height;
200 static int hf_devmode_display_flags;
201 static int hf_devmode_display_freq;
202 static int hf_devmode_icm_method;
203 static int hf_devmode_icm_intent;
204 static int hf_devmode_media_type;
205 static int hf_devmode_dither_type;
206 static int hf_devmode_reserved1;
207 static int hf_devmode_reserved2;
208 static int hf_devmode_panning_width;
209 static int hf_devmode_panning_height;
210 static int hf_devmode_driver_extra;
212 static int hf_devmode_fields_orientation;
213 static int hf_devmode_fields_papersize;
214 static int hf_devmode_fields_paperlength;
215 static int hf_devmode_fields_paperwidth;
216 static int hf_devmode_fields_scale;
217 static int hf_devmode_fields_position;
218 static int hf_devmode_fields_nup;
219 static int hf_devmode_fields_copies;
220 static int hf_devmode_fields_defaultsource;
221 static int hf_devmode_fields_printquality;
222 static int hf_devmode_fields_color;
223 static int hf_devmode_fields_duplex;
224 static int hf_devmode_fields_yresolution;
225 static int hf_devmode_fields_ttoption;
226 static int hf_devmode_fields_collate;
227 static int hf_devmode_fields_formname;
228 static int hf_devmode_fields_logpixels;
229 static int hf_devmode_fields_bitsperpel;
230 static int hf_devmode_fields_pelswidth;
231 static int hf_devmode_fields_pelsheight;
232 static int hf_devmode_fields_displayflags;
233 static int hf_devmode_fields_displayfrequency;
234 static int hf_devmode_fields_icmmethod;
235 static int hf_devmode_fields_icmintent;
236 static int hf_devmode_fields_mediatype;
237 static int hf_devmode_fields_dithertype;
238 static int hf_devmode_fields_panningwidth;
239 static int hf_devmode_fields_panningheight;
241 /* Print job */
243 static int hf_job_id;
244 static int hf_job_priority;
245 static int hf_job_position;
246 static int hf_job_totalpages;
247 static int hf_job_totalbytes;
248 static int hf_job_pagesprinted;
249 static int hf_job_bytesprinted;
250 static int hf_job_size;
252 static int hf_job_status;
253 static int hf_job_status_paused;
254 static int hf_job_status_error;
255 static int hf_job_status_deleting;
256 static int hf_job_status_spooling;
257 static int hf_job_status_printing;
258 static int hf_job_status_offline;
259 static int hf_job_status_paperout;
260 static int hf_job_status_printed;
261 static int hf_job_status_deleted;
262 static int hf_job_status_blocked;
263 static int hf_job_status_user_intervention;
265 /* Forms */
267 static int hf_form;
268 static int hf_form_level;
269 static int hf_form_name;
270 static int hf_form_flags;
271 static int hf_form_unknown;
272 static int hf_form_width;
273 static int hf_form_height;
274 static int hf_form_left_margin;
275 static int hf_form_top_margin;
276 static int hf_form_horiz_len;
277 static int hf_form_vert_len;
279 static int hf_enumforms_num;
281 /* Print notify */
283 static int hf_notify_options_version;
284 static int hf_notify_options_flags;
285 static int hf_notify_options_flags_refresh;
286 static int hf_notify_options_count;
287 static int hf_notify_option_type;
288 static int hf_notify_option_reserved1;
289 static int hf_notify_option_reserved2;
290 static int hf_notify_option_reserved3;
291 static int hf_notify_option_count;
292 static int hf_notify_option_data_count;
293 static int hf_notify_info_count;
294 static int hf_notify_info_version;
295 static int hf_notify_info_flags;
296 static int hf_notify_info_data_type;
297 static int hf_notify_info_data_count;
298 static int hf_notify_info_data_id;
299 static int hf_notify_info_data_value1;
300 static int hf_notify_info_data_value2;
301 static int hf_notify_info_data_bufsize;
302 static int hf_notify_info_data_buffer;
303 static int hf_notify_info_data_buffer_len;
304 static int hf_notify_info_data_buffer_data;
306 static int hf_notify_field;
308 static int hf_printerlocal;
310 static int hf_rrpcn_changelow;
311 static int hf_rrpcn_changehigh;
312 static int hf_rrpcn_unk0;
313 static int hf_rrpcn_unk1;
315 static int hf_replyopenprinter_unk0;
316 static int hf_replyopenprinter_unk1;
318 static int hf_devmode_devicename;
319 static int hf_devmode_form_name;
320 static int hf_relative_string;
321 static int hf_value_name;
322 static int hf_keybuffer;
323 static int hf_value_string;
325 static expert_field ei_unimplemented_dissector;
326 static expert_field ei_unknown_data;
327 static expert_field ei_spool_printer_info_level;
328 static expert_field ei_printer_info_level;
329 static expert_field ei_form_level;
330 static expert_field ei_job_info_level;
331 static expert_field ei_driver_info_level;
332 static expert_field ei_level;
333 static expert_field ei_notify_info_data_type;
334 static expert_field ei_enumprinterdataex_value;
335 static expert_field ei_buffer_size_too_long;
337 /* Registry data types */
339 #define DCERPC_REG_NONE 0
340 #define DCERPC_REG_SZ 1
341 #define DCERPC_REG_EXPAND_SZ 2
342 #define DCERPC_REG_BINARY 3
343 #define DCERPC_REG_DWORD 4
344 #define DCERPC_REG_DWORD_LE 4 /* DWORD, little endian
346 #define DCERPC_REG_DWORD_BE 5 /* DWORD, big endian */
347 #define DCERPC_REG_LINK 6
348 #define DCERPC_REG_MULTI_SZ 7
349 #define DCERPC_REG_RESOURCE_LIST 8
350 #define DCERPC_REG_FULL_RESOURCE_DESCRIPTOR 9
351 #define DCERPC_REG_RESOURCE_REQUIREMENTS_LIST 10
353 static const value_string reg_datatypes[] = {
354 { DCERPC_REG_NONE, "REG_NONE" },
355 { DCERPC_REG_SZ, "REG_SZ" },
356 { DCERPC_REG_EXPAND_SZ, "REG_EXPAND_SZ" },
357 { DCERPC_REG_BINARY, "REG_BINARY" },
358 { DCERPC_REG_DWORD, "REG_DWORD" },
359 /* { DCERPC_REG_DWORD_LE, "REG_DWORD_LE" }, */
360 { DCERPC_REG_DWORD_BE, "REG_DWORD_BE" },
361 { DCERPC_REG_LINK, "REG_LINK" },
362 { DCERPC_REG_MULTI_SZ, "REG_MULTI_SZ" },
363 { DCERPC_REG_RESOURCE_LIST, "REG_RESOURCE_LIST" },
364 { DCERPC_REG_FULL_RESOURCE_DESCRIPTOR, "REG_FULL_RESOURCE_DESCRIPTOR" },
365 { DCERPC_REG_RESOURCE_REQUIREMENTS_LIST, "REG_RESOURCE_REQUIREMENTS_LIST" },
366 {0, NULL }
368 static value_string_ext reg_datatypes_ext = VALUE_STRING_EXT_INIT(reg_datatypes);
370 /****************************************************************************/
373 * Dissect SPOOLSS specific access rights
376 static int hf_server_access_admin;
377 static int hf_server_access_enum;
378 static int hf_printer_access_admin;
379 static int hf_printer_access_use;
380 static int hf_job_access_admin;
382 static void
383 spoolss_printer_specific_rights(tvbuff_t *tvb, int offset, proto_tree *tree,
384 uint32_t access)
386 proto_tree_add_boolean(
387 tree, hf_printer_access_use, tvb, offset, 4, access);
389 proto_tree_add_boolean(
390 tree, hf_printer_access_admin, tvb, offset, 4, access);
393 struct access_mask_info spoolss_printer_access_mask_info = {
394 "SPOOLSS printer",
395 spoolss_printer_specific_rights,
396 NULL, /* Generic mapping table */
397 NULL /* Standard mapping table */
400 static void
401 spoolss_printserver_specific_rights(tvbuff_t *tvb, int offset,
402 proto_tree *tree, uint32_t access)
404 proto_tree_add_boolean(
405 tree, hf_server_access_enum, tvb, offset, 4, access);
407 proto_tree_add_boolean(
408 tree, hf_server_access_admin, tvb, offset, 4, access);
411 static struct access_mask_info spoolss_printserver_access_mask_info = {
412 "SPOOLSS print server",
413 spoolss_printserver_specific_rights,
414 NULL, /* Generic mapping table */
415 NULL /* Standard mapping table */
418 static void
419 spoolss_job_specific_rights(tvbuff_t *tvb, int offset,
420 proto_tree *tree, uint32_t access)
422 proto_tree_add_boolean(
423 tree, hf_job_access_admin, tvb, offset, 4, access);
426 static struct access_mask_info spoolss_job_access_mask_info = {
427 "SPOOLSS job",
428 spoolss_job_specific_rights,
429 NULL, /* Generic mapping table */
430 NULL /* Standard mapping table */
434 * Routines to dissect a spoolss BUFFER
437 typedef struct {
438 tvbuff_t *tvb;
439 proto_item *tree; /* Proto tree buffer located in */
440 proto_item *item;
441 } BUFFER;
443 static int ett_BUFFER;
445 static int
446 dissect_spoolss_buffer_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
447 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
449 BUFFER *b = (BUFFER *)di->private_data;
450 proto_item *item;
451 uint32_t size;
452 const uint8_t *data;
454 if (di->conformant_run)
455 return offset;
457 /* Dissect size and data */
459 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
460 hf_buffer_size, &size);
462 /* Before going any further, we must ensure the bytes
463 actually esist in the tvb */
464 if ((uint32_t)tvb_reported_length_remaining(tvb, offset) < size) {
465 expert_add_info(pinfo, tree, &ei_buffer_size_too_long);
466 return offset;
469 offset = dissect_ndr_uint8s(tvb, offset, pinfo, NULL, di, drep,
470 hf_buffer_data, size, &data);
472 item = proto_tree_add_item(
473 tree, hf_buffer_data, tvb, offset - size,
474 size, ENC_NA);
476 /* Return buffer info */
478 if (b) {
480 /* I'm not sure about this. Putting the buffer into
481 its own tvb makes sense and the dissection code is
482 much clearer, but the data is a proper subset of
483 the actual tvb. Not adding the new data source
484 makes the hex display confusing as it switches
485 between the 'DCERPC over SMB' tvb and the buffer
486 tvb with no visual cues as to what is going on. */
488 b->tvb = tvb_new_child_real_data(tvb, data, size, size);
489 add_new_data_source(pinfo, b->tvb, "SPOOLSS buffer");
491 b->item = item;
492 b->tree = proto_item_add_subtree(item, ett_BUFFER);
495 return offset;
498 /* Dissect a spoolss buffer and return buffer data */
500 static int
501 dissect_spoolss_buffer(tvbuff_t *tvb, int offset, packet_info *pinfo,
502 proto_tree *tree, dcerpc_info *di, uint8_t *drep, BUFFER *b)
504 if (b)
505 memset(b, 0, sizeof(BUFFER));
507 di->private_data = b;
509 offset = dissect_ndr_pointer(
510 tvb, offset, pinfo, tree, di, drep,
511 dissect_spoolss_buffer_data, NDR_POINTER_UNIQUE,
512 "Buffer", -1);
514 return offset;
517 static int
518 dissect_spoolss_string_parm_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
519 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
521 uint32_t buffer_len, len;
522 char *s;
523 proto_item *item = NULL;
525 if (di->conformant_run)
526 return offset;
528 /* Dissect size and data */
530 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
531 hf_string_parm_size, &buffer_len);
533 s = tvb_get_stringz_enc(pinfo->pool, tvb, offset, &len, ENC_UTF_16|ENC_LITTLE_ENDIAN);
535 if (tree && buffer_len) {
536 tvb_ensure_bytes_exist(tvb, offset, buffer_len);
538 item = proto_tree_add_string(
539 tree, hf_string_parm_data, tvb, offset, len, s);
541 offset += buffer_len;
543 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", s);
545 /* Append string to upper level item */
546 if (tree && item) {
547 item = item->parent != NULL ? item->parent : item;
548 proto_item_append_text(item, ": %s", s);
551 return offset;
554 /* Dissect a spoolss string parameter */
556 static int
557 dissect_spoolss_string_parm(tvbuff_t *tvb, int offset, packet_info *pinfo,
558 proto_tree *tree, dcerpc_info *di, uint8_t *drep, const char *text)
560 offset = dissect_ndr_pointer(
561 tvb, offset, pinfo, tree, di, drep,
562 dissect_spoolss_string_parm_data, NDR_POINTER_UNIQUE,
563 text, -1);
565 return offset;
569 * SYSTEM_TIME
572 static int ett_SYSTEM_TIME;
574 static int hf_time_year;
575 static int hf_time_month;
576 static int hf_time_dow;
577 static int hf_time_day;
578 static int hf_time_hour;
579 static int hf_time_minute;
580 static int hf_time_second;
581 static int hf_time_msec;
583 static int
584 dissect_SYSTEM_TIME(tvbuff_t *tvb, int offset, packet_info *pinfo,
585 proto_tree *tree, dcerpc_info *di, uint8_t *drep, const char *name,
586 bool add_subtree, char **data)
588 proto_item *item = NULL;
589 proto_tree *subtree = tree;
590 uint16_t year, month, day, hour, minute, second, millisecond;
591 char *str;
593 if (add_subtree) {
594 subtree = proto_tree_add_subtree(tree, tvb, offset, 16, ett_SYSTEM_TIME, &item, name);
597 offset = dissect_ndr_uint16(
598 tvb, offset, pinfo, subtree, di, drep, hf_time_year, &year);
600 offset = dissect_ndr_uint16(
601 tvb, offset, pinfo, subtree, di, drep, hf_time_month, &month);
603 offset = dissect_ndr_uint16(
604 tvb, offset, pinfo, subtree, di, drep, hf_time_dow, NULL);
606 offset = dissect_ndr_uint16(
607 tvb, offset, pinfo, subtree, di, drep, hf_time_day, &day);
609 offset = dissect_ndr_uint16(
610 tvb, offset, pinfo, subtree, di, drep, hf_time_hour, &hour);
612 offset = dissect_ndr_uint16(
613 tvb, offset, pinfo, subtree, di, drep, hf_time_minute, &minute);
615 offset = dissect_ndr_uint16(
616 tvb, offset, pinfo, subtree, di, drep, hf_time_second, &second);
618 offset = dissect_ndr_uint16(
619 tvb, offset, pinfo, subtree, di, drep, hf_time_msec, &millisecond);
621 str = wmem_strdup_printf(pinfo->pool,
622 "%d/%02d/%02d %02d:%02d:%02d.%03d",
623 year, month, day, hour, minute, second,
624 millisecond);
626 if (add_subtree)
627 proto_item_append_text(item, ": %s", str);
629 if (data)
630 *data = str;
632 return offset;
635 static int
636 dissect_SYSTEM_TIME_ptr(tvbuff_t *tvb, int offset, packet_info *pinfo,
637 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
639 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
640 char *str;
643 offset = dissect_SYSTEM_TIME(
644 tvb, offset, pinfo, tree, di, drep, NULL, false, &str);
645 dcv->private_data = wmem_strdup(wmem_file_scope(), str);
647 return offset;
651 * SpoolssClosePrinter
654 static int
655 SpoolssClosePrinter_q(tvbuff_t *tvb, int offset,
656 packet_info *pinfo, proto_tree *tree,
657 dcerpc_info *di, uint8_t *drep)
659 e_ctx_hnd policy_hnd;
660 char *pol_name;
662 /* Parse packet */
664 offset = dissect_nt_policy_hnd(
665 tvb, offset, pinfo, tree, di, drep, hf_hnd, &policy_hnd, NULL,
666 PIDL_POLHND_CLOSE);
668 dcerpc_fetch_polhnd_data(&policy_hnd, &pol_name, NULL, NULL, NULL,
669 pinfo->num);
671 if (pol_name)
672 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
673 pol_name);
675 return offset;
678 static int
679 SpoolssClosePrinter_r(tvbuff_t *tvb, int offset,
680 packet_info *pinfo, proto_tree *tree,
681 dcerpc_info *di, uint8_t *drep)
683 /* Parse packet */
685 offset = dissect_nt_policy_hnd(
686 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
687 PIDL_POLHND_USE);
690 offset = dissect_doserror(
691 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
693 return offset;
696 /* Dissect some printer data. The get/set/enum printerdata routines all
697 store value/data in a uint8 array. We could use the ndr routines for
698 this but that would result in one item for each byte in the printer
699 data. */
701 static int ett_printerdata_data;
702 static int ett_printerdata_value;
704 static int
705 dissect_printerdata_data(tvbuff_t *tvb, int offset,
706 packet_info *pinfo, proto_tree *tree,
707 dcerpc_info *di, uint8_t *drep, uint32_t type)
709 proto_item *item, *hidden_item;
710 proto_tree *subtree;
711 uint32_t size;
713 subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_printerdata_data, &item, "Data");
715 offset = dissect_ndr_uint32(
716 tvb, offset, pinfo, subtree, di, drep, hf_printerdata_size, &size);
718 if (size) {
720 offset = dissect_ndr_uint8s(
721 tvb, offset, pinfo, subtree, di, drep,
722 hf_printerdata_data, size, NULL);
724 switch(type) {
725 case DCERPC_REG_SZ: {
726 const uint8_t *data;
728 hidden_item = proto_tree_add_item_ret_string(
729 tree, hf_printerdata_data_sz, tvb,
730 offset - size, size, ENC_UTF_16|ENC_LITTLE_ENDIAN, pinfo->pool, &data);
731 proto_item_set_hidden(hidden_item);
733 proto_item_append_text(item, ": %s", data);
735 col_append_fstr(pinfo->cinfo, COL_INFO, " = %s", data);
736 break;
738 case DCERPC_REG_DWORD: {
739 uint32_t data = tvb_get_letohl(tvb, offset - size);
741 proto_item_append_text(item, ": 0x%08x", data);
743 col_append_fstr(
744 pinfo->cinfo, COL_INFO, " = 0x%08x",
745 data);
747 hidden_item = proto_tree_add_uint(
748 tree, hf_printerdata_data_dword, tvb,
749 offset - size, 4, data);
750 proto_item_set_hidden(hidden_item);
752 break;
754 case DCERPC_REG_BINARY:
755 col_append_str(
756 pinfo->cinfo, COL_INFO,
757 " = <binary data>");
758 break;
760 default:
761 break;
765 proto_item_set_len(item, size + 4);
767 return offset;
771 * SpoolssGetPrinterData
774 static int
775 SpoolssGetPrinterData_q(tvbuff_t *tvb, int offset,
776 packet_info *pinfo, proto_tree *tree,
777 dcerpc_info *di, uint8_t *drep)
779 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
780 char *value_name;
781 proto_item *hidden_item;
783 hidden_item = proto_tree_add_uint(
784 tree, hf_printerdata, tvb, offset, 0, 1);
785 proto_item_set_hidden(hidden_item);
787 /* Parse packet */
789 offset = dissect_nt_policy_hnd(
790 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
791 PIDL_POLHND_USE);
794 value_name = NULL;
795 offset = dissect_ndr_cvstring(
796 tvb, offset, pinfo, tree, di, drep, sizeof(uint16_t),
797 hf_printerdata_value, true, &value_name);
798 /* GetPrinterData() stores the printerdata in se_data */
799 if(!pinfo->fd->visited){
800 if(!dcv->se_data && value_name){
801 dcv->se_data = wmem_strdup(wmem_file_scope(), value_name);
805 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", value_name);
807 offset = dissect_ndr_uint32(
808 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
810 return offset;
813 static int
814 SpoolssGetPrinterData_r(tvbuff_t *tvb, int offset,
815 packet_info *pinfo, proto_tree *tree,
816 dcerpc_info *di, uint8_t *drep)
818 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
819 uint32_t type;
820 proto_item *hidden_item;
821 const char *data;
823 hidden_item = proto_tree_add_uint(
824 tree, hf_printerdata, tvb, offset, 0, 1);
825 proto_item_set_hidden(hidden_item);
827 /* Parse packet */
829 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
830 hf_printerdata_type, &type);
832 data = (const char *)(dcv->se_data ? dcv->se_data : "????");
834 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", data);
836 offset = dissect_printerdata_data(
837 tvb, offset, pinfo, tree, di, drep, type);
839 offset = dissect_ndr_uint32(
840 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
842 offset = dissect_doserror(
843 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
845 return offset;
849 * SpoolssGetPrinterDataEx
852 static int
853 SpoolssGetPrinterDataEx_q(tvbuff_t *tvb, int offset,
854 packet_info *pinfo, proto_tree *tree,
855 dcerpc_info *di, uint8_t *drep)
857 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
858 char *key_name, *value_name;
859 proto_item *hidden_item;
861 hidden_item = proto_tree_add_uint(
862 tree, hf_printerdata, tvb, offset, 0, 1);
863 proto_item_set_hidden(hidden_item);
865 /* Parse packet */
867 offset = dissect_nt_policy_hnd(
868 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
869 PIDL_POLHND_USE);
871 key_name=NULL;
872 offset = dissect_ndr_cvstring(
873 tvb, offset, pinfo, tree, di, drep, sizeof(uint16_t),
874 hf_printerdata_key, true, &key_name);
876 value_name=NULL;
877 offset = dissect_ndr_cvstring(
878 tvb, offset, pinfo, tree, di, drep, sizeof(uint16_t),
879 hf_printerdata_value, true, &value_name);
881 /* GetPrinterDataEx() stores the key/value in se_data */
882 if(!pinfo->fd->visited){
883 if(!dcv->se_data){
884 dcv->se_data = wmem_strdup_printf(wmem_file_scope(),
885 "%s==%s",
886 key_name?key_name:"",
887 value_name?value_name:"");
891 if (dcv->se_data)
892 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
893 (char *)dcv->se_data);
895 offset = dissect_ndr_uint32(
896 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
898 return offset;
901 static int
902 SpoolssGetPrinterDataEx_r(tvbuff_t *tvb, int offset,
903 packet_info *pinfo, proto_tree *tree,
904 dcerpc_info *di, uint8_t *drep)
906 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
907 uint32_t size, type;
908 proto_item *hidden_item;
910 hidden_item = proto_tree_add_uint(
911 tree, hf_printerdata, tvb, offset, 0, 1);
912 proto_item_set_hidden(hidden_item);
914 /* Parse packet */
916 offset = dissect_ndr_uint32(
917 tvb, offset, pinfo, tree, di, drep, hf_printerdata_type, &type);
919 offset = dissect_ndr_uint32(
920 tvb, offset, pinfo, tree, di, drep, hf_returned, &size);
922 if (dcv->se_data) {
923 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", (char *)dcv->se_data);
926 if (size)
927 dissect_printerdata_data(tvb, offset, pinfo, tree, di, drep, type);
929 offset += size;
931 offset = dissect_ndr_uint32(
932 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
934 offset = dissect_doserror(
935 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
937 return offset;
941 * SpoolssSetPrinterData
944 static int
945 SpoolssSetPrinterData_q(tvbuff_t *tvb, int offset,
946 packet_info *pinfo, proto_tree *tree,
947 dcerpc_info *di, uint8_t *drep)
949 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
950 char *value_name;
951 uint32_t type;
952 proto_item *hidden_item;
954 hidden_item = proto_tree_add_uint(
955 tree, hf_printerdata, tvb, offset, 0, 1);
956 proto_item_set_hidden(hidden_item);
958 /* Parse packet */
960 offset = dissect_nt_policy_hnd(
961 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
962 PIDL_POLHND_USE);
964 value_name=NULL;
965 offset = dissect_ndr_cvstring(
966 tvb, offset, pinfo, tree, di, drep, sizeof(uint16_t),
967 hf_printerdata_value, true, &value_name);
969 /* GetPrinterDataEx() stores the key/value in se_data */
970 if(!pinfo->fd->visited){
971 if(!dcv->se_data){
972 dcv->se_data = wmem_strdup(wmem_file_scope(),
973 value_name?value_name:"");
978 if (dcv->se_data){
979 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", (char *)dcv->se_data);
982 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
983 hf_printerdata_type, &type);
985 offset = dissect_printerdata_data(
986 tvb, offset, pinfo, tree, di, drep, type);
988 offset = dissect_ndr_uint32(
989 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
991 return offset;
994 static int
995 SpoolssSetPrinterData_r(tvbuff_t *tvb, int offset,
996 packet_info *pinfo, proto_tree *tree,
997 dcerpc_info *di, uint8_t *drep)
999 proto_item *hidden_item;
1001 hidden_item = proto_tree_add_uint(
1002 tree, hf_printerdata, tvb, offset, 0, 1);
1003 proto_item_set_hidden(hidden_item);
1005 /* Parse packet */
1007 offset = dissect_doserror(
1008 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
1010 return offset;
1014 * SpoolssSetPrinterDataEx
1017 static int hf_setprinterdataex_max_len;
1018 static int hf_setprinterdataex_real_len;
1019 static int hf_setprinterdataex_data;
1021 static int
1022 SpoolssSetPrinterDataEx_q(tvbuff_t *tvb, int offset,
1023 packet_info *pinfo, proto_tree *tree,
1024 dcerpc_info *di, uint8_t *drep)
1026 char *key_name, *value_name;
1027 uint32_t max_len;
1028 proto_item *hidden_item;
1030 hidden_item = proto_tree_add_uint(
1031 tree, hf_printerdata, tvb, offset, 0, 1);
1032 proto_item_set_hidden(hidden_item);
1034 /* Parse packet */
1036 offset = dissect_nt_policy_hnd(
1037 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
1038 PIDL_POLHND_USE);
1040 offset = dissect_ndr_cvstring(
1041 tvb, offset, pinfo, tree, di, drep, sizeof(uint16_t),
1042 hf_printerdata_key, true, &key_name);
1044 offset = dissect_ndr_cvstring(
1045 tvb, offset, pinfo, tree, di, drep, sizeof(uint16_t),
1046 hf_printerdata_value, true, &value_name);
1048 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s/%s",
1049 key_name, value_name);
1051 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
1052 hf_printerdata_type, NULL);
1054 offset = dissect_ndr_uint32(
1055 tvb, offset, pinfo, tree, di, drep,
1056 hf_setprinterdataex_max_len, &max_len);
1058 offset = dissect_ndr_uint8s(
1059 tvb, offset, pinfo, tree, di, drep,
1060 hf_setprinterdataex_data, max_len, NULL);
1062 offset = dissect_ndr_uint32(
1063 tvb, offset, pinfo, tree, di, drep,
1064 hf_setprinterdataex_real_len, NULL);
1066 return offset;
1069 static int
1070 SpoolssSetPrinterDataEx_r(tvbuff_t *tvb, int offset,
1071 packet_info *pinfo, proto_tree *tree,
1072 dcerpc_info *di, uint8_t *drep)
1074 proto_item *hidden_item;
1076 hidden_item = proto_tree_add_uint(
1077 tree, hf_printerdata, tvb, offset, 0, 1);
1078 proto_item_set_hidden(hidden_item);
1080 /* Parse packet */
1082 offset = dissect_doserror(
1083 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
1085 return offset;
1088 /* XXX - "name" should be an hf_ value for an FT_STRING. */
1089 static int
1090 dissect_spoolss_uint16uni(tvbuff_t *tvb, int offset, packet_info *pinfo _U_,
1091 proto_tree *tree, uint8_t *drep _U_, char **data,
1092 int hf_name)
1094 int len, remaining;
1095 char *text;
1097 if (offset % 2)
1098 offset += 2 - (offset % 2);
1100 /* Get remaining data in buffer as a string */
1102 remaining = tvb_reported_length_remaining(tvb, offset);
1103 if (remaining <= 0) {
1104 if (data)
1105 *data = wmem_strdup(pinfo->pool, "");
1106 return offset;
1109 text = tvb_get_string_enc(pinfo->pool, tvb, offset, remaining, ENC_UTF_16|ENC_LITTLE_ENDIAN);
1110 len = (int)strlen(text);
1112 proto_tree_add_string(tree, hf_name, tvb, offset, len * 2, text);
1114 if (data)
1115 *data = text;
1117 return offset + (len + 1) * 2;
1121 * DEVMODE
1124 /* Devicemode orientation values */
1126 static const value_string devmode_orientation_vals[] =
1128 { DEVMODE_ORIENTATION_PORTRAIT, "Portrait" },
1129 { DEVMODE_ORIENTATION_LANDSCAPE, "Landscape" },
1130 { 0, NULL }
1133 /* Paper size values. International paper sizes is a fascinating
1134 topic. No seriously! (-: */
1136 static const value_string devmode_papersize_vals[] =
1138 { DEVMODE_PAPERSIZE_LETTER, "Letter" },
1139 { DEVMODE_PAPERSIZE_LETTERSMALL, "Letter (small)" },
1140 { DEVMODE_PAPERSIZE_TABLOID, "Tabloid" },
1141 { DEVMODE_PAPERSIZE_LEDGER, "Ledger" },
1142 { DEVMODE_PAPERSIZE_LEGAL, "Legal" },
1143 { DEVMODE_PAPERSIZE_STATEMENT, "Statement" },
1144 { DEVMODE_PAPERSIZE_EXECUTIVE, "Executive" },
1145 { DEVMODE_PAPERSIZE_A3, "A3" },
1146 { DEVMODE_PAPERSIZE_A4, "A4" },
1147 { DEVMODE_PAPERSIZE_A4SMALL, "A4 (small)" },
1148 { DEVMODE_PAPERSIZE_A5, "A5" },
1149 { DEVMODE_PAPERSIZE_B4, "B4" },
1150 { DEVMODE_PAPERSIZE_B5, "B5" },
1151 { DEVMODE_PAPERSIZE_FOLIO, "Folio" },
1152 { DEVMODE_PAPERSIZE_QUARTO, "Quarto" },
1153 { DEVMODE_PAPERSIZE_10X14, "10x14" },
1154 { DEVMODE_PAPERSIZE_11X17, "11x17" },
1155 { DEVMODE_PAPERSIZE_NOTE, "Note" },
1156 { DEVMODE_PAPERSIZE_ENV9, "Envelope #9" },
1157 { DEVMODE_PAPERSIZE_ENV10, "Envelope #10" },
1158 { DEVMODE_PAPERSIZE_ENV11, "Envelope #11" },
1159 { DEVMODE_PAPERSIZE_ENV12, "Envelope #12" },
1160 { DEVMODE_PAPERSIZE_ENV14, "Envelope #14" },
1161 { DEVMODE_PAPERSIZE_CSHEET, "C sheet" },
1162 { DEVMODE_PAPERSIZE_DSHEET, "D sheet" },
1163 { DEVMODE_PAPERSIZE_ESHEET, "E sheet" },
1164 { DEVMODE_PAPERSIZE_ENVDL, "Envelope DL" },
1165 { DEVMODE_PAPERSIZE_ENVC5, "Envelope C5" },
1166 { DEVMODE_PAPERSIZE_ENVC3, "Envelope C3" },
1167 { DEVMODE_PAPERSIZE_ENVC4, "Envelope C4" },
1168 { DEVMODE_PAPERSIZE_ENVC6, "Envelope C6" },
1169 { DEVMODE_PAPERSIZE_ENVC65, "Envelope C65" },
1170 { DEVMODE_PAPERSIZE_ENVB4, "Envelope B4" },
1171 { DEVMODE_PAPERSIZE_ENVB5, "Envelope B5" },
1172 { DEVMODE_PAPERSIZE_ENVB6, "Envelope B6" },
1173 { DEVMODE_PAPERSIZE_ENVITALY, "Envelope (Italy)" },
1174 { DEVMODE_PAPERSIZE_ENVMONARCH, "Envelope (Monarch)" },
1175 { DEVMODE_PAPERSIZE_ENVPERSONAL, "Envelope (Personal)" },
1176 { DEVMODE_PAPERSIZE_FANFOLDUS, "Fanfold (US)" },
1177 { DEVMODE_PAPERSIZE_FANFOLDSTDGERMAN, "Fanfold (Std German)" },
1178 { DEVMODE_PAPERSIZE_FANFOLDLGLGERMAN, "Fanfold (Legal German)" },
1179 { DEVMODE_PAPERSIZE_ISOB4, "B4 (ISO)" },
1180 { DEVMODE_PAPERSIZE_JAPANESEPOSTCARD, "Japanese postcard" },
1181 { DEVMODE_PAPERSIZE_9X11, "9x11" },
1182 { DEVMODE_PAPERSIZE_10X11, "10x11" },
1183 { DEVMODE_PAPERSIZE_15X11, "15x11" },
1184 { DEVMODE_PAPERSIZE_ENVINVITE, "Envelope (Invite)" },
1185 { DEVMODE_PAPERSIZE_RESERVED48, "Reserved (48)" },
1186 { DEVMODE_PAPERSIZE_RESERVED49, "Reserved (49)" },
1187 { DEVMODE_PAPERSIZE_LETTEREXTRA, "Letter (Extra)" },
1188 { DEVMODE_PAPERSIZE_LEGALEXTRA, "Legal (Extra)" },
1189 { DEVMODE_PAPERSIZE_TABLOIDEXTRA, "Tabloid (Extra)" },
1190 { DEVMODE_PAPERSIZE_A4EXTRA, "A4 (Extra)" },
1191 { DEVMODE_PAPERSIZE_LETTERTRANS, "Letter (Transverse)" },
1192 { DEVMODE_PAPERSIZE_A4TRANS, "A4 (Transverse)" },
1193 { DEVMODE_PAPERSIZE_LETTEREXTRATRANS, "Letter (Extra, Transverse)" },
1194 { DEVMODE_PAPERSIZE_APLUS, "A+" },
1195 { DEVMODE_PAPERSIZE_BPLUS, "B+" },
1196 { DEVMODE_PAPERSIZE_LETTERPLUS, "Letter+" },
1197 { DEVMODE_PAPERSIZE_A4PLUS, "A4+" },
1198 { DEVMODE_PAPERSIZE_A5TRANS, "A5 (Transverse)" },
1199 { DEVMODE_PAPERSIZE_B5TRANS, "B5 (Transverse)" },
1200 { DEVMODE_PAPERSIZE_A3EXTRA, "A3 (Extra)" },
1201 { DEVMODE_PAPERSIZE_A5EXTRA, "A5 (Extra)" },
1202 { DEVMODE_PAPERSIZE_B5EXTRA, "B5 (Extra)" },
1203 { DEVMODE_PAPERSIZE_A2, "A2" },
1204 { DEVMODE_PAPERSIZE_A3TRANS, "A3 (Transverse)" },
1205 { DEVMODE_PAPERSIZE_A3EXTRATRANS, "A3 (Extra, Transverse" },
1206 { DEVMODE_PAPERSIZE_DBLJAPANESEPOSTCARD, "Double Japanese Postcard" },
1207 { DEVMODE_PAPERSIZE_A6, "A6" },
1208 { DEVMODE_PAPERSIZE_JENVKAKU2, "Japanese Envelope (Kaku #2)" },
1209 { DEVMODE_PAPERSIZE_JENVKAKU3, "Japanese Envelope (Kaku #3)" },
1210 { DEVMODE_PAPERSIZE_JENVCHOU3, "Japanese Envelope (Chou #3)" },
1211 { DEVMODE_PAPERSIZE_JENVCHOU4, "Japanese Envelope (Chou #4)" },
1212 { DEVMODE_PAPERSIZE_LETTERROT, "Letter (Rotated)" },
1213 { DEVMODE_PAPERSIZE_A3ROT, "A3 (Rotated)" },
1214 { DEVMODE_PAPERSIZE_A4ROT, "A4 (Rotated)" },
1215 { DEVMODE_PAPERSIZE_A5ROT, "A5 (Rotated)" },
1216 { DEVMODE_PAPERSIZE_B4JISROT, "B4 (JIS, Rotated)" },
1217 { DEVMODE_PAPERSIZE_B5JISROT, "B5 (JIS, Rotated)"},
1218 { DEVMODE_PAPERSIZE_JAPANESEPOSTCARDROT,
1219 "Japanese Postcard (Rotated)" },
1220 { DEVMODE_PAPERSIZE_DBLJAPANESEPOSTCARDROT82,
1221 "Double Japanese Postcard (Rotated)" },
1222 { DEVMODE_PAPERSIZE_A6ROT, "A6 (Rotated)" },
1223 { DEVMODE_PAPERSIZE_JENVKAKU2ROT,
1224 "Japanese Envelope (Kaku #2, Rotated)" },
1225 { DEVMODE_PAPERSIZE_JENVKAKU3ROT,
1226 "Japanese Envelope (Kaku #3, Rotated)" },
1227 { DEVMODE_PAPERSIZE_JENVCHOU3ROT,
1228 "Japanese Envelope (Chou #3, Rotated)" },
1229 { DEVMODE_PAPERSIZE_JENVCHOU4ROT,
1230 "Japanese Envelope (Chou #4, Rotated)" },
1231 { DEVMODE_PAPERSIZE_B6JIS, "B6 (JIS)" },
1232 { DEVMODE_PAPERSIZE_B6JISROT, "B6 (JIS, Rotated)" },
1233 { DEVMODE_PAPERSIZE_12X11, "12x11" },
1234 { DEVMODE_PAPERSIZE_JENVYOU4, "Japanese Envelope (You #4)" },
1235 { DEVMODE_PAPERSIZE_JENVYOU4ROT,
1236 "Japanese Envelope (You #4, Rotated" },
1237 { DEVMODE_PAPERSIZE_P16K, "PRC 16K" },
1238 { DEVMODE_PAPERSIZE_P32K, "PRC 32K" },
1239 { DEVMODE_PAPERSIZE_P32KBIG, "P32K (Big)" },
1240 { DEVMODE_PAPERSIZE_PENV1, "PRC Envelope #1" },
1241 { DEVMODE_PAPERSIZE_PENV2, "PRC Envelope #2" },
1242 { DEVMODE_PAPERSIZE_PENV3, "PRC Envelope #3" },
1243 { DEVMODE_PAPERSIZE_PENV4, "PRC Envelope #4" },
1244 { DEVMODE_PAPERSIZE_PENV5, "PRC Envelope #5" },
1245 { DEVMODE_PAPERSIZE_PENV6, "PRC Envelope #6" },
1246 { DEVMODE_PAPERSIZE_PENV7, "PRC Envelope #7" },
1247 { DEVMODE_PAPERSIZE_PENV8, "PRC Envelope #8" },
1248 { DEVMODE_PAPERSIZE_PENV9, "PRC Envelope #9" },
1249 { DEVMODE_PAPERSIZE_PENV10, "PRC Envelope #10" },
1250 { DEVMODE_PAPERSIZE_P16KROT, "PRC 16K (Rotated)" },
1251 { DEVMODE_PAPERSIZE_P32KROT, "PRC 32K (Rotated)" },
1252 { DEVMODE_PAPERSIZE_P32KBIGROT, "PRC 32K (Big, Rotated)" },
1253 { DEVMODE_PAPERSIZE_PENV1ROT, "PRC Envelope #1 (Rotated)" },
1254 { DEVMODE_PAPERSIZE_PENV2ROT, "PRC Envelope #2 (Rotated)" },
1255 { DEVMODE_PAPERSIZE_PENV3ROT, "PRC Envelope #3 (Rotated)" },
1256 { DEVMODE_PAPERSIZE_PENV4ROT, "PRC Envelope #4 (Rotated)" },
1257 { DEVMODE_PAPERSIZE_PENV5ROT, "PRC Envelope #5 (Rotated)" },
1258 { DEVMODE_PAPERSIZE_PENV6ROT, "PRC Envelope #6 (Rotated)" },
1259 { DEVMODE_PAPERSIZE_PENV7ROT, "PRC Envelope #7 (Rotated)" },
1260 { DEVMODE_PAPERSIZE_PENV8ROT, "PRC Envelope #8 (Rotated)" },
1261 { DEVMODE_PAPERSIZE_PENV9ROT, "PRC Envelope #9 (Rotated)" },
1262 { DEVMODE_PAPERSIZE_PENV10ROT, "PRC Envelope #10 (Rotated)" },
1263 { 0, NULL }
1265 static value_string_ext devmode_papersize_vals_ext = VALUE_STRING_EXT_INIT(devmode_papersize_vals);
1267 /* List of observed specversions */
1269 static const value_string devmode_specversion_vals[] =
1271 { 0x0320, "Observed" },
1272 { 0x0400, "Observed" },
1273 { 0x0401, "Observed" },
1274 { 0x040d, "Observed" },
1275 { 0, NULL }
1278 /* Paper sources */
1280 static const value_string devmode_papersource_vals[] =
1282 { DEVMODE_PAPERSOURCE_UPPER, "Upper" },
1283 { DEVMODE_PAPERSOURCE_LOWER, "Lower" },
1284 { DEVMODE_PAPERSOURCE_MIDDLE, "Middle" },
1285 { DEVMODE_PAPERSOURCE_MANUAL, "Manual" },
1286 { DEVMODE_PAPERSOURCE_ENV, "Envelope" },
1287 { DEVMODE_PAPERSOURCE_ENVMANUAL, "Envelope Manual" },
1288 { DEVMODE_PAPERSOURCE_AUTO, "Auto" },
1289 { DEVMODE_PAPERSOURCE_TRACTOR, "Tractor" },
1290 { DEVMODE_PAPERSOURCE_SMALLFMT, "Small Format" },
1291 { DEVMODE_PAPERSOURCE_LARGEFMAT, "Large Format" },
1292 { DEVMODE_PAPERSOURCE_LARGECAP, "Large Capacity" },
1293 { DEVMODE_PAPERSOURCE_CASSETTE, "Cassette" },
1294 { DEVMODE_PAPERSOURCE_FORMSRC, "Form Source" },
1295 { 0, NULL }
1297 static value_string_ext devmode_papersource_vals_ext = VALUE_STRING_EXT_INIT(devmode_papersource_vals);
1299 /* Print quality */
1301 static const value_string devmode_printquality_vals[] =
1303 { DEVMODE_PRINTQUALITY_HIGH, "High" },
1304 { DEVMODE_PRINTQUALITY_MEDIUM, "Medium" },
1305 { DEVMODE_PRINTQUALITY_LOW, "Low" },
1306 { DEVMODE_PRINTQUALITY_DRAFT, "Draft" },
1307 { 0, NULL }
1310 /* Color */
1312 static const value_string devmode_colour_vals[] =
1314 { DEVMODE_COLOUR_COLOUR, "Colour" },
1315 { DEVMODE_COLOUR_MONO, "Monochrome" },
1316 { 0, NULL }
1319 /* TrueType options */
1321 static const value_string devmode_ttoption_vals[] =
1323 { 0, "Not set" },
1324 { DEVMODE_TTOPTION_BITMAP, "Bitmap" },
1325 { DEVMODE_TTOPTION_DOWNLOAD, "Download" },
1326 { DEVMODE_TTOPTION_DOWNLOAD_OUTLINE, "Download outline" },
1327 { DEVMODE_TTOPTION_SUBDEV, "Substitute device fonts" },
1328 { 0, NULL }
1331 /* Collate info */
1333 static const value_string devmode_collate_vals[] =
1335 { DEVMODE_COLLATE_FALSE, "False" },
1336 { DEVMODE_COLLATE_TRUE, "True" },
1337 { 0, NULL }
1340 /* Duplex info */
1342 static const value_string devmode_duplex_vals[] =
1344 { DEVMODE_DUPLEX_SIMPLEX, "Simplex" },
1345 { DEVMODE_DUPLEX_VERT, "Vertical" },
1346 { DEVMODE_DUPLEX_HORIZ, "Horizontal" },
1347 { 0, NULL }
1350 static const value_string devmode_displayflags_vals[] =
1352 { 0, "Colour" },
1353 { DEVMODE_DISPLAYFLAGS_GRAYSCALE, "Grayscale" },
1354 { DEVMODE_DISPLAYFLAGS_INTERLACED, "Interlaced" },
1355 { 0, NULL }
1358 static const value_string devmode_icmmethod_vals[] =
1360 { DEVMODE_ICMMETHOD_NONE, "None" },
1361 { DEVMODE_ICMMETHOD_SYSTEM, "System" },
1362 { DEVMODE_ICMMETHOD_DRIVER, "Driver" },
1363 { DEVMODE_ICMMETHOD_DEVICE, "Device" },
1364 { 0, NULL }
1367 static const value_string devmode_icmintent_vals[] =
1369 { 0, "Not set" },
1370 { DEVMODE_ICMINTENT_SATURATE, "Saturate" },
1371 { DEVMODE_ICMINTENT_CONTRAST, "Contrast" },
1372 { DEVMODE_ICMINTENT_COLORIMETRIC, "Colorimetric" },
1373 { DEVMODE_ICMINTENT_ABS_COLORIMETRIC, "Absolute colorimetric" },
1374 { 0, NULL }
1377 static const value_string devmode_mediatype_vals[] =
1379 { 0, "Not set" },
1380 { DEVMODE_MEDIATYPE_STANDARD, "Standard" },
1381 { DEVMODE_MEDIATYPE_TRANSPARENCY, "Transparency" },
1382 { DEVMODE_MEDIATYPE_GLOSSY, "Glossy" },
1383 { 0, NULL }
1386 static const value_string devmode_dithertype_vals[] =
1388 { 0, "Not set" },
1389 { DEVMODE_DITHERTYPE_NONE, "None" },
1390 { DEVMODE_DITHERTYPE_COARSE, "Coarse" },
1391 { DEVMODE_DITHERTYPE_LINE, "Line" },
1392 { DEVMODE_DITHERTYPE_LINEART, "Line art" },
1393 { DEVMODE_DITHERTYPE_ERRORDIFFUSION, "Error diffusion" },
1394 { DEVMODE_DITHERTYPE_RESERVED6, "Reserved 6" },
1395 { DEVMODE_DITHERTYPE_RESERVED7, "Reserved 7" },
1396 { DEVMODE_DITHERTYPE_GRAYSCALE, "Grayscale" },
1397 { 0, NULL }
1400 static int ett_DEVMODE_fields;
1402 static int
1403 dissect_DEVMODE_fields(tvbuff_t *tvb, int offset, packet_info *pinfo,
1404 proto_tree *tree, dcerpc_info *di, uint8_t *drep, uint32_t *pdata)
1406 uint32_t fields;
1407 proto_item *hidden_item;
1409 static int * const hf_fields[] = {
1410 &hf_devmode_fields_orientation,
1411 &hf_devmode_fields_papersize,
1412 &hf_devmode_fields_paperlength,
1413 &hf_devmode_fields_paperwidth,
1414 &hf_devmode_fields_scale,
1415 &hf_devmode_fields_position,
1416 &hf_devmode_fields_nup,
1417 &hf_devmode_fields_copies,
1418 &hf_devmode_fields_defaultsource,
1419 &hf_devmode_fields_printquality,
1420 &hf_devmode_fields_color,
1421 &hf_devmode_fields_duplex,
1422 &hf_devmode_fields_yresolution,
1423 &hf_devmode_fields_ttoption,
1424 &hf_devmode_fields_collate,
1425 &hf_devmode_fields_formname,
1426 &hf_devmode_fields_logpixels,
1427 &hf_devmode_fields_bitsperpel,
1428 &hf_devmode_fields_pelswidth,
1429 &hf_devmode_fields_pelsheight,
1430 &hf_devmode_fields_displayflags,
1431 &hf_devmode_fields_displayfrequency,
1432 &hf_devmode_fields_icmmethod,
1433 &hf_devmode_fields_icmintent,
1434 &hf_devmode_fields_mediatype,
1435 &hf_devmode_fields_dithertype,
1436 &hf_devmode_fields_panningwidth,
1437 &hf_devmode_fields_panningheight,
1438 NULL
1441 hidden_item = proto_tree_add_uint(
1442 tree, hf_devmode, tvb, offset, 0, 1);
1443 proto_item_set_hidden(hidden_item);
1445 offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, di, drep, -1, &fields);
1447 proto_tree_add_bitmask_value_with_flags(tree, tvb, offset - 4, hf_devmode_fields,
1448 ett_DEVMODE_fields, hf_fields, fields, BMT_NO_APPEND);
1450 if (pdata)
1451 *pdata = fields;
1453 return offset;
1456 static int ett_DEVMODE;
1458 static int
1459 dissect_DEVMODE(tvbuff_t *tvb, int offset, packet_info *pinfo,
1460 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
1462 proto_item *item;
1463 proto_tree *subtree;
1464 uint16_t driver_extra;
1465 int16_t print_quality;
1466 uint32_t fields;
1467 int struct_start = offset;
1469 if (di->conformant_run)
1470 return offset;
1472 subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_DEVMODE, &item, "Devicemode");
1474 offset = dissect_ndr_uint32(
1475 tvb, offset, pinfo, subtree, di, drep, hf_devmode_size,
1476 NULL);
1478 /* The device name is stored in a 32-wchar buffer */
1480 dissect_spoolss_uint16uni(tvb, offset, pinfo, subtree, drep, NULL, hf_devmode_devicename);
1481 offset += 64;
1483 offset = dissect_ndr_uint16(
1484 tvb, offset, pinfo, subtree, di, drep,
1485 hf_devmode_spec_version, NULL);
1487 offset = dissect_ndr_uint16(
1488 tvb, offset, pinfo, subtree, di, drep,
1489 hf_devmode_driver_version, NULL);
1491 offset = dissect_ndr_uint16(
1492 tvb, offset, pinfo, subtree, di, drep,
1493 hf_devmode_size2, NULL);
1495 offset = dissect_ndr_uint16(
1496 tvb, offset, pinfo, subtree, di, drep,
1497 hf_devmode_driver_extra_len, &driver_extra);
1499 offset = dissect_DEVMODE_fields(
1500 tvb, offset, pinfo, subtree, di, drep, &fields);
1502 offset = dissect_ndr_uint16(
1503 tvb, offset, pinfo, subtree, di, drep,
1504 hf_devmode_orientation, NULL);
1506 offset = dissect_ndr_uint16(
1507 tvb, offset, pinfo, subtree, di, drep,
1508 hf_devmode_paper_size, NULL);
1510 offset = dissect_ndr_uint16(
1511 tvb, offset, pinfo, subtree, di, drep,
1512 hf_devmode_paper_length, NULL);
1514 offset = dissect_ndr_uint16(
1515 tvb, offset, pinfo, subtree, di, drep,
1516 hf_devmode_paper_width, NULL);
1518 offset = dissect_ndr_uint16(
1519 tvb, offset, pinfo, subtree, di, drep,
1520 hf_devmode_scale, NULL);
1522 offset = dissect_ndr_uint16(
1523 tvb, offset, pinfo, subtree, di, drep,
1524 hf_devmode_copies, NULL);
1526 offset = dissect_ndr_uint16(
1527 tvb, offset, pinfo, subtree, di, drep,
1528 hf_devmode_default_source, NULL);
1530 offset = dissect_ndr_uint16(
1531 tvb, offset, pinfo, NULL, di, drep,
1532 hf_devmode_print_quality, &print_quality);
1534 if (print_quality < 0)
1535 proto_tree_add_item(
1536 subtree, hf_devmode_print_quality, tvb,
1537 offset - 2, 2, DREP_ENC_INTEGER(drep));
1538 else
1539 proto_tree_add_uint_format_value(
1540 subtree, hf_devmode_print_quality, tvb, offset - 4, 4,
1541 print_quality, "%d dpi", print_quality);
1543 offset = dissect_ndr_uint16(
1544 tvb, offset, pinfo, subtree, di, drep,
1545 hf_devmode_color, NULL);
1547 offset = dissect_ndr_uint16(
1548 tvb, offset, pinfo, subtree, di, drep,
1549 hf_devmode_duplex, NULL);
1551 offset = dissect_ndr_uint16(
1552 tvb, offset, pinfo, subtree, di, drep,
1553 hf_devmode_y_resolution, NULL);
1555 offset = dissect_ndr_uint16(
1556 tvb, offset, pinfo, subtree, di, drep,
1557 hf_devmode_tt_option, NULL);
1559 offset = dissect_ndr_uint16(
1560 tvb, offset, pinfo, subtree, di, drep,
1561 hf_devmode_collate, NULL);
1563 dissect_spoolss_uint16uni(tvb, offset, pinfo, subtree, drep, NULL, hf_devmode_form_name);
1564 offset += 64;
1566 offset = dissect_ndr_uint16(
1567 tvb, offset, pinfo, subtree, di, drep,
1568 hf_devmode_log_pixels, NULL);
1570 offset = dissect_ndr_uint32(
1571 tvb, offset, pinfo, subtree, di, drep,
1572 hf_devmode_bits_per_pel, NULL);
1574 offset = dissect_ndr_uint32(
1575 tvb, offset, pinfo, subtree, di, drep,
1576 hf_devmode_pels_width, NULL);
1578 offset = dissect_ndr_uint32(
1579 tvb, offset, pinfo, subtree, di, drep,
1580 hf_devmode_pels_height, NULL);
1582 offset = dissect_ndr_uint32(
1583 tvb, offset, pinfo, subtree, di, drep,
1584 hf_devmode_display_flags, NULL);
1586 offset = dissect_ndr_uint32(
1587 tvb, offset, pinfo, subtree, di, drep,
1588 hf_devmode_display_freq, NULL);
1590 /* TODO: Some of the remaining fields are optional. See
1591 rpc_parse/parse_spoolss.c in the Samba source for details. */
1593 offset = dissect_ndr_uint32(
1594 tvb, offset, pinfo, subtree, di, drep,
1595 hf_devmode_icm_method, NULL);
1597 offset = dissect_ndr_uint32(
1598 tvb, offset, pinfo, subtree, di, drep,
1599 hf_devmode_icm_intent, NULL);
1601 offset = dissect_ndr_uint32(
1602 tvb, offset, pinfo, subtree, di, drep,
1603 hf_devmode_media_type, NULL);
1605 offset = dissect_ndr_uint32(
1606 tvb, offset, pinfo, subtree, di, drep,
1607 hf_devmode_dither_type, NULL);
1609 offset = dissect_ndr_uint32(
1610 tvb, offset, pinfo, subtree, di, drep,
1611 hf_devmode_reserved1, NULL);
1613 offset = dissect_ndr_uint32(
1614 tvb, offset, pinfo, subtree, di, drep,
1615 hf_devmode_reserved2, NULL);
1617 offset = dissect_ndr_uint32(
1618 tvb, offset, pinfo, subtree, di, drep,
1619 hf_devmode_panning_width, NULL);
1621 offset = dissect_ndr_uint32(
1622 tvb, offset, pinfo, subtree, di, drep,
1623 hf_devmode_panning_height, NULL);
1625 if (driver_extra)
1626 offset = dissect_ndr_uint8s(
1627 tvb, offset, pinfo, subtree, di, drep,
1628 hf_devmode_driver_extra, driver_extra, NULL);
1630 proto_item_set_len(item, offset - struct_start);
1632 return offset;
1636 * DEVMODE_CTR
1639 static int ett_DEVMODE_CTR;
1642 dissect_DEVMODE_CTR(tvbuff_t *tvb, int offset, packet_info *pinfo,
1643 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
1645 proto_tree *subtree;
1646 uint32_t size;
1648 subtree = proto_tree_add_subtree(
1649 tree, tvb, offset, 0, ett_DEVMODE_CTR, NULL, "Devicemode container");
1651 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
1652 hf_devmodectr_size, &size);
1654 offset = dissect_ndr_pointer(
1655 tvb, offset, pinfo, subtree, di, drep,
1656 dissect_DEVMODE, NDR_POINTER_UNIQUE, "Devicemode", -1);
1658 return offset;
1662 * Relative string given by offset into the current buffer. Note that
1663 * the offset for subsequent relstrs are against the structure start, not
1664 * the point where the offset is parsed from.
1667 static int ett_RELSTR;
1669 static int
1670 dissect_spoolss_relstr(tvbuff_t *tvb, int offset, packet_info *pinfo,
1671 proto_tree *tree, dcerpc_info *di, uint8_t *drep, int hf_index,
1672 int struct_start, char **data)
1674 proto_item *item;
1675 proto_tree *subtree;
1676 uint32_t relstr_offset, relstr_start, relstr_end;
1677 char *text;
1679 /* Peek ahead to read the string. We need this for the
1680 proto_tree_add_string() call so filtering will work. */
1682 offset = dissect_ndr_uint32(
1683 tvb, offset, pinfo, NULL, di, drep, hf_offset, &relstr_offset);
1685 relstr_start = relstr_offset + struct_start;
1687 if (relstr_offset) {
1688 relstr_end = dissect_spoolss_uint16uni(
1689 tvb, relstr_start, pinfo, NULL, drep, &text, hf_relative_string);
1690 } else { /* relstr_offset == 0 is a NULL string */
1691 text = wmem_strdup(pinfo->pool, "");
1692 relstr_end = relstr_start;
1695 /* OK now add the proto item with the string value */
1697 item = proto_tree_add_string(tree, hf_index, tvb, relstr_start, relstr_end - relstr_start, text);
1698 subtree = proto_item_add_subtree(item, ett_RELSTR);
1700 dissect_ndr_uint32(
1701 tvb, offset - 4, pinfo, subtree, di, drep, hf_offset, NULL);
1703 if (relstr_offset)
1704 dissect_spoolss_uint16uni(
1705 tvb, relstr_start, pinfo, subtree, drep, NULL, hf_relative_string);
1707 if (data)
1708 *data = text;
1710 return offset;
1713 /* An array of relative strings. This is currently just a copy of the
1714 dissect_spoolss_relstr() function as I can't find an example driver that
1715 has more than one dependent file. */
1717 static int ett_RELSTR_ARRAY;
1719 static int
1720 dissect_spoolss_relstrarray(tvbuff_t *tvb, int offset, packet_info *pinfo,
1721 proto_tree *tree, dcerpc_info *di, uint8_t *drep, int hf_index,
1722 int struct_start, char **data)
1724 proto_item *item;
1725 proto_tree *subtree;
1726 uint32_t relstr_offset, relstr_start/*, relstr_end, relstr_len*/;
1727 char *text;
1729 item = proto_tree_add_string(tree, hf_index, tvb, offset, 4, "");
1731 subtree = proto_item_add_subtree(item, ett_RELSTR_ARRAY);
1733 offset = dissect_ndr_uint32(
1734 tvb, offset, pinfo, subtree, di, drep, hf_offset, &relstr_offset);
1736 /* A relative offset of zero is a NULL string */
1738 relstr_start = relstr_offset + struct_start;
1740 if (relstr_offset)
1741 /*relstr_end = */dissect_spoolss_uint16uni(
1742 tvb, relstr_start, pinfo, subtree, drep, &text, hf_relative_string);
1743 else {
1744 text = wmem_strdup(pinfo->pool, "NULL");
1745 /*relstr_end = offset;*/
1748 /*relstr_len = relstr_end - relstr_start;*/
1750 proto_item_append_text(item, "%s", text);
1752 if (data)
1753 *data = text;
1755 return offset;
1759 * PRINTER_INFO_0
1762 static int hf_printer_status;
1764 static const value_string printer_status_vals[] =
1766 { PRINTER_STATUS_OK, "OK" },
1767 { PRINTER_STATUS_PAUSED, "Paused" },
1768 { PRINTER_STATUS_ERROR, "Error" },
1769 { PRINTER_STATUS_PENDING_DELETION, "Pending deletion" },
1770 { PRINTER_STATUS_PAPER_JAM, "Paper jam" },
1771 { PRINTER_STATUS_PAPER_OUT, "Paper out" },
1772 { PRINTER_STATUS_MANUAL_FEED, "Manual feed" },
1773 { PRINTER_STATUS_PAPER_PROBLEM, "Paper problem" },
1774 { PRINTER_STATUS_OFFLINE, "Offline" },
1775 { PRINTER_STATUS_IO_ACTIVE, "IO active" },
1776 { PRINTER_STATUS_BUSY, "Busy" },
1777 { PRINTER_STATUS_PRINTING, "Printing" },
1778 { PRINTER_STATUS_OUTPUT_BIN_FULL, "Output bin full" },
1779 { PRINTER_STATUS_NOT_AVAILABLE, "Not available" },
1780 { PRINTER_STATUS_WAITING, "Waiting" },
1781 { PRINTER_STATUS_PROCESSING, "Processing" },
1782 { PRINTER_STATUS_INITIALIZING, "Initialising" },
1783 { PRINTER_STATUS_WARMING_UP, "Warming up" },
1784 { PRINTER_STATUS_TONER_LOW, "Toner low" },
1785 { PRINTER_STATUS_NO_TONER, "No toner" },
1786 { PRINTER_STATUS_PAGE_PUNT, "Page punt" },
1787 { PRINTER_STATUS_USER_INTERVENTION, "User intervention" },
1788 { PRINTER_STATUS_OUT_OF_MEMORY, "Out of memory" },
1789 { PRINTER_STATUS_DOOR_OPEN, "Door open" },
1790 { PRINTER_STATUS_SERVER_UNKNOWN, "Server unknown" },
1791 { PRINTER_STATUS_POWER_SAVE, "Power save" },
1792 { 0, NULL }
1794 static value_string_ext printer_status_vals_ext = VALUE_STRING_EXT_INIT(printer_status_vals);
1796 static int ett_PRINTER_INFO_0;
1798 static int
1799 dissect_PRINTER_INFO_0(tvbuff_t *tvb, int offset,
1800 packet_info *pinfo, proto_tree *tree,
1801 dcerpc_info *di, uint8_t *drep)
1803 offset = dissect_spoolss_relstr(
1804 tvb, offset, pinfo, tree, di, drep, hf_printername,
1805 0, NULL);
1807 offset = dissect_spoolss_relstr(
1808 tvb, offset, pinfo, tree, di, drep, hf_servername,
1809 0, NULL);
1811 offset = dissect_ndr_uint32(
1812 tvb, offset, pinfo, tree, di, drep, hf_printer_cjobs, NULL);
1814 offset = dissect_ndr_uint32(
1815 tvb, offset, pinfo, tree, di, drep, hf_printer_total_jobs,
1816 NULL);
1818 offset = dissect_ndr_uint32(
1819 tvb, offset, pinfo, tree, di, drep, hf_printer_total_bytes,
1820 NULL);
1822 offset = dissect_SYSTEM_TIME(
1823 tvb, offset, pinfo, tree, di, drep, "Unknown time", true, NULL);
1825 offset = dissect_ndr_uint32(
1826 tvb, offset, pinfo, tree, di, drep, hf_printer_global_counter,
1827 NULL);
1829 offset = dissect_ndr_uint32(
1830 tvb, offset, pinfo, tree, di, drep, hf_printer_total_pages,
1831 NULL);
1833 offset = dissect_ndr_uint16(
1834 tvb, offset, pinfo, tree, di, drep, hf_printer_major_version,
1835 NULL);
1837 offset = dissect_ndr_uint16(
1838 tvb, offset, pinfo, tree, di, drep, hf_printer_build_version,
1839 NULL);
1841 offset = dissect_ndr_uint32(
1842 tvb, offset, pinfo, tree, di, drep, hf_printer_unk7, NULL);
1844 offset = dissect_ndr_uint32(
1845 tvb, offset, pinfo, tree, di, drep, hf_printer_unk8, NULL);
1847 offset = dissect_ndr_uint32(
1848 tvb, offset, pinfo, tree, di, drep, hf_printer_unk9, NULL);
1850 offset = dissect_ndr_uint32(
1851 tvb, offset, pinfo, tree, di, drep, hf_printer_session_ctr,
1852 NULL);
1854 offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep,
1855 hf_printer_unk11, NULL);
1857 offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep,
1858 hf_printer_printer_errors, NULL);
1860 offset = dissect_ndr_uint32(
1861 tvb, offset, pinfo, tree, di, drep, hf_printer_unk13, NULL);
1863 offset = dissect_ndr_uint32(
1864 tvb, offset, pinfo, tree, di, drep, hf_printer_unk14, NULL);
1866 offset = dissect_ndr_uint32(
1867 tvb, offset, pinfo, tree, di, drep, hf_printer_unk15, NULL);
1869 offset = dissect_ndr_uint32(
1870 tvb, offset, pinfo, tree, di, drep, hf_printer_unk16, NULL);
1872 offset = dissect_ndr_uint32(
1873 tvb, offset, pinfo, tree, di, drep, hf_printer_changeid, NULL);
1875 offset = dissect_ndr_uint32(
1876 tvb, offset, pinfo, tree, di, drep, hf_printer_unk18, NULL);
1878 offset = dissect_ndr_uint32(
1879 tvb, offset, pinfo, tree, di, drep, hf_printer_status, NULL);
1881 offset = dissect_ndr_uint32(
1882 tvb, offset, pinfo, tree, di, drep, hf_printer_unk20, NULL);
1884 offset = dissect_ndr_uint32(
1885 tvb, offset, pinfo, tree, di, drep, hf_printer_c_setprinter,
1886 NULL);
1888 offset = dissect_ndr_uint16(
1889 tvb, offset, pinfo, tree, di, drep, hf_printer_unk22, NULL);
1891 offset = dissect_ndr_uint16(
1892 tvb, offset, pinfo, tree, di, drep, hf_printer_unk23, NULL);
1894 offset = dissect_ndr_uint16(
1895 tvb, offset, pinfo, tree, di, drep, hf_printer_unk24, NULL);
1897 offset = dissect_ndr_uint16(
1898 tvb, offset, pinfo, tree, di, drep, hf_printer_unk25, NULL);
1900 offset = dissect_ndr_uint16(
1901 tvb, offset, pinfo, tree, di, drep, hf_printer_unk26, NULL);
1903 offset = dissect_ndr_uint16(
1904 tvb, offset, pinfo, tree, di, drep, hf_printer_unk27, NULL);
1906 offset = dissect_ndr_uint16(
1907 tvb, offset, pinfo, tree, di, drep, hf_printer_unk28, NULL);
1909 offset = dissect_ndr_uint16(
1910 tvb, offset, pinfo, tree, di, drep, hf_printer_unk29, NULL);
1912 return offset;
1916 * PRINTER_INFO_1
1919 static int ett_PRINTER_INFO_1;
1921 static int
1922 dissect_PRINTER_INFO_1(tvbuff_t *tvb, int offset,
1923 packet_info *pinfo, proto_tree *tree,
1924 dcerpc_info *di, uint8_t *drep)
1926 offset = dissect_ndr_uint32(
1927 tvb, offset, pinfo, tree, di, drep,
1928 hf_printer_flags, NULL);
1930 offset = dissect_spoolss_relstr(
1931 tvb, offset, pinfo, tree, di, drep, hf_printerdesc,
1932 0, NULL);
1934 offset = dissect_spoolss_relstr(
1935 tvb, offset, pinfo, tree, di, drep, hf_printername,
1936 0, NULL);
1938 offset = dissect_spoolss_relstr(
1939 tvb, offset, pinfo, tree, di, drep, hf_printercomment,
1940 0, NULL);
1942 return offset;
1945 /* Job status */
1947 static const true_false_string tfs_job_status_paused = {
1948 "Job is paused",
1949 "Job is not paused"
1952 static const true_false_string tfs_job_status_error = {
1953 "Job has an error",
1954 "Job is OK"
1957 static const true_false_string tfs_job_status_deleting = {
1958 "Job is being deleted",
1959 "Job is not being deleted"
1962 static const true_false_string tfs_job_status_spooling = {
1963 "Job is being spooled",
1964 "Job is not being spooled"
1967 static const true_false_string tfs_job_status_printing = {
1968 "Job is being printed",
1969 "Job is not being printed"
1972 static const true_false_string tfs_job_status_offline = {
1973 "Job is offline",
1974 "Job is not offline"
1977 static const true_false_string tfs_job_status_paperout = {
1978 "Job is out of paper",
1979 "Job is not out of paper"
1982 static const true_false_string tfs_job_status_printed = {
1983 "Job has completed printing",
1984 "Job has not completed printing"
1987 static const true_false_string tfs_job_status_deleted = {
1988 "Job has been deleted",
1989 "Job has not been deleted"
1992 static const true_false_string tfs_job_status_blocked = {
1993 "Job has been blocked",
1994 "Job has not been blocked"
1997 static const true_false_string tfs_job_status_user_intervention = {
1998 "User intervention required",
1999 "User intervention not required"
2002 static int ett_job_status;
2004 static int
2005 dissect_job_status(tvbuff_t *tvb, int offset, packet_info *pinfo,
2006 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
2008 uint32_t status;
2009 static int * const hf_status[] = {
2010 &hf_job_status_user_intervention,
2011 &hf_job_status_blocked,
2012 &hf_job_status_deleted,
2013 &hf_job_status_printed,
2014 &hf_job_status_paperout,
2015 &hf_job_status_offline,
2016 &hf_job_status_printing,
2017 &hf_job_status_spooling,
2018 &hf_job_status_deleting,
2019 &hf_job_status_error,
2020 &hf_job_status_paused,
2021 NULL
2024 offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, di, drep, -1, &status);
2026 proto_tree_add_bitmask_value_with_flags(tree, tvb, offset - 4, hf_job_status,
2027 ett_job_status, hf_status, status, BMT_NO_APPEND);
2029 return offset;
2032 /* Printer attributes */
2034 static int ett_printer_attributes;
2036 static int hf_printer_attributes;
2037 static int hf_printer_attributes_queued;
2038 static int hf_printer_attributes_direct;
2039 static int hf_printer_attributes_default;
2040 static int hf_printer_attributes_shared;
2041 static int hf_printer_attributes_network;
2042 static int hf_printer_attributes_hidden;
2043 static int hf_printer_attributes_local;
2044 static int hf_printer_attributes_enable_devq;
2045 static int hf_printer_attributes_keep_printed_jobs;
2046 static int hf_printer_attributes_do_complete_first;
2047 static int hf_printer_attributes_work_offline;
2048 static int hf_printer_attributes_enable_bidi;
2049 static int hf_printer_attributes_raw_only;
2050 static int hf_printer_attributes_published;
2052 static const true_false_string tfs_printer_attributes_queued = {
2053 "The printer starts printing after last page spooled",
2054 "The printer starts printing while spooling"
2057 static const true_false_string tfs_printer_attributes_direct = {
2058 "Jobs are sent directly to the printer",
2059 "Jobs are spooled to the printer before printing"
2062 static const true_false_string tfs_printer_attributes_default = {
2063 "The printer is the default printer",
2064 "The printer is not the default printer"
2067 static const true_false_string tfs_printer_attributes_shared = {
2068 "The printer is shared",
2069 "The printer is not shared"
2072 static const true_false_string tfs_printer_attributes_network = {
2073 "The printer is a network printer connection",
2074 "The printer is not a network printer connection"
2077 static const true_false_string tfs_printer_attributes_hidden = {
2078 "The printer is hidden from some users on the network",
2079 "The printer is not hidden from some users on the network"
2082 static const true_false_string tfs_printer_attributes_local = {
2083 "The printer is a local printer",
2084 "The printer is not a local printer"
2087 static const true_false_string tfs_printer_attributes_enable_devq = {
2088 "The queue on the printer is enabled if available",
2089 "The queue on the printer is not enabled",
2092 static const true_false_string tfs_printer_attributes_keep_printed_jobs = {
2093 "Jobs are kept after they are printed",
2094 "Jobs are deleted after they are printed"
2097 static const true_false_string tfs_printer_attributes_do_complete_first = {
2098 "Jobs that have completed spooling are scheduled before still spooling jobs",
2099 "Jobs are scheduled in the order they start spooling"
2102 static const true_false_string tfs_printer_attributes_work_offline = {
2103 "The printer is currently connected",
2104 "The printer is currently not connected"
2107 static const true_false_string tfs_printer_attributes_enable_bidi = {
2108 "Bidirectional communications are supported",
2109 "Bidirectional communications are not supported"
2112 static const true_false_string tfs_printer_attributes_raw_only = {
2113 "Only raw data type print jobs can be spooled",
2114 "All data type print jobs can be spooled"
2117 static const true_false_string tfs_printer_attributes_published = {
2118 "The printer is published in the directory",
2119 "The printer is not published in the directory"
2122 static int
2123 dissect_printer_attributes(tvbuff_t *tvb, int offset, packet_info *pinfo,
2124 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
2126 uint32_t attributes;
2127 static int * const hf_attributes[] = {
2128 &hf_printer_attributes_published,
2129 &hf_printer_attributes_raw_only,
2130 &hf_printer_attributes_enable_bidi,
2131 &hf_printer_attributes_work_offline,
2132 &hf_printer_attributes_do_complete_first,
2133 &hf_printer_attributes_keep_printed_jobs,
2134 &hf_printer_attributes_enable_devq,
2135 &hf_printer_attributes_local,
2136 &hf_printer_attributes_hidden,
2137 &hf_printer_attributes_network,
2138 &hf_printer_attributes_shared,
2139 &hf_printer_attributes_default,
2140 &hf_printer_attributes_direct,
2141 &hf_printer_attributes_queued,
2142 NULL
2145 offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, di, drep, -1, &attributes);
2147 proto_tree_add_bitmask_value_with_flags(tree, tvb, offset - 4, hf_printer_attributes,
2148 ett_printer_attributes, hf_attributes, attributes, BMT_NO_APPEND);
2150 return offset;
2153 /* Printer Driver attributes */
2155 static int ett_printer_driver_attributes;
2157 static int hf_printer_driver_attributes;
2158 static int hf_printer_driver_attributes_package_aware;
2159 static int hf_printer_driver_attributes_xps;
2160 static int hf_printer_driver_attributes_sandbox_enabled;
2161 static int hf_printer_driver_attributes_class;
2162 static int hf_printer_driver_attributes_derived;
2163 static int hf_printer_driver_attributes_not_shareable;
2164 static int hf_printer_driver_attributes_category_fax;
2165 static int hf_printer_driver_attributes_category_file;
2166 static int hf_printer_driver_attributes_category_virtual;
2167 static int hf_printer_driver_attributes_category_service;
2168 static int hf_printer_driver_attributes_soft_reset_required;
2169 static int hf_printer_driver_attributes_category_3d;
2171 static const true_false_string tfs_printer_driver_attributes_package_aware = {
2172 "Printer Driver is package aware",
2173 "Printer Driver is not package aware"
2176 static const true_false_string tfs_printer_driver_attributes_xps = {
2177 "Printer Driver is XPS based",
2178 "Printer Driver is not XPS based"
2181 static const true_false_string tfs_printer_driver_attributes_sandbox_enabled = {
2182 "Printer Driver is sandbox enabled",
2183 "Printer Driver is not sandbox enabled"
2186 static const true_false_string tfs_printer_driver_attributes_class = {
2187 "Printer Driver is a Class Printer Driver",
2188 "Printer Driver is not a Class Printer Driver"
2191 static const true_false_string tfs_printer_driver_attributes_derived = {
2192 "Printer Driver is a derived Printer Driver",
2193 "Printer Driver is not a derived Printer Driver"
2196 static const true_false_string tfs_printer_driver_attributes_not_shareable = {
2197 "Printer Driver is a not a sharable Printer Driver",
2198 "Printer Driver is a shareable Printer Driver"
2201 static const true_false_string tfs_printer_driver_attributes_category_fax = {
2202 "Printer Driver is a Fax Printer Driver",
2203 "Printer Driver is not a Fax Printer Driver"
2206 static const true_false_string tfs_printer_driver_attributes_category_file = {
2207 "Printer Driver is a File Printer Driver",
2208 "Printer Driver is not a File Printer Driver"
2211 static const true_false_string tfs_printer_driver_attributes_category_virtual = {
2212 "Printer Driver is a Virtual Printer Driver",
2213 "Printer Driver is not a Virtual Printer Driver"
2216 static const true_false_string tfs_printer_driver_attributes_category_service = {
2217 "Printer Driver is a Service Printer Driver",
2218 "Printer Driver is not a Service Printer Driver"
2221 static const true_false_string tfs_printer_driver_attributes_soft_reset_required = {
2222 "Soft reset is required for this Printer Driver",
2223 "No soft reset is required for this Printer Driver"
2226 static const true_false_string tfs_printer_driver_attributes_category_3d = {
2227 "Printer Driver is a 3D Printer Driver",
2228 "Printer Driver is not a 3D Printer Driver"
2231 static int
2232 dissect_printer_driver_attributes(tvbuff_t *tvb, int offset, packet_info *pinfo,
2233 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
2235 uint32_t attributes;
2236 static int * const hf_attributes[] = {
2237 &hf_printer_driver_attributes_package_aware,
2238 &hf_printer_driver_attributes_xps,
2239 &hf_printer_driver_attributes_sandbox_enabled,
2240 &hf_printer_driver_attributes_class,
2241 &hf_printer_driver_attributes_derived,
2242 &hf_printer_driver_attributes_not_shareable,
2243 &hf_printer_driver_attributes_category_fax,
2244 &hf_printer_driver_attributes_category_file,
2245 &hf_printer_driver_attributes_category_virtual,
2246 &hf_printer_driver_attributes_category_service,
2247 &hf_printer_driver_attributes_soft_reset_required,
2248 &hf_printer_driver_attributes_category_3d,
2249 NULL
2252 offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, di, drep, -1, &attributes);
2254 proto_tree_add_bitmask_value_with_flags(tree, tvb, offset - 4, hf_printer_driver_attributes,
2255 ett_printer_driver_attributes, hf_attributes, attributes, BMT_NO_APPEND);
2257 return offset;
2262 * PRINTER_INFO_2
2265 static int ett_PRINTER_INFO_2;
2267 static int
2268 dissect_PRINTER_INFO_2(tvbuff_t *tvb, int offset,
2269 packet_info *pinfo, proto_tree *tree,
2270 dcerpc_info *di, uint8_t *drep)
2272 uint32_t devmode_offset, secdesc_offset;
2274 offset = dissect_spoolss_relstr(
2275 tvb, offset, pinfo, tree, di, drep, hf_servername,
2276 0, NULL);
2278 offset = dissect_spoolss_relstr(
2279 tvb, offset, pinfo, tree, di, drep, hf_printername,
2280 0, NULL);
2282 offset = dissect_spoolss_relstr(
2283 tvb, offset, pinfo, tree, di, drep, hf_sharename,
2284 0, NULL);
2286 offset = dissect_spoolss_relstr(
2287 tvb, offset, pinfo, tree, di, drep, hf_portname,
2288 0, NULL);
2290 offset = dissect_spoolss_relstr(
2291 tvb, offset, pinfo, tree, di, drep, hf_drivername,
2292 0, NULL);
2294 offset = dissect_spoolss_relstr(
2295 tvb, offset, pinfo, tree, di, drep, hf_printercomment,
2296 0, NULL);
2298 offset = dissect_spoolss_relstr(
2299 tvb, offset, pinfo, tree, di, drep, hf_printerlocation,
2300 0, NULL);
2302 offset = dissect_ndr_uint32(
2303 tvb, offset, pinfo, NULL, di, drep, hf_offset,
2304 &devmode_offset);
2306 dissect_DEVMODE(tvb, devmode_offset - 4, pinfo, tree, di, drep);
2308 offset = dissect_spoolss_relstr(
2309 tvb, offset, pinfo, tree, di, drep, hf_sepfile,
2310 0, NULL);
2312 offset = dissect_spoolss_relstr(
2313 tvb, offset, pinfo, tree, di, drep, hf_printprocessor,
2314 0, NULL);
2316 offset = dissect_spoolss_relstr(
2317 tvb, offset, pinfo, tree, di, drep, hf_datatype,
2318 0, NULL);
2320 offset = dissect_spoolss_relstr(
2321 tvb, offset, pinfo, tree, di, drep, hf_parameters,
2322 0, NULL);
2325 * XXX - what *is* the length of this security descriptor?
2326 * "prs_PRINTER_INFO_2()" is passed to "defer_ptr()", but
2327 * "defer_ptr" takes, as an argument, a function with a
2328 * different calling sequence from "prs_PRINTER_INFO_2()",
2329 * lacking the "len" argument, so that won't work.
2332 offset = dissect_ndr_uint32(
2333 tvb, offset, pinfo, NULL, di, drep, hf_offset,
2334 &secdesc_offset);
2336 dissect_nt_sec_desc(
2337 tvb, secdesc_offset, pinfo, tree, drep,
2338 false, -1,
2339 &spoolss_printer_access_mask_info);
2341 offset = dissect_printer_attributes(tvb, offset, pinfo, tree, di, drep);
2343 offset = dissect_ndr_uint32(
2344 tvb, offset, pinfo, NULL, di, drep, hf_printer_priority,
2345 NULL);
2347 offset = dissect_ndr_uint32(
2348 tvb, offset, pinfo, NULL, di, drep,
2349 hf_printer_default_priority, NULL);
2351 offset = dissect_ndr_uint32(
2352 tvb, offset, pinfo, NULL, di, drep, hf_start_time, NULL);
2354 offset = dissect_ndr_uint32(
2355 tvb, offset, pinfo, NULL, di, drep, hf_end_time, NULL);
2357 offset = dissect_ndr_uint32(
2358 tvb, offset, pinfo, tree, di, drep,
2359 hf_printer_status, NULL);
2361 offset = dissect_ndr_uint32(
2362 tvb, offset, pinfo, NULL, di, drep, hf_printer_jobs,
2363 NULL);
2365 offset = dissect_ndr_uint32(
2366 tvb, offset, pinfo, NULL, di, drep,
2367 hf_printer_averageppm, NULL);
2369 return offset;
2373 * PRINTER_INFO_3
2376 static int ett_PRINTER_INFO_3;
2378 static int
2379 dissect_PRINTER_INFO_3(tvbuff_t *tvb, int offset,
2380 packet_info *pinfo, proto_tree *tree,
2381 dcerpc_info *di, uint8_t *drep)
2383 offset = dissect_ndr_uint32(
2384 tvb, offset, pinfo, tree, di, drep,
2385 hf_printer_flags, NULL);
2387 offset = dissect_nt_sec_desc(
2388 tvb, offset, pinfo, tree, drep,
2389 false, -1,
2390 &spoolss_printer_access_mask_info);
2392 return offset;
2396 * PRINTER_INFO_5
2399 static int ett_PRINTER_INFO_5;
2401 static int
2402 dissect_PRINTER_INFO_5(tvbuff_t *tvb, int offset,
2403 packet_info *pinfo, proto_tree *tree,
2404 dcerpc_info *di, uint8_t *drep)
2406 offset = dissect_spoolss_relstr(
2407 tvb, offset, pinfo, tree, di, drep, hf_printername,
2408 0, NULL);
2410 offset = dissect_spoolss_relstr(
2411 tvb, offset, pinfo, tree, di, drep, hf_portname,
2412 0, NULL);
2414 offset = dissect_printer_attributes(tvb, offset, pinfo, tree, di, drep);
2416 offset = dissect_ndr_uint32(
2417 tvb, offset, pinfo, tree, di, drep,
2418 hf_device_not_selected_timeout, NULL);
2420 offset = dissect_ndr_uint32(
2421 tvb, offset, pinfo, tree, di, drep,
2422 hf_transmission_retry_timeout, NULL);
2424 return offset;
2429 * PRINTER_INFO_7
2432 static int ett_PRINTER_INFO_7;
2434 static const value_string getprinter_action_vals[] = {
2435 { DS_PUBLISH, "Publish" },
2436 { DS_UNPUBLISH, "Unpublish" },
2437 { DS_UPDATE, "Update" },
2438 { DS_PENDING, "Pending" },
2439 { DS_REPUBLISH, "Republish" },
2440 { 0, NULL }
2443 static int
2444 dissect_PRINTER_INFO_7(tvbuff_t *tvb, int offset,
2445 packet_info *pinfo, proto_tree *tree,
2446 dcerpc_info *di, uint8_t *drep)
2448 offset = dissect_spoolss_relstr(
2449 tvb, offset, pinfo, tree, di, drep, hf_printer_guid,
2450 0, NULL);
2452 offset = dissect_ndr_uint32(
2453 tvb, offset, pinfo, tree, di, drep,
2454 hf_printer_action, NULL);
2456 return offset;
2460 * PRINTER_DATATYPE structure
2463 static int ett_PRINTER_DATATYPE;
2465 static int
2466 dissect_PRINTER_DATATYPE(tvbuff_t *tvb, int offset,
2467 packet_info *pinfo, proto_tree *tree,
2468 dcerpc_info *di, uint8_t *drep)
2470 if (di->conformant_run)
2471 return offset;
2473 offset = dissect_ndr_cvstring(
2474 tvb, offset, pinfo, tree, di, drep, sizeof(uint16_t),
2475 hf_datatype, true, NULL);
2477 return offset;
2481 * USER_LEVEL_1 structure
2484 static int ett_USER_LEVEL_1;
2486 static int hf_userlevel_size;
2487 static int hf_userlevel_client;
2488 static int hf_userlevel_user;
2489 static int hf_userlevel_build;
2490 static int hf_userlevel_major;
2491 static int hf_userlevel_minor;
2492 static int hf_userlevel_processor;
2494 static int
2495 dissect_USER_LEVEL_1(tvbuff_t *tvb, int offset,
2496 packet_info *pinfo, proto_tree *tree,
2497 dcerpc_info *di, uint8_t *drep)
2499 uint32_t level;
2501 /* Guy has pointed out that this dissection looks wrong. In
2502 the wireshark output for a USER_LEVEL_1 it looks like the
2503 info level and container pointer are transposed. I'm not
2504 even sure this structure is a container. */
2506 offset = dissect_ndr_uint32(
2507 tvb, offset, pinfo, tree, di, drep, hf_level, &level);
2509 offset = dissect_ndr_uint32(
2510 tvb, offset, pinfo, tree, di, drep, hf_userlevel_size, NULL);
2512 offset = dissect_ndr_str_pointer_item(
2513 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE,
2514 "Client", hf_userlevel_client, 0);
2516 offset = dissect_ndr_str_pointer_item(
2517 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE,
2518 "User", hf_userlevel_user, 0);
2520 offset = dissect_ndr_uint32(
2521 tvb, offset, pinfo, tree, di, drep, hf_userlevel_build, NULL);
2523 offset = dissect_ndr_uint32(
2524 tvb, offset, pinfo, tree, di, drep, hf_userlevel_major, NULL);
2526 offset = dissect_ndr_uint32(
2527 tvb, offset, pinfo, tree, di, drep, hf_userlevel_minor, NULL);
2529 offset = dissect_ndr_uint32(
2530 tvb, offset, pinfo, tree, di, drep, hf_userlevel_processor, NULL);
2532 return offset;
2536 * USER_LEVEL_CTR structure
2539 static int ett_USER_LEVEL_CTR;
2542 dissect_USER_LEVEL_CTR(tvbuff_t *tvb, int offset,
2543 packet_info *pinfo, proto_tree *tree,
2544 dcerpc_info *di, uint8_t *drep)
2546 proto_tree *subtree;
2547 proto_item *item;
2548 uint32_t level;
2550 if (di->conformant_run)
2551 return offset;
2553 subtree = proto_tree_add_subtree(
2554 tree, tvb, offset, 0, ett_USER_LEVEL_CTR, &item, "User level container");
2556 offset = dissect_ndr_uint32(
2557 tvb, offset, pinfo, subtree, di, drep, hf_level, &level);
2559 switch(level) {
2560 case 1:
2561 offset = dissect_ndr_pointer(
2562 tvb, offset, pinfo, subtree, di, drep,
2563 dissect_USER_LEVEL_1, NDR_POINTER_UNIQUE,
2564 "User level 1", -1);
2565 break;
2566 default:
2567 expert_add_info_format(pinfo, item, &ei_level, "Info level %d not decoded", level);
2568 break;
2571 return offset;
2575 * SpoolssOpenPrinterEx
2578 static int
2579 SpoolssOpenPrinterEx_q(tvbuff_t *tvb, int offset,
2580 packet_info *pinfo, proto_tree *tree,
2581 dcerpc_info *di, uint8_t *drep)
2583 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
2584 char *name;
2586 /* Parse packet */
2588 dcv->private_data=NULL;
2589 offset = dissect_ndr_pointer_cb(
2590 tvb, offset, pinfo, tree, di, drep,
2591 dissect_ndr_wchar_cvstring, NDR_POINTER_UNIQUE,
2592 "Printer name", hf_printername, cb_wstr_postprocess,
2593 GINT_TO_POINTER(CB_STR_COL_INFO | CB_STR_SAVE | 1));
2594 name = (char *)dcv->private_data;
2596 /* OpenPrinterEx() stores the key/value in se_data */
2597 if(!pinfo->fd->visited){
2598 if(!dcv->se_data){
2599 dcv->se_data = wmem_strdup(wmem_file_scope(),
2600 name?name:"");
2604 offset = dissect_ndr_pointer(
2605 tvb, offset, pinfo, tree, di, drep,
2606 dissect_PRINTER_DATATYPE, NDR_POINTER_UNIQUE,
2607 "Printer datatype", -1);
2609 offset = dissect_DEVMODE_CTR(tvb, offset, pinfo, tree, di, drep);
2611 name=(char *)dcv->se_data;
2612 if (name) {
2613 if (name[0] == '\\' && name[1] == '\\')
2614 name += 2;
2616 /* Determine if we are opening a printer or a print server */
2618 if (strchr(name, '\\'))
2619 offset = dissect_nt_access_mask(
2620 tvb, offset, pinfo, tree, di, drep,
2621 hf_access_required,
2622 &spoolss_printer_access_mask_info, NULL);
2623 else
2624 offset = dissect_nt_access_mask(
2625 tvb, offset, pinfo, tree, di, drep,
2626 hf_access_required,
2627 &spoolss_printserver_access_mask_info, NULL);
2628 } else {
2630 /* We can't decide what type of object being opened */
2632 offset = dissect_nt_access_mask(
2633 tvb, offset, pinfo, tree, di, drep, hf_access_required,
2634 NULL, NULL);
2637 offset = dissect_USER_LEVEL_CTR(tvb, offset, pinfo, tree, di, drep);
2639 return offset;
2642 static int
2643 SpoolssOpenPrinterEx_r(tvbuff_t *tvb, int offset,
2644 packet_info *pinfo, proto_tree *tree,
2645 dcerpc_info *di, uint8_t *drep)
2647 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
2648 e_ctx_hnd policy_hnd;
2649 proto_item *hnd_item;
2650 uint32_t status;
2652 /* Parse packet */
2654 offset = dissect_nt_policy_hnd(
2655 tvb, offset, pinfo, tree, di, drep, hf_hnd, &policy_hnd, &hnd_item,
2656 PIDL_POLHND_OPEN);
2658 offset = dissect_doserror(
2659 tvb, offset, pinfo, tree, di, drep, hf_rc, &status);
2661 if( status == 0 ){
2662 const char *pol_name;
2664 if (dcv->se_data){
2665 pol_name = wmem_strdup_printf(pinfo->pool,
2666 "OpenPrinterEx(%s)", (char *)dcv->se_data);
2667 } else {
2668 pol_name = "Unknown OpenPrinterEx() handle";
2670 if(!pinfo->fd->visited){
2671 dcerpc_store_polhnd_name(&policy_hnd, pinfo, pol_name);
2674 if(hnd_item)
2675 proto_item_append_text(hnd_item, ": %s", pol_name);
2678 return offset;
2681 static const value_string printer_notify_option_data_vals[] = {
2682 { PRINTER_NOTIFY_SERVER_NAME, "Server name" },
2683 { PRINTER_NOTIFY_PRINTER_NAME, "Printer name" },
2684 { PRINTER_NOTIFY_SHARE_NAME, "Share name" },
2685 { PRINTER_NOTIFY_PORT_NAME, "Port name" },
2686 { PRINTER_NOTIFY_DRIVER_NAME, "Driver name" },
2687 { PRINTER_NOTIFY_COMMENT, "Comment" },
2688 { PRINTER_NOTIFY_LOCATION, "Location" },
2689 { PRINTER_NOTIFY_DEVMODE, "Devmode" },
2690 { PRINTER_NOTIFY_SEPFILE, "Sepfile" },
2691 { PRINTER_NOTIFY_PRINT_PROCESSOR, "Print processor" },
2692 { PRINTER_NOTIFY_PARAMETERS, "Parameters" },
2693 { PRINTER_NOTIFY_DATATYPE, "Datatype" },
2694 { PRINTER_NOTIFY_SECURITY_DESCRIPTOR, "Security descriptor" },
2695 { PRINTER_NOTIFY_ATTRIBUTES, "Attributes" },
2696 { PRINTER_NOTIFY_PRIORITY, "Priority" },
2697 { PRINTER_NOTIFY_DEFAULT_PRIORITY, "Default priority" },
2698 { PRINTER_NOTIFY_START_TIME, "Start time" },
2699 { PRINTER_NOTIFY_UNTIL_TIME, "Until time" },
2700 { PRINTER_NOTIFY_STATUS, "Status" },
2701 { PRINTER_NOTIFY_STATUS_STRING, "Status string" },
2702 { PRINTER_NOTIFY_CJOBS, "Cjobs" },
2703 { PRINTER_NOTIFY_AVERAGE_PPM, "Average PPM" },
2704 { PRINTER_NOTIFY_TOTAL_PAGES, "Total pages" },
2705 { PRINTER_NOTIFY_PAGES_PRINTED, "Pages printed" },
2706 { PRINTER_NOTIFY_TOTAL_BYTES, "Total bytes" },
2707 { PRINTER_NOTIFY_BYTES_PRINTED, "Bytes printed" },
2708 { 0, NULL}
2710 static value_string_ext printer_notify_option_data_vals_ext = VALUE_STRING_EXT_INIT(printer_notify_option_data_vals);
2712 static const value_string job_notify_option_data_vals[] = {
2713 { JOB_NOTIFY_PRINTER_NAME, "Printer name" },
2714 { JOB_NOTIFY_MACHINE_NAME, "Machine name" },
2715 { JOB_NOTIFY_PORT_NAME, "Port name" },
2716 { JOB_NOTIFY_USER_NAME, "User name" },
2717 { JOB_NOTIFY_NOTIFY_NAME, "Notify name" },
2718 { JOB_NOTIFY_DATATYPE, "Data type" },
2719 { JOB_NOTIFY_PRINT_PROCESSOR, "Print processor" },
2720 { JOB_NOTIFY_PARAMETERS, "Parameters" },
2721 { JOB_NOTIFY_DRIVER_NAME, "Driver name" },
2722 { JOB_NOTIFY_DEVMODE, "Devmode" },
2723 { JOB_NOTIFY_STATUS, "Status" },
2724 { JOB_NOTIFY_STATUS_STRING, "Status string" },
2725 { JOB_NOTIFY_SECURITY_DESCRIPTOR, "Security descriptor" },
2726 { JOB_NOTIFY_DOCUMENT, "Document" },
2727 { JOB_NOTIFY_PRIORITY, "Priority" },
2728 { JOB_NOTIFY_POSITION, "Position" },
2729 { JOB_NOTIFY_SUBMITTED, "Submitted" },
2730 { JOB_NOTIFY_START_TIME, "Start time" },
2731 { JOB_NOTIFY_UNTIL_TIME, "Until time" },
2732 { JOB_NOTIFY_TIME, "Time" },
2733 { JOB_NOTIFY_TOTAL_PAGES, "Total pages" },
2734 { JOB_NOTIFY_PAGES_PRINTED, "Pages printed" },
2735 { JOB_NOTIFY_TOTAL_BYTES, "Total bytes" },
2736 { JOB_NOTIFY_BYTES_PRINTED, "Bytes printed" },
2737 { 0, NULL}
2739 static value_string_ext job_notify_option_data_vals_ext = VALUE_STRING_EXT_INIT(job_notify_option_data_vals);
2741 static int
2742 dissect_notify_field(tvbuff_t *tvb, int offset, packet_info *pinfo,
2743 proto_tree *tree, dcerpc_info *di, uint8_t *drep, uint16_t type,
2744 uint16_t *data)
2746 uint16_t field;
2747 const char *str;
2749 offset = dissect_ndr_uint16(
2750 tvb, offset, pinfo, NULL, di, drep,
2751 hf_notify_field, &field);
2753 switch(type) {
2754 case PRINTER_NOTIFY_TYPE:
2755 str = val_to_str_ext_const(field, &printer_notify_option_data_vals_ext,
2756 "Unknown");
2757 break;
2758 case JOB_NOTIFY_TYPE:
2759 str = val_to_str_ext_const(field, &job_notify_option_data_vals_ext,
2760 "Unknown");
2761 break;
2762 default:
2763 str = "Unknown notify type";
2764 break;
2767 proto_tree_add_uint_format_value(tree, hf_notify_field, tvb, offset - 2, 2, field, "%s (%d)", str, field);
2769 if (data)
2770 *data = field;
2772 return offset;
2775 static int
2776 dissect_NOTIFY_OPTION_DATA(tvbuff_t *tvb, int offset, packet_info *pinfo,
2777 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
2779 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
2780 uint32_t count, i;
2781 uint16_t type;
2783 if (di->conformant_run)
2784 return offset;
2786 offset = dissect_ndr_uint32(
2787 tvb, offset, pinfo, tree, di, drep,
2788 hf_notify_option_data_count, &count);
2790 type = GPOINTER_TO_INT(dcv->private_data);
2792 for (i = 0; i < count; i++)
2793 offset = dissect_notify_field(
2794 tvb, offset, pinfo, tree, di, drep, type, NULL);
2796 return offset;
2799 static const value_string printer_notify_types[] =
2801 { PRINTER_NOTIFY_TYPE, "Printer notify" },
2802 { JOB_NOTIFY_TYPE, "Job notify" },
2803 { 0, NULL }
2806 static const
2807 char *notify_plural(int count)
2809 if (count == 1)
2810 return "notification";
2812 return "notifies";
2815 static int ett_NOTIFY_OPTION;
2817 static int
2818 dissect_NOTIFY_OPTION(tvbuff_t *tvb, int offset, packet_info *pinfo,
2819 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
2821 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
2822 proto_item *item;
2823 proto_tree *subtree;
2824 uint16_t type;
2825 uint32_t count;
2827 subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_NOTIFY_OPTION, &item, "Notify Option");
2829 offset = dissect_ndr_uint16(tvb, offset, pinfo, subtree, di, drep,
2830 hf_notify_option_type, &type);
2832 proto_item_append_text(
2833 item, ": %s", val_to_str(type, printer_notify_types,
2834 "Unknown (%d)"));
2836 offset = dissect_ndr_uint16(tvb, offset, pinfo, subtree, di, drep,
2837 hf_notify_option_reserved1, NULL);
2839 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
2840 hf_notify_option_reserved2, NULL);
2842 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
2843 hf_notify_option_reserved3, NULL);
2845 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
2846 hf_notify_option_count, &count);
2848 proto_item_append_text(
2849 item, ", %d %s", count, notify_plural(count));
2851 dcv->private_data = GINT_TO_POINTER((int)type);
2853 offset = dissect_ndr_pointer(
2854 tvb, offset, pinfo, subtree, di, drep,
2855 dissect_NOTIFY_OPTION_DATA, NDR_POINTER_UNIQUE,
2856 "Notify Option Data", -1);
2858 return offset;
2861 static int
2862 dissect_NOTIFY_OPTIONS_ARRAY(tvbuff_t *tvb, int offset,
2863 packet_info *pinfo, proto_tree *tree,
2864 dcerpc_info *di, uint8_t *drep)
2866 /* Why is a check for di->conformant_run not required here? */
2868 offset = dissect_ndr_ucarray(
2869 tvb, offset, pinfo, tree, di, drep, dissect_NOTIFY_OPTION);
2871 return offset;
2874 static int ett_notify_options_flags;
2876 static const true_false_string tfs_notify_options_flags_refresh = {
2877 "Data for all monitored fields is present",
2878 "Data for all monitored fields not present"
2881 static int
2882 dissect_notify_options_flags(tvbuff_t *tvb, int offset, packet_info *pinfo,
2883 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
2885 uint32_t flags;
2886 static int * const hf_flags[] = {
2887 &hf_notify_options_flags_refresh,
2888 NULL
2891 offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, di, drep, -1, &flags);
2893 proto_tree_add_bitmask_value_with_flags(tree, tvb, offset - 4, hf_notify_options_flags,
2894 ett_notify_options_flags, hf_flags, flags, BMT_NO_APPEND);
2896 return offset;
2900 dissect_NOTIFY_OPTIONS_ARRAY_CTR(tvbuff_t *tvb, int offset,
2901 packet_info *pinfo, proto_tree *tree,
2902 dcerpc_info *di, uint8_t *drep)
2904 if (di->conformant_run)
2905 return offset;
2907 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
2908 hf_notify_options_version, NULL);
2910 offset = dissect_notify_options_flags(tvb, offset, pinfo, tree, di, drep);
2912 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
2913 hf_notify_options_count, NULL);
2915 offset = dissect_ndr_pointer(
2916 tvb, offset, pinfo, tree, di, drep,
2917 dissect_NOTIFY_OPTIONS_ARRAY, NDR_POINTER_UNIQUE,
2918 "Notify Options Array", -1);
2920 return offset;
2924 * SpoolssRFFPCNEX
2927 static int ett_rffpcnex_flags;
2929 static int hf_rffpcnex_flags;
2930 static int hf_rffpcnex_options;
2932 static int hf_rffpcnex_flags_add_printer;
2933 static int hf_rffpcnex_flags_set_printer;
2934 static int hf_rffpcnex_flags_delete_printer;
2935 static int hf_rffpcnex_flags_failed_printer_connection;
2937 static const true_false_string tfs_rffpcnex_flags_add_printer = {
2938 "Notify on add printer",
2939 "Don't notify on add printer"
2942 static const true_false_string tfs_rffpcnex_flags_set_printer = {
2943 "Notify on set printer",
2944 "Don't notify on set printer"
2947 static const true_false_string tfs_rffpcnex_flags_delete_printer = {
2948 "Notify on delete printer",
2949 "Don't notify on delete printer"
2952 static const true_false_string tfs_rffpcnex_flags_failed_connection_printer = {
2953 "Notify on failed printer connection",
2954 "Don't notify on failed printer connection"
2957 static int hf_rffpcnex_flags_add_job;
2958 static int hf_rffpcnex_flags_set_job;
2959 static int hf_rffpcnex_flags_delete_job;
2960 static int hf_rffpcnex_flags_write_job;
2962 static const true_false_string tfs_rffpcnex_flags_add_job = {
2963 "Notify on add job",
2964 "Don't notify on add job"
2967 static const true_false_string tfs_rffpcnex_flags_set_job = {
2968 "Notify on set job",
2969 "Don't notify on set job"
2972 static const true_false_string tfs_rffpcnex_flags_delete_job = {
2973 "Notify on delete job",
2974 "Don't notify on delete job"
2977 static const true_false_string tfs_rffpcnex_flags_write_job = {
2978 "Notify on writejob",
2979 "Don't notify on write job"
2982 static int hf_rffpcnex_flags_add_form;
2983 static int hf_rffpcnex_flags_set_form;
2984 static int hf_rffpcnex_flags_delete_form;
2986 static const true_false_string tfs_rffpcnex_flags_add_form = {
2987 "Notify on add form",
2988 "Don't notify on add form"
2991 static const true_false_string tfs_rffpcnex_flags_set_form = {
2992 "Notify on set form",
2993 "Don't notify on set form"
2996 static const true_false_string tfs_rffpcnex_flags_delete_form = {
2997 "Notify on delete form",
2998 "Don't notify on delete form"
3001 static int hf_rffpcnex_flags_add_port;
3002 static int hf_rffpcnex_flags_configure_port;
3003 static int hf_rffpcnex_flags_delete_port;
3005 static const true_false_string tfs_rffpcnex_flags_add_port = {
3006 "Notify on add port",
3007 "Don't notify on add port"
3010 static const true_false_string tfs_rffpcnex_flags_configure_port = {
3011 "Notify on configure port",
3012 "Don't notify on configure port"
3015 static const true_false_string tfs_rffpcnex_flags_delete_port = {
3016 "Notify on delete port",
3017 "Don't notify on delete port"
3020 static int hf_rffpcnex_flags_add_print_processor;
3021 static int hf_rffpcnex_flags_delete_print_processor;
3023 static const true_false_string tfs_rffpcnex_flags_add_print_processor = {
3024 "Notify on add driver",
3025 "Don't notify on add driver"
3028 static const true_false_string tfs_rffpcnex_flags_delete_print_processor = {
3029 "Notify on add driver",
3030 "Don't notify on add driver"
3033 static int hf_rffpcnex_flags_add_driver;
3034 static int hf_rffpcnex_flags_set_driver;
3035 static int hf_rffpcnex_flags_delete_driver;
3037 static const true_false_string tfs_rffpcnex_flags_add_driver = {
3038 "Notify on add driver",
3039 "Don't notify on add driver"
3042 static const true_false_string tfs_rffpcnex_flags_set_driver = {
3043 "Notify on set driver",
3044 "Don't notify on set driver"
3047 static const true_false_string tfs_rffpcnex_flags_delete_driver = {
3048 "Notify on delete driver",
3049 "Don't notify on delete driver"
3052 static int hf_rffpcnex_flags_timeout;
3054 static const true_false_string tfs_rffpcnex_flags_timeout = {
3055 "Notify on timeout",
3056 "Don't notify on timeout"
3059 static int
3060 SpoolssRFFPCNEX_q(tvbuff_t *tvb, int offset,
3061 packet_info *pinfo, proto_tree *tree,
3062 dcerpc_info *di, uint8_t *drep)
3064 uint32_t flags;
3065 static int * const hf_flags[] = {
3066 &hf_rffpcnex_flags_timeout,
3067 &hf_rffpcnex_flags_delete_driver,
3068 &hf_rffpcnex_flags_set_driver,
3069 &hf_rffpcnex_flags_add_driver,
3070 &hf_rffpcnex_flags_delete_print_processor,
3071 &hf_rffpcnex_flags_add_print_processor,
3072 &hf_rffpcnex_flags_delete_port,
3073 &hf_rffpcnex_flags_configure_port,
3074 &hf_rffpcnex_flags_add_port,
3075 &hf_rffpcnex_flags_delete_form,
3076 &hf_rffpcnex_flags_set_form,
3077 &hf_rffpcnex_flags_add_form,
3078 &hf_rffpcnex_flags_write_job,
3079 &hf_rffpcnex_flags_delete_job,
3080 &hf_rffpcnex_flags_set_job,
3081 &hf_rffpcnex_flags_add_job,
3082 &hf_rffpcnex_flags_failed_printer_connection,
3083 &hf_rffpcnex_flags_delete_printer,
3084 &hf_rffpcnex_flags_set_printer,
3085 &hf_rffpcnex_flags_add_printer,
3086 NULL
3089 /* Parse packet */
3091 offset = dissect_nt_policy_hnd(
3092 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
3093 PIDL_POLHND_USE);
3095 offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, di, drep, -1, &flags);
3097 proto_tree_add_bitmask_value(tree, tvb, offset - 4, hf_rffpcnex_flags,
3098 ett_rffpcnex_flags, hf_flags, flags);
3100 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
3101 hf_rffpcnex_options, NULL);
3103 offset = dissect_ndr_str_pointer_item(
3104 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE,
3105 "Server", hf_servername, 0);
3107 offset = dissect_ndr_uint32(
3108 tvb, offset, pinfo, tree, di, drep, hf_printerlocal, NULL);
3110 offset = dissect_ndr_pointer(
3111 tvb, offset, pinfo, tree, di, drep,
3112 dissect_NOTIFY_OPTIONS_ARRAY_CTR, NDR_POINTER_UNIQUE,
3113 "Notify Options Container", -1);
3115 return offset;
3118 static int
3119 SpoolssRFFPCNEX_r(tvbuff_t *tvb, int offset,
3120 packet_info *pinfo, proto_tree *tree,
3121 dcerpc_info *di, uint8_t *drep)
3123 /* Parse packet */
3125 offset = dissect_doserror(
3126 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
3128 return offset;
3132 * SpoolssReplyOpenPrinter
3135 static int
3136 SpoolssReplyOpenPrinter_q(tvbuff_t *tvb, int offset,
3137 packet_info *pinfo, proto_tree *tree,
3138 dcerpc_info *di, uint8_t *drep)
3140 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
3141 uint32_t printerlocal;
3142 char *name;
3144 /* Parse packet */
3145 name=NULL;
3146 offset = dissect_ndr_cvstring(
3147 tvb, offset, pinfo, tree, di, drep, sizeof(uint16_t),
3148 hf_servername, true, &name);
3149 /* ReplyOpenPrinter() stores the printername in se_data */
3150 if(!pinfo->fd->visited){
3151 if(!dcv->se_data){
3152 if(name){
3153 dcv->se_data = wmem_strdup(wmem_file_scope(), name);
3158 if (name)
3159 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", name);
3161 offset = dissect_ndr_uint32(
3162 tvb, offset, pinfo, tree, di, drep, hf_printerlocal,
3163 &printerlocal);
3165 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
3166 hf_printerdata_type, NULL);
3168 offset = dissect_ndr_uint32(
3169 tvb, offset, pinfo, tree, di, drep, hf_replyopenprinter_unk0,
3170 NULL);
3172 offset = dissect_ndr_uint32(
3173 tvb, offset, pinfo, tree, di, drep, hf_replyopenprinter_unk1,
3174 NULL);
3176 return offset;
3179 static int
3180 SpoolssReplyOpenPrinter_r(tvbuff_t *tvb, int offset,
3181 packet_info *pinfo, proto_tree *tree,
3182 dcerpc_info *di, uint8_t *drep)
3184 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
3185 e_ctx_hnd policy_hnd;
3186 proto_item *hnd_item;
3187 uint32_t status;
3189 /* Parse packet */
3191 offset = dissect_nt_policy_hnd(
3192 tvb, offset, pinfo, tree, di, drep, hf_hnd, &policy_hnd, &hnd_item,
3193 PIDL_POLHND_OPEN);
3195 offset = dissect_doserror(
3196 tvb, offset, pinfo, tree, di, drep, hf_rc, &status);
3198 if( status == 0 ){
3199 const char *pol_name;
3201 if (dcv->se_data){
3202 pol_name = wmem_strdup_printf(pinfo->pool,
3203 "ReplyOpenPrinter(%s)", (char *)dcv->se_data);
3204 } else {
3205 pol_name = "Unknown ReplyOpenPrinter() handle";
3207 if(!pinfo->fd->visited){
3208 dcerpc_store_polhnd_name(&policy_hnd, pinfo, pol_name);
3211 if(hnd_item)
3212 proto_item_append_text(hnd_item, ": %s", pol_name);
3215 return offset;
3219 * SpoolssGetPrinter
3223 static int
3224 SpoolssGetPrinter_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
3225 proto_tree *tree, dcerpc_info *di, uint8_t *drep )
3227 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
3228 uint32_t level;
3230 /* Parse packet */
3232 offset = dissect_nt_policy_hnd(
3233 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
3234 PIDL_POLHND_USE);
3236 offset = dissect_ndr_uint32(
3237 tvb, offset, pinfo, tree, di, drep, hf_level, &level);
3239 /* GetPrinter() stores the level in se_data */
3240 if(!pinfo->fd->visited){
3241 dcv->se_data = GINT_TO_POINTER((int)level);
3245 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
3247 offset = dissect_spoolss_buffer(
3248 tvb, offset, pinfo, tree, di, drep, NULL);
3250 offset = dissect_ndr_uint32(
3251 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
3253 return offset;
3256 static int ett_PRINTER_INFO;
3258 static int
3259 SpoolssGetPrinter_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
3260 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
3262 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
3263 BUFFER buffer;
3264 int16_t level = GPOINTER_TO_INT(dcv->se_data);
3265 proto_item *item = NULL;
3266 proto_tree *subtree = NULL;
3268 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
3270 /* Parse packet */
3272 offset = dissect_spoolss_buffer(
3273 tvb, offset, pinfo, tree, di, drep, &buffer);
3275 if (buffer.tvb) {
3276 subtree = proto_tree_add_subtree_format( buffer.tree, buffer.tvb, 0, -1, ett_PRINTER_INFO, &item, "Print info level %d", level);
3278 switch(level) {
3279 case 0:
3280 dissect_PRINTER_INFO_0(
3281 buffer.tvb, 0, pinfo, subtree, di, drep);
3282 break;
3283 case 1:
3284 dissect_PRINTER_INFO_1(
3285 buffer.tvb, 0, pinfo, subtree, di, drep);
3286 break;
3287 case 2:
3288 dissect_PRINTER_INFO_2(
3289 buffer.tvb, 0, pinfo, subtree, di, drep);
3290 break;
3291 case 3:
3292 dissect_PRINTER_INFO_3(
3293 buffer.tvb, 0, pinfo, subtree, di, drep);
3294 break;
3295 case 5:
3296 dissect_PRINTER_INFO_5(
3297 buffer.tvb, 0, pinfo, subtree, di, drep);
3298 break;
3299 case 7:
3300 dissect_PRINTER_INFO_7(
3301 buffer.tvb, 0, pinfo, subtree, di, drep);
3302 break;
3303 default:
3304 expert_add_info(pinfo, item, &ei_printer_info_level);
3305 break;
3309 offset = dissect_ndr_uint32(
3310 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
3312 offset = dissect_doserror(
3313 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
3315 return offset;
3319 * SEC_DESC_BUF
3322 static int ett_SEC_DESC_BUF;
3324 static int hf_secdescbuf_maxlen;
3325 static int hf_secdescbuf_undoc;
3326 static int hf_secdescbuf_len;
3328 static int
3329 dissect_SEC_DESC_BUF(tvbuff_t *tvb, int offset, packet_info *pinfo,
3330 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
3332 proto_tree *subtree;
3333 uint32_t len;
3335 /* XXX: I think this is really a array of bytes which can be
3336 dissected using dissect_ndr_cvstring(). The dissected data
3337 can be passed to dissect_nt_sec_desc(). The problem is that
3338 dissect_nt_cvstring() passes back a char * where it really
3339 should pass back a tvb. */
3341 subtree = proto_tree_add_subtree(
3342 tree, tvb, offset, 0, ett_SEC_DESC_BUF, NULL, "Security descriptor buffer");
3344 offset = dissect_ndr_uint32(
3345 tvb, offset, pinfo, subtree, di, drep,
3346 hf_secdescbuf_maxlen, NULL);
3348 offset = dissect_ndr_uint32(
3349 tvb, offset, pinfo, subtree, di, drep,
3350 hf_secdescbuf_undoc, NULL);
3352 offset = dissect_ndr_uint32(
3353 tvb, offset, pinfo, subtree, di, drep,
3354 hf_secdescbuf_len, &len);
3356 dissect_nt_sec_desc(
3357 tvb, offset, pinfo, subtree, drep, true, len,
3358 &spoolss_printer_access_mask_info);
3360 offset += len;
3362 return offset;
3366 * SPOOL_PRINTER_INFO_LEVEL
3369 static int ett_SPOOL_PRINTER_INFO_LEVEL;
3371 /* spool printer info */
3373 static int hf_spool_printer_info_devmode_ptr;
3374 static int hf_spool_printer_info_secdesc_ptr;
3377 dissect_SPOOL_PRINTER_INFO(tvbuff_t *tvb, int offset, packet_info *pinfo,
3378 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
3380 proto_tree *subtree;
3381 uint32_t level;
3382 proto_tree *item;
3384 subtree = proto_tree_add_subtree(
3385 tree, tvb, offset, 0, ett_SPOOL_PRINTER_INFO_LEVEL, &item, "Spool printer info level");
3387 offset = dissect_ndr_uint32(
3388 tvb, offset, pinfo, subtree, di, drep, hf_level, &level);
3390 switch(level) {
3391 case 3: {
3392 uint32_t devmode_ptr, secdesc_ptr;
3394 /* I can't seem to get this working with the correct
3395 dissect_ndr_pointer() function so let's cheat and
3396 dissect the pointers by hand. )-: */
3398 offset = dissect_ndr_uint32(
3399 tvb, offset, pinfo, subtree, di, drep,
3400 hf_spool_printer_info_devmode_ptr,
3401 &devmode_ptr);
3403 offset = dissect_ndr_uint32(
3404 tvb, offset, pinfo, subtree, di, drep,
3405 hf_spool_printer_info_secdesc_ptr,
3406 &secdesc_ptr);
3408 if (devmode_ptr)
3409 offset = dissect_DEVMODE_CTR(
3410 tvb, offset, pinfo, subtree, di, drep);
3412 if (secdesc_ptr)
3413 offset = dissect_SEC_DESC_BUF(
3414 tvb, offset, pinfo, subtree, di, drep);
3416 break;
3418 case 2:
3419 default:
3420 expert_add_info_format(pinfo, item, &ei_spool_printer_info_level, "Unknown spool printer info level %d", level);
3421 break;
3424 return offset;
3428 * SpoolssSetPrinter
3431 static int hf_setprinter_cmd;
3433 static const value_string setprinter_cmd_vals[] = {
3434 { SPOOLSS_PRINTER_CONTROL_UNPAUSE, "Unpause" },
3435 { SPOOLSS_PRINTER_CONTROL_PAUSE, "Pause" },
3436 { SPOOLSS_PRINTER_CONTROL_RESUME, "Resume" },
3437 { SPOOLSS_PRINTER_CONTROL_PURGE, "Purge" },
3438 { SPOOLSS_PRINTER_CONTROL_SET_STATUS, "Set status" },
3439 { 0, NULL }
3442 static int
3443 SpoolssSetPrinter_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
3444 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
3446 uint32_t level;
3448 /* Parse packet */
3450 offset = dissect_nt_policy_hnd(
3451 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
3452 PIDL_POLHND_USE);
3454 offset = dissect_ndr_uint32(
3455 tvb, offset, pinfo, tree, di, drep, hf_level, &level);
3457 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
3459 offset = dissect_SPOOL_PRINTER_INFO(
3460 tvb, offset, pinfo, tree, di, drep);
3462 offset = dissect_ndr_uint32(
3463 tvb, offset, pinfo, tree, di, drep,
3464 hf_setprinter_cmd, NULL);
3466 return offset;
3469 static int
3470 SpoolssSetPrinter_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
3471 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
3473 /* Parse packet */
3475 offset = dissect_doserror(
3476 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
3478 return offset;
3482 * FORM_REL
3485 static const value_string form_type_vals[] =
3487 { SPOOLSS_FORM_USER, "User" },
3488 { SPOOLSS_FORM_BUILTIN, "Builtin" },
3489 { SPOOLSS_FORM_PRINTER, "Printer" },
3490 { 0, NULL }
3493 static int ett_FORM_REL;
3495 static int
3496 dissect_FORM_REL(tvbuff_t *tvb, int offset, packet_info *pinfo,
3497 proto_tree *tree, dcerpc_info *di, uint8_t *drep, int struct_start)
3499 proto_item *item;
3500 proto_tree *subtree;
3501 uint32_t flags;
3502 int item_start = offset;
3503 char *name = NULL;
3505 subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_FORM_REL, &item, "Form");
3507 offset = dissect_ndr_uint32(
3508 tvb, offset, pinfo, subtree, di, drep, hf_form_flags, &flags);
3510 offset = dissect_spoolss_relstr(
3511 tvb, offset, pinfo, subtree, di, drep, hf_form_name,
3512 struct_start, &name);
3514 if (name) {
3515 proto_item_append_text(item, ": %s", name);
3518 offset = dissect_ndr_uint32(
3519 tvb, offset, pinfo, subtree, di, drep,
3520 hf_form_width, NULL);
3522 offset = dissect_ndr_uint32(
3523 tvb, offset, pinfo, subtree, di, drep,
3524 hf_form_height, NULL);
3526 offset = dissect_ndr_uint32(
3527 tvb, offset, pinfo, subtree, di, drep,
3528 hf_form_left_margin, NULL);
3530 offset = dissect_ndr_uint32(
3531 tvb, offset, pinfo, subtree, di, drep,
3532 hf_form_top_margin, NULL);
3534 offset = dissect_ndr_uint32(
3535 tvb, offset, pinfo, subtree, di, drep,
3536 hf_form_horiz_len, NULL);
3538 offset = dissect_ndr_uint32(
3539 tvb, offset, pinfo, subtree, di, drep,
3540 hf_form_vert_len, NULL);
3542 proto_item_set_len(item, offset - item_start);
3544 return offset;
3548 * SpoolssEnumForms
3551 static int
3552 SpoolssEnumForms_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
3553 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
3555 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
3556 uint32_t level;
3557 proto_item *hidden_item;
3559 hidden_item = proto_tree_add_uint(
3560 tree, hf_form, tvb, offset, 0, 1);
3561 proto_item_set_hidden(hidden_item);
3563 /* Parse packet */
3565 offset = dissect_nt_policy_hnd(
3566 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
3567 PIDL_POLHND_USE);
3569 offset = dissect_ndr_uint32(
3570 tvb, offset, pinfo, tree, di, drep, hf_level, &level);
3572 /* EnumForms() stores the level in se_data */
3573 if(!pinfo->fd->visited){
3574 dcv->se_data = GINT_TO_POINTER((int)level);
3577 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
3579 offset = dissect_spoolss_buffer(
3580 tvb, offset, pinfo, tree, di, drep, NULL);
3582 offset = dissect_ndr_uint32(
3583 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
3585 return offset;
3588 static int
3589 SpoolssEnumForms_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
3590 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
3592 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
3593 BUFFER buffer;
3594 uint32_t level = GPOINTER_TO_UINT(dcv->se_data), i, count;
3595 int buffer_offset;
3596 proto_item *hidden_item;
3598 hidden_item = proto_tree_add_uint(
3599 tree, hf_form, tvb, offset, 0, 1);
3600 proto_item_set_hidden(hidden_item);
3602 /* Parse packet */
3604 offset = dissect_spoolss_buffer(
3605 tvb, offset, pinfo, tree, di, drep, &buffer);
3607 offset = dissect_ndr_uint32(
3608 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
3610 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
3612 offset = dissect_ndr_uint32(
3613 tvb, offset, pinfo, tree, di, drep, hf_enumforms_num, &count);
3615 /* Unfortunately this array isn't in NDR format so we can't
3616 use prs_array(). The other weird thing is the
3617 struct_start being inside the loop rather than outside.
3618 Very strange. */
3620 buffer_offset = 0;
3622 for (i = 0; i < count; i++) {
3623 int struct_start = buffer_offset;
3625 buffer_offset = dissect_FORM_REL(
3626 buffer.tvb, buffer_offset, pinfo, buffer.tree, di, drep,
3627 struct_start);
3630 offset = dissect_doserror(
3631 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
3633 return offset;
3637 * SpoolssDeletePrinter
3640 static int
3641 SpoolssDeletePrinter_q(tvbuff_t *tvb, int offset,
3642 packet_info *pinfo, proto_tree *tree,
3643 dcerpc_info *di, uint8_t *drep)
3645 /* Parse packet */
3647 offset = dissect_nt_policy_hnd(
3648 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
3649 PIDL_POLHND_USE);
3651 return offset;
3654 static int
3655 SpoolssDeletePrinter_r(tvbuff_t *tvb, int offset,
3656 packet_info *pinfo, proto_tree *tree,
3657 dcerpc_info *di, uint8_t *drep)
3659 /* Parse packet */
3661 offset = dissect_nt_policy_hnd(
3662 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
3663 PIDL_POLHND_USE);
3665 offset = dissect_doserror(
3666 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
3668 return offset;
3671 static int
3672 SpoolssAddPrinterEx_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
3673 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
3675 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
3676 e_ctx_hnd policy_hnd;
3677 proto_item *hnd_item;
3678 uint32_t status;
3680 /* Parse packet */
3682 offset = dissect_nt_policy_hnd(
3683 tvb, offset, pinfo, tree, di, drep, hf_hnd, &policy_hnd, &hnd_item,
3684 PIDL_POLHND_OPEN);
3686 offset = dissect_doserror(
3687 tvb, offset, pinfo, tree, di, drep, hf_rc, &status);
3689 if( status == 0 ){
3690 const char *pol_name;
3692 if (dcv->se_data){
3693 pol_name = wmem_strdup_printf(pinfo->pool,
3694 "AddPrinterEx(%s)", (char *)dcv->se_data);
3695 } else {
3696 pol_name = "Unknown AddPrinterEx() handle";
3698 if(!pinfo->fd->visited){
3699 dcerpc_store_polhnd_name(&policy_hnd, pinfo, pol_name);
3702 if(hnd_item)
3703 proto_item_append_text(hnd_item, ": %s", pol_name);
3706 return offset;
3710 * SpoolssEnumPrinterData
3713 static int hf_enumprinterdata_enumindex;
3714 static int hf_enumprinterdata_value_offered;
3715 static int hf_enumprinterdata_data_offered;
3716 static int hf_enumprinterdata_value_len;
3717 static int hf_enumprinterdata_value_needed;
3718 static int hf_enumprinterdata_data_needed;
3720 static int
3721 SpoolssEnumPrinterData_q(tvbuff_t *tvb, int offset,
3722 packet_info *pinfo, proto_tree *tree,
3723 dcerpc_info *di, uint8_t *drep)
3725 uint32_t ndx;
3726 proto_item *hidden_item;
3728 hidden_item = proto_tree_add_uint(
3729 tree, hf_printerdata, tvb, offset, 0, 1);
3730 proto_item_set_hidden(hidden_item);
3732 /* Parse packet */
3734 offset = dissect_nt_policy_hnd(
3735 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
3736 PIDL_POLHND_USE);
3738 offset = dissect_ndr_uint32(
3739 tvb, offset, pinfo, tree, di, drep,
3740 hf_enumprinterdata_enumindex, &ndx);
3742 col_append_fstr(pinfo->cinfo, COL_INFO, ", index %d", ndx);
3744 offset = dissect_ndr_uint32(
3745 tvb, offset, pinfo, tree, di, drep,
3746 hf_enumprinterdata_value_offered, NULL);
3748 offset = dissect_ndr_uint32(
3749 tvb, offset, pinfo, tree, di, drep,
3750 hf_enumprinterdata_data_offered, NULL);
3752 return offset;
3755 static int
3756 SpoolssEnumPrinterData_r(tvbuff_t *tvb, int offset,
3757 packet_info *pinfo, proto_tree *tree,
3758 dcerpc_info *di, uint8_t *drep)
3760 uint32_t value_len, type;
3761 char *value;
3762 proto_item *value_item;
3763 proto_tree *value_subtree;
3764 proto_item *hidden_item;
3766 hidden_item = proto_tree_add_uint(
3767 tree, hf_printerdata, tvb, offset, 0, 1);
3768 proto_item_set_hidden(hidden_item);
3770 /* Parse packet */
3772 value_subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_printerdata_value, &value_item, "Value");
3774 offset = dissect_ndr_uint32(
3775 tvb, offset, pinfo, value_subtree, di, drep,
3776 hf_enumprinterdata_value_len, &value_len);
3778 if (value_len) {
3779 dissect_spoolss_uint16uni(
3780 tvb, offset, pinfo, value_subtree, drep, &value, hf_value_name);
3782 offset += value_len * 2;
3784 if (value && value[0])
3785 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", value);
3787 proto_item_append_text(value_item, ": %s", value);
3789 hidden_item = proto_tree_add_string(
3790 tree, hf_printerdata_value, tvb, offset, 0, value);
3791 proto_item_set_hidden(hidden_item);
3794 proto_item_set_len(value_item, value_len * 2 + 4);
3796 offset = dissect_ndr_uint32(
3797 tvb, offset, pinfo, value_subtree, di, drep,
3798 hf_enumprinterdata_value_needed, NULL);
3800 offset = dissect_ndr_uint32(
3801 tvb, offset, pinfo, tree, di, drep, hf_printerdata_type, &type);
3803 offset = dissect_printerdata_data(
3804 tvb, offset, pinfo, tree, di, drep, type);
3806 offset = dissect_ndr_uint32(
3807 tvb, offset, pinfo, tree, di, drep,
3808 hf_enumprinterdata_data_needed, NULL);
3810 offset = dissect_doserror(
3811 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
3813 return offset;
3817 * SpoolssEnumPrinters
3820 static int ett_enumprinters_flags;
3822 static int hf_enumprinters_flags;
3823 static int hf_enumprinters_flags_local;
3824 static int hf_enumprinters_flags_name;
3825 static int hf_enumprinters_flags_shared;
3826 static int hf_enumprinters_flags_default;
3827 static int hf_enumprinters_flags_connections;
3828 static int hf_enumprinters_flags_network;
3829 static int hf_enumprinters_flags_remote;
3831 static int
3832 SpoolssEnumPrinters_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
3833 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
3835 uint32_t level, flags;
3836 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
3837 static int * const hf_flags[] = {
3838 &hf_enumprinters_flags_network,
3839 &hf_enumprinters_flags_shared,
3840 &hf_enumprinters_flags_remote,
3841 &hf_enumprinters_flags_name,
3842 &hf_enumprinters_flags_connections,
3843 &hf_enumprinters_flags_local,
3844 &hf_enumprinters_flags_default,
3845 NULL
3848 /* Parse packet */
3850 offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, di, drep, -1, &flags);
3852 proto_tree_add_bitmask_value(tree, tvb, offset - 4, hf_enumprinters_flags,
3853 ett_enumprinters_flags, hf_flags, flags);
3855 offset = dissect_ndr_str_pointer_item(
3856 tvb, offset, pinfo, tree, di, drep,
3857 NDR_POINTER_UNIQUE, "Server name", hf_servername, 0);
3859 offset = dissect_ndr_uint32(
3860 tvb, offset, pinfo, tree, di, drep, hf_level, &level);
3862 /* GetPrinter() stores the level in se_data */
3863 if(!pinfo->fd->visited){
3864 dcv->se_data = GINT_TO_POINTER((int)level);
3867 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
3869 offset = dissect_spoolss_buffer(
3870 tvb, offset, pinfo, tree, di, drep, NULL);
3872 offset = dissect_ndr_uint32(
3873 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
3875 return offset;
3878 static int
3879 SpoolssEnumPrinters_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
3880 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
3882 uint32_t num_drivers;
3883 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
3884 int16_t level = GPOINTER_TO_INT(dcv->se_data);
3885 BUFFER buffer;
3886 proto_item *item;
3887 proto_tree *subtree = NULL;
3889 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
3891 /* Parse packet */
3893 offset = dissect_spoolss_buffer(
3894 tvb, offset, pinfo, tree, di, drep, &buffer);
3896 if (buffer.tvb) {
3897 subtree = proto_tree_add_subtree_format( buffer.tree, buffer.tvb, 0, -1, ett_PRINTER_INFO, &item, "Print info level %d", level);
3899 switch(level) {
3900 case 0:
3901 dissect_PRINTER_INFO_0(
3902 buffer.tvb, 0, pinfo, subtree, di, drep);
3903 break;
3904 case 1:
3905 dissect_PRINTER_INFO_1(
3906 buffer.tvb, 0, pinfo, subtree, di, drep);
3907 break;
3908 case 2:
3909 dissect_PRINTER_INFO_2(
3910 buffer.tvb, 0, pinfo, subtree, di, drep);
3911 break;
3912 case 3:
3913 dissect_PRINTER_INFO_3(
3914 buffer.tvb, 0, pinfo, subtree, di, drep);
3915 break;
3916 case 5:
3917 dissect_PRINTER_INFO_5(
3918 buffer.tvb, 0, pinfo, subtree, di, drep);
3919 break;
3920 case 7:
3921 dissect_PRINTER_INFO_7(
3922 buffer.tvb, 0, pinfo, subtree, di, drep);
3923 break;
3924 default:
3925 expert_add_info(pinfo, item, &ei_printer_info_level);
3926 break;
3930 offset = dissect_ndr_uint32(
3931 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
3933 offset = dissect_ndr_uint32(
3934 tvb, offset, pinfo, tree, di, drep, hf_returned,
3935 &num_drivers);
3937 offset = dissect_doserror(
3938 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
3940 return offset;
3944 * AddPrinterDriver
3946 static int
3947 SpoolssAddPrinterDriver_r(tvbuff_t *tvb, int offset,
3948 packet_info *pinfo, proto_tree *tree,
3949 dcerpc_info *di, uint8_t *drep)
3951 /* Parse packet */
3953 offset = dissect_doserror(
3954 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
3956 return offset;
3960 * FORM_1
3963 static int ett_FORM_1;
3965 static int
3966 dissect_FORM_1(tvbuff_t *tvb, int offset, packet_info *pinfo,
3967 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
3969 proto_tree *subtree;
3970 uint32_t flags;
3972 subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_FORM_1, NULL, "Form level 1");
3974 offset = dissect_ndr_str_pointer_item(
3975 tvb, offset, pinfo, subtree, di, drep, NDR_POINTER_UNIQUE,
3976 "Name", hf_form_name, 0);
3978 /* Eek - we need to know whether this pointer was NULL or not.
3979 Currently there is not any way to do this. */
3981 if (tvb_reported_length_remaining(tvb, offset) <= 0)
3982 goto done;
3984 offset = dissect_ndr_uint32(
3985 tvb, offset, pinfo, subtree, di, drep, hf_form_flags, &flags);
3987 offset = dissect_ndr_uint32(
3988 tvb, offset, pinfo, subtree, di, drep,
3989 hf_form_unknown, NULL);
3991 offset = dissect_ndr_uint32(
3992 tvb, offset, pinfo, subtree, di, drep,
3993 hf_form_width, NULL);
3995 offset = dissect_ndr_uint32(
3996 tvb, offset, pinfo, subtree, di, drep,
3997 hf_form_height, NULL);
3999 offset = dissect_ndr_uint32(
4000 tvb, offset, pinfo, subtree, di, drep,
4001 hf_form_left_margin, NULL);
4003 offset = dissect_ndr_uint32(
4004 tvb, offset, pinfo, subtree, di, drep,
4005 hf_form_top_margin, NULL);
4007 offset = dissect_ndr_uint32(
4008 tvb, offset, pinfo, subtree, di, drep,
4009 hf_form_horiz_len, NULL);
4011 offset = dissect_ndr_uint32(
4012 tvb, offset, pinfo, subtree, di, drep,
4013 hf_form_vert_len, NULL);
4015 done:
4016 return offset;
4020 * FORM_CTR
4023 static int ett_FORM_CTR;
4026 dissect_FORM_CTR(tvbuff_t *tvb, int offset,
4027 packet_info *pinfo, proto_tree *tree,
4028 dcerpc_info *di, uint8_t *drep)
4030 proto_tree *subtree;
4031 proto_item *item;
4032 uint32_t level;
4034 subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_FORM_CTR, &item, "Form container");
4036 offset = dissect_ndr_uint32(
4037 tvb, offset, pinfo, subtree, di, drep, hf_form_level, &level);
4039 switch(level) {
4040 case 1:
4041 offset = dissect_FORM_1(tvb, offset, pinfo, subtree, di, drep);
4042 break;
4044 default:
4045 expert_add_info_format(pinfo, item, &ei_form_level, "Unknown form info level %d", level);
4046 break;
4049 return offset;
4053 * AddForm
4056 static int
4057 SpoolssAddForm_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
4058 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4060 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
4061 uint32_t level;
4062 proto_item *hidden_item;
4064 hidden_item = proto_tree_add_uint(
4065 tree, hf_form, tvb, offset, 0, 1);
4066 proto_item_set_hidden(hidden_item);
4068 /* Parse packet */
4070 offset = dissect_nt_policy_hnd(
4071 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
4072 PIDL_POLHND_USE);
4074 offset = dissect_ndr_uint32(
4075 tvb, offset, pinfo, tree, di, drep, hf_form_level, &level);
4077 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
4079 /* AddForm() stores the level in se_data */
4080 if(!pinfo->fd->visited){
4081 dcv->se_data = GUINT_TO_POINTER((int)level);
4084 offset = dissect_FORM_CTR(tvb, offset, pinfo, tree, di, drep);
4086 return offset;
4089 static int
4090 SpoolssAddForm_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
4091 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4093 proto_item *hidden_item;
4095 hidden_item = proto_tree_add_uint(
4096 tree, hf_form, tvb, offset, 0, 1);
4097 proto_item_set_hidden(hidden_item);
4099 /* Parse packet */
4101 offset = dissect_doserror(
4102 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
4104 return offset;
4108 * DeleteForm
4111 static int
4112 SpoolssDeleteForm_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
4113 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4115 proto_item *hidden_item;
4116 char *name = NULL;
4118 hidden_item = proto_tree_add_uint(
4119 tree, hf_form, tvb, offset, 0, 1);
4120 proto_item_set_hidden(hidden_item);
4122 /* Parse packet */
4124 offset = dissect_nt_policy_hnd(
4125 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
4126 PIDL_POLHND_USE);
4128 offset = dissect_ndr_cvstring(
4129 tvb, offset, pinfo, tree, di, drep,
4130 sizeof(uint16_t), hf_form_name, true, &name);
4132 if (name)
4133 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", name);
4135 return offset;
4138 static int
4139 SpoolssDeleteForm_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
4140 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4142 proto_item *hidden_item;
4144 hidden_item = proto_tree_add_uint(
4145 tree, hf_form, tvb, offset, 0, 1);
4146 proto_item_set_hidden(hidden_item);
4148 /* Parse packet */
4150 offset = dissect_doserror(
4151 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
4153 return offset;
4157 * SetForm
4160 static int
4161 SpoolssSetForm_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
4162 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4164 char *name = NULL;
4165 uint32_t level;
4166 proto_item *hidden_item;
4168 hidden_item = proto_tree_add_uint(
4169 tree, hf_form, tvb, offset, 0, 1);
4170 proto_item_set_hidden(hidden_item);
4172 /* Parse packet */
4174 offset = dissect_nt_policy_hnd(
4175 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
4176 PIDL_POLHND_USE);
4178 offset = dissect_ndr_cvstring(
4179 tvb, offset, pinfo, tree, di, drep,
4180 sizeof(uint16_t), hf_form_name, true, &name);
4182 if (name)
4183 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", name);
4185 offset = dissect_ndr_uint32(
4186 tvb, offset, pinfo, tree, di, drep, hf_form_level, &level);
4188 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
4190 offset = dissect_FORM_CTR(tvb, offset, pinfo, tree, di, drep);
4192 return offset;
4195 static int
4196 SpoolssSetForm_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
4197 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4199 proto_item *hidden_item;
4201 hidden_item = proto_tree_add_uint(
4202 tree, hf_form, tvb, offset, 0, 1);
4203 proto_item_set_hidden(hidden_item);
4205 /* Parse packet */
4207 offset = dissect_doserror(
4208 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
4210 return offset;
4214 * GetForm
4217 static int
4218 SpoolssGetForm_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
4219 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4221 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
4222 proto_item *hidden_item;
4223 uint32_t level;
4224 char *name;
4226 hidden_item = proto_tree_add_uint(
4227 tree, hf_form, tvb, offset, 0, 1);
4228 proto_item_set_hidden(hidden_item);
4230 /* Parse packet */
4232 offset = dissect_nt_policy_hnd(
4233 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
4234 PIDL_POLHND_USE);
4236 offset = dissect_ndr_cvstring(
4237 tvb, offset, pinfo, tree, di, drep,
4238 sizeof(uint16_t), hf_form_name, true, &name);
4240 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", name);
4242 offset = dissect_ndr_uint32(
4243 tvb, offset, pinfo, tree, di, drep, hf_form_level, &level);
4245 /* GetForm() stores the level in se_data */
4246 if(!pinfo->fd->visited){
4247 dcv->se_data = GUINT_TO_POINTER((int)level);
4250 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d",
4251 level);
4253 offset = dissect_spoolss_buffer(tvb, offset, pinfo, tree, di, drep, NULL);
4255 offset = dissect_ndr_uint32(
4256 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
4258 return offset;
4261 static int
4262 SpoolssGetForm_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
4263 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4265 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
4266 BUFFER buffer;
4267 uint32_t level = GPOINTER_TO_UINT(dcv->se_data);
4268 proto_item *hidden_item;
4270 hidden_item = proto_tree_add_uint(
4271 tree, hf_form, tvb, offset, 0, 1);
4272 proto_item_set_hidden(hidden_item);
4274 /* Parse packet */
4276 offset = dissect_spoolss_buffer(
4277 tvb, offset, pinfo, tree, di, drep, &buffer);
4279 offset = dissect_ndr_uint32(
4280 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
4282 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
4284 if (buffer.tvb) {
4285 int buffer_offset = 0;
4287 switch(level) {
4288 case 1: {
4289 int struct_start = buffer_offset;
4291 /*buffer_offset = */dissect_FORM_REL(
4292 buffer.tvb, buffer_offset, pinfo, tree, di, drep,
4293 struct_start);
4294 break;
4297 default:
4298 proto_tree_add_expert_format(buffer.tree, pinfo, &ei_form_level, buffer.tvb, buffer_offset, -1, "Unknown form info level %d", level);
4299 break;
4303 offset = dissect_doserror(
4304 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
4306 return offset;
4310 /* A generic reply function that just parses the status code. Useful for
4311 unimplemented dissectors so the status code can be inserted into the
4312 INFO column. */
4314 static int
4315 SpoolssGeneric_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
4316 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4318 int len = tvb_reported_length(tvb);
4320 proto_tree_add_expert(tree, pinfo, &ei_unimplemented_dissector, tvb, offset, 0);
4322 offset = dissect_doserror(
4323 tvb, len - 4, pinfo, tree, di, drep, hf_rc, NULL);
4325 return offset;
4329 * JOB_INFO_1
4332 static int ett_JOB_INFO_1;
4334 static int
4335 dissect_spoolss_JOB_INFO_1(tvbuff_t *tvb, int offset, packet_info *pinfo,
4336 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4338 proto_item *item;
4339 proto_tree *subtree;
4340 int struct_start = offset;
4341 char *document_name;
4343 subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_JOB_INFO_1, &item, "Job info level 1");
4345 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
4346 hf_job_id, NULL);
4348 offset = dissect_spoolss_relstr(
4349 tvb, offset, pinfo, subtree, di, drep, hf_printername,
4350 struct_start, NULL);
4352 offset = dissect_spoolss_relstr(
4353 tvb, offset, pinfo, subtree, di, drep, hf_servername,
4354 struct_start, NULL);
4356 offset = dissect_spoolss_relstr(
4357 tvb, offset, pinfo, subtree, di, drep, hf_username,
4358 struct_start, NULL);
4360 offset = dissect_spoolss_relstr(
4361 tvb, offset, pinfo, subtree, di, drep, hf_documentname,
4362 struct_start, &document_name);
4364 proto_item_append_text(item, ": %s", document_name);
4366 offset = dissect_spoolss_relstr(
4367 tvb, offset, pinfo, subtree, di, drep, hf_datatype,
4368 struct_start, NULL);
4370 offset = dissect_spoolss_relstr(
4371 tvb, offset, pinfo, subtree, di, drep, hf_textstatus,
4372 struct_start, NULL);
4374 offset = dissect_job_status(tvb, offset, pinfo, subtree, di, drep);
4376 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
4377 hf_job_priority, NULL);
4379 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
4380 hf_job_position, NULL);
4382 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
4383 hf_job_totalpages, NULL);
4385 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
4386 hf_job_pagesprinted, NULL);
4388 offset = dissect_SYSTEM_TIME(
4389 tvb, offset, pinfo, subtree, di, drep, "Job Submission Time",
4390 true, NULL);
4392 proto_item_set_len(item, offset - struct_start);
4394 return offset;
4398 * JOB_INFO_2
4401 static int ett_JOB_INFO_2;
4403 static int
4404 dissect_spoolss_JOB_INFO_2(tvbuff_t *tvb, int offset, packet_info *pinfo,
4405 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4407 proto_item *item;
4408 proto_tree *subtree;
4409 int struct_start = offset;
4410 char *document_name;
4411 uint32_t devmode_offset, secdesc_offset;
4413 subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_JOB_INFO_2, &item, "Job info level 2");
4415 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
4416 hf_job_id, NULL);
4418 offset = dissect_spoolss_relstr(
4419 tvb, offset, pinfo, subtree, di, drep, hf_printername,
4420 struct_start, NULL);
4422 offset = dissect_spoolss_relstr(
4423 tvb, offset, pinfo, subtree, di, drep, hf_machinename,
4424 struct_start, NULL);
4426 offset = dissect_spoolss_relstr(
4427 tvb, offset, pinfo, subtree, di, drep, hf_username,
4428 struct_start, NULL);
4430 offset = dissect_spoolss_relstr(
4431 tvb, offset, pinfo, subtree, di, drep, hf_documentname,
4432 struct_start, &document_name);
4434 proto_item_append_text(item, ": %s", document_name);
4436 offset = dissect_spoolss_relstr(
4437 tvb, offset, pinfo, subtree, di, drep, hf_notifyname,
4438 struct_start, NULL);
4440 offset = dissect_spoolss_relstr(
4441 tvb, offset, pinfo, subtree, di, drep, hf_datatype,
4442 struct_start, NULL);
4444 offset = dissect_spoolss_relstr(
4445 tvb, offset, pinfo, subtree, di, drep, hf_printprocessor,
4446 struct_start, NULL);
4448 offset = dissect_spoolss_relstr(
4449 tvb, offset, pinfo, subtree, di, drep, hf_parameters,
4450 struct_start, NULL);
4452 offset = dissect_spoolss_relstr(
4453 tvb, offset, pinfo, subtree, di, drep, hf_drivername,
4454 struct_start, NULL);
4456 offset = dissect_ndr_uint32(
4457 tvb, offset, pinfo, NULL, di, drep, hf_offset,
4458 &devmode_offset);
4460 dissect_DEVMODE(
4461 tvb, devmode_offset - 4 + struct_start, pinfo, subtree, di, drep);
4463 offset = dissect_spoolss_relstr(
4464 tvb, offset, pinfo, subtree, di, drep, hf_textstatus,
4465 struct_start, NULL);
4467 offset = dissect_ndr_uint32(
4468 tvb, offset, pinfo, NULL, di, drep, hf_offset,
4469 &secdesc_offset);
4471 dissect_nt_sec_desc(
4472 tvb, secdesc_offset, pinfo, subtree, drep,
4473 false, -1,
4474 &spoolss_job_access_mask_info);
4476 offset = dissect_job_status(tvb, offset, pinfo, subtree, di, drep);
4478 offset = dissect_ndr_uint32(
4479 tvb, offset, pinfo, subtree, di, drep, hf_job_priority, NULL);
4481 offset = dissect_ndr_uint32(
4482 tvb, offset, pinfo, subtree, di, drep, hf_job_position, NULL);
4484 offset = dissect_ndr_uint32(
4485 tvb, offset, pinfo, NULL, di, drep, hf_start_time, NULL);
4487 offset = dissect_ndr_uint32(
4488 tvb, offset, pinfo, NULL, di, drep, hf_end_time, NULL);
4490 offset = dissect_ndr_uint32(
4491 tvb, offset, pinfo, subtree, di, drep, hf_job_totalpages, NULL);
4493 offset = dissect_ndr_uint32(
4494 tvb, offset, pinfo, subtree, di, drep, hf_job_size, NULL);
4496 offset = dissect_SYSTEM_TIME(
4497 tvb, offset, pinfo, subtree, di, drep, "Job Submission Time",
4498 true, NULL);
4500 offset = dissect_ndr_uint32(
4501 tvb, offset, pinfo, NULL, di, drep, hf_elapsed_time, NULL);
4503 offset = dissect_ndr_uint32(
4504 tvb, offset, pinfo, subtree, di, drep, hf_job_pagesprinted, NULL);
4506 proto_item_set_len(item, offset - struct_start);
4508 return offset;
4512 * EnumJobs
4515 static int hf_enumjobs_firstjob;
4516 static int hf_enumjobs_numjobs;
4518 static int
4519 SpoolssEnumJobs_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
4520 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4522 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
4523 uint32_t level;
4525 /* Parse packet */
4527 offset = dissect_nt_policy_hnd(
4528 tvb, offset, pinfo, tree, di, drep,
4529 hf_hnd, NULL, NULL, PIDL_POLHND_USE);
4531 offset = dissect_ndr_uint32(
4532 tvb, offset, pinfo, tree, di, drep, hf_enumjobs_firstjob, NULL);
4534 offset = dissect_ndr_uint32(
4535 tvb, offset, pinfo, tree, di, drep, hf_enumjobs_numjobs, NULL);
4537 offset = dissect_ndr_uint32(
4538 tvb, offset, pinfo, tree, di, drep, hf_level, &level);
4540 /* EnumJobs() stores the level in se_data */
4541 if(!pinfo->fd->visited){
4542 dcv->se_data = GUINT_TO_POINTER((int)level);
4545 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
4547 offset = dissect_spoolss_buffer(tvb, offset, pinfo, tree, di, drep, NULL);
4549 offset = dissect_ndr_uint32(
4550 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
4552 return offset;
4555 static int
4556 SpoolssEnumJobs_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
4557 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4559 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
4560 int16_t level = GPOINTER_TO_UINT(dcv->se_data);
4561 BUFFER buffer;
4562 uint32_t num_jobs, i;
4563 int buffer_offset;
4565 /* Parse packet */
4567 offset = dissect_spoolss_buffer(
4568 tvb, offset, pinfo, tree, di, drep, &buffer);
4570 offset = dissect_ndr_uint32(
4571 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
4573 offset = dissect_ndr_uint32(
4574 tvb, offset, pinfo, tree, di, drep, hf_enumjobs_numjobs,
4575 &num_jobs);
4577 buffer_offset = 0;
4579 for (i = 0; i < num_jobs; i++) {
4580 switch(level) {
4581 case 1:
4582 buffer_offset = dissect_spoolss_JOB_INFO_1(
4583 buffer.tvb, buffer_offset, pinfo,
4584 buffer.tree, di, drep);
4585 break;
4586 case 2:
4587 buffer_offset = dissect_spoolss_JOB_INFO_2(
4588 buffer.tvb, buffer_offset, pinfo,
4589 buffer.tree, di, drep);
4590 break;
4591 default:
4592 proto_tree_add_expert_format( buffer.tree, pinfo, &ei_job_info_level, buffer.tvb, 0, -1, "Unknown job info level %d", level);
4593 break;
4598 offset = dissect_doserror(
4599 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
4601 return offset;
4605 * SetJob
4608 static const value_string setjob_commands[] = {
4609 { JOB_CONTROL_PAUSE, "Pause" },
4610 { JOB_CONTROL_RESUME, "Resume" },
4611 { JOB_CONTROL_CANCEL, "Cancel" },
4612 { JOB_CONTROL_RESTART, "Restart" },
4613 { JOB_CONTROL_DELETE, "Delete" },
4614 { 0, NULL }
4617 static int hf_setjob_cmd;
4619 static int
4620 SpoolssSetJob_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
4621 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4623 uint32_t jobid, cmd;
4625 /* Parse packet */
4627 offset = dissect_nt_policy_hnd(
4628 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
4629 PIDL_POLHND_USE);
4631 offset = dissect_ndr_uint32(
4632 tvb, offset, pinfo, tree, di, drep, hf_job_id, &jobid);
4634 offset = dissect_ndr_uint32(
4635 tvb, offset, pinfo, tree, di, drep, hf_level, NULL);
4637 offset = dissect_ndr_uint32(
4638 tvb, offset, pinfo, tree, di, drep, hf_setjob_cmd, &cmd);
4640 col_append_fstr(
4641 pinfo->cinfo, COL_INFO, ", %s jobid %d",
4642 val_to_str(cmd, setjob_commands, "Unknown (%d)"),
4643 jobid);
4645 return offset;
4648 static int
4649 SpoolssSetJob_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
4650 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4652 /* Parse packet */
4654 offset = dissect_doserror(
4655 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
4657 return offset;
4661 * GetJob
4664 static int
4665 SpoolssGetJob_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
4666 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4668 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
4669 uint32_t level, jobid;
4671 /* Parse packet */
4673 offset = dissect_nt_policy_hnd(
4674 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
4675 PIDL_POLHND_USE);
4677 offset = dissect_ndr_uint32(
4678 tvb, offset, pinfo, tree, di, drep, hf_job_id, &jobid);
4680 offset = dissect_ndr_uint32(
4681 tvb, offset, pinfo, tree, di, drep, hf_level, &level);
4683 /* GetJob() stores the level in se_data */
4684 if(!pinfo->fd->visited){
4685 dcv->se_data = GUINT_TO_POINTER((int)level);
4688 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d, jobid %d",
4689 level, jobid);
4691 offset = dissect_spoolss_buffer(tvb, offset, pinfo, tree, di, drep, NULL);
4693 offset = dissect_ndr_uint32(
4694 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
4696 return offset;
4699 static int
4700 SpoolssGetJob_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
4701 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4703 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
4704 int32_t level = GPOINTER_TO_UINT(dcv->se_data);
4705 BUFFER buffer;
4707 /* Parse packet */
4709 offset = dissect_spoolss_buffer(tvb, offset, pinfo, tree, di, drep,
4710 &buffer);
4712 if (buffer.tvb) {
4713 int buffer_offset = 0;
4715 switch(level) {
4716 case 1:
4717 /*buffer_offset = */dissect_spoolss_JOB_INFO_1(
4718 buffer.tvb, buffer_offset, pinfo,
4719 buffer.tree, di, drep);
4720 break;
4721 case 2:
4722 default:
4723 proto_tree_add_expert_format( buffer.tree, pinfo, &ei_job_info_level, buffer.tvb, buffer_offset, -1, "Unknown job info level %d", level);
4724 break;
4728 offset = dissect_ndr_uint32(
4729 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
4731 offset = dissect_doserror(
4732 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
4734 return offset;
4738 * StartPagePrinter
4741 static int
4742 SpoolssStartPagePrinter_q(tvbuff_t *tvb, int offset,
4743 packet_info *pinfo, proto_tree *tree,
4744 dcerpc_info *di, uint8_t *drep)
4746 e_ctx_hnd policy_hnd;
4747 char *pol_name;
4749 /* Parse packet */
4751 offset = dissect_nt_policy_hnd(
4752 tvb, offset, pinfo, tree, di, drep, hf_hnd, &policy_hnd, NULL,
4753 PIDL_POLHND_USE);
4755 dcerpc_fetch_polhnd_data(&policy_hnd, &pol_name, NULL, NULL, NULL,
4756 pinfo->num);
4758 if (pol_name)
4759 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
4760 pol_name);
4762 return offset;
4765 static int
4766 SpoolssStartPagePrinter_r(tvbuff_t *tvb, int offset,
4767 packet_info *pinfo, proto_tree *tree,
4768 dcerpc_info *di, uint8_t *drep)
4770 /* Parse packet */
4772 offset = dissect_doserror(
4773 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
4775 return offset;
4779 * EndPagePrinter
4782 static int
4783 SpoolssEndPagePrinter_q(tvbuff_t *tvb, int offset,
4784 packet_info *pinfo, proto_tree *tree,
4785 dcerpc_info *di, uint8_t *drep)
4787 e_ctx_hnd policy_hnd;
4788 char *pol_name;
4790 /* Parse packet */
4792 offset = dissect_nt_policy_hnd(
4793 tvb, offset, pinfo, tree, di, drep, hf_hnd, &policy_hnd, NULL,
4794 PIDL_POLHND_USE);
4796 dcerpc_fetch_polhnd_data(&policy_hnd, &pol_name, NULL, NULL, NULL,
4797 pinfo->num);
4799 if (pol_name)
4800 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
4801 pol_name);
4803 return offset;
4806 static int
4807 SpoolssEndPagePrinter_r(tvbuff_t *tvb, int offset,
4808 packet_info *pinfo, proto_tree *tree,
4809 dcerpc_info *di, uint8_t *drep)
4811 /* Parse packet */
4813 offset = dissect_doserror(
4814 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
4816 return offset;
4820 * DOC_INFO_1
4823 static int ett_DOC_INFO_1;
4825 static int
4826 dissect_spoolss_doc_info_1(tvbuff_t *tvb, int offset, packet_info *pinfo,
4827 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4829 proto_tree *subtree;
4831 subtree = proto_tree_add_subtree(
4832 tree, tvb, offset, 0, ett_DOC_INFO_1, NULL, "Document info level 1");
4834 offset = dissect_ndr_str_pointer_item(
4835 tvb, offset, pinfo, subtree, di, drep, NDR_POINTER_UNIQUE,
4836 "Document name", hf_documentname, 0);
4838 offset = dissect_ndr_str_pointer_item(
4839 tvb, offset, pinfo, subtree, di, drep, NDR_POINTER_UNIQUE,
4840 "Output file", hf_outputfile, 0);
4842 offset = dissect_ndr_str_pointer_item(
4843 tvb, offset, pinfo, subtree, di, drep, NDR_POINTER_UNIQUE,
4844 "Data type", hf_datatype, 0);
4846 return offset;
4849 static int
4850 dissect_spoolss_doc_info_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
4851 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4853 if (di->conformant_run)
4854 return offset;
4856 return dissect_spoolss_doc_info_1(tvb, offset, pinfo, tree, di, drep);
4860 * DOC_INFO
4863 static int ett_DOC_INFO;
4865 static int
4866 dissect_spoolss_doc_info(tvbuff_t *tvb, int offset, packet_info *pinfo,
4867 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4869 proto_tree *subtree;
4870 uint32_t level;
4872 subtree = proto_tree_add_subtree(
4873 tree, tvb, offset, 0, ett_DOC_INFO, NULL, "Document info");
4875 offset = dissect_ndr_uint32(
4876 tvb, offset, pinfo, subtree, di, drep, hf_level, &level);
4878 offset = dissect_ndr_pointer(
4879 tvb, offset, pinfo, subtree, di, drep,
4880 dissect_spoolss_doc_info_data,
4881 NDR_POINTER_UNIQUE, "Document info", -1);
4883 return offset;
4887 * DOC_INFO_CTR
4890 static int ett_DOC_INFO_CTR;
4893 dissect_spoolss_doc_info_ctr(tvbuff_t *tvb, int offset, packet_info *pinfo,
4894 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
4896 proto_tree *subtree;
4898 subtree = proto_tree_add_subtree(
4899 tree, tvb, offset, 0, ett_DOC_INFO_CTR, NULL, "Document info container");
4901 offset = dissect_ndr_uint32(
4902 tvb, offset, pinfo, subtree, di, drep, hf_level, NULL);
4904 offset = dissect_spoolss_doc_info(
4905 tvb, offset, pinfo, subtree, di, drep);
4907 return offset;
4911 * StartDocPrinter
4914 static int
4915 SpoolssStartDocPrinter_q(tvbuff_t *tvb, int offset,
4916 packet_info *pinfo, proto_tree *tree,
4917 dcerpc_info *di, uint8_t *drep)
4919 e_ctx_hnd policy_hnd;
4920 char *pol_name;
4922 /* Parse packet */
4924 offset = dissect_nt_policy_hnd(
4925 tvb, offset, pinfo, tree, di, drep, hf_hnd, &policy_hnd, NULL,
4926 PIDL_POLHND_USE);
4928 dcerpc_fetch_polhnd_data(&policy_hnd, &pol_name, NULL, NULL, NULL,
4929 pinfo->num);
4931 if (pol_name)
4932 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
4933 pol_name);
4935 offset = dissect_spoolss_doc_info_ctr(tvb, offset, pinfo, tree, di, drep);
4937 return offset;
4940 static int
4941 SpoolssStartDocPrinter_r(tvbuff_t *tvb, int offset,
4942 packet_info *pinfo, proto_tree *tree,
4943 dcerpc_info *di, uint8_t *drep)
4945 /* Parse packet */
4947 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
4948 hf_job_id, NULL);
4950 offset = dissect_doserror(
4951 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
4953 return offset;
4957 * EndDocPrinter
4960 static int
4961 SpoolssEndDocPrinter_q(tvbuff_t *tvb, int offset,
4962 packet_info *pinfo, proto_tree *tree,
4963 dcerpc_info *di, uint8_t *drep)
4965 e_ctx_hnd policy_hnd;
4966 char *pol_name;
4968 /* Parse packet */
4970 offset = dissect_nt_policy_hnd(
4971 tvb, offset, pinfo, tree, di, drep, hf_hnd, &policy_hnd, NULL,
4972 PIDL_POLHND_USE);
4974 dcerpc_fetch_polhnd_data(&policy_hnd, &pol_name, NULL, NULL, NULL,
4975 pinfo->num);
4977 if (pol_name)
4978 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
4979 pol_name);
4982 return offset;
4985 static int
4986 SpoolssEndDocPrinter_r(tvbuff_t *tvb, int offset,
4987 packet_info *pinfo, proto_tree *tree,
4988 dcerpc_info *di, uint8_t *drep)
4990 /* Parse packet */
4992 offset = dissect_doserror(
4993 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
4995 return offset;
4999 * WritePrinter
5002 static int ett_writeprinter_buffer;
5004 static int hf_writeprinter_numwritten;
5006 static int
5007 SpoolssWritePrinter_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
5008 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
5010 e_ctx_hnd policy_hnd;
5011 char *pol_name;
5012 uint32_t size;
5013 proto_item *item;
5014 proto_tree *subtree;
5016 /* Parse packet */
5018 offset = dissect_nt_policy_hnd(
5019 tvb, offset, pinfo, tree, di, drep, hf_hnd, &policy_hnd, NULL,
5020 PIDL_POLHND_USE);
5022 dcerpc_fetch_polhnd_data(&policy_hnd, &pol_name, NULL, NULL, NULL,
5023 pinfo->num);
5025 if (pol_name)
5026 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
5027 pol_name);
5029 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
5030 hf_buffer_size, &size);
5032 col_append_fstr(pinfo->cinfo, COL_INFO, ", %d bytes", size);
5034 subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_writeprinter_buffer, &item, "Buffer");
5036 offset = dissect_ndr_uint8s(tvb, offset, pinfo, subtree, di, drep,
5037 hf_buffer_data, size, NULL);
5039 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
5040 hf_buffer_size, NULL);
5042 proto_item_set_len(item, size + 4);
5044 return offset;
5047 static int
5048 SpoolssWritePrinter_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
5049 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
5051 uint32_t size;
5053 /* Parse packet */
5055 offset = dissect_ndr_uint32(
5056 tvb, offset, pinfo, tree, di, drep, hf_writeprinter_numwritten,
5057 &size);
5059 col_append_fstr(
5060 pinfo->cinfo, COL_INFO, ", %d bytes written", size);
5062 offset = dissect_doserror(
5063 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
5065 return offset;
5069 * DeletePrinterData
5072 static int
5073 SpoolssDeletePrinterData_q(tvbuff_t *tvb, int offset,
5074 packet_info *pinfo, proto_tree *tree,
5075 dcerpc_info *di, uint8_t *drep)
5077 char *value_name;
5078 proto_item *hidden_item;
5080 hidden_item = proto_tree_add_uint(
5081 tree, hf_printerdata, tvb, offset, 0, 1);
5082 proto_item_set_hidden(hidden_item);
5084 /* Parse packet */
5086 offset = dissect_nt_policy_hnd(
5087 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
5088 PIDL_POLHND_USE);
5090 offset = dissect_ndr_cvstring(
5091 tvb, offset, pinfo, tree, di, drep, sizeof(uint16_t),
5092 hf_printerdata_value, true, &value_name);
5094 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", value_name);
5096 return offset;
5099 static int
5100 SpoolssDeletePrinterData_r(tvbuff_t *tvb, int offset,
5101 packet_info *pinfo, proto_tree *tree,
5102 dcerpc_info *di, uint8_t *drep)
5104 proto_item *hidden_item;
5106 hidden_item = proto_tree_add_uint(
5107 tree, hf_printerdata, tvb, offset, 0, 1);
5108 proto_item_set_hidden(hidden_item);
5110 /* Parse packet */
5112 offset = dissect_doserror(
5113 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
5115 return offset;
5119 * DRIVER_INFO_1
5122 static int ett_DRIVER_INFO_1;
5124 static int
5125 dissect_DRIVER_INFO_1(tvbuff_t *tvb, int offset,
5126 packet_info *pinfo, proto_tree *tree,
5127 dcerpc_info *di, uint8_t *drep)
5129 proto_tree *subtree;
5130 int struct_start = offset;
5132 subtree = proto_tree_add_subtree(
5133 tree, tvb, offset, 0, ett_DRIVER_INFO_1, NULL, "Driver info level 1");
5135 offset = dissect_spoolss_relstr(
5136 tvb, offset, pinfo, subtree, di, drep, hf_drivername,
5137 struct_start, NULL);
5139 return offset;
5143 * DRIVER_INFO_2
5146 static const value_string driverinfo_cversion_vals[] =
5148 { 0, "Windows 95/98/Me" },
5149 { 2, "Windows NT 4.0" },
5150 { 3, "Windows 2000/XP" },
5151 { 0, NULL }
5154 static int ett_DRIVER_INFO_2;
5156 static int
5157 dissect_DRIVER_INFO_2(tvbuff_t *tvb, int offset,
5158 packet_info *pinfo, proto_tree *tree,
5159 dcerpc_info *di, uint8_t *drep)
5161 proto_tree *subtree;
5162 int struct_start = offset;
5164 subtree = proto_tree_add_subtree(
5165 tree, tvb, offset, 0, ett_DRIVER_INFO_2, NULL, "Driver info level 2");
5167 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
5168 hf_driverinfo_cversion, NULL);
5170 offset = dissect_spoolss_relstr(
5171 tvb, offset, pinfo, subtree, di, drep, hf_drivername,
5172 struct_start, NULL);
5174 offset = dissect_spoolss_relstr(
5175 tvb, offset, pinfo, subtree, di, drep, hf_environment,
5176 struct_start, NULL);
5178 offset = dissect_spoolss_relstr(
5179 tvb, offset, pinfo, subtree, di, drep, hf_driverpath,
5180 struct_start, NULL);
5182 offset = dissect_spoolss_relstr(
5183 tvb, offset, pinfo, subtree, di, drep, hf_datafile,
5184 struct_start, NULL);
5186 offset = dissect_spoolss_relstr(
5187 tvb, offset, pinfo, subtree, di, drep, hf_configfile,
5188 struct_start, NULL);
5190 return offset;
5194 * DRIVER_INFO_3
5197 static int ett_DRIVER_INFO_3;
5199 static int
5200 dissect_DRIVER_INFO_3(tvbuff_t *tvb, int offset,
5201 packet_info *pinfo, proto_tree *tree,
5202 dcerpc_info *di, uint8_t *drep)
5204 proto_tree *subtree;
5205 int struct_start = offset;
5207 subtree = proto_tree_add_subtree(
5208 tree, tvb, offset, 0, ett_DRIVER_INFO_3, NULL, "Driver info level 3");
5210 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
5211 hf_driverinfo_cversion, NULL);
5213 offset = dissect_spoolss_relstr(
5214 tvb, offset, pinfo, subtree, di, drep, hf_drivername,
5215 struct_start, NULL);
5217 offset = dissect_spoolss_relstr(
5218 tvb, offset, pinfo, subtree, di, drep, hf_environment,
5219 struct_start, NULL);
5221 offset = dissect_spoolss_relstr(
5222 tvb, offset, pinfo, subtree, di, drep, hf_driverpath,
5223 struct_start, NULL);
5225 offset = dissect_spoolss_relstr(
5226 tvb, offset, pinfo, subtree, di, drep, hf_datafile,
5227 struct_start, NULL);
5229 offset = dissect_spoolss_relstr(
5230 tvb, offset, pinfo, subtree, di, drep, hf_configfile,
5231 struct_start, NULL);
5233 offset = dissect_spoolss_relstr(
5234 tvb, offset, pinfo, subtree, di, drep, hf_helpfile,
5235 struct_start, NULL);
5237 offset = dissect_spoolss_relstrarray(
5238 tvb, offset, pinfo, subtree, di, drep, hf_dependentfiles,
5239 struct_start, NULL);
5241 offset = dissect_spoolss_relstr(
5242 tvb, offset, pinfo, subtree, di, drep, hf_monitorname,
5243 struct_start, NULL);
5245 offset = dissect_spoolss_relstr(
5246 tvb, offset, pinfo, subtree, di, drep, hf_defaultdatatype,
5247 struct_start, NULL);
5249 return offset;
5254 DRIVER_INFO_6
5257 static int ett_DRIVER_INFO_6;
5259 static int
5260 dissect_DRIVER_INFO_6(tvbuff_t *tvb, int offset,
5261 packet_info *pinfo, proto_tree *tree,
5262 dcerpc_info *di, uint8_t *drep)
5264 proto_tree *subtree;
5265 int struct_start = offset;
5267 subtree = proto_tree_add_subtree(
5268 tree, tvb, offset, 0, ett_DRIVER_INFO_6, NULL, "Driver info level 6");
5270 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
5271 hf_driverinfo_cversion, NULL);
5273 offset = dissect_spoolss_relstr(
5274 tvb, offset, pinfo, subtree, di, drep, hf_drivername,
5275 struct_start, NULL);
5277 offset = dissect_spoolss_relstr(
5278 tvb, offset, pinfo, subtree, di, drep, hf_environment,
5279 struct_start, NULL);
5281 offset = dissect_spoolss_relstr(
5282 tvb, offset, pinfo, subtree, di, drep, hf_driverpath,
5283 struct_start, NULL);
5285 offset = dissect_spoolss_relstr(
5286 tvb, offset, pinfo, subtree, di, drep, hf_datafile,
5287 struct_start, NULL);
5289 offset = dissect_spoolss_relstr(
5290 tvb, offset, pinfo, subtree, di, drep, hf_configfile,
5291 struct_start, NULL);
5293 offset = dissect_spoolss_relstr(
5294 tvb, offset, pinfo, subtree, di, drep, hf_helpfile,
5295 struct_start, NULL);
5297 offset = dissect_spoolss_relstr(
5298 tvb, offset, pinfo, subtree, di, drep, hf_monitorname,
5299 struct_start, NULL);
5301 offset = dissect_spoolss_relstr(
5302 tvb, offset, pinfo, subtree, di, drep, hf_defaultdatatype,
5303 struct_start, NULL);
5305 offset = dissect_spoolss_relstrarray(
5306 tvb, offset, pinfo, subtree, di, drep, hf_dependentfiles,
5307 struct_start, NULL);
5309 offset = dissect_spoolss_relstrarray(
5310 tvb, offset, pinfo, subtree, di, drep, hf_previousdrivernames,
5311 struct_start, NULL);
5313 offset = dissect_ndr_nt_NTTIME (
5314 tvb, offset, pinfo, subtree, di, drep,hf_driverdate);
5316 offset = dissect_ndr_uint32(
5317 tvb, offset, pinfo, subtree, di, drep, hf_padding,
5318 NULL);
5320 offset = dissect_ndr_uint32(
5321 tvb, offset, pinfo, subtree, di, drep, hf_driver_version_low,
5322 NULL);
5324 offset = dissect_ndr_uint32(
5325 tvb, offset, pinfo, subtree, di, drep, hf_driver_version_high,
5326 NULL);
5328 offset = dissect_spoolss_relstr(
5329 tvb, offset, pinfo, subtree, di, drep, hf_mfgname,
5330 struct_start, NULL);
5332 offset = dissect_spoolss_relstr(
5333 tvb, offset, pinfo, subtree, di, drep, hf_oemurl,
5334 struct_start, NULL);
5336 offset = dissect_spoolss_relstr(
5337 tvb, offset, pinfo, subtree, di, drep, hf_hardwareid,
5338 struct_start, NULL);
5340 offset = dissect_spoolss_relstr(
5341 tvb, offset, pinfo, subtree, di, drep, hf_provider,
5342 struct_start, NULL);
5344 return offset;
5349 DRIVER_INFO_8
5352 static int ett_DRIVER_INFO_8;
5354 static int
5355 dissect_DRIVER_INFO_8(tvbuff_t *tvb, int offset,
5356 packet_info *pinfo, proto_tree *tree,
5357 dcerpc_info *di, uint8_t *drep)
5359 proto_tree *subtree;
5360 int struct_start = offset;
5362 subtree = proto_tree_add_subtree(
5363 tree, tvb, offset, 0, ett_DRIVER_INFO_8, NULL, "Driver info level 8");
5365 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
5366 hf_driverinfo_cversion, NULL);
5368 offset = dissect_spoolss_relstr(
5369 tvb, offset, pinfo, subtree, di, drep, hf_drivername,
5370 struct_start, NULL);
5372 offset = dissect_spoolss_relstr(
5373 tvb, offset, pinfo, subtree, di, drep, hf_environment,
5374 struct_start, NULL);
5376 offset = dissect_spoolss_relstr(
5377 tvb, offset, pinfo, subtree, di, drep, hf_driverpath,
5378 struct_start, NULL);
5380 offset = dissect_spoolss_relstr(
5381 tvb, offset, pinfo, subtree, di, drep, hf_datafile,
5382 struct_start, NULL);
5384 offset = dissect_spoolss_relstr(
5385 tvb, offset, pinfo, subtree, di, drep, hf_configfile,
5386 struct_start, NULL);
5388 offset = dissect_spoolss_relstr(
5389 tvb, offset, pinfo, subtree, di, drep, hf_helpfile,
5390 struct_start, NULL);
5392 offset = dissect_spoolss_relstrarray(
5393 tvb, offset, pinfo, subtree, di, drep, hf_dependentfiles,
5394 struct_start, NULL);
5396 offset = dissect_spoolss_relstr(
5397 tvb, offset, pinfo, subtree, di, drep, hf_monitorname,
5398 struct_start, NULL);
5400 offset = dissect_spoolss_relstr(
5401 tvb, offset, pinfo, subtree, di, drep, hf_defaultdatatype,
5402 struct_start, NULL);
5404 offset = dissect_spoolss_relstrarray(
5405 tvb, offset, pinfo, subtree, di, drep, hf_previousdrivernames,
5406 struct_start, NULL);
5408 offset = dissect_ndr_nt_NTTIME (
5409 tvb, offset, pinfo, subtree, di, drep, hf_driverdate);
5411 offset = dissect_ndr_uint32(
5412 tvb, offset, pinfo, subtree, di, drep, hf_padding,
5413 NULL);
5415 offset = dissect_ndr_uint32(
5416 tvb, offset, pinfo, subtree, di, drep, hf_driver_version_low,
5417 NULL);
5419 offset = dissect_ndr_uint32(
5420 tvb, offset, pinfo, subtree, di, drep, hf_driver_version_high,
5421 NULL);
5423 offset = dissect_spoolss_relstr(
5424 tvb, offset, pinfo, subtree, di, drep, hf_mfgname,
5425 struct_start, NULL);
5427 offset = dissect_spoolss_relstr(
5428 tvb, offset, pinfo, subtree, di, drep, hf_oemurl,
5429 struct_start, NULL);
5431 offset = dissect_spoolss_relstr(
5432 tvb, offset, pinfo, subtree, di, drep, hf_hardwareid,
5433 struct_start, NULL);
5435 offset = dissect_spoolss_relstr(
5436 tvb, offset, pinfo, subtree, di, drep, hf_provider,
5437 struct_start, NULL);
5439 offset = dissect_spoolss_relstr(
5440 tvb, offset, pinfo, subtree, di, drep, hf_printprocessor,
5441 struct_start, NULL);
5443 offset = dissect_spoolss_relstr(
5444 tvb, offset, pinfo, subtree, di, drep, hf_vendor_setup,
5445 struct_start, NULL);
5447 offset = dissect_spoolss_relstrarray(
5448 tvb, offset, pinfo, subtree, di, drep, hf_color_profiles,
5449 struct_start, NULL);
5451 offset = dissect_spoolss_relstr(
5452 tvb, offset, pinfo, subtree, di, drep, hf_inf_path,
5453 struct_start, NULL);
5455 offset = dissect_printer_driver_attributes(
5456 tvb, offset, pinfo, subtree, di, drep);
5458 offset = dissect_spoolss_relstrarray(
5459 tvb, offset, pinfo, subtree, di, drep, hf_core_driver_dependencies,
5460 struct_start, NULL);
5462 offset = dissect_ndr_nt_NTTIME (
5463 tvb, offset, pinfo, subtree, di, drep, hf_min_inbox_driverdate);
5465 offset = dissect_ndr_uint32(
5466 tvb, offset, pinfo, subtree, di, drep, hf_min_inbox_driver_version_low,
5467 NULL);
5469 offset = dissect_ndr_uint32(
5470 tvb, offset, pinfo, subtree, di, drep, hf_min_inbox_driver_version_high,
5471 NULL);
5473 return offset;
5477 static int ett_DRIVER_INFO_101;
5479 static int
5480 dissect_DRIVER_INFO_101(tvbuff_t *tvb, int offset,
5481 packet_info *pinfo, proto_tree *tree,
5482 dcerpc_info *di, uint8_t *drep)
5484 proto_tree *subtree;
5485 int struct_start = offset;
5487 subtree = proto_tree_add_subtree(
5488 tree, tvb, offset, 0, ett_DRIVER_INFO_101, NULL, "Driver info level 101");
5490 offset = dissect_ndr_uint32(tvb, offset, pinfo, subtree, di, drep,
5491 hf_driverinfo_cversion, NULL);
5493 offset = dissect_spoolss_relstr(
5494 tvb, offset, pinfo, subtree, di, drep, hf_drivername,
5495 struct_start, NULL);
5497 offset = dissect_spoolss_relstr(
5498 tvb, offset, pinfo, subtree, di, drep, hf_environment,
5499 struct_start, NULL);
5501 proto_tree_add_expert(subtree, pinfo, &ei_unknown_data, tvb, offset, 0);
5503 return offset;
5507 CORE_PRINTER_DRIVER
5510 static int ett_CORE_PRINTER_DRIVER;
5512 static int
5513 dissect_CORE_PRINTER_DRIVER(tvbuff_t *tvb, int offset,
5514 packet_info *pinfo, proto_tree *tree,
5515 dcerpc_info *di, uint8_t *drep)
5517 proto_tree *subtree;
5519 ALIGN_TO_5_BYTES;
5521 subtree = proto_tree_add_subtree(
5522 tree, tvb, offset, 0, ett_CORE_PRINTER_DRIVER, NULL, "Core Printer Driver");
5524 offset = dissect_ndr_uuid_t(tvb, offset, pinfo, subtree, di, drep,
5525 hf_core_driver_guid, NULL);
5527 offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, subtree, di, drep,
5528 hf_driverdate);
5530 offset = dissect_ndr_uint64(tvb, offset, pinfo, subtree, di, drep,
5531 hf_driver_version, NULL);
5533 /* The package id is stored in a 260-wchar buffer */
5535 dissect_spoolss_uint16uni(tvb, offset, pinfo, subtree, drep, NULL,
5536 hf_package_id);
5538 offset += 520;
5540 if (di->call_data->flags & DCERPC_IS_NDR64) {
5541 ALIGN_TO_5_BYTES;
5544 return offset;
5549 * EnumPrinterDrivers
5552 static int
5553 SpoolssEnumPrinterDrivers_q(tvbuff_t *tvb, int offset,
5554 packet_info *pinfo, proto_tree *tree,
5555 dcerpc_info *di, uint8_t *drep)
5557 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
5558 uint32_t level;
5560 /* Parse packet */
5562 offset = dissect_ndr_str_pointer_item(
5563 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE,
5564 "Name", hf_servername, 0);
5566 offset = dissect_ndr_str_pointer_item(
5567 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE,
5568 "Environment", hf_environment, 0);
5570 offset = dissect_ndr_uint32(
5571 tvb, offset, pinfo, tree, di, drep, hf_level, &level);
5573 /* EnumPrinterDrivers() stores the level in se_data */
5574 if(!pinfo->fd->visited){
5575 dcv->se_data = GUINT_TO_POINTER((int)level);
5578 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
5580 offset = dissect_spoolss_buffer(tvb, offset, pinfo, tree, di, drep, NULL);
5582 offset = dissect_ndr_uint32(
5583 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
5585 return offset;
5588 static int
5589 SpoolssEnumPrinterDrivers_r(tvbuff_t *tvb, int offset,
5590 packet_info *pinfo, proto_tree *tree,
5591 dcerpc_info *di, uint8_t *drep)
5593 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
5594 uint32_t level = GPOINTER_TO_UINT(dcv->se_data), num_drivers, i;
5595 int buffer_offset;
5596 BUFFER buffer;
5598 /* Parse packet */
5600 offset = dissect_spoolss_buffer(tvb, offset, pinfo, tree, di, drep,
5601 &buffer);
5603 offset = dissect_ndr_uint32(
5604 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
5606 offset = dissect_ndr_uint32(
5607 tvb, offset, pinfo, tree, di, drep, hf_returned,
5608 &num_drivers);
5610 buffer_offset = 0;
5612 for (i = 0; i < num_drivers; i++) {
5613 switch(level) {
5614 case 1:
5615 buffer_offset = dissect_DRIVER_INFO_1(
5616 buffer.tvb, buffer_offset, pinfo,
5617 buffer.tree, di, drep);
5618 break;
5619 case 2:
5620 buffer_offset = dissect_DRIVER_INFO_2(
5621 buffer.tvb, buffer_offset, pinfo,
5622 buffer.tree, di, drep);
5623 break;
5624 case 3:
5625 buffer_offset = dissect_DRIVER_INFO_3(
5626 buffer.tvb, buffer_offset, pinfo,
5627 buffer.tree, di, drep);
5628 break;
5629 case 6:
5630 buffer_offset = dissect_DRIVER_INFO_6(
5631 buffer.tvb, buffer_offset, pinfo,
5632 buffer.tree, di, drep);
5633 break;
5634 case 8:
5635 buffer_offset = dissect_DRIVER_INFO_8(
5636 buffer.tvb, buffer_offset, pinfo,
5637 buffer.tree, di, drep);
5638 break;
5639 case 101:
5640 /*buffer_offset =*/ dissect_DRIVER_INFO_101(
5641 buffer.tvb, buffer_offset, pinfo,
5642 buffer.tree, di, drep);
5643 /*break;*/
5644 goto done; /*Not entirely implemented*/
5645 default:
5646 proto_tree_add_expert_format( buffer.tree, pinfo, &ei_driver_info_level, buffer.tvb, buffer_offset, -1, "Unknown driver info level %d", level);
5647 goto done;
5651 done:
5652 offset = dissect_doserror(
5653 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
5655 return offset;
5659 * GetPrinterDriver2
5662 static int
5663 SpoolssGetPrinterDriver2_q(tvbuff_t *tvb, int offset,
5664 packet_info *pinfo, proto_tree *tree,
5665 dcerpc_info *di, uint8_t *drep)
5667 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
5668 e_ctx_hnd policy_hnd;
5669 char *pol_name;
5670 uint32_t level;
5672 /* Parse packet */
5674 offset = dissect_nt_policy_hnd(
5675 tvb, offset, pinfo, tree, di, drep, hf_hnd, &policy_hnd, NULL,
5676 PIDL_POLHND_USE);
5678 dcerpc_fetch_polhnd_data(&policy_hnd, &pol_name, NULL, NULL, NULL,
5679 pinfo->num);
5681 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
5682 pol_name);
5684 offset = dissect_ndr_str_pointer_item(
5685 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE,
5686 "Environment", hf_environment, 0);
5688 offset = dissect_ndr_uint32(
5689 tvb, offset, pinfo, tree, di, drep, hf_level, &level);
5691 /* GetPrinterDriver2() stores the level in se_data */
5692 if(!pinfo->fd->visited){
5693 dcv->se_data = GUINT_TO_POINTER((int)level);
5696 col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
5698 offset = dissect_spoolss_buffer(tvb, offset, pinfo, tree, di, drep, NULL);
5700 offset = dissect_ndr_uint32(
5701 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
5703 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
5704 hf_clientmajorversion, NULL);
5706 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
5707 hf_clientminorversion, NULL);
5709 return offset;
5712 static int
5713 SpoolssGetPrinterDriver2_r(tvbuff_t *tvb, int offset,
5714 packet_info *pinfo, proto_tree *tree,
5715 dcerpc_info *di, uint8_t *drep)
5717 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
5718 uint32_t level = GPOINTER_TO_UINT(dcv->se_data);
5719 BUFFER buffer;
5721 /* Parse packet */
5723 offset = dissect_spoolss_buffer(tvb, offset, pinfo, tree, di, drep,
5724 &buffer);
5726 if (buffer.tvb) {
5727 switch(level) {
5728 case 1:
5729 dissect_DRIVER_INFO_1(
5730 buffer.tvb, 0, pinfo, buffer.tree, di, drep);
5731 break;
5732 case 2:
5733 dissect_DRIVER_INFO_2(
5734 buffer.tvb, 0, pinfo, buffer.tree, di, drep);
5735 break;
5736 case 3:
5737 dissect_DRIVER_INFO_3(
5738 buffer.tvb, 0, pinfo, buffer.tree, di, drep);
5739 break;
5740 case 6:
5741 dissect_DRIVER_INFO_6(
5742 buffer.tvb, 0, pinfo, buffer.tree, di, drep);
5743 break;
5744 case 8:
5745 dissect_DRIVER_INFO_8(
5746 buffer.tvb, 0, pinfo, buffer.tree, di, drep);
5747 break;
5748 case 101:
5749 dissect_DRIVER_INFO_101(
5750 buffer.tvb, 0, pinfo, buffer.tree, di, drep);
5751 break;
5752 default:
5753 proto_tree_add_expert_format( buffer.tree, pinfo, &ei_driver_info_level, buffer.tvb, 0, -1, "Unknown driver info level %d", level);
5754 break;
5758 offset = dissect_ndr_uint32(
5759 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
5761 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
5762 hf_servermajorversion, NULL);
5764 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
5765 hf_serverminorversion, NULL);
5767 offset = dissect_doserror(
5768 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
5770 return offset;
5773 static int
5774 dissect_notify_info_data_buffer(tvbuff_t *tvb, int offset, packet_info *pinfo,
5775 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
5777 uint32_t len;
5779 offset = dissect_ndr_uint32(
5780 tvb, offset, pinfo, tree, di, drep,
5781 hf_notify_info_data_buffer_len, &len);
5783 offset = dissect_ndr_uint16s(
5784 tvb, offset, pinfo, tree, di, drep,
5785 hf_notify_info_data_buffer_data, len);
5787 return offset;
5790 static void
5791 cb_notify_str_postprocess(packet_info *pinfo _U_,
5792 proto_tree *tree,
5793 proto_item *item, dcerpc_info *di _U_, tvbuff_t *tvb,
5794 int start_offset, int end_offset,
5795 void *callback_args)
5797 int levels, hf_index = GPOINTER_TO_INT(callback_args);
5798 uint32_t len;
5799 char *s;
5800 proto_item *hidden_item;
5802 /* Align start_offset on 4-byte boundary. */
5804 if (start_offset % 4)
5805 start_offset += 4 - (start_offset % 4);
5807 /* Get string length */
5809 len = tvb_get_letohl(tvb, start_offset);
5811 s = tvb_get_string_enc(pinfo->pool,
5812 tvb, start_offset + 4, (end_offset - start_offset - 4), ENC_UTF_16|ENC_LITTLE_ENDIAN);
5814 /* Append string to upper-level proto_items */
5816 levels = 2;
5818 if (levels > 0 && item && s && s[0]) {
5819 proto_item_append_text(item, ": %s", s);
5820 item = item->parent;
5821 levels--;
5822 if (levels > 0) {
5823 proto_item_append_text(item, ": %s", s);
5824 item = item->parent;
5825 levels--;
5826 while (levels > 0) {
5827 proto_item_append_text(item, " %s", s);
5828 item = item->parent;
5829 levels--;
5834 /* Add hidden field so filter brings up any notify data */
5836 if (hf_index > 0) {
5837 hidden_item = proto_tree_add_string(
5838 tree, hf_index, tvb, start_offset, len, s);
5839 proto_item_set_hidden(hidden_item);
5843 /* Return the hf_index for a printer notify field. This is used to
5844 add a hidden string to the display so that filtering will bring
5845 up relevant notify data. */
5847 static int
5848 printer_notify_hf_index(int field)
5850 int result = -1;
5852 switch(field) {
5853 case PRINTER_NOTIFY_SERVER_NAME:
5854 result = hf_servername;
5855 break;
5856 case PRINTER_NOTIFY_PRINTER_NAME:
5857 result = hf_printername;
5858 break;
5859 case PRINTER_NOTIFY_SHARE_NAME:
5860 result = hf_sharename;
5861 break;
5862 case PRINTER_NOTIFY_PORT_NAME:
5863 result = hf_portname;
5864 break;
5865 case PRINTER_NOTIFY_DRIVER_NAME:
5866 result = hf_drivername;
5867 break;
5868 case PRINTER_NOTIFY_COMMENT:
5869 result = hf_printercomment;
5870 break;
5871 case PRINTER_NOTIFY_LOCATION:
5872 result = hf_printerlocation;
5873 break;
5874 case PRINTER_NOTIFY_SEPFILE:
5875 result = hf_sepfile;
5876 break;
5877 case PRINTER_NOTIFY_PRINT_PROCESSOR:
5878 result = hf_printprocessor;
5879 break;
5880 case PRINTER_NOTIFY_PARAMETERS:
5881 result = hf_parameters;
5882 break;
5883 case PRINTER_NOTIFY_DATATYPE:
5884 result = hf_parameters;
5885 break;
5888 return result;
5891 static int
5892 job_notify_hf_index(int field)
5894 int result = -1;
5896 switch(field) {
5897 case JOB_NOTIFY_PRINTER_NAME:
5898 result = hf_printername;
5899 break;
5900 case JOB_NOTIFY_MACHINE_NAME:
5901 result = hf_machinename;
5902 break;
5903 case JOB_NOTIFY_PORT_NAME:
5904 result = hf_portname;
5905 break;
5906 case JOB_NOTIFY_USER_NAME:
5907 result = hf_username;
5908 break;
5909 case JOB_NOTIFY_NOTIFY_NAME:
5910 result = hf_notifyname;
5911 break;
5912 case JOB_NOTIFY_DATATYPE:
5913 result = hf_datatype;
5914 break;
5915 case JOB_NOTIFY_PRINT_PROCESSOR:
5916 result = hf_printprocessor;
5917 break;
5918 case JOB_NOTIFY_DRIVER_NAME:
5919 result = hf_drivername;
5920 break;
5921 case JOB_NOTIFY_DOCUMENT:
5922 result = hf_documentname;
5923 break;
5924 case JOB_NOTIFY_PRIORITY:
5925 result = hf_job_priority;
5926 break;
5927 case JOB_NOTIFY_POSITION:
5928 result = hf_job_position;
5929 break;
5930 case JOB_NOTIFY_TOTAL_PAGES:
5931 result = hf_job_totalpages;
5932 break;
5933 case JOB_NOTIFY_PAGES_PRINTED:
5934 result = hf_job_pagesprinted;
5935 break;
5936 case JOB_NOTIFY_TOTAL_BYTES:
5937 result = hf_job_totalbytes;
5938 break;
5939 case JOB_NOTIFY_BYTES_PRINTED:
5940 result = hf_job_bytesprinted;
5941 break;
5944 return result;
5947 static int
5948 dissect_NOTIFY_INFO_DATA_printer(tvbuff_t *tvb, int offset, packet_info *pinfo,
5949 proto_tree *tree, proto_item *item,
5950 dcerpc_info *di, uint8_t *drep, uint16_t field)
5952 uint32_t value1;
5954 switch (field) {
5956 /* String notify data */
5958 case PRINTER_NOTIFY_SERVER_NAME:
5959 case PRINTER_NOTIFY_PRINTER_NAME:
5960 case PRINTER_NOTIFY_SHARE_NAME:
5961 case PRINTER_NOTIFY_DRIVER_NAME:
5962 case PRINTER_NOTIFY_COMMENT:
5963 case PRINTER_NOTIFY_LOCATION:
5964 case PRINTER_NOTIFY_SEPFILE:
5965 case PRINTER_NOTIFY_PRINT_PROCESSOR:
5966 case PRINTER_NOTIFY_PARAMETERS:
5967 case PRINTER_NOTIFY_DATATYPE:
5968 case PRINTER_NOTIFY_PORT_NAME:
5970 offset = dissect_ndr_uint32(
5971 tvb, offset, pinfo, tree, di, drep,
5972 hf_notify_info_data_bufsize, &value1);
5974 offset = dissect_ndr_pointer_cb(
5975 tvb, offset, pinfo, tree, di, drep,
5976 dissect_notify_info_data_buffer,
5977 NDR_POINTER_UNIQUE, "String",
5978 hf_notify_info_data_buffer,
5979 cb_notify_str_postprocess,
5980 GINT_TO_POINTER(printer_notify_hf_index(field)));
5982 break;
5984 case PRINTER_NOTIFY_ATTRIBUTES:
5986 /* Value 1 is the printer attributes */
5988 offset = dissect_printer_attributes(
5989 tvb, offset, pinfo, tree, di, drep);
5991 offset = dissect_ndr_uint32(
5992 tvb, offset, pinfo, NULL, di, drep,
5993 hf_notify_info_data_value2, NULL);
5995 break;
5997 case PRINTER_NOTIFY_STATUS: {
5998 uint32_t status;
6000 /* Value 1 is the printer status */
6002 offset = dissect_ndr_uint32(
6003 tvb, offset, pinfo, tree, di, drep,
6004 hf_printer_status, &status);
6006 offset = dissect_ndr_uint32(
6007 tvb, offset, pinfo, NULL, di, drep,
6008 hf_notify_info_data_value2, NULL);
6010 proto_item_append_text(
6011 item, ": %s",
6012 val_to_str_ext_const(status, &printer_status_vals_ext, "Unknown"));
6014 break;
6017 /* Unknown notify data */
6019 case PRINTER_NOTIFY_SECURITY_DESCRIPTOR: /* Secdesc */
6020 case PRINTER_NOTIFY_DEVMODE: /* Devicemode */
6022 offset = dissect_ndr_uint32(
6023 tvb, offset, pinfo, tree, di, drep,
6024 hf_notify_info_data_bufsize, &value1);
6026 offset = dissect_ndr_pointer(
6027 tvb, offset, pinfo, tree, di, drep,
6028 dissect_notify_info_data_buffer,
6029 NDR_POINTER_UNIQUE, "Buffer",
6030 hf_notify_info_data_buffer);
6032 break;
6034 default:
6035 offset = dissect_ndr_uint32(
6036 tvb, offset, pinfo, tree, di, drep,
6037 hf_notify_info_data_value1, NULL);
6039 offset = dissect_ndr_uint32(
6040 tvb, offset, pinfo, tree, di, drep,
6041 hf_notify_info_data_value2, NULL);
6043 break;
6045 return offset;
6048 static void
6049 notify_job_time_cb(packet_info *pinfo _U_, proto_tree *tree _U_,
6050 proto_item *item, dcerpc_info *di, tvbuff_t *tvb _U_,
6051 int start_offset _U_, int end_offset _U_,
6052 void *callback_args _U_)
6054 dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
6055 char *str = (char *)dcv->private_data;
6057 /* Append job string stored in dcv->private_data by
6058 dissect_SYSTEM_TIME_ptr() in the current item as well
6059 as the parent. */
6061 proto_item_append_text(item, ": %s", str);
6063 if (item)
6064 proto_item_append_text(item->parent, ": %s", str);
6067 static int
6068 dissect_NOTIFY_INFO_DATA_job(tvbuff_t *tvb, int offset, packet_info *pinfo,
6069 proto_tree *tree, proto_item *item, dcerpc_info *di, uint8_t *drep,
6070 uint16_t field)
6072 uint32_t value1;
6073 proto_item *hidden_item;
6075 switch (field) {
6077 /* String notify data */
6079 case JOB_NOTIFY_PRINTER_NAME:
6080 case JOB_NOTIFY_MACHINE_NAME:
6081 case JOB_NOTIFY_PORT_NAME:
6082 case JOB_NOTIFY_USER_NAME:
6083 case JOB_NOTIFY_NOTIFY_NAME:
6084 case JOB_NOTIFY_DATATYPE:
6085 case JOB_NOTIFY_PRINT_PROCESSOR:
6086 case JOB_NOTIFY_PARAMETERS:
6087 case JOB_NOTIFY_DRIVER_NAME:
6088 case JOB_NOTIFY_STATUS_STRING:
6089 case JOB_NOTIFY_DOCUMENT:
6091 offset = dissect_ndr_uint32(
6092 tvb, offset, pinfo, tree, di, drep,
6093 hf_notify_info_data_bufsize, &value1);
6095 offset = dissect_ndr_pointer_cb(
6096 tvb, offset, pinfo, tree, di, drep,
6097 dissect_notify_info_data_buffer,
6098 NDR_POINTER_UNIQUE, "String",
6099 hf_notify_info_data_buffer,
6100 cb_notify_str_postprocess,
6101 GINT_TO_POINTER(job_notify_hf_index(field)));
6103 break;
6105 case JOB_NOTIFY_STATUS:
6106 offset = dissect_job_status(
6107 tvb, offset, pinfo, tree, di, drep);
6109 offset = dissect_ndr_uint32(
6110 tvb, offset, pinfo, NULL, di, drep,
6111 hf_notify_info_data_value2, NULL);
6113 break;
6115 case JOB_NOTIFY_SUBMITTED:
6117 /* SYSTEM_TIME */
6119 offset = dissect_ndr_uint32(
6120 tvb, offset, pinfo, tree, di, drep,
6121 hf_notify_info_data_buffer_len, NULL);
6123 offset = dissect_ndr_pointer_cb(
6124 tvb, offset, pinfo, tree, di, drep,
6125 dissect_SYSTEM_TIME_ptr, NDR_POINTER_UNIQUE,
6126 "Time submitted", -1, notify_job_time_cb, NULL);
6128 break;
6130 case JOB_NOTIFY_PRIORITY:
6131 case JOB_NOTIFY_POSITION:
6132 case JOB_NOTIFY_TOTAL_PAGES:
6133 case JOB_NOTIFY_PAGES_PRINTED:
6134 case JOB_NOTIFY_TOTAL_BYTES:
6135 case JOB_NOTIFY_BYTES_PRINTED: {
6136 uint32_t value;
6138 offset = dissect_ndr_uint32(
6139 tvb, offset, pinfo, tree, di, drep,
6140 hf_notify_info_data_value1, &value);
6142 offset = dissect_ndr_uint32(
6143 tvb, offset, pinfo, tree, di, drep,
6144 hf_notify_info_data_value2, NULL);
6146 proto_item_append_text(item, ": %d", value);
6148 hidden_item = proto_tree_add_uint(
6149 tree, job_notify_hf_index(field), tvb,
6150 offset, 4, value);
6151 proto_item_set_hidden(hidden_item);
6153 break;
6156 /* Unknown notify data */
6158 case JOB_NOTIFY_DEVMODE:
6160 offset = dissect_ndr_uint32(
6161 tvb, offset, pinfo, tree, di, drep,
6162 hf_notify_info_data_bufsize, &value1);
6164 offset = dissect_ndr_pointer(
6165 tvb, offset, pinfo, tree, di, drep,
6166 dissect_notify_info_data_buffer,
6167 NDR_POINTER_UNIQUE, "Buffer",
6168 hf_notify_info_data_buffer);
6170 break;
6172 default:
6173 offset = dissect_ndr_uint32(
6174 tvb, offset, pinfo, tree, di, drep,
6175 hf_notify_info_data_value1, NULL);
6177 offset = dissect_ndr_uint32(
6178 tvb, offset, pinfo, tree, di, drep,
6179 hf_notify_info_data_value2, NULL);
6181 return offset;
6184 static int ett_NOTIFY_INFO_DATA;
6186 static int
6187 dissect_NOTIFY_INFO_DATA(tvbuff_t *tvb, int offset, packet_info *pinfo,
6188 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
6190 proto_item *item;
6191 proto_tree *subtree;
6192 uint32_t count;
6193 uint16_t type, field;
6194 const char *field_string;
6196 subtree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_NOTIFY_INFO_DATA, &item, "");
6198 offset = dissect_ndr_uint16(
6199 tvb, offset, pinfo, subtree, di, drep,
6200 hf_notify_info_data_type, &type);
6202 offset = dissect_notify_field(
6203 tvb, offset, pinfo, subtree, di, drep, type, &field);
6205 switch(type) {
6206 case PRINTER_NOTIFY_TYPE:
6207 field_string = val_to_str_ext(
6208 field, &printer_notify_option_data_vals_ext,
6209 "Unknown (%d)");
6210 break;
6211 case JOB_NOTIFY_TYPE:
6212 field_string = val_to_str_ext(
6213 field, &job_notify_option_data_vals_ext,
6214 "Unknown (%d)");
6215 break;
6216 default:
6217 field_string = "Unknown field";
6218 break;
6221 proto_item_append_text(
6222 item, "%s, %s",
6223 val_to_str(type, printer_notify_types, "Unknown (%d)"),
6224 field_string);
6226 offset = dissect_ndr_uint32(
6227 tvb, offset, pinfo, subtree, di, drep,
6228 hf_notify_info_data_count, &count);
6230 offset = dissect_ndr_uint32(
6231 tvb, offset, pinfo, subtree, di, drep,
6232 hf_notify_info_data_id, NULL);
6234 offset = dissect_ndr_uint32(
6235 tvb, offset, pinfo, subtree, di, drep,
6236 hf_notify_info_data_count, NULL);
6238 /* The value here depends on (type, field) */
6240 switch (type) {
6241 case PRINTER_NOTIFY_TYPE:
6242 offset = dissect_NOTIFY_INFO_DATA_printer(
6243 tvb, offset, pinfo, subtree, item, di, drep, field);
6244 break;
6245 case JOB_NOTIFY_TYPE:
6246 offset = dissect_NOTIFY_INFO_DATA_job(
6247 tvb, offset, pinfo, subtree, item, di, drep, field);
6248 break;
6249 default:
6250 expert_add_info(pinfo, item, &ei_notify_info_data_type);
6251 break;
6254 return offset;
6258 dissect_NOTIFY_INFO(tvbuff_t *tvb, int offset, packet_info *pinfo,
6259 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
6261 uint32_t count;
6263 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
6264 hf_notify_info_version, NULL);
6266 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
6267 hf_notify_info_flags, NULL);
6269 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
6270 hf_notify_info_count, &count);
6272 if (!di->conformant_run)
6273 col_append_fstr(
6274 pinfo->cinfo, COL_INFO, ", %d %s", count,
6275 notify_plural(count));
6277 offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, di, drep,
6278 dissect_NOTIFY_INFO_DATA);
6280 return offset;
6284 * RFNPCNEX
6287 static int
6288 SpoolssRFNPCNEX_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
6289 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
6291 uint32_t changeid;
6293 /* Parse packet */
6295 offset = dissect_nt_policy_hnd(
6296 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
6297 PIDL_POLHND_USE);
6299 offset = dissect_ndr_uint32(
6300 tvb, offset, pinfo, tree, di, drep, hf_rrpcn_changelow, &changeid);
6302 col_append_fstr(
6303 pinfo->cinfo, COL_INFO, ", changeid %d", changeid);
6305 offset = dissect_ndr_pointer(
6306 tvb, offset, pinfo, tree, di, drep,
6307 dissect_NOTIFY_OPTIONS_ARRAY_CTR, NDR_POINTER_UNIQUE,
6308 "Notify Options Array Container", -1);
6310 return offset;
6313 static int
6314 SpoolssRFNPCNEX_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
6315 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
6317 /* Parse packet */
6319 offset = dissect_ndr_pointer(
6320 tvb, offset, pinfo, tree, di, drep,
6321 dissect_NOTIFY_INFO, NDR_POINTER_UNIQUE,
6322 "Notify Info", -1);
6324 offset = dissect_doserror(
6325 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
6327 return offset;
6331 * RRPCN
6334 static int
6335 SpoolssRRPCN_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
6336 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
6338 uint32_t changeid;
6340 /* Parse packet */
6342 offset = dissect_nt_policy_hnd(
6343 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
6344 PIDL_POLHND_USE);
6346 offset = dissect_ndr_uint32(
6347 tvb, offset, pinfo, tree, di, drep, hf_rrpcn_changelow, &changeid);
6349 col_append_fstr(
6350 pinfo->cinfo, COL_INFO, ", changeid %d", changeid);
6352 offset = dissect_ndr_uint32(
6353 tvb, offset, pinfo, tree, di, drep, hf_rrpcn_changehigh, NULL);
6355 offset = dissect_ndr_uint32(
6356 tvb, offset, pinfo, tree, di, drep, hf_rrpcn_unk0, NULL);
6358 offset = dissect_ndr_uint32(
6359 tvb, offset, pinfo, tree, di, drep, hf_rrpcn_unk1, NULL);
6361 offset = dissect_ndr_pointer(
6362 tvb, offset, pinfo, tree, di, drep,
6363 dissect_NOTIFY_INFO, NDR_POINTER_UNIQUE,
6364 "Notify Info", -1);
6366 /* Notify info */
6368 return offset;
6371 static int
6372 SpoolssRRPCN_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
6373 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
6375 /* Parse packet */
6377 offset = dissect_ndr_uint32(
6378 tvb, offset, pinfo, tree, di, drep, hf_rrpcn_unk0, NULL);
6380 offset = dissect_doserror(
6381 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
6383 return offset;
6387 * ReplyClosePrinter
6390 static int
6391 SpoolssReplyClosePrinter_q(tvbuff_t *tvb, int offset,
6392 packet_info *pinfo, proto_tree *tree,
6393 dcerpc_info *di, uint8_t *drep)
6395 /* Parse packet */
6397 offset = dissect_nt_policy_hnd(
6398 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
6399 PIDL_POLHND_CLOSE);
6401 return offset;
6404 static int
6405 SpoolssReplyClosePrinter_r(tvbuff_t *tvb, int offset,
6406 packet_info *pinfo, proto_tree *tree,
6407 dcerpc_info *di, uint8_t *drep)
6409 /* Parse packet */
6411 offset = dissect_nt_policy_hnd(
6412 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
6413 PIDL_POLHND_USE);
6415 offset = dissect_doserror(
6416 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
6418 return offset;
6422 * FCPN
6425 static int
6426 SpoolssFCPN_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
6427 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
6429 /* Parse packet */
6431 offset = dissect_nt_policy_hnd(
6432 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
6433 PIDL_POLHND_USE);
6435 return offset;
6438 static int
6439 SpoolssFCPN_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
6440 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
6442 /* Parse packet */
6444 offset = dissect_doserror(
6445 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
6447 return offset;
6451 * RouterReplyPrinter
6454 static int hf_routerreplyprinter_condition;
6455 static int hf_routerreplyprinter_unknown1;
6456 static int hf_routerreplyprinter_changeid;
6458 static int
6459 SpoolssRouterReplyPrinter_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
6460 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
6462 /* Parse packet */
6464 offset = dissect_nt_policy_hnd(
6465 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
6466 PIDL_POLHND_USE);
6468 offset = dissect_ndr_uint32(
6469 tvb, offset, pinfo, tree, di, drep,
6470 hf_routerreplyprinter_condition, NULL);
6472 offset = dissect_ndr_uint32(
6473 tvb, offset, pinfo, tree, di, drep,
6474 hf_routerreplyprinter_unknown1, NULL);
6476 offset = dissect_ndr_uint32(
6477 tvb, offset, pinfo, tree, di, drep,
6478 hf_routerreplyprinter_changeid, NULL);
6480 return offset;
6483 static int
6484 SpoolssRouterReplyPrinter_r(tvbuff_t *tvb, int offset, packet_info *pinfo,
6485 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
6487 /* Parse packet */
6489 offset = dissect_doserror(
6490 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
6492 return offset;
6495 static int hf_keybuffer_size;
6497 static int
6498 dissect_spoolss_keybuffer(tvbuff_t *tvb, int offset, packet_info *pinfo,
6499 proto_tree *tree, dcerpc_info *di, uint8_t *drep)
6501 uint32_t size;
6502 int end_offset;
6504 if (di->conformant_run)
6505 return offset;
6507 /* Dissect size and data */
6509 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
6510 hf_keybuffer_size, &size);
6512 end_offset = offset + (size*2);
6513 if (end_offset < offset) {
6515 * Overflow - make the end offset one past the end of
6516 * the packet data, so we throw an exception (as the
6517 * size is almost certainly too big).
6519 end_offset = tvb_reported_length_remaining(tvb, offset) + 1;
6522 while (offset > 0 && offset < end_offset) {
6523 offset = dissect_spoolss_uint16uni(
6524 tvb, offset, pinfo, tree, drep, NULL, hf_keybuffer);
6527 return offset;
6531 static int
6532 SpoolssEnumPrinterKey_q(tvbuff_t *tvb, int offset,
6533 packet_info *pinfo, proto_tree *tree,
6534 dcerpc_info *di, uint8_t *drep)
6536 char *key_name;
6538 /* Parse packet */
6540 offset = dissect_nt_policy_hnd(
6541 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
6542 PIDL_POLHND_USE);
6544 offset = dissect_ndr_cvstring(
6545 tvb, offset, pinfo, tree, di, drep, sizeof(uint16_t),
6546 hf_printerdata_key, true, &key_name);
6548 if (!key_name[0])
6549 key_name = "\"\"";
6551 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", key_name);
6553 offset = dissect_ndr_uint32(
6554 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
6556 return offset;
6559 static int
6560 SpoolssEnumPrinterKey_r(tvbuff_t *tvb, int offset,
6561 packet_info *pinfo, proto_tree *tree,
6562 dcerpc_info *di, uint8_t *drep)
6564 /* Parse packet */
6566 offset = dissect_spoolss_keybuffer(tvb, offset, pinfo, tree, di, drep);
6568 offset = dissect_ndr_uint32(
6569 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
6571 offset = dissect_doserror(
6572 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
6574 return offset;
6577 static int hf_enumprinterdataex_name_offset;
6578 static int hf_enumprinterdataex_name_len;
6579 static int hf_enumprinterdataex_name;
6580 static int hf_enumprinterdataex_val_offset;
6581 static int hf_enumprinterdataex_val_len;
6582 static int hf_enumprinterdataex_val_dword_low;
6583 static int hf_enumprinterdataex_val_dword_high;
6584 static int hf_enumprinterdataex_value_null;
6585 static int hf_enumprinterdataex_value_uint;
6586 static int hf_enumprinterdataex_value_binary;
6587 static int hf_enumprinterdataex_value_multi_sz;
6589 static int
6590 SpoolssEnumPrinterDataEx_q(tvbuff_t *tvb, int offset,
6591 packet_info *pinfo, proto_tree *tree,
6592 dcerpc_info *di, uint8_t *drep)
6594 char *key_name;
6595 proto_item *hidden_item;
6597 hidden_item = proto_tree_add_uint(
6598 tree, hf_printerdata, tvb, offset, 0, 1);
6599 proto_item_set_hidden(hidden_item);
6601 /* Parse packet */
6603 offset = dissect_nt_policy_hnd(
6604 tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
6605 PIDL_POLHND_USE);
6607 offset = dissect_ndr_cvstring(
6608 tvb, offset, pinfo, tree, di, drep, sizeof(uint16_t),
6609 hf_printerdata_key, true, &key_name);
6611 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", key_name);
6613 offset = dissect_ndr_uint32(
6614 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
6616 return offset;
6619 static int ett_printer_enumdataex_value;
6621 static int
6622 dissect_spoolss_printer_enum_values(tvbuff_t *tvb, int offset,
6623 packet_info *pinfo, proto_tree *tree,
6624 dcerpc_info *di, uint8_t *drep)
6626 uint32_t start_offset = offset;
6627 uint32_t name_offset, name_len, val_offset, val_len, val_type;
6628 char *name;
6629 proto_item *item;
6630 proto_tree *subtree;
6632 /* Get offset of value name */
6634 offset = dissect_ndr_uint32(
6635 tvb, offset, pinfo, NULL, di, drep,
6636 hf_enumprinterdataex_name_offset, &name_offset);
6638 offset = dissect_ndr_uint32(
6639 tvb, offset, pinfo, NULL, di, drep,
6640 hf_enumprinterdataex_name_len, &name_len);
6642 dissect_spoolss_uint16uni(
6643 tvb, start_offset + name_offset, pinfo, NULL, drep,
6644 &name, hf_enumprinterdataex_name);
6646 subtree = proto_tree_add_subtree_format(tree, tvb, offset, 0, ett_printer_enumdataex_value, &item, "Name: %s", name);
6648 proto_tree_add_uint(subtree, hf_enumprinterdataex_name_offset, tvb, offset - 8, 4, name_offset);
6650 proto_tree_add_uint(subtree, hf_enumprinterdataex_name_len, tvb, offset - 4, 4, name_len);
6652 proto_tree_add_string( subtree, hf_enumprinterdataex_name, tvb, start_offset + name_offset, ((int)strlen(name) + 1) * 2, name);
6654 offset = dissect_ndr_uint32(
6655 tvb, offset, pinfo, subtree, di, drep, hf_printerdata_type,
6656 &val_type);
6658 offset = dissect_ndr_uint32(
6659 tvb, offset, pinfo, subtree, di, drep,
6660 hf_enumprinterdataex_val_offset, &val_offset);
6662 offset = dissect_ndr_uint32(
6663 tvb, offset, pinfo, subtree, di, drep,
6664 hf_enumprinterdataex_val_len, &val_len);
6666 if (val_len == 0) {
6667 proto_tree_add_uint_format_value(subtree, hf_enumprinterdataex_value_null, tvb, start_offset + val_offset, 4, 0, "(null)");
6668 return offset;
6671 switch(val_type) {
6672 case DCERPC_REG_DWORD: {
6673 uint32_t value;
6674 uint16_t low, high;
6675 int offset2 = start_offset + val_offset;
6677 /* Needs to be broken into two 16-byte ints because it may
6678 not be aligned. */
6680 offset2 = dissect_ndr_uint16(
6681 tvb, offset2, pinfo, subtree, di, drep,
6682 hf_enumprinterdataex_val_dword_low, &low);
6684 /*offset2 = */dissect_ndr_uint16(
6685 tvb, offset2, pinfo, subtree, di, drep,
6686 hf_enumprinterdataex_val_dword_high, &high);
6688 value = (high << 16) | low;
6690 proto_tree_add_uint(subtree, hf_enumprinterdataex_value_uint, tvb, start_offset + val_offset, 4, value);
6692 proto_item_append_text(item, ", Value: %d", value);
6694 break;
6696 case DCERPC_REG_SZ: {
6697 char *value;
6699 dissect_spoolss_uint16uni(
6700 tvb, start_offset + val_offset, pinfo, subtree, drep,
6701 &value, hf_value_string);
6703 proto_item_append_text(item, ", Value: %s", value);
6705 break;
6707 case DCERPC_REG_BINARY:
6709 /* FIXME: nicer way to display this */
6711 proto_tree_add_bytes_format_value( subtree, hf_enumprinterdataex_value_binary, tvb, start_offset + val_offset, val_len, NULL, "<binary data>");
6712 break;
6714 case DCERPC_REG_MULTI_SZ:
6716 /* FIXME: implement REG_MULTI_SZ support */
6718 proto_tree_add_bytes_format_value(subtree, hf_enumprinterdataex_value_multi_sz, tvb, start_offset + val_offset, val_len, NULL, "<REG_MULTI_SZ not implemented>");
6719 break;
6721 default:
6722 proto_tree_add_expert_format( subtree, pinfo, &ei_enumprinterdataex_value, tvb, start_offset + val_offset, val_len, "%s: unknown type %d", name, val_type);
6725 return offset;
6728 static int ett_PRINTER_DATA_CTR;
6730 static int
6731 SpoolssEnumPrinterDataEx_r(tvbuff_t *tvb, int offset,
6732 packet_info *pinfo, proto_tree *tree,
6733 dcerpc_info *di, uint8_t *drep)
6735 uint32_t size, num_values;
6736 proto_item *hidden_item;
6738 hidden_item = proto_tree_add_uint(
6739 tree, hf_printerdata, tvb, offset, 0, 1);
6740 proto_item_set_hidden(hidden_item);
6742 /* Parse packet */
6744 offset = dissect_ndr_uint32(
6745 tvb, offset, pinfo, tree, di, drep,
6746 hf_buffer_size, &size);
6748 dissect_ndr_uint32(
6749 tvb, offset + size + 4, pinfo, NULL, di, drep, hf_returned,
6750 &num_values);
6752 if (size) {
6753 proto_tree *subtree;
6754 int offset2 = offset;
6755 uint32_t i;
6757 subtree = proto_tree_add_subtree(
6758 tree, tvb, offset, 0, ett_PRINTER_DATA_CTR, NULL, "Printer data");
6760 for (i=0; i < num_values; i++)
6761 offset2 = dissect_spoolss_printer_enum_values(
6762 tvb, offset2, pinfo, subtree, di, drep);
6765 offset += size;
6767 offset = dissect_ndr_uint32(
6768 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
6770 offset = dissect_ndr_uint32(
6771 tvb, offset, pinfo, tree, di, drep, hf_returned, NULL);
6773 offset = dissect_doserror(
6774 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
6776 return offset;
6779 static int
6780 SpoolssGetPrinterDriverDirectory_q(tvbuff_t *tvb, int offset,
6781 packet_info *pinfo, proto_tree *tree,
6782 dcerpc_info *di, uint8_t *drep)
6784 uint32_t level;
6786 /* Parse packet */
6788 offset = dissect_ndr_str_pointer_item(
6789 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE,
6790 "Name", hf_servername, 0);
6792 offset = dissect_ndr_str_pointer_item(
6793 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE,
6794 "Environment", hf_environment, 0);
6796 offset = dissect_ndr_uint32(
6797 tvb, offset, pinfo, tree, di, drep, hf_level, &level);
6799 offset = dissect_spoolss_buffer(
6800 tvb, offset, pinfo, tree, di, drep, NULL);
6802 offset = dissect_ndr_uint32(
6803 tvb, offset, pinfo, tree, di, drep, hf_offered, NULL);
6805 return offset;
6808 static int
6809 SpoolssGetPrinterDriverDirectory_r(tvbuff_t *tvb, int offset,
6810 packet_info *pinfo, proto_tree *tree,
6811 dcerpc_info *di, uint8_t *drep)
6813 /* Parse packet */
6815 offset = dissect_spoolss_string_parm(
6816 tvb, offset, pinfo, tree, di, drep, "Directory");
6818 offset = dissect_ndr_uint32(
6819 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
6821 offset = dissect_doserror(
6822 tvb, offset, pinfo, tree, di, drep, hf_rc, NULL);
6824 return offset;
6827 static int
6828 SpoolssGetCorePrinterDrivers_q(tvbuff_t *tvb, int offset,
6829 packet_info *pinfo, proto_tree *tree,
6830 dcerpc_info *di, uint8_t *drep)
6832 /* Parse packet */
6834 offset = dissect_ndr_str_pointer_item(
6835 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE,
6836 "Name", hf_servername, 0);
6838 offset = dissect_ndr_str_pointer_item(
6839 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_REF,
6840 "Environment", hf_environment, 0);
6842 offset = dissect_ndr_uint32(
6843 tvb, offset, pinfo, tree, di, drep,
6844 hf_offered, NULL);
6845 #if 1
6846 offset = dissect_spoolss_keybuffer(
6847 tvb, offset, pinfo, tree, di, drep);
6848 #else
6849 offset = dissect_ndr_uint32(
6850 tvb, offset, pinfo, tree, di, drep,
6851 hf_core_driver_size, NULL);
6853 offset = dissect_spoolss_uint16uni(
6854 tvb, offset, pinfo, tree, drep,
6855 NULL, hf_core_printer_driver_ids);
6856 #endif
6857 offset = dissect_ndr_uint32(
6858 tvb, offset, pinfo, tree, di, drep,
6859 hf_core_printer_driver_count, NULL);
6861 return offset;
6864 static int
6865 SpoolssGetCorePrinterDrivers_r(tvbuff_t *tvb, int offset,
6866 packet_info *pinfo, proto_tree *tree,
6867 dcerpc_info *di, uint8_t *drep)
6869 uint32_t num_drivers, i;
6871 /* Parse packet */
6873 offset = dissect_ndr_uint32(
6874 tvb, offset, pinfo, tree, di, drep,
6875 hf_core_printer_driver_count,
6876 &num_drivers);
6878 offset = dissect_ndr_uint32(
6879 tvb, offset, pinfo, tree, di, drep, hf_core_printer_driver_ids,
6880 NULL);
6882 for (i = 0; i < num_drivers; i++) {
6883 offset = dissect_CORE_PRINTER_DRIVER(
6884 tvb, offset, pinfo,
6885 tree, di, drep);
6888 offset = dissect_hresult(
6889 tvb, offset, pinfo, tree, di, drep, hf_hresult, NULL);
6891 return offset;
6894 static int
6895 SpoolssGetPrinterDriverPackagePath_q(tvbuff_t *tvb, int offset,
6896 packet_info *pinfo, proto_tree *tree,
6897 dcerpc_info *di, uint8_t *drep)
6899 /* Parse packet */
6901 offset = dissect_ndr_str_pointer_item(
6902 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE,
6903 "Name", hf_servername, 0);
6905 offset = dissect_ndr_str_pointer_item(
6906 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_REF,
6907 "Environment", hf_environment, 0);
6909 offset = dissect_ndr_str_pointer_item(
6910 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE,
6911 "Language", hf_language, 0);
6913 offset = dissect_ndr_str_pointer_item(
6914 tvb, offset, pinfo, tree, di, drep, NDR_POINTER_REF,
6915 "PackageId", hf_package_id, 0);
6917 offset = dissect_spoolss_buffer(
6918 tvb, offset, pinfo, tree, di, drep, NULL);
6920 offset = dissect_ndr_uint32(
6921 tvb, offset, pinfo, tree, di, drep,
6922 hf_driver_package_cab_size, NULL);
6924 return offset;
6927 static int
6928 SpoolssGetPrinterDriverPackagePath_r(tvbuff_t *tvb, int offset,
6929 packet_info *pinfo, proto_tree *tree,
6930 dcerpc_info *di, uint8_t *drep)
6932 /* Parse packet */
6934 offset = dissect_spoolss_string_parm(
6935 tvb, offset, pinfo, tree, di, drep, "DriverPackageCab");
6937 offset = dissect_ndr_uint32(
6938 tvb, offset, pinfo, tree, di, drep, hf_needed, NULL);
6940 offset = dissect_hresult(
6941 tvb, offset, pinfo, tree, di, drep, hf_hresult, NULL);
6943 return offset;
6947 * List of subdissectors for this pipe.
6950 static const dcerpc_sub_dissector dcerpc_spoolss_dissectors[] = {
6951 { SPOOLSS_ENUMPRINTERS, "EnumPrinters",
6952 SpoolssEnumPrinters_q, SpoolssEnumPrinters_r },
6953 { SPOOLSS_OPENPRINTER, "OpenPrinter",
6954 NULL, SpoolssGeneric_r },
6955 { SPOOLSS_SETJOB, "SetJob",
6956 SpoolssSetJob_q, SpoolssSetJob_r },
6957 { SPOOLSS_GETJOB, "GetJob",
6958 SpoolssGetJob_q, SpoolssGetJob_r },
6959 { SPOOLSS_ENUMJOBS, "EnumJobs",
6960 SpoolssEnumJobs_q, SpoolssEnumJobs_r },
6961 { SPOOLSS_ADDPRINTER, "AddPrinter",
6962 NULL, SpoolssGeneric_r },
6963 { SPOOLSS_DELETEPRINTER, "DeletePrinter",
6964 SpoolssDeletePrinter_q, SpoolssDeletePrinter_r },
6965 { SPOOLSS_SETPRINTER, "SetPrinter",
6966 SpoolssSetPrinter_q, SpoolssSetPrinter_r },
6967 { SPOOLSS_GETPRINTER, "GetPrinter",
6968 SpoolssGetPrinter_q, SpoolssGetPrinter_r },
6969 { SPOOLSS_ADDPRINTERDRIVER, "AddPrinterDriver",
6970 NULL, SpoolssAddPrinterDriver_r },
6971 { SPOOLSS_ENUMPRINTERDRIVERS, "EnumPrinterDrivers",
6972 SpoolssEnumPrinterDrivers_q, SpoolssEnumPrinterDrivers_r },
6973 { SPOOLSS_GETPRINTERDRIVER, "GetPrinterDriver",
6974 NULL, SpoolssGeneric_r },
6975 { SPOOLSS_GETPRINTERDRIVERDIRECTORY, "GetPrinterDriverDirectory",
6976 SpoolssGetPrinterDriverDirectory_q, SpoolssGetPrinterDriverDirectory_r },
6977 { SPOOLSS_DELETEPRINTERDRIVER, "DeletePrinterDriver",
6978 NULL, SpoolssGeneric_r },
6979 { SPOOLSS_ADDPRINTPROCESSOR, "AddPrintProcessor",
6980 NULL, SpoolssGeneric_r },
6981 { SPOOLSS_ENUMPRINTPROCESSORS, "EnumPrintProcessor",
6982 NULL, SpoolssGeneric_r },
6983 { SPOOLSS_GETPRINTPROCESSORDIRECTORY, "GetPrintProcessorDirectory",
6984 NULL, SpoolssGeneric_r },
6985 { SPOOLSS_STARTDOCPRINTER, "StartDocPrinter",
6986 SpoolssStartDocPrinter_q, SpoolssStartDocPrinter_r },
6987 { SPOOLSS_STARTPAGEPRINTER, "StartPagePrinter",
6988 SpoolssStartPagePrinter_q, SpoolssStartPagePrinter_r },
6989 { SPOOLSS_WRITEPRINTER, "WritePrinter",
6990 SpoolssWritePrinter_q, SpoolssWritePrinter_r },
6991 { SPOOLSS_ENDPAGEPRINTER, "EndPagePrinter",
6992 SpoolssEndPagePrinter_q, SpoolssEndPagePrinter_r },
6993 { SPOOLSS_ABORTPRINTER, "AbortPrinter",
6994 NULL, SpoolssGeneric_r },
6995 { SPOOLSS_READPRINTER, "ReadPrinter",
6996 NULL, SpoolssGeneric_r },
6997 { SPOOLSS_ENDDOCPRINTER, "EndDocPrinter",
6998 SpoolssEndDocPrinter_q, SpoolssEndDocPrinter_r },
6999 { SPOOLSS_ADDJOB, "AddJob",
7000 NULL, SpoolssGeneric_r },
7001 { SPOOLSS_SCHEDULEJOB, "ScheduleJob",
7002 NULL, SpoolssGeneric_r },
7003 { SPOOLSS_GETPRINTERDATA, "GetPrinterData",
7004 SpoolssGetPrinterData_q, SpoolssGetPrinterData_r },
7005 { SPOOLSS_SETPRINTERDATA, "SetPrinterData",
7006 SpoolssSetPrinterData_q, SpoolssSetPrinterData_r },
7007 { SPOOLSS_WAITFORPRINTERCHANGE, "WaitForPrinterChange",
7008 NULL, SpoolssGeneric_r },
7009 { SPOOLSS_CLOSEPRINTER, "ClosePrinter",
7010 SpoolssClosePrinter_q, SpoolssClosePrinter_r },
7011 { SPOOLSS_ADDFORM, "AddForm",
7012 SpoolssAddForm_q, SpoolssAddForm_r },
7013 { SPOOLSS_DELETEFORM, "DeleteForm",
7014 SpoolssDeleteForm_q, SpoolssDeleteForm_r },
7015 { SPOOLSS_GETFORM, "GetForm",
7016 SpoolssGetForm_q, SpoolssGetForm_r },
7017 { SPOOLSS_SETFORM, "SetForm",
7018 SpoolssSetForm_q, SpoolssSetForm_r },
7019 { SPOOLSS_ENUMFORMS, "EnumForms",
7020 SpoolssEnumForms_q, SpoolssEnumForms_r },
7021 { SPOOLSS_ENUMPORTS, "EnumPorts",
7022 NULL, SpoolssGeneric_r },
7023 { SPOOLSS_ENUMMONITORS, "EnumMonitors",
7024 NULL, SpoolssGeneric_r },
7025 { SPOOLSS_ADDPORT, "AddPort",
7026 NULL, SpoolssGeneric_r },
7027 { SPOOLSS_CONFIGUREPORT, "ConfigurePort",
7028 NULL, SpoolssGeneric_r },
7029 { SPOOLSS_DELETEPORT, "DeletePort",
7030 NULL, SpoolssGeneric_r },
7031 { SPOOLSS_CREATEPRINTERIC, "CreatePrinterIC",
7032 NULL, SpoolssGeneric_r },
7033 { SPOOLSS_PLAYGDISCRIPTONPRINTERIC, "PlayDiscriptOnPrinterIC",
7034 NULL, SpoolssGeneric_r },
7035 { SPOOLSS_DELETEPRINTERIC, "DeletePrinterIC",
7036 NULL, SpoolssGeneric_r },
7037 { SPOOLSS_ADDPRINTERCONNECTION, "AddPrinterConnection",
7038 NULL, SpoolssGeneric_r },
7039 { SPOOLSS_DELETEPRINTERCONNECTION, "DeletePrinterConnection",
7040 NULL, SpoolssGeneric_r },
7041 { SPOOLSS_PRINTERMESSAGEBOX, "PrinterMessageBox",
7042 NULL, SpoolssGeneric_r },
7043 { SPOOLSS_ADDMONITOR, "AddMonitor",
7044 NULL, SpoolssGeneric_r },
7045 { SPOOLSS_DELETEMONITOR, "DeleteMonitor",
7046 NULL, SpoolssGeneric_r },
7047 { SPOOLSS_DELETEPRINTPROCESSOR, "DeletePrintProcessor",
7048 NULL, SpoolssGeneric_r },
7049 { SPOOLSS_ADDPRINTPROVIDER, "AddPrintProvider",
7050 NULL, SpoolssGeneric_r },
7051 { SPOOLSS_DELETEPRINTPROVIDER, "DeletePrintProvider",
7052 NULL, SpoolssGeneric_r },
7053 { SPOOLSS_ENUMPRINTPROCDATATYPES, "EnumPrintProcDataTypes",
7054 NULL, SpoolssGeneric_r },
7055 { SPOOLSS_RESETPRINTER, "ResetPrinter",
7056 NULL, SpoolssGeneric_r },
7057 { SPOOLSS_GETPRINTERDRIVER2, "GetPrinterDriver2",
7058 SpoolssGetPrinterDriver2_q, SpoolssGetPrinterDriver2_r },
7059 { SPOOLSS_FINDFIRSTPRINTERCHANGENOTIFICATION,
7060 "FindFirstPrinterChangeNotification",
7061 NULL, SpoolssGeneric_r },
7062 { SPOOLSS_FINDNEXTPRINTERCHANGENOTIFICATION,
7063 "FindNextPrinterChangeNotification",
7064 NULL, SpoolssGeneric_r },
7065 { SPOOLSS_FCPN, "FCPN",
7066 SpoolssFCPN_q, SpoolssFCPN_r },
7067 { SPOOLSS_ROUTERFINDFIRSTPRINTERNOTIFICATIONOLD,
7068 "RouterFindFirstPrinterNotificationOld",
7069 NULL, SpoolssGeneric_r },
7070 { SPOOLSS_REPLYOPENPRINTER, "ReplyOpenPrinter",
7071 SpoolssReplyOpenPrinter_q, SpoolssReplyOpenPrinter_r },
7072 { SPOOLSS_ROUTERREPLYPRINTER, "RouterReplyPrinter",
7073 SpoolssRouterReplyPrinter_q, SpoolssRouterReplyPrinter_r },
7074 { SPOOLSS_REPLYCLOSEPRINTER, "ReplyClosePrinter",
7075 SpoolssReplyClosePrinter_q, SpoolssReplyClosePrinter_r },
7076 { SPOOLSS_ADDPORTEX, "AddPortEx",
7077 NULL, SpoolssGeneric_r },
7078 { SPOOLSS_REMOTEFINDFIRSTPRINTERCHANGENOTIFICATION,
7079 "RemoteFindFirstPrinterChangeNotification",
7080 NULL, SpoolssGeneric_r },
7081 { SPOOLSS_SPOOLERINIT, "SpoolerInit",
7082 NULL, SpoolssGeneric_r },
7083 { SPOOLSS_RESETPRINTEREX, "ResetPrinterEx",
7084 NULL, SpoolssGeneric_r },
7085 { SPOOLSS_RFFPCNEX, "RFFPCNEX",
7086 SpoolssRFFPCNEX_q, SpoolssRFFPCNEX_r },
7087 { SPOOLSS_RRPCN, "RRPCN",
7088 SpoolssRRPCN_q, SpoolssRRPCN_r },
7089 { SPOOLSS_RFNPCNEX, "RFNPCNEX",
7090 SpoolssRFNPCNEX_q, SpoolssRFNPCNEX_r },
7091 { SPOOLSS_OPENPRINTEREX, "OpenPrinterEx",
7092 SpoolssOpenPrinterEx_q, SpoolssOpenPrinterEx_r },
7093 { SPOOLSS_ADDPRINTEREX, "AddPrinterEx",
7094 NULL, SpoolssAddPrinterEx_r },
7095 { SPOOLSS_ENUMPRINTERDATA, "EnumPrinterData",
7096 SpoolssEnumPrinterData_q, SpoolssEnumPrinterData_r },
7097 { SPOOLSS_DELETEPRINTERDATA, "DeletePrinterData",
7098 SpoolssDeletePrinterData_q, SpoolssDeletePrinterData_r },
7099 { SPOOLSS_GETPRINTERDATAEX, "GetPrinterDataEx",
7100 SpoolssGetPrinterDataEx_q, SpoolssGetPrinterDataEx_r },
7101 { SPOOLSS_SETPRINTERDATAEX, "SetPrinterDataEx",
7102 SpoolssSetPrinterDataEx_q, SpoolssSetPrinterDataEx_r },
7103 { SPOOLSS_ENUMPRINTERDATAEX, "EnumPrinterDataEx",
7104 SpoolssEnumPrinterDataEx_q, SpoolssEnumPrinterDataEx_r },
7105 { SPOOLSS_ENUMPRINTERKEY, "EnumPrinterKey",
7106 SpoolssEnumPrinterKey_q, SpoolssEnumPrinterKey_r },
7107 { SPOOLSS_DELETEPRINTERDATAEX, "DeletePrinterDataEx",
7108 NULL, SpoolssGeneric_r },
7109 { SPOOLSS_DELETEPRINTERDRIVEREX, "DeletePrinterDriverEx",
7110 NULL, SpoolssGeneric_r },
7111 { SPOOLSS_ADDPRINTERDRIVEREX, "AddPrinterDriverEx",
7112 NULL, SpoolssGeneric_r },
7113 { SPOOLSS_GETCOREPRINTERDRIVERS, "GetCorePrinterDrivers",
7114 SpoolssGetCorePrinterDrivers_q, SpoolssGetCorePrinterDrivers_r },
7115 { SPOOLSS_GETPRINTERDRIVERPACKAGEPATH, "GetPrinterDriverPackagePath",
7116 SpoolssGetPrinterDriverPackagePath_q, SpoolssGetPrinterDriverPackagePath_r },
7118 { 0, NULL, NULL, NULL },
7122 * Dissector initialisation function
7125 /* Protocol registration */
7127 static int proto_dcerpc_spoolss;
7128 static int ett_dcerpc_spoolss;
7130 void
7131 proto_register_dcerpc_spoolss(void)
7133 static hf_register_info hf[] = {
7135 /* GetPrinterDriver2 */
7137 { &hf_clientmajorversion,
7138 { "Client major version", "spoolss.clientmajorversion", FT_UINT32, BASE_DEC,
7139 NULL, 0x0, "Client printer driver major version", HFILL }},
7140 { &hf_clientminorversion,
7141 { "Client minor version", "spoolss.clientminorversion", FT_UINT32, BASE_DEC,
7142 NULL, 0x0, "Client printer driver minor version", HFILL }},
7143 { &hf_servermajorversion,
7144 { "Server major version", "spoolss.servermajorversion", FT_UINT32, BASE_DEC,
7145 NULL, 0x0, "Server printer driver major version", HFILL }},
7146 { &hf_serverminorversion,
7147 { "Server minor version", "spoolss.serverminorversion", FT_UINT32, BASE_DEC,
7148 NULL, 0x0, "Server printer driver minor version", HFILL }},
7149 { &hf_driverpath,
7150 { "Driver path", "spoolss.driverpath", FT_STRING, BASE_NONE,
7151 NULL, 0, NULL, HFILL }},
7152 { &hf_datafile,
7153 { "Data file", "spoolss.datafile", FT_STRING, BASE_NONE,
7154 NULL, 0, NULL, HFILL }},
7155 { &hf_configfile,
7156 { "Config file", "spoolss.configfile", FT_STRING, BASE_NONE,
7157 NULL, 0, "Printer name", HFILL }},
7158 { &hf_helpfile,
7159 { "Help file", "spoolss.helpfile", FT_STRING, BASE_NONE,
7160 NULL, 0, NULL, HFILL }},
7161 { &hf_monitorname,
7162 { "Monitor name", "spoolss.monitorname", FT_STRING, BASE_NONE,
7163 NULL, 0, NULL, HFILL }},
7164 { &hf_defaultdatatype,
7165 { "Default data type", "spoolss.defaultdatatype", FT_STRING, BASE_NONE,
7166 NULL, 0, NULL, HFILL }},
7167 { &hf_driverinfo_cversion,
7168 { "Driver version", "spoolss.drivercversion", FT_UINT32, BASE_DEC,
7169 VALS(driverinfo_cversion_vals), 0, "Printer name", HFILL }},
7170 { &hf_dependentfiles,
7171 { "Dependent files", "spoolss.dependentfiles", FT_STRING, BASE_NONE,
7172 NULL, 0, NULL, HFILL }},
7174 { &hf_printer_status,
7175 { "Status", "spoolss.printer_status", FT_UINT32, BASE_DEC|BASE_EXT_STRING,
7176 &printer_status_vals_ext, 0, NULL, HFILL }},
7178 { &hf_previousdrivernames,
7179 { "Previous Driver Names", "spoolss.previousdrivernames", FT_STRING, BASE_NONE,
7180 NULL, 0, NULL, HFILL }},
7182 { &hf_color_profiles,
7183 { "Color Profiles", "spoolss.colorprofiles", FT_STRING, BASE_NONE,
7184 NULL, 0, NULL, HFILL }},
7186 { &hf_core_driver_dependencies,
7187 { "Core Driver Dependencies", "spoolss.coredriverdependencies", FT_STRING, BASE_NONE,
7188 NULL, 0, NULL, HFILL }},
7190 { &hf_driverdate,
7191 { "Driver Date", "spoolss.driverdate", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
7192 NULL, 0, "Date of driver creation", HFILL }},
7194 { &hf_min_inbox_driverdate,
7195 { "Min Inbox Driver Date", "spoolss.mininboxdriverdate", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL,
7196 NULL, 0, "Min Inbox Date of driver creation", HFILL }},
7198 { &hf_padding,
7199 { "Padding", "spoolss.padding", FT_UINT32, BASE_HEX,
7200 NULL, 0, "Some padding - conveys no semantic information", HFILL }},
7202 { &hf_driver_version,
7203 { "Driver Version", "spoolss.driverversion", FT_UINT64, BASE_HEX,
7204 NULL, 0, "Driver Version ID", HFILL }},
7206 { &hf_driver_version_low,
7207 { "Minor Driver Version", "spoolss.minordriverversion", FT_UINT32, BASE_HEX,
7208 NULL, 0, "Driver Version Low", HFILL }},
7210 { &hf_driver_version_high,
7211 { "Major Driver Version", "spoolss.majordriverversion", FT_UINT32, BASE_HEX,
7212 NULL, 0, "Driver Version High", HFILL }},
7214 { &hf_min_inbox_driver_version_low,
7215 { "Min Inbox Minor Driver Version", "spoolss.mininboxminordriverversion", FT_UINT32, BASE_HEX,
7216 NULL, 0, "Min Inbox Driver Version Low", HFILL }},
7218 { &hf_min_inbox_driver_version_high,
7219 { "Min Inbox Major Driver Version", "spoolss.mininboxmajordriverversion", FT_UINT32, BASE_HEX,
7220 NULL, 0, "Min Inbox Driver Version High", HFILL }},
7222 { &hf_mfgname,
7223 { "Mfgname", "spoolss.mfgname", FT_STRING, BASE_NONE,
7224 NULL, 0, "Manufacturer Name", HFILL }},
7226 { &hf_oemurl,
7227 { "OEM URL", "spoolss.oemrul", FT_STRING, BASE_NONE,
7228 NULL, 0, "OEM URL - Website of Vendor", HFILL }},
7230 { &hf_hardwareid,
7231 { "Hardware ID", "spoolss.hardwareid", FT_STRING, BASE_NONE,
7232 NULL, 0, "Hardware Identification Information", HFILL }},
7234 { &hf_provider,
7235 { "Provider", "spoolss.provider", FT_STRING, BASE_NONE,
7236 NULL, 0, "Provider of Driver", HFILL }},
7238 /* Setprinter RPC */
7240 { &hf_setprinter_cmd,
7241 { "Command", "spoolss.setprinter_cmd", FT_UINT32, BASE_DEC,
7242 VALS(setprinter_cmd_vals), 0, NULL, HFILL }},
7244 /* Enumprinters */
7246 { &hf_enumprinters_flags,
7247 { "Flags", "spoolss.enumprinters.flags",
7248 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
7250 { &hf_enumprinters_flags_local,
7251 { "Enum local", "spoolss.enumprinters.flags.enum_local",
7252 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7253 PRINTER_ENUM_LOCAL, NULL, HFILL }},
7255 { &hf_enumprinters_flags_name,
7256 { "Enum name", "spoolss.enumprinters.flags.enum_name",
7257 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7258 PRINTER_ENUM_NAME, NULL, HFILL }},
7260 { &hf_enumprinters_flags_shared,
7261 { "Enum shared", "spoolss.enumprinters.flags.enum_shared",
7262 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7263 PRINTER_ENUM_SHARED, NULL, HFILL }},
7265 { &hf_enumprinters_flags_default,
7266 { "Enum default", "spoolss.enumprinters.flags.enum_default",
7267 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7268 PRINTER_ENUM_DEFAULT, NULL, HFILL }},
7270 { &hf_enumprinters_flags_connections,
7271 { "Enum connections", "spoolss.enumprinters.flags.enum_connections",
7272 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7273 PRINTER_ENUM_CONNECTIONS, NULL, HFILL }},
7275 { &hf_enumprinters_flags_network,
7276 { "Enum network", "spoolss.enumprinters.flags.enum_network",
7277 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7278 PRINTER_ENUM_NETWORK, NULL, HFILL }},
7280 { &hf_enumprinters_flags_remote,
7281 { "Enum remote", "spoolss.enumprinters.flags.enum_remote",
7282 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7283 PRINTER_ENUM_REMOTE, NULL, HFILL }},
7285 /* GetPrinter */
7287 { &hf_start_time,
7288 { "Start time", "spoolss.start_time",
7289 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7291 { &hf_end_time,
7292 { "End time", "spoolss.end_time",
7293 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7295 { &hf_elapsed_time,
7296 { "Elapsed time", "spoolss.elapsed_time",
7297 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7299 { &hf_device_not_selected_timeout,
7300 { "Device Not Selected Timeout", "spoolss.device_not_selected_timeout",
7301 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7303 { &hf_transmission_retry_timeout,
7304 { "Transmission Retry Timeout", "spoolss.transmission_retry_timeout",
7305 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7308 * New hf index values
7311 { &hf_opnum,
7312 { "Operation", "spoolss.opnum", FT_UINT16, BASE_DEC,
7313 NULL, 0x0, NULL, HFILL }},
7315 { &hf_hnd,
7316 { "Context handle", "spoolss.hnd", FT_BYTES, BASE_NONE,
7317 NULL, 0x0, "SPOOLSS policy handle", HFILL }},
7319 { &hf_rc,
7320 { "Return code", "spoolss.rc", FT_UINT32, BASE_HEX | BASE_EXT_STRING,
7321 &DOS_errors_ext, 0x0, "SPOOLSS return code", HFILL }},
7323 { &hf_hresult,
7324 { "HRESULT return code", "spoolss.hresult", FT_UINT32, BASE_HEX | BASE_EXT_STRING,
7325 &HRES_errors_ext, 0x0, "SPOOLSS HRESULT return code", HFILL }},
7327 { &hf_offered,
7328 { "Offered", "spoolss.offered", FT_UINT32, BASE_DEC,
7329 NULL, 0x0, "Size of buffer offered in this request",
7330 HFILL }},
7332 { &hf_needed,
7333 { "Needed", "spoolss.needed", FT_UINT32, BASE_DEC,
7334 NULL, 0x0, "Size of buffer required for request", HFILL }},
7336 { &hf_returned,
7337 { "Returned", "spoolss.returned", FT_UINT32, BASE_DEC,
7338 NULL, 0x0, "Number of items returned", HFILL }},
7340 { &hf_buffer_size,
7341 { "Buffer size", "spoolss.buffer.size", FT_UINT32, BASE_DEC,
7342 NULL, 0x0, "Size of buffer", HFILL }},
7344 { &hf_buffer_data,
7345 { "Buffer data", "spoolss.buffer.data", FT_BYTES, BASE_NONE,
7346 NULL, 0x0, "Contents of buffer", HFILL }},
7348 { &hf_string_parm_size,
7349 { "String buffer size", "spoolss.string.buffersize", FT_UINT32, BASE_DEC,
7350 NULL, 0x0, "Size of string buffer", HFILL }},
7352 { &hf_string_parm_data,
7353 { "String data", "spoolss.string.data", FT_STRINGZ, BASE_NONE,
7354 NULL, 0x0, "Contents of string", HFILL }},
7356 { &hf_offset,
7357 { "Offset", "spoolss.offset", FT_UINT32, BASE_DEC,
7358 NULL, 0x0, "Offset of data", HFILL }},
7360 { &hf_level,
7361 { "Info level", "spoolss.enumjobs.level", FT_UINT32,
7362 BASE_DEC, NULL, 0x0, NULL, HFILL }},
7365 { &hf_printername,
7366 { "Printer name", "spoolss.printername", FT_STRING,
7367 BASE_NONE, NULL, 0, NULL, HFILL }},
7369 { &hf_machinename,
7370 { "Machine name", "spoolss.machinename", FT_STRING,
7371 BASE_NONE, NULL, 0, NULL, HFILL }},
7373 { &hf_notifyname,
7374 { "Notify name", "spoolss.notifyname", FT_STRING,
7375 BASE_NONE, NULL, 0, NULL, HFILL }},
7377 { &hf_printerdesc,
7378 { "Printer description", "spoolss.printerdesc", FT_STRING,
7379 BASE_NONE, NULL, 0, NULL, HFILL }},
7381 { &hf_printercomment,
7382 { "Printer comment", "spoolss.printercomment", FT_STRING,
7383 BASE_NONE, NULL, 0, NULL, HFILL }},
7385 { &hf_servername,
7386 { "Server name", "spoolss.servername", FT_STRING, BASE_NONE,
7387 NULL, 0, NULL, HFILL }},
7389 { &hf_sharename,
7390 { "Share name", "spoolss.sharename", FT_STRING, BASE_NONE,
7391 NULL, 0, NULL, HFILL }},
7393 { &hf_portname,
7394 { "Port name", "spoolss.portname", FT_STRING, BASE_NONE,
7395 NULL, 0, NULL, HFILL }},
7397 { &hf_printerlocation,
7398 { "Printer location", "spoolss.printerlocation", FT_STRING,
7399 BASE_NONE, NULL, 0, NULL, HFILL }},
7401 { &hf_environment,
7402 { "Environment name", "spoolss.environment", FT_STRING,
7403 BASE_NONE, NULL, 0, NULL, HFILL }},
7405 { &hf_drivername,
7406 { "Driver name", "spoolss.drivername", FT_STRING, BASE_NONE,
7407 NULL, 0, NULL, HFILL }},
7409 { &hf_username,
7410 { "User name", "spoolss.username", FT_STRING, BASE_NONE,
7411 NULL, 0, NULL, HFILL }},
7413 { &hf_documentname,
7414 { "Document name", "spoolss.document", FT_STRING, BASE_NONE,
7415 NULL, 0, NULL, HFILL }},
7417 { &hf_outputfile,
7418 { "Output file", "spoolss.outputfile", FT_STRING, BASE_NONE,
7419 NULL, 0, NULL, HFILL }},
7421 { &hf_datatype,
7422 { "Datatype", "spoolss.datatype", FT_STRING, BASE_NONE,
7423 NULL, 0, NULL, HFILL }},
7425 { &hf_textstatus,
7426 { "Text status", "spoolss.textstatus", FT_STRING, BASE_NONE,
7427 NULL, 0, NULL, HFILL }},
7429 { &hf_sepfile,
7430 { "Separator file", "spoolss.setpfile", FT_STRING, BASE_NONE,
7431 NULL, 0, NULL, HFILL }},
7433 { &hf_parameters,
7434 { "Parameters", "spoolss.parameters", FT_STRING, BASE_NONE,
7435 NULL, 0, NULL, HFILL }},
7437 { &hf_printprocessor,
7438 { "Print processor", "spoolss.printprocessor", FT_STRING,
7439 BASE_NONE, NULL, 0, NULL, HFILL }},
7441 { &hf_vendor_setup,
7442 { "Vendor Setup", "spoolss.vendorsetup", FT_STRING,
7443 BASE_NONE, NULL, 0, NULL, HFILL }},
7445 { &hf_inf_path,
7446 { "Inf Path", "spoolss.infpath", FT_STRING,
7447 BASE_NONE, NULL, 0, NULL, HFILL }},
7449 { &hf_core_printer_driver_ids,
7450 { "Core Printer Driver IDs", "spoolss.core_printer_driver_ids", FT_STRING,
7451 BASE_NONE, NULL, 0, NULL, HFILL }},
7453 { &hf_core_driver_guid,
7454 { "Core Printer Driver GUID", "spoolss.core_driver_guid", FT_GUID,
7455 BASE_NONE, NULL, 0, NULL, HFILL }},
7457 { &hf_core_driver_size,
7458 { "Core Printer Driver Size", "spoolss.core_driver_size", FT_UINT32,
7459 BASE_DEC, NULL, 0, NULL, HFILL }},
7461 { &hf_core_printer_driver_count,
7462 { "Core Printer Driver Count", "spoolss.core_printer_driver_count", FT_UINT32,
7463 BASE_DEC, NULL, 0, NULL, HFILL }},
7465 { &hf_package_id,
7466 { "PackageId", "spoolss.package_id", FT_STRING,
7467 BASE_NONE, NULL, 0, NULL, HFILL }},
7469 { &hf_language,
7470 { "Language name", "spoolss.language", FT_STRING,
7471 BASE_NONE, NULL, 0, NULL, HFILL }},
7473 { &hf_driver_package_cab_size,
7474 { "Driver Package Cabinet Size", "spoolss.driver_package_cab_size", FT_UINT32,
7475 BASE_DEC, NULL, 0, NULL, HFILL }},
7477 /* Printer data */
7479 { &hf_printerdata,
7480 { "Data", "spoolss.printerdata", FT_UINT32,
7481 BASE_HEX, NULL, 0, NULL, HFILL }},
7483 { &hf_printerdata_key,
7484 { "Key", "spoolss.printerdata.key", FT_STRING,
7485 BASE_NONE, NULL, 0, "Printer data key", HFILL }},
7487 { &hf_printerdata_value,
7488 { "Value", "spoolss.printerdata.value",
7489 FT_STRING, BASE_NONE, NULL, 0, "Printer data value",
7490 HFILL }},
7492 { &hf_printerdata_type,
7493 { "Type", "spoolss.printerdata.type",
7494 FT_UINT32, BASE_DEC|BASE_EXT_STRING, &reg_datatypes_ext, 0,
7495 "Printer data type", HFILL }},
7497 { &hf_printerdata_size,
7498 { "Size", "spoolss.printerdata.size",
7499 FT_UINT32, BASE_DEC, NULL, 0, "Printer data size",
7500 HFILL }},
7502 { &hf_printerdata_data,
7503 { "Data", "spoolss.printerdata.data", FT_BYTES, BASE_NONE,
7504 NULL, 0x0, "Printer data", HFILL }},
7506 { &hf_printerdata_data_dword,
7507 { "DWORD data", "spoolss.printerdata.data.dword",
7508 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
7510 { &hf_printerdata_data_sz,
7511 { "String data", "spoolss.printerdata.data.sz",
7512 FT_STRING, BASE_NONE, NULL, 0, NULL,
7513 HFILL }},
7515 /* Devicemode */
7517 { &hf_devmodectr_size,
7518 { "Devicemode ctr size", "spoolss.devicemodectr.size",
7519 FT_UINT32, BASE_DEC, NULL, 0, NULL,
7520 HFILL }},
7522 { &hf_devmode,
7523 { "Devicemode", "spoolss.devmode", FT_UINT32,
7524 BASE_HEX, NULL, 0, NULL, HFILL }},
7526 { &hf_devmode_size,
7527 { "Size", "spoolss.devmode.size",
7528 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7530 { &hf_devmode_spec_version,
7531 { "Spec version", "spoolss.devmode.spec_version",
7532 FT_UINT16, BASE_DEC, VALS(devmode_specversion_vals),
7533 0, NULL, HFILL }},
7535 { &hf_devmode_driver_version,
7536 { "Driver version", "spoolss.devmode.driver_version",
7537 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
7539 { &hf_devmode_size2,
7540 { "Size2", "spoolss.devmode.size2",
7541 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
7543 { &hf_devmode_fields,
7544 { "Fields", "spoolss.devmode.fields",
7545 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
7547 { &hf_devmode_orientation,
7548 { "Orientation", "spoolss.devmode.orientation",
7549 FT_UINT16, BASE_DEC, VALS(devmode_orientation_vals),
7550 0, NULL, HFILL }},
7552 { &hf_devmode_paper_size,
7553 { "Paper size", "spoolss.devmode.paper_size",
7554 FT_UINT16, BASE_DEC|BASE_EXT_STRING, &devmode_papersize_vals_ext,
7555 0, NULL, HFILL }},
7557 { &hf_devmode_paper_width,
7558 { "Paper width", "spoolss.devmode.paper_width",
7559 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
7561 { &hf_devmode_paper_length,
7562 { "Paper length", "spoolss.devmode.paper_length",
7563 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
7565 { &hf_devmode_scale,
7566 { "Scale", "spoolss.devmode.scale",
7567 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
7569 { &hf_devmode_copies,
7570 { "Copies", "spoolss.devmode.copies",
7571 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
7573 { &hf_devmode_default_source,
7574 { "Default source", "spoolss.devmode.default_source",
7575 FT_UINT16, BASE_DEC|BASE_EXT_STRING, &devmode_papersource_vals_ext,
7576 0, NULL, HFILL }},
7578 { &hf_devmode_print_quality,
7579 { "Print quality", "spoolss.devmode.print_quality",
7580 FT_UINT16, BASE_DEC, VALS(devmode_printquality_vals),
7581 0, NULL, HFILL }},
7583 { &hf_devmode_color,
7584 { "Color", "spoolss.devmode.color",
7585 FT_UINT16, BASE_DEC, VALS(devmode_colour_vals), 0,
7586 NULL, HFILL }},
7588 { &hf_devmode_duplex,
7589 { "Duplex", "spoolss.devmode.duplex",
7590 FT_UINT16, BASE_DEC, VALS(devmode_duplex_vals), 0,
7591 NULL, HFILL }},
7593 { &hf_devmode_y_resolution,
7594 { "Y resolution", "spoolss.devmode.y_resolution",
7595 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
7597 { &hf_devmode_tt_option,
7598 { "TT option", "spoolss.devmode.tt_option",
7599 FT_UINT16, BASE_DEC, VALS(devmode_ttoption_vals), 0,
7600 NULL, HFILL }},
7602 { &hf_devmode_collate,
7603 { "Collate", "spoolss.devmode.collate",
7604 FT_UINT16, BASE_DEC, VALS(devmode_collate_vals), 0,
7605 NULL, HFILL }},
7607 { &hf_devmode_log_pixels,
7608 { "Log pixels", "spoolss.devmode.log_pixels",
7609 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
7611 { &hf_devmode_bits_per_pel,
7612 { "Bits per pel", "spoolss.devmode.bits_per_pel",
7613 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7615 { &hf_devmode_pels_width,
7616 { "Pels width", "spoolss.devmode.pels_width",
7617 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7619 { &hf_devmode_pels_height,
7620 { "Pels height", "spoolss.devmode.pels_height",
7621 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7623 { &hf_devmode_display_flags,
7624 { "Display flags", "spoolss.devmode.display_flags",
7625 FT_UINT32, BASE_DEC, VALS(devmode_displayflags_vals), 0,
7626 NULL, HFILL }},
7628 { &hf_devmode_display_freq,
7629 { "Display frequency", "spoolss.devmode.display_freq",
7630 FT_UINT32, BASE_DEC, NULL, 0, NULL,
7631 HFILL }},
7633 { &hf_devmode_icm_method,
7634 { "ICM method", "spoolss.devmode.icm_method",
7635 FT_UINT32, BASE_DEC, VALS(devmode_icmmethod_vals), 0,
7636 NULL, HFILL }},
7638 { &hf_devmode_icm_intent,
7639 { "ICM intent", "spoolss.devmode.icm_intent",
7640 FT_UINT32, BASE_DEC, VALS(devmode_icmintent_vals), 0,
7641 NULL, HFILL }},
7643 { &hf_devmode_media_type,
7644 { "Media type", "spoolss.devmode.media_type",
7645 FT_UINT32, BASE_DEC, VALS(devmode_mediatype_vals), 0,
7646 NULL, HFILL }},
7648 { &hf_devmode_dither_type,
7649 { "Dither type", "spoolss.devmode.dither_type",
7650 FT_UINT32, BASE_DEC, VALS(devmode_dithertype_vals), 0,
7651 NULL, HFILL }},
7653 { &hf_devmode_reserved1,
7654 { "Reserved1", "spoolss.devmode.reserved1",
7655 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7657 { &hf_devmode_reserved2,
7658 { "Reserved2", "spoolss.devmode.reserved2",
7659 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7661 { &hf_devmode_panning_width,
7662 { "Panning width", "spoolss.devmode.panning_width",
7663 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7665 { &hf_devmode_panning_height,
7666 { "Panning height", "spoolss.devmode.panning_height",
7667 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
7669 { &hf_devmode_driver_extra_len,
7670 { "Driver extra length",
7671 "spoolss.devmode.driver_extra_len",
7672 FT_UINT32, BASE_DEC, NULL, 0, NULL,
7673 HFILL }},
7675 { &hf_devmode_driver_extra,
7676 { "Driver extra", "spoolss.devmode.driver_extra",
7677 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
7679 /* Devicemode fields */
7681 { &hf_devmode_fields_orientation,
7682 { "Orientation", "spoolss.devmode.fields.orientation",
7683 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7684 DEVMODE_ORIENTATION, NULL, HFILL }},
7686 { &hf_devmode_fields_papersize,
7687 { "Paper size", "spoolss.devmode.fields.paper_size",
7688 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7689 DEVMODE_PAPERSIZE, NULL, HFILL }},
7691 { &hf_devmode_fields_paperlength,
7692 { "Paper length", "spoolss.devmode.fields.paper_length",
7693 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7694 DEVMODE_PAPERLENGTH, NULL, HFILL }},
7696 { &hf_devmode_fields_paperwidth,
7697 { "Paper width", "spoolss.devmode.fields.paper_width",
7698 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7699 DEVMODE_PAPERWIDTH, NULL, HFILL }},
7701 { &hf_devmode_fields_scale,
7702 { "Scale", "spoolss.devmode.fields.scale",
7703 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7704 DEVMODE_SCALE, NULL, HFILL }},
7706 { &hf_devmode_fields_position,
7707 { "Position", "spoolss.devmode.fields.position",
7708 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7709 DEVMODE_POSITION, NULL, HFILL }},
7711 { &hf_devmode_fields_nup,
7712 { "N-up", "spoolss.devmode.fields.nup",
7713 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7714 DEVMODE_NUP, NULL, HFILL }},
7716 { &hf_devmode_fields_copies,
7717 { "Copies", "spoolss.devmode.fields.copies",
7718 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7719 DEVMODE_COPIES, NULL, HFILL }},
7721 { &hf_devmode_fields_defaultsource,
7722 { "Default source", "spoolss.devmode.fields.default_source",
7723 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7724 DEVMODE_DEFAULTSOURCE, NULL, HFILL }},
7726 { &hf_devmode_fields_printquality,
7727 { "Print quality", "spoolss.devmode.fields.print_quality",
7728 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7729 DEVMODE_PRINTQUALITY, NULL, HFILL }},
7731 { &hf_devmode_fields_color,
7732 { "Color", "spoolss.devmode.fields.color",
7733 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7734 DEVMODE_COLOR, NULL, HFILL }},
7736 { &hf_devmode_fields_duplex,
7737 { "Duplex", "spoolss.devmode.fields.duplex",
7738 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7739 DEVMODE_DUPLEX, NULL, HFILL }},
7741 { &hf_devmode_fields_yresolution,
7742 { "Y resolution", "spoolss.devmode.fields.y_resolution",
7743 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7744 DEVMODE_YRESOLUTION, NULL, HFILL }},
7746 { &hf_devmode_fields_ttoption,
7747 { "TT option", "spoolss.devmode.fields.tt_option",
7748 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7749 DEVMODE_TTOPTION, NULL, HFILL }},
7751 { &hf_devmode_fields_collate,
7752 { "Collate", "spoolss.devmode.fields.collate",
7753 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7754 DEVMODE_COLLATE, NULL, HFILL }},
7756 { &hf_devmode_fields_formname,
7757 { "Form name", "spoolss.devmode.fields.form_name",
7758 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7759 DEVMODE_FORMNAME, NULL, HFILL }},
7761 { &hf_devmode_fields_logpixels,
7762 { "Log pixels", "spoolss.devmode.fields.log_pixels",
7763 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7764 DEVMODE_LOGPIXELS, NULL, HFILL }},
7766 { &hf_devmode_fields_bitsperpel,
7767 { "Bits per pel", "spoolss.devmode.fields.bits_per_pel",
7768 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7769 DEVMODE_BITSPERPEL, NULL, HFILL }},
7771 { &hf_devmode_fields_pelswidth,
7772 { "Pels width", "spoolss.devmode.fields.pels_width",
7773 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7774 DEVMODE_PELSWIDTH, NULL, HFILL }},
7776 { &hf_devmode_fields_pelsheight,
7777 { "Pels height", "spoolss.devmode.fields.pels_height",
7778 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7779 DEVMODE_PELSHEIGHT, NULL, HFILL }},
7781 { &hf_devmode_fields_displayflags,
7782 { "Display flags", "spoolss.devmode.fields.display_flags",
7783 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7784 DEVMODE_DISPLAYFLAGS, NULL, HFILL }},
7786 { &hf_devmode_fields_displayfrequency,
7787 { "Display frequency",
7788 "spoolss.devmode.fields.display_frequency",
7789 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7790 DEVMODE_DISPLAYFREQUENCY, NULL, HFILL }},
7792 { &hf_devmode_fields_icmmethod,
7793 { "ICM method", "spoolss.devmode.fields.icm_method",
7794 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7795 DEVMODE_ICMMETHOD, NULL, HFILL }},
7797 { &hf_devmode_fields_icmintent,
7798 { "ICM intent", "spoolss.devmode.fields.icm_intent",
7799 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7800 DEVMODE_ICMINTENT, NULL, HFILL }},
7802 { &hf_devmode_fields_mediatype,
7803 { "Media type", "spoolss.devmode.fields.media_type",
7804 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7805 DEVMODE_MEDIATYPE, NULL, HFILL }},
7807 { &hf_devmode_fields_dithertype,
7808 { "Dither type", "spoolss.devmode.fields.dither_type",
7809 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7810 DEVMODE_DITHERTYPE, NULL, HFILL }},
7812 { &hf_devmode_fields_panningwidth,
7813 { "Panning width", "spoolss.devmode.fields.panning_width",
7814 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7815 DEVMODE_PANNINGWIDTH, NULL, HFILL }},
7817 { &hf_devmode_fields_panningheight,
7818 { "Panning height", "spoolss.devmode.fields.panning_height",
7819 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
7820 DEVMODE_PANNINGHEIGHT, NULL, HFILL }},
7822 /* EnumPrinterData RPC */
7824 { &hf_enumprinterdata_enumindex,
7825 { "Enum index", "spoolss.enumprinterdata.enumindex",
7826 FT_UINT32, BASE_DEC, NULL, 0x0,
7827 "Index for start of enumeration", HFILL }},
7829 { &hf_enumprinterdata_value_offered,
7830 { "Value size offered",
7831 "spoolss.enumprinterdata.value_offered", FT_UINT32,
7832 BASE_DEC, NULL, 0x0,
7833 "Buffer size offered for printerdata value", HFILL }},
7835 { &hf_enumprinterdata_data_offered,
7836 { "Data size offered",
7837 "spoolss.enumprinterdata.data_offered", FT_UINT32,
7838 BASE_DEC, NULL, 0x0,
7839 "Buffer size offered for printerdata data", HFILL }},
7841 { &hf_enumprinterdata_value_len,
7842 { "Value length",
7843 "spoolss.enumprinterdata.value_len", FT_UINT32,
7844 BASE_DEC, NULL, 0x0,
7845 "Size of printerdata value", HFILL }},
7847 { &hf_enumprinterdata_value_needed,
7848 { "Value size needed",
7849 "spoolss.enumprinterdata.value_needed", FT_UINT32,
7850 BASE_DEC, NULL, 0x0,
7851 "Buffer size needed for printerdata value", HFILL }},
7853 { &hf_enumprinterdata_data_needed,
7854 { "Data size needed",
7855 "spoolss.enumprinterdata.data_needed", FT_UINT32, BASE_DEC,
7856 NULL, 0x0, "Buffer size needed for printerdata data",
7857 HFILL }},
7859 /* Print jobs */
7861 { &hf_job_id,
7862 { "Job ID", "spoolss.job.id", FT_UINT32, BASE_DEC,
7863 NULL, 0x0, "Job identification number", HFILL }},
7865 { &hf_job_status,
7866 { "Job status", "spoolss.job.status", FT_UINT32, BASE_DEC,
7867 NULL, 0x0, NULL, HFILL }},
7869 { &hf_job_status_paused,
7870 { "Paused", "spoolss.job.status.paused", FT_BOOLEAN, 32,
7871 TFS(&tfs_job_status_paused), JOB_STATUS_PAUSED,
7872 NULL, HFILL }},
7874 { &hf_job_status_error,
7875 { "Error", "spoolss.job.status.error", FT_BOOLEAN, 32,
7876 TFS(&tfs_job_status_error), JOB_STATUS_ERROR,
7877 NULL, HFILL }},
7879 { &hf_job_status_deleting,
7880 { "Deleting", "spoolss.job.status.deleting", FT_BOOLEAN, 32,
7881 TFS(&tfs_job_status_deleting), JOB_STATUS_DELETING,
7882 NULL, HFILL }},
7884 { &hf_job_status_spooling,
7885 { "Spooling", "spoolss.job.status.spooling", FT_BOOLEAN, 32,
7886 TFS(&tfs_job_status_spooling), JOB_STATUS_SPOOLING,
7887 NULL, HFILL }},
7889 { &hf_job_status_printing,
7890 { "Printing", "spoolss.job.status.printing", FT_BOOLEAN, 32,
7891 TFS(&tfs_job_status_printing), JOB_STATUS_PRINTING,
7892 NULL, HFILL }},
7894 { &hf_job_status_offline,
7895 { "Offline", "spoolss.job.status.offline", FT_BOOLEAN, 32,
7896 TFS(&tfs_job_status_offline), JOB_STATUS_OFFLINE,
7897 NULL, HFILL }},
7899 { &hf_job_status_paperout,
7900 { "Paperout", "spoolss.job.status.paperout", FT_BOOLEAN, 32,
7901 TFS(&tfs_job_status_paperout), JOB_STATUS_PAPEROUT,
7902 NULL, HFILL }},
7904 { &hf_job_status_printed,
7905 { "Printed", "spoolss.job.status.printed", FT_BOOLEAN, 32,
7906 TFS(&tfs_job_status_printed), JOB_STATUS_PRINTED,
7907 NULL, HFILL }},
7909 { &hf_job_status_deleted,
7910 { "Deleted", "spoolss.job.status.deleted", FT_BOOLEAN, 32,
7911 TFS(&tfs_job_status_deleted), JOB_STATUS_DELETED,
7912 NULL, HFILL }},
7914 { &hf_job_status_blocked,
7915 { "Blocked", "spoolss.job.status.blocked", FT_BOOLEAN, 32,
7916 TFS(&tfs_job_status_blocked), JOB_STATUS_BLOCKED,
7917 NULL, HFILL }},
7919 { &hf_job_status_user_intervention,
7920 { "User intervention",
7921 "spoolss.job.status.user_intervention", FT_BOOLEAN, 32,
7922 TFS(&tfs_job_status_user_intervention),
7923 JOB_STATUS_USER_INTERVENTION, NULL,
7924 HFILL }},
7926 { &hf_job_priority,
7927 { "Job priority", "spoolss.job.priority", FT_UINT32,
7928 BASE_DEC, NULL, 0x0, NULL, HFILL }},
7930 { &hf_job_position,
7931 { "Job position", "spoolss.job.position", FT_UINT32,
7932 BASE_DEC, NULL, 0x0, NULL, HFILL }},
7934 { &hf_job_totalpages,
7935 { "Job total pages", "spoolss.job.totalpages", FT_UINT32,
7936 BASE_DEC, NULL, 0x0, NULL, HFILL }},
7938 { &hf_job_totalbytes,
7939 { "Job total bytes", "spoolss.job.totalbytes", FT_UINT32,
7940 BASE_DEC, NULL, 0x0, NULL, HFILL }},
7942 { &hf_job_bytesprinted,
7943 { "Job bytes printed", "spoolss.job.bytesprinted",
7944 FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
7945 HFILL }},
7947 { &hf_job_pagesprinted,
7948 { "Job pages printed", "spoolss.job.pagesprinted",
7949 FT_UINT32, BASE_DEC, NULL, 0x0, NULL,
7950 HFILL }},
7952 { &hf_job_size,
7953 { "Job size", "spoolss.job.size", FT_UINT32, BASE_DEC,
7954 NULL, 0x0, NULL, HFILL }},
7956 /* Forms */
7958 { &hf_form,
7959 { "Data", "spoolss.form", FT_UINT32,
7960 BASE_HEX, NULL, 0, NULL, HFILL }},
7962 { &hf_form_level,
7963 { "Level", "spoolss.form.level", FT_UINT32,
7964 BASE_DEC, NULL, 0, NULL, HFILL }},
7966 { &hf_form_name,
7967 { "Name", "spoolss.form.name", FT_STRING, BASE_NONE,
7968 NULL, 0, NULL, HFILL }},
7970 { &hf_form_flags,
7971 { "Flags", "spoolss.form.flags", FT_UINT32,
7972 BASE_DEC, VALS(form_type_vals), 0, NULL, HFILL }},
7974 { &hf_form_unknown,
7975 { "Unknown", "spoolss.form.unknown", FT_UINT32,
7976 BASE_HEX, NULL, 0, NULL, HFILL }},
7978 { &hf_form_width,
7979 { "Width", "spoolss.form.width", FT_UINT32,
7980 BASE_DEC, NULL, 0, NULL, HFILL }},
7982 { &hf_form_height,
7983 { "Height", "spoolss.form.height", FT_UINT32,
7984 BASE_DEC, NULL, 0, NULL, HFILL }},
7986 { &hf_form_left_margin,
7987 { "Left margin", "spoolss.form.left", FT_UINT32,
7988 BASE_DEC, NULL, 0, NULL, HFILL }},
7990 { &hf_form_top_margin,
7991 { "Top", "spoolss.form.top", FT_UINT32,
7992 BASE_DEC, NULL, 0, NULL, HFILL }},
7994 { &hf_form_horiz_len,
7995 { "Horizontal", "spoolss.form.horiz", FT_UINT32,
7996 BASE_DEC, NULL, 0, NULL, HFILL }},
7998 { &hf_form_vert_len,
7999 { "Vertical", "spoolss.form.vert", FT_UINT32,
8000 BASE_DEC, NULL, 0, NULL, HFILL }},
8002 { &hf_enumforms_num,
8003 { "Num", "spoolss.enumforms.num", FT_UINT32,
8004 BASE_DEC, NULL, 0, NULL, HFILL }},
8006 /* Print notify */
8008 { &hf_notify_options_version,
8009 { "Version", "spoolss.notify_options.version", FT_UINT32,
8010 BASE_DEC, NULL, 0, NULL, HFILL }},
8012 { &hf_notify_options_flags,
8013 { "Flags", "spoolss.notify_options.flags", FT_UINT32,
8014 BASE_DEC, NULL, 0, NULL, HFILL }},
8016 { &hf_notify_options_count,
8017 { "Count", "spoolss.notify_options.count", FT_UINT32,
8018 BASE_DEC, NULL, 0, NULL, HFILL }},
8020 { &hf_notify_option_type,
8021 { "Type", "spoolss.notify_option.type", FT_UINT16, BASE_DEC,
8022 VALS(printer_notify_types), 0, NULL, HFILL }},
8024 { &hf_notify_option_reserved1,
8025 { "Reserved1", "spoolss.notify_option.reserved1", FT_UINT16,
8026 BASE_DEC, NULL, 0, NULL, HFILL }},
8028 { &hf_notify_option_reserved2,
8029 { "Reserved2", "spoolss.notify_option.reserved2", FT_UINT32,
8030 BASE_DEC, NULL, 0, NULL, HFILL }},
8032 { &hf_notify_option_reserved3,
8033 { "Reserved3", "spoolss.notify_option.reserved3", FT_UINT32,
8034 BASE_DEC, NULL, 0, NULL, HFILL }},
8036 { &hf_notify_option_count,
8037 { "Count", "spoolss.notify_option.count", FT_UINT32,
8038 BASE_DEC, NULL, 0, NULL, HFILL }},
8040 { &hf_notify_option_data_count,
8041 { "Count", "spoolss.notify_option_data.count", FT_UINT32,
8042 BASE_DEC, NULL, 0, NULL, HFILL }},
8044 { &hf_notify_options_flags_refresh,
8045 { "Refresh", "spoolss.notify_options.flags.refresh", FT_BOOLEAN, 32,
8046 TFS(&tfs_notify_options_flags_refresh),
8047 PRINTER_NOTIFY_OPTIONS_REFRESH, NULL, HFILL }},
8049 { &hf_notify_info_count,
8050 { "Count", "spoolss.notify_info.count", FT_UINT32, BASE_DEC,
8051 NULL, 0, NULL, HFILL }},
8053 { &hf_notify_info_version,
8054 { "Version", "spoolss.notify_info.version", FT_UINT32,
8055 BASE_DEC, NULL, 0, NULL, HFILL }},
8057 { &hf_notify_info_flags,
8058 { "Flags", "spoolss.notify_info.flags", FT_UINT32, BASE_HEX,
8059 NULL, 0, NULL, HFILL }},
8061 { &hf_notify_info_data_type,
8062 { "Type", "spoolss.notify_info_data.type", FT_UINT16,
8063 BASE_DEC, VALS(printer_notify_types), 0, NULL, HFILL }},
8065 { &hf_notify_field,
8066 { "Field", "spoolss.notify_field", FT_UINT16, BASE_DEC,
8067 NULL, 0, NULL, HFILL }},
8069 { &hf_notify_info_data_count,
8070 { "Count", "spoolss.notify_info_data.count", FT_UINT32,
8071 BASE_DEC, NULL, 0, NULL, HFILL }},
8073 { &hf_notify_info_data_id,
8074 { "Job Id", "spoolss.notify_info_data.jobid", FT_UINT32,
8075 BASE_DEC, NULL, 0, NULL, HFILL }},
8077 { &hf_notify_info_data_value1,
8078 { "Value1", "spoolss.notify_info_data.value1", FT_UINT32,
8079 BASE_HEX, NULL, 0, NULL, HFILL }},
8081 { &hf_notify_info_data_value2,
8082 { "Value2", "spoolss.notify_info_data.value2", FT_UINT32,
8083 BASE_HEX, NULL, 0, NULL, HFILL }},
8085 { &hf_notify_info_data_bufsize,
8086 { "Buffer size", "spoolss.notify_info_data.bufsize",
8087 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8089 { &hf_notify_info_data_buffer,
8090 { "Buffer", "spoolss.notify_info_data.buffer", FT_UINT32,
8091 BASE_HEX, NULL, 0, NULL, HFILL }},
8093 { &hf_notify_info_data_buffer_len,
8094 { "Buffer length", "spoolss.notify_info_data.buffer.len",
8095 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
8097 { &hf_notify_info_data_buffer_data,
8098 { "Buffer data", "spoolss.notify_info_data.buffer.data",
8099 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
8101 /* RffpCNex RPC */
8103 { &hf_rffpcnex_options,
8104 { "Options", "spoolss.rffpcnex.options", FT_UINT32, BASE_DEC,
8105 NULL, 0, "RFFPCNEX options", HFILL }},
8107 { &hf_printerlocal, /* XXX: move me */
8108 { "Printer local", "spoolss.printer_local", FT_UINT32,
8109 BASE_DEC, NULL, 0, NULL, HFILL }},
8111 { &hf_rffpcnex_flags,
8112 { "RFFPCNEX flags", "spoolss.rffpcnex.flags", FT_UINT32,
8113 BASE_DEC, NULL, 0, NULL, HFILL }},
8115 { &hf_rffpcnex_flags_add_printer,
8116 { "Add printer", "spoolss.rffpcnex.flags.add_printer",
8117 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_add_printer),
8118 SPOOLSS_PRINTER_CHANGE_ADD_PRINTER, NULL,
8119 HFILL }},
8121 { &hf_rffpcnex_flags_set_printer,
8122 { "Set printer", "spoolss.rffpcnex.flags.set_printer",
8123 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_set_printer),
8124 SPOOLSS_PRINTER_CHANGE_SET_PRINTER, NULL,
8125 HFILL }},
8127 { &hf_rffpcnex_flags_delete_printer,
8128 { "Delete printer", "spoolss.rffpcnex.flags.delete_printer",
8129 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_delete_printer),
8130 SPOOLSS_PRINTER_CHANGE_DELETE_PRINTER, NULL,
8131 HFILL }},
8133 { &hf_rffpcnex_flags_add_job,
8134 { "Add job", "spoolss.rffpcnex.flags.add_job",
8135 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_add_job),
8136 SPOOLSS_PRINTER_CHANGE_ADD_JOB, NULL, HFILL }},
8138 { &hf_rffpcnex_flags_set_job,
8139 { "Set job", "spoolss.rffpcnex.flags.set_job",
8140 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_set_job),
8141 SPOOLSS_PRINTER_CHANGE_SET_JOB, NULL, HFILL }},
8143 { &hf_rffpcnex_flags_delete_job,
8144 { "Delete job", "spoolss.rffpcnex.flags.delete_job",
8145 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_delete_job),
8146 SPOOLSS_PRINTER_CHANGE_DELETE_JOB, NULL, HFILL }},
8148 { &hf_rffpcnex_flags_write_job,
8149 { "Write job", "spoolss.rffpcnex.flags.write_job",
8150 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_write_job),
8151 SPOOLSS_PRINTER_CHANGE_WRITE_JOB, NULL, HFILL }},
8153 { &hf_rffpcnex_flags_add_form,
8154 { "Add form", "spoolss.rffpcnex.flags.add_form",
8155 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_add_form),
8156 SPOOLSS_PRINTER_CHANGE_ADD_FORM, NULL, HFILL }},
8158 { &hf_rffpcnex_flags_set_form,
8159 { "Set form", "spoolss.rffpcnex.flags.set_form",
8160 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_set_form),
8161 SPOOLSS_PRINTER_CHANGE_SET_FORM, NULL, HFILL }},
8163 { &hf_rffpcnex_flags_delete_form,
8164 { "Delete form", "spoolss.rffpcnex.flags.delete_form",
8165 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_delete_form),
8166 SPOOLSS_PRINTER_CHANGE_DELETE_FORM, NULL,
8167 HFILL }},
8169 { &hf_rffpcnex_flags_add_port,
8170 { "Add port", "spoolss.rffpcnex.flags.add_port",
8171 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_add_port),
8172 SPOOLSS_PRINTER_CHANGE_ADD_PORT, NULL, HFILL }},
8174 { &hf_rffpcnex_flags_configure_port,
8175 { "Configure port", "spoolss.rffpcnex.flags.configure_port",
8176 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_configure_port),
8177 SPOOLSS_PRINTER_CHANGE_CONFIGURE_PORT, NULL,
8178 HFILL }},
8180 { &hf_rffpcnex_flags_delete_port,
8181 { "Delete port", "spoolss.rffpcnex.flags.delete_port",
8182 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_delete_port),
8183 SPOOLSS_PRINTER_CHANGE_DELETE_PORT, NULL,
8184 HFILL }},
8186 { &hf_rffpcnex_flags_add_print_processor,
8187 { "Add processor", "spoolss.rffpcnex.flags.add_processor",
8188 FT_BOOLEAN, 32,
8189 TFS(&tfs_rffpcnex_flags_add_print_processor),
8190 SPOOLSS_PRINTER_CHANGE_ADD_PRINT_PROCESSOR,
8191 NULL, HFILL }},
8193 { &hf_rffpcnex_flags_delete_print_processor,
8194 { "Delete processor",
8195 "spoolss.rffpcnex.flags.delete_processor", FT_BOOLEAN, 32,
8196 TFS(&tfs_rffpcnex_flags_delete_print_processor),
8197 SPOOLSS_PRINTER_CHANGE_DELETE_PRINT_PROCESSOR,
8198 NULL, HFILL }},
8200 { &hf_rffpcnex_flags_add_driver,
8201 { "Add driver", "spoolss.rffpcnex.flags.add_driver",
8202 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_add_driver),
8203 SPOOLSS_PRINTER_CHANGE_ADD_PRINTER_DRIVER, NULL,
8204 HFILL }},
8206 { &hf_rffpcnex_flags_set_driver,
8207 { "Set driver", "spoolss.rffpcnex.flags.set_driver",
8208 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_set_driver),
8209 SPOOLSS_PRINTER_CHANGE_SET_PRINTER_DRIVER, NULL,
8210 HFILL }},
8212 { &hf_rffpcnex_flags_delete_driver,
8213 { "Delete driver", "spoolss.rffpcnex.flags.delete_driver",
8214 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_delete_driver),
8215 SPOOLSS_PRINTER_CHANGE_DELETE_PRINTER_DRIVER,
8216 NULL, HFILL }},
8218 { &hf_rffpcnex_flags_timeout,
8219 { "Timeout", "spoolss.rffpcnex.flags.timeout",
8220 FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_timeout),
8221 SPOOLSS_PRINTER_CHANGE_TIMEOUT, NULL, HFILL }},
8223 { &hf_rffpcnex_flags_failed_printer_connection,
8224 { "Failed printer connection",
8225 "spoolss.rffpcnex.flags.failed_connection_printer",
8226 FT_BOOLEAN, 32,
8227 TFS(&tfs_rffpcnex_flags_failed_connection_printer),
8228 SPOOLSS_PRINTER_CHANGE_FAILED_CONNECTION_PRINTER,
8229 NULL, HFILL }},
8231 /* RRPCN RPC */
8233 { &hf_rrpcn_changelow,
8234 { "Change low", "spoolss.rrpcn.changelow", FT_UINT32,
8235 BASE_DEC, NULL, 0, NULL, HFILL }},
8237 { &hf_rrpcn_changehigh,
8238 { "Change high", "spoolss.rrpcn.changehigh", FT_UINT32,
8239 BASE_DEC, NULL, 0, NULL, HFILL }},
8241 { &hf_rrpcn_unk0,
8242 { "Unknown 0", "spoolss.rrpcn.unk0", FT_UINT32, BASE_DEC,
8243 NULL, 0, NULL, HFILL }},
8245 { &hf_rrpcn_unk1,
8246 { "Unknown 1", "spoolss.rrpcn.unk1", FT_UINT32, BASE_DEC,
8247 NULL, 0, NULL, HFILL }},
8249 /* ReplyOpenPrinter RPC */
8251 { &hf_replyopenprinter_unk0,
8252 { "Unknown 0", "spoolss.replyopenprinter.unk0", FT_UINT32,
8253 BASE_DEC, NULL, 0, NULL, HFILL }},
8255 { &hf_replyopenprinter_unk1,
8256 { "Unknown 1", "spoolss.replyopenprinter.unk1", FT_UINT32,
8257 BASE_DEC, NULL, 0, NULL, HFILL }},
8259 { &hf_devmode_devicename,
8260 { "DeviceName", "spoolss.devmode.devicename", FT_STRING,
8261 BASE_NONE, NULL, 0, NULL, HFILL }},
8263 { &hf_devmode_form_name,
8264 { "FormName", "spoolss.devmode.form_name", FT_STRING,
8265 BASE_NONE, NULL, 0, NULL, HFILL }},
8267 { &hf_relative_string,
8268 { "String", "spoolss.relative_string", FT_STRING,
8269 BASE_NONE, NULL, 0, NULL, HFILL }},
8271 { &hf_value_name,
8272 { "Value Name", "spoolss.value_name", FT_STRING,
8273 BASE_NONE, NULL, 0, NULL, HFILL }},
8275 { &hf_keybuffer,
8276 { "Key", "spoolss.hf_keybuffer", FT_STRING,
8277 BASE_NONE, NULL, 0, NULL, HFILL }},
8279 { &hf_value_string,
8280 { "Value", "spoolss.value_string", FT_STRING,
8281 BASE_NONE, NULL, 0, NULL, HFILL }},
8283 /* Printer attributes */
8285 { &hf_printer_attributes,
8286 { "Attributes", "spoolss.printer_attributes", FT_UINT32,
8287 BASE_HEX, NULL, 0, NULL, HFILL }},
8289 { &hf_printer_attributes_queued,
8290 { "Queued", "spoolss.printer_attributes.queued", FT_BOOLEAN,
8291 32, TFS(&tfs_printer_attributes_queued),
8292 PRINTER_ATTRIBUTE_QUEUED, NULL, HFILL }},
8294 { &hf_printer_attributes_direct,
8295 { "Direct", "spoolss.printer_attributes.direct", FT_BOOLEAN,
8296 32, TFS(&tfs_printer_attributes_direct),
8297 PRINTER_ATTRIBUTE_DIRECT, NULL, HFILL }},
8299 { &hf_printer_attributes_default,
8300 { "Default (9x/ME only)",
8301 "spoolss.printer_attributes.default",FT_BOOLEAN,
8302 32, TFS(&tfs_printer_attributes_default),
8303 PRINTER_ATTRIBUTE_DEFAULT, NULL, HFILL }},
8305 { &hf_printer_attributes_shared,
8306 { "Shared", "spoolss.printer_attributes.shared", FT_BOOLEAN,
8307 32, TFS(&tfs_printer_attributes_shared),
8308 PRINTER_ATTRIBUTE_SHARED, NULL, HFILL }},
8310 { &hf_printer_attributes_network,
8311 { "Network", "spoolss.printer_attributes.network",
8312 FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_network),
8313 PRINTER_ATTRIBUTE_NETWORK, NULL, HFILL }},
8315 { &hf_printer_attributes_hidden,
8316 { "Hidden", "spoolss.printer_attributes.hidden", FT_BOOLEAN,
8317 32, TFS(&tfs_printer_attributes_hidden),
8318 PRINTER_ATTRIBUTE_HIDDEN, NULL, HFILL }},
8320 { &hf_printer_attributes_local,
8321 { "Local", "spoolss.printer_attributes.local", FT_BOOLEAN,
8322 32, TFS(&tfs_printer_attributes_local),
8323 PRINTER_ATTRIBUTE_LOCAL, NULL, HFILL }},
8325 { &hf_printer_attributes_enable_devq,
8326 { "Enable devq", "spoolss.printer_attributes.enable_devq",
8327 FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_enable_devq),
8328 PRINTER_ATTRIBUTE_ENABLE_DEVQ, "Enable evq", HFILL }},
8330 { &hf_printer_attributes_keep_printed_jobs,
8331 { "Keep printed jobs",
8332 "spoolss.printer_attributes.keep_printed_jobs", FT_BOOLEAN,
8333 32, TFS(&tfs_printer_attributes_keep_printed_jobs),
8334 PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS, NULL,
8335 HFILL }},
8337 { &hf_printer_attributes_do_complete_first,
8338 { "Do complete first",
8339 "spoolss.printer_attributes.do_complete_first", FT_BOOLEAN,
8340 32, TFS(&tfs_printer_attributes_do_complete_first),
8341 PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST, NULL,
8342 HFILL }},
8344 { &hf_printer_attributes_work_offline,
8345 { "Work offline (9x/ME only)",
8346 "spoolss.printer_attributes.work_offline", FT_BOOLEAN,
8347 32, TFS(&tfs_printer_attributes_work_offline),
8348 PRINTER_ATTRIBUTE_WORK_OFFLINE, NULL, HFILL }},
8350 { &hf_printer_attributes_enable_bidi,
8351 { "Enable bidi (9x/ME only)",
8352 "spoolss.printer_attributes.enable_bidi", FT_BOOLEAN,
8353 32, TFS(&tfs_printer_attributes_enable_bidi),
8354 PRINTER_ATTRIBUTE_ENABLE_BIDI, NULL, HFILL }},
8356 { &hf_printer_attributes_raw_only,
8357 { "Raw only", "spoolss.printer_attributes.raw_only",
8358 FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_raw_only),
8359 PRINTER_ATTRIBUTE_RAW_ONLY, NULL, HFILL }},
8361 { &hf_printer_attributes_published,
8362 { "Published", "spoolss.printer_attributes.published",
8363 FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_published),
8364 PRINTER_ATTRIBUTE_PUBLISHED, NULL, HFILL }},
8366 /* Printer Driver attributes */
8368 { &hf_printer_driver_attributes,
8369 { "Driver Attributes", "spoolss.printer_driver_attributes", FT_UINT32,
8370 BASE_HEX, NULL, 0, NULL, HFILL }},
8372 { &hf_printer_driver_attributes_package_aware,
8373 { "Package Aware", "spoolss.printer_driver_attributes.packageaware", FT_BOOLEAN,
8374 32, TFS(&tfs_printer_driver_attributes_package_aware),
8375 PRINTER_DRIVER_PACKAGE_AWARE, NULL, HFILL }},
8377 { &hf_printer_driver_attributes_xps,
8378 { "XPS", "spoolss.printer_driver_attributes.xps", FT_BOOLEAN,
8379 32, TFS(&tfs_printer_driver_attributes_xps),
8380 PRINTER_DRIVER_XPS, NULL, HFILL }},
8382 { &hf_printer_driver_attributes_sandbox_enabled,
8383 { "Sandbox enabled", "spoolss.printer_driver_attributes.sandboxenabled", FT_BOOLEAN,
8384 32, TFS(&tfs_printer_driver_attributes_sandbox_enabled),
8385 PRINTER_DRIVER_SANDBOX_ENABLED, NULL, HFILL }},
8387 { &hf_printer_driver_attributes_class,
8388 { "Class Driver", "spoolss.printer_driver_attributes.class", FT_BOOLEAN,
8389 32, TFS(&tfs_printer_driver_attributes_class),
8390 PRINTER_DRIVER_CLASS, NULL, HFILL }},
8392 { &hf_printer_driver_attributes_derived,
8393 { "Derived Driver", "spoolss.printer_driver_attributes.derived", FT_BOOLEAN,
8394 32, TFS(&tfs_printer_driver_attributes_derived),
8395 PRINTER_DRIVER_DERIVED, NULL, HFILL }},
8397 { &hf_printer_driver_attributes_not_shareable,
8398 { "Not Shareable", "spoolss.printer_driver_attributes.notshareable", FT_BOOLEAN,
8399 32, TFS(&tfs_printer_driver_attributes_not_shareable),
8400 PRINTER_DRIVER_NOT_SHAREABLE, NULL, HFILL }},
8402 { &hf_printer_driver_attributes_category_fax,
8403 { "Category Fax", "spoolss.printer_driver_attributes.categoryfax", FT_BOOLEAN,
8404 32, TFS(&tfs_printer_driver_attributes_category_fax),
8405 PRINTER_DRIVER_CATEGORY_FAX, NULL, HFILL }},
8407 { &hf_printer_driver_attributes_category_file,
8408 { "Category File", "spoolss.printer_driver_attributes.categoryfile", FT_BOOLEAN,
8409 32, TFS(&tfs_printer_driver_attributes_category_file),
8410 PRINTER_DRIVER_CATEGORY_FILE, NULL, HFILL }},
8412 { &hf_printer_driver_attributes_category_virtual,
8413 { "Category Virtual", "spoolss.printer_driver_attributes.categoryvirtual", FT_BOOLEAN,
8414 32, TFS(&tfs_printer_driver_attributes_category_virtual),
8415 PRINTER_DRIVER_CATEGORY_VIRTUAL, NULL, HFILL }},
8417 { &hf_printer_driver_attributes_category_service,
8418 { "Category Service", "spoolss.printer_driver_attributes.categoryservice", FT_BOOLEAN,
8419 32, TFS(&tfs_printer_driver_attributes_category_service),
8420 PRINTER_DRIVER_CATEGORY_SERVICE, NULL, HFILL }},
8422 { &hf_printer_driver_attributes_soft_reset_required,
8423 { "Soft Reset Required", "spoolss.printer_driver_attributes.softresetrequired", FT_BOOLEAN,
8424 32, TFS(&tfs_printer_driver_attributes_soft_reset_required),
8425 PRINTER_DRIVER_SOFT_RESET_REQUIRED, NULL, HFILL }},
8427 { &hf_printer_driver_attributes_category_3d,
8428 { "Category 3D", "spoolss.printer_driver_attributes.category3d", FT_BOOLEAN,
8429 32, TFS(&tfs_printer_driver_attributes_category_3d),
8430 PRINTER_DRIVER_CATEGORY_3D, NULL, HFILL }},
8433 /* Timestamps */
8435 { &hf_time_year,
8436 { "Year", "spoolss.time.year", FT_UINT32, BASE_DEC,
8437 NULL, 0x0, NULL, HFILL }},
8439 { &hf_time_month,
8440 { "Month", "spoolss.time.month", FT_UINT32, BASE_DEC,
8441 NULL, 0x0, NULL, HFILL }},
8443 { &hf_time_dow,
8444 { "Day of week", "spoolss.time.dow", FT_UINT32, BASE_DEC,
8445 NULL, 0x0, NULL, HFILL }},
8447 { &hf_time_day,
8448 { "Day", "spoolss.time.day", FT_UINT32, BASE_DEC,
8449 NULL, 0x0, NULL, HFILL }},
8451 { &hf_time_hour,
8452 { "Hour", "spoolss.time.hour", FT_UINT32, BASE_DEC,
8453 NULL, 0x0, NULL, HFILL }},
8455 { &hf_time_minute,
8456 { "Minute", "spoolss.time.minute", FT_UINT32, BASE_DEC,
8457 NULL, 0x0, NULL, HFILL }},
8459 { &hf_time_second,
8460 { "Second", "spoolss.time.second", FT_UINT32, BASE_DEC,
8461 NULL, 0x0, NULL, HFILL }},
8463 { &hf_time_msec,
8464 { "Millisecond", "spoolss.time.msec", FT_UINT32, BASE_DEC,
8465 NULL, 0x0, NULL, HFILL }},
8467 /* Userlevel */
8469 { &hf_userlevel_size,
8470 { "Size", "spoolss.userlevel.size",
8471 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8473 { &hf_userlevel_client,
8474 { "Client", "spoolss.userlevel.client", FT_STRING,
8475 BASE_NONE, NULL, 0, NULL, HFILL }},
8477 { &hf_userlevel_user,
8478 { "User", "spoolss.userlevel.user", FT_STRING,
8479 BASE_NONE, NULL, 0, NULL, HFILL }},
8481 { &hf_userlevel_build,
8482 { "Build", "spoolss.userlevel.build",
8483 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8485 { &hf_userlevel_major,
8486 { "Major", "spoolss.userlevel.major",
8487 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8489 { &hf_userlevel_minor,
8490 { "Minor", "spoolss.userlevel.minor",
8491 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8493 { &hf_userlevel_processor,
8494 { "Processor", "spoolss.userlevel.processor",
8495 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8497 /* EnumprinterdataEx RPC */
8499 { &hf_enumprinterdataex_name_offset,
8500 { "Name offset", "spoolss.enumprinterdataex.name_offset",
8501 FT_UINT32, BASE_DEC, NULL, 0x0,
8502 NULL, HFILL }},
8504 { &hf_enumprinterdataex_name_len,
8505 { "Name len", "spoolss.enumprinterdataex.name_len",
8506 FT_UINT32, BASE_DEC, NULL, 0x0,
8507 NULL, HFILL }},
8509 { &hf_enumprinterdataex_name,
8510 { "Name", "spoolss.enumprinterdataex.name",
8511 FT_STRING, BASE_NONE, NULL, 0x0,
8512 NULL, HFILL }},
8514 { &hf_enumprinterdataex_val_offset,
8515 { "Value offset", "spoolss.enumprinterdataex.value_offset",
8516 FT_UINT32, BASE_DEC, NULL, 0x0,
8517 NULL, HFILL }},
8519 { &hf_enumprinterdataex_val_len,
8520 { "Value len", "spoolss.enumprinterdataex.value_len",
8521 FT_UINT32, BASE_DEC, NULL, 0x0,
8522 NULL, HFILL }},
8524 { &hf_enumprinterdataex_val_dword_high,
8525 { "DWORD value (high)",
8526 "spoolss.enumprinterdataex.val_dword.high",
8527 FT_UINT16, BASE_DEC, NULL, 0x0,
8528 NULL, HFILL }},
8530 { &hf_enumprinterdataex_value_null,
8531 { "Value",
8532 "spoolss.enumprinterdataex.val_null",
8533 FT_UINT32, BASE_DEC, NULL, 0x0,
8534 NULL, HFILL }},
8536 { &hf_enumprinterdataex_value_uint,
8537 { "Value",
8538 "spoolss.enumprinterdataex.val_uint",
8539 FT_UINT32, BASE_DEC, NULL, 0x0,
8540 NULL, HFILL }},
8542 { &hf_enumprinterdataex_value_binary,
8543 { "Value",
8544 "spoolss.enumprinterdataex.val_binary",
8545 FT_BYTES, BASE_NONE, NULL, 0x0,
8546 NULL, HFILL }},
8548 { &hf_enumprinterdataex_value_multi_sz,
8549 { "Value",
8550 "spoolss.enumprinterdataex.val_multi_sz",
8551 FT_BYTES, BASE_NONE, NULL, 0x0,
8552 NULL, HFILL }},
8554 { &hf_enumprinterdataex_val_dword_low,
8555 { "DWORD value (low)",
8556 "spoolss.enumprinterdataex.val_dword.low",
8557 FT_UINT16, BASE_DEC, NULL, 0x0,
8558 NULL, HFILL }},
8560 /* RouterReplyPrinter RPC */
8562 { &hf_routerreplyprinter_condition,
8563 { "Condition", "spoolss.routerreplyprinter.condition",
8564 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8566 { &hf_routerreplyprinter_unknown1,
8567 { "Unknown1", "spoolss.routerreplyprinter.unknown1",
8568 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8570 { &hf_routerreplyprinter_changeid,
8571 { "Change id", "spoolss.routerreplyprinter.changeid",
8572 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8574 /* EnumPrinterKey RPC */
8576 { &hf_keybuffer_size,
8577 { "Key Buffer size", "spoolss.keybuffer.size", FT_UINT32,
8578 BASE_DEC, NULL, 0x0, "Size of buffer", HFILL }},
8580 /* SetJob RPC */
8582 { &hf_setjob_cmd,
8583 { "Set job command", "spoolss.setjob.cmd", FT_UINT32,
8584 BASE_DEC, VALS(setjob_commands), 0x0, "Printer data name",
8585 HFILL }},
8587 /* EnumJobs RPC */
8589 { &hf_enumjobs_firstjob,
8590 { "First job", "spoolss.enumjobs.firstjob", FT_UINT32,
8591 BASE_DEC, NULL, 0x0, "Index of first job to return",
8592 HFILL }},
8594 { &hf_enumjobs_numjobs,
8595 { "Num jobs", "spoolss.enumjobs.numjobs", FT_UINT32,
8596 BASE_DEC, NULL, 0x0, "Number of jobs to return", HFILL }},
8598 /* Security descriptor buffer */
8600 { &hf_secdescbuf_maxlen,
8601 { "Max len", "spoolss.secdescbuf.max_len",
8602 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8604 { &hf_secdescbuf_undoc,
8605 { "Undocumented", "spoolss.secdescbuf.undoc",
8606 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8608 { &hf_secdescbuf_len,
8609 { "Length", "spoolss.secdescbuf.len",
8610 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8612 /* Spool printer info */
8614 { &hf_spool_printer_info_devmode_ptr,
8615 { "Devmode pointer", "spoolss.spoolprinterinfo.devmode_ptr",
8616 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
8618 { &hf_spool_printer_info_secdesc_ptr,
8619 { "Secdesc pointer", "spoolss.spoolprinterinfo.secdesc_ptr",
8620 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
8622 /* WritePrinter RPC */
8624 { &hf_writeprinter_numwritten,
8625 { "Num written", "spoolss.writeprinter.numwritten",
8626 FT_UINT32, BASE_DEC, NULL, 0x0, "Number of bytes written",
8627 HFILL }},
8629 /* Setprinterdataex RPC */
8631 { &hf_setprinterdataex_max_len,
8632 { "Max len", "spoolss.setprinterdataex.max_len",
8633 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8635 { &hf_setprinterdataex_real_len,
8636 { "Real len", "spoolss.setprinterdataex.real_len",
8637 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8639 { &hf_setprinterdataex_data,
8640 { "Data", "spoolss.setprinterdataex.data",
8641 FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
8643 /* Specific access rights */
8645 { &hf_access_required,
8646 { "Access required", "spoolss.access_required",
8647 FT_UINT32, BASE_HEX, NULL, 0x0, NULL,
8648 HFILL }},
8650 { &hf_server_access_admin,
8651 { "Server admin", "spoolss.access_mask.server_admin",
8652 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
8653 SERVER_ACCESS_ADMINISTER, NULL, HFILL }},
8655 { &hf_server_access_enum,
8656 { "Server enum", "spoolss.access_mask.server_enum",
8657 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
8658 SERVER_ACCESS_ENUMERATE, NULL, HFILL }},
8660 { &hf_printer_access_admin,
8661 { "Printer admin", "spoolss.access_mask.printer_admin",
8662 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
8663 PRINTER_ACCESS_ADMINISTER, NULL, HFILL }},
8665 { &hf_printer_access_use,
8666 { "Printer use", "spoolss.access_mask.printer_use",
8667 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
8668 PRINTER_ACCESS_USE, NULL, HFILL }},
8670 { &hf_job_access_admin,
8671 { "Job admin", "spoolss.access_mask.job_admin",
8672 FT_BOOLEAN, 32, TFS(&tfs_set_notset),
8673 JOB_ACCESS_ADMINISTER, NULL, HFILL }},
8675 /* Printer information */
8677 { &hf_printer_cjobs,
8678 { "CJobs", "spoolss.printer.cjobs", FT_UINT32,
8679 BASE_DEC, NULL, 0, NULL, HFILL }},
8681 { &hf_printer_total_jobs,
8682 { "Total jobs", "spoolss.printer.total_jobs", FT_UINT32,
8683 BASE_DEC, NULL, 0, NULL, HFILL }},
8685 { &hf_printer_total_bytes,
8686 { "Total bytes", "spoolss.printer.total_bytes", FT_UINT32,
8687 BASE_DEC, NULL, 0, NULL, HFILL }},
8689 { &hf_printer_global_counter,
8690 { "Global counter", "spoolss.printer.global_counter",
8691 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8693 { &hf_printer_total_pages,
8694 { "Total pages", "spoolss.printer.total_pages", FT_UINT32,
8695 BASE_DEC, NULL, 0, NULL, HFILL }},
8697 { &hf_printer_major_version,
8698 { "Major version", "spoolss.printer.major_version",
8699 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
8701 { &hf_printer_build_version,
8702 { "Build version", "spoolss.printer.build_version",
8703 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
8705 { &hf_printer_unk7,
8706 { "Unknown 7", "spoolss.printer.unknown7", FT_UINT32,
8707 BASE_DEC, NULL, 0, NULL, HFILL }},
8709 { &hf_printer_unk8,
8710 { "Unknown 8", "spoolss.printer.unknown8", FT_UINT32,
8711 BASE_DEC, NULL, 0, NULL, HFILL }},
8713 { &hf_printer_unk9,
8714 { "Unknown 9", "spoolss.printer.unknown9", FT_UINT32,
8715 BASE_DEC, NULL, 0, NULL, HFILL }},
8717 { &hf_printer_session_ctr,
8718 { "Session counter", "spoolss.printer.session_ctr",
8719 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8721 { &hf_printer_unk11,
8722 { "Unknown 11", "spoolss.printer.unknown11", FT_UINT32,
8723 BASE_DEC, NULL, 0, NULL, HFILL }},
8725 { &hf_printer_printer_errors,
8726 { "Printer errors", "spoolss.printer.printer_errors",
8727 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8729 { &hf_printer_unk13,
8730 { "Unknown 13", "spoolss.printer.unknown13", FT_UINT32,
8731 BASE_DEC, NULL, 0, NULL, HFILL }},
8733 { &hf_printer_unk14,
8734 { "Unknown 14", "spoolss.printer.unknown14", FT_UINT32,
8735 BASE_DEC, NULL, 0, NULL, HFILL }},
8737 { &hf_printer_unk15,
8738 { "Unknown 15", "spoolss.printer.unknown15", FT_UINT32,
8739 BASE_DEC, NULL, 0, NULL, HFILL }},
8741 { &hf_printer_unk16,
8742 { "Unknown 16", "spoolss.printer.unknown16", FT_UINT32,
8743 BASE_DEC, NULL, 0, NULL, HFILL }},
8745 { &hf_printer_changeid,
8746 { "Change id", "spoolss.printer.changeid", FT_UINT32,
8747 BASE_DEC, NULL, 0, NULL, HFILL }},
8749 { &hf_printer_unk18,
8750 { "Unknown 18", "spoolss.printer.unknown18", FT_UINT32,
8751 BASE_DEC, NULL, 0, NULL, HFILL }},
8753 { &hf_printer_unk20,
8754 { "Unknown 20", "spoolss.printer.unknown20", FT_UINT32,
8755 BASE_DEC, NULL, 0, NULL, HFILL }},
8757 { &hf_printer_c_setprinter,
8758 { "Csetprinter", "spoolss.printer.c_setprinter",
8759 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8761 { &hf_printer_unk22,
8762 { "Unknown 22", "spoolss.printer.unknown22",
8763 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
8765 { &hf_printer_unk23,
8766 { "Unknown 23", "spoolss.printer.unknown23",
8767 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
8769 { &hf_printer_unk24,
8770 { "Unknown 24", "spoolss.printer.unknown24",
8771 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
8773 { &hf_printer_unk25,
8774 { "Unknown 25", "spoolss.printer.unknown25",
8775 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
8777 { &hf_printer_unk26,
8778 { "Unknown 26", "spoolss.printer.unknown26",
8779 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
8781 { &hf_printer_unk27,
8782 { "Unknown 27", "spoolss.printer.unknown27",
8783 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
8785 { &hf_printer_unk28,
8786 { "Unknown 28", "spoolss.printer.unknown28",
8787 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
8789 { &hf_printer_unk29,
8790 { "Unknown 29", "spoolss.printer.unknown29",
8791 FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
8793 { &hf_printer_flags,
8794 { "Flags", "spoolss.printer.flags",
8795 FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }},
8797 { &hf_printer_priority,
8798 { "Priority", "spoolss.printer.priority",
8799 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8801 { &hf_printer_default_priority,
8802 { "Default Priority", "spoolss.printer.default_priority",
8803 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8805 { &hf_printer_averageppm,
8806 { "Average PPM", "spoolss.printer.averageppm",
8807 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8809 { &hf_printer_jobs,
8810 { "Jobs", "spoolss.printer.jobs",
8811 FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
8813 { &hf_printer_guid,
8814 { "GUID", "spoolss.printer.guid", FT_STRING,
8815 BASE_NONE, NULL, 0, NULL, HFILL }},
8817 { &hf_printer_action,
8818 { "Action", "spoolss.printer.action", FT_UINT32, BASE_DEC,
8819 VALS(getprinter_action_vals), 0, NULL, HFILL }},
8822 static int *ett[] = {
8823 &ett_dcerpc_spoolss,
8824 &ett_PRINTER_DATATYPE,
8825 &ett_DEVMODE_CTR,
8826 &ett_DEVMODE,
8827 &ett_DEVMODE_fields,
8828 &ett_USER_LEVEL_CTR,
8829 &ett_USER_LEVEL_1,
8830 &ett_BUFFER,
8831 &ett_PRINTER_INFO,
8832 &ett_SPOOL_PRINTER_INFO_LEVEL,
8833 &ett_PRINTER_INFO_0,
8834 &ett_PRINTER_INFO_1,
8835 &ett_PRINTER_INFO_2,
8836 &ett_PRINTER_INFO_3,
8837 &ett_PRINTER_INFO_5,
8838 &ett_PRINTER_INFO_7,
8839 &ett_RELSTR,
8840 &ett_RELSTR_ARRAY,
8841 &ett_FORM_REL,
8842 &ett_FORM_CTR,
8843 &ett_FORM_1,
8844 &ett_JOB_INFO_1,
8845 &ett_JOB_INFO_2,
8846 &ett_SEC_DESC_BUF,
8847 &ett_SYSTEM_TIME,
8848 &ett_DOC_INFO_1,
8849 &ett_DOC_INFO,
8850 &ett_DOC_INFO_CTR,
8851 &ett_printerdata_value,
8852 &ett_printerdata_data,
8853 &ett_writeprinter_buffer,
8854 &ett_DRIVER_INFO_1,
8855 &ett_DRIVER_INFO_2,
8856 &ett_DRIVER_INFO_3,
8857 &ett_DRIVER_INFO_6,
8858 &ett_DRIVER_INFO_8,
8859 &ett_DRIVER_INFO_101,
8860 &ett_CORE_PRINTER_DRIVER,
8861 &ett_rffpcnex_flags,
8862 &ett_notify_options_flags,
8863 &ett_NOTIFY_INFO_DATA,
8864 &ett_NOTIFY_OPTION,
8865 &ett_printer_attributes,
8866 &ett_printer_driver_attributes,
8867 &ett_job_status,
8868 &ett_enumprinters_flags,
8869 &ett_PRINTER_DATA_CTR,
8870 &ett_printer_enumdataex_value,
8873 static ei_register_info ei[] = {
8874 { &ei_unimplemented_dissector, { "spoolss.unimplemented_dissector", PI_UNDECODED, PI_WARN, "Unimplemented dissector: SPOOLSS", EXPFILL }},
8875 { &ei_unknown_data, { "spoolss.unknown_data", PI_UNDECODED, PI_WARN, "Unknown data follows", EXPFILL }},
8876 { &ei_printer_info_level, { "spoolss.printer.unknown", PI_PROTOCOL, PI_WARN, "Unknown printer info level", EXPFILL }},
8877 { &ei_spool_printer_info_level, { "spoolss.spool_printer.unknown", PI_PROTOCOL, PI_WARN, "Unknown spool printer info level", EXPFILL }},
8878 { &ei_form_level, { "spoolss.form.level.unknown", PI_PROTOCOL, PI_WARN, "Unknown form info level", EXPFILL }},
8879 { &ei_job_info_level, { "spoolss.job_info.level.unknown", PI_PROTOCOL, PI_WARN, "Unknown job info level", EXPFILL }},
8880 { &ei_driver_info_level, { "spoolss.driver_info.level.unknown", PI_PROTOCOL, PI_WARN, "Unknown driver info level", EXPFILL }},
8881 { &ei_level, { "spoolss.level.unknown", PI_PROTOCOL, PI_WARN, "Info level unknown", EXPFILL }},
8882 { &ei_notify_info_data_type, { "spoolss.notify_info_data.type.unknown", PI_PROTOCOL, PI_WARN, "Unknown notify type", EXPFILL }},
8883 { &ei_enumprinterdataex_value, { "spoolss.enumprinterdataex.val_unknown", PI_PROTOCOL, PI_WARN, "Unknown value type", EXPFILL }},
8884 { &ei_buffer_size_too_long, { "spoolss.buffer.size.invalid", PI_PROTOCOL, PI_ERROR, "Buffer size too long", EXPFILL }},
8887 expert_module_t* expert_dcerpc_spoolss;
8889 proto_dcerpc_spoolss = proto_register_protocol("Microsoft Spool Subsystem", "SPOOLSS", "spoolss");
8891 proto_register_field_array(proto_dcerpc_spoolss, hf, array_length(hf));
8892 proto_register_subtree_array(ett, array_length(ett));
8893 expert_dcerpc_spoolss = expert_register_protocol(proto_dcerpc_spoolss);
8894 expert_register_field_array(expert_dcerpc_spoolss, ei, array_length(ei));
8897 /* Protocol handoff */
8899 static e_guid_t uuid_dcerpc_spoolss = {
8900 0x12345678, 0x1234, 0xabcd,
8901 { 0xef, 0x00, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab }
8904 static uint16_t ver_dcerpc_spoolss = 1;
8906 void
8907 proto_reg_handoff_dcerpc_spoolss(void)
8910 /* Register protocol as dcerpc */
8912 dcerpc_init_uuid(proto_dcerpc_spoolss, ett_dcerpc_spoolss,
8913 &uuid_dcerpc_spoolss, ver_dcerpc_spoolss,
8914 dcerpc_spoolss_dissectors, hf_opnum);
8918 * Editor modelines - https://www.wireshark.org/tools/modelines.html
8920 * Local variables:
8921 * c-basic-offset: 8
8922 * tab-width: 8
8923 * indent-tabs-mode: t
8924 * End:
8926 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
8927 * :indentSize=8:tabSize=8:noTabs=false: