}
-static void on_save_activate(GtkMenuItem *menuitem, gpointer user_data)
-{
- WERROR error = reg_save(registry, NULL);
- if(!W_ERROR_IS_OK(error)) {
- gtk_show_werror(mainwin, "Error while saving", error);
- }
-}
-
-
static void on_save_as_activate(GtkMenuItem *menuitem, gpointer user_data)
{
gint result;
result = gtk_dialog_run(GTK_DIALOG(savefilewin));
switch(result) {
case GTK_RESPONSE_OK:
- error = reg_save(registry, gtk_file_selection_get_filename(GTK_FILE_SELECTION(savefilewin)));
+ /* FIXME: error = reg_dump(registry, gtk_file_selection_get_filename(GTK_FILE_SELECTION(savefilewin))); */
if(!W_ERROR_IS_OK(error)) {
gtk_show_werror(mainwin, "Error while saving as", error);
}
gtk_box_pack_start (GTK_BOX (vbox1), statusbar, FALSE, FALSE, 0);
gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (statusbar), FALSE);
- g_signal_connect ((gpointer) save, "activate",
- G_CALLBACK (on_save_activate),
- NULL);
g_signal_connect ((gpointer) save_as, "activate",
G_CALLBACK (on_save_as_activate),
NULL);
return WERR_OK;
}
-WERROR reg_key_get_value_by_index(TALLOC_CTX *mem_ctx, struct registry_key *key, int idx, struct registry_value **val)
+WERROR reg_key_get_value_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *key, int idx, struct registry_value **val)
{
if(!key) return WERR_INVALID_PARAM;
return WERR_OK;
}
-WERROR reg_key_num_subkeys(struct registry_key *key, uint32_t *count)
+WERROR reg_key_num_subkeys(const struct registry_key *key, uint32_t *count)
{
if(!key) return WERR_INVALID_PARAM;
return WERR_NOT_SUPPORTED;
}
-WERROR reg_key_num_values(struct registry_key *key, uint32_t *count)
+WERROR reg_key_num_values(const struct registry_key *key, uint32_t *count)
{
if(!key) return WERR_INVALID_PARAM;
return WERR_NOT_SUPPORTED;
}
-WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx, struct registry_key *key, int idx, struct registry_key **subkey)
+WERROR reg_key_get_subkey_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *key, int idx, struct registry_key **subkey)
{
if(!key) return WERR_INVALID_PARAM;
return WERR_OK;;
}
-WERROR reg_key_get_subkey_by_name(TALLOC_CTX *mem_ctx, struct registry_key *key, const char *name, struct registry_key **subkey)
+WERROR reg_key_get_subkey_by_name(TALLOC_CTX *mem_ctx, const struct registry_key *key, const char *name, struct registry_key **subkey)
{
int i;
WERROR error = WERR_OK;
return WERR_OK;
}
-WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx, struct registry_key *key, const char *name, struct registry_value **val)
+WERROR reg_key_get_value_by_name(TALLOC_CTX *mem_ctx, const struct registry_key *key, const char *name, struct registry_value **val)
{
int i;
WERROR error = WERR_OK;
return WERR_OK;
}
-WERROR reg_key_add_name(TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *desc, struct registry_key **newkey)
+WERROR reg_key_add_name(TALLOC_CTX *mem_ctx, const struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *desc, struct registry_key **newkey)
{
WERROR error;
}
-WERROR reg_get_sec_desc(TALLOC_CTX *ctx, struct registry_key *key, struct security_descriptor **secdesc)
+WERROR reg_get_sec_desc(TALLOC_CTX *ctx, const struct registry_key *key, struct security_descriptor **secdesc)
{
/* A 'real' set function has preference */
if (key->hive->functions->key_get_sec_desc)
return WERR_NOT_SUPPORTED;
}
-WERROR reg_del_value(struct registry_key *key, const char *valname)
+WERROR reg_del_value(const struct registry_key *key, const char *valname)
{
WERROR ret = WERR_OK;
if(!key->hive->functions->del_value)
return ret;
}
-WERROR reg_save (struct registry_context *ctx, const char *location)
-{
- return WERR_NOT_SUPPORTED;
-}
-
-WERROR reg_key_flush(struct registry_key *key)
+WERROR reg_key_flush(const struct registry_key *key)
{
if (!key) {
return WERR_INVALID_PARAM;
return WERR_OK;
}
-WERROR reg_key_subkeysizes(struct registry_key *key, uint32_t *max_subkeylen, uint32_t *max_subkeysize)
+WERROR reg_key_subkeysizes(const struct registry_key *key, uint32_t *max_subkeylen, uint32_t *max_subkeysize)
{
int i = 0;
struct registry_key *subkey;
return WERR_OK;
}
-WERROR reg_key_valuesizes(struct registry_key *key, uint32_t *max_valnamelen, uint32_t *max_valbufsize)
+WERROR reg_key_valuesizes(const struct registry_key *key, uint32_t *max_valnamelen, uint32_t *max_valbufsize)
{
int i = 0;
struct registry_value *value;
#include "system/dir.h"
#include "system/filesys.h"
-static WERROR reg_dir_add_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *desc, struct registry_key **result)
+static WERROR reg_dir_add_key(TALLOC_CTX *mem_ctx, const struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *desc, struct registry_key **result)
{
char *path;
int ret;
return WERR_INVALID_PARAM;
}
-static WERROR reg_dir_del_key(struct registry_key *k, const char *name)
+static WERROR reg_dir_del_key(const struct registry_key *k, const char *name)
{
char *child = talloc_asprintf(NULL, "%s/%s", (char *)k->backend_data, name);
WERROR ret;
return ret;
}
-static WERROR reg_dir_open_key(TALLOC_CTX *mem_ctx, struct registry_key *p, const char *name, struct registry_key **subkey)
+static WERROR reg_dir_open_key(TALLOC_CTX *mem_ctx, const struct registry_key *p, const char *name, struct registry_key **subkey)
{
DIR *d;
char *fullpath, *unixpath;
return WERR_OK;
}
-static WERROR reg_dir_key_by_index(TALLOC_CTX *mem_ctx, struct registry_key *k, int idx, struct registry_key **key)
+static WERROR reg_dir_key_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *k, int idx, struct registry_key **key)
{
struct dirent *e;
char *fullpath = k->backend_data;
return 0;
}
-static struct ldb_dn *reg_path_to_ldb(TALLOC_CTX *mem_ctx, struct registry_key *from, const char *path, const char *add)
+static struct ldb_dn *reg_path_to_ldb(TALLOC_CTX *mem_ctx, const struct registry_key *from, const char *path, const char *add)
{
TALLOC_CTX *local_ctx;
struct ldb_dn *ret = ldb_dn_new(mem_ctx);
}
-static WERROR ldb_get_subkey_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k, int idx, struct registry_key **subkey)
+static WERROR ldb_get_subkey_by_id(TALLOC_CTX *mem_ctx, const struct registry_key *k, int idx, struct registry_key **subkey)
{
struct ldb_context *c = k->hive->backend_data;
struct ldb_message_element *el;
return WERR_OK;
}
-static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k, int idx, struct registry_value **value)
+static WERROR ldb_get_value_by_id(TALLOC_CTX *mem_ctx, const struct registry_key *k, int idx, struct registry_value **value)
{
struct ldb_context *c = k->hive->backend_data;
struct ldb_key_data *kd = k->backend_data;
return WERR_OK;
}
-static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, struct registry_key *h, const char *name, struct registry_key **key)
+static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct registry_key *h, const char *name, struct registry_key **key)
{
struct ldb_context *c = h->hive->backend_data;
struct ldb_message **msg;
return WERR_OK;
}
-static WERROR ldb_add_key (TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *sd, struct registry_key **newkey)
+static WERROR ldb_add_key (TALLOC_CTX *mem_ctx, const struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *sd, struct registry_key **newkey)
{
struct ldb_context *ctx = parent->hive->backend_data;
struct ldb_message *msg;
return WERR_OK;
}
-static WERROR ldb_del_key (struct registry_key *key, const char *child)
+static WERROR ldb_del_key (const struct registry_key *key, const char *child)
{
int ret;
struct ldb_key_data *kd = key->backend_data;
return WERR_OK;
}
-static WERROR ldb_del_value (struct registry_key *key, const char *child)
+static WERROR ldb_del_value (const struct registry_key *key, const char *child)
{
int ret;
struct ldb_key_data *kd = key->backend_data;
return WERR_OK;
}
-static WERROR ldb_set_value (struct registry_key *parent, const char *name, uint32_t type, DATA_BLOB data)
+static WERROR ldb_set_value (const struct registry_key *parent, const char *name, uint32_t type, DATA_BLOB data)
{
struct ldb_context *ctx = parent->hive->backend_data;
struct ldb_message *msg;
return ret;
}
-static WERROR regf_num_subkeys (struct registry_key *key, uint32_t *count)
+static WERROR regf_num_subkeys (const struct registry_key *key, uint32_t *count)
{
struct nk_block *nk = key->backend_data;
return WERR_OK;
}
-static WERROR regf_num_values (struct registry_key *key, uint32_t *count)
+static WERROR regf_num_values (const struct registry_key *key, uint32_t *count)
{
struct nk_block *nk = key->backend_data;
return ret;
}
-static WERROR regf_get_value (TALLOC_CTX *ctx, struct registry_key *key, int idx, struct registry_value **ret)
+static WERROR regf_get_value (TALLOC_CTX *ctx, const struct registry_key *key, int idx, struct registry_value **ret)
{
struct nk_block *nk = key->backend_data;
struct vk_block *vk;
return WERR_OK;
}
-static WERROR regf_get_subkey (TALLOC_CTX *ctx, struct registry_key *key, int idx, struct registry_key **ret)
+static WERROR regf_get_subkey (TALLOC_CTX *ctx, const struct registry_key *key, int idx, struct registry_key **ret)
{
DATA_BLOB data;
struct nk_block *nk = key->backend_data;
}
-static WERROR regf_set_sec_desc (struct registry_key *key, struct security_descriptor *sec_desc)
+static WERROR regf_set_sec_desc (const struct registry_key *key, const struct security_descriptor *sec_desc)
{
/* FIXME */
return WERR_NOT_SUPPORTED;
}
-static WERROR regf_get_sec_desc(TALLOC_CTX *ctx, struct registry_key *key, struct security_descriptor **sd)
+static WERROR regf_get_sec_desc(TALLOC_CTX *ctx, const struct registry_key *key, struct security_descriptor **sd)
{
struct nk_block *nk = key->backend_data;
struct sk_block sk;
return ret;
}
-static WERROR regf_del_value (struct registry_key *parent, const char *name)
+static WERROR regf_del_value (const struct registry_key *parent, const char *name)
{
/* FIXME */
return WERR_NOT_SUPPORTED;
}
-static WERROR regf_del_key (struct registry_key *parent, const char *name)
+static WERROR regf_del_key (const struct registry_key *parent, const char *name)
{
struct nk_block *nk = parent->backend_data;
return WERR_NOT_SUPPORTED;
}
-static WERROR regf_add_key (TALLOC_CTX *ctx, struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *sec_desc, struct registry_key **ret)
+static WERROR regf_add_key (TALLOC_CTX *ctx, const struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *sec_desc, struct registry_key **ret)
{
struct nk_block *parent_nk = parent->backend_data, nk;
struct regf_data *regf = parent->hive->backend_data;
return WERR_OK;
}
-static WERROR regf_set_value (struct registry_key *key, const char *name, uint32_t type, DATA_BLOB data)
+static WERROR regf_set_value (const struct registry_key *key, const char *name, uint32_t type, const DATA_BLOB data)
{
/* FIXME */
{ 0, NULL }
};
-static WERROR rpc_query_key(struct registry_key *k);
+static WERROR rpc_query_key(const struct registry_key *k);
static WERROR rpc_get_predefined_key (struct registry_context *ctx, uint32_t hkey_type, struct registry_key **k)
{
}
#endif
-static WERROR rpc_open_key(TALLOC_CTX *mem_ctx, struct registry_key *h, const char *name, struct registry_key **key)
+static WERROR rpc_open_key(TALLOC_CTX *mem_ctx, const struct registry_key *h, const char *name, struct registry_key **key)
{
struct rpc_key_data *mykeydata;
struct winreg_OpenKey r;
return r.out.result;
}
-static WERROR rpc_get_value_by_index(TALLOC_CTX *mem_ctx, struct registry_key *parent, int n, struct registry_value **value)
+static WERROR rpc_get_value_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *parent, int n, struct registry_value **value)
{
struct rpc_key_data *mykeydata = parent->backend_data;
WERROR error;
return r.out.result;
}
-static WERROR rpc_get_subkey_by_index(TALLOC_CTX *mem_ctx, struct registry_key *parent, int n, struct registry_key **subkey)
+static WERROR rpc_get_subkey_by_index(TALLOC_CTX *mem_ctx, const struct registry_key *parent, int n, struct registry_key **subkey)
{
struct winreg_EnumKey r;
struct rpc_key_data *mykeydata = parent->backend_data;
return r.out.result;
}
-static WERROR rpc_add_key(TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *sec, struct registry_key **key)
+static WERROR rpc_add_key(TALLOC_CTX *mem_ctx, const struct registry_key *parent, const char *name, uint32_t access_mask, struct security_descriptor *sec, struct registry_key **key)
{
NTSTATUS status;
struct winreg_CreateKey r;
return r.out.result;
}
-static WERROR rpc_query_key(struct registry_key *k)
+static WERROR rpc_query_key(const struct registry_key *k)
{
NTSTATUS status;
struct winreg_QueryInfoKey r;
return r.out.result;
}
-static WERROR rpc_del_key(struct registry_key *parent, const char *name)
+static WERROR rpc_del_key(const struct registry_key *parent, const char *name)
{
NTSTATUS status;
struct rpc_key_data *mykeydata = parent->backend_data;
return r.out.result;
}
-static WERROR rpc_num_values(struct registry_key *key, uint32_t *count)
+static WERROR rpc_num_values(const struct registry_key *key, uint32_t *count)
{
struct rpc_key_data *mykeydata = key->backend_data;
WERROR error;
return WERR_OK;
}
-static WERROR rpc_num_subkeys(struct registry_key *key, uint32_t *count)
+static WERROR rpc_num_subkeys(const struct registry_key *key, uint32_t *count)
{
struct rpc_key_data *mykeydata = key->backend_data;
WERROR error;
return WERR_OK;
}
-static WERROR w95_get_subkey_by_index (TALLOC_CTX *mem_ctx, struct registry_key *parent, int n, struct registry_key **key)
+static WERROR w95_get_subkey_by_index (TALLOC_CTX *mem_ctx, const struct registry_key *parent, int n, struct registry_key **key)
{
CREG *creg = parent->hive->backend_data;
RGKN_KEY *rgkn_key = parent->backend_data;
return WERR_NO_MORE_ITEMS;
}
-static WERROR w95_num_values(struct registry_key *k, uint32_t *count)
+static WERROR w95_num_values(const struct registry_key *k, uint32_t *count)
{
RGKN_KEY *rgkn_key = k->backend_data;
RGDB_KEY *rgdb_key = LOCN_RGDB_KEY((CREG *)k->hive->backend_data, rgkn_key->id.rgdb, rgkn_key->id.id);
return WERR_OK;
}
-static WERROR w95_get_value_by_id(TALLOC_CTX *mem_ctx, struct registry_key *k, int idx, struct registry_value **value)
+static WERROR w95_get_value_by_id(TALLOC_CTX *mem_ctx, const struct registry_key *k, int idx, struct registry_value **value)
{
RGKN_KEY *rgkn_key = k->backend_data;
DWORD i;
} regf_hdr;
/*
- hbin probably means hive-bin (what bin stands for I don't know)
+ hbin probably means hive-bin (i.e. hive-container)
This block is always a multiple
of 4kb in size.
*/
#define REGISTRY_INTERFACE_VERSION 1
/* structure to store the registry handles */
-struct registry_key {
- char *name; /* Name of the key */
- const char *path; /* Full path to the key */
- char *class_name; /* Name of key class */
- NTTIME last_mod; /* Time last modified */
+struct registry_key
+{
+ char *name;
+ const char *path;
+ char *class_name;
+ NTTIME last_mod;
struct registry_hive *hive;
void *backend_data;
};
-struct registry_value {
+struct registry_value
+{
char *name;
unsigned int data_type;
DATA_BLOB data;
};
/* FIXME */
-typedef void (*key_notification_function) (void);
-typedef void (*value_notification_function) (void);
+typedef void (*reg_key_notification_function) (void);
+typedef void (*reg_value_notification_function) (void);
/*
* Container for function pointers to enumeration routines
WERROR (*open_hive) (struct registry_hive *, struct registry_key **);
/* Or this one */
- WERROR (*open_key) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_key **);
+ WERROR (*open_key) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_key **);
- WERROR (*num_subkeys) (struct registry_key *, uint32_t *count);
- WERROR (*num_values) (struct registry_key *, uint32_t *count);
- WERROR (*get_subkey_by_index) (TALLOC_CTX *, struct registry_key *, int idx, struct registry_key **);
+ WERROR (*num_subkeys) (const struct registry_key *, uint32_t *count);
+ WERROR (*num_values) (const struct registry_key *, uint32_t *count);
+ WERROR (*get_subkey_by_index) (TALLOC_CTX *, const struct registry_key *, int idx, struct registry_key **);
/* Can not contain more then one level */
- WERROR (*get_subkey_by_name) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_key **);
- WERROR (*get_value_by_index) (TALLOC_CTX *, struct registry_key *, int idx, struct registry_value **);
+ WERROR (*get_subkey_by_name) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_key **);
+ WERROR (*get_value_by_index) (TALLOC_CTX *, const struct registry_key *, int idx, struct registry_value **);
/* Can not contain more then one level */
- WERROR (*get_value_by_name) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_value **);
+ WERROR (*get_value_by_name) (TALLOC_CTX *, const struct registry_key *, const char *name, struct registry_value **);
/* Security control */
- WERROR (*key_get_sec_desc) (TALLOC_CTX *, struct registry_key *, struct security_descriptor **);
- WERROR (*key_set_sec_desc) (struct registry_key *, struct security_descriptor *);
+ WERROR (*key_get_sec_desc) (TALLOC_CTX *, const struct registry_key *, struct security_descriptor **);
+ WERROR (*key_set_sec_desc) (const struct registry_key *, const struct security_descriptor *);
/* Notification */
- WERROR (*request_key_change_notify) (struct registry_key *, key_notification_function);
- WERROR (*request_value_change_notify) (struct registry_value *, value_notification_function);
+ WERROR (*request_key_change_notify) (const struct registry_key *, reg_key_notification_function);
+ WERROR (*request_value_change_notify) (const struct registry_value *, reg_value_notification_function);
/* Key management */
- WERROR (*add_key)(TALLOC_CTX *, struct registry_key *, const char *name, uint32_t access_mask, struct security_descriptor *, struct registry_key **);
- WERROR (*del_key)(struct registry_key *, const char *name);
- WERROR (*flush_key) (struct registry_key *);
+ WERROR (*add_key)(TALLOC_CTX *, const struct registry_key *, const char *name, uint32_t access_mask, struct security_descriptor *, struct registry_key **);
+ WERROR (*del_key)(const struct registry_key *, const char *name);
+ WERROR (*flush_key) (const struct registry_key *);
/* Value management */
- WERROR (*set_value)(struct registry_key *, const char *name, uint32_t type, DATA_BLOB data);
- WERROR (*del_value)(struct registry_key *, const char *valname);
+ WERROR (*set_value)(const struct registry_key *, const char *name, uint32_t type, const DATA_BLOB data);
+ WERROR (*del_value)(const struct registry_key *, const char *valname);
};
-struct registry_hive {
+struct registry_hive
+{
const struct hive_operations *functions;
struct registry_key *root;
void *backend_data;