Ignore:
Timestamp:
03/31/11 13:20:05 (13 years ago)
Author:
tim
Message:

reorganized code
added remaining methods to iterator
added test case for new methods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/pyregfi/structures.py

    r215 r220  
    224224                           ('state', c_void_p),
    225225                           ]
     226
     227
     228# Load libregfi and define function prototypes
     229regfi = ctypes.CDLL(ctypes.util.find_library('regfi'), use_errno=True)
     230
     231regfi.regfi_alloc.argtypes = [c_int, REGFI_ENCODING]
     232regfi.regfi_alloc.restype = POINTER(REGFI_FILE)
     233
     234regfi.regfi_alloc_cb.argtypes = [POINTER(REGFI_RAW_FILE), REGFI_ENCODING]
     235regfi.regfi_alloc_cb.restype = POINTER(REGFI_FILE)
     236
     237regfi.regfi_free.argtypes = [POINTER(REGFI_FILE)]
     238regfi.regfi_free.restype = None
     239
     240regfi.regfi_log_get_str.argtypes = []
     241regfi.regfi_log_get_str.restype = c_char_p
     242
     243regfi.regfi_log_set_mask.argtypes = [c_uint16]
     244regfi.regfi_log_set_mask.restype = c_bool
     245
     246regfi.regfi_get_rootkey.argtypes = [POINTER(REGFI_FILE)]
     247regfi.regfi_get_rootkey.restype = POINTER(REGFI_NK)
     248
     249regfi.regfi_free_record.argtypes = [c_void_p]
     250regfi.regfi_free_record.restype = None
     251
     252regfi.regfi_fetch_num_subkeys.argtypes = [POINTER(REGFI_NK)]
     253regfi.regfi_fetch_num_subkeys.restype = c_uint32
     254
     255regfi.regfi_fetch_num_values.argtypes = [POINTER(REGFI_NK)]
     256regfi.regfi_fetch_num_values.restype = c_uint32
     257
     258regfi.regfi_fetch_classname.argtypes = [POINTER(REGFI_FILE), POINTER(REGFI_NK)]
     259regfi.regfi_fetch_classname.restype = POINTER(REGFI_CLASSNAME)
     260
     261regfi.regfi_fetch_sk.argtypes = [POINTER(REGFI_FILE), POINTER(REGFI_NK)]
     262regfi.regfi_fetch_sk.restype = POINTER(REGFI_SK)
     263
     264regfi.regfi_fetch_data.argtypes = [POINTER(REGFI_FILE), POINTER(REGFI_VK)]
     265regfi.regfi_fetch_data.restype = POINTER(REGFI_DATA)
     266
     267regfi.regfi_find_subkey.argtypes = [POINTER(REGFI_FILE), POINTER(REGFI_NK),
     268                                    c_char_p, POINTER(c_uint32)]
     269regfi.regfi_find_subkey.restype = c_bool
     270
     271regfi.regfi_find_value.argtypes = [POINTER(REGFI_FILE), POINTER(REGFI_NK),
     272                                    c_char_p, POINTER(c_uint32)]
     273regfi.regfi_find_value.restype = c_bool
     274
     275regfi.regfi_get_subkey.argtypes = [POINTER(REGFI_FILE), POINTER(REGFI_NK),
     276                                   c_uint32]
     277regfi.regfi_get_subkey.restype = POINTER(REGFI_NK)
     278
     279regfi.regfi_get_value.argtypes = [POINTER(REGFI_FILE), POINTER(REGFI_NK),
     280                                   c_uint32]
     281regfi.regfi_get_value.restype = POINTER(REGFI_VK)
     282
     283regfi.regfi_get_parentkey.argtypes = [POINTER(REGFI_FILE), POINTER(REGFI_NK)]
     284regfi.regfi_get_parentkey.restype = POINTER(REGFI_NK)
     285
     286regfi.regfi_nt2unix_time.argtypes = [POINTER(REGFI_NTTIME)]
     287regfi.regfi_nt2unix_time.restype = c_double
     288
     289regfi.regfi_iterator_new.argtypes = [POINTER(REGFI_FILE), REGFI_ENCODING]
     290regfi.regfi_iterator_new.restype = POINTER(REGFI_ITERATOR)
     291
     292regfi.regfi_iterator_free.argtypes = [POINTER(REGFI_ITERATOR)]
     293regfi.regfi_iterator_free.restype = None
     294
     295regfi.regfi_iterator_down.argtypes = [POINTER(REGFI_ITERATOR)]
     296regfi.regfi_iterator_down.restype = c_bool
     297
     298regfi.regfi_iterator_up.argtypes = [POINTER(REGFI_ITERATOR)]
     299regfi.regfi_iterator_up.restype = c_bool
     300
     301regfi.regfi_iterator_to_root.argtypes = [POINTER(REGFI_ITERATOR)]
     302regfi.regfi_iterator_to_root.restype = c_bool
     303
     304regfi.regfi_iterator_walk_path.argtypes = [POINTER(REGFI_ITERATOR)]
     305regfi.regfi_iterator_walk_path.restype = c_bool
     306
     307regfi.regfi_iterator_cur_key.argtypes = [POINTER(REGFI_ITERATOR)]
     308regfi.regfi_iterator_cur_key.restype = POINTER(REGFI_NK)
     309
     310regfi.regfi_iterator_first_subkey.argtypes = [POINTER(REGFI_ITERATOR)]
     311regfi.regfi_iterator_first_subkey.restype = c_bool
     312
     313regfi.regfi_iterator_cur_subkey.argtypes = [POINTER(REGFI_ITERATOR)]
     314regfi.regfi_iterator_cur_subkey.restype = POINTER(REGFI_NK)
     315
     316regfi.regfi_iterator_next_subkey.argtypes = [POINTER(REGFI_ITERATOR)]
     317regfi.regfi_iterator_next_subkey.restype = c_bool
     318
     319regfi.regfi_iterator_find_subkey.argtypes = [POINTER(REGFI_ITERATOR), c_char_p]
     320regfi.regfi_iterator_find_subkey.restype = c_bool
     321
     322regfi.regfi_iterator_first_value.argtypes = [POINTER(REGFI_ITERATOR)]
     323regfi.regfi_iterator_first_value.restype = c_bool
     324
     325regfi.regfi_iterator_cur_value.argtypes = [POINTER(REGFI_ITERATOR)]
     326regfi.regfi_iterator_cur_value.restype = POINTER(REGFI_VK)
     327
     328regfi.regfi_iterator_next_value.argtypes = [POINTER(REGFI_ITERATOR)]
     329regfi.regfi_iterator_next_value.restype = c_bool
     330
     331regfi.regfi_iterator_find_value.argtypes = [POINTER(REGFI_ITERATOR), c_char_p]
     332regfi.regfi_iterator_find_value.restype = c_bool
     333
     334
     335regfi.regfi_init.argtypes = []
     336regfi.regfi_init.restype = None
     337regfi.regfi_init()
Note: See TracChangeset for help on using the changeset viewer.