Author: jerry
Date: 2005-08-22 19:47:56 +0000 (Mon, 22 Aug 2005)
New Revision: 9486

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9486

Log:
ensure that the registry hash records are sorted by original subkey name and 
not the 4 character hash key
Modified:
   branches/SAMBA_3_0/source/include/regfio.h
   branches/SAMBA_3_0/source/registry/regfio.c
   trunk/source/include/regfio.h
   trunk/source/registry/regfio.c


Changeset:
Modified: branches/SAMBA_3_0/source/include/regfio.h
===================================================================
--- branches/SAMBA_3_0/source/include/regfio.h  2005-08-22 19:43:47 UTC (rev 
9485)
+++ branches/SAMBA_3_0/source/include/regfio.h  2005-08-22 19:47:56 UTC (rev 
9486)
@@ -80,6 +80,7 @@
 typedef struct {
        uint32 nk_off;
        uint8 keycheck[sizeof(uint32)];
+       char *fullname;
 } REGF_HASH_REC;
 
 typedef struct {

Modified: branches/SAMBA_3_0/source/registry/regfio.c
===================================================================
--- branches/SAMBA_3_0/source/registry/regfio.c 2005-08-22 19:43:47 UTC (rev 
9485)
+++ branches/SAMBA_3_0/source/registry/regfio.c 2005-08-22 19:47:56 UTC (rev 
9486)
@@ -1670,7 +1670,7 @@
 
 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 @@
 
                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 @@
                                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;
                }
        }
 

Modified: trunk/source/include/regfio.h
===================================================================
--- trunk/source/include/regfio.h       2005-08-22 19:43:47 UTC (rev 9485)
+++ trunk/source/include/regfio.h       2005-08-22 19:47:56 UTC (rev 9486)
@@ -80,6 +80,7 @@
 typedef struct {
        uint32 nk_off;
        uint8 keycheck[sizeof(uint32)];
+       char *fullname;
 } REGF_HASH_REC;
 
 typedef struct {

Modified: trunk/source/registry/regfio.c
===================================================================
--- trunk/source/registry/regfio.c      2005-08-22 19:43:47 UTC (rev 9485)
+++ trunk/source/registry/regfio.c      2005-08-22 19:47:56 UTC (rev 9486)
@@ -1670,7 +1670,7 @@
 
 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 @@
 
                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 */

Reply via email to