873f59eb4e09dd48fd0fc7f0127da7e9714d7a0e
[metze/samba/wip.git] / bin / default / librpc / gen_ndr / packet-dcerpc-misc.c
1 /* DO NOT EDIT
2         This filter was automatically generated
3         from /home/metze/devel/samba/4.0/master4-franky/librpc/idl/misc.idl and /home/metze/devel/samba/4.0/master4-franky/librpc/idl/misc.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         $Id$
11 */
12
13
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
21
22 #include <glib.h>
23 #include <string.h>
24 #include <epan/packet.h>
25
26 #include "packet-dcerpc.h"
27 #include "packet-dcerpc-nt.h"
28 #include "packet-windows-common.h"
29 #include "packet-dcerpc-misc.h"
30
31 /* Ett declarations */
32 static gint ett_dcerpc_misc = -1;
33 static gint ett_misc_GUID = -1;
34 static gint ett_misc_ndr_syntax_id = -1;
35 static gint ett_misc_policy_handle = -1;
36 static gint ett_misc_KRB5_EDATA_NTSTATUS = -1;
37 static gint ett_misc_winreg_Data = -1;
38 static gint ett_misc_svcctl_ServerType = -1;
39
40
41 /* Header field declarations */
42 static gint hf_misc_svcctl_ServerType_SV_TYPE_SERVER = -1;
43 static gint hf_misc_GUID_time_low = -1;
44 static gint hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_MASTER = -1;
45 static gint hf_misc_svcctl_ServerType_SV_TYPE_PRINTQ_SERVER = -1;
46 static gint hf_misc_KRB5_EDATA_NTSTATUS_unknown2 = -1;
47 static gint hf_misc_GUID_time_hi_and_version = -1;
48 static gint hf_misc_svcctl_ServerType_SV_TYPE_WIN95_PLUS = -1;
49 static gint hf_misc_svcctl_ServerType_SV_TYPE_NOVELL = -1;
50 static gint hf_misc_svcctl_ServerType_SV_TYPE_TIME_SOURCE = -1;
51 static gint hf_misc_GUID_node = -1;
52 static gint hf_misc_winreg_Data_string = -1;
53 static gint hf_misc_svcctl_ServerType_SV_TYPE_BACKUP_BROWSER = -1;
54 static gint hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_CTRL = -1;
55 static gint hf_misc_winreg_Data_data = -1;
56 static gint hf_misc_winreg_Data_binary = -1;
57 static gint hf_misc_policy_handle_uuid = -1;
58 static gint hf_misc_policy_handle_handle_type = -1;
59 static gint hf_misc_svcctl_ServerType_SV_TYPE_WORKSTATION = -1;
60 static gint hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_MEMBER = -1;
61 static gint hf_misc_svcctl_ServerType_SV_TYPE_SERVER_OSF = -1;
62 static gint hf_misc_svcctl_ServerType_SV_TYPE_SERVER_MFPN = -1;
63 static gint hf_misc_svcctl_ServerType_SV_TYPE_DFS_SERVER = -1;
64 static gint hf_misc_svcctl_ServerType_SV_TYPE_ALTERNATE_XPORT = -1;
65 static gint hf_misc_GUID_time_mid = -1;
66 static gint hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_ENUM = -1;
67 static gint hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_BAKCTRL = -1;
68 static gint hf_misc_winreg_Data_value = -1;
69 static gint hf_misc_svcctl_ServerType_SV_TYPE_DIALIN_SERVER = -1;
70 static gint hf_misc_svcctl_ServerType_SV_TYPE_SQLSERVER = -1;
71 static gint hf_misc_svcctl_ServerType_SV_TYPE_POTENTIAL_BROWSER = -1;
72 static gint hf_misc_svcctl_ServerType_SV_TYPE_LOCAL_LIST_ONLY = -1;
73 static gint hf_misc_svcctl_ServerType_SV_TYPE_WFW = -1;
74 static gint hf_misc_svcctl_ServerType_SV_TYPE_SERVER_NT = -1;
75 static gint hf_misc_KRB5_EDATA_NTSTATUS_ntstatus = -1;
76 static gint hf_misc_svcctl_ServerType_SV_TYPE_SERVER_UNIX = -1;
77 static gint hf_misc_svcctl_ServerType_SV_TYPE_SERVER_VMS = -1;
78 static gint hf_misc_KRB5_EDATA_NTSTATUS_unknown1 = -1;
79 static gint hf_misc_ndr_syntax_id_uuid = -1;
80 static gint hf_misc_opnum = -1;
81 static gint hf_misc_svcctl_ServerType_SV_TYPE_AFP = -1;
82 static gint hf_misc_svcctl_ServerType_SV_TYPE_MASTER_BROWSER = -1;
83 static gint hf_misc_GUID_clock_seq = -1;
84 static gint hf_misc_svcctl_ServerType_SV_TYPE_NT = -1;
85 static gint hf_misc_ndr_syntax_id_if_version = -1;
86 static gint hf_misc_winreg_Data_string_array = -1;
87
88 static gint proto_dcerpc_misc = -1;
89 /* Version information */
90
91
92 static e_uuid_t uuid_dcerpc_misc = {
93         0x, 0x, 0x,
94         { 0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x }
95 };
96 static guint16 ver_dcerpc_misc = 0;
97
98 static int misc_dissect_element_GUID_time_low(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
99 static int misc_dissect_element_GUID_time_mid(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
100 static int misc_dissect_element_GUID_time_hi_and_version(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
101 static int misc_dissect_element_GUID_clock_seq(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
102 static int misc_dissect_element_GUID_clock_seq_(tvbuff_t *tvb _U_, int offset _U_,int length _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
103 static int misc_dissect_element_GUID_node(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
104 static int misc_dissect_element_GUID_node_(tvbuff_t *tvb _U_, int offset _U_,int length _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
105 static int misc_dissect_element_ndr_syntax_id_uuid(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
106 static int misc_dissect_element_ndr_syntax_id_if_version(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
107 static int misc_dissect_element_policy_handle_handle_type(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
108 static int misc_dissect_element_policy_handle_uuid(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
109 const value_string misc_netr_SchannelType_vals[] = {
110         { SEC_CHAN_NULL, "SEC_CHAN_NULL" },
111         { SEC_CHAN_LOCAL, "SEC_CHAN_LOCAL" },
112         { SEC_CHAN_WKSTA, "SEC_CHAN_WKSTA" },
113         { SEC_CHAN_DNS_DOMAIN, "SEC_CHAN_DNS_DOMAIN" },
114         { SEC_CHAN_DOMAIN, "SEC_CHAN_DOMAIN" },
115         { SEC_CHAN_LANMAN, "SEC_CHAN_LANMAN" },
116         { SEC_CHAN_BDC, "SEC_CHAN_BDC" },
117         { SEC_CHAN_RODC, "SEC_CHAN_RODC" },
118 { 0, NULL }
119 };
120 static int misc_dissect_element_KRB5_EDATA_NTSTATUS_ntstatus(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
121 static int misc_dissect_element_KRB5_EDATA_NTSTATUS_unknown1(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
122 static int misc_dissect_element_KRB5_EDATA_NTSTATUS_unknown2(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
123 const value_string misc_winreg_Type_vals[] = {
124         { REG_NONE, "REG_NONE" },
125         { REG_SZ, "REG_SZ" },
126         { REG_EXPAND_SZ, "REG_EXPAND_SZ" },
127         { REG_BINARY, "REG_BINARY" },
128         { REG_DWORD, "REG_DWORD" },
129         { REG_DWORD_BIG_ENDIAN, "REG_DWORD_BIG_ENDIAN" },
130         { REG_LINK, "REG_LINK" },
131         { REG_MULTI_SZ, "REG_MULTI_SZ" },
132         { REG_RESOURCE_LIST, "REG_RESOURCE_LIST" },
133         { REG_FULL_RESOURCE_DESCRIPTOR, "REG_FULL_RESOURCE_DESCRIPTOR" },
134         { REG_RESOURCE_REQUIREMENTS_LIST, "REG_RESOURCE_REQUIREMENTS_LIST" },
135         { REG_QWORD, "REG_QWORD" },
136 { 0, NULL }
137 };
138 static int misc_dissect_element_winreg_Data_string(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
139 static int misc_dissect_element_winreg_Data_string(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
140 static int misc_dissect_element_winreg_Data_binary(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
141 static int misc_dissect_element_winreg_Data_value(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
142 static int misc_dissect_element_winreg_Data_value(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
143 static int misc_dissect_element_winreg_Data_string_array(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
144 static int misc_dissect_element_winreg_Data_data(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_);
145 const value_string misc_netr_SamDatabaseID_vals[] = {
146         { SAM_DATABASE_DOMAIN, "SAM_DATABASE_DOMAIN" },
147         { SAM_DATABASE_BUILTIN, "SAM_DATABASE_BUILTIN" },
148         { SAM_DATABASE_PRIVS, "SAM_DATABASE_PRIVS" },
149 { 0, NULL }
150 };
151 static const true_false_string svcctl_ServerType_SV_TYPE_WORKSTATION_tfs = {
152    "SV_TYPE_WORKSTATION is SET",
153    "SV_TYPE_WORKSTATION is NOT SET",
154 };
155 static const true_false_string svcctl_ServerType_SV_TYPE_SERVER_tfs = {
156    "SV_TYPE_SERVER is SET",
157    "SV_TYPE_SERVER is NOT SET",
158 };
159 static const true_false_string svcctl_ServerType_SV_TYPE_SQLSERVER_tfs = {
160    "SV_TYPE_SQLSERVER is SET",
161    "SV_TYPE_SQLSERVER is NOT SET",
162 };
163 static const true_false_string svcctl_ServerType_SV_TYPE_DOMAIN_CTRL_tfs = {
164    "SV_TYPE_DOMAIN_CTRL is SET",
165    "SV_TYPE_DOMAIN_CTRL is NOT SET",
166 };
167 static const true_false_string svcctl_ServerType_SV_TYPE_DOMAIN_BAKCTRL_tfs = {
168    "SV_TYPE_DOMAIN_BAKCTRL is SET",
169    "SV_TYPE_DOMAIN_BAKCTRL is NOT SET",
170 };
171 static const true_false_string svcctl_ServerType_SV_TYPE_TIME_SOURCE_tfs = {
172    "SV_TYPE_TIME_SOURCE is SET",
173    "SV_TYPE_TIME_SOURCE is NOT SET",
174 };
175 static const true_false_string svcctl_ServerType_SV_TYPE_AFP_tfs = {
176    "SV_TYPE_AFP is SET",
177    "SV_TYPE_AFP is NOT SET",
178 };
179 static const true_false_string svcctl_ServerType_SV_TYPE_NOVELL_tfs = {
180    "SV_TYPE_NOVELL is SET",
181    "SV_TYPE_NOVELL is NOT SET",
182 };
183 static const true_false_string svcctl_ServerType_SV_TYPE_DOMAIN_MEMBER_tfs = {
184    "SV_TYPE_DOMAIN_MEMBER is SET",
185    "SV_TYPE_DOMAIN_MEMBER is NOT SET",
186 };
187 static const true_false_string svcctl_ServerType_SV_TYPE_PRINTQ_SERVER_tfs = {
188    "SV_TYPE_PRINTQ_SERVER is SET",
189    "SV_TYPE_PRINTQ_SERVER is NOT SET",
190 };
191 static const true_false_string svcctl_ServerType_SV_TYPE_DIALIN_SERVER_tfs = {
192    "SV_TYPE_DIALIN_SERVER is SET",
193    "SV_TYPE_DIALIN_SERVER is NOT SET",
194 };
195 static const true_false_string svcctl_ServerType_SV_TYPE_SERVER_UNIX_tfs = {
196    "SV_TYPE_SERVER_UNIX is SET",
197    "SV_TYPE_SERVER_UNIX is NOT SET",
198 };
199 static const true_false_string svcctl_ServerType_SV_TYPE_NT_tfs = {
200    "SV_TYPE_NT is SET",
201    "SV_TYPE_NT is NOT SET",
202 };
203 static const true_false_string svcctl_ServerType_SV_TYPE_WFW_tfs = {
204    "SV_TYPE_WFW is SET",
205    "SV_TYPE_WFW is NOT SET",
206 };
207 static const true_false_string svcctl_ServerType_SV_TYPE_SERVER_MFPN_tfs = {
208    "SV_TYPE_SERVER_MFPN is SET",
209    "SV_TYPE_SERVER_MFPN is NOT SET",
210 };
211 static const true_false_string svcctl_ServerType_SV_TYPE_SERVER_NT_tfs = {
212    "SV_TYPE_SERVER_NT is SET",
213    "SV_TYPE_SERVER_NT is NOT SET",
214 };
215 static const true_false_string svcctl_ServerType_SV_TYPE_POTENTIAL_BROWSER_tfs = {
216    "SV_TYPE_POTENTIAL_BROWSER is SET",
217    "SV_TYPE_POTENTIAL_BROWSER is NOT SET",
218 };
219 static const true_false_string svcctl_ServerType_SV_TYPE_BACKUP_BROWSER_tfs = {
220    "SV_TYPE_BACKUP_BROWSER is SET",
221    "SV_TYPE_BACKUP_BROWSER is NOT SET",
222 };
223 static const true_false_string svcctl_ServerType_SV_TYPE_MASTER_BROWSER_tfs = {
224    "SV_TYPE_MASTER_BROWSER is SET",
225    "SV_TYPE_MASTER_BROWSER is NOT SET",
226 };
227 static const true_false_string svcctl_ServerType_SV_TYPE_DOMAIN_MASTER_tfs = {
228    "SV_TYPE_DOMAIN_MASTER is SET",
229    "SV_TYPE_DOMAIN_MASTER is NOT SET",
230 };
231 static const true_false_string svcctl_ServerType_SV_TYPE_SERVER_OSF_tfs = {
232    "SV_TYPE_SERVER_OSF is SET",
233    "SV_TYPE_SERVER_OSF is NOT SET",
234 };
235 static const true_false_string svcctl_ServerType_SV_TYPE_SERVER_VMS_tfs = {
236    "SV_TYPE_SERVER_VMS is SET",
237    "SV_TYPE_SERVER_VMS is NOT SET",
238 };
239 static const true_false_string svcctl_ServerType_SV_TYPE_WIN95_PLUS_tfs = {
240    "SV_TYPE_WIN95_PLUS is SET",
241    "SV_TYPE_WIN95_PLUS is NOT SET",
242 };
243 static const true_false_string svcctl_ServerType_SV_TYPE_DFS_SERVER_tfs = {
244    "SV_TYPE_DFS_SERVER is SET",
245    "SV_TYPE_DFS_SERVER is NOT SET",
246 };
247 static const true_false_string svcctl_ServerType_SV_TYPE_ALTERNATE_XPORT_tfs = {
248    "SV_TYPE_ALTERNATE_XPORT is SET",
249    "SV_TYPE_ALTERNATE_XPORT is NOT SET",
250 };
251 static const true_false_string svcctl_ServerType_SV_TYPE_LOCAL_LIST_ONLY_tfs = {
252    "SV_TYPE_LOCAL_LIST_ONLY is SET",
253    "SV_TYPE_LOCAL_LIST_ONLY is NOT SET",
254 };
255 static const true_false_string svcctl_ServerType_SV_TYPE_DOMAIN_ENUM_tfs = {
256    "SV_TYPE_DOMAIN_ENUM is SET",
257    "SV_TYPE_DOMAIN_ENUM is NOT SET",
258 };
259
260
261 /* IDL: struct { */
262 /* IDL:         uint32 time_low; */
263 /* IDL:         uint16 time_mid; */
264 /* IDL:         uint16 time_hi_and_version; */
265 /* IDL:         uint8 clock_seq[2]; */
266 /* IDL:         uint8 node[6]; */
267 /* IDL: } */
268
269 static int
270 misc_dissect_element_GUID_time_low(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
271 {
272         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_misc_GUID_time_low, 0);
273
274         return offset;
275 }
276
277 static int
278 misc_dissect_element_GUID_time_mid(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
279 {
280         offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_misc_GUID_time_mid, 0);
281
282         return offset;
283 }
284
285 static int
286 misc_dissect_element_GUID_time_hi_and_version(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
287 {
288         offset = PIDL_dissect_uint16(tvb, offset, pinfo, tree, drep, hf_misc_GUID_time_hi_and_version, 0);
289
290         return offset;
291 }
292
293 static int
294 misc_dissect_element_GUID_clock_seq(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
295 {
296         dcerpc_info *di = (dcerpc_info*)pinfo->private_data;
297         int conformant = di->conformant_run;
298         if (!conformant) {
299                 offset = misc_dissect_element_GUID_clock_seq_(tvb, offset, 2, pinfo, tree, drep);
300         }
301
302         return offset;
303 }
304
305 static int
306 misc_dissect_element_GUID_clock_seq_(tvbuff_t *tvb _U_, int offset _U_,int length _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
307 {
308         proto_tree_add_bytes(tree, hf_misc_GUID_clock_seq, tvb, offset, length, tvb_get_ptr(tvb, offset,length)); offset += length;
309
310         return offset;
311 }
312
313 static int
314 misc_dissect_element_GUID_node(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
315 {
316         dcerpc_info *di = (dcerpc_info*)pinfo->private_data;
317         int conformant = di->conformant_run;
318         if (!conformant) {
319                 offset = misc_dissect_element_GUID_node_(tvb, offset, 6, pinfo, tree, drep);
320         }
321
322         return offset;
323 }
324
325 static int
326 misc_dissect_element_GUID_node_(tvbuff_t *tvb _U_, int offset _U_,int length _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
327 {
328         proto_tree_add_bytes(tree, hf_misc_GUID_node, tvb, offset, length, tvb_get_ptr(tvb, offset,length)); offset += length;
329
330         return offset;
331 }
332
333 int
334 misc_dissect_struct_GUID(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_)
335 {
336         proto_item *item = NULL;
337         proto_tree *tree = NULL;
338         dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
339         int old_offset;
340
341         ALIGN_TO_4_BYTES;
342
343         old_offset = offset;
344
345         if (parent_tree) {
346                 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
347                 tree = proto_item_add_subtree(item, ett_misc_GUID);
348         }
349         
350         offset = misc_dissect_element_GUID_time_low(tvb, offset, pinfo, tree, drep);
351
352         offset = misc_dissect_element_GUID_time_mid(tvb, offset, pinfo, tree, drep);
353
354         offset = misc_dissect_element_GUID_time_hi_and_version(tvb, offset, pinfo, tree, drep);
355
356         offset = misc_dissect_element_GUID_clock_seq(tvb, offset, pinfo, tree, drep);
357
358         offset = misc_dissect_element_GUID_node(tvb, offset, pinfo, tree, drep);
359
360
361         proto_item_set_len(item, offset-old_offset);
362
363
364         if (di->call_data->flags & DCERPC_IS_NDR64) {
365                 ALIGN_TO_4_BYTES;
366         }
367
368         return offset;
369 }
370
371
372 /* IDL: struct { */
373 /* IDL:         GUID uuid; */
374 /* IDL:         uint32 if_version; */
375 /* IDL: } */
376
377 static int
378 misc_dissect_element_ndr_syntax_id_uuid(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
379 {
380         offset = dissect_ndr_uuid_t(tvb, offset, pinfo, tree, drep, hf_misc_ndr_syntax_id_uuid, NULL);
381
382         return offset;
383 }
384
385 static int
386 misc_dissect_element_ndr_syntax_id_if_version(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
387 {
388         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_misc_ndr_syntax_id_if_version, 0);
389
390         return offset;
391 }
392
393 int
394 misc_dissect_struct_ndr_syntax_id(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_)
395 {
396         proto_item *item = NULL;
397         proto_tree *tree = NULL;
398         dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
399         int old_offset;
400
401         ALIGN_TO_4_BYTES;
402
403         old_offset = offset;
404
405         if (parent_tree) {
406                 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
407                 tree = proto_item_add_subtree(item, ett_misc_ndr_syntax_id);
408         }
409         
410         offset = misc_dissect_element_ndr_syntax_id_uuid(tvb, offset, pinfo, tree, drep);
411
412         offset = misc_dissect_element_ndr_syntax_id_if_version(tvb, offset, pinfo, tree, drep);
413
414
415         proto_item_set_len(item, offset-old_offset);
416
417
418         if (di->call_data->flags & DCERPC_IS_NDR64) {
419                 ALIGN_TO_4_BYTES;
420         }
421
422         return offset;
423 }
424
425
426 /* IDL: struct { */
427 /* IDL:         uint32 handle_type; */
428 /* IDL:         GUID uuid; */
429 /* IDL: } */
430
431 static int
432 misc_dissect_element_policy_handle_handle_type(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
433 {
434         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_misc_policy_handle_handle_type, 0);
435
436         return offset;
437 }
438
439 static int
440 misc_dissect_element_policy_handle_uuid(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
441 {
442         offset = dissect_ndr_uuid_t(tvb, offset, pinfo, tree, drep, hf_misc_policy_handle_uuid, NULL);
443
444         return offset;
445 }
446
447 int
448 misc_dissect_struct_policy_handle(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_)
449 {
450         proto_item *item = NULL;
451         proto_tree *tree = NULL;
452         dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
453         int old_offset;
454
455         ALIGN_TO_4_BYTES;
456
457         old_offset = offset;
458
459         if (parent_tree) {
460                 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
461                 tree = proto_item_add_subtree(item, ett_misc_policy_handle);
462         }
463         
464         offset = misc_dissect_element_policy_handle_handle_type(tvb, offset, pinfo, tree, drep);
465
466         offset = misc_dissect_element_policy_handle_uuid(tvb, offset, pinfo, tree, drep);
467
468
469         proto_item_set_len(item, offset-old_offset);
470
471
472         if (di->call_data->flags & DCERPC_IS_NDR64) {
473                 ALIGN_TO_4_BYTES;
474         }
475
476         return offset;
477 }
478
479
480 /* IDL: enum { */
481 /* IDL:         SEC_CHAN_NULL=0, */
482 /* IDL:         SEC_CHAN_LOCAL=1, */
483 /* IDL:         SEC_CHAN_WKSTA=2, */
484 /* IDL:         SEC_CHAN_DNS_DOMAIN=3, */
485 /* IDL:         SEC_CHAN_DOMAIN=4, */
486 /* IDL:         SEC_CHAN_LANMAN=5, */
487 /* IDL:         SEC_CHAN_BDC=6, */
488 /* IDL:         SEC_CHAN_RODC=7, */
489 /* IDL: } */
490
491 int
492 misc_dissect_enum_netr_SchannelType(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 *param _U_)
493 {
494         guint1632 parameter=0;
495         if(param){
496                 parameter=(guint1632)*param;
497         }
498         offset = dissect_ndr_uint1632(tvb, offset, pinfo, tree, drep, hf_index, &parameter);
499         if(param){
500                 *param=(guint32)parameter;
501         }
502         return offset;
503 }
504
505
506 /* IDL: struct { */
507 /* IDL:         NTSTATUS ntstatus; */
508 /* IDL:         uint32 unknown1; */
509 /* IDL:         uint32 unknown2; */
510 /* IDL: } */
511
512 static int
513 misc_dissect_element_KRB5_EDATA_NTSTATUS_ntstatus(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
514 {
515         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_misc_KRB5_EDATA_NTSTATUS_ntstatus, 0);
516
517         return offset;
518 }
519
520 static int
521 misc_dissect_element_KRB5_EDATA_NTSTATUS_unknown1(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
522 {
523         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_misc_KRB5_EDATA_NTSTATUS_unknown1, 0);
524
525         return offset;
526 }
527
528 static int
529 misc_dissect_element_KRB5_EDATA_NTSTATUS_unknown2(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
530 {
531         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_misc_KRB5_EDATA_NTSTATUS_unknown2, 0);
532
533         return offset;
534 }
535
536 int
537 misc_dissect_struct_KRB5_EDATA_NTSTATUS(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_)
538 {
539         proto_item *item = NULL;
540         proto_tree *tree = NULL;
541         dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
542         int old_offset;
543
544         ALIGN_TO_4_BYTES;
545
546         old_offset = offset;
547
548         if (parent_tree) {
549                 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);
550                 tree = proto_item_add_subtree(item, ett_misc_KRB5_EDATA_NTSTATUS);
551         }
552         
553         offset = misc_dissect_element_KRB5_EDATA_NTSTATUS_ntstatus(tvb, offset, pinfo, tree, drep);
554
555         offset = misc_dissect_element_KRB5_EDATA_NTSTATUS_unknown1(tvb, offset, pinfo, tree, drep);
556
557         offset = misc_dissect_element_KRB5_EDATA_NTSTATUS_unknown2(tvb, offset, pinfo, tree, drep);
558
559
560         proto_item_set_len(item, offset-old_offset);
561
562
563         if (di->call_data->flags & DCERPC_IS_NDR64) {
564                 ALIGN_TO_4_BYTES;
565         }
566
567         return offset;
568 }
569
570
571 /* IDL: enum { */
572 /* IDL:         REG_NONE=0, */
573 /* IDL:         REG_SZ=1, */
574 /* IDL:         REG_EXPAND_SZ=2, */
575 /* IDL:         REG_BINARY=3, */
576 /* IDL:         REG_DWORD=4, */
577 /* IDL:         REG_DWORD_BIG_ENDIAN=5, */
578 /* IDL:         REG_LINK=6, */
579 /* IDL:         REG_MULTI_SZ=7, */
580 /* IDL:         REG_RESOURCE_LIST=8, */
581 /* IDL:         REG_FULL_RESOURCE_DESCRIPTOR=9, */
582 /* IDL:         REG_RESOURCE_REQUIREMENTS_LIST=10, */
583 /* IDL:         REG_QWORD=11, */
584 /* IDL: } */
585
586 int
587 misc_dissect_enum_winreg_Type(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 *param _U_)
588 {
589         guint32 parameter=0;
590         if(param){
591                 parameter=(guint32)*param;
592         }
593         offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_index, &parameter);
594         if(param){
595                 *param=(guint32)parameter;
596         }
597         return offset;
598 }
599
600
601 /* IDL: [public(1)] [nodiscriminant(1)] [flag(LIBNDR_FLAG_LITTLE_ENDIAN)] union { */
602 /* IDL: [case(REG_NONE)] [case(REG_NONE)] EMPTY ; */
603 /* IDL: [case(REG_SZ)] [flag(LIBNDR_FLAG_STR_NULLTERM|LIBNDR_FLAG_ALIGN2)] [case(REG_SZ)] string string; */
604 /* IDL: [case(REG_EXPAND_SZ)] [flag(LIBNDR_FLAG_STR_NULLTERM|LIBNDR_FLAG_ALIGN2)] [case(REG_EXPAND_SZ)] string string; */
605 /* IDL: [case(REG_BINARY)] [flag(LIBNDR_FLAG_REMAINING)] [case(REG_BINARY)] DATA_BLOB binary; */
606 /* IDL: [case(REG_DWORD)] [case(REG_DWORD)] uint32 value; */
607 /* IDL: [case(REG_DWORD_BIG_ENDIAN)] [flag(LIBNDR_FLAG_BIGENDIAN)] [case(REG_DWORD_BIG_ENDIAN)] uint32 value; */
608 /* IDL: [case(REG_MULTI_SZ)] [flag(LIBNDR_FLAG_STR_NULLTERM|LIBNDR_FLAG_ALIGN2)] [case(REG_MULTI_SZ)] string_array string_array; */
609 /* IDL: [default] ; */
610 /* IDL: } */
611
612 static int
613 misc_dissect_element_winreg_Data_string(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
614 {
615         offset = dissect_null_term_wstring(tvb, offset, pinfo, tree, drep, hf_misc_winreg_Data_string , 0);
616
617         return offset;
618 }
619
620 static int
621 misc_dissect_element_winreg_Data_string(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
622 {
623         offset = dissect_null_term_wstring(tvb, offset, pinfo, tree, drep, hf_misc_winreg_Data_string , 0);
624
625         return offset;
626 }
627
628 static int
629 misc_dissect_element_winreg_Data_binary(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
630 {
631         offset = dissect_ndr_datablob(tvb, offset, pinfo, tree, drep, hf_misc_winreg_Data_binary, 1);
632
633         return offset;
634 }
635
636 static int
637 misc_dissect_element_winreg_Data_value(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
638 {
639         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_misc_winreg_Data_value, 0);
640
641         return offset;
642 }
643
644 static int
645 misc_dissect_element_winreg_Data_value(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
646 {
647         offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, hf_misc_winreg_Data_value, 0);
648
649         return offset;
650 }
651
652 static int
653 misc_dissect_element_winreg_Data_string_array(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
654 {
655         offset = misc_dissect_struct_string_array(tvb,offset,pinfo,tree,drep,hf_misc_winreg_Data_string_array,0);
656
657         return offset;
658 }
659
660 static int
661 misc_dissect_element_winreg_Data_data(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_)
662 {
663         offset = dissect_ndr_datablob(tvb, offset, pinfo, tree, drep, hf_misc_winreg_Data_data, 1);
664
665         return offset;
666 }
667
668 static int
669 misc_dissect_winreg_Data(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_)
670 {
671         proto_item *item = NULL;
672         proto_tree *tree = NULL;
673         int old_offset;
674         guint32 level = param;
675
676         old_offset = offset;
677         if (parent_tree) {
678                 item = proto_tree_add_text(parent_tree, tvb, offset, -1, "winreg_Data");
679                 tree = proto_item_add_subtree(item, ett_misc_winreg_Data);
680         }
681
682         switch(level) {
683                 case REG_NONE:
684                 break;
685
686                 case REG_SZ:
687                         offset = misc_dissect_element_winreg_Data_string(tvb, offset, pinfo, tree, drep);
688                 break;
689
690                 case REG_EXPAND_SZ:
691                         offset = misc_dissect_element_winreg_Data_string(tvb, offset, pinfo, tree, drep);
692                 break;
693
694                 case REG_BINARY:
695                         offset = misc_dissect_element_winreg_Data_binary(tvb, offset, pinfo, tree, drep);
696                 break;
697
698                 case REG_DWORD:
699                         offset = misc_dissect_element_winreg_Data_value(tvb, offset, pinfo, tree, drep);
700                 break;
701
702                 case REG_DWORD_BIG_ENDIAN:
703                         offset = misc_dissect_element_winreg_Data_value(tvb, offset, pinfo, tree, drep);
704                 break;
705
706                 case REG_MULTI_SZ:
707                         offset = misc_dissect_element_winreg_Data_string_array(tvb, offset, pinfo, tree, drep);
708                 break;
709
710                 default:
711                         offset = misc_dissect_element_winreg_Data_data(tvb, offset, pinfo, tree, drep);
712                 break;
713         }
714         proto_item_set_len(item, offset-old_offset);
715
716
717         return offset;
718 }
719
720 /* IDL: enum { */
721 /* IDL:         SAM_DATABASE_DOMAIN=0, */
722 /* IDL:         SAM_DATABASE_BUILTIN=1, */
723 /* IDL:         SAM_DATABASE_PRIVS=2, */
724 /* IDL: } */
725
726 int
727 misc_dissect_enum_netr_SamDatabaseID(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 *param _U_)
728 {
729         guint32 parameter=0;
730         if(param){
731                 parameter=(guint32)*param;
732         }
733         offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_index, &parameter);
734         if(param){
735                 *param=(guint32)parameter;
736         }
737         return offset;
738 }
739
740
741 /* IDL: bitmap { */
742 /* IDL:         SV_TYPE_WORKSTATION =  0x00000001 , */
743 /* IDL:         SV_TYPE_SERVER =  0x00000002 , */
744 /* IDL:         SV_TYPE_SQLSERVER =  0x00000004 , */
745 /* IDL:         SV_TYPE_DOMAIN_CTRL =  0x00000008 , */
746 /* IDL:         SV_TYPE_DOMAIN_BAKCTRL =  0x00000010 , */
747 /* IDL:         SV_TYPE_TIME_SOURCE =  0x00000020 , */
748 /* IDL:         SV_TYPE_AFP =  0x00000040 , */
749 /* IDL:         SV_TYPE_NOVELL =  0x00000080 , */
750 /* IDL:         SV_TYPE_DOMAIN_MEMBER =  0x00000100 , */
751 /* IDL:         SV_TYPE_PRINTQ_SERVER =  0x00000200 , */
752 /* IDL:         SV_TYPE_DIALIN_SERVER =  0x00000400 , */
753 /* IDL:         SV_TYPE_SERVER_UNIX =  0x00000800 , */
754 /* IDL:         SV_TYPE_NT =  0x00001000 , */
755 /* IDL:         SV_TYPE_WFW =  0x00002000 , */
756 /* IDL:         SV_TYPE_SERVER_MFPN =  0x00004000 , */
757 /* IDL:         SV_TYPE_SERVER_NT =  0x00008000 , */
758 /* IDL:         SV_TYPE_POTENTIAL_BROWSER =  0x00010000 , */
759 /* IDL:         SV_TYPE_BACKUP_BROWSER =  0x00020000 , */
760 /* IDL:         SV_TYPE_MASTER_BROWSER =  0x00040000 , */
761 /* IDL:         SV_TYPE_DOMAIN_MASTER =  0x00080000 , */
762 /* IDL:         SV_TYPE_SERVER_OSF =  0x00100000 , */
763 /* IDL:         SV_TYPE_SERVER_VMS =  0x00200000 , */
764 /* IDL:         SV_TYPE_WIN95_PLUS =  0x00400000 , */
765 /* IDL:         SV_TYPE_DFS_SERVER =  0x00800000 , */
766 /* IDL:         SV_TYPE_ALTERNATE_XPORT =  0x20000000 , */
767 /* IDL:         SV_TYPE_LOCAL_LIST_ONLY =  0x40000000 , */
768 /* IDL:         SV_TYPE_DOMAIN_ENUM =  0x80000000 , */
769 /* IDL: } */
770
771 int
772 misc_dissect_bitmap_svcctl_ServerType(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_)
773 {
774         proto_item *item = NULL;
775         proto_tree *tree = NULL;
776
777         guint32 flags;
778         ALIGN_TO_4_BYTES;
779
780         if (parent_tree) {
781                 item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, 4, DREP_ENC_INTEGER(drep));
782                 tree = proto_item_add_subtree(item,ett_misc_svcctl_ServerType);
783         }
784
785         offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, drep, -1, &flags);
786         proto_item_append_text(item, ": ");
787
788         if (!flags)
789                 proto_item_append_text(item, "(No values set)");
790
791         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_WORKSTATION, tvb, offset-4, 4, flags);
792         if (flags&( 0x00000001 )){
793                 proto_item_append_text(item, "SV_TYPE_WORKSTATION");
794                 if (flags & (~( 0x00000001 )))
795                         proto_item_append_text(item, ", ");
796         }
797         flags&=(~( 0x00000001 ));
798
799         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_SERVER, tvb, offset-4, 4, flags);
800         if (flags&( 0x00000002 )){
801                 proto_item_append_text(item, "SV_TYPE_SERVER");
802                 if (flags & (~( 0x00000002 )))
803                         proto_item_append_text(item, ", ");
804         }
805         flags&=(~( 0x00000002 ));
806
807         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_SQLSERVER, tvb, offset-4, 4, flags);
808         if (flags&( 0x00000004 )){
809                 proto_item_append_text(item, "SV_TYPE_SQLSERVER");
810                 if (flags & (~( 0x00000004 )))
811                         proto_item_append_text(item, ", ");
812         }
813         flags&=(~( 0x00000004 ));
814
815         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_CTRL, tvb, offset-4, 4, flags);
816         if (flags&( 0x00000008 )){
817                 proto_item_append_text(item, "SV_TYPE_DOMAIN_CTRL");
818                 if (flags & (~( 0x00000008 )))
819                         proto_item_append_text(item, ", ");
820         }
821         flags&=(~( 0x00000008 ));
822
823         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_BAKCTRL, tvb, offset-4, 4, flags);
824         if (flags&( 0x00000010 )){
825                 proto_item_append_text(item, "SV_TYPE_DOMAIN_BAKCTRL");
826                 if (flags & (~( 0x00000010 )))
827                         proto_item_append_text(item, ", ");
828         }
829         flags&=(~( 0x00000010 ));
830
831         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_TIME_SOURCE, tvb, offset-4, 4, flags);
832         if (flags&( 0x00000020 )){
833                 proto_item_append_text(item, "SV_TYPE_TIME_SOURCE");
834                 if (flags & (~( 0x00000020 )))
835                         proto_item_append_text(item, ", ");
836         }
837         flags&=(~( 0x00000020 ));
838
839         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_AFP, tvb, offset-4, 4, flags);
840         if (flags&( 0x00000040 )){
841                 proto_item_append_text(item, "SV_TYPE_AFP");
842                 if (flags & (~( 0x00000040 )))
843                         proto_item_append_text(item, ", ");
844         }
845         flags&=(~( 0x00000040 ));
846
847         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_NOVELL, tvb, offset-4, 4, flags);
848         if (flags&( 0x00000080 )){
849                 proto_item_append_text(item, "SV_TYPE_NOVELL");
850                 if (flags & (~( 0x00000080 )))
851                         proto_item_append_text(item, ", ");
852         }
853         flags&=(~( 0x00000080 ));
854
855         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_MEMBER, tvb, offset-4, 4, flags);
856         if (flags&( 0x00000100 )){
857                 proto_item_append_text(item, "SV_TYPE_DOMAIN_MEMBER");
858                 if (flags & (~( 0x00000100 )))
859                         proto_item_append_text(item, ", ");
860         }
861         flags&=(~( 0x00000100 ));
862
863         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_PRINTQ_SERVER, tvb, offset-4, 4, flags);
864         if (flags&( 0x00000200 )){
865                 proto_item_append_text(item, "SV_TYPE_PRINTQ_SERVER");
866                 if (flags & (~( 0x00000200 )))
867                         proto_item_append_text(item, ", ");
868         }
869         flags&=(~( 0x00000200 ));
870
871         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_DIALIN_SERVER, tvb, offset-4, 4, flags);
872         if (flags&( 0x00000400 )){
873                 proto_item_append_text(item, "SV_TYPE_DIALIN_SERVER");
874                 if (flags & (~( 0x00000400 )))
875                         proto_item_append_text(item, ", ");
876         }
877         flags&=(~( 0x00000400 ));
878
879         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_SERVER_UNIX, tvb, offset-4, 4, flags);
880         if (flags&( 0x00000800 )){
881                 proto_item_append_text(item, "SV_TYPE_SERVER_UNIX");
882                 if (flags & (~( 0x00000800 )))
883                         proto_item_append_text(item, ", ");
884         }
885         flags&=(~( 0x00000800 ));
886
887         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_NT, tvb, offset-4, 4, flags);
888         if (flags&( 0x00001000 )){
889                 proto_item_append_text(item, "SV_TYPE_NT");
890                 if (flags & (~( 0x00001000 )))
891                         proto_item_append_text(item, ", ");
892         }
893         flags&=(~( 0x00001000 ));
894
895         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_WFW, tvb, offset-4, 4, flags);
896         if (flags&( 0x00002000 )){
897                 proto_item_append_text(item, "SV_TYPE_WFW");
898                 if (flags & (~( 0x00002000 )))
899                         proto_item_append_text(item, ", ");
900         }
901         flags&=(~( 0x00002000 ));
902
903         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_SERVER_MFPN, tvb, offset-4, 4, flags);
904         if (flags&( 0x00004000 )){
905                 proto_item_append_text(item, "SV_TYPE_SERVER_MFPN");
906                 if (flags & (~( 0x00004000 )))
907                         proto_item_append_text(item, ", ");
908         }
909         flags&=(~( 0x00004000 ));
910
911         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_SERVER_NT, tvb, offset-4, 4, flags);
912         if (flags&( 0x00008000 )){
913                 proto_item_append_text(item, "SV_TYPE_SERVER_NT");
914                 if (flags & (~( 0x00008000 )))
915                         proto_item_append_text(item, ", ");
916         }
917         flags&=(~( 0x00008000 ));
918
919         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_POTENTIAL_BROWSER, tvb, offset-4, 4, flags);
920         if (flags&( 0x00010000 )){
921                 proto_item_append_text(item, "SV_TYPE_POTENTIAL_BROWSER");
922                 if (flags & (~( 0x00010000 )))
923                         proto_item_append_text(item, ", ");
924         }
925         flags&=(~( 0x00010000 ));
926
927         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_BACKUP_BROWSER, tvb, offset-4, 4, flags);
928         if (flags&( 0x00020000 )){
929                 proto_item_append_text(item, "SV_TYPE_BACKUP_BROWSER");
930                 if (flags & (~( 0x00020000 )))
931                         proto_item_append_text(item, ", ");
932         }
933         flags&=(~( 0x00020000 ));
934
935         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_MASTER_BROWSER, tvb, offset-4, 4, flags);
936         if (flags&( 0x00040000 )){
937                 proto_item_append_text(item, "SV_TYPE_MASTER_BROWSER");
938                 if (flags & (~( 0x00040000 )))
939                         proto_item_append_text(item, ", ");
940         }
941         flags&=(~( 0x00040000 ));
942
943         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_MASTER, tvb, offset-4, 4, flags);
944         if (flags&( 0x00080000 )){
945                 proto_item_append_text(item, "SV_TYPE_DOMAIN_MASTER");
946                 if (flags & (~( 0x00080000 )))
947                         proto_item_append_text(item, ", ");
948         }
949         flags&=(~( 0x00080000 ));
950
951         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_SERVER_OSF, tvb, offset-4, 4, flags);
952         if (flags&( 0x00100000 )){
953                 proto_item_append_text(item, "SV_TYPE_SERVER_OSF");
954                 if (flags & (~( 0x00100000 )))
955                         proto_item_append_text(item, ", ");
956         }
957         flags&=(~( 0x00100000 ));
958
959         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_SERVER_VMS, tvb, offset-4, 4, flags);
960         if (flags&( 0x00200000 )){
961                 proto_item_append_text(item, "SV_TYPE_SERVER_VMS");
962                 if (flags & (~( 0x00200000 )))
963                         proto_item_append_text(item, ", ");
964         }
965         flags&=(~( 0x00200000 ));
966
967         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_WIN95_PLUS, tvb, offset-4, 4, flags);
968         if (flags&( 0x00400000 )){
969                 proto_item_append_text(item, "SV_TYPE_WIN95_PLUS");
970                 if (flags & (~( 0x00400000 )))
971                         proto_item_append_text(item, ", ");
972         }
973         flags&=(~( 0x00400000 ));
974
975         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_DFS_SERVER, tvb, offset-4, 4, flags);
976         if (flags&( 0x00800000 )){
977                 proto_item_append_text(item, "SV_TYPE_DFS_SERVER");
978                 if (flags & (~( 0x00800000 )))
979                         proto_item_append_text(item, ", ");
980         }
981         flags&=(~( 0x00800000 ));
982
983         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_ALTERNATE_XPORT, tvb, offset-4, 4, flags);
984         if (flags&( 0x20000000 )){
985                 proto_item_append_text(item, "SV_TYPE_ALTERNATE_XPORT");
986                 if (flags & (~( 0x20000000 )))
987                         proto_item_append_text(item, ", ");
988         }
989         flags&=(~( 0x20000000 ));
990
991         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_LOCAL_LIST_ONLY, tvb, offset-4, 4, flags);
992         if (flags&( 0x40000000 )){
993                 proto_item_append_text(item, "SV_TYPE_LOCAL_LIST_ONLY");
994                 if (flags & (~( 0x40000000 )))
995                         proto_item_append_text(item, ", ");
996         }
997         flags&=(~( 0x40000000 ));
998
999         proto_tree_add_boolean(tree, hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_ENUM, tvb, offset-4, 4, flags);
1000         if (flags&( 0x80000000 )){
1001                 proto_item_append_text(item, "SV_TYPE_DOMAIN_ENUM");
1002                 if (flags & (~( 0x80000000 )))
1003                         proto_item_append_text(item, ", ");
1004         }
1005         flags&=(~( 0x80000000 ));
1006
1007         if (flags) {
1008                 proto_item_append_text(item, "Unknown bitmap value 0x%x", flags);
1009         }
1010
1011         return offset;
1012 }
1013
1014
1015 static dcerpc_sub_dissector misc_dissectors[] = {
1016         { 0, NULL, NULL, NULL }
1017 };
1018
1019 void proto_register_dcerpc_misc(void)
1020 {
1021         static hf_register_info hf[] = {
1022         { &hf_misc_svcctl_ServerType_SV_TYPE_SERVER,
1023           { "Sv Type Server", "misc.svcctl_ServerType.SV_TYPE_SERVER", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_SERVER_tfs), ( 0x00000002 ), NULL, HFILL }},
1024         { &hf_misc_GUID_time_low,
1025           { "Time Low", "misc.GUID.time_low", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
1026         { &hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_MASTER,
1027           { "Sv Type Domain Master", "misc.svcctl_ServerType.SV_TYPE_DOMAIN_MASTER", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_DOMAIN_MASTER_tfs), ( 0x00080000 ), NULL, HFILL }},
1028         { &hf_misc_svcctl_ServerType_SV_TYPE_PRINTQ_SERVER,
1029           { "Sv Type Printq Server", "misc.svcctl_ServerType.SV_TYPE_PRINTQ_SERVER", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_PRINTQ_SERVER_tfs), ( 0x00000200 ), NULL, HFILL }},
1030         { &hf_misc_KRB5_EDATA_NTSTATUS_unknown2,
1031           { "Unknown2", "misc.KRB5_EDATA_NTSTATUS.unknown2", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
1032         { &hf_misc_GUID_time_hi_and_version,
1033           { "Time Hi And Version", "misc.GUID.time_hi_and_version", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
1034         { &hf_misc_svcctl_ServerType_SV_TYPE_WIN95_PLUS,
1035           { "Sv Type Win95 Plus", "misc.svcctl_ServerType.SV_TYPE_WIN95_PLUS", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_WIN95_PLUS_tfs), ( 0x00400000 ), NULL, HFILL }},
1036         { &hf_misc_svcctl_ServerType_SV_TYPE_NOVELL,
1037           { "Sv Type Novell", "misc.svcctl_ServerType.SV_TYPE_NOVELL", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_NOVELL_tfs), ( 0x00000080 ), NULL, HFILL }},
1038         { &hf_misc_svcctl_ServerType_SV_TYPE_TIME_SOURCE,
1039           { "Sv Type Time Source", "misc.svcctl_ServerType.SV_TYPE_TIME_SOURCE", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_TIME_SOURCE_tfs), ( 0x00000020 ), NULL, HFILL }},
1040         { &hf_misc_GUID_node,
1041           { "Node", "misc.GUID.node", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1042         { &hf_misc_winreg_Data_string,
1043           { "String", "misc.winreg_Data.string", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
1044         { &hf_misc_svcctl_ServerType_SV_TYPE_BACKUP_BROWSER,
1045           { "Sv Type Backup Browser", "misc.svcctl_ServerType.SV_TYPE_BACKUP_BROWSER", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_BACKUP_BROWSER_tfs), ( 0x00020000 ), NULL, HFILL }},
1046         { &hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_CTRL,
1047           { "Sv Type Domain Ctrl", "misc.svcctl_ServerType.SV_TYPE_DOMAIN_CTRL", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_DOMAIN_CTRL_tfs), ( 0x00000008 ), NULL, HFILL }},
1048         { &hf_misc_winreg_Data_data,
1049           { "Data", "misc.winreg_Data.data", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1050         { &hf_misc_winreg_Data_binary,
1051           { "Binary", "misc.winreg_Data.binary", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
1052         { &hf_misc_policy_handle_uuid,
1053           { "Uuid", "misc.policy_handle.uuid", FT_GUID, BASE_NONE, NULL, 0, NULL, HFILL }},
1054         { &hf_misc_policy_handle_handle_type,
1055           { "Handle Type", "misc.policy_handle.handle_type", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
1056         { &hf_misc_svcctl_ServerType_SV_TYPE_WORKSTATION,
1057           { "Sv Type Workstation", "misc.svcctl_ServerType.SV_TYPE_WORKSTATION", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_WORKSTATION_tfs), ( 0x00000001 ), NULL, HFILL }},
1058         { &hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_MEMBER,
1059           { "Sv Type Domain Member", "misc.svcctl_ServerType.SV_TYPE_DOMAIN_MEMBER", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_DOMAIN_MEMBER_tfs), ( 0x00000100 ), NULL, HFILL }},
1060         { &hf_misc_svcctl_ServerType_SV_TYPE_SERVER_OSF,
1061           { "Sv Type Server Osf", "misc.svcctl_ServerType.SV_TYPE_SERVER_OSF", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_SERVER_OSF_tfs), ( 0x00100000 ), NULL, HFILL }},
1062         { &hf_misc_svcctl_ServerType_SV_TYPE_SERVER_MFPN,
1063           { "Sv Type Server Mfpn", "misc.svcctl_ServerType.SV_TYPE_SERVER_MFPN", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_SERVER_MFPN_tfs), ( 0x00004000 ), NULL, HFILL }},
1064         { &hf_misc_svcctl_ServerType_SV_TYPE_DFS_SERVER,
1065           { "Sv Type Dfs Server", "misc.svcctl_ServerType.SV_TYPE_DFS_SERVER", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_DFS_SERVER_tfs), ( 0x00800000 ), NULL, HFILL }},
1066         { &hf_misc_svcctl_ServerType_SV_TYPE_ALTERNATE_XPORT,
1067           { "Sv Type Alternate Xport", "misc.svcctl_ServerType.SV_TYPE_ALTERNATE_XPORT", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_ALTERNATE_XPORT_tfs), ( 0x20000000 ), NULL, HFILL }},
1068         { &hf_misc_GUID_time_mid,
1069           { "Time Mid", "misc.GUID.time_mid", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
1070         { &hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_ENUM,
1071           { "Sv Type Domain Enum", "misc.svcctl_ServerType.SV_TYPE_DOMAIN_ENUM", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_DOMAIN_ENUM_tfs), ( 0x80000000 ), NULL, HFILL }},
1072         { &hf_misc_svcctl_ServerType_SV_TYPE_DOMAIN_BAKCTRL,
1073           { "Sv Type Domain Bakctrl", "misc.svcctl_ServerType.SV_TYPE_DOMAIN_BAKCTRL", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_DOMAIN_BAKCTRL_tfs), ( 0x00000010 ), NULL, HFILL }},
1074         { &hf_misc_winreg_Data_value,
1075           { "Value", "misc.winreg_Data.value", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
1076         { &hf_misc_svcctl_ServerType_SV_TYPE_DIALIN_SERVER,
1077           { "Sv Type Dialin Server", "misc.svcctl_ServerType.SV_TYPE_DIALIN_SERVER", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_DIALIN_SERVER_tfs), ( 0x00000400 ), NULL, HFILL }},
1078         { &hf_misc_svcctl_ServerType_SV_TYPE_SQLSERVER,
1079           { "Sv Type Sqlserver", "misc.svcctl_ServerType.SV_TYPE_SQLSERVER", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_SQLSERVER_tfs), ( 0x00000004 ), NULL, HFILL }},
1080         { &hf_misc_svcctl_ServerType_SV_TYPE_POTENTIAL_BROWSER,
1081           { "Sv Type Potential Browser", "misc.svcctl_ServerType.SV_TYPE_POTENTIAL_BROWSER", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_POTENTIAL_BROWSER_tfs), ( 0x00010000 ), NULL, HFILL }},
1082         { &hf_misc_svcctl_ServerType_SV_TYPE_LOCAL_LIST_ONLY,
1083           { "Sv Type Local List Only", "misc.svcctl_ServerType.SV_TYPE_LOCAL_LIST_ONLY", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_LOCAL_LIST_ONLY_tfs), ( 0x40000000 ), NULL, HFILL }},
1084         { &hf_misc_svcctl_ServerType_SV_TYPE_WFW,
1085           { "Sv Type Wfw", "misc.svcctl_ServerType.SV_TYPE_WFW", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_WFW_tfs), ( 0x00002000 ), NULL, HFILL }},
1086         { &hf_misc_svcctl_ServerType_SV_TYPE_SERVER_NT,
1087           { "Sv Type Server Nt", "misc.svcctl_ServerType.SV_TYPE_SERVER_NT", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_SERVER_NT_tfs), ( 0x00008000 ), NULL, HFILL }},
1088         { &hf_misc_KRB5_EDATA_NTSTATUS_ntstatus,
1089           { "Ntstatus", "misc.KRB5_EDATA_NTSTATUS.ntstatus", FT_UINT32, BASE_DEC, VALS(NT_errors), 0, NULL, HFILL }},
1090         { &hf_misc_svcctl_ServerType_SV_TYPE_SERVER_UNIX,
1091           { "Sv Type Server Unix", "misc.svcctl_ServerType.SV_TYPE_SERVER_UNIX", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_SERVER_UNIX_tfs), ( 0x00000800 ), NULL, HFILL }},
1092         { &hf_misc_svcctl_ServerType_SV_TYPE_SERVER_VMS,
1093           { "Sv Type Server Vms", "misc.svcctl_ServerType.SV_TYPE_SERVER_VMS", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_SERVER_VMS_tfs), ( 0x00200000 ), NULL, HFILL }},
1094         { &hf_misc_KRB5_EDATA_NTSTATUS_unknown1,
1095           { "Unknown1", "misc.KRB5_EDATA_NTSTATUS.unknown1", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
1096         { &hf_misc_ndr_syntax_id_uuid,
1097           { "Uuid", "misc.ndr_syntax_id.uuid", FT_GUID, BASE_NONE, NULL, 0, NULL, HFILL }},
1098         { &hf_misc_opnum,
1099           { "Operation", "misc.opnum", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }},
1100         { &hf_misc_svcctl_ServerType_SV_TYPE_AFP,
1101           { "Sv Type Afp", "misc.svcctl_ServerType.SV_TYPE_AFP", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_AFP_tfs), ( 0x00000040 ), NULL, HFILL }},
1102         { &hf_misc_svcctl_ServerType_SV_TYPE_MASTER_BROWSER,
1103           { "Sv Type Master Browser", "misc.svcctl_ServerType.SV_TYPE_MASTER_BROWSER", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_MASTER_BROWSER_tfs), ( 0x00040000 ), NULL, HFILL }},
1104         { &hf_misc_GUID_clock_seq,
1105           { "Clock Seq", "misc.GUID.clock_seq", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
1106         { &hf_misc_svcctl_ServerType_SV_TYPE_NT,
1107           { "Sv Type Nt", "misc.svcctl_ServerType.SV_TYPE_NT", FT_BOOLEAN, 32, TFS(&svcctl_ServerType_SV_TYPE_NT_tfs), ( 0x00001000 ), NULL, HFILL }},
1108         { &hf_misc_ndr_syntax_id_if_version,
1109           { "If Version", "misc.ndr_syntax_id.if_version", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
1110         { &hf_misc_winreg_Data_string_array,
1111           { "String Array", "misc.winreg_Data.string_array", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }},
1112         };
1113
1114
1115         static gint *ett[] = {
1116                 &ett_dcerpc_misc,
1117                 &ett_misc_GUID,
1118                 &ett_misc_ndr_syntax_id,
1119                 &ett_misc_policy_handle,
1120                 &ett_misc_KRB5_EDATA_NTSTATUS,
1121                 &ett_misc_winreg_Data,
1122                 &ett_misc_svcctl_ServerType,
1123         };
1124
1125         proto_dcerpc_misc = proto_register_protocol("MISC (pidl)", "MISC", "misc");
1126         proto_register_field_array(proto_dcerpc_misc, hf, array_length (hf));
1127         proto_register_subtree_array(ett, array_length(ett));
1128 }
1129
1130 void proto_reg_handoff_dcerpc_misc(void)
1131 {
1132         dcerpc_init_uuid(proto_dcerpc_misc, ett_dcerpc_misc,
1133                 &uuid_dcerpc_misc, ver_dcerpc_misc,
1134                 misc_dissectors, hf_misc_opnum);
1135 }