summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.win32.h8
-rw-r--r--src/compat.c44
-rw-r--r--src/compat.h37
-rw-r--r--src/drive.h8
-rw-r--r--src/ntfs.h6
-rw-r--r--src/ntfsx.c2
-rw-r--r--src/scrounge.c2
-rw-r--r--src/usuals.h6
-rw-r--r--win32/.cvsignore4
-rw-r--r--win32/win32.dsp16
10 files changed, 45 insertions, 88 deletions
diff --git a/config.win32.h b/config.win32.h
index 524df57..497abfb 100644
--- a/config.win32.h
+++ b/config.win32.h
@@ -10,7 +10,7 @@
/* #undef HAVE_BYTE */
/* Define to 1 if you have the `chdir' function. */
-#define HAVE_CHDIR 1
+/* #define HAVE_CHDIR 1 */
/* Define to 1 if you have the `chmod' function. */
/* #define HAVE_CHMOD 1 */
@@ -25,7 +25,7 @@
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `getcwd' function. */
-#define HAVE_GETCWD 1
+/* #define HAVE_GETCWD 1 */
/* Define to 1 if you have the `getopt' function. */
/* #define HAVE_GETOPT 1 */
@@ -52,7 +52,7 @@
/* #define HAVE_INTTYPES_H 1 */
/* Define to 1 if you have the <io.h> header file. */
-/* #undef HAVE_IO_H */
+#define HAVE_IO_H 1
/* Define to 1 if you have the `itoa' function. */
/* #undef HAVE_ITOA */
@@ -148,7 +148,7 @@
/* #define HAVE_UINT64_T 1 */
/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
+/* #define HAVE_UNISTD_H 1 */
/* Define to 1 if you have the `utimes' function. */
/* #define HAVE_UTIMES 1 */
diff --git a/src/compat.c b/src/compat.c
index 171f551..013675f 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -87,20 +87,7 @@ int getopt(int nargc, char* const* nargv, const char* ostr)
return (-1);
}
- if (place[1] && *++place == '-') #include <sys/types.h>
-
- void *malloc ();
-
- /* Allocate an N-byte block of memory from the heap.
- If N is zero, allocate a 1-byte block. */
-
- void *
- rpl_malloc (size_t n)
- {
- if (n == 0)
- n = 1;
- return malloc (n);
- }/* found "--" */
+ if (place[1] && *++place == '-') /* found "--" */
{
++optind;
place = EMSG;
@@ -151,20 +138,6 @@ int getopt(int nargc, char* const* nargv, const char* ostr)
return (optopt); /* dump back option letter */
}
#endif
- #include <sys/types.h>
-
- void *malloc ();
-
- /* Allocate an N-byte block of memory from the heap.
- If N is zero, allocate a 1-byte block. */
-
- void *
- rpl_malloc (size_t n)
- {
- if (n == 0)
- n = 1;
- return malloc (n);
- }
#ifndef HAVE_ERR_H
@@ -413,18 +386,3 @@ char* itoa(int val, char* out, int radix)
return out;
}
#endif
-
-#if HAVE_MALLOC == 0
-#undef malloc
-
-/* Allocate an N-byte block of memory from the heap.
- If N is zero, allocate a 1-byte block. */
-
-void* rpl_malloc (size_t n)
-{
- if (n == 0)
- n = 1;
- return malloc (n);
-}
-
-#endif
diff --git a/src/compat.h b/src/compat.h
index 0047991..a73637f 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -22,25 +22,25 @@
/* Force use of win32 configuration if compiling there */
#ifdef _WIN32
-#include "../config.win32.h"
+#include "config.win32.h"
#else
#ifdef HAVE_CONFIG_H
-#include "../config.h"
+#include "config.h"
#endif
#endif
#include <sys/types.h>
#ifndef MAX_PATH
- #ifdef _MAX_PATH
- #define MAX_PATH _MAX_PATH
- #else
- #define MAX_PATH 256
- #endif
+#ifdef _MAX_PATH
+#define MAX_PATH _MAX_PATH
+#else
+#define MAX_PATH 256
+#endif
#endif
#ifndef HAVE_STDARG_H
-#error ERROR: Must have a working <stdarg.h> header
+#error ERROR: Must have a working stdarg.h header
#else
#include <stdarg.h>
#endif
@@ -83,7 +83,9 @@ typedef unsigned char byte;
typedef unsigned int uint;
#endif
+#ifdef HAVE_STDINT_H
#include <stdint.h>
+#endif
#ifndef HAVE_UINT64
#ifdef HAVE_UINT64_T
@@ -174,20 +176,7 @@ void err_set_file(void *fp);
void err_set_exit(void (*ef)(int));
void err(int eval, const char *fmt, ...);
void verr(int eval, const char *fmt, va_list ap);
-void errc(int eval, int c #include <sys/types.h>
-
- void *malloc ();
-
- /* Allocate an N-byte block of memory from the heap.
- If N is zero, allocate a 1-byte block. */
-
- void *
- rpl_malloc (size_t n)
- {
- if (n == 0)
- n = 1;
- return malloc (n);
- }ode, const char *fmt, ...);
+void errc(int eval, int code, const char *fmt, ...);
void verrc(int eval, int code, const char *fmt, va_list ap);
void errx(int eval, const char *fmt, ...);
void verrx(int eval, const char *fmt, va_list ap);
@@ -200,7 +189,7 @@ void vwarnx(const char *fmt, va_list ap);
#endif
#ifndef HAVE_REALLOCF
-void* reallocf(void* ptr, size_t size);
+void* reallocf(void* p, size_t sz);
#endif
/* Some number conversion stuff */
@@ -326,7 +315,7 @@ void* reallocf(void* ptr, size_t size);
#ifdef _WIN32
#define lseek64 _lseeki64
#else
- #if ( SIZEOF_OFF_T == 8 )
+ #if SIZEOF_OFF_T == 8
#define lseek64 lseek
#else
#error ERROR: Must have a working 64 bit seek function
diff --git a/src/drive.h b/src/drive.h
index 9d8e58c..fc05567 100644
--- a/src/drive.h
+++ b/src/drive.h
@@ -23,7 +23,13 @@
#include "usuals.h"
#define kSectorSize 0x200
-#define kInvalidSector UL(0xFFFFFFFFFFFFFFFF)
+
+#ifdef _WIN32
+ #define kInvalidSector 0xFFFFFFFFFFFFFFFF
+#else
+ #define kInvalidSector 0xFFFFFFFFFFFFFFFFLL
+#endif
+
struct _ntfsx_mftmap;
struct _drivelocks;
diff --git a/src/ntfs.h b/src/ntfs.h
index 06ca6bb..f35fac0 100644
--- a/src/ntfs.h
+++ b/src/ntfs.h
@@ -60,6 +60,12 @@ ntfs_bootsector;
#define kNTFS_RecFlagUse 0x01
#define kNTFS_RecFlagDir 0x02
+#ifdef _WIN32
+ #define kNTFS_RefMask 0xFFFFFFFFFFFF
+#else
+ #define kNTFS_RefMask 0xFFFFFFFFFFFFLL
+#endif
+
typedef struct _ntfs_recordheader
{
uint32 magic; /* Magic number 'FILE' */
diff --git a/src/ntfsx.c b/src/ntfsx.c
index 4d6546b..6c4dd45 100644
--- a/src/ntfsx.c
+++ b/src/ntfsx.c
@@ -316,7 +316,7 @@ ntfsx_attribute* ntfsx_record_findattribute(ntfsx_record* record, uint32 attrTyp
if(atlr->type == attrType)
{
/* Read in appropriate cluster */
- mftRecord = ntfsx_mftmap_sectorforindex(record->info->mftmap, atlr->refAttrib & UL(0xFFFFFFFFFFFF));
+ mftRecord = ntfsx_mftmap_sectorforindex(record->info->mftmap, atlr->refAttrib & kNTFS_RefMask);
r2 = ntfsx_record_alloc(record->info);
if(!r2)
diff --git a/src/scrounge.c b/src/scrounge.c
index 075f329..4350e5e 100644
--- a/src/scrounge.c
+++ b/src/scrounge.c
@@ -109,7 +109,7 @@ void processRecordFileBasics(partitioninfo* pi, ntfsx_record* record, filebasics
/* Parent Directory */
- basics->parent = filename->refParent & UL(0xFFFFFFFFFFFF);
+ basics->parent = filename->refParent & kNTFS_RefMask;
/* Namespace */
diff --git a/src/usuals.h b/src/usuals.h
index f429d5b..01f39a0 100644
--- a/src/usuals.h
+++ b/src/usuals.h
@@ -72,10 +72,4 @@
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
-#ifdef _WIN32
- #define UL(x) x
-#else
- #define UL(x) x#LL
-#endif
-
#endif /* __USUALS_H__ */
diff --git a/win32/.cvsignore b/win32/.cvsignore
new file mode 100644
index 0000000..55017e7
--- /dev/null
+++ b/win32/.cvsignore
@@ -0,0 +1,4 @@
+win32.ncb
+win32.plg
+win32.opt
+debug \ No newline at end of file
diff --git a/win32/win32.dsp b/win32/win32.dsp
index 91efad7..cf0449f 100644
--- a/win32/win32.dsp
+++ b/win32/win32.dsp
@@ -37,12 +37,12 @@ RSC=rc.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "release"
+# PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"Release/scrounge-ntfs.exe" /opt:nowin98
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"release/scrounge-ntfs.exe" /opt:nowin98
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "win32 - Win32 Debug"
@@ -62,12 +62,12 @@ LINK32=link.exe
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
+# PROP Output_Dir "debug"
+# PROP Intermediate_Dir "debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@@ -75,7 +75,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/scrounge-ntfs.exe" /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"debug/scrounge-ntfs.exe" /pdbtype:sept
!ENDIF