Rev 11166: Some more work towards fixing the build. in file:///home/jelmer/bzr.samba/4.0-regwrite/

Jelmer Vernooij jelmer at samba.org
Sat Feb 10 15:02:31 GMT 2007


At file:///home/jelmer/bzr.samba/4.0-regwrite/

------------------------------------------------------------
revno: 11166
revision-id: jelmer at samba.org-20070210150222-mpmii8ak5w25btqc
parent: jelmer at samba.org-20070208171835-589fvhzi1hilvnan
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 4.0-regwrite
timestamp: Sat 2007-02-10 16:02:22 +0100
message:
  Some more work towards fixing the build.
modified:
  .bzrignore                     svn-v2:17811 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-.bzrignore
  source/lib/registry/creg.c     svn-v2:4132 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2freg_backend_w95.c
  source/lib/registry/dir.c      svn-v2:4132 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2freg_backend_dir.c
  source/lib/registry/ldb.c      svn-v2:4132 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2freg_backend_ldb.c
  source/lib/registry/rpc.c      svn-v2:4132 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2flib%2fregistry%2freg_backend_rpc.c
=== modified file '.bzrignore'
--- a/.bzrignore	2007-01-24 13:00:19 +0000
+++ b/.bzrignore	2007-02-10 15:02:22 +0000
@@ -172,3 +172,4 @@
 source/st
 source/samba.info
 source/pidl/cover_db
+source/lib/registry/apidocs

=== modified file 'source/lib/registry/creg.c'
--- a/source/lib/registry/creg.c	2007-02-08 17:18:35 +0000
+++ b/source/lib/registry/creg.c	2007-02-10 15:02:22 +0000
@@ -83,7 +83,6 @@
 	REG_ID id;
 } RGKN_KEY;
 
-
 typedef struct rgdb_block {
 	DWORD RGDB_ID;		/* RGDB */
 	DWORD size;
@@ -123,6 +122,11 @@
 	RGDB_KEY ***rgdb_keys;
 } CREG;
 
+struct creg_key_data {
+	RGKN_KEY *data;
+	CREG *hive;
+};
+
 #if 0 /* unused */
 #define RGKN_START_SIZE 0x2000
 #define RGKN_INC_SIZE   0x1000
@@ -183,16 +187,15 @@
 	}
 }
 
-WERROR reg_open_creg_file(const char *location, struct registry_key **root)
+WERROR reg_open_creg_file(TALLOC_CTX *parent_ctx, const char *location, struct registry_key **root)
 {
 	CREG *creg;
 	DWORD creg_id, rgkn_id;
 	DWORD i;
 	DWORD offset;
 
-	creg = talloc(h, CREG);
+	creg = talloc(parent_ctx, CREG);
 	memset(creg, 0, sizeof(CREG));
-	h->backend_data = creg;
 
 	if((creg->fd = open(location, O_RDONLY, 0000)) < 0) {
 		return WERR_FOOBAR;
@@ -205,7 +208,7 @@
     creg->base = mmap(0, creg->sbuf.st_size, PROT_READ, MAP_SHARED, creg->fd, 0);
                                                                                                                                               
     if (creg->base == (void *)-1) {
-		DEBUG(0,("Could not mmap file: %s, %s\n", h->location, strerror(errno)));
+		DEBUG(0,("Could not mmap file: %s, %s\n", location, strerror(errno)));
         return WERR_FOOBAR;
     }
 
@@ -213,7 +216,7 @@
 
 	if ((creg_id = IVAL(&creg->creg_hdr->CREG_ID,0)) != str_to_dword("CREG")) {
 		DEBUG(0, ("Unrecognized Windows 95 registry header id: 0x%0X, %s\n", 
-				  creg_id, h->location));
+				  creg_id, location));
 		return WERR_FOOBAR;
 	}
 
@@ -221,7 +224,7 @@
 
 	if ((rgkn_id = IVAL(&creg->rgkn_hdr->RGKN_ID,0)) != str_to_dword("RGKN")) {
 		DEBUG(0, ("Unrecognized Windows 95 registry key index id: 0x%0X, %s\n", 
-				  rgkn_id, h->location));
+				  rgkn_id, location));
 		return WERR_FOOBAR;
 	}
 
@@ -237,7 +240,7 @@
 	}
 #endif
 
-	creg->rgdb_keys = talloc_array(h, RGDB_KEY **, creg->creg_hdr->num_rgdb);
+	creg->rgdb_keys = talloc_array(parent_ctx, RGDB_KEY **, creg->creg_hdr->num_rgdb);
 
 	offset = 0;
 	DEBUG(3, ("Reading %d rgdb entries\n", creg->creg_hdr->num_rgdb));
@@ -246,14 +249,14 @@
 		
 		if(strncmp((char *)&(rgdb_hdr->RGDB_ID), "RGDB", 4)) {
 			DEBUG(0, ("unrecognized rgdb entry: %4d, %s\n", 
-					  rgdb_hdr->RGDB_ID, h->location));
+					  rgdb_hdr->RGDB_ID, location));
 			return WERR_FOOBAR;
 		} else {
 			DEBUG(3, ("Valid rgdb entry, first free id: %d, max id: %d\n", rgdb_hdr->first_free_id, rgdb_hdr->max_id));
 		}
 
 
-		creg->rgdb_keys[i] = talloc_array(h, RGDB_KEY *, rgdb_hdr->max_id+1);
+		creg->rgdb_keys[i] = talloc_array(creg, RGDB_KEY *, rgdb_hdr->max_id+1);
 		memset(creg->rgdb_keys[i], 0, sizeof(RGDB_KEY *) * (rgdb_hdr->max_id+1));
 
 		parse_rgdb_block(creg, rgdb_hdr);
@@ -262,9 +265,10 @@
 	}
 	
 	/* First element in rgkn should be root key */
-	*root = talloc(h, struct registry_key);
+	*root = talloc(parent_ctx, struct registry_key);
 	(*root)->name = NULL;
 	(*root)->backend_data = LOCN_RGKN(creg, sizeof(RGKN_HDR));
+	/* FIXME: attach creg to key */
 	
 	return WERR_OK;
 }
@@ -272,7 +276,8 @@
 static WERROR creg_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;
+	struct creg_key_data *private_data = parent->backend_data;
+	RGKN_KEY *rgkn_key = private_data->data;
 	RGKN_KEY *child;
 	DWORD child_offset;
 	DWORD cur = 0;
@@ -343,7 +348,7 @@
 	return WERR_OK;
 }
 
-static struct hive_operations reg_backend_creg = {
+static struct reg_key_operations reg_backend_creg = {
 	.name = "creg",
 	.get_value_by_index = creg_get_value_by_id,
 	.num_values = creg_num_values,

=== modified file 'source/lib/registry/dir.c'
--- a/source/lib/registry/dir.c	2007-02-08 17:18:35 +0000
+++ b/source/lib/registry/dir.c	2007-02-10 15:02:22 +0000
@@ -118,16 +118,17 @@
 	return WERR_NO_MORE_ITEMS;
 }
 
-WERROR reg_open_directory(const char *location, struct registry_key **key)
+WERROR reg_open_directory(TALLOC_CTX *parent_ctx, 
+						  const char *location, struct registry_key **key)
 {
-	if(!h->location) return WERR_INVALID_PARAM;
+	if(!location) return WERR_INVALID_PARAM;
 
 	*key = talloc(h, struct registry_key);
 	(*key)->backend_data = talloc_strdup(*key, location);
 	return WERR_OK;
 }
 
-static struct hive_operations reg_backend_dir = {
+static struct reg_key_operations reg_backend_dir = {
 	.name = "dir",
 	.open_key = reg_dir_open_key,
 	.add_key = reg_dir_add_key,

=== modified file 'source/lib/registry/ldb.c'
--- a/source/lib/registry/ldb.c	2007-02-08 17:18:35 +0000
+++ b/source/lib/registry/ldb.c	2007-02-10 15:02:22 +0000
@@ -391,7 +391,7 @@
 	return WERR_OK;
 }
 
-static struct hive_operations reg_backend_ldb = {
+static struct reg_key_operations reg_backend_ldb = {
 	.name = "ldb",
 	.add_key = ldb_add_key,
 	.del_key = ldb_del_key,

=== modified file 'source/lib/registry/rpc.c'
--- a/source/lib/registry/rpc.c	2007-02-08 17:18:35 +0000
+++ b/source/lib/registry/rpc.c	2007-02-10 15:02:22 +0000
@@ -346,7 +346,7 @@
 	return WERR_OK;
 }
 
-static struct hive_operations reg_backend_rpc = {
+static struct reg_key_operations reg_backend_rpc = {
 	.name = "rpc",
 	.open_key = rpc_open_key,
 	.get_subkey_by_index = rpc_get_subkey_by_index,



More information about the samba-cvs mailing list