Changeset 215 for trunk/lib


Ignore:
Timestamp:
03/27/11 21:46:11 (14 years ago)
Author:
tim
Message:

improvements to smoketest script, additional test case
added a function to get a key's parent in both regfi and pyregfi
bug fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/regfi.c

    r213 r215  
    16701670 * rest of the file if that fails.
    16711671 ******************************************************************************/
    1672 REGFI_NK* regfi_rootkey(REGFI_FILE* file)
     1672const REGFI_NK* regfi_get_rootkey(REGFI_FILE* file)
    16731673{
    16741674  REGFI_NK* nk = NULL;
     
    16951695   */
    16961696 
    1697   if(!regfi_read_lock(file, &file->hbins_lock, "regfi_rootkey"))
     1697  if(!regfi_read_lock(file, &file->hbins_lock, "regfi_get_rootkey"))
    16981698    return NULL;
    16991699
     
    17051705  }
    17061706
    1707   if(!regfi_rw_unlock(file, &file->hbins_lock, "regfi_rootkey"))
     1707  if(!regfi_rw_unlock(file, &file->hbins_lock, "regfi_get_rootkey"))
    17081708    return NULL;
    17091709
     
    17271727{
    17281728  uint32_t num_in_list = 0;
     1729  if(key == NULL)
     1730    return 0;
     1731
    17291732  if(key->subkeys != NULL)
    17301733    num_in_list = key->subkeys->num_keys;
     
    17471750{
    17481751  uint32_t num_in_list = 0;
     1752  if(key == NULL)
     1753    return 0;
     1754
    17491755  if(key->values != NULL)
    17501756    num_in_list = key->values->num_values;
     
    17731779    return NULL;
    17741780
    1775   root = regfi_rootkey(file);
     1781  root = (REGFI_NK*)regfi_get_rootkey(file);
    17761782  if(root == NULL)
    17771783  {
     
    19061912
    19071913  if(path[x] == NULL)
     1914  {
    19081915    return true;
    1909  
     1916  }
     1917
    19101918  /* XXX: is this the right number of times? */
    19111919  for(; x > 0; x--)
     
    22122220
    22132221
    2214 
    22152222/******************************************************************************
    22162223 *****************************************************************************/
     
    22272234  return NULL; 
    22282235}
     2236
     2237
     2238
     2239/******************************************************************************
     2240 *****************************************************************************/
     2241const REGFI_NK* regfi_get_parentkey(REGFI_FILE* file, const REGFI_NK* key)
     2242{
     2243  if(key != NULL && key->parent_off != REGFI_OFFSET_NONE)
     2244  {
     2245    /*    fprintf(stderr, "key->parent_off=%.8X\n", key->parent_off);*/
     2246    return regfi_load_key(file,
     2247                          key->parent_off+REGFI_REGF_SIZE,
     2248                          file->string_encoding, true);
     2249  }
     2250 
     2251  return NULL;
     2252}
     2253
    22292254
    22302255
Note: See TracChangeset for help on using the changeset viewer.