2 Unix SMB/CIFS implementation.
3 Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
28 #include "param/param.h"
30 typedef struct registry_context reg;
31 typedef struct hive_key hive_key;
34 /* FIXME: This should be in another file */
35 %typemap(default,noblock=1) struct auth_session_info * {
40 %import "../../lib/talloc/talloc.i"
41 %import "../../auth/credentials/credentials.i"
42 %import "../../libcli/util/errors.i"
43 %import "../../param/param.i"
45 /* Utility functions */
47 const char *reg_get_predef_name(uint32_t hkey);
48 const char *str_regtype(int type);
50 /* Registry contexts */
51 %typemap(in,noblock=1,numinputs=0) struct registry_context ** (struct registry_context *tmp) {
55 %typemap(argout,noblock=1) struct registry_context ** {
56 $result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_registry_context, 0);
59 %rename(Registry) reg_open_local;
60 WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx,
61 struct auth_session_info *session_info,
62 struct cli_credentials *credentials);
64 %typemap(in,noblock=1) const char ** {
65 /* Check if is a list */
66 if (PyList_Check($input)) {
67 int size = PyList_Size($input);
69 $1 = (char **) malloc((size+1)*sizeof(const char *));
70 for (i = 0; i < size; i++) {
71 PyObject *o = PyList_GetItem($input,i);
72 if (PyString_Check(o))
73 $1[i] = PyString_AsString(PyList_GetItem($input,i));
75 PyErr_SetString(PyExc_TypeError,"list must contain strings");
82 PyErr_SetString(PyExc_TypeError,"not a list");
87 %typemap(freearg,noblock=1) const char ** {
93 typedef struct registry_context {
96 WERROR get_predefined_key_by_name(const char *name,
97 struct registry_key **key);
99 WERROR key_del_abs(const char *path);
100 WERROR get_predefined_key(uint32_t hkey_id, struct registry_key **key);
101 WERROR diff_apply(const char *filename);
102 WERROR generate_diff(struct registry_context *ctx2, const struct reg_diff_callbacks *callbacks,
103 void *callback_data);
105 WERROR mount_hive(struct hive_key *key, uint32_t hkey_id,
106 const char **elements=NULL);
108 struct registry_key *import_hive_key(struct hive_key *hive, uint32_t predef_key, const char **elements);
109 WERROR mount_hive(struct hive_key *key, const char *predef_name)
112 for (i = 0; reg_predefined_keys[i].name; i++) {
113 if (!strcasecmp(reg_predefined_keys[i].name, predef_name))
114 return reg_mount_hive($self, key,
115 reg_predefined_keys[i].handle, NULL);
117 return WERR_INVALID_NAME;
124 %typemap(in,noblock=1,numinputs=0) struct hive_key ** (struct hive_key *tmp) {
128 %typemap(argout,noblock=1) struct hive_key ** {
130 $result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_hive_key, 0);
133 %rename(hive_key) reg_open_hive;
134 WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
135 struct auth_session_info *session_info,
136 struct cli_credentials *credentials,
137 struct loadparm_context *lp_ctx,
138 struct hive_key **root);
140 %rename(open_ldb) reg_open_ldb_file;
141 WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
142 struct auth_session_info *session_info,
143 struct cli_credentials *credentials,
144 struct loadparm_context *lp_ctx,
145 struct hive_key **k);
147 %rename(create_dir) reg_create_directory;
148 WERROR reg_create_directory(TALLOC_CTX *parent_ctx,
149 const char *location, struct hive_key **key);
151 %rename(open_dir) reg_open_directory;
152 WERROR reg_open_directory(TALLOC_CTX *parent_ctx,
153 const char *location, struct hive_key **key);
155 %talloctype(hive_key);
157 typedef struct hive_key {
159 WERROR del(const char *name);
161 WERROR del_value(const char *name);
162 WERROR set_value(const char *name, uint32_t type, const DATA_BLOB data);
166 %rename(open_samba) reg_open_samba;
168 WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
169 struct registry_context **ctx,
170 struct loadparm_context *lp_ctx,
171 struct auth_session_info *session_info,
172 struct cli_credentials *credentials);
175 %constant uint32_t HKEY_CLASSES_ROOT = HKEY_CLASSES_ROOT;
176 %constant uint32_t HKEY_CURRENT_USER = HKEY_CURRENT_USER;
177 %constant uint32_t HKEY_LOCAL_MACHINE = HKEY_LOCAL_MACHINE;
178 %constant uint32_t HKEY_USERS = HKEY_USERS;
179 %constant uint32_t HKEY_PERFORMANCE_DATA = HKEY_PERFORMANCE_DATA;
180 %constant uint32_t HKEY_CURRENT_CONFIG = HKEY_CURRENT_CONFIG;
181 %constant uint32_t HKEY_DYN_DATA = HKEY_DYN_DATA;
182 %constant uint32_t HKEY_PERFORMANCE_TEXT = HKEY_PERFORMANCE_TEXT;
183 %constant uint32_t HKEY_PERFORMANCE_NLSTEXT = HKEY_PERFORMANCE_NLSTEXT;