Changeset 256 for trunk


Ignore:
Timestamp:
06/15/11 18:05:37 (13 years ago)
Author:
tim
Message:

switched to %XX encoding in command line tool output

fixed limitation with NULL/None/(default) value name lookups

corrected an nttime bug

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/regfi.c

    r255 r256  
    11901190    ? REGFI_ENCODING_ASCII : REGFI_ENCODING_UTF16LE;
    11911191
     1192  if(vk->name_length == 0)
     1193    return;
     1194
    11921195  if(from_encoding == output_encoding)
    11931196  {
     
    12801283  REGFI_ENCODING from_encoding = (nk->flags & REGFI_NK_FLAG_ASCIINAME)
    12811284    ? REGFI_ENCODING_ASCII : REGFI_ENCODING_UTF16LE;
    1282  
     1285
     1286  if(nk->name_length == 0)
     1287    return; 
     1288
    12831289  if(from_encoding == output_encoding)
    12841290  {
     
    23452351  bool found = false;
    23462352
    2347   /* XXX: cur->name can be NULL in the registry.
    2348    *      Should we allow for a way to search for that?
     2353  /* XXX: should we allow "(default)" subkey names?
     2354   *      Do realistically they exist?
    23492355   */
    23502356  if(name == NULL)
     
    23572363      return false;
    23582364
    2359     if((cur->name != NULL)
    2360       && (strcasecmp(cur->name, name) == 0))
     2365    /* A NULL name signifies the "(default)" value for a key */
     2366    if(cur->name != NULL && (strcasecmp(cur->name, name) == 0))
    23612367    {
    23622368      found = true;
     
    23822388  bool found = false;
    23832389
    2384   /* XXX: cur->name can be NULL in the registry. 
    2385    *      Should we allow for a way to search for that?
    2386    */
    2387   if(name == NULL)
    2388     return false;
    2389 
    23902390  for(i=0; (i < num_values) && (found == false); i++)
    23912391  {
     
    23942394      return false;
    23952395
    2396     if((cur->name != NULL)
    2397        && (strcasecmp(cur->name, name) == 0))
     2396    /* A NULL name signifies the "(default)" value for a key */
     2397    if(((name == NULL) && (cur->name == NULL))
     2398       || ((name != NULL) && (cur->name != NULL)
     2399           && (strcasecmp(cur->name, name) == 0)))
    23982400    {
    23992401      found = true;
  • trunk/pyregfi-distutils.py

    r212 r256  
    22
    33from distutils.core import setup
    4 setup(name='pyregfi', version='0.1', package_dir={'':'python'}, packages=['pyregfi'])
     4setup(name='pyregfi', version='1.0', package_dir={'':'python'}, packages=['pyregfi'])
  • trunk/python/pyregfi/__init__.py

    r255 r256  
    509509       
    510510        elif name == "modified":
    511             ret_val = regfi.regfi_nt2unix_time(byref(self._base.contents.mtime))
     511            ret_val = regfi.regfi_nt2unix_time(self._base.contents.mtime)
    512512
    513513        else:
     
    764764
    765765        elif name == "modified":
    766             return regfi.regfi_nt2unix_time(byref(self._base.contents.mtime))
     766            return regfi.regfi_nt2unix_time(self._base.contents.mtime)
    767767
    768768        return getattr(self.file.contents, name)
  • trunk/python/pyregfi/structures.py

    r255 r256  
    279279
    280280regfi.regfi_find_value.argtypes = [POINTER(REGFI_FILE), POINTER(REGFI_NK),
    281                                     c_char_p, POINTER(c_uint32)]
     281                                   c_char_p, POINTER(c_uint32)]
    282282regfi.regfi_find_value.restype = c_bool
    283283
     
    287287
    288288regfi.regfi_get_value.argtypes = [POINTER(REGFI_FILE), POINTER(REGFI_NK),
    289                                    c_uint32]
     289                                  c_uint32]
    290290regfi.regfi_get_value.restype = POINTER(REGFI_VK)
    291291
  • trunk/src/common.c

    r251 r256  
    2525iconv_t conv_desc;
    2626
    27 const char* key_special_chars = ",\"\\/";
    28 const char* subfield_special_chars = ",\"\\|";
    29 const char* common_special_chars = ",\"\\";
     27const char* key_special_chars = ",\"/";
     28const char* subfield_special_chars = ",\"|";
     29const char* common_special_chars = ",\"";
    3030
    3131#define REGLOOKUP_EXIT_OK       0
     
    7070/* Returns a newly malloc()ed string which contains original buffer,
    7171 * except for non-printable or special characters are quoted in hex
    72  * with the syntax '\xQQ' where QQ is the hex ascii value of the quoted
     72 * with the syntax '%QQ' where QQ is the hex ascii value of the quoted
    7373 * character.  A null terminator is added, since only ascii, not binary,
    7474 * is returned.
     
    119119    }
    120120   
    121     if(str[i] < 32 || str[i] > 126 || strchr(special, str[i]) != NULL)
     121    if(str[i] < 32 || str[i] > 126
     122       || str[i] == '%' || strchr(special, str[i]) != NULL)
    122123    {
    123124      num_written += snprintf(ret_val + num_written, buf_len - num_written,
    124                               "\\x%.2X", str[i]);
     125                              "%%%.2X", str[i]);
    125126    }
    126127    else
     
    135136/* Returns a newly malloc()ed string which contains original string,
    136137 * except for non-printable or special characters are quoted in hex
    137  * with the syntax '\xQQ' where QQ is the hex ascii value of the quoted
     138 * with the syntax '%QQ' where QQ is the hex ascii value of the quoted
    138139 * character.
    139140 */
Note: See TracChangeset for help on using the changeset viewer.