Changeset 135 for trunk/src/reglookup.c


Ignore:
Timestamp:
01/21/09 05:27:32 (15 years ago)
Author:
tim
Message:

cleaned up regfi API

started adding debugging infrastructure, but currently broken

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/reglookup.c

    r126 r135  
    11/*
    2  * A utility to read a Windows NT/2K/XP/2K3 registry file, using
    3  * Gerald Carter''s regfio interface.
     2 * A utility to read a Windows NT and later registry files.
    43 *
    5  * Copyright (C) 2005-2008 Timothy D. Morgan
     4 * Copyright (C) 2005-2009 Timothy D. Morgan
    65 * Copyright (C) 2002 Richard Sharpe, rsharpe@richardsharpe.com
    76 *
     
    4342
    4443/* Other globals */
    45 REGF_FILE* f;
     44REGFI_FILE* f;
    4645
    4746
     
    5251
    5352
    54 void printValue(const REGF_VK_REC* vk, char* prefix)
     53void printValue(const REGFI_VK_REC* vk, char* prefix)
    5554{
    5655  char* quoted_value = NULL;
     
    6665   *   http://msdn2.microsoft.com/en-us/library/ms724872.aspx
    6766   */
    68   if(size > VK_MAX_DATA_LENGTH)
     67  if(size > REGFI_VK_MAX_DATA_LENGTH)
    6968  {
    7069    fprintf(stderr, "WARNING: value data size %d larger than "
    71             "%d, truncating...\n", size, VK_MAX_DATA_LENGTH);
    72     size = VK_MAX_DATA_LENGTH;
     70            "%d, truncating...\n", size, REGFI_VK_MAX_DATA_LENGTH);
     71    size = REGFI_VK_MAX_DATA_LENGTH;
    7372  }
    7473 
     
    143142  uint32 ret_cur = 0;
    144143
    145   ret_val = (char**)malloc((REGF_MAX_DEPTH+1+1)*sizeof(char**));
     144  ret_val = (char**)malloc((REGFI_MAX_DEPTH+1+1)*sizeof(char**));
    146145  if (ret_val == NULL)
    147146    return NULL;
     
    163162      copy[next-cur] = '\0';
    164163      ret_val[ret_cur++] = copy;
    165       if(ret_cur < (REGF_MAX_DEPTH+1+1))
     164      if(ret_cur < (REGFI_MAX_DEPTH+1+1))
    166165        ret_val[ret_cur] = NULL;
    167166      else
     
    176175    copy = strdup(cur);
    177176    ret_val[ret_cur++] = copy;
    178     if(ret_cur < (REGF_MAX_DEPTH+1+1))
     177    if(ret_cur < (REGFI_MAX_DEPTH+1+1))
    179178      ret_val[ret_cur] = NULL;
    180179    else
     
    275274void printValueList(REGFI_ITERATOR* i, char* prefix)
    276275{
    277   const REGF_VK_REC* value;
     276  const REGFI_VK_REC* value;
    278277
    279278  value = regfi_iterator_first_value(i);
     
    299298  time_t tmp_time[1];
    300299  struct tm* tmp_time_s = NULL;
    301   const REGF_SK_REC* sk;
    302   const REGF_NK_REC* k = regfi_iterator_cur_key(i);
     300  const REGFI_SK_REC* sk;
     301  const REGFI_NK_REC* k = regfi_iterator_cur_key(i);
    303302
    304303  *tmp_time = nt_time_to_unix(&k->mtime);
     
    369368void printKeyTree(REGFI_ITERATOR* iter)
    370369{
    371   const REGF_NK_REC* root = NULL;
    372   const REGF_NK_REC* cur = NULL;
    373   const REGF_NK_REC* sub = NULL;
     370  const REGFI_NK_REC* root = NULL;
     371  const REGFI_NK_REC* cur = NULL;
     372  const REGFI_NK_REC* sub = NULL;
    374373  char* path = NULL;
    375374  int key_type = regfi_type_str2val("KEY");
     
    441440int retrievePath(REGFI_ITERATOR* iter, char** path)
    442441{
    443   const REGF_VK_REC* value;
     442  const REGFI_VK_REC* value;
    444443  char* tmp_path_joined;
    445444  const char** tmp_path;
     
    450449
    451450  /* One extra for any value at the end, and one more for NULL */
    452   tmp_path = (const char**)malloc(sizeof(const char**)*(REGF_MAX_DEPTH+1+1));
     451  tmp_path = (const char**)malloc(sizeof(const char**)*(REGFI_MAX_DEPTH+1+1));
    453452  if(tmp_path == NULL)
    454453    return -2;
     
    457456  for(i=0;
    458457      (path[i] != NULL) && (path[i+1] != NULL)
    459         && (i < REGF_MAX_DEPTH+1+1);
     458        && (i < REGFI_MAX_DEPTH+1+1);
    460459      i++)
    461460    tmp_path[i] = path[i];
Note: See TracChangeset for help on using the changeset viewer.