Changeset 107
- Timestamp:
- 04/18/08 00:51:21 (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/regfi.h
r106 r107 71 71 #define REG_KEY 0x7FFFFFFF 72 72 73 #define REGFI_FLAG_NONE 0x0 74 #define REGFI_FLAG_SAVE_UNALLOC 0x1 73 75 74 76 #define REGF_BLOCKSIZE 0x1000 … … 322 324 char* regfi_get_group(SEC_DESC* sec_desc); 323 325 324 REGF_FILE* regfi_open(const char* filename );326 REGF_FILE* regfi_open(const char* filename, uint32 flags); 325 327 int regfi_close(REGF_FILE* r); 326 328 -
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 -
trunk/src/reglookup.c
r102 r107 899 899 bailOut(EX_OSERR, "ERROR: Memory allocation problem.\n"); 900 900 901 f = regfi_open(registry_file );901 f = regfi_open(registry_file, 0); 902 902 if(f == NULL) 903 903 {
Note: See TracChangeset
for help on using the changeset viewer.