Changeset 170 for trunk/src/reglookup.c


Ignore:
Timestamp:
03/05/10 23:40:25 (14 years ago)
Author:
tim
Message:

merged Tobias Mueller's patch with some changes
updated version number

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/reglookup.c

    r168 r170  
    22 * A utility to read a Windows NT and later registry files.
    33 *
    4  * Copyright (C) 2005-2009 Timothy D. Morgan
     4 * Copyright (C) 2005-2010 Timothy D. Morgan
     5 * Copyright (C) 2010 Tobias Mueller (portions of '-i' code)
    56 * Copyright (C) 2002 Richard Sharpe, rsharpe@richardsharpe.com
    67 *
     
    3132
    3233/* Globals, influenced by command line parameters */
     34bool print_value_mtime = false;
    3335bool print_verbose = false;
    3436bool print_security = false;
     
    5759  char* conv_error = NULL;
    5860  const char* str_type = NULL;
     61  char mtime[20];
     62  time_t tmp_time[1];
     63  struct tm* tmp_time_s = NULL;
    5964
    6065  if(vk->valuename == NULL)
     
    97102  }
    98103
     104  if(print_value_mtime)
     105  {
     106    *tmp_time = regfi_nt2unix_time(&iter->cur_key->mtime);
     107    tmp_time_s = gmtime(tmp_time);
     108    strftime(mtime, sizeof(mtime), "%Y-%m-%d %H:%M:%S", tmp_time_s);
     109  }
     110  else
     111    mtime[0] = '\0';
     112
    99113  str_type = regfi_type_val2str(vk->type);
    100114  if(print_security)
    101115  {
    102116    if(str_type == NULL)
    103       printf("%s/%s,0x%.8X,%s,,,,,\n", prefix, quoted_name,
    104              vk->type, quoted_value);
    105     else
    106       printf("%s/%s,%s,%s,,,,,\n", prefix, quoted_name,
    107              str_type, quoted_value);
     117      printf("%s/%s,0x%.8X,%s,%s,,,,\n", prefix, quoted_name,
     118             vk->type, quoted_value, mtime);
     119    else
     120      printf("%s/%s,%s,%s,%s,,,,\n", prefix, quoted_name,
     121             str_type, quoted_value, mtime);
    108122  }
    109123  else
    110124  {
    111125    if(str_type == NULL)
    112       printf("%s/%s,0x%.8X,%s,\n", prefix, quoted_name,
    113              vk->type, quoted_value);
    114     else
    115       printf("%s/%s,%s,%s,\n", prefix, quoted_name,
    116              str_type, quoted_value);
     126      printf("%s/%s,0x%.8X,%s,%s\n", prefix, quoted_name,
     127             vk->type, quoted_value, mtime);
     128    else
     129      printf("%s/%s,%s,%s,%s\n", prefix, quoted_name,
     130             str_type, quoted_value, mtime);
    117131  }
    118132
     
    548562  fprintf(stderr, "\t-p\t restrict output to elements below this path.\n");
    549563  fprintf(stderr, "\t-t\t restrict results to this specific data type.\n");
     564  fprintf(stderr, "\t-i\t includes parent key modification times with child values.\n");
    550565  fprintf(stderr, "\n");
    551566}
     
    605620    else if (strcmp("-v", argv[argi]) == 0)
    606621      print_verbose = true;
     622    else if (strcmp("-i", argv[argi]) == 0)
     623      print_value_mtime = true;
    607624    else
    608625    {
Note: See TracChangeset for help on using the changeset viewer.