From f59bebe5140f2d92a00d282dd62e8eea83873c3b Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 26 Aug 2002 21:47:41 +0000 Subject: [PATCH] Make winedump compilable by MSVC. --- tools/winedump/main.c | 4 +++- tools/winedump/misc.c | 2 +- tools/winedump/pe.c | 8 ++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/winedump/main.c b/tools/winedump/main.c index 1ec0b50149c..e0162a276aa 100644 --- a/tools/winedump/main.c +++ b/tools/winedump/main.c @@ -17,8 +17,10 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "winedump.h" +#include "config.h" + +#include "winedump.h" _globals globals; /* All global variables */ diff --git a/tools/winedump/misc.c b/tools/winedump/misc.c index 1039f4226e8..b164e57a78b 100644 --- a/tools/winedump/misc.c +++ b/tools/winedump/misc.c @@ -224,5 +224,5 @@ void fatal (const char *message) perror (message); else puts (message); - do_usage (); + exit(1); } diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c index a5832a08479..058cdeb0afd 100644 --- a/tools/winedump/pe.c +++ b/tools/winedump/pe.c @@ -42,6 +42,10 @@ #include "winedump.h" #include "pe.h" +#ifndef O_BINARY +# define O_BINARY 0 +#endif + static void* base; static unsigned long total_len; static IMAGE_NT_HEADERS* nt_headers; @@ -649,7 +653,7 @@ static const char *get_resource_type( int id ) static void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix ) { - int i, j; + unsigned int i, j; printf( "%s", prefix ); for (i = 0; i < size; i++) @@ -822,7 +826,7 @@ int pe_analysis(const char* name, void (*fn)(void), enum FileSig wanted_sig) setbuf(stdout, NULL); - fd = open(name, O_RDONLY); + fd = open(name, O_RDONLY | O_BINARY); if (fd == -1) fatal("Can't open file"); if (fstat(fd, &s) < 0) fatal("Can't get size");