Changeset 988 for vendor/current/source3/registry/regfio.c
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/registry/regfio.c
r746 r988 23 23 #include "../librpc/gen_ndr/ndr_security.h" 24 24 #include "../libcli/security/security_descriptor.h" 25 #include "../libcli/security/secdesc.h" 25 26 26 27 #undef DBGC_CLASS … … 45 46 static bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth) 46 47 { 47 uint32 low, high;48 uint32_t low, high; 48 49 if (nttime == NULL) 49 50 return False; … … 75 76 *******************************************************************/ 76 77 77 static int write_block( REGF_FILE *file, prs_struct *ps, uint32 offset )78 static int write_block( REGF_FILE *file, prs_struct *ps, uint32_t offset ) 78 79 { 79 80 int bytes_written, returned; 80 81 char *buffer = prs_data_p( ps ); 81 uint32 buffer_size = prs_data_size( ps );82 uint32_t buffer_size = prs_data_size( ps ); 82 83 SMB_STRUCT_STAT sbuf; 83 84 … … 113 114 *******************************************************************/ 114 115 115 static int read_block( REGF_FILE *file, prs_struct *ps, uint32 file_offset, uint32block_size )116 static int read_block( REGF_FILE *file, prs_struct *ps, uint32_t file_offset, uint32_t block_size ) 116 117 { 117 118 int bytes_read, returned; … … 199 200 200 201 if ( hbin->free_off != REGF_OFFSET_NONE ) { 201 uint32 header = 0xffffffff;202 203 if ( !prs_set_offset( &hbin->ps, hbin->free_off-sizeof(uint32 ) ) )202 uint32_t header = 0xffffffff; 203 204 if ( !prs_set_offset( &hbin->ps, hbin->free_off-sizeof(uint32_t) ) ) 204 205 return False; 205 206 if ( !prs_uint32( "free_size", &hbin->ps, 0, &hbin->free_size ) ) … … 224 225 225 226 for ( p=file->block_list; p && p!=hbin; p=p->next ) 226 ; ;227 ; 227 228 228 229 if ( p == hbin ) { … … 246 247 depth++; 247 248 248 if ( !prs_uint8s( True, "header", ps, depth, (uint8 *)file->header, sizeof( file->header )) )249 if ( !prs_uint8s( True, "header", ps, depth, (uint8_t *)file->header, sizeof( file->header )) ) 249 250 return False; 250 251 … … 303 304 static bool prs_hbin_block( const char *desc, prs_struct *ps, int depth, REGF_HBIN *hbin ) 304 305 { 305 uint32 block_size2;306 uint32_t block_size2; 306 307 307 308 prs_debug(ps, depth, desc, "prs_regf_block"); 308 309 depth++; 309 310 310 if ( !prs_uint8s( True, "header", ps, depth, (uint8 *)hbin->header, sizeof( hbin->header )) )311 if ( !prs_uint8s( True, "header", ps, depth, (uint8_t*)hbin->header, sizeof( hbin->header )) ) 311 312 return False; 312 313 … … 338 339 static bool prs_nk_rec( const char *desc, prs_struct *ps, int depth, REGF_NK_REC *nk ) 339 340 { 340 uint16 class_length, name_length;341 uint32 start;342 uint32 data_size, start_off, end_off;343 uint32 unknown_off = REGF_OFFSET_NONE;341 uint16_t class_length, name_length; 342 uint32_t start; 343 uint32_t data_size, start_off, end_off; 344 uint32_t unknown_off = REGF_OFFSET_NONE; 344 345 345 346 nk->hbin_off = prs_offset( ps ); … … 351 352 /* back up and get the data_size */ 352 353 353 if ( !prs_set_offset( ps, prs_offset(ps)-sizeof(uint32 )) )354 if ( !prs_set_offset( ps, prs_offset(ps)-sizeof(uint32_t)) ) 354 355 return False; 355 356 start_off = prs_offset( ps ); … … 357 358 return False; 358 359 359 if ( !prs_uint8s( True, "header", ps, depth, (uint8 *)nk->header, sizeof( nk->header )) )360 if ( !prs_uint8s( True, "header", ps, depth, (uint8_t *)nk->header, sizeof( nk->header )) ) 360 361 return False; 361 362 … … 418 419 } 419 420 420 if ( !prs_uint8s( True, "name", ps, depth, (uint8 *)nk->keyname, name_length) )421 if ( !prs_uint8s( True, "name", ps, depth, (uint8_t *)nk->keyname, name_length) ) 421 422 return False; 422 423 … … 442 443 *******************************************************************/ 443 444 444 static uint32 regf_block_checksum( prs_struct *ps )445 static uint32_t regf_block_checksum( prs_struct *ps ) 445 446 { 446 447 char *buffer = prs_data_p( ps ); 447 uint32 checksum, x;448 uint32_t checksum, x; 448 449 int i; 449 450 … … 466 467 { 467 468 prs_struct ps; 468 uint32 checksum;469 uint32_t checksum; 469 470 470 471 /* grab the first block from the file */ … … 496 497 { 497 498 REGF_HBIN *hbin; 498 uint32 record_size, curr_off, block_size, header;499 500 if ( !(hbin = TALLOC_ZERO_P(file->mem_ctx, REGF_HBIN)) )499 uint32_t record_size, curr_off, block_size, header; 500 501 if ( !(hbin = talloc_zero(file->mem_ctx, REGF_HBIN)) ) 501 502 return NULL; 502 503 hbin->file_off = offset; … … 521 522 /* remember that the record_size is in the 4 bytes preceeding the record itself */ 522 523 523 if ( !prs_set_offset( &hbin->ps, file->data_offset+HBIN_HDR_SIZE-sizeof(uint32 ) ) )524 return False;524 if ( !prs_set_offset( &hbin->ps, file->data_offset+HBIN_HDR_SIZE-sizeof(uint32_t) ) ) 525 return NULL; 525 526 526 527 record_size = 0; … … 545 546 546 547 if ( !prs_set_offset( &hbin->ps, curr_off) ) 547 return False;548 return NULL; 548 549 549 550 if ( !prs_uint32( "rec_size", &hbin->ps, 0, &record_size ) ) 550 return False;551 return NULL; 551 552 if ( !prs_uint32( "header", &hbin->ps, 0, &header ) ) 552 return False;553 return NULL; 553 554 554 555 SMB_ASSERT( record_size != 0 ); … … 567 568 record header */ 568 569 569 hbin->free_off = curr_off + sizeof(uint32 );570 hbin->free_off = curr_off + sizeof(uint32_t); 570 571 hbin->free_size = record_size; 571 572 } … … 574 575 575 576 if ( !prs_set_offset( &hbin->ps, file->data_offset+HBIN_HDR_SIZE ) ) 576 return False;577 return NULL; 577 578 578 579 return hbin; … … 584 585 *******************************************************************/ 585 586 586 static bool hbin_contains_offset( REGF_HBIN *hbin, uint32 offset )587 static bool hbin_contains_offset( REGF_HBIN *hbin, uint32_t offset ) 587 588 { 588 589 if ( !hbin ) … … 600 601 *******************************************************************/ 601 602 602 static REGF_HBIN* lookup_hbin_block( REGF_FILE *file, uint32 offset )603 static REGF_HBIN* lookup_hbin_block( REGF_FILE *file, uint32_t offset ) 603 604 { 604 605 REGF_HBIN *hbin = NULL; 605 uint32 block_off;606 uint32_t block_off; 606 607 607 608 /* start with the open list */ … … 659 660 int i; 660 661 REGF_LF_REC *lf = &nk->subkeys; 661 uint32 data_size, start_off, end_off;662 uint32_t data_size, start_off, end_off; 662 663 663 664 prs_debug(&hbin->ps, depth, desc, "prs_lf_records"); … … 676 677 /* backup and get the data_size */ 677 678 678 if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32 )) )679 if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32_t)) ) 679 680 return False; 680 681 start_off = prs_offset( &hbin->ps ); … … 682 683 return False; 683 684 684 if ( !prs_uint8s( True, "header", &hbin->ps, depth, (uint8 *)lf->header, sizeof( lf->header )) )685 if ( !prs_uint8s( True, "header", &hbin->ps, depth, (uint8_t *)lf->header, sizeof( lf->header )) ) 685 686 return False; 686 687 … … 722 723 { 723 724 prs_struct *ps = &hbin->ps; 724 uint16 tag = 0xFFFF;725 uint32 data_size, start_off, end_off;725 uint16_t tag = 0xFFFF; 726 uint32_t data_size, start_off, end_off; 726 727 727 728 … … 734 735 /* backup and get the data_size */ 735 736 736 if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32 )) )737 if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32_t)) ) 737 738 return False; 738 739 start_off = prs_offset( &hbin->ps ); … … 740 741 return False; 741 742 742 if ( !prs_uint8s( True, "header", ps, depth, (uint8 *)sk->header, sizeof( sk->header )) )743 if ( !prs_uint8s( True, "header", ps, depth, (uint8_t *)sk->header, sizeof( sk->header )) ) 743 744 return False; 744 745 if ( !prs_uint16( "tag", ps, depth, &tag)) … … 768 769 return False; 769 770 } else { 770 blob = data_blob_const(prs_data_p(&hbin->ps), 771 prs_data_size(&hbin->ps)); 771 blob = data_blob_const( 772 prs_data_p(&hbin->ps) + prs_offset(&hbin->ps), 773 prs_data_size(&hbin->ps) - prs_offset(&hbin->ps) 774 ); 772 775 status = unmarshall_sec_desc(mem_ctx, 773 776 blob.data, blob.length, … … 798 801 static bool hbin_prs_vk_rec( const char *desc, REGF_HBIN *hbin, int depth, REGF_VK_REC *vk, REGF_FILE *file ) 799 802 { 800 uint32 offset;801 uint16 name_length;803 uint32_t offset; 804 uint16_t name_length; 802 805 prs_struct *ps = &hbin->ps; 803 uint32 data_size, start_off, end_off;806 uint32_t data_size, start_off, end_off; 804 807 805 808 prs_debug(ps, depth, desc, "prs_vk_rec"); … … 808 811 /* backup and get the data_size */ 809 812 810 if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32 )) )813 if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32_t)) ) 811 814 return False; 812 815 start_off = prs_offset( &hbin->ps ); … … 814 817 return False; 815 818 816 if ( !prs_uint8s( True, "header", ps, depth, (uint8 *)vk->header, sizeof( vk->header )) )819 if ( !prs_uint8s( True, "header", ps, depth, (uint8_t *)vk->header, sizeof( vk->header )) ) 817 820 return False; 818 821 … … 843 846 return False; 844 847 } 845 if ( !prs_uint8s( True, "name", ps, depth, (uint8 *)vk->valuename, name_length ) )848 if ( !prs_uint8s( True, "name", ps, depth, (uint8_t *)vk->valuename, name_length ) ) 846 849 return False; 847 850 } … … 861 864 if ( !(vk->data_size & VK_DATA_IN_OFFSET) ) { 862 865 REGF_HBIN *hblock = hbin; 863 uint32 data_rec_size;866 uint32_t data_rec_size; 864 867 865 868 if ( UNMARSHALLING(&hbin->ps) ) { 866 if ( !(vk->data = PRS_ALLOC_MEM( ps, uint8 , vk->data_size) ) )869 if ( !(vk->data = PRS_ALLOC_MEM( ps, uint8_t, vk->data_size) ) ) 867 870 return False; 868 871 } … … 873 876 return False; 874 877 } 875 if ( !(prs_set_offset( &hblock->ps, (vk->data_off+HBIN_HDR_SIZE-hblock->first_hbin_off)-sizeof(uint32 ) )) )878 if ( !(prs_set_offset( &hblock->ps, (vk->data_off+HBIN_HDR_SIZE-hblock->first_hbin_off)-sizeof(uint32_t) )) ) 876 879 return False; 877 880 878 881 if ( MARSHALLING(&hblock->ps) ) { 879 data_rec_size = ( (vk->data_size+sizeof(uint32 )) & 0xfffffff8 ) + 8;882 data_rec_size = ( (vk->data_size+sizeof(uint32_t)) & 0xfffffff8 ) + 8; 880 883 data_rec_size = ( data_rec_size - 1 ) ^ 0xFFFFFFFF; 881 884 } … … 889 892 } 890 893 else { 891 if ( !(vk->data = PRS_ALLOC_MEM( ps, uint8 , 4 ) ) )894 if ( !(vk->data = PRS_ALLOC_MEM( ps, uint8_t, 4 ) ) ) 892 895 return False; 893 896 SIVAL( vk->data, 0, vk->data_off ); … … 916 919 { 917 920 int i; 918 uint32 record_size;921 uint32_t record_size; 919 922 920 923 prs_debug(&hbin->ps, depth, desc, "prs_vk_records"); … … 933 936 /* convert the offset to something relative to this HBIN block */ 934 937 935 if ( !prs_set_offset( &hbin->ps, nk->values_off+HBIN_HDR_SIZE-hbin->first_hbin_off-sizeof(uint32 )) )938 if ( !prs_set_offset( &hbin->ps, nk->values_off+HBIN_HDR_SIZE-hbin->first_hbin_off-sizeof(uint32_t)) ) 936 939 return False; 937 940 938 941 if ( MARSHALLING( &hbin->ps) ) { 939 record_size = ( ( nk->num_values * sizeof(uint32 ) ) & 0xfffffff8 ) + 8;942 record_size = ( ( nk->num_values * sizeof(uint32_t) ) & 0xfffffff8 ) + 8; 940 943 record_size = (record_size - 1) ^ 0xFFFFFFFF; 941 944 } … … 951 954 for ( i=0; i<nk->num_values; i++ ) { 952 955 REGF_HBIN *sub_hbin = hbin; 953 uint32 new_offset;956 uint32_t new_offset; 954 957 955 958 if ( !hbin_contains_offset( hbin, nk->values[i].rec_off ) ) { … … 980 983 *******************************************************************/ 981 984 982 static REGF_SK_REC* find_sk_record_by_offset( REGF_FILE *file, uint32 offset )985 static REGF_SK_REC* find_sk_record_by_offset( REGF_FILE *file, uint32_t offset ) 983 986 { 984 987 REGF_SK_REC *p_sk; … … 1067 1070 sub_hbin = lookup_hbin_block( file, nk->sk_off ); 1068 1071 if ( !sub_hbin ) { 1069 DEBUG(0,("hbin_prs_key: Failed to find HBIN block containing sk_off set [0x%x]\n",1070 nk->s ubkeys_off));1072 DEBUG(0,("hbin_prs_key: Failed to find HBIN block containing sk_off [0x%x]\n", 1073 nk->sk_off)); 1071 1074 return False; 1072 1075 } 1073 1076 } 1074 1077 1075 if ( !(nk->sec_desc = TALLOC_ZERO_P( file->mem_ctx, REGF_SK_REC )) )1078 if ( !(nk->sec_desc = talloc_zero( file->mem_ctx, REGF_SK_REC )) ) 1076 1079 return False; 1077 1080 nk->sec_desc->sk_off = nk->sk_off; … … 1093 1096 static bool next_record( REGF_HBIN *hbin, const char *hdr, bool *eob ) 1094 1097 { 1095 uint8 header[REC_HDR_SIZE];1096 uint32 record_size;1097 uint32 curr_off, block_size;1098 uint8_t header[REC_HDR_SIZE]; 1099 uint32_t record_size; 1100 uint32_t curr_off, block_size; 1098 1101 bool found = False; 1099 1102 prs_struct *ps = &hbin->ps; … … 1106 1109 and we need to backup to read the record size */ 1107 1110 1108 curr_off -= sizeof(uint32 );1111 curr_off -= sizeof(uint32_t); 1109 1112 1110 1113 block_size = prs_data_size( ps ); 1111 1114 record_size = 0; 1112 memset( header, 0x0, sizeof(uint8 )*REC_HDR_SIZE );1115 memset( header, 0x0, sizeof(uint8_t)*REC_HDR_SIZE ); 1113 1116 while ( !found ) { 1114 1117 … … 1132 1135 if ( memcmp( header, hdr, REC_HDR_SIZE ) == 0 ) { 1133 1136 found = True; 1134 curr_off += sizeof(uint32 );1137 curr_off += sizeof(uint32_t); 1135 1138 } 1136 1139 } … … 1372 1375 REGF_NK_REC *nk; 1373 1376 REGF_HBIN *hbin; 1374 uint32 offset = REGF_BLOCKSIZE;1377 uint32_t offset = REGF_BLOCKSIZE; 1375 1378 bool found = False; 1376 1379 bool eob; … … 1379 1382 return NULL; 1380 1383 1381 if ( !(nk = TALLOC_ZERO_P( file->mem_ctx, REGF_NK_REC )) ) {1384 if ( !(nk = talloc_zero( file->mem_ctx, REGF_NK_REC )) ) { 1382 1385 DEBUG(0,("regfio_rootkey: talloc() failed!\n")); 1383 1386 return NULL; … … 1427 1430 REGF_NK_REC *subkey; 1428 1431 REGF_HBIN *hbin; 1429 uint32 nk_offset;1432 uint32_t nk_offset; 1430 1433 1431 1434 /* see if there is anything left to report */ … … 1447 1450 1448 1451 nk->subkey_index++; 1449 if ( !(subkey = TALLOC_ZERO_P( file->mem_ctx, REGF_NK_REC )) )1452 if ( !(subkey = talloc_zero( file->mem_ctx, REGF_NK_REC )) ) 1450 1453 return NULL; 1451 1454 … … 1460 1463 *******************************************************************/ 1461 1464 1462 static REGF_HBIN* regf_hbin_allocate( REGF_FILE *file, uint32 block_size )1465 static REGF_HBIN* regf_hbin_allocate( REGF_FILE *file, uint32_t block_size ) 1463 1466 { 1464 1467 REGF_HBIN *hbin; 1465 1468 SMB_STRUCT_STAT sbuf; 1466 1469 1467 if ( !(hbin = TALLOC_ZERO_P( file->mem_ctx, REGF_HBIN )) )1470 if ( !(hbin = talloc_zero( file->mem_ctx, REGF_HBIN )) ) 1468 1471 return NULL; 1469 1472 … … 1479 1482 1480 1483 hbin->free_off = HBIN_HEADER_REC_SIZE; 1481 hbin->free_size = block_size - hbin->free_off + sizeof(uint32 );1484 hbin->free_size = block_size - hbin->free_off + sizeof(uint32_t); 1482 1485 1483 1486 hbin->block_size = block_size; … … 1501 1504 *******************************************************************/ 1502 1505 1503 static void update_free_space( REGF_HBIN *hbin, uint32 size_used )1506 static void update_free_space( REGF_HBIN *hbin, uint32_t size_used ) 1504 1507 { 1505 1508 hbin->free_off += size_used; … … 1516 1519 *******************************************************************/ 1517 1520 1518 static REGF_HBIN* find_free_space( REGF_FILE *file, uint32 size )1521 static REGF_HBIN* find_free_space( REGF_FILE *file, uint32_t size ) 1519 1522 { 1520 1523 REGF_HBIN *hbin, *p_hbin; 1521 uint32 block_off;1524 uint32_t block_off; 1522 1525 bool cached; 1523 1526 … … 1575 1578 1576 1579 if ( !hbin ) { 1577 uint32 alloc_size;1580 uint32_t alloc_size; 1578 1581 1579 1582 /* allocate in multiples of REGF_ALLOC_BLOCK; make sure (size + hbin_header) fits */ … … 1591 1594 /* set the offset to be ready to write */ 1592 1595 1593 if ( !prs_set_offset( &hbin->ps, hbin->free_off-sizeof(uint32 ) ) )1596 if ( !prs_set_offset( &hbin->ps, hbin->free_off-sizeof(uint32_t) ) ) 1594 1597 return NULL; 1595 1598 … … 1599 1602 1600 1603 if ( !prs_uint32("allocated_size", &hbin->ps, 0, &size) ) 1601 return False;1604 return NULL; 1602 1605 1603 1606 update_free_space( hbin, size ); … … 1609 1612 *******************************************************************/ 1610 1613 1611 static uint32 sk_record_data_size( struct security_descriptor * sd )1612 { 1613 uint32 size, size_mod8;1614 static uint32_t sk_record_data_size( struct security_descriptor * sd ) 1615 { 1616 uint32_t size, size_mod8; 1614 1617 1615 1618 size_mod8 = 0; … … 1617 1620 /* the record size is sizeof(hdr) + name + static members + data_size_field */ 1618 1621 1619 size = sizeof(uint32 )*5 + ndr_size_security_descriptor(sd, 0) + sizeof(uint32);1622 size = sizeof(uint32_t)*5 + ndr_size_security_descriptor(sd, 0) + sizeof(uint32_t); 1620 1623 1621 1624 /* multiple of 8 */ … … 1630 1633 *******************************************************************/ 1631 1634 1632 static uint32 vk_record_data_size( REGF_VK_REC *vk )1633 { 1634 uint32 size, size_mod8;1635 static uint32_t vk_record_data_size( REGF_VK_REC *vk ) 1636 { 1637 uint32_t size, size_mod8; 1635 1638 1636 1639 size_mod8 = 0; … … 1638 1641 /* the record size is sizeof(hdr) + name + static members + data_size_field */ 1639 1642 1640 size = REC_HDR_SIZE + (sizeof(uint16 )*3) + (sizeof(uint32)*3) + sizeof(uint32);1643 size = REC_HDR_SIZE + (sizeof(uint16_t)*3) + (sizeof(uint32_t)*3) + sizeof(uint32_t); 1641 1644 1642 1645 if ( vk->valuename ) … … 1654 1657 *******************************************************************/ 1655 1658 1656 static uint32 lf_record_data_size( uint32num_keys )1657 { 1658 uint32 size, size_mod8;1659 static uint32_t lf_record_data_size( uint32_t num_keys ) 1660 { 1661 uint32_t size, size_mod8; 1659 1662 1660 1663 size_mod8 = 0; 1661 1664 1662 /* the record size is sizeof(hdr) + num_keys + sizeof of hash_array + data_size_uint32 */1663 1664 size = REC_HDR_SIZE + sizeof(uint16 ) + (sizeof(REGF_HASH_REC) * num_keys) + sizeof(uint32);1665 /* the record size is sizeof(hdr) + num_keys + sizeof of hash_array + data_size_uint32_t */ 1666 1667 size = REC_HDR_SIZE + sizeof(uint16_t) + (sizeof(REGF_HASH_REC) * num_keys) + sizeof(uint32_t); 1665 1668 1666 1669 /* multiple of 8 */ … … 1675 1678 *******************************************************************/ 1676 1679 1677 static uint32 nk_record_data_size( REGF_NK_REC *nk )1678 { 1679 uint32 size, size_mod8;1680 static uint32_t nk_record_data_size( REGF_NK_REC *nk ) 1681 { 1682 uint32_t size, size_mod8; 1680 1683 1681 1684 size_mod8 = 0; 1682 1685 1683 /* the record size is static + length_of_keyname + length_of_classname + data_size_uint32 */1684 1685 size = 0x4c + strlen(nk->keyname) + sizeof(uint32 );1686 /* the record size is static + length_of_keyname + length_of_classname + data_size_uint32_t */ 1687 1688 size = 0x4c + strlen(nk->keyname) + sizeof(uint32_t); 1686 1689 1687 1690 if ( nk->classname ) … … 1717 1720 vk->type = regval_type( value ); 1718 1721 1719 if ( vk->data_size > sizeof(uint32 ) ) {1720 uint32 data_size = ( (vk->data_size+sizeof(uint32)) & 0xfffffff8 ) + 8;1721 1722 vk->data = (uint8 *)TALLOC_MEMDUP( file->mem_ctx,1722 if ( vk->data_size > sizeof(uint32_t) ) { 1723 uint32_t data_size = ( (vk->data_size+sizeof(uint32_t)) & 0xfffffff8 ) + 8; 1724 1725 vk->data = (uint8_t *)talloc_memdup( file->mem_ctx, 1723 1726 regval_data_p(value), 1724 1727 vk->data_size ); … … 1739 1742 1740 1743 if ( vk->data_size != 0 ) 1741 memcpy( &vk->data_off, regval_data_p(value), sizeof(uint32));1744 memcpy( &vk->data_off, regval_data_p(value), vk->data_size); 1742 1745 vk->data_size |= VK_DATA_IN_OFFSET; 1743 1746 } … … 1751 1754 static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 ) 1752 1755 { 1753 return StrCaseCmp( h1->fullname, h2->fullname );1756 return strcasecmp_m( h1->fullname, h2->fullname ); 1754 1757 } 1755 1758 … … 1763 1766 REGF_NK_REC *nk; 1764 1767 REGF_HBIN *vlist_hbin = NULL; 1765 uint32 size;1766 1767 if ( !(nk = TALLOC_ZERO_P( file->mem_ctx, REGF_NK_REC )) )1768 uint32_t size; 1769 1770 if ( !(nk = talloc_zero( file->mem_ctx, REGF_NK_REC )) ) 1768 1771 return NULL; 1769 1772 … … 1804 1807 1805 1808 hash->nk_off = prs_offset( &nk->hbin->ps ) + nk->hbin->first_hbin_off - HBIN_HDR_SIZE; 1806 memcpy( hash->keycheck, name, sizeof(uint32));1809 memcpy(hash->keycheck, name, MIN(strlen(name),sizeof(uint32_t))); 1807 1810 hash->fullname = talloc_strdup( file->mem_ctx, name ); 1808 1811 parent->subkey_index++; … … 1812 1815 1813 1816 if ( !hbin_prs_lf_records( "lf_rec", parent->subkeys.hbin, 0, parent ) ) 1814 return False;1817 return NULL; 1815 1818 } 1816 1819 … … 1819 1822 nk->sk_off = REGF_OFFSET_NONE; 1820 1823 if ( sec_desc ) { 1821 uint32 sk_size = sk_record_data_size( sec_desc );1824 uint32_t sk_size = sk_record_data_size( sec_desc ); 1822 1825 REGF_HBIN *sk_hbin; 1823 1826 … … 1831 1834 } 1832 1835 1833 if ( !(nk->sec_desc = TALLOC_ZERO_P( file->mem_ctx, REGF_SK_REC )) )1836 if ( !(nk->sec_desc = talloc_zero( file->mem_ctx, REGF_SK_REC )) ) 1834 1837 return NULL; 1835 1838 … … 1848 1851 /* size value must be self-inclusive */ 1849 1852 nk->sec_desc->size = ndr_size_security_descriptor(sec_desc, 0) 1850 + sizeof(uint32 );1851 1852 DLIST_ADD_END( file->sec_desc_list, nk->sec_desc , REGF_SK_REC *);1853 + sizeof(uint32_t); 1854 1855 DLIST_ADD_END( file->sec_desc_list, nk->sec_desc); 1853 1856 1854 1857 /* update the offsets for us and the previous sd in the list. … … 1883 1886 nk->subkeys_off = REGF_OFFSET_NONE; 1884 1887 if ( (nk->num_subkeys = regsubkey_ctr_numkeys( subkeys )) != 0 ) { 1885 uint32 lf_size = lf_record_data_size( nk->num_subkeys );1886 uint32 namelen;1888 uint32_t lf_size = lf_record_data_size( nk->num_subkeys ); 1889 uint32_t namelen; 1887 1890 int i; 1888 1891 … … 1898 1901 nk->subkeys.num_keys = nk->num_subkeys; 1899 1902 if (nk->subkeys.num_keys) { 1900 if ( !(nk->subkeys.hashes = TALLOC_ZERO_ARRAY( file->mem_ctx, REGF_HASH_REC, nk->subkeys.num_keys )) )1903 if ( !(nk->subkeys.hashes = talloc_zero_array( file->mem_ctx, REGF_HASH_REC, nk->subkeys.num_keys )) ) 1901 1904 return NULL; 1902 1905 } else { … … 1917 1920 nk->values_off = REGF_OFFSET_NONE; 1918 1921 if ( (nk->num_values = regval_ctr_numvals( values )) != 0 ) { 1919 uint32 vlist_size = ( ( nk->num_values * sizeof(uint32) ) & 0xfffffff8 ) + 8;1922 uint32_t vlist_size = ( ( nk->num_values * sizeof(uint32_t) ) & 0xfffffff8 ) + 8; 1920 1923 int i; 1921 1924 … … 1926 1929 1927 1930 if (nk->num_values) { 1928 if ( !(nk->values = TALLOC_ARRAY( file->mem_ctx, REGF_VK_REC, nk->num_values )) )1931 if ( !(nk->values = talloc_array( file->mem_ctx, REGF_VK_REC, nk->num_values )) ) 1929 1932 return NULL; 1930 1933 } else { … … 1935 1938 1936 1939 for ( i=0; i<nk->num_values; i++ ) { 1937 uint32 vk_size, namelen, datalen;1940 uint32_t vk_size, namelen, datalen; 1938 1941 struct regval_blob *r; 1939 1942 … … 1964 1967 prs_set_offset( &nk->hbin->ps, nk->hbin_off ); 1965 1968 if ( !prs_nk_rec( "nk_rec", &nk->hbin->ps, 0, nk ) ) 1966 return False;1969 return NULL; 1967 1970 1968 1971 if ( nk->num_values ) { 1969 1972 if ( !hbin_prs_vk_records( "vk_records", vlist_hbin, 0, nk, file ) ) 1970 return False;1973 return NULL; 1971 1974 } 1972 1975
Note:
See TracChangeset
for help on using the changeset viewer.