Fix the Linux build to accomodate with the new Win32 features.

This commit is contained in:
Sam Hocevar 2010-09-22 22:18:07 +00:00 committed by sam
parent 6ac571b003
commit c60b52ccb3
4 changed files with 21 additions and 5 deletions

View File

@ -14,7 +14,7 @@ LIBZZUF = \
libzzuf/sys.c libzzuf/sys.h \
libzzuf/network.c libzzuf/network.h \
libzzuf/lib-fd.c libzzuf/lib-mem.c libzzuf/lib-signal.c \
libzzuf/lib-stream.c libzzuf/lib-load.h
libzzuf/lib-stream.c libzzuf/lib-win32.c libzzuf/lib-load.h
COMMON = \
common/common.h \

View File

@ -18,7 +18,7 @@
#define STR(x) #x
#define ORIG(x) x##_orig
#ifdef HAVE_DLFCN_H
#if defined HAVE_DLFCN_H
# include <dlfcn.h>
# define NEW(x) x
# define LOADSYM(x) \
@ -34,7 +34,7 @@
if(!ORIG(x)) \
abort(); \
} while(0)
#else
#elif defined _WIN32
# define NEW(x) x##_new
# define LOADSYM(x) \
do { \
@ -56,4 +56,7 @@ zzuf_table_t;
extern zzuf_table_t table_stream[],
table_win32[];
#else
# error no function diversion system for this platform
#endif

View File

@ -1147,6 +1147,7 @@ int NEW(__uflow)(FILE *fp)
#endif
/* Win32 function table */
#if defined _WIN32
zzuf_table_t table_stream[] =
{
DIVERT(fopen),
@ -1154,3 +1155,5 @@ zzuf_table_t table_stream[] =
DIVERT(fclose),
DIVERT_END
};
#endif

View File

@ -16,12 +16,18 @@
#include "config.h"
#if defined HAVE_WINDOWS_H
# include <windows.h>
#if defined HAVE_STDINT_H
# include <stdint.h>
#elif defined HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#include <stdio.h>
#if defined HAVE_WINDOWS_H
# include <windows.h>
#endif
#include "common.h"
#include "libzzuf.h"
#include "lib-load.h"
@ -37,6 +43,7 @@ static HANDLE (*ORIG(CreateFileA))(LPCTSTR lpFileName, DWORD dwDesiredAccess,
HANDLE hTemplateFile);
#endif
#if defined HAVE_CREATEFILE
HANDLE NEW(CreateFileA)(LPCTSTR lpFileName, DWORD dwDesiredAccess,
DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
@ -47,8 +54,10 @@ HANDLE NEW(CreateFileA)(LPCTSTR lpFileName, DWORD dwDesiredAccess,
lpSecurityAttributes, dwCreationDisposition,
dwFlagsAndAttributes, hTemplateFile);
}
#endif
/* Win32 function table */
#if defined _WIN32
zzuf_table_t table_win32[] =
{
#if defined HAVE_CREATEFILE
@ -56,4 +65,5 @@ zzuf_table_t table_win32[] =
#endif
DIVERT_END
};
#endif