Changeset 143
- Timestamp:
- 02/12/09 22:24:27 (16 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile
r141 r143 15 15 INC=-I/usr/local/include 16 16 LIB=-L/usr/local/lib -lm 17 BIN_EXT= 18 EXTRA_OBJ= 17 19 18 20 UNAME := $(shell uname) 19 21 ifneq ($(UNAME),Linux) 20 22 LIB:=$(LIB) -liconv 23 endif 24 25 ifdef BUILD_MINGW 26 CC=i586-mingw32msvc-cc 27 BIN_EXT=.exe 28 LIBICONV_PATH=/usr/local/src/libiconv-1.9.2-1-lib 29 INC:=$(INC) -I$(LIBICONV_PATH)/include 30 EXTRA_OBJ=$(LIBICONV_PATH)/lib/libiconv.dll.a 21 31 endif 22 32 -
trunk/include/regfi.h
r140 r143 58 58 #define REGFI_MSG_WARN 0x0004 59 59 #define REGFI_MSG_ERROR 0x0010 60 61 /* Windows is lame */ 62 #ifdef O_BINARY 63 #define REGFI_OPEN_FLAGS O_RDONLY|O_BINARY 64 #else 65 #define REGFI_OPEN_FLAGS O_RDONLY 66 #endif 60 67 61 68 /* Registry data types */ -
trunk/lib/regfi.c
r140 r143 510 510 ret_val = regfi_load_subkeylist_aux(file, offset, max_size, strict, 511 511 REGFI_MAX_SUBKEY_DEPTH); 512 if(ret_val == NULL) 513 { 514 regfi_add_message(file, REGFI_MSG_WARN, "Failed to load subkey list at" 515 " offset 0x%.8X.", offset); 516 return NULL; 517 } 512 518 513 519 if(num_keys != ret_val->num_keys) … … 1152 1158 1153 1159 /* open an existing file */ 1154 if ((fd = open(filename, O_RDONLY)) == -1)1155 { 1156 /* DEBUG(0,("regfi_open: failure to open %s (%s)\n", filename, strerror(errno)));*/1160 if ((fd = open(filename, REGFI_OPEN_FLAGS)) == -1) 1161 { 1162 /* fprintf(stderr, "regfi_open: failure to open %s (%s)\n", filename, strerror(errno));*/ 1157 1163 return NULL; 1158 1164 } … … 1170 1176 if ((rb = regfi_parse_regf(fd, true)) == NULL) 1171 1177 { 1172 /* DEBUG(0,("regfi_open: Failed to read initial REGF block\n"));*/1178 /* fprintf(stderr, "regfi_open: Failed to read initial REGF block\n"); */ 1173 1179 close(fd); 1174 1180 return NULL; … … 1179 1185 if(rb->hbins == NULL) 1180 1186 { 1187 /* fprintf(stderr, "regfi_open: Failed to create HBIN list.\n"); */ 1181 1188 range_list_free(rb->hbins); 1182 1189 close(fd); … … 1331 1338 * caching and make things slow. 1332 1339 */ 1333 ret_val->sk_recs = lru_cache_create(127, 0x15DEAD05^time(NULL) 1334 ^(getpid()<<16)^(getppid()<<8), 1340 ret_val->sk_recs = lru_cache_create(127, 0x15DEAD05^time(NULL)^(getpid()<<16), 1335 1341 true); 1336 1342 -
trunk/src/Makefile
r110 r143 3 3 ################################################################################ 4 4 5 REGLOOKUP=$(BUILD_BIN)/reglookup 6 REGLOOKUP_RECOVER=$(BUILD_BIN)/reglookup-recover 5 REGLOOKUP=$(BUILD_BIN)/reglookup$(BIN_EXT) 6 REGLOOKUP_RECOVER=$(BUILD_BIN)/reglookup-recover$(BIN_EXT) 7 7 OBJ=$(wildcard ../lib/*.o) 8 8 FILES=$(REGLOOKUP) $(REGLOOKUP_RECOVER) … … 11 11 12 12 $(REGLOOKUP): reglookup.o $(OBJ) 13 $(CC) $(CFLAGS) $(OPTS) $(LIB) -o $@ reglookup.o $(OBJ) 13 $(CC) $(CFLAGS) $(OPTS) $(LIB) -o $@ reglookup.o $(OBJ) $(EXTRA_OBJ) 14 14 15 15 $(REGLOOKUP_RECOVER): reglookup-recover.o $(OBJ) 16 $(CC) $(CFLAGS) $(OPTS) $(LIB) -o $@ reglookup-recover.o $(OBJ) 16 $(CC) $(CFLAGS) $(OPTS) $(LIB) -o $@ reglookup-recover.o $(OBJ) $(EXTRA_OBJ) 17 17 18 18 reglookup.o: reglookup.c -
trunk/src/common.c
r138 r143 31 31 #define REGLOOKUP_VERSION "0.10.0" 32 32 33 #define REGLOOKUP_EXIT_OK 0 34 #define REGLOOKUP_EXIT_OSERR 71 35 #define REGLOOKUP_EXIT_USAGE 64 36 #define REGLOOKUP_EXIT_DATAERR 65 37 #define REGLOOKUP_EXIT_NOINPUT 66 38 33 39 34 40 void bailOut(int code, char* message) -
trunk/src/reglookup-recover.c
r138 r143 22 22 #include <stdio.h> 23 23 #include <stdlib.h> 24 #include <sysexits.h>25 24 26 25 #include "../include/regfi.h" … … 84 83 quoted_name = malloc(1*sizeof(char)); 85 84 if(quoted_name == NULL) 86 bailOut( EX_OSERR, "ERROR: Could not allocate sufficient memory.\n");85 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Could not allocate sufficient memory.\n"); 87 86 quoted_name[0] = '\0'; 88 87 … … 140 139 quoted_name = malloc(1*sizeof(char)); 141 140 if(quoted_name == NULL) 142 bailOut( EX_OSERR, "ERROR: Could not allocate sufficient memory.\n");141 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Could not allocate sufficient memory.\n"); 143 142 quoted_name[0] = '\0'; 144 143 } … … 149 148 quoted_value = malloc(1*sizeof(char)); 150 149 if(quoted_value == NULL) 151 bailOut( EX_OSERR, "ERROR: Could not allocate sufficient memory.\n");150 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Could not allocate sufficient memory.\n"); 152 151 quoted_value[0] = '\0'; 153 152 … … 714 713 { 715 714 usage(); 716 bailOut( EX_USAGE, "ERROR: Requires at least one argument.\n");715 bailOut(REGLOOKUP_EXIT_USAGE, "ERROR: Requires at least one argument.\n"); 717 716 } 718 717 … … 738 737 usage(); 739 738 fprintf(stderr, "ERROR: Unrecognized option: %s\n", argv[argi]); 740 bailOut( EX_USAGE, "");739 bailOut(REGLOOKUP_EXIT_USAGE, ""); 741 740 } 742 741 } … … 744 743 745 744 if((registry_file = strdup(argv[argi])) == NULL) 746 bailOut( EX_OSERR, "ERROR: Memory allocation problem.\n");745 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Memory allocation problem.\n"); 747 746 748 747 f = regfi_open(registry_file); … … 750 749 { 751 750 fprintf(stderr, "ERROR: Couldn't open registry file: %s\n", registry_file); 752 bailOut( EX_NOINPUT, "");751 bailOut(REGLOOKUP_EXIT_NOINPUT, ""); 753 752 } 754 753 if(print_verbose) -
trunk/src/reglookup.c
r141 r143 23 23 24 24 #include <stdlib.h> 25 #include <sysexits.h>26 25 #include <stdio.h> 27 26 #include <string.h> … … 82 81 quoted_name = malloc(1*sizeof(char)); 83 82 if(quoted_name == NULL) 84 bailOut( EX_OSERR, "ERROR: Could not allocate sufficient memory.\n");83 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Could not allocate sufficient memory.\n"); 85 84 quoted_name[0] = '\0'; 86 85 } … … 161 160 copy = (char*)malloc((next-cur+1)*sizeof(char)); 162 161 if(copy == NULL) 163 bailOut( EX_OSERR, "ERROR: Memory allocation problem.\n");162 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Memory allocation problem.\n"); 164 163 165 164 memcpy(copy, cur, next-cur); … … 169 168 ret_val[ret_cur] = NULL; 170 169 else 171 bailOut( EX_DATAERR, "ERROR: Registry maximum depth exceeded.\n");170 bailOut(REGLOOKUP_EXIT_DATAERR, "ERROR: Registry maximum depth exceeded.\n"); 172 171 } 173 172 cur = next+1; … … 182 181 ret_val[ret_cur] = NULL; 183 182 else 184 bailOut( EX_DATAERR, "ERROR: Registry maximum depth exceeded.\n");183 bailOut(REGLOOKUP_EXIT_DATAERR, "ERROR: Registry maximum depth exceeded.\n"); 185 184 } 186 185 … … 384 383 385 384 if(root == NULL) 386 bailOut( EX_DATAERR, "ERROR: root cannot be NULL.\n");385 bailOut(REGLOOKUP_EXIT_DATAERR, "ERROR: root cannot be NULL.\n"); 387 386 388 387 do … … 392 391 path = iter2Path(iter); 393 392 if(path == NULL) 394 bailOut( EX_OSERR, "ERROR: Could not construct iterator's path.\n");393 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Could not construct iterator's path.\n"); 395 394 396 395 if(!type_filter_enabled || (key_type == type_filter)) … … 410 409 { 411 410 printMsgs(iter->f); 412 bailOut( EX_DATAERR, "ERROR: could not traverse iterator upward.\n");411 bailOut(REGLOOKUP_EXIT_DATAERR, "ERROR: could not traverse iterator upward.\n"); 413 412 } 414 413 … … 417 416 { 418 417 printMsgs(iter->f); 419 bailOut( EX_DATAERR, "ERROR: unexpected NULL for key.\n");418 bailOut(REGLOOKUP_EXIT_DATAERR, "ERROR: unexpected NULL for key.\n"); 420 419 } 421 420 … … 431 430 { 432 431 printMsgs(iter->f); 433 bailOut( EX_DATAERR, "ERROR: could not traverse iterator downward.\n");432 bailOut(REGLOOKUP_EXIT_DATAERR, "ERROR: could not traverse iterator downward.\n"); 434 433 } 435 434 … … 507 506 508 507 if((value == NULL) || (tmp_path_joined == NULL)) 509 bailOut( EX_OSERR, "ERROR: Unexpected error before printValue.\n");508 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Unexpected error before printValue.\n"); 510 509 511 510 if(!type_filter_enabled || (value->type == type_filter)) … … 525 524 { 526 525 printMsgs(iter->f); 527 bailOut( EX_DATAERR, "ERROR: Unexpected error on traversing path filter key.\n");526 bailOut(REGLOOKUP_EXIT_DATAERR, "ERROR: Unexpected error on traversing path filter key.\n"); 528 527 } 529 528 … … 568 567 { 569 568 usage(); 570 bailOut( EX_USAGE, "ERROR: Requires at least one argument.\n");569 bailOut(REGLOOKUP_EXIT_USAGE, "ERROR: Requires at least one argument.\n"); 571 570 } 572 571 … … 579 578 { 580 579 usage(); 581 bailOut( EX_USAGE, "ERROR: '-p' option requires parameter.\n");580 bailOut(REGLOOKUP_EXIT_USAGE, "ERROR: '-p' option requires parameter.\n"); 582 581 } 583 582 if((path_filter = strdup(argv[argi])) == NULL) 584 bailOut( EX_OSERR, "ERROR: Memory allocation problem.\n");583 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Memory allocation problem.\n"); 585 584 586 585 path_filter_enabled = true; … … 591 590 { 592 591 usage(); 593 bailOut( EX_USAGE, "ERROR: '-t' option requires parameter.\n");592 bailOut(REGLOOKUP_EXIT_USAGE, "ERROR: '-t' option requires parameter.\n"); 594 593 } 595 594 if((type_filter = regfi_type_str2val(argv[argi])) < 0) 596 595 { 597 596 fprintf(stderr, "ERROR: Invalid type specified: %s.\n", argv[argi]); 598 bailOut( EX_USAGE, "");597 bailOut(REGLOOKUP_EXIT_USAGE, ""); 599 598 } 600 599 type_filter_enabled = true; … … 614 613 usage(); 615 614 fprintf(stderr, "ERROR: Unrecognized option: %s\n", argv[argi]); 616 bailOut( EX_USAGE, "");615 bailOut(REGLOOKUP_EXIT_USAGE, ""); 617 616 } 618 617 } 619 618 if((registry_file = strdup(argv[argi])) == NULL) 620 bailOut( EX_OSERR, "ERROR: Memory allocation problem.\n");619 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Memory allocation problem.\n"); 621 620 622 621 f = regfi_open(registry_file); … … 624 623 { 625 624 fprintf(stderr, "ERROR: Couldn't open registry file: %s\n", registry_file); 626 bailOut( EX_NOINPUT, "");625 bailOut(REGLOOKUP_EXIT_NOINPUT, ""); 627 626 } 628 627 … … 632 631 iter = regfi_iterator_new(f); 633 632 if(iter == NULL) 634 bailOut( EX_OSERR, "ERROR: Couldn't create registry iterator.\n");633 bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Couldn't create registry iterator.\n"); 635 634 636 635 if(print_header) … … 659 658 fprintf(stderr, "ERROR: retrievePath() returned %d.\n", 660 659 retr_path_ret); 661 bailOut(EX_DATAERR,"ERROR: Unknown error occurred in retrieving path.\n"); 660 bailOut(REGLOOKUP_EXIT_DATAERR, 661 "ERROR: Unknown error occurred in retrieving path.\n"); 662 662 } 663 663 }
Note: See TracChangeset
for help on using the changeset viewer.