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/>.
29 typedef struct registry_context reg;
30 typedef struct hive_key hive;
33 /* FIXME: This should be in another file */
34 %typemap(default) struct auth_session_info * {
39 %import "../../lib/talloc/talloc.i"
40 %import "../../auth/credentials/credentials.i"
41 %import "../../libcli/util/errors.i"
43 /* Utility functions */
45 const char *reg_get_predef_name(uint32_t hkey);
46 const char *str_regtype(int type);
48 /* Registry contexts */
49 %typemap(in,numinputs=0) struct registry_context ** (struct registry_context *tmp) {
53 %typemap(argout) struct registry_context ** {
54 $result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_registry_context, 0);
57 %rename(Registry) reg_open_local;
58 WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx,
59 struct auth_session_info *session_info,
60 struct cli_credentials *credentials);
62 %typemap(in) const char ** {
63 /* Check if is a list */
64 if (PyList_Check($input)) {
65 int size = PyList_Size($input);
67 $1 = (char **) malloc((size+1)*sizeof(const char *));
68 for (i = 0; i < size; i++) {
69 PyObject *o = PyList_GetItem($input,i);
70 if (PyString_Check(o))
71 $1[i] = PyString_AsString(PyList_GetItem($input,i));
73 PyErr_SetString(PyExc_TypeError,"list must contain strings");
80 PyErr_SetString(PyExc_TypeError,"not a list");
85 %typemap(freearg) const char ** {
89 typedef struct registry_context {
92 ~reg() { talloc_free($self); }
93 WERROR get_predefined_key_by_name(const char *name,
94 struct registry_key **key);
96 WERROR get_predefined_key(uint32_t hkey_id, struct registry_key **key);
97 WERROR apply_patchfile(const char *filename)
99 return reg_diff_apply(filename, $self);
102 WERROR mount_hive(struct hive_key *hive_key, uint32_t hkey_id,
103 const char **elements=NULL);
107 def mount(self, path, hkey_id, elements=[]):
108 self.mount_hive(Hive(path), hkey_id, elements)
113 %typemap(in,numinputs=0) struct hive_key ** (struct hive_key *tmp) {
117 %typemap(argout) struct hive_key ** {
119 $result = SWIG_NewPointerObj(*$1, SWIGTYPE_p_hive_key, 0);
122 %rename(Hive) reg_open_hive;
123 WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
124 struct auth_session_info *session_info,
125 struct cli_credentials *credentials,
126 struct hive_key **root);
128 typedef struct hive_key {
130 ~hive() { talloc_free($self); }
134 %rename(open_samba) reg_open_samba;
136 WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
137 struct registry_context **ctx,
138 struct loadparm_context *lp_ctx,
139 struct auth_session_info *session_info,
140 struct cli_credentials *credentials);
143 %constant uint32_t HKEY_CLASSES_ROOT = HKEY_CLASSES_ROOT;
144 %constant uint32_t HKEY_CURRENT_USER = HKEY_CURRENT_USER;
145 %constant uint32_t HKEY_LOCAL_MACHINE = HKEY_LOCAL_MACHINE;
146 %constant uint32_t HKEY_USERS = HKEY_USERS;
147 %constant uint32_t HKEY_PERFORMANCE_DATA = HKEY_PERFORMANCE_DATA;
148 %constant uint32_t HKEY_CURRENT_CONFIG = HKEY_CURRENT_CONFIG;
149 %constant uint32_t HKEY_DYN_DATA = HKEY_DYN_DATA;
150 %constant uint32_t HKEY_PERFORMANCE_TEXT = HKEY_PERFORMANCE_TEXT;
151 %constant uint32_t HKEY_PERFORMANCE_NLSTEXT = HKEY_PERFORMANCE_NLSTEXT;