Ignore:
Timestamp:
12/06/09 15:09:01 (14 years ago)
Author:
tim
Message:

began rearranging data parsing. Moved charater set conversion and basic parsing logic into regfi

File:
1 edited

Legend:

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

    r157 r159  
    111111  char* conv_error = NULL;
    112112  const char* str_type = NULL;
    113   uint32 size = vk->data_size;
    114 
    115   /* Microsoft's documentation indicates that "available memory" is
    116    * the limit on value sizes.  Annoying.  We limit it to 1M which
    117    * should rarely be exceeded, unless the file is corrupt or
    118    * malicious. For more info, see:
    119    *   http://msdn2.microsoft.com/en-us/library/ms724872.aspx
    120    */
    121   /* XXX: Should probably do something different here for this tool.
    122    *      Also, It would be really nice if this message somehow included the
    123    *      name of the current value we're having trouble with, since
    124    *      stderr/stdout don't always sync nicely.
    125    */
    126   if(size > REGFI_VK_MAX_DATA_LENGTH)
    127   {
    128     fprintf(stderr, "WARN: value data size %d larger than "
    129             "%d, truncating...\n", size, REGFI_VK_MAX_DATA_LENGTH);
    130     size = REGFI_VK_MAX_DATA_LENGTH;
    131   }
    132  
     113
    133114  quoted_name = quote_string(vk->valuename, key_special_chars);
    134115  if (quoted_name == NULL)
     
    144125    quoted_name[0] = '\0';
    145126  }
    146 
    147   quoted_value = data_to_ascii(vk->data, size, vk->type, &conv_error);
     127  /* XXX: Add command line option to choose output encoding */
     128  if(vk->data != NULL
     129     && !regfi_interpret_data(f, "US-ASCII//TRANSLIT", vk->type, vk->data))
     130  {
     131    fprintf(stderr, "WARN: Error occurred while interpreting data for VK record"
     132            " at offset 0x%.8X.\n", vk->offset);
     133  }
     134  printMsgs(f);
     135
     136  quoted_value = data_to_ascii(vk->data, &conv_error);
    148137  if(quoted_value == NULL)
    149138  {
     
    469458    return 10;
    470459
     460  data.buf = NULL;
     461  data.len = 0;
    471462  for(i=0; i<range_list_size(unalloc_values); i++)
    472463  {
     
    571562          }
    572563        }
    573 
    574         vk->data = data.buf;
    575         vk->data_size = data.len;
     564        /* XXX: Need to come up with a different way to link these so the
     565         *      vk->data item can be removed from the structure.
     566         */
     567        vk->data = regfi_buffer_to_data(data);
     568        talloc_steal(vk, vk->data);
    576569      }
    577570    }
Note: See TracChangeset for help on using the changeset viewer.