Changeset 4661 for zzuf


Ignore:
Timestamp:
Sep 23, 2010, 1:38:36 AM (9 years ago)
Author:
Sam Hocevar
Message:

Divert ReadFile?() and CloseHandle?().

Location:
zzuf/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/configure.ac

    r4658 r4661  
    5555AC_CHECK_FUNCS(__open64 __lseek64 __fopen64 __freopen64 __ftello64 __fseeko64 __fsetpos64)
    5656AC_CHECK_FUNCS(__fgets_chk __fgets_unlocked_chk __fread_chk __fread_unlocked_chk __read_chk __recv_chk __recvfrom_chk)
    57 AC_CHECK_FUNCS(CreateFileA CreateFileW)
     57AC_CHECK_FUNCS(CreateFileA CreateFileW ReadFile CloseHandle)
    5858
    5959AC_CHECK_TYPES(sighandler_t, [], [],
  • zzuf/trunk/msvc/config.h

    r4659 r4661  
    2525/* #undef HAVE_ARPA_INET_H */
    2626#define HAVE_BIND 1
     27#define HAVE_CLOSEHANDLE 1
    2728#define HAVE_CONNECT 1
    2829#define HAVE_CREATEFILEA 1
     
    7374/* #undef HAVE_PREAD */
    7475#define HAVE_PROCESS_H 1
     76#define HAVE_READFILE 1
    7577/* #undef HAVE_READV */
    7678#define HAVE_RECV 1
  • zzuf/trunk/src/libzzuf/lib-win32.c

    r4658 r4661  
    4141                                   DWORD, DWORD, HANDLE);
    4242#endif
    43 
    4443#if defined HAVE_CREATEFILEA
    4544static HANDLE (*ORIG(CreateFileW))(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES,
    4645                                   DWORD, DWORD, HANDLE);
    4746#endif
     47#if defined HAVE_READFILE
     48static BOOL (*ORIG(ReadFile))(HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED);
     49#endif
     50#if defined HAVE_CLOSEHANDLE
     51static BOOL (*ORIG(CloseHandle))(HANDLE);
     52#endif
     53
     54/*
     55 * CreateFileA, CreateFileW
     56 */
    4857
    4958#if defined HAVE_CREATEFILEA
     
    7382#endif
    7483
     84/*
     85 * ReadFile
     86 */
     87
     88#if defined HAVE_READFILE
     89BOOL NEW(ReadFile)(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
     90                   LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
     91{
     92    fprintf(stderr, "ReadFile diverted!\n");
     93    return ORIG(ReadFile)(hFile, lpBuffer, nNumberOfBytesToRead,
     94                          lpNumberOfBytesRead, lpOverlapped);
     95}
     96#endif
     97
     98/*
     99 * CloseHandle
     100 */
     101
     102#if defined HAVE_CLOSEHANDLE
     103BOOL NEW(CloseHandle)(HANDLE hObject)
     104{
     105    fprintf(stderr, "CloseHandle diverted!\n");
     106    return ORIG(CloseHandle)(hObject);
     107}
     108#endif
     109
    75110/* Win32 function table */
    76111#if defined _WIN32
    77112zzuf_table_t table_win32[] =
    78113{
     114#if defined HAVE_CLOSEHANDLE
     115    DIVERT(CloseHandle),
     116#endif
    79117#if defined HAVE_CREATEFILEA
    80118    DIVERT(CreateFileA),
     
    83121    DIVERT(CreateFileW),
    84122#endif
     123#if defined HAVE_READFILE
     124    DIVERT(ReadFile),
     125#endif
    85126    DIVERT_END
    86127};
Note: See TracChangeset for help on using the changeset viewer.