14 files changed:
g_assert(k);
for(i = 0; W_ERROR_IS_OK(error = reg_key_get_subkey_by_index(mem_ctx, k, i, &sub)); i++) {
g_assert(k);
for(i = 0; W_ERROR_IS_OK(error = reg_key_get_subkey_by_index(mem_ctx, k, i, &sub)); i++) {
/* Replace the blank child with the first directory entry
You may be tempted to remove the blank child node and then
append a new one. Don't. If you remove the blank child
/* Replace the blank child with the first directory entry
You may be tempted to remove the blank child node and then
append a new one. Don't. If you remove the blank child
reg_string_to_val(mem_ctx,str_regtype(gtk_combo_box_get_active(GTK_COMBO_BOX(entry_type))), gtk_entry_get_text(GTK_ENTRY(entry_value)), &val);
reg_string_to_val(mem_ctx,str_regtype(gtk_combo_box_get_active(GTK_COMBO_BOX(entry_type))), gtk_entry_get_text(GTK_ENTRY(entry_value)), &val);
- error = reg_val_set(current_key, gtk_entry_get_text(GTK_ENTRY(entry_name)), val->data_type, val->data_blk, val->data_len);
+ error = reg_val_set(current_key, gtk_entry_get_text(GTK_ENTRY(entry_name)), val->data_type, val->data);
if (!W_ERROR_IS_OK(error)) {
gtk_show_werror(NULL, "Error while setting value", error);
if (!W_ERROR_IS_OK(error)) {
gtk_show_werror(NULL, "Error while setting value", error);
reg_string_to_val(mem_ctx,str_regtype(gtk_combo_box_get_active(GTK_COMBO_BOX(entry_type))), gtk_entry_get_text(GTK_ENTRY(entry_value)), &val);
reg_string_to_val(mem_ctx,str_regtype(gtk_combo_box_get_active(GTK_COMBO_BOX(entry_type))), gtk_entry_get_text(GTK_ENTRY(entry_value)), &val);
- error = reg_val_set(current_key, gtk_entry_get_text(GTK_ENTRY(entry_name)), val->data_type, val->data_blk, val->data_len);
+ error = reg_val_set(current_key, gtk_entry_get_text(GTK_ENTRY(entry_name)), val->data_type, val->data);
if (!W_ERROR_IS_OK(error)) {
gtk_show_werror(NULL, "Error while setting value", error);
if (!W_ERROR_IS_OK(error)) {
gtk_show_werror(NULL, "Error while setting value", error);
struct registry_value {
char *name;
unsigned int data_type;
struct registry_value {
char *name;
unsigned int data_type;
- int data_len;
- void *data_blk; /* Might want a separate block */
/* Or this one */
WERROR (*open_key) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_key **);
/* Or this one */
WERROR (*open_key) (TALLOC_CTX *, struct registry_key *, const char *name, struct registry_key **);
- /* Either implement these */
- WERROR (*num_subkeys) (struct registry_key *, int *count);
- WERROR (*num_values) (struct registry_key *, int *count);
+ 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 **);
/* Can not contain more then one level */
WERROR (*get_subkey_by_index) (TALLOC_CTX *, struct registry_key *, int idx, struct registry_key **);
/* Can not contain more then one level */
WERROR (*flush_key) (struct registry_key *);
/* Value management */
WERROR (*flush_key) (struct registry_key *);
/* Value management */
- WERROR (*set_value)(struct registry_key *, const char *name, uint32_t type, void *data, int len);
+ 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 (*del_value)(struct registry_key *, const char *valname);
};
};
struct reg_init_function_entry {
};
struct reg_init_function_entry {
- /* Function to create a member of the pdb_methods list */
const struct hive_operations *hive_functions;
struct reg_init_function_entry *prev, *next;
};
const struct hive_operations *hive_functions;
struct reg_init_function_entry *prev, *next;
};
-/* Used internally */
-#define SMB_REG_ASSERT(a) { if(!(a)) { DEBUG(0,("%s failed! (%s:%d)", #a, __FILE__, __LINE__)); }}
-
- support for editing values / adding values / deleting values
- support for adding/deleting keys
- support for security descriptors
- support for editing values / adding values / deleting values
- support for adding/deleting keys
- support for security descriptors
+
+- pass parsed paths around rather then strings (i.e. just a list of strings)
-WERROR reg_key_num_subkeys(struct registry_key *key, int *count)
+WERROR reg_key_num_subkeys(struct registry_key *key, uint32_t *count)
{
if(!key) return WERR_INVALID_PARAM;
{
if(!key) return WERR_INVALID_PARAM;
return WERR_NOT_SUPPORTED;
}
return WERR_NOT_SUPPORTED;
}
-WERROR reg_key_num_values(struct registry_key *key, int *count)
+WERROR reg_key_num_values(struct registry_key *key, uint32_t *count)
{
if(!key) return WERR_INVALID_PARAM;
{
if(!key) return WERR_INVALID_PARAM;
-WERROR reg_val_set(struct registry_key *key, const char *value, uint32_t type, void *data, int len)
+WERROR reg_val_set(struct registry_key *key, const char *value, uint32_t type, DATA_BLOB data)
{
/* A 'real' set function has preference */
if (key->hive->functions->set_value)
{
/* A 'real' set function has preference */
if (key->hive->functions->set_value)
- return key->hive->functions->set_value(key, value, type, data, len);
+ return key->hive->functions->set_value(key, value, type, data);
DEBUG(1, ("Backend '%s' doesn't support method set_value\n", key->hive->functions->name));
return WERR_NOT_SUPPORTED;
DEBUG(1, ("Backend '%s' doesn't support method set_value\n", key->hive->functions->name));
return WERR_NOT_SUPPORTED;
if (value->name) {
*max_valnamelen = MAX(*max_valnamelen, strlen(value->name));
}
if (value->name) {
*max_valnamelen = MAX(*max_valnamelen, strlen(value->name));
}
- *max_valbufsize = MAX(*max_valbufsize, value->data_len);
+ *max_valbufsize = MAX(*max_valbufsize, value->data.length);
char *reg_val_data_string(TALLOC_CTX *mem_ctx, struct registry_value *v)
{
char *reg_val_data_string(TALLOC_CTX *mem_ctx, struct registry_value *v)
{
- if(v->data_len == 0) return talloc_strdup(mem_ctx, "");
+ if(v->data.length == 0) return talloc_strdup(mem_ctx, "");
switch (v->data_type) {
case REG_EXPAND_SZ:
case REG_SZ:
switch (v->data_type) {
case REG_EXPAND_SZ:
case REG_SZ:
- convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, v->data_blk, v->data_len, (void **)&ret);
+ convert_string_talloc(mem_ctx, CH_UTF16, CH_UNIX, v->data.data, v->data.length, (void **)&ret);
return ret;
case REG_BINARY:
return ret;
case REG_BINARY:
- ret = talloc_array_size(mem_ctx, 3, v->data_len+1);
- asciip = ret;
- for (i=0; i<v->data_len; i++) {
- int str_rem = v->data_len * 3 - (asciip - ret);
- asciip += snprintf(asciip, str_rem, "%02x", *(uint8_t *)(((char *)v->data_blk)+i));
- if (i < v->data_len && str_rem > 0)
- *asciip = ' '; asciip++;
- }
- *asciip = '\0';
+ ret = data_blob_hex_string(mem_ctx, &v->data);
return ret;
case REG_DWORD:
return ret;
case REG_DWORD:
- if (*(int *)v->data_blk == 0)
+ if (*(int *)v->data.data == 0)
return talloc_strdup(mem_ctx, "0");
return talloc_strdup(mem_ctx, "0");
- return talloc_asprintf(mem_ctx, "0x%x", *(int *)v->data_blk);
+ return talloc_asprintf(mem_ctx, "0x%x", *(int *)v->data.data);
case REG_MULTI_SZ:
/* FIXME */
case REG_MULTI_SZ:
/* FIXME */
{
case REG_SZ:
case REG_EXPAND_SZ:
{
case REG_SZ:
case REG_EXPAND_SZ:
- (*value)->data_len = convert_string_talloc(mem_ctx, CH_UNIX, CH_UTF16, data_str, strlen(data_str), &(*value)->data_blk);
+ (*value)->data.length = convert_string_talloc(mem_ctx, CH_UNIX, CH_UTF16, data_str, strlen(data_str), (void **)&(*value)->data.data);
- case REG_DWORD:
- (*value)->data_len = sizeof(uint32_t);
- (*value)->data_blk = talloc(mem_ctx, uint32_t);
- *((uint32_t *)(*value)->data_blk) = strtol(data_str, NULL, 0);
+
+ case REG_DWORD: {
+ uint32_t tmp = strtol(data_str, NULL, 0);
+ (*value)->data = data_blob_talloc(mem_ctx, &tmp, 4);
+ }
- (*value)->data_len = 0;
- (*value)->data_blk = NULL;
+ ZERO_STRUCT((*value)->data);
-static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg, char **name, uint32_t *type, void **data, int *len)
+static void reg_ldb_unpack_value(TALLOC_CTX *mem_ctx, struct ldb_message *msg, char **name, uint32_t *type, DATA_BLOB *data)
{
const struct ldb_val *val;
*name = talloc_strdup(mem_ctx, ldb_msg_find_string(msg, "value", NULL));
{
const struct ldb_val *val;
*name = talloc_strdup(mem_ctx, ldb_msg_find_string(msg, "value", NULL));
{
case REG_SZ:
case REG_EXPAND_SZ:
{
case REG_SZ:
case REG_EXPAND_SZ:
- *len = convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16, val->data, val->length, data);
+ data->length = convert_string_talloc(mem_ctx, CH_UTF8, CH_UTF16, val->data, val->length, (void **)&data->data);
- case REG_DWORD:
- *len = 4;
- *data = talloc(mem_ctx, uint32_t);
- SIVAL(*data, 0, strtol(val->data, NULL, 0));
+ case REG_DWORD: {
+ uint32_t tmp = strtoul((char *)val->data, NULL, 0);
+ *data = data_blob_talloc(mem_ctx, &tmp, 4);
+ }
- *data = talloc_memdup(mem_ctx, val->data, val->length);
- *len = val->length;
+ *data = data_blob_talloc(mem_ctx, val->data, val->length);
-static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, TALLOC_CTX *mem_ctx, const char *name, uint32_t type, void *data, int len)
+static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, TALLOC_CTX *mem_ctx, const char *name, uint32_t type, DATA_BLOB data)
{
struct ldb_val val;
struct ldb_message *msg = talloc_zero(mem_ctx, struct ldb_message);
{
struct ldb_val val;
struct ldb_message *msg = talloc_zero(mem_ctx, struct ldb_message);
switch (type) {
case REG_SZ:
case REG_EXPAND_SZ:
switch (type) {
case REG_SZ:
case REG_EXPAND_SZ:
- val.length = convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, data, len, &val.data);
+ val.length = convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, (void *)data.data, data.length, (void **)&val.data);
ldb_msg_add_value(ctx, msg, "data", &val);
break;
ldb_msg_add_value(ctx, msg, "data", &val);
break;
- ldb_msg_add_string(ctx, msg, "data", talloc_asprintf(mem_ctx, "0x%x", IVAL(data, 0)));
+ ldb_msg_add_string(ctx, msg, "data", talloc_asprintf(mem_ctx, "0x%x", IVAL(data.data, 0)));
- val.length = len;
- val.data = data;
- ldb_msg_add_value(ctx, msg, "data", &val);
+ ldb_msg_add_value(ctx, msg, "data", &data);
*subkey = talloc(mem_ctx, struct registry_key);
talloc_set_destructor(*subkey, reg_close_ldb_key);
*subkey = talloc(mem_ctx, struct registry_key);
talloc_set_destructor(*subkey, reg_close_ldb_key);
- (*subkey)->name = talloc_strdup(mem_ctx, el->values[0].data);
+ (*subkey)->name = talloc_strdup(mem_ctx, (char *)el->values[0].data);
(*subkey)->backend_data = newkd = talloc_zero(*subkey, struct ldb_key_data);
(*subkey)->last_mod = 0; /* TODO: we need to add this to the
ldb backend properly */
(*subkey)->backend_data = newkd = talloc_zero(*subkey, struct ldb_key_data);
(*subkey)->last_mod = 0; /* TODO: we need to add this to the
ldb backend properly */
*value = talloc(mem_ctx, struct registry_value);
*value = talloc(mem_ctx, struct registry_value);
- reg_ldb_unpack_value(mem_ctx, kd->values[idx], &(*value)->name, &(*value)->data_type, &(*value)->data_blk, &(*value)->data_len);
+ reg_ldb_unpack_value(mem_ctx, kd->values[idx], &(*value)->name, &(*value)->data_type, &(*value)->data);
-static WERROR ldb_set_value (struct registry_key *parent, const char *name, uint32_t type, void *data, int len)
+static WERROR ldb_set_value (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;
{
struct ldb_context *ctx = parent->hive->backend_data;
struct ldb_message *msg;
int ret;
TALLOC_CTX *mem_ctx = talloc_init("ldb_set_value");
int ret;
TALLOC_CTX *mem_ctx = talloc_init("ldb_set_value");
- msg = reg_ldb_pack_value(ctx, mem_ctx, name, type, data, len);
+ msg = reg_ldb_pack_value(ctx, mem_ctx, name, type, data);
msg->dn = ldb_dn_build_child(msg, "value", name, kd->dn);
msg->dn = ldb_dn_build_child(msg, "value", name, kd->dn);
static REGF_HDR *nt_get_regf_hdr(struct registry_hive *h)
{
REGF *regf = h->backend_data;
static REGF_HDR *nt_get_regf_hdr(struct registry_hive *h)
{
REGF *regf = h->backend_data;
if (!regf->base) { /* Try to mmap etc the file */
if (!regf->base) { /* Try to mmap etc the file */
- SMB_REG_ASSERT(regf->base != NULL);
+ SMB_ASSERT(regf->base != NULL);
return (REGF_HDR *)regf->base;
}
return (REGF_HDR *)regf->base;
}
/* Here, we have an item in the map that has been reserved, or tmp==NULL. */
/* Here, we have an item in the map that has been reserved, or tmp==NULL. */
- SMB_REG_ASSERT(tmp == NULL || (tmp && tmp->state != SEC_DESC_NON));
+ SMB_ASSERT(tmp == NULL || (tmp && tmp->state != SEC_DESC_NON));
/*
* Now, allocate a KEY_SEC_DESC, and parse the structure here, and add the
/*
* Now, allocate a KEY_SEC_DESC, and parse the structure here, and add the
sk_prev_off = IVAL(&sk_hdr->prev_off,0);
tmp->prev = lookup_create_sec_key(regf, regf->sk_map, sk_prev_off);
sk_prev_off = IVAL(&sk_hdr->prev_off,0);
tmp->prev = lookup_create_sec_key(regf, regf->sk_map, sk_prev_off);
- SMB_REG_ASSERT(tmp->prev != NULL);
+ SMB_ASSERT(tmp->prev != NULL);
sk_next_off = IVAL(&sk_hdr->next_off,0);
tmp->next = lookup_create_sec_key(regf, regf->sk_map, sk_next_off);
sk_next_off = IVAL(&sk_hdr->next_off,0);
tmp->next = lookup_create_sec_key(regf, regf->sk_map, sk_next_off);
- SMB_REG_ASSERT(tmp->next != NULL);
+ SMB_ASSERT(tmp->next != NULL);
memcpy(dtmp, &dat_off, dat_len);
}
memcpy(dtmp, &dat_off, dat_len);
}
-
- tmp->data_blk = dtmp;
- tmp->data_len = dat_len;
+ tmp->data = data_blob_talloc(mem_ctx, dtmp, dat_len);
-static WERROR lf_num_entries(struct registry_hive *h, LF_HDR *lf_hdr, int size, int *count)
+static WERROR lf_num_entries(struct registry_hive *h, LF_HDR *lf_hdr, int size, uint32_t *count)
{
WERROR error;
error = lf_verify(h, lf_hdr, size);
if(!W_ERROR_IS_OK(error)) return error;
{
WERROR error;
error = lf_verify(h, lf_hdr, size);
if(!W_ERROR_IS_OK(error)) return error;
- SMB_REG_ASSERT(size < 0);
*count = SVAL(&lf_hdr->key_count,0);
DEBUG(2, ("Key Count: %u\n", *count));
*count = SVAL(&lf_hdr->key_count,0);
DEBUG(2, ("Key Count: %u\n", *count));
error = lf_verify(parent->hive, lf_hdr, size);
if(!W_ERROR_IS_OK(error)) return error;
error = lf_verify(parent->hive, lf_hdr, size);
if(!W_ERROR_IS_OK(error)) return error;
- SMB_REG_ASSERT(size < 0);
count = SVAL(&lf_hdr->key_count,0);
DEBUG(2, ("Key Count: %u\n", count));
count = SVAL(&lf_hdr->key_count,0);
DEBUG(2, ("Key Count: %u\n", count));
return WERR_INVALID_PARAM;
}
return WERR_INVALID_PARAM;
}
- SMB_REG_ASSERT(size < 0);
namlen = SVAL(&nk_hdr->nam_len,0);
clsname_len = SVAL(&nk_hdr->clsnam_len,0);
namlen = SVAL(&nk_hdr->nam_len,0);
clsname_len = SVAL(&nk_hdr->clsnam_len,0);
/* Fish out the key name and process the LF list */
/* Fish out the key name and process the LF list */
- SMB_REG_ASSERT(namlen < sizeof(key_name));
+ SMB_ASSERT(namlen < sizeof(key_name));
strncpy(key_name, nk_hdr->key_nam, namlen);
key_name[namlen] = '\0';
strncpy(key_name, nk_hdr->key_nam, namlen);
key_name[namlen] = '\0';
if (!regf || !size || !off) return NULL;
if (!regf || !size || !off) return NULL;
- SMB_REG_ASSERT(regf->blk_head != NULL);
+ SMB_ASSERT(regf->blk_head != NULL);
/*
* round up size to include header and then to 8-byte boundary
/*
* round up size to include header and then to 8-byte boundary
-static WERROR nt_num_subkeys(struct registry_key *k, int *num)
+static WERROR nt_num_subkeys(struct registry_key *k, uint32_t *num)
{
REGF *regf = k->hive->backend_data;
LF_HDR *lf_hdr;
{
REGF *regf = k->hive->backend_data;
LF_HDR *lf_hdr;
return lf_num_entries(k->hive, lf_hdr, BLK_SIZE(lf_hdr), num);
}
return lf_num_entries(k->hive, lf_hdr, BLK_SIZE(lf_hdr), num);
}
-static WERROR nt_num_values(struct registry_key *k, int *count)
+static WERROR nt_num_values(struct registry_key *k, uint32_t *count)
{
NK_HDR *nk_hdr = k->backend_data;
*count = IVAL(&nk_hdr->val_cnt,0);
{
NK_HDR *nk_hdr = k->backend_data;
*count = IVAL(&nk_hdr->val_cnt,0);
*value = talloc(mem_ctx, struct registry_value);
(*value)->name = talloc_strdup(mem_ctx, r.out.name->name);
(*value)->data_type = type;
*value = talloc(mem_ctx, struct registry_value);
(*value)->name = talloc_strdup(mem_ctx, r.out.name->name);
(*value)->data_type = type;
- (*value)->data_len = *r.out.length;
- (*value)->data_blk = talloc_memdup(mem_ctx, r.out.value, *r.out.length);
+ (*value)->data = data_blob_talloc(mem_ctx, r.out.value, *r.out.length);
-static WERROR rpc_num_values(struct registry_key *key, int *count) {
+static WERROR rpc_num_values(struct registry_key *key, uint32_t *count)
+{
struct rpc_key_data *mykeydata = key->backend_data;
WERROR error;
struct rpc_key_data *mykeydata = key->backend_data;
WERROR error;
-static WERROR rpc_num_subkeys(struct registry_key *key, int *count) {
+static WERROR rpc_num_subkeys(struct registry_key *key, uint32_t *count)
+{
struct rpc_key_data *mykeydata = key->backend_data;
WERROR error;
struct rpc_key_data *mykeydata = key->backend_data;
WERROR error;
return WERR_NO_MORE_ITEMS;
}
return WERR_NO_MORE_ITEMS;
}
-static WERROR w95_num_values(struct registry_key *k, int *count)
+static WERROR w95_num_values(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);
{
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);
*value = talloc(mem_ctx, struct registry_value);
(*value)->name = talloc_strndup(mem_ctx, (char *)curval+sizeof(RGDB_VALUE), curval->name_len);
*value = talloc(mem_ctx, struct registry_value);
(*value)->name = talloc_strndup(mem_ctx, (char *)curval+sizeof(RGDB_VALUE), curval->name_len);
- (*value)->data_len = curval->data_len;
- (*value)->data_blk = talloc_memdup(mem_ctx, (char *)curval+sizeof(RGDB_VALUE)+curval->name_len, curval->data_len);
+ (*value)->data = data_blob_talloc(mem_ctx, curval+sizeof(RGDB_VALUE)+curval->name_len, curval->data_len);
(*value)->data_type = curval->type;
return WERR_OK;
(*value)->data_type = curval->type;
return WERR_OK;
- typedef struct {
- uint32 major;
- uint32 minor;
- uint32 release;
- uint32 build;
- } regf_version;
-
- /* 1.3.0.1 for WinNT 4
+ /*
+ * Registry version number
+ * 1.3.0.1 for WinNT 4
+ typedef struct {
+ [value(1)] uint32 major;
+ [value(3)] uint32 minor;
+ [value(0)] uint32 release;
+ [value(1)] uint32 build;
+ } regf_version;
/*
"regf" is obviously the abbreviation for "Registry file". "regf" is the
/*
"regf" is obviously the abbreviation for "Registry file". "regf" is the
typedef enum {
REG_ROOT_KEY = 0x20,
typedef enum {
REG_ROOT_KEY = 0x20,
REG_SYM_LINK = 0x10
} reg_key_type;
REG_SYM_LINK = 0x10
} reg_key_type;
uint32 num_values;
uint32 values_offset;
uint32 sk_offset;
uint32 num_values;
uint32 values_offset;
uint32 sk_offset;
uint32 unk4[5];
uint16 name_length;
uint16 clsname_length;
uint32 unk4[5];
uint16 name_length;
uint16 clsname_length;
uint32 base37; /* base37 of key name */
} lh_hash;
uint32 base37; /* base37 of key name */
} lh_hash;
+ /* Subkey listing with hash of first 4 characters */
typedef struct {
uint16 key_count;
lh_hash hashes[key_count];
typedef struct {
uint16 key_count;
lh_hash hashes[key_count];
for(i = 0; W_ERROR_IS_OK(error1 = reg_key_get_value_by_index(mem_ctx, newkey, i, &v1)); i++) {
error2 = reg_key_get_value_by_name(mem_ctx, oldkey, v1->name, &v2);
for(i = 0; W_ERROR_IS_OK(error1 = reg_key_get_value_by_index(mem_ctx, newkey, i, &v1)); i++) {
error2 = reg_key_get_value_by_name(mem_ctx, oldkey, v1->name, &v2);
- if ((W_ERROR_IS_OK(error2) && (v2->data_len != v1->data_len || memcmp(v1->data_blk, v2->data_blk, v1->data_len)))
+ if ((W_ERROR_IS_OK(error2) && data_blob_equal(&v1->data, &v2->data))
|| W_ERROR_EQUAL(error2, WERR_DEST_NOT_FOUND)) {
fprintf(out, "\"%s\"=%s:%s\n", v1->name, str_regtype(v1->data_type), reg_val_data_string(mem_ctx, v1));
}
|| W_ERROR_EQUAL(error2, WERR_DEST_NOT_FOUND)) {
fprintf(out, "\"%s\"=%s:%s\n", v1->name, str_regtype(v1->data_type), reg_val_data_string(mem_ctx, v1));
}
DEBUG(0, ("Error removing value '%s'\n", val->name));
}
modified = True;
DEBUG(0, ("Error removing value '%s'\n", val->name));
}
modified = True;
- }
- else {
- if(!W_ERROR_IS_OK(reg_val_set(tmp, val->name, val->type, val->val, strlen(val->val)))) {
+ } else {
+ DATA_BLOB blob;
+ blob.data = (uint8_t *)val->val;
+ blob.length = strlen(val->val);
+ if(!W_ERROR_IS_OK(reg_val_set(tmp, val->name, val->type, blob))) {
DEBUG(0, ("Error adding new value '%s'\n", val->name));
continue;
}
DEBUG(0, ("Error adding new value '%s'\n", val->name));
continue;
}
} else {
struct registry_value *val;
if (reg_string_to_val(mem_ctx, argv[2], argv[3], &val)) {
} else {
struct registry_value *val;
if (reg_string_to_val(mem_ctx, argv[2], argv[3], &val)) {
- WERROR error = reg_val_set(cur, argv[1], val->data_type, val->data_blk, val->data_len);
+ WERROR error = reg_val_set(cur, argv[1], val->data_type, val->data);
if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Error setting value: %s\n", win_errstr(error));
return NULL;
if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Error setting value: %s\n", win_errstr(error));
return NULL;
/* check the client has enough room for the value */
if (r->in.value != NULL &&
r->in.size != NULL &&
/* check the client has enough room for the value */
if (r->in.value != NULL &&
r->in.size != NULL &&
- value->data_len > *r->in.size) {
+ value->data.length > *r->in.size) {
r->out.name->size = 2*strlen_m_term(value->name);
if (r->in.value) {
r->out.name->size = 2*strlen_m_term(value->name);
if (r->in.value) {
- r->out.value = value->data_blk;
+ r->out.value = value->data.data;
}
if (r->in.size) {
r->out.size = talloc(mem_ctx, uint32_t);
}
if (r->in.size) {
r->out.size = talloc(mem_ctx, uint32_t);
- *r->out.size = value->data_len;
+ *r->out.size = value->data.length;
r->out.length = r->out.size;
}
r->out.length = r->out.size;
}
/* Just asking for the size of the buffer */
r->out.type = &val->data_type;
/* Just asking for the size of the buffer */
r->out.type = &val->data_type;
- r->out.length = &val->data_len;
+ r->out.length = &val->data.length;
if (!r->in.data) {
r->out.size = talloc(mem_ctx, uint32_t);
if (!r->in.data) {
r->out.size = talloc(mem_ctx, uint32_t);
- *r->out.size = val->data_len;
+ *r->out.size = val->data.length;
} else {
r->out.size = r->in.size;
} else {
r->out.size = r->in.size;
- r->out.data = val->data_blk;
+ r->out.data = val->data.data;
struct dcesrv_handle *h;
struct registry_key *key;
WERROR result;
struct dcesrv_handle *h;
struct registry_key *key;
WERROR result;
DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
key = h->data;
DCESRV_PULL_HANDLE_FAULT(h, r->in.handle, HTYPE_REGKEY);
key = h->data;
- result = reg_val_set(key, r->in.name.name, r->in.type, r->in.data, r->in.size);
+ data.data = r->in.data;
+ data.length = r->in.size;
+ result = reg_val_set(key, r->in.name.name, r->in.type, data);
if (!W_ERROR_IS_OK(result)) {
return result;
if (!W_ERROR_IS_OK(result)) {
return result;