- Timestamp:
- 01/21/09 05:27:32 (16 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/reglookup-recover.c
r130 r135 67 67 68 68 69 void printKey(REGF _FILE* f, REGF_NK_REC* nk, const char* prefix)69 void printKey(REGFI_FILE* f, REGFI_NK_REC* nk, const char* prefix) 70 70 { 71 71 char mtime[20]; … … 102 102 103 103 104 void printValue(REGF _FILE* f, const REGF_VK_REC* vk, const char* prefix)104 void printValue(REGFI_FILE* f, const REGFI_VK_REC* vk, const char* prefix) 105 105 { 106 106 char* quoted_value = NULL; … … 122 122 * stderr/stdout don't always sync nicely. 123 123 */ 124 if(size > VK_MAX_DATA_LENGTH)124 if(size > REGFI_VK_MAX_DATA_LENGTH) 125 125 { 126 126 fprintf(stderr, "WARNING: value data size %d larger than " 127 "%d, truncating...\n", size, VK_MAX_DATA_LENGTH);128 size = VK_MAX_DATA_LENGTH;127 "%d, truncating...\n", size, REGFI_VK_MAX_DATA_LENGTH); 128 size = REGFI_VK_MAX_DATA_LENGTH; 129 129 } 130 130 … … 188 188 189 189 190 void printSK(REGF _FILE* f, REGF_SK_REC* sk)190 void printSK(REGFI_FILE* f, REGFI_SK_REC* sk) 191 191 { 192 192 char* quoted_raw = NULL; … … 226 226 227 227 228 int printCell(REGF _FILE* f, uint32 offset)228 int printCell(REGFI_FILE* f, uint32 offset) 229 229 { 230 230 char* quoted_buf; … … 254 254 * together is slow and redundant. 255 255 */ 256 char* getParentPath(REGF _FILE* f, REGF_NK_REC* nk)257 { 258 void_stack* path_stack = void_stack_new(REGF _MAX_DEPTH);259 REGF _HBIN* hbin;260 REGF _NK_REC* cur_ancestor;256 char* getParentPath(REGFI_FILE* f, REGFI_NK_REC* nk) 257 { 258 void_stack* path_stack = void_stack_new(REGFI_MAX_DEPTH); 259 REGFI_HBIN* hbin; 260 REGFI_NK_REC* cur_ancestor; 261 261 char* ret_val; 262 262 char* path_element; … … 267 267 /* The path_stack size limit should guarantee that we don't recurse forever. */ 268 268 virt_offset = nk->parent_off; 269 while(virt_offset != REGF _OFFSET_NONE)269 while(virt_offset != REGFI_OFFSET_NONE) 270 270 { 271 271 hbin = regfi_lookup_hbin(f, virt_offset); 272 272 if(hbin == NULL) 273 virt_offset = REGF _OFFSET_NONE;273 virt_offset = REGFI_OFFSET_NONE; 274 274 else 275 275 { 276 276 max_length = hbin->block_size + hbin->file_off 277 - (virt_offset+REGF _BLOCKSIZE);278 cur_ancestor = regfi_parse_nk(f, virt_offset+REGF _BLOCKSIZE,277 - (virt_offset+REGFI_REGF_SIZE); 278 cur_ancestor = regfi_parse_nk(f, virt_offset+REGFI_REGF_SIZE, 279 279 max_length, true); 280 280 if(cur_ancestor == NULL) 281 virt_offset = REGF _OFFSET_NONE;281 virt_offset = REGFI_OFFSET_NONE; 282 282 else 283 283 { 284 if((cur_ancestor->key_type == NK_TYPE_ROOTKEY1)285 || (cur_ancestor->key_type == NK_TYPE_ROOTKEY2))286 virt_offset = REGF _OFFSET_NONE;284 if((cur_ancestor->key_type == REGFI_NK_TYPE_ROOTKEY1) 285 || (cur_ancestor->key_type == REGFI_NK_TYPE_ROOTKEY2)) 286 virt_offset = REGFI_OFFSET_NONE; 287 287 else 288 288 virt_offset = cur_ancestor->parent_off; … … 415 415 416 416 /* NOTE: unalloc_keys should be an empty range_list. */ 417 int extractKeys(REGF _FILE* f,417 int extractKeys(REGFI_FILE* f, 418 418 range_list* unalloc_cells, 419 419 range_list* unalloc_keys) 420 420 { 421 421 const range_list_element* cur_elem; 422 REGF _NK_REC* key;422 REGFI_NK_REC* key; 423 423 uint32 i, j; 424 424 … … 455 455 456 456 457 int extractValueLists(REGF _FILE* f,457 int extractValueLists(REGFI_FILE* f, 458 458 range_list* unalloc_cells, 459 459 range_list* unalloc_keys) 460 460 { 461 REGF _NK_REC* nk;462 REGF _HBIN* hbin;461 REGFI_NK_REC* nk; 462 REGFI_HBIN* hbin; 463 463 const range_list_element* cur_elem; 464 464 uint32 i, j, num_keys, off, values_length, max_length; … … 472 472 nk = cur_elem->data; 473 473 474 if(nk->num_values && (nk->values_off!=REGF _OFFSET_NONE))474 if(nk->num_values && (nk->values_off!=REGFI_OFFSET_NONE)) 475 475 { 476 476 hbin = regfi_lookup_hbin(f, nk->values_off); … … 478 478 if(hbin != NULL) 479 479 { 480 off = nk->values_off + REGF _BLOCKSIZE;480 off = nk->values_off + REGFI_REGF_SIZE; 481 481 max_length = hbin->block_size + hbin->file_off - off; 482 482 /* XXX: This is a hack. We parse all value-lists, VK records, … … 546 546 if(nk->values[j]->data != NULL && !nk->values[j]->data_in_offset) 547 547 { 548 off = nk->values[j]->data_off+REGF _BLOCKSIZE;548 off = nk->values[j]->data_off+REGFI_REGF_SIZE; 549 549 if(!range_list_has_range(unalloc_cells, off, 550 550 nk->values[j]->data_size)) … … 576 576 577 577 /* NOTE: unalloc_values should be an empty range_list. */ 578 int extractValues(REGF _FILE* f,578 int extractValues(REGFI_FILE* f, 579 579 range_list* unalloc_cells, 580 580 range_list* unalloc_values) 581 581 { 582 582 const range_list_element* cur_elem; 583 REGF _VK_REC* vk;583 REGFI_VK_REC* vk; 584 584 uint32 i, j, off; 585 585 … … 616 616 { 617 617 cur_elem = range_list_get(unalloc_values, i); 618 vk = (REGF _VK_REC*)cur_elem->data;618 vk = (REGFI_VK_REC*)cur_elem->data; 619 619 if(vk == NULL) 620 620 return 40; … … 622 622 if(vk->data != NULL && !vk->data_in_offset) 623 623 { 624 off = vk->data_off+REGF _BLOCKSIZE;624 off = vk->data_off+REGFI_REGF_SIZE; 625 625 if(!range_list_has_range(unalloc_cells, off, vk->data_size)) 626 626 { /* We've parsed a data cell which isn't in the unallocated … … 643 643 644 644 /* NOTE: unalloc_sks should be an empty range_list. */ 645 int extractSKs(REGF _FILE* f,645 int extractSKs(REGFI_FILE* f, 646 646 range_list* unalloc_cells, 647 647 range_list* unalloc_sks) 648 648 { 649 649 const range_list_element* cur_elem; 650 REGF _SK_REC* sk;650 REGFI_SK_REC* sk; 651 651 uint32 i, j; 652 652 … … 684 684 int main(int argc, char** argv) 685 685 { 686 REGF _FILE* f;686 REGFI_FILE* f; 687 687 const range_list_element* cur_elem; 688 688 range_list* unalloc_cells; … … 693 693 char* tmp_name; 694 694 char* tmp_path; 695 REGF _NK_REC* tmp_key;696 REGF _VK_REC* tmp_value;695 REGFI_NK_REC* tmp_key; 696 REGFI_VK_REC* tmp_value; 697 697 uint32 argi, arge, i, j, ret, num_unalloc_keys; 698 698 /* uint32 test_offset;*/ … … 806 806 { 807 807 cur_elem = range_list_get(unalloc_keys, i); 808 tmp_key = (REGF _NK_REC*)cur_elem->data;808 tmp_key = (REGFI_NK_REC*)cur_elem->data; 809 809 810 810 if(tmp_key == NULL) … … 821 821 { 822 822 cur_elem = range_list_get(unalloc_keys, i); 823 tmp_key = (REGF _NK_REC*)cur_elem->data;823 tmp_key = (REGFI_NK_REC*)cur_elem->data; 824 824 825 825 printKey(f, tmp_key, parent_paths[i]); … … 848 848 { 849 849 cur_elem = range_list_get(unalloc_values, i); 850 tmp_value = (REGF _VK_REC*)cur_elem->data;850 tmp_value = (REGFI_VK_REC*)cur_elem->data; 851 851 852 852 printValue(f, tmp_value, ""); -
trunk/src/reglookup.c
r126 r135 1 1 /* 2 * A utility to read a Windows NT/2K/XP/2K3 registry file, using 3 * Gerald Carter''s regfio interface. 2 * A utility to read a Windows NT and later registry files. 4 3 * 5 * Copyright (C) 2005-200 8Timothy D. Morgan4 * Copyright (C) 2005-2009 Timothy D. Morgan 6 5 * Copyright (C) 2002 Richard Sharpe, rsharpe@richardsharpe.com 7 6 * … … 43 42 44 43 /* Other globals */ 45 REGF _FILE* f;44 REGFI_FILE* f; 46 45 47 46 … … 52 51 53 52 54 void printValue(const REGF _VK_REC* vk, char* prefix)53 void printValue(const REGFI_VK_REC* vk, char* prefix) 55 54 { 56 55 char* quoted_value = NULL; … … 66 65 * http://msdn2.microsoft.com/en-us/library/ms724872.aspx 67 66 */ 68 if(size > VK_MAX_DATA_LENGTH)67 if(size > REGFI_VK_MAX_DATA_LENGTH) 69 68 { 70 69 fprintf(stderr, "WARNING: value data size %d larger than " 71 "%d, truncating...\n", size, VK_MAX_DATA_LENGTH);72 size = VK_MAX_DATA_LENGTH;70 "%d, truncating...\n", size, REGFI_VK_MAX_DATA_LENGTH); 71 size = REGFI_VK_MAX_DATA_LENGTH; 73 72 } 74 73 … … 143 142 uint32 ret_cur = 0; 144 143 145 ret_val = (char**)malloc((REGF _MAX_DEPTH+1+1)*sizeof(char**));144 ret_val = (char**)malloc((REGFI_MAX_DEPTH+1+1)*sizeof(char**)); 146 145 if (ret_val == NULL) 147 146 return NULL; … … 163 162 copy[next-cur] = '\0'; 164 163 ret_val[ret_cur++] = copy; 165 if(ret_cur < (REGF _MAX_DEPTH+1+1))164 if(ret_cur < (REGFI_MAX_DEPTH+1+1)) 166 165 ret_val[ret_cur] = NULL; 167 166 else … … 176 175 copy = strdup(cur); 177 176 ret_val[ret_cur++] = copy; 178 if(ret_cur < (REGF _MAX_DEPTH+1+1))177 if(ret_cur < (REGFI_MAX_DEPTH+1+1)) 179 178 ret_val[ret_cur] = NULL; 180 179 else … … 275 274 void printValueList(REGFI_ITERATOR* i, char* prefix) 276 275 { 277 const REGF _VK_REC* value;276 const REGFI_VK_REC* value; 278 277 279 278 value = regfi_iterator_first_value(i); … … 299 298 time_t tmp_time[1]; 300 299 struct tm* tmp_time_s = NULL; 301 const REGF _SK_REC* sk;302 const REGF _NK_REC* k = regfi_iterator_cur_key(i);300 const REGFI_SK_REC* sk; 301 const REGFI_NK_REC* k = regfi_iterator_cur_key(i); 303 302 304 303 *tmp_time = nt_time_to_unix(&k->mtime); … … 369 368 void printKeyTree(REGFI_ITERATOR* iter) 370 369 { 371 const REGF _NK_REC* root = NULL;372 const REGF _NK_REC* cur = NULL;373 const REGF _NK_REC* sub = NULL;370 const REGFI_NK_REC* root = NULL; 371 const REGFI_NK_REC* cur = NULL; 372 const REGFI_NK_REC* sub = NULL; 374 373 char* path = NULL; 375 374 int key_type = regfi_type_str2val("KEY"); … … 441 440 int retrievePath(REGFI_ITERATOR* iter, char** path) 442 441 { 443 const REGF _VK_REC* value;442 const REGFI_VK_REC* value; 444 443 char* tmp_path_joined; 445 444 const char** tmp_path; … … 450 449 451 450 /* One extra for any value at the end, and one more for NULL */ 452 tmp_path = (const char**)malloc(sizeof(const char**)*(REGF _MAX_DEPTH+1+1));451 tmp_path = (const char**)malloc(sizeof(const char**)*(REGFI_MAX_DEPTH+1+1)); 453 452 if(tmp_path == NULL) 454 453 return -2; … … 457 456 for(i=0; 458 457 (path[i] != NULL) && (path[i+1] != NULL) 459 && (i < REGF _MAX_DEPTH+1+1);458 && (i < REGFI_MAX_DEPTH+1+1); 460 459 i++) 461 460 tmp_path[i] = path[i];
Note: See TracChangeset
for help on using the changeset viewer.