Changeset 198 for trunk/python2/regfi


Ignore:
Timestamp:
05/31/10 15:20:34 (14 years ago)
Author:
tim
Message:

misc tweaks to run under python2.5-dbg

Location:
trunk/python2/regfi
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/python2/regfi/class.c

    r196 r198  
    3333// allocated therefore:
    3434
    35 inline void Object_init(Object this) {
     35void Object_init(Object this) {
    3636  this->__class__ = &__Object;
    3737  this->__super__ = NULL;
    38 };
     38}
    3939
    4040struct Object_t __Object = {
     
    5656      return 0;
    5757  };
    58 };
     58}
    5959
    6060void unimplemented(Object self) {
    6161  printf("%s contains unimplemented functions.. is it an abstract class?\n", NAMEOF(self));
    6262  abort();
    63 };
     63}
  • trunk/python2/regfi/error.c

    r196 r198  
    2222void error_dest(void *slot) {
    2323  if(slot) talloc_free(slot);
    24 };
     24}
    2525
    2626void *raise_errors(enum _error_type t, char *reason, ...) {
     
    4242
    4343  return NULL;
    44 };
     44}
    4545
    4646static int error_subsystem_initialised=0;
     
    7070
    7171  return type;
    72 };
     72}
    7373
    7474/** Initialise the error subsystem */
     
    8282    abort();
    8383  };
    84 };
     84}
  • trunk/python2/regfi/pyregfi.h

    r196 r198  
    1919struct ValueIterator_t;
    2020
    21 BIND_STRUCT(REGFI_NK_REC);
    22 BIND_STRUCT(REGFI_VK_REC);
    23 BIND_STRUCT(REGFI_DATA);
     21BIND_STRUCT(REGFI_NK_REC)
     22BIND_STRUCT(REGFI_VK_REC)
     23BIND_STRUCT(REGFI_DATA)
    2424
    2525/** This is the base class for data objects */
    2626CLASS(RawData, Object)
    27     REGFI_DATA *data;
    28     REGFI_VK_REC *rec;
     27    const REGFI_DATA *data;
     28    const REGFI_VK_REC *rec;
    2929
    30     RawData METHOD(RawData, Con, REGFI_DATA *data,REGFI_VK_REC *record);
     30    RawData METHOD(RawData, Con, REGFI_DATA *data, REGFI_VK_REC *record);
    3131
    3232    /** Return the raw buffer as a string. By default we only return
  • trunk/python2/regfi/regfi.c

    r196 r198  
    1818
    1919  return 0;
    20 };
     20}
    2121
    2222static RegistryFile RegistryFile_Con(RegistryFile self, char *filename) {
     
    2525    RaiseError(EIOError, "Unable to open %s", filename);
    2626    goto error;
    27   };
     27  }
    2828
    2929  self->reg = regfi_alloc(self->fd);
    3030
    3131  if(!self->reg) {
    32     RaiseError(ERuntimeError, "REGFI Error: %s", regfi_log_get_str());
    33     goto error;
    34   };
     32    /*RaiseError(ERuntimeError, "REGFI Error: %s", regfi_log_get_str());*/
     33    /*char* e = regfi_log_get_str();*/
     34    /*fprintf(stderr, "%p\n", e);*/
     35    goto error;
     36  }
    3537
    3638  talloc_set_destructor((void *)self, RegistryFile_dest);
     
    4042  talloc_free(self);
    4143  return NULL;
    42 };
     44}
    4345
    4446static KeyIterator RegistryFile_get_key(RegistryFile self, char **path, REGFI_ENCODING encoding) {
    4547  return CONSTRUCT(KeyIterator, KeyIterator, Con, NULL, self, path, encoding);
    46 };
     48}
    4749
    4850
     
    5860  if(this->next_item) {
    5961    regfi_free_record(this->next_item);
    60   };
    61 
    62   return 0;
    63 };
     62  }
     63
     64  return 0;
     65}
    6466
    6567static KeyIterator KeyIterator_Con(KeyIterator self, RegistryFile file, char **path,
     
    7072    RaiseError(ERuntimeError, "Error: %s", regfi_log_get_str());
    7173    goto error;
    72   };
     74  }
    7375
    7476  talloc_set_destructor((void*)self, KeyIterator_dest);
     
    7981      RaiseError(ERuntimeError, "Unable to walk down key path");
    8082      goto error;
    81     };
    82   };
     83    }
     84  }
    8385
    8486  // Get the first key in the list
     
    8890 error:
    8991  return NULL;
    90 };
     92}
    9193
    9294static void KeyIterator__iter__(KeyIterator self) {
     
    9698
    9799  self->next_item = regfi_iterator_first_subkey(self->iter);
    98 };
    99 
    100 static REGFI_NK_REC *KeyIterator_next(KeyIterator self) {
    101   const REGFI_NK_REC * result;
     100}
     101
     102static const REGFI_NK_REC* KeyIterator_next(KeyIterator self) {
     103  const REGFI_NK_REC* result;
    102104
    103105  if(!self->next_item) return NULL;
     
    108110
    109111  return result;
    110 };
     112}
    111113
    112114static ValueIterator KeyIterator_list_values(KeyIterator self) {
    113115  return CONSTRUCT(ValueIterator, ValueIterator, Con, NULL, self);
    114 };
     116}
    115117
    116118VIRTUAL(KeyIterator, Object) {
     
    127129
    128130  return 0;
    129 };
     131}
    130132
    131133static ValueIterator ValueIterator_Con(ValueIterator self, KeyIterator key) {
     
    139141
    140142  return self;
    141 };
     143}
    142144
    143145static void ValueIterator__iter__(ValueIterator self) {
     
    145147
    146148  self->next_item = regfi_iterator_first_value(self->iter);
    147 };
     149}
    148150
    149151static RawData ValueIterator_iternext(ValueIterator self) {
    150152  RawData result;
    151   REGFI_DATA *data;
    152   REGFI_VK_REC *rec = (REGFI_VK_REC *)self->next_item;
     153  const REGFI_DATA *data;
     154  const REGFI_VK_REC *rec = self->next_item;
    153155
    154156  if(!rec) return NULL;
     
    158160    RaiseError(ERuntimeError, "Unable to fetch data: %s", regfi_log_get_str());
    159161    goto error;
    160   };
     162  }
    161163
    162164  switch(self->next_item->type) {
     
    174176    result = (RawData)CONSTRUCT(RawData, RawData, Con, NULL, data, rec);
    175177    break;
    176   };
     178  }
    177179
    178180
     
    188190  talloc_free(self);
    189191  return NULL;
    190 };
     192}
    191193
    192194VIRTUAL(ValueIterator, Object) {
     
    208210
    209211  return 0;
    210 };
     212}
    211213
    212214static RawData RawData_Con(RawData self, REGFI_DATA *data, REGFI_VK_REC *record) {
     
    217219
    218220  return self;
    219 };
     221}
    220222
    221223static int RawData_get_value(RawData self, char *buff, int len) {
     
    225227
    226228  return available_to_read;
    227 };
     229}
    228230
    229231VIRTUAL(RawData, Object) {
     
    232234} END_VIRTUAL
    233235
    234 static char *DataString_get_value(DataString self) {
     236static char* DataString_get_value(DataString self) {
    235237  RawData this = (RawData)self;
    236238
    237   return this->data->interpreted.string;
    238 };
     239  return (char*)this->data->interpreted.string;
     240}
    239241
    240242VIRTUAL(DataString, RawData) {
     
    246248
    247249  return this->data->interpreted.dword;
    248 };
     250}
    249251
    250252VIRTUAL(DWORDData, RawData) {
     
    255257  INIT_CLASS(RegistryFile);
    256258
    257 };
     259}
Note: See TracChangeset for help on using the changeset viewer.