HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-dcerpc-initshutdown.c
blob0f954b397f6a684d18750c6151d332122666343b
1 /* DO NOT EDIT
2 This filter was automatically generated
3 from initshutdown.idl and initshutdown.cnf.
5 Pidl is a perl based IDL compiler for DCE/RPC idl files.
6 It is maintained by the Samba team, not the Wireshark team.
7 Instructions on how to download and install Pidl can be
8 found at http://wiki.wireshark.org/Pidl
10 $Id$
14 #include "config.h"
15 #ifdef _MSC_VER
16 #pragma warning(disable:4005)
17 #pragma warning(disable:4013)
18 #pragma warning(disable:4018)
19 #pragma warning(disable:4101)
20 #endif
22 #include <glib.h>
23 #include <string.h>
24 #include <epan/packet.h>
26 #include "packet-dcerpc.h"
27 #include "packet-dcerpc-nt.h"
28 #include "packet-windows-common.h"
29 #include "packet-dcerpc-initshutdown.h"
31 /* Ett declarations */
32 static gint ett_dcerpc_initshutdown = -1;
33 static gint ett_initshutdown_initshutdown_ReasonFlags = -1;
36 /* Header field declarations */
37 static gint hf_initshutdown_initshutdown_InitEx_do_reboot = -1;
38 static gint hf_initshutdown_initshutdown_InitEx_force_apps = -1;
39 static gint hf_initshutdown_initshutdown_ReasonFlags_SHTDN_REASON_FLAG_PLANNED = -1;
40 static gint hf_initshutdown_initshutdown_ReasonFlags_SHTDN_REASON_FLAG_USER_DEFINED = -1;
41 static gint hf_initshutdown_initshutdown_InitEx_timeout = -1;
42 static gint hf_initshutdown_initshutdown_InitEx_hostname = -1;
43 static gint hf_initshutdown_werror = -1;
44 static gint hf_initshutdown_initshutdown_Abort_server = -1;
45 static gint hf_initshutdown_opnum = -1;
46 static gint hf_initshutdown_initshutdown_Init_hostname = -1;
47 static gint hf_initshutdown_initshutdown_InitEx_reason = -1;
48 static gint hf_initshutdown_initshutdown_Init_timeout = -1;
49 static gint hf_initshutdown_initshutdown_Init_force_apps = -1;
50 static gint hf_initshutdown_initshutdown_Init_do_reboot = -1;
51 static gint hf_initshutdown_initshutdown_Init_message = -1;
52 static gint hf_initshutdown_initshutdown_InitEx_message = -1;
54 static gint proto_dcerpc_initshutdown = -1;
55 /* Version information */
58 static e_uuid_t uuid_dcerpc_initshutdown = {
59 0x894de0c0, 0x0d55, 0x11d3,
60 { 0xa3, 0x22, 0x00, 0xc0, 0x4f, 0xa3, 0x21, 0xa1 }
62 static guint16 ver_dcerpc_initshutdown = 1;
64 const value_string initshutdown_initshutdown_ReasonMajor_vals[] = {
65 { SHTDN_REASON_MAJOR_OTHER, "SHTDN_REASON_MAJOR_OTHER" },
66 { SHTDN_REASON_MAJOR_HARDWARE, "SHTDN_REASON_MAJOR_HARDWARE" },
67 { SHTDN_REASON_MAJOR_OPERATINGSYSTEM, "SHTDN_REASON_MAJOR_OPERATINGSYSTEM" },
68 { SHTDN_REASON_MAJOR_SOFTWARE, "SHTDN_REASON_MAJOR_SOFTWARE" },
69 { SHTDN_REASON_MAJOR_APPLICATION, "SHTDN_REASON_MAJOR_APPLICATION" },
70 { SHTDN_REASON_MAJOR_SYSTEM, "SHTDN_REASON_MAJOR_SYSTEM" },
71 { SHTDN_REASON_MAJOR_POWER, "SHTDN_REASON_MAJOR_POWER" },
72 { SHTDN_REASON_MAJOR_LEGACY_API, "SHTDN_REASON_MAJOR_LEGACY_API" },
73 { 0, NULL }
75 const value_string initshutdown_initshutdown_ReasonMinor_vals[] = {
76 { SHTDN_REASON_MINOR_OTHER, "SHTDN_REASON_MINOR_OTHER" },
77 { SHTDN_REASON_MINOR_MAINTENANCE, "SHTDN_REASON_MINOR_MAINTENANCE" },
78 { SHTDN_REASON_MINOR_INSTALLATION, "SHTDN_REASON_MINOR_INSTALLATION" },
79 { SHTDN_REASON_MINOR_UPGRADE, "SHTDN_REASON_MINOR_UPGRADE" },
80 { SHTDN_REASON_MINOR_RECONFIG, "SHTDN_REASON_MINOR_RECONFIG" },
81 { SHTDN_REASON_MINOR_HUNG, "SHTDN_REASON_MINOR_HUNG" },
82 { SHTDN_REASON_MINOR_UNSTABLE, "SHTDN_REASON_MINOR_UNSTABLE" },
83 { SHTDN_REASON_MINOR_DISK, "SHTDN_REASON_MINOR_DISK" },
84 { SHTDN_REASON_MINOR_PROCESSOR, "SHTDN_REASON_MINOR_PROCESSOR" },
85 { SHTDN_REASON_MINOR_NETWORKCARD, "SHTDN_REASON_MINOR_NETWORKCARD" },
86 { SHTDN_REASON_MINOR_POWER_SUPPLY, "SHTDN_REASON_MINOR_POWER_SUPPLY" },
87 { SHTDN_REASON_MINOR_CORDUNPLUGGED, "SHTDN_REASON_MINOR_CORDUNPLUGGED" },
88 { SHTDN_REASON_MINOR_ENVIRONMENT, "SHTDN_REASON_MINOR_ENVIRONMENT" },
89 { SHTDN_REASON_MINOR_HARDWARE_DRIVER, "SHTDN_REASON_MINOR_HARDWARE_DRIVER" },
90 { SHTDN_REASON_MINOR_OTHERDRIVER, "SHTDN_REASON_MINOR_OTHERDRIVER" },
91 { SHTDN_REASON_MINOR_BLUESCREEN, "SHTDN_REASON_MINOR_BLUESCREEN" },
92 { SHTDN_REASON_MINOR_SERVICEPACK, "SHTDN_REASON_MINOR_SERVICEPACK" },
93 { SHTDN_REASON_MINOR_HOTFIX, "SHTDN_REASON_MINOR_HOTFIX" },
94 { SHTDN_REASON_MINOR_SECURITYFIX, "SHTDN_REASON_MINOR_SECURITYFIX" },
95 { SHTDN_REASON_MINOR_SECURITY, "SHTDN_REASON_MINOR_SECURITY" },
96 { SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY, "SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY" },
97 { SHTDN_REASON_MINOR_WMI, "SHTDN_REASON_MINOR_WMI" },
98 { SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL, "SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL" },
99 { SHTDN_REASON_MINOR_HOTFIX_UNINSTALL, "SHTDN_REASON_MINOR_HOTFIX_UNINSTALL" },
100 { SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL, "SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL" },
101 { SHTDN_REASON_MINOR_MMC, "SHTDN_REASON_MINOR_MMC" },
102 { SHTDN_REASON_MINOR_TERMSRV, "SHTDN_REASON_MINOR_TERMSRV" },
103 { 0, NULL }
105 static const true_false_string initshutdown_ReasonFlags_SHTDN_REASON_FLAG_USER_DEFINED_tfs = {
106 "SHTDN_REASON_FLAG_USER_DEFINED is SET",
107 "SHTDN_REASON_FLAG_USER_DEFINED is NOT SET",
109 static const true_false_string initshutdown_ReasonFlags_SHTDN_REASON_FLAG_PLANNED_tfs = {
110 "SHTDN_REASON_FLAG_PLANNED is SET",
111 "SHTDN_REASON_FLAG_PLANNED is NOT SET",
113 static int initshutdown_dissect_element_Init_hostname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
114 static int initshutdown_dissect_element_Init_hostname_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
115 static int initshutdown_dissect_element_Init_message(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
116 static int initshutdown_dissect_element_Init_message_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
117 static int initshutdown_dissect_element_Init_timeout(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
118 static int initshutdown_dissect_element_Init_force_apps(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
119 static int initshutdown_dissect_element_Init_do_reboot(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
120 static int initshutdown_dissect_element_Abort_server(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
121 static int initshutdown_dissect_element_Abort_server_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
122 static int initshutdown_dissect_element_InitEx_hostname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
123 static int initshutdown_dissect_element_InitEx_hostname_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
124 static int initshutdown_dissect_element_InitEx_message(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
125 static int initshutdown_dissect_element_InitEx_message_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
126 static int initshutdown_dissect_element_InitEx_timeout(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
127 static int initshutdown_dissect_element_InitEx_force_apps(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
128 static int initshutdown_dissect_element_InitEx_do_reboot(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
129 static int initshutdown_dissect_element_InitEx_reason(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_);
132 /* IDL: enum { */
133 /* IDL: SHTDN_REASON_MAJOR_OTHER=0x00000000, */
134 /* IDL: SHTDN_REASON_MAJOR_HARDWARE=0x00010000, */
135 /* IDL: SHTDN_REASON_MAJOR_OPERATINGSYSTEM=0x00020000, */
136 /* IDL: SHTDN_REASON_MAJOR_SOFTWARE=0x00030000, */
137 /* IDL: SHTDN_REASON_MAJOR_APPLICATION=0x00040000, */
138 /* IDL: SHTDN_REASON_MAJOR_SYSTEM=0x00050000, */
139 /* IDL: SHTDN_REASON_MAJOR_POWER=0x00060000, */
140 /* IDL: SHTDN_REASON_MAJOR_LEGACY_API=0x00070000, */
141 /* IDL: } */
144 initshutdown_dissect_enum_ReasonMajor(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 *param _U_)
146 guint32 parameter=0;
147 if(param){
148 parameter=(guint32)*param;
150 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_index, &parameter);
151 if(param){
152 *param=(guint32)parameter;
154 return offset;
158 /* IDL: enum { */
159 /* IDL: SHTDN_REASON_MINOR_OTHER=0x00000000, */
160 /* IDL: SHTDN_REASON_MINOR_MAINTENANCE=0x00000001, */
161 /* IDL: SHTDN_REASON_MINOR_INSTALLATION=0x00000002, */
162 /* IDL: SHTDN_REASON_MINOR_UPGRADE=0x00000003, */
163 /* IDL: SHTDN_REASON_MINOR_RECONFIG=0x00000004, */
164 /* IDL: SHTDN_REASON_MINOR_HUNG=0x00000005, */
165 /* IDL: SHTDN_REASON_MINOR_UNSTABLE=0x00000006, */
166 /* IDL: SHTDN_REASON_MINOR_DISK=0x00000007, */
167 /* IDL: SHTDN_REASON_MINOR_PROCESSOR=0x00000008, */
168 /* IDL: SHTDN_REASON_MINOR_NETWORKCARD=0x00000009, */
169 /* IDL: SHTDN_REASON_MINOR_POWER_SUPPLY=0x0000000a, */
170 /* IDL: SHTDN_REASON_MINOR_CORDUNPLUGGED=0x0000000b, */
171 /* IDL: SHTDN_REASON_MINOR_ENVIRONMENT=0x0000000c, */
172 /* IDL: SHTDN_REASON_MINOR_HARDWARE_DRIVER=0x0000000d, */
173 /* IDL: SHTDN_REASON_MINOR_OTHERDRIVER=0x0000000e, */
174 /* IDL: SHTDN_REASON_MINOR_BLUESCREEN=0x0000000f, */
175 /* IDL: SHTDN_REASON_MINOR_SERVICEPACK=0x00000010, */
176 /* IDL: SHTDN_REASON_MINOR_HOTFIX=0x00000011, */
177 /* IDL: SHTDN_REASON_MINOR_SECURITYFIX=0x00000012, */
178 /* IDL: SHTDN_REASON_MINOR_SECURITY=0x00000013, */
179 /* IDL: SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY=0x00000014, */
180 /* IDL: SHTDN_REASON_MINOR_WMI=0x00000015, */
181 /* IDL: SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL=0x00000016, */
182 /* IDL: SHTDN_REASON_MINOR_HOTFIX_UNINSTALL=0x00000017, */
183 /* IDL: SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL=0x00000018, */
184 /* IDL: SHTDN_REASON_MINOR_MMC=0x00000019, */
185 /* IDL: SHTDN_REASON_MINOR_TERMSRV=0x00000020, */
186 /* IDL: } */
189 initshutdown_dissect_enum_ReasonMinor(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 *param _U_)
191 guint32 parameter=0;
192 if(param){
193 parameter=(guint32)*param;
195 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_index, &parameter);
196 if(param){
197 *param=(guint32)parameter;
199 return offset;
203 /* IDL: bitmap { */
204 /* IDL: SHTDN_REASON_FLAG_USER_DEFINED = 0x40000000 , */
205 /* IDL: SHTDN_REASON_FLAG_PLANNED = 0x80000000 , */
206 /* IDL: } */
209 initshutdown_dissect_bitmap_ReasonFlags(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
211 proto_item *item = NULL;
212 proto_tree *tree = NULL;
214 guint32 flags;
215 ALIGN_TO_4_BYTES;
217 if (parent_tree) {
218 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
219 tree = proto_item_add_subtree(item,ett_initshutdown_initshutdown_ReasonFlags);
222 offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, di, drep, -1, &flags);
223 proto_item_append_text(item, ": ");
225 if (!flags)
226 proto_item_append_text(item, "(No values set)");
228 proto_tree_add_boolean(tree, hf_initshutdown_initshutdown_ReasonFlags_SHTDN_REASON_FLAG_USER_DEFINED, tvb, offset-4, 4, flags);
229 if (flags&( 0x40000000 )){
230 proto_item_append_text(item, "SHTDN_REASON_FLAG_USER_DEFINED");
231 if (flags & (~( 0x40000000 )))
232 proto_item_append_text(item, ", ");
234 flags&=(~( 0x40000000 ));
236 proto_tree_add_boolean(tree, hf_initshutdown_initshutdown_ReasonFlags_SHTDN_REASON_FLAG_PLANNED, tvb, offset-4, 4, flags);
237 if (flags&( 0x80000000 )){
238 proto_item_append_text(item, "SHTDN_REASON_FLAG_PLANNED");
239 if (flags & (~( 0x80000000 )))
240 proto_item_append_text(item, ", ");
242 flags&=(~( 0x80000000 ));
244 if (flags) {
245 proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
248 return offset;
251 static int
252 initshutdown_dissect_element_Init_hostname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
254 offset = dissect_ndr_toplevel_pointer(tvb, offset, pinfo, tree, di, drep, initshutdown_dissect_element_Init_hostname_, NDR_POINTER_UNIQUE, "Pointer to Hostname (uint16)",hf_initshutdown_initshutdown_Init_hostname);
256 return offset;
259 static int
260 initshutdown_dissect_element_Init_hostname_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
262 offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_Init_hostname, 0);
264 return offset;
267 static int
268 initshutdown_dissect_element_Init_message(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
270 offset = dissect_ndr_toplevel_pointer(tvb, offset, pinfo, tree, di, drep, initshutdown_dissect_element_Init_message_, NDR_POINTER_UNIQUE, "Pointer to Message (lsa_StringLarge)",hf_initshutdown_initshutdown_Init_message);
272 return offset;
275 static int
276 initshutdown_dissect_element_Init_message_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
278 offset=lsarpc_dissect_struct_lsa_StringLarge(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_Init_message, 0);
280 return offset;
283 static int
284 initshutdown_dissect_element_Init_timeout(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
286 offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_Init_timeout, 0);
288 return offset;
291 static int
292 initshutdown_dissect_element_Init_force_apps(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
294 offset = PIDL_dissect_uint8(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_Init_force_apps, 0);
296 return offset;
299 static int
300 initshutdown_dissect_element_Init_do_reboot(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
302 offset = PIDL_dissect_uint8(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_Init_do_reboot, 0);
304 return offset;
307 /* IDL: WERROR initshutdown_Init( */
308 /* IDL: [unique(1)] [in] uint16 *hostname, */
309 /* IDL: [unique(1)] [in] lsa_StringLarge *message, */
310 /* IDL: [in] uint32 timeout, */
311 /* IDL: [in] uint8 force_apps, */
312 /* IDL: [in] uint8 do_reboot */
313 /* IDL: ); */
315 static int
316 initshutdown_dissect_Init_response(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
318 guint32 status;
320 pinfo->dcerpc_procedure_name="Init";
321 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_werror, &status);
323 if (status != 0)
324 col_append_fstr(pinfo->cinfo, COL_INFO, ", Error: %s", val_to_str(status, WERR_errors, "Unknown DOS error 0x%08x"));
326 return offset;
329 static int
330 initshutdown_dissect_Init_request(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
332 pinfo->dcerpc_procedure_name="Init";
333 offset = initshutdown_dissect_element_Init_hostname(tvb, offset, pinfo, tree, di, drep);
334 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
335 offset = initshutdown_dissect_element_Init_message(tvb, offset, pinfo, tree, di, drep);
336 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
337 offset = initshutdown_dissect_element_Init_timeout(tvb, offset, pinfo, tree, di, drep);
338 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
339 offset = initshutdown_dissect_element_Init_force_apps(tvb, offset, pinfo, tree, di, drep);
340 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
341 offset = initshutdown_dissect_element_Init_do_reboot(tvb, offset, pinfo, tree, di, drep);
342 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
343 return offset;
346 static int
347 initshutdown_dissect_element_Abort_server(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
349 offset = dissect_ndr_toplevel_pointer(tvb, offset, pinfo, tree, di, drep, initshutdown_dissect_element_Abort_server_, NDR_POINTER_UNIQUE, "Pointer to Server (uint16)",hf_initshutdown_initshutdown_Abort_server);
351 return offset;
354 static int
355 initshutdown_dissect_element_Abort_server_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
357 offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_Abort_server, 0);
359 return offset;
362 /* IDL: WERROR initshutdown_Abort( */
363 /* IDL: [unique(1)] [in] uint16 *server */
364 /* IDL: ); */
366 static int
367 initshutdown_dissect_Abort_response(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
369 guint32 status;
371 pinfo->dcerpc_procedure_name="Abort";
372 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_werror, &status);
374 if (status != 0)
375 col_append_fstr(pinfo->cinfo, COL_INFO, ", Error: %s", val_to_str(status, WERR_errors, "Unknown DOS error 0x%08x"));
377 return offset;
380 static int
381 initshutdown_dissect_Abort_request(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
383 pinfo->dcerpc_procedure_name="Abort";
384 offset = initshutdown_dissect_element_Abort_server(tvb, offset, pinfo, tree, di, drep);
385 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
386 return offset;
389 static int
390 initshutdown_dissect_element_InitEx_hostname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
392 offset = dissect_ndr_toplevel_pointer(tvb, offset, pinfo, tree, di, drep, initshutdown_dissect_element_InitEx_hostname_, NDR_POINTER_UNIQUE, "Pointer to Hostname (uint16)",hf_initshutdown_initshutdown_InitEx_hostname);
394 return offset;
397 static int
398 initshutdown_dissect_element_InitEx_hostname_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
400 offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_InitEx_hostname, 0);
402 return offset;
405 static int
406 initshutdown_dissect_element_InitEx_message(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
408 offset = dissect_ndr_toplevel_pointer(tvb, offset, pinfo, tree, di, drep, initshutdown_dissect_element_InitEx_message_, NDR_POINTER_UNIQUE, "Pointer to Message (lsa_StringLarge)",hf_initshutdown_initshutdown_InitEx_message);
410 return offset;
413 static int
414 initshutdown_dissect_element_InitEx_message_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
416 offset=lsarpc_dissect_struct_lsa_StringLarge(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_InitEx_message, 0);
418 return offset;
421 static int
422 initshutdown_dissect_element_InitEx_timeout(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
424 offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_InitEx_timeout, 0);
426 return offset;
429 static int
430 initshutdown_dissect_element_InitEx_force_apps(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
432 offset = PIDL_dissect_uint8(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_InitEx_force_apps, 0);
434 return offset;
437 static int
438 initshutdown_dissect_element_InitEx_do_reboot(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
440 offset = PIDL_dissect_uint8(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_InitEx_do_reboot, 0);
442 return offset;
445 static int
446 initshutdown_dissect_element_InitEx_reason(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
448 offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_initshutdown_InitEx_reason, 0);
450 return offset;
453 /* IDL: WERROR initshutdown_InitEx( */
454 /* IDL: [unique(1)] [in] uint16 *hostname, */
455 /* IDL: [unique(1)] [in] lsa_StringLarge *message, */
456 /* IDL: [in] uint32 timeout, */
457 /* IDL: [in] uint8 force_apps, */
458 /* IDL: [in] uint8 do_reboot, */
459 /* IDL: [in] uint32 reason */
460 /* IDL: ); */
462 static int
463 initshutdown_dissect_InitEx_response(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
465 guint32 status;
467 pinfo->dcerpc_procedure_name="InitEx";
468 offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_initshutdown_werror, &status);
470 if (status != 0)
471 col_append_fstr(pinfo->cinfo, COL_INFO, ", Error: %s", val_to_str(status, WERR_errors, "Unknown DOS error 0x%08x"));
473 return offset;
476 static int
477 initshutdown_dissect_InitEx_request(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_)
479 pinfo->dcerpc_procedure_name="InitEx";
480 offset = initshutdown_dissect_element_InitEx_hostname(tvb, offset, pinfo, tree, di, drep);
481 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
482 offset = initshutdown_dissect_element_InitEx_message(tvb, offset, pinfo, tree, di, drep);
483 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
484 offset = initshutdown_dissect_element_InitEx_timeout(tvb, offset, pinfo, tree, di, drep);
485 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
486 offset = initshutdown_dissect_element_InitEx_force_apps(tvb, offset, pinfo, tree, di, drep);
487 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
488 offset = initshutdown_dissect_element_InitEx_do_reboot(tvb, offset, pinfo, tree, di, drep);
489 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
490 offset = initshutdown_dissect_element_InitEx_reason(tvb, offset, pinfo, tree, di, drep);
491 offset = dissect_deferred_pointers(pinfo, tvb, offset, di, drep);
492 return offset;
496 static dcerpc_sub_dissector initshutdown_dissectors[] = {
497 { 0, "Init",
498 initshutdown_dissect_Init_request, initshutdown_dissect_Init_response},
499 { 1, "Abort",
500 initshutdown_dissect_Abort_request, initshutdown_dissect_Abort_response},
501 { 2, "InitEx",
502 initshutdown_dissect_InitEx_request, initshutdown_dissect_InitEx_response},
503 { 0, NULL, NULL, NULL }
506 void proto_register_dcerpc_initshutdown(void)
508 static hf_register_info hf[] = {
509 { &hf_initshutdown_initshutdown_InitEx_do_reboot,
510 { "Do Reboot", "initshutdown.initshutdown_InitEx.do_reboot", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
511 { &hf_initshutdown_initshutdown_InitEx_force_apps,
512 { "Force Apps", "initshutdown.initshutdown_InitEx.force_apps", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
513 { &hf_initshutdown_initshutdown_ReasonFlags_SHTDN_REASON_FLAG_PLANNED,
514 { "Shtdn Reason Flag Planned", "initshutdown.initshutdown_ReasonFlags.SHTDN_REASON_FLAG_PLANNED", FT_BOOLEAN, 32, TFS(&initshutdown_ReasonFlags_SHTDN_REASON_FLAG_PLANNED_tfs), ( 0x80000000 ), NULL, HFILL }},
515 { &hf_initshutdown_initshutdown_ReasonFlags_SHTDN_REASON_FLAG_USER_DEFINED,
516 { "Shtdn Reason Flag User Defined", "initshutdown.initshutdown_ReasonFlags.SHTDN_REASON_FLAG_USER_DEFINED", FT_BOOLEAN, 32, TFS(&initshutdown_ReasonFlags_SHTDN_REASON_FLAG_USER_DEFINED_tfs), ( 0x40000000 ), NULL, HFILL }},
517 { &hf_initshutdown_initshutdown_InitEx_timeout,
518 { "Timeout", "initshutdown.initshutdown_InitEx.timeout", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
519 { &hf_initshutdown_initshutdown_InitEx_hostname,
520 { "Hostname", "initshutdown.initshutdown_InitEx.hostname", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
521 { &hf_initshutdown_werror,
522 { "Windows Error", "initshutdown.werror", FT_UINT32, BASE_HEX, VALS(WERR_errors), 0, NULL, HFILL }},
523 { &hf_initshutdown_initshutdown_Abort_server,
524 { "Server", "initshutdown.initshutdown_Abort.server", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
525 { &hf_initshutdown_opnum,
526 { "Operation", "initshutdown.opnum", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
527 { &hf_initshutdown_initshutdown_Init_hostname,
528 { "Hostname", "initshutdown.initshutdown_Init.hostname", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
529 { &hf_initshutdown_initshutdown_InitEx_reason,
530 { "Reason", "initshutdown.initshutdown_InitEx.reason", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
531 { &hf_initshutdown_initshutdown_Init_timeout,
532 { "Timeout", "initshutdown.initshutdown_Init.timeout", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
533 { &hf_initshutdown_initshutdown_Init_force_apps,
534 { "Force Apps", "initshutdown.initshutdown_Init.force_apps", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
535 { &hf_initshutdown_initshutdown_Init_do_reboot,
536 { "Do Reboot", "initshutdown.initshutdown_Init.do_reboot", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
537 { &hf_initshutdown_initshutdown_Init_message,
538 { "Message", "initshutdown.initshutdown_Init.message", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
539 { &hf_initshutdown_initshutdown_InitEx_message,
540 { "Message", "initshutdown.initshutdown_InitEx.message", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
544 static gint *ett[] = {
545 &ett_dcerpc_initshutdown,
546 &ett_initshutdown_initshutdown_ReasonFlags,
549 proto_dcerpc_initshutdown = proto_register_protocol("Init shutdown service", "INITSHUTDOWN", "initshutdown");
550 proto_register_field_array(proto_dcerpc_initshutdown, hf, array_length (hf));
551 proto_register_subtree_array(ett, array_length(ett));
554 void proto_reg_handoff_dcerpc_initshutdown(void)
556 dcerpc_init_uuid(proto_dcerpc_initshutdown, ett_dcerpc_initshutdown,
557 &uuid_dcerpc_initshutdown, ver_dcerpc_initshutdown,
558 initshutdown_dissectors, hf_initshutdown_opnum);