diff --git a/README b/README index 241bf93..91715fc 100644 --- a/README +++ b/README @@ -1,3 +1,7 @@ +Install latest JDK +set JAVA_HOME and JDK_HOME system variable +PUT libiberty.a to C:\MunGW\lib + ******************************************************************** As of 6/27/2013 Scalpel has been released under the Apache 2.0 License @@ -71,13 +75,8 @@ int the future. COMPILE INSTRUCTIONS ON SUPPORTED PLATFORMS: -Linux/Mac OS X: -% ./bootstrap -% ./configure -% make Windows (mingw): -cd src mingw32-make -f Makefile.win diff --git a/jni/libscalpel_jni.cpp b/jni/libscalpel_jni.cpp index be3981e..147004a 100644 --- a/jni/libscalpel_jni.cpp +++ b/jni/libscalpel_jni.cpp @@ -475,7 +475,7 @@ static unsigned long long tskDataSourceTellO(ScalpelInputReader * const reader) detachThread(); - fprintf(stdout, "tskDataSourceTellO() ret %"PRIu64 "\n", joff ); + fprintf(stdout, "tskDataSourceTellO() ret %" PRIu64 "\n", joff ); return (unsigned long long) joff; } @@ -535,13 +535,13 @@ static int tskDataSourceOpen(ScalpelInputReader * const reader) { fprintf(stdout, "tskDataSourceOpen() WARNING stream already open\n"); //already open, should really close first, reset jlong zerOff = env->CallLongMethod(tskData->jInputStream, tskData->jSeekMethodId, (jlong)0); - fprintf(stdout, "tskDataSourceOpen() rewinded, new offset: %"PRI64 "\n", (long long) zerOff); + fprintf(stdout, "tskDataSourceOpen() rewinded, new offset: %" PRI64 "\n", (long long) zerOff); } else if (!tskData->firstOpen) { //closed but had already been open, so need to rewind to start //const jlong jnewOff = jlong zerOff = env->CallLongMethod(tskData->jInputStream, tskData->jSeekMethodId, (jlong)0); - fprintf(stdout, "tskDataSourceOpen() rewinded, new offset: %"PRI64 "\n", (long long) zerOff); + fprintf(stdout, "tskDataSourceOpen() rewinded, new offset: %" PRI64 "\n", (long long) zerOff); } diff --git a/libscalpel_jni.dll b/libscalpel_jni.dll new file mode 100644 index 0000000..1a47979 Binary files /dev/null and b/libscalpel_jni.dll differ diff --git a/libscalpel_jni.lib b/libscalpel_jni.lib new file mode 100644 index 0000000..82ebf16 Binary files /dev/null and b/libscalpel_jni.lib differ diff --git a/pthreads-win32/pthread.h b/pthreads-win32/pthread.h index f3d2dac..5160130 100644 --- a/pthreads-win32/pthread.h +++ b/pthreads-win32/pthread.h @@ -302,14 +302,6 @@ enum { #endif #endif -#ifndef HAVE_STRUCT_TIMESPEC -#define HAVE_STRUCT_TIMESPEC 1 -struct timespec { - long tv_sec; - long tv_nsec; -}; -#endif /* HAVE_STRUCT_TIMESPEC */ - #ifndef SIG_BLOCK #define SIG_BLOCK 0 #endif /* SIG_BLOCK */ diff --git a/src/dig.cpp b/src/dig.cpp index 53c998a..53b5d99 100644 --- a/src/dig.cpp +++ b/src/dig.cpp @@ -378,10 +378,10 @@ static int setupAuditFile(struct scalpelState *state) { if(state->skip) { - fprintf(state->auditFile, "\nSkipped the first %"PRIu64 "bytes of %s...\n", + fprintf(state->auditFile, "\nSkipped the first %" PRIu64 "bytes of %s...\n", state->skip, scalpelInputGetId(state->inReader)); if(state->modeVerbose) { - fprintf(stdout, "\nSkipped the first %"PRIu64 "bytes of %s...\n", + fprintf(stdout, "\nSkipped the first %" PRIu64 "bytes of %s...\n", state->skip, scalpelInputGetId(state->inReader)); } } @@ -448,7 +448,7 @@ digBuffer(struct scalpelState *state, unsigned long long lengthofbuf, // found a header--record location in header offsets database if(state->modeVerbose) { - fprintf(stdout, "A %s header was found at : %"PRIu64 "\n", + fprintf(stdout, "A %s header was found at : %" PRIu64 "\n", currentneedle->suffix, positionUseCoverageBlockmap(state, startLocation)); @@ -478,7 +478,7 @@ digBuffer(struct scalpelState *state, unsigned long long lengthofbuf, if(state->modeVerbose) { fprintf(stdout, - "Memory reallocation performed, total header storage = %"PRIu64 "\n", + "Memory reallocation performed, total header storage = %" PRIu64 "\n", currentneedle->offsets.headerstorage); } } @@ -494,7 +494,7 @@ digBuffer(struct scalpelState *state, unsigned long long lengthofbuf, // found a footer--record location in footer offsets database if(state->modeVerbose) { - fprintf(stdout, "A %s footer was found at : %"PRIu64 "\n", + fprintf(stdout, "A %s footer was found at : %" PRIu64 "\n", currentneedle->suffix, positionUseCoverageBlockmap(state, startLocation)); @@ -524,7 +524,7 @@ digBuffer(struct scalpelState *state, unsigned long long lengthofbuf, if(state->modeVerbose) { fprintf(stdout, - "Memory reallocation performed, total footer storage = %"PRIu64 "\n", + "Memory reallocation performed, total footer storage = %" PRIu64 "\n", currentneedle->offsets.footerstorage); } } @@ -618,7 +618,7 @@ digBuffer(struct scalpelState *state, unsigned long long lengthofbuf, // found a header--record location in header offsets database if(state->modeVerbose) { - fprintf(stdout, "A %s header was found at : %"PRIu64 "\n", + fprintf(stdout, "A %s header was found at : %" PRIu64 "\n", currentneedle->suffix, positionUseCoverageBlockmap(state, startLocation)); } @@ -647,7 +647,7 @@ digBuffer(struct scalpelState *state, unsigned long long lengthofbuf, if(state->modeVerbose) { fprintf(stdout, - "Memory reallocation performed, total header storage = %"PRIu64 "\n", + "Memory reallocation performed, total header storage = %" PRIu64 "\n", currentneedle->offsets.headerstorage); } @@ -756,7 +756,7 @@ digBuffer(struct scalpelState *state, unsigned long long lengthofbuf, startLocation = offset + (foundat[needlenum][i] - readbuffer); if(state->modeVerbose) { - fprintf(stdout, "A %s footer was found at : %"PRIu64 "\n", + fprintf(stdout, "A %s footer was found at : %" PRIu64 "\n", currentneedle->suffix, positionUseCoverageBlockmap(state, startLocation)); } @@ -784,7 +784,7 @@ digBuffer(struct scalpelState *state, unsigned long long lengthofbuf, if(state->modeVerbose) { fprintf(stdout, - "Memory reallocation performed, total footer storage = %"PRIu64 "\n", + "Memory reallocation performed, total footer storage = %" PRIu64 "\n", currentneedle->offsets.footerstorage); } } @@ -991,7 +991,7 @@ void *streaming_reader(void *sss) { state->inReader)) > longestneedle - 1) { if(state->modeVerbose) { - fprintf(stdout, "Read %"PRIu64 " bytes from image file.\n", bytesread); + fprintf(stdout, "Read %" PRIu64 " bytes from image file.\n", bytesread); } if((err = scalpelInputGetError(state->inReader))) { @@ -1106,7 +1106,7 @@ int digImageFile(struct scalpelState *state) { if(state->modeVerbose) { - fprintf(stdout, "Total file size is %"PRIu64 " bytes\n", filesize); + fprintf(stdout, "Total file size is %" PRIu64 " bytes\n", filesize); } @@ -1537,7 +1537,7 @@ int carveImageFile(struct scalpelState *state) { fprintf(stdout, "%s", currentneedle->endtext); } - fprintf(stdout, "\" --> %"PRIu64 " files\n", currentneedle->numfilestocarve); + fprintf(stdout, "\" --> %" PRIu64 " files\n", currentneedle->numfilestocarve); } @@ -1915,7 +1915,7 @@ static int (unsigned long long)(ceil((double)filesize / (double)state->coverageblocksize)); - fprintf(stdout, "# of blocks in coverage blockmap is %"PRIu64 ".\n", + fprintf(stdout, "# of blocks in coverage blockmap is %" PRIu64 ".\n", state->coveragenumblocks); @@ -1970,7 +1970,7 @@ static int (unsigned long long)ceil((double)filesize / (double)state->coverageblocksize); - fprintf(stdout, "# of blocks in coverage blockmap is %"PRIu64 ".\n", + fprintf(stdout, "# of blocks in coverage blockmap is %" PRIu64 ".\n", state->coveragenumblocks); fprintf(stdout, "Allocating and clearing in-core coverage bitmap.\n"); @@ -2374,7 +2374,7 @@ static off64_t ftello_use_coverage_map(struct scalpelState *state, ScalpelInputR if(state->modeVerbose && state->useCoverageBlockmap) { fprintf(stdout, - "Coverage map decreased current file position by %"PRIu64 " bytes.\n", + "Coverage map decreased current file position by %" PRIu64 " bytes.\n", (unsigned long long)decrease); } } @@ -2399,7 +2399,7 @@ fread_use_coverage_map(struct scalpelState *state, void *ptr, if(state->useCoverageBlockmap) { if(state->modeVerbose) { fprintf(stdout, - "Issuing coverage map-based READ, wants %"PRIu64 " bytes.\n", + "Issuing coverage map-based READ, wants %" PRIu64 " bytes.\n", neededbytes); } @@ -2425,7 +2425,7 @@ fread_use_coverage_map(struct scalpelState *state, void *ptr, if(state->modeVerbose) { fprintf(stdout, - "fread using coverage map to skip %"PRIu64 " bytes.\n", bytestoskip); + "fread using coverage map to skip %" PRIu64 " bytes.\n", bytestoskip); } scalpelInputSeeko(inReader, (off64_t) bytestoskip, SCALPEL_SEEK_CUR); @@ -2450,7 +2450,7 @@ fread_use_coverage_map(struct scalpelState *state, void *ptr, if(state->modeVerbose) { fprintf(stdout, - "fread using coverage map found %"PRIu64 " consecutive bytes.\n", + "fread using coverage map found %" PRIu64 " consecutive bytes.\n", bytestoread); } @@ -2465,7 +2465,7 @@ fread_use_coverage_map(struct scalpelState *state, void *ptr, curpos += bytestoread; if(state->modeVerbose) { - fprintf(stdout, "fread using coverage map read %"PRIu64 " bytes.\n", + fprintf(stdout, "fread using coverage map read %" PRIu64 " bytes.\n", bytesread); } } @@ -2879,7 +2879,7 @@ static int writeHeaderFooterDatabase(struct scalpelState *state) { } // # of headers - if(fprintf(dbfile, "%"PRIu64 "\n", currentneedle->offsets.numheaders) + if(fprintf(dbfile, "%" PRIu64 "\n", currentneedle->offsets.numheaders) <= 0) { fprintf(stderr, @@ -2893,7 +2893,7 @@ static int writeHeaderFooterDatabase(struct scalpelState *state) { for(i = 0; i < currentneedle->offsets.numheaders; i++) { #ifdef _WIN32 if(fprintf - (dbfile, "%"PRIu64 "\n", + (dbfile, "%" PRIu64 "\n", positionUseCoverageBlockmap(state, currentneedle->offsets. headers[i])) <= 0) { @@ -2913,7 +2913,7 @@ static int writeHeaderFooterDatabase(struct scalpelState *state) { } // # of footers - if(fprintf(dbfile, "%"PRIu64 "\n", currentneedle->offsets.numfooters) + if(fprintf(dbfile, "%" PRIu64 "\n", currentneedle->offsets.numfooters) <= 0) { fprintf(stderr, "Error writing to header/footer database file: %s\n", fn); @@ -2925,7 +2925,7 @@ static int writeHeaderFooterDatabase(struct scalpelState *state) { // all footer positions for current suffix for(i = 0; i < currentneedle->offsets.numfooters; i++) { if(fprintf - (dbfile, "%"PRIu64 "\n", + (dbfile, "%" PRIu64 "\n", positionUseCoverageBlockmap(state, currentneedle->offsets. footers[i])) <= 0) { diff --git a/src/helpers.cpp b/src/helpers.cpp index bbbeae2..0921ca4 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -528,7 +528,7 @@ int skipInFile(struct scalpelState *state, ScalpelInputReader * inReader) if((scalpelInputSeeko(inReader, state->skip, SCALPEL_SEEK_SET))) { fprintf(stderr, - "ERROR: Couldn't skip %"PRIu64 " bytes at the start of input file %s\n", + "ERROR: Couldn't skip %" PRIu64 " bytes at the start of input file %s\n", state->skip, inputId); @@ -543,7 +543,7 @@ int skipInFile(struct scalpelState *state, ScalpelInputReader * inReader) } else { - fprintf(stderr, "\nSkipped the first %"PRIu64 " bytes of %s...\n", + fprintf(stderr, "\nSkipped the first %" PRIu64 " bytes of %s...\n", state->skip, inputId); diff --git a/src/scalpel_exec.cpp b/src/scalpel_exec.cpp index 5bfc026..5598f5b 100644 --- a/src/scalpel_exec.cpp +++ b/src/scalpel_exec.cpp @@ -141,7 +141,7 @@ int main(int argc, char **argv) { } fprintf(stdout, - "\nScalpel is done, files carved = %"PRIu64 ", elapsed = %ld secs.\n", + "\nScalpel is done, files carved = %" PRIu64 ", elapsed = %ld secs.\n", state.fileswritten, (int)time(0) - starttime); destroy_threading_model(&state); @@ -348,7 +348,7 @@ void processCommandLineArgs(int argc, char **argv, struct scalpelState *state) { numopts++; state->skip = strtoull(optarg, NULL, 10); fprintf(stdout, - "Skipping the first %"PRIu64 " bytes of each image file.\n", state->skip); + "Skipping the first %" PRIu64 " bytes of each image file.\n", state->skip); break; case 'c':