r9486: ensure that the registry hash records are sorted by original subkey name and...
authorGerald Carter <jerry@samba.org>
Mon, 22 Aug 2005 19:47:56 +0000 (19:47 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:01:11 +0000 (11:01 -0500)
source/include/regfio.h
source/registry/regfio.c

index e088a4a344c596e6adc8f4740fe006fb1823b1f1..3f0c10e8954e4f3ca5e49ef29508ca8c0ca15e46 100644 (file)
@@ -80,6 +80,7 @@ typedef struct regf_hbin {
 typedef struct {
        uint32 nk_off;
        uint8 keycheck[sizeof(uint32)];
+       char *fullname;
 } REGF_HASH_REC;
 
 typedef struct {
index 486839698684fea90a19fec6d9225712be03c055..aebb1ebaed614f6e13a1ab6160331ba7871e04b9 100644 (file)
@@ -1670,7 +1670,7 @@ static BOOL create_vk_record( REGF_FILE *file, REGF_VK_REC *vk, REGISTRY_VALUE *
 
 static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
 {
-       return StrnCaseCmp( h1->keycheck, h2->keycheck, sizeof(uint32) );
+       return strcmp( h1->fullname, h2->fullname );
 }
 
 /*******************************************************************
@@ -1722,6 +1722,7 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
 
                hash->nk_off = prs_offset( &nk->hbin->ps ) + nk->hbin->first_hbin_off - HBIN_HDR_SIZE;
                memcpy( hash->keycheck, name, sizeof(uint32) );
+               hash->fullname = talloc_strdup( file->mem_ctx, name );
                parent->subkey_index++;
 
                /* sort the list by keyname */
@@ -1852,8 +1853,8 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
                                nk->max_bytes_valuename = namelen * 2;
 
                        datalen = regval_size( r );
-                       if ( datalen*2 > nk->max_bytes_value )
-                               nk->max_bytes_value = datalen * 2;
+                       if ( datalen > nk->max_bytes_value )
+                               nk->max_bytes_value = datalen;
                }
        }