Hi Martin,
Hi Antonio,
Martin Koeppe wrote:
> Unfortunately gddrescue is not available for Windows.
There is at least a cygwin port of ddrescue. Just search for "ddrescue
cygwin".
yes, but I prefer a native Windows build because I need it on many different
boxes and only occasionally on one particular box. And all of the boxes don't
have cygwin installed.
The Cygwin version of ddrescue does not require a Cygwin install. It
requires only cygwin1.dll is in same directory or in the PATH. I have
successfully run this ddrescue.exe also from a UBCD4Win Live CD without
a Cygwin install.
I've done a quick build of a native Windows ddrescue.exe with MinGW g++.
Required only few hacks (attached).
to build on MSYS:
$ ./configure
$ make
to build on Cygwin:
$ ./configure CXX=g++-3 CPPFLAGS=-mno-cygwin LDFLAGS=-mno-cygwin
$ make
(Or: cross-compile it on Linux :-)
But this version does not work with raw devices (e.g.
'\\.\PhysicalDrive1') because lseek(., 0, SEEK_END) fails. The
lseeki64() from MSVCRT.dll apparently cannot be used to determine the
size of a raw device.
Did you actually try your code with a raw disk or CD/DVD device? Which
MSVC version did you use?
Regards,
Christian
diff -rup ddrescue-1.12-rc1.orig/ddrescue.cc ddrescue-1.12-rc1/ddrescue.cc
--- ddrescue-1.12-rc1.orig/ddrescue.cc 2010-01-03 01:08:17.000000000 +0100
+++ ddrescue-1.12-rc1/ddrescue.cc 2010-03-02 21:09:58.634125000 +0100
@@ -320,8 +320,12 @@ void set_signals() throw()
{
interrupted = false;
signal( SIGINT, sighandler );
+#ifdef SIGHUP
signal( SIGHUP, sighandler );
+#endif
signal( SIGTERM, sighandler );
+#ifdef SIGUSR1
signal( SIGUSR1, SIG_IGN );
signal( SIGUSR2, SIG_IGN );
+#endif
}
diff -rup ddrescue-1.12-rc1.orig/ddrescue.h ddrescue-1.12-rc1/ddrescue.h
--- ddrescue-1.12-rc1.orig/ddrescue.h 2010-01-03 01:08:17.000000000 +0100
+++ ddrescue-1.12-rc1/ddrescue.h 2010-03-02 22:42:38.212250000 +0100
@@ -181,3 +181,10 @@ void internal_error( const char * msg )
void show_error( const char * msg,
const int errcode = 0, const bool help = false ) throw();
void write_logfile_header( FILE * f ) throw();
+
+#ifdef _WIN32
+#include <io.h>
+#define lseek lseek64
+inline int fsync(int) { return 0; }
+#endif
+
diff -rup ddrescue-1.12-rc1.orig/logbook.cc ddrescue-1.12-rc1/logbook.cc
--- ddrescue-1.12-rc1.orig/logbook.cc 2010-01-03 01:08:17.000000000 +0100
+++ ddrescue-1.12-rc1/logbook.cc 2010-03-02 21:12:02.056000000 +0100
@@ -217,7 +217,11 @@ Logbook::Logbook( const long long ipos,
final_msg_( 0 ), final_errno_( 0 ), index_( 0 ),
ul_t1( std::time( 0 ) )
{
+#ifdef _SC_PAGESIZE
int alignment = sysconf( _SC_PAGESIZE );
+#else
+ int alignment = 4096;
+#endif
if( alignment < hardbs_ || alignment % hardbs_ ) alignment = hardbs_;
if( alignment < 2 || alignment > 65536 ) alignment = 0;
iobuf_ = iobuf_base = new char[ softbs_ + alignment ];
_______________________________________________
Bug-ddrescue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-ddrescue