source: zzuf/trunk/src/libzzuf/lib-win32.c @ 4657

Last change on this file since 4657 was 4657, checked in by Sam Hocevar, 11 years ago

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

File size: 1.8 KB
Line 
1/*
2 *  zzuf - general purpose fuzzer
3 *  Copyright (c) 2006-2010 Sam Hocevar <sam@hocevar.net>
4 *                All Rights Reserved
5 *
6 *  This program is free software. It comes without any warranty, to
7 *  the extent permitted by applicable law. You can redistribute it
8 *  and/or modify it under the terms of the Do What The Fuck You Want
9 *  To Public License, Version 2, as published by Sam Hocevar. See
10 *  http://sam.zoy.org/wtfpl/COPYING for more details.
11 */
12
13/*
14 *  load-win32.c: loaded Win32 functions
15 */
16
17#include "config.h"
18
19#if defined HAVE_STDINT_H
20#   include <stdint.h>
21#elif defined HAVE_INTTYPES_H
22#   include <inttypes.h>
23#endif
24
25#include <stdio.h>
26
27#if defined HAVE_WINDOWS_H
28#   include <windows.h>
29#endif
30
31#include "common.h"
32#include "libzzuf.h"
33#include "lib-load.h"
34#include "debug.h"
35#include "fuzz.h"
36#include "fd.h"
37
38/* Kernel functions that we divert */
39#if defined HAVE_CREATEFILE
40static HANDLE (*ORIG(CreateFileA))(LPCTSTR lpFileName, DWORD dwDesiredAccess,
41           DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
42           DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
43           HANDLE hTemplateFile);
44#endif
45
46#if defined HAVE_CREATEFILE
47HANDLE NEW(CreateFileA)(LPCTSTR lpFileName, DWORD dwDesiredAccess,
48           DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
49           DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
50           HANDLE hTemplateFile)
51{
52    fprintf(stderr, "CreateFileA diverted!\n");
53    return ORIG(CreateFileA)(lpFileName, dwDesiredAccess, dwShareMode,
54                             lpSecurityAttributes, dwCreationDisposition,
55                             dwFlagsAndAttributes, hTemplateFile);
56}
57#endif
58
59/* Win32 function table */
60#if defined _WIN32
61zzuf_table_t table_win32[] =
62{
63#if defined HAVE_CREATEFILE
64    DIVERT(CreateFileA),
65#endif
66    DIVERT_END
67};
68#endif
69
Note: See TracBrowser for help on using the repository browser.