98097d89b2c801b4f411620144a06f9d0f22510e
[obnox/wireshark/wip.git] / packet-dcerpc-reg.c
1 /* packet-dcerpc-reg.c
2  * Routines for SMB \\PIPE\\winreg packet disassembly
3  * Copyright 2001, Tim Potter <tpot@samba.org>
4  *
5  * $Id: packet-dcerpc-reg.c,v 1.2 2002/01/03 20:42:40 guy Exp $
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  * 
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  * 
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  * 
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifdef HAVE_CONFIG_H
27 #include "config.h"
28 #endif
29
30 #include <glib.h>
31 #include "packet.h"
32 #include "packet-dcerpc.h"
33 #include "packet-dcerpc-reg.h"
34
35 /* Registry data types */
36
37 const value_string reg_datatypes[] = {
38         { REG_NONE, "REG_NONE" },
39         { REG_SZ, "REG_SZ" },
40         { REG_EXPAND_SZ, "REG_EXPAND_SZ" },
41         { REG_BINARY, "REG_BINARY" },
42         { REG_DWORD, "REG_DWORD" },
43         { REG_DWORD_LE, "REG_DWORD_LE" },
44         { REG_DWORD_BE, "REG_DWORD_BE" },
45         { REG_LINK, "REG_LINK" },
46         { REG_MULTI_SZ, "REG_MULTI_SZ" },
47         { REG_RESOURCE_LIST, "REG_RESOURCE_LIST" },
48         { REG_FULL_RESOURCE_DESCRIPTOR, "REG_FULL_RESOURCE_DESCRIPTOR" },
49         { REG_RESOURCE_REQUIREMENTS_LIST, "REG_RESOURCE_REQUIREMENTS_LIST" },
50         {0, NULL }
51 };
52
53 static int proto_dcerpc_reg = -1;
54 static gint ett_dcerpc_reg = -1;
55
56 static e_uuid_t uuid_dcerpc_reg = {
57         0x338cd001, 0x2244, 0x31f1,
58         { 0xaa, 0xaa, 0x90, 0x00, 0x38, 0x00, 0x10, 0x03 }
59 };
60
61 static guint16 ver_dcerpc_reg = 1;
62
63 static dcerpc_sub_dissector dcerpc_reg_dissectors[] = {
64         { REG_OPEN_HKCR, "REG_OPEN_HKCR", NULL, NULL },
65         { _REG_UNK_01, "_REG_UNK_01", NULL, NULL },
66         { REG_OPEN_HKLM, "REG_OPEN_HKLM", NULL, NULL },
67         { _REG_UNK_03, "_REG_UNK_03", NULL, NULL },
68         { REG_OPEN_HKU, "REG_OPEN_HKU", NULL, NULL },
69         { REG_CLOSE, "REG_CLOSE", NULL, NULL },
70         { REG_CREATE_KEY, "REG_CREATE_KEY", NULL, NULL },
71         { REG_DELETE_KEY, "REG_DELETE_KEY", NULL, NULL },
72         { REG_DELETE_VALUE, "REG_DELETE_VALUE", NULL, NULL },
73         { REG_ENUM_KEY, "REG_ENUM_KEY", NULL, NULL },
74         { REG_ENUM_VALUE, "REG_ENUM_VALUE", NULL, NULL },
75         { REG_FLUSH_KEY, "REG_FLUSH_KEY", NULL, NULL },
76         { REG_GET_KEY_SEC, "REG_GET_KEY_SEC", NULL, NULL },
77         { _REG_UNK_0D, "_REG_UNK_0D", NULL, NULL },
78         { _REG_UNK_0E, "_REG_UNK_0E", NULL, NULL },
79         { REG_OPEN_ENTRY, "REG_OPEN_ENTRY", NULL, NULL },
80         { REG_QUERY_KEY, "REG_QUERY_KEY", NULL, NULL },
81         { REG_INFO, "REG_INFO", NULL, NULL },
82         { _REG_UNK_12, "_REG_UNK_12", NULL, NULL },
83         { _REG_UNK_13, "_REG_UNK_13", NULL, NULL },
84         { _REG_UNK_14, "_REG_UNK_14", NULL, NULL },
85         { REG_SET_KEY_SEC, "REG_SET_KEY_SEC", NULL, NULL },
86         { REG_CREATE_VALUE, "REG_CREATE_VALUE", NULL, NULL },
87         { _REG_UNK_17, "_REG_UNK_17", NULL, NULL },
88         { REG_SHUTDOWN, "REG_SHUTDOWN", NULL, NULL },
89         { REG_ABORT_SHUTDOWN, "REG_ABORT_SHUTDOWN", NULL, NULL },
90         { REG_UNK_1A, "REG_UNK_1A", NULL, NULL },
91
92         {0, NULL, NULL,  NULL },
93 };
94
95 void 
96 proto_register_dcerpc_reg(void)
97 {
98         static gint *ett[] = {
99                 &ett_dcerpc_reg,
100         };
101
102         proto_dcerpc_reg = proto_register_protocol(
103                 "Microsoft Registry", "REG", "reg");
104
105         proto_register_subtree_array(ett, array_length(ett));
106 }
107
108 void
109 proto_reg_handoff_dcerpc_reg(void)
110 {
111         /* Register protocol as dcerpc */
112
113         dcerpc_init_uuid(proto_dcerpc_reg, ett_dcerpc_reg, &uuid_dcerpc_reg,
114                          ver_dcerpc_reg, dcerpc_reg_dissectors);
115 }