Changeset 151 for trunk/src


Ignore:
Timestamp:
03/04/09 16:14:09 (16 years ago)
Author:
tim
Message:

parsed more items from regf header structure

improved feedback from regfi_parse_data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/reglookup-recover.c

    r150 r151  
    263263  uint32 virt_offset, i, stack_size, ret_val_size, ret_val_used;
    264264  uint32 max_length;
    265   /* A little hack so we don't have to walk a quoted string twice. */
    266   struct name_holder
    267   {
    268     char* quoted_name;
    269     uint32_t length;
    270   };
    271   struct name_holder* path_element;
    272 
     265  REGFI_BUFFER* path_element;
    273266 
    274267  /* The path_stack size limit should guarantee that we don't recurse forever. */
     
    298291          virt_offset = cur_ancestor->parent_off;
    299292       
    300         path_element = talloc(path_stack, struct name_holder);
     293        path_element = talloc(path_stack, REGFI_BUFFER);
    301294        if(path_element != NULL)
    302           path_element->quoted_name = quote_string(cur_ancestor->keyname,
     295          path_element->buf = (uint8*)quote_string(cur_ancestor->keyname,
    303296                                                   key_special_chars);
    304297         
    305         if(path_element == NULL || path_element->quoted_name == NULL
     298        if(path_element == NULL || path_element->buf == NULL
    306299           || !void_stack_push(path_stack, path_element))
    307300        {
     
    316309         * 16 bits and the max depth is 512.
    317310         */
    318         path_element->length = strlen(path_element->quoted_name);
    319         ret_val_size += path_element->length + 1;
     311        path_element->len = strlen((char*)path_element->buf);
     312        ret_val_size += path_element->len + 1;
    320313
    321314        regfi_free_key(cur_ancestor);
     
    338331    path_element = void_stack_pop(path_stack);
    339332    snprintf(ret_val+ret_val_used, ret_val_size-ret_val_used,
    340              "/%s", path_element->quoted_name);
    341     ret_val_used += path_element->length + 1;
    342     free(path_element->quoted_name);
     333             "/%s", path_element->buf);
     334    ret_val_used += path_element->len + 1;
     335    free(path_element->buf);
    343336    talloc_free(path_element);
    344337  }
     
    471464  REGFI_VK_REC* vk;
    472465  const REGFI_HBIN* hbin;
     466  REGFI_BUFFER data;
    473467  uint32 i, off, data_offset, data_maxsize;
    474468
     
    488482      if(vk->data_in_offset)
    489483      {
    490         vk->data = regfi_parse_data(f, vk->type, vk->data_off,
    491                                     vk->data_size, 4,
    492                                     vk->data_in_offset, false);
     484        data = regfi_parse_data(f, vk->type, vk->data_off,
     485                                vk->data_size, 4,
     486                                vk->data_in_offset, false);
     487        vk->data = data.buf;
     488        vk->data_size = data.len;
    493489      }
    494490      else if(range_list_has_range(unalloc_cells, off, vk->data_size))
     
    499495          data_offset = vk->data_off+REGFI_REGF_SIZE;
    500496          data_maxsize = hbin->block_size + hbin->file_off - data_offset;
    501           vk->data = regfi_parse_data(f, vk->type, data_offset,
    502                                       vk->data_size, data_maxsize,
    503                                       vk->data_in_offset, false);
     497          data = regfi_parse_data(f, vk->type, data_offset,
     498                                  vk->data_size, data_maxsize,
     499                                  vk->data_in_offset, false);
     500          vk->data = data.buf;
     501          vk->data_size = data.len;
     502
    504503          if(vk->data != NULL)
    505504          {
     
    509508             *      wrong.  Need a feedback mechanism to be more fuzzy with
    510509             *      data cell lengths and the ranges removed.
     510             *
     511             *      The introduction of REGFI_BUFFER in regfi_parse_data has
     512             *      fixed some of this.  Should review again with respect to
     513             *      the other issues mentioned above though.
    511514             */
    512515            /* A data record was recovered. Remove from unalloc_cells. */
Note: See TracChangeset for help on using the changeset viewer.