X-Git-Url: http://git.samba.org/samba.git/?a=blobdiff_plain;f=source3%2Fregistry%2Fregfio.c;h=954f4ae7bd0b6916984c3e783a429ef1d1f07bb4;hb=54abd2aa66069e6baf7769c496f46d9dba18db39;hp=aebb1ebaed614f6e13a1ab6160331ba7871e04b9;hpb=030bba20f1270eabb52eba5f95d85cc25f82e224;p=ira%2Fwip.git diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c index aebb1ebaed6..954f4ae7bd0 100644 --- a/source3/registry/regfio.c +++ b/source3/registry/regfio.c @@ -85,7 +85,7 @@ static int read_block( REGF_FILE *file, prs_struct *ps, uint32 file_offset, uint if ( (size_t)file_offset >= sbuf.st_size ) return -1; - /* if block_size == 0, we are parsnig HBIN records and need + /* if block_size == 0, we are parsing HBIN records and need to read some of the header to get the block_size from there */ if ( block_size == 0 ) { @@ -533,7 +533,7 @@ static REGF_HBIN* read_hbin_block( REGF_FILE *file, off_t offset ) } /******************************************************************* - Input a randon offset and receive the correpsonding HBIN + Input a random offset and receive the corresponding HBIN block for it *******************************************************************/ @@ -549,7 +549,7 @@ static BOOL hbin_contains_offset( REGF_HBIN *hbin, uint32 offset ) } /******************************************************************* - Input a randon offset and receive the correpsonding HBIN + Input a random offset and receive the corresponding HBIN block for it *******************************************************************/ @@ -561,7 +561,7 @@ static REGF_HBIN* lookup_hbin_block( REGF_FILE *file, uint32 offset ) /* start with the open list */ for ( hbin=file->block_list; hbin; hbin=hbin->next ) { - DEBUG(10,("lookup_hbin_block: address = 0x%x [0x%x]\n", hbin->file_off, (uint32)hbin )); + DEBUG(10,("lookup_hbin_block: address = 0x%x [0x%lx]\n", hbin->file_off, (unsigned long)hbin )); if ( hbin_contains_offset( hbin, offset ) ) return hbin; } @@ -1030,7 +1030,7 @@ static BOOL next_record( REGF_HBIN *hbin, const char *hdr, BOOL *eob ) if ( curr_off == 0 ) prs_set_offset( ps, HBIN_HEADER_REC_SIZE ); - /* assume that the current offset is at the reacord header + /* assume that the current offset is at the record header and we need to backup to read the record size */ curr_off -= sizeof(uint32); @@ -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 strcmp( h1->fullname, h2->fullname ); + return StrCaseCmp( h1->fullname, h2->fullname ); } /******************************************************************* @@ -1768,22 +1768,28 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 ) DLIST_ADD_END( file->sec_desc_list, nk->sec_desc, tmp ); - /* initialize offsets */ - - nk->sec_desc->prev_sk_off = nk->sec_desc->sk_off; - nk->sec_desc->next_sk_off = nk->sec_desc->sk_off; - - /* now update the offsets for us and the previous sd in the list */ + /* update the offsets for us and the previous sd in the list. + if this is the first record, then just set the next and prev + offsets to ourself. */ if ( nk->sec_desc->prev ) { REGF_SK_REC *prev = nk->sec_desc->prev; nk->sec_desc->prev_sk_off = prev->hbin_off + prev->hbin->first_hbin_off - HBIN_HDR_SIZE; - prev->next_sk_off = nk->sk_off; + prev->next_sk_off = nk->sec_desc->sk_off; + + /* the end must loop around to the front */ + nk->sec_desc->next_sk_off = file->sec_desc_list->sk_off; + + /* and first must loop around to the tail */ + file->sec_desc_list->prev_sk_off = nk->sec_desc->sk_off; + } else { + nk->sec_desc->prev_sk_off = nk->sec_desc->sk_off; + nk->sec_desc->next_sk_off = nk->sec_desc->sk_off; } } - /* dump the reference count */ + /* bump the reference count +1 */ nk->sk_off = nk->sec_desc->sk_off; nk->sec_desc->ref_count++;