From Kovarththanan Rajaratnam via bug 3548:
[obnox/wireshark/wip.git] / epan / dissectors / packet-dcerpc-initshutdown.c
1 /* DO NOT EDIT
2         This filter was automatically generated
3         from initshutdown.idl and initshutdown.cnf.
4         
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
9 */
10
11
12 #ifdef HAVE_CONFIG_H
13 #include "config.h"
14 #endif
15
16 #ifdef _MSC_VER
17 #pragma warning(disable:4005)
18 #pragma warning(disable:4013)
19 #pragma warning(disable:4018)
20 #pragma warning(disable:4101)
21 #endif
22
23 #include <glib.h>
24 #include <string.h>
25 #include <epan/packet.h>
26
27 #include "packet-dcerpc.h"
28 #include "packet-dcerpc-nt.h"
29 #include "packet-windows-common.h"
30 #include "packet-dcerpc-initshutdown.h"
31
32 /* Ett declarations */
33 static gint ett_dcerpc_initshutdown = -1;
34 static gint ett_initshutdown_initshutdown_String_sub = -1;
35 static gint ett_initshutdown_initshutdown_String = -1;
36
37
38 /* Header field declarations */
39 static gint hf_initshutdown_initshutdown_String_name_len = -1;
40 static gint hf_initshutdown_initshutdown_Abort_server = -1;
41 static gint hf_initshutdown_initshutdown_Init_message = -1;
42 static gint hf_initshutdown_initshutdown_Init_hostname = -1;
43 static gint hf_initshutdown_initshutdown_InitEx_reboot = -1;
44 static gint hf_initshutdown_initshutdown_InitEx_reason = -1;
45 static gint hf_initshutdown_initshutdown_String_name_size = -1;
46 static gint hf_initshutdown_initshutdown_Init_timeout = -1;
47 static gint hf_initshutdown_initshutdown_InitEx_hostname = -1;
48 static gint hf_initshutdown_initshutdown_InitEx_message = -1;
49 static gint hf_initshutdown_initshutdown_String_name = -1;
50 static gint hf_initshutdown_initshutdown_Init_reboot = -1;
51 static gint hf_initshutdown_opnum = -1;
52 static gint hf_initshutdown_initshutdown_Init_force_apps = -1;
53 static gint hf_initshutdown_initshutdown_String_sub_name = -1;
54 static gint hf_initshutdown_werror = -1;
55 static gint hf_initshutdown_initshutdown_String_sub_name_size = -1;
56 static gint hf_initshutdown_initshutdown_InitEx_force_apps = -1;
57 static gint hf_initshutdown_initshutdown_InitEx_timeout = -1;
58
59 static gint proto_dcerpc_initshutdown = -1;
60 /* Version information */
61
62
63 static e_uuid_t uuid_dcerpc_initshutdown = {
64         0x894de0c0, 0x0d55, 0x11d3,
65         { 0xa3, 0x22, 0x00, 0xc0, 0x4f, 0xa3, 0x21, 0xa1 }
66 };
67 static guint16 ver_dcerpc_initshutdown = 1;
68
69 static int initshutdown_dissect_element_String_sub_name_size(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
70 static int initshutdown_dissect_element_String_sub_name(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
71 static int initshutdown_dissect_element_String_name_len(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
72 static int initshutdown_dissect_element_String_name_size(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
73 static int initshutdown_dissect_element_String_name(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
74 static int initshutdown_dissect_element_String_name_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
75 static int initshutdown_dissect_element_Init_hostname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
76 static int initshutdown_dissect_element_Init_hostname_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
77 static int initshutdown_dissect_element_Init_message(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
78 static int initshutdown_dissect_element_Init_message_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
79 static int initshutdown_dissect_element_Init_timeout(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
80 static int initshutdown_dissect_element_Init_force_apps(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
81 static int initshutdown_dissect_element_Init_reboot(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
82 static int initshutdown_dissect_element_Abort_server(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
83 static int initshutdown_dissect_element_Abort_server_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
84 static int initshutdown_dissect_element_InitEx_hostname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
85 static int initshutdown_dissect_element_InitEx_hostname_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
86 static int initshutdown_dissect_element_InitEx_message(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
87 static int initshutdown_dissect_element_InitEx_message_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
88 static int initshutdown_dissect_element_InitEx_timeout(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
89 static int initshutdown_dissect_element_InitEx_force_apps(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
90 static int initshutdown_dissect_element_InitEx_reboot(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
91 static int initshutdown_dissect_element_InitEx_reason(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
92
93
94 /* IDL: struct { */
95 /* IDL:         [value(strlen_m_term(name))] uint32 name_size; */
96 /* IDL:         [flag(LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM)] string name; */
97 /* IDL: } */
98
99 static int
100 initshutdown_dissect_element_String_sub_name_size(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
101 {
102         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_String_sub_name_size, 0);
103
104         return offset;
105 }
106
107 static int
108 initshutdown_dissect_element_String_sub_name(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
109 {
110
111         return offset;
112 }
113
114 int
115 initshutdown_dissect_struct_String_sub(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
116 {
117         proto_item *item = NULL;
118         proto_tree *tree = NULL;
119         int old_offset;
120
121         ALIGN_TO_4_BYTES;
122
123         old_offset = offset;
124
125         if (parent_tree) {
126                 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE);
127                 tree = proto_item_add_subtree(item, ett_initshutdown_initshutdown_String_sub);
128         }
129         
130         offset = initshutdown_dissect_element_String_sub_name_size(tvb, offset, pinfo, tree, drep);
131
132         offset = initshutdown_dissect_element_String_sub_name(tvb, offset, pinfo, tree, drep);
133
134
135         proto_item_set_len(item, offset-old_offset);
136
137         return offset;
138 }
139
140
141 /* IDL: struct { */
142 /* IDL:         [value(strlen_m(name->name)*2)] uint16 name_len; */
143 /* IDL:         [value(strlen_m_term(name->name)*2)] uint16 name_size; */
144 /* IDL:         [unique(1)] initshutdown_String_sub *name; */
145 /* IDL: } */
146
147 static int
148 initshutdown_dissect_element_String_name_len(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
149 {
150         offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_String_name_len, 0);
151
152         return offset;
153 }
154
155 static int
156 initshutdown_dissect_element_String_name_size(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
157 {
158         offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_String_name_size, 0);
159
160         return offset;
161 }
162
163 static int
164 initshutdown_dissect_element_String_name(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
165 {
166         offset = dissect_ndr_embedded_pointer(tvb, offset, pinfo, tree, drep, initshutdown_dissect_element_String_name_, NDR_POINTER_UNIQUE, "Pointer to Name (initshutdown_String_sub)",hf_initshutdown_initshutdown_String_name);
167
168         return offset;
169 }
170
171 static int
172 initshutdown_dissect_element_String_name_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
173 {
174         offset = initshutdown_dissect_struct_String_sub(tvb,offset,pinfo,tree,drep,hf_initshutdown_initshutdown_String_name,0);
175
176         return offset;
177 }
178
179 int
180 initshutdown_dissect_struct_String(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_)
181 {
182         proto_item *item = NULL;
183         proto_tree *tree = NULL;
184         int old_offset;
185
186         ALIGN_TO_4_BYTES;
187
188         old_offset = offset;
189
190         if (parent_tree) {
191                 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE);
192                 tree = proto_item_add_subtree(item, ett_initshutdown_initshutdown_String);
193         }
194         
195         offset = initshutdown_dissect_element_String_name_len(tvb, offset, pinfo, tree, drep);
196
197         offset = initshutdown_dissect_element_String_name_size(tvb, offset, pinfo, tree, drep);
198
199         offset = initshutdown_dissect_element_String_name(tvb, offset, pinfo, tree, drep);
200
201
202         proto_item_set_len(item, offset-old_offset);
203
204         return offset;
205 }
206
207 static int
208 initshutdown_dissect_element_Init_hostname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
209 {
210         offset = dissect_ndr_toplevel_pointer(tvb, offset, pinfo, tree, drep, initshutdown_dissect_element_Init_hostname_, NDR_POINTER_UNIQUE, "Pointer to Hostname (uint16)",hf_initshutdown_initshutdown_Init_hostname);
211
212         return offset;
213 }
214
215 static int
216 initshutdown_dissect_element_Init_hostname_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
217 {
218         offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_Init_hostname, 0);
219
220         return offset;
221 }
222
223 static int
224 initshutdown_dissect_element_Init_message(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
225 {
226         offset = dissect_ndr_toplevel_pointer(tvb, offset, pinfo, tree, drep, initshutdown_dissect_element_Init_message_, NDR_POINTER_UNIQUE, "Pointer to Message (initshutdown_String)",hf_initshutdown_initshutdown_Init_message);
227
228         return offset;
229 }
230
231 static int
232 initshutdown_dissect_element_Init_message_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
233 {
234         offset = initshutdown_dissect_struct_String(tvb,offset,pinfo,tree,drep,hf_initshutdown_initshutdown_Init_message,0);
235
236         return offset;
237 }
238
239 static int
240 initshutdown_dissect_element_Init_timeout(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
241 {
242         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_Init_timeout, 0);
243
244         return offset;
245 }
246
247 static int
248 initshutdown_dissect_element_Init_force_apps(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
249 {
250         offset = PIDL_dissect_uint8(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_Init_force_apps, 0);
251
252         return offset;
253 }
254
255 static int
256 initshutdown_dissect_element_Init_reboot(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
257 {
258         offset = PIDL_dissect_uint8(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_Init_reboot, 0);
259
260         return offset;
261 }
262
263 /* IDL: WERROR initshutdown_Init( */
264 /* IDL: [in] [unique(1)] uint16 *hostname, */
265 /* IDL: [in] [unique(1)] initshutdown_String *message, */
266 /* IDL: [in] uint32 timeout, */
267 /* IDL: [in] uint8 force_apps, */
268 /* IDL: [in] uint8 reboot */
269 /* IDL: ); */
270
271 static int
272 initshutdown_dissect_Init_response(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
273 {
274         guint32 status;
275
276         pinfo->dcerpc_procedure_name="Init";
277         offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_initshutdown_werror, &status);
278
279         if (status != 0 && check_col(pinfo->cinfo, COL_INFO))
280                 col_append_fstr(pinfo->cinfo, COL_INFO, ", Error: %s", val_to_str(status, WERR_errors, "Unknown DOS error 0x%08x"));
281
282         return offset;
283 }
284
285 static int
286 initshutdown_dissect_Init_request(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
287 {
288         pinfo->dcerpc_procedure_name="Init";
289         offset = initshutdown_dissect_element_Init_hostname(tvb, offset, pinfo, tree, drep);
290         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
291         offset = initshutdown_dissect_element_Init_message(tvb, offset, pinfo, tree, drep);
292         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
293         offset = initshutdown_dissect_element_Init_timeout(tvb, offset, pinfo, tree, drep);
294         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
295         offset = initshutdown_dissect_element_Init_force_apps(tvb, offset, pinfo, tree, drep);
296         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
297         offset = initshutdown_dissect_element_Init_reboot(tvb, offset, pinfo, tree, drep);
298         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
299         return offset;
300 }
301
302 static int
303 initshutdown_dissect_element_Abort_server(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
304 {
305         offset = dissect_ndr_toplevel_pointer(tvb, offset, pinfo, tree, drep, initshutdown_dissect_element_Abort_server_, NDR_POINTER_UNIQUE, "Pointer to Server (uint16)",hf_initshutdown_initshutdown_Abort_server);
306
307         return offset;
308 }
309
310 static int
311 initshutdown_dissect_element_Abort_server_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
312 {
313         offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_Abort_server, 0);
314
315         return offset;
316 }
317
318 /* IDL: WERROR initshutdown_Abort( */
319 /* IDL: [in] [unique(1)] uint16 *server */
320 /* IDL: ); */
321
322 static int
323 initshutdown_dissect_Abort_response(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
324 {
325         guint32 status;
326
327         pinfo->dcerpc_procedure_name="Abort";
328         offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_initshutdown_werror, &status);
329
330         if (status != 0 && check_col(pinfo->cinfo, COL_INFO))
331                 col_append_fstr(pinfo->cinfo, COL_INFO, ", Error: %s", val_to_str(status, WERR_errors, "Unknown DOS error 0x%08x"));
332
333         return offset;
334 }
335
336 static int
337 initshutdown_dissect_Abort_request(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
338 {
339         pinfo->dcerpc_procedure_name="Abort";
340         offset = initshutdown_dissect_element_Abort_server(tvb, offset, pinfo, tree, drep);
341         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
342         return offset;
343 }
344
345 static int
346 initshutdown_dissect_element_InitEx_hostname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
347 {
348         offset = dissect_ndr_toplevel_pointer(tvb, offset, pinfo, tree, drep, initshutdown_dissect_element_InitEx_hostname_, NDR_POINTER_UNIQUE, "Pointer to Hostname (uint16)",hf_initshutdown_initshutdown_InitEx_hostname);
349
350         return offset;
351 }
352
353 static int
354 initshutdown_dissect_element_InitEx_hostname_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
355 {
356         offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_InitEx_hostname, 0);
357
358         return offset;
359 }
360
361 static int
362 initshutdown_dissect_element_InitEx_message(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
363 {
364         offset = dissect_ndr_toplevel_pointer(tvb, offset, pinfo, tree, drep, initshutdown_dissect_element_InitEx_message_, NDR_POINTER_UNIQUE, "Pointer to Message (initshutdown_String)",hf_initshutdown_initshutdown_InitEx_message);
365
366         return offset;
367 }
368
369 static int
370 initshutdown_dissect_element_InitEx_message_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
371 {
372         offset = initshutdown_dissect_struct_String(tvb,offset,pinfo,tree,drep,hf_initshutdown_initshutdown_InitEx_message,0);
373
374         return offset;
375 }
376
377 static int
378 initshutdown_dissect_element_InitEx_timeout(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
379 {
380         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_InitEx_timeout, 0);
381
382         return offset;
383 }
384
385 static int
386 initshutdown_dissect_element_InitEx_force_apps(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
387 {
388         offset = PIDL_dissect_uint8(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_InitEx_force_apps, 0);
389
390         return offset;
391 }
392
393 static int
394 initshutdown_dissect_element_InitEx_reboot(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
395 {
396         offset = PIDL_dissect_uint8(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_InitEx_reboot, 0);
397
398         return offset;
399 }
400
401 static int
402 initshutdown_dissect_element_InitEx_reason(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
403 {
404         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_initshutdown_initshutdown_InitEx_reason, 0);
405
406         return offset;
407 }
408
409 /* IDL: WERROR initshutdown_InitEx( */
410 /* IDL: [in] [unique(1)] uint16 *hostname, */
411 /* IDL: [in] [unique(1)] initshutdown_String *message, */
412 /* IDL: [in] uint32 timeout, */
413 /* IDL: [in] uint8 force_apps, */
414 /* IDL: [in] uint8 reboot, */
415 /* IDL: [in] uint32 reason */
416 /* IDL: ); */
417
418 static int
419 initshutdown_dissect_InitEx_response(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
420 {
421         guint32 status;
422
423         pinfo->dcerpc_procedure_name="InitEx";
424         offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_initshutdown_werror, &status);
425
426         if (status != 0 && check_col(pinfo->cinfo, COL_INFO))
427                 col_append_fstr(pinfo->cinfo, COL_INFO, ", Error: %s", val_to_str(status, WERR_errors, "Unknown DOS error 0x%08x"));
428
429         return offset;
430 }
431
432 static int
433 initshutdown_dissect_InitEx_request(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
434 {
435         pinfo->dcerpc_procedure_name="InitEx";
436         offset = initshutdown_dissect_element_InitEx_hostname(tvb, offset, pinfo, tree, drep);
437         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
438         offset = initshutdown_dissect_element_InitEx_message(tvb, offset, pinfo, tree, drep);
439         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
440         offset = initshutdown_dissect_element_InitEx_timeout(tvb, offset, pinfo, tree, drep);
441         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
442         offset = initshutdown_dissect_element_InitEx_force_apps(tvb, offset, pinfo, tree, drep);
443         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
444         offset = initshutdown_dissect_element_InitEx_reboot(tvb, offset, pinfo, tree, drep);
445         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
446         offset = initshutdown_dissect_element_InitEx_reason(tvb, offset, pinfo, tree, drep);
447         offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);
448         return offset;
449 }
450
451
452 static dcerpc_sub_dissector initshutdown_dissectors[] = {
453         { 0, "Init",
454            initshutdown_dissect_Init_request, initshutdown_dissect_Init_response},
455         { 1, "Abort",
456            initshutdown_dissect_Abort_request, initshutdown_dissect_Abort_response},
457         { 2, "InitEx",
458            initshutdown_dissect_InitEx_request, initshutdown_dissect_InitEx_response},
459         { 0, NULL, NULL, NULL }
460 };
461
462 void proto_register_dcerpc_initshutdown(void)
463 {
464         static hf_register_info hf[] = {
465         { &hf_initshutdown_initshutdown_String_name_len, 
466           { "Name Len", "initshutdown.initshutdown_String.name_len", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
467         { &hf_initshutdown_initshutdown_Abort_server, 
468           { "Server", "initshutdown.initshutdown_Abort.server", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
469         { &hf_initshutdown_initshutdown_Init_message, 
470           { "Message", "initshutdown.initshutdown_Init.message", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
471         { &hf_initshutdown_initshutdown_Init_hostname, 
472           { "Hostname", "initshutdown.initshutdown_Init.hostname", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
473         { &hf_initshutdown_initshutdown_InitEx_reboot, 
474           { "Reboot", "initshutdown.initshutdown_InitEx.reboot", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
475         { &hf_initshutdown_initshutdown_InitEx_reason, 
476           { "Reason", "initshutdown.initshutdown_InitEx.reason", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
477         { &hf_initshutdown_initshutdown_String_name_size, 
478           { "Name Size", "initshutdown.initshutdown_String.name_size", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
479         { &hf_initshutdown_initshutdown_Init_timeout, 
480           { "Timeout", "initshutdown.initshutdown_Init.timeout", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
481         { &hf_initshutdown_initshutdown_InitEx_hostname, 
482           { "Hostname", "initshutdown.initshutdown_InitEx.hostname", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
483         { &hf_initshutdown_initshutdown_InitEx_message, 
484           { "Message", "initshutdown.initshutdown_InitEx.message", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
485         { &hf_initshutdown_initshutdown_String_name, 
486           { "Name", "initshutdown.initshutdown_String.name", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
487         { &hf_initshutdown_initshutdown_Init_reboot, 
488           { "Reboot", "initshutdown.initshutdown_Init.reboot", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
489         { &hf_initshutdown_opnum, 
490           { "Operation", "initshutdown.opnum", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
491         { &hf_initshutdown_initshutdown_Init_force_apps, 
492           { "Force Apps", "initshutdown.initshutdown_Init.force_apps", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
493         { &hf_initshutdown_initshutdown_String_sub_name, 
494           { "Name", "initshutdown.initshutdown_String_sub.name", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
495         { &hf_initshutdown_werror, 
496           { "Windows Error", "initshutdown.werror", FT_UINT32, BASE_HEX, VALS(WERR_errors), 0, NULL, HFILL }},
497         { &hf_initshutdown_initshutdown_String_sub_name_size, 
498           { "Name Size", "initshutdown.initshutdown_String_sub.name_size", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
499         { &hf_initshutdown_initshutdown_InitEx_force_apps, 
500           { "Force Apps", "initshutdown.initshutdown_InitEx.force_apps", FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL }},
501         { &hf_initshutdown_initshutdown_InitEx_timeout, 
502           { "Timeout", "initshutdown.initshutdown_InitEx.timeout", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
503         };
504
505
506         static gint *ett[] = {
507                 &ett_dcerpc_initshutdown,
508                 &ett_initshutdown_initshutdown_String_sub,
509                 &ett_initshutdown_initshutdown_String,
510         };
511
512         proto_dcerpc_initshutdown = proto_register_protocol("Init shutdown service", "INITSHUTDOWN", "initshutdown");
513         proto_register_field_array(proto_dcerpc_initshutdown, hf, array_length (hf));
514         proto_register_subtree_array(ett, array_length(ett));
515 }
516
517 void proto_reg_handoff_dcerpc_initshutdown(void)
518 {
519         dcerpc_init_uuid(proto_dcerpc_initshutdown, ett_dcerpc_initshutdown,
520                 &uuid_dcerpc_initshutdown, ver_dcerpc_initshutdown,
521                 initshutdown_dissectors, hf_initshutdown_opnum);
522 }