Changeset 4662 for zzuf


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

Mark diverted Win32 functions as stdcall, it's the correct calling
convention.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/libzzuf/lib-win32.c

    r4661 r4662  
    3838/* Kernel functions that we divert */
    3939#if defined HAVE_CREATEFILEA
    40 static HANDLE (*ORIG(CreateFileA))(LPCTSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES,
    41                                    DWORD, DWORD, HANDLE);
     40static HANDLE (__stdcall *ORIG(CreateFileA))(LPCTSTR, DWORD, DWORD,
     41                                             LPSECURITY_ATTRIBUTES,
     42                                             DWORD, DWORD, HANDLE);
    4243#endif
    4344#if defined HAVE_CREATEFILEA
    44 static HANDLE (*ORIG(CreateFileW))(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES,
    45                                    DWORD, DWORD, HANDLE);
     45static HANDLE (__stdcall *ORIG(CreateFileW))(LPCWSTR, DWORD, DWORD,
     46                                             LPSECURITY_ATTRIBUTES,
     47                                             DWORD, DWORD, HANDLE);
    4648#endif
    4749#if defined HAVE_READFILE
    48 static BOOL (*ORIG(ReadFile))(HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED);
     50static BOOL (__stdcall *ORIG(ReadFile))(HANDLE, LPVOID, DWORD, LPDWORD,
     51                                        LPOVERLAPPED);
    4952#endif
    5053#if defined HAVE_CLOSEHANDLE
    51 static BOOL (*ORIG(CloseHandle))(HANDLE);
     54static BOOL (__stdcall *ORIG(CloseHandle))(HANDLE);
    5255#endif
    5356
     
    5760
    5861#if defined HAVE_CREATEFILEA
    59 HANDLE NEW(CreateFileA)(LPCTSTR lpFileName, DWORD dwDesiredAccess,
     62HANDLE __stdcall NEW(CreateFileA)(LPCTSTR lpFileName, DWORD dwDesiredAccess,
    6063           DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
    6164           DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
    6265           HANDLE hTemplateFile)
    6366{
    64     fprintf(stderr, "CreateFileA diverted!\n");
     67    fprintf(stderr, "CreateFileA(%s)\n", lpFileName);
    6568    return ORIG(CreateFileA)(lpFileName, dwDesiredAccess, dwShareMode,
    6669                             lpSecurityAttributes, dwCreationDisposition,
     
    7073
    7174#if defined HAVE_CREATEFILEW
    72 HANDLE NEW(CreateFileW)(LPCWSTR lpFileName, DWORD dwDesiredAccess,
     75HANDLE __stdcall NEW(CreateFileW)(LPCWSTR lpFileName, DWORD dwDesiredAccess,
    7376           DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
    7477           DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
    7578           HANDLE hTemplateFile)
    7679{
    77     fprintf(stderr, "CreateFileW diverted!\n");
     80    fprintf(stderr, "CreateFileW(?)\n");
    7881    return ORIG(CreateFileW)(lpFileName, dwDesiredAccess, dwShareMode,
    7982                             lpSecurityAttributes, dwCreationDisposition,
     
    8790
    8891#if defined HAVE_READFILE
    89 BOOL NEW(ReadFile)(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
    90                    LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
     92BOOL __stdcall NEW(ReadFile)(HANDLE hFile, LPVOID lpBuffer,
     93           DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead,
     94           LPOVERLAPPED lpOverlapped)
    9195{
    92     fprintf(stderr, "ReadFile diverted!\n");
     96    fprintf(stderr, "ReadFile(%i)\n", nNumberOfBytesToRead);
    9397    return ORIG(ReadFile)(hFile, lpBuffer, nNumberOfBytesToRead,
    9498                          lpNumberOfBytesRead, lpOverlapped);
     
    101105
    102106#if defined HAVE_CLOSEHANDLE
    103 BOOL NEW(CloseHandle)(HANDLE hObject)
     107BOOL __stdcall NEW(CloseHandle)(HANDLE hObject)
    104108{
    105     fprintf(stderr, "CloseHandle diverted!\n");
     109    fprintf(stderr, "CloseHandle(%i)\n", hObject);
    106110    return ORIG(CloseHandle)(hObject);
    107111}
Note: See TracChangeset for help on using the changeset viewer.