- Timestamp:
- 04/18/08 00:51:21 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/regfi.c
r106 r107 883 883 * first hbin offset. 884 884 *******************************************************************/ 885 REGF_FILE* regfi_open(const char* filename )885 REGF_FILE* regfi_open(const char* filename, uint32 flags) 886 886 { 887 887 REGF_FILE* rb; … … 889 889 uint32 hbin_off; 890 890 int fd; 891 int flags = O_RDONLY; 892 bool rla; 891 bool rla, save_unalloc = false; 892 893 if(flags & REGFI_FLAG_SAVE_UNALLOC) 894 save_unalloc = true; 893 895 894 896 /* open an existing file */ 895 if ((fd = open(filename, flags)) == -1)897 if ((fd = open(filename, O_RDONLY)) == -1) 896 898 { 897 899 /* DEBUG(0,("regfi_open: failure to open %s (%s)\n", filename, strerror(errno)));*/ … … 920 922 rla = true; 921 923 hbin_off = REGF_BLOCKSIZE; 922 hbin = regfi_parse_hbin(rb, hbin_off, true, false);924 hbin = regfi_parse_hbin(rb, hbin_off, true, save_unalloc); 923 925 while(hbin && rla) 924 926 { 925 927 hbin_off = hbin->file_off + hbin->block_size; 926 928 rla = range_list_add(rb->hbins, hbin->file_off, hbin->block_size, hbin); 927 hbin = regfi_parse_hbin(rb, hbin_off, true, false);929 hbin = regfi_parse_hbin(rb, hbin_off, true, save_unalloc); 928 930 } 929 931 … … 968 970 REGF_NK_REC* nk = NULL; 969 971 REGF_HBIN* hbin; 970 uint32 offset = REGF_BLOCKSIZE; 971 uint32 root_offset; 972 uint32 root_offset, i, num_hbins; 972 973 973 974 if(!file) … … 979 980 block (but I'm not assuming that for now) */ 980 981 981 while((hbin = regfi_parse_hbin(file, offset, true, false))) 982 { 982 num_hbins = range_list_size(file->hbins); 983 for(i=0; i < num_hbins; i++) 984 { 985 hbin = (REGF_HBIN*)range_list_get(file->hbins, i)->data; 983 986 if(regfi_find_root_nk(file, hbin->file_off+HBIN_HEADER_REC_SIZE, 984 987 hbin->block_size-HBIN_HEADER_REC_SIZE, &root_offset)) … … 987 990 break; 988 991 } 989 990 offset += hbin->block_size;991 992 } 992 993
Note: See TracChangeset
for help on using the changeset viewer.