PGO: Statically generate data structures
[blocksruntime.git] / lib / interception / interception_win.h
blobf2727c9241d3202edd80ea46a749c475bf3a739c
1 //===-- interception_linux.h ------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file is a part of AddressSanitizer, an address sanity checker.
12 // Windows-specific interception methods.
13 //===----------------------------------------------------------------------===//
15 #ifdef _WIN32
17 #if !defined(INCLUDED_FROM_INTERCEPTION_LIB)
18 # error "interception_win.h should be included from interception library only"
19 #endif
21 #ifndef INTERCEPTION_WIN_H
22 #define INTERCEPTION_WIN_H
24 namespace __interception {
25 // returns true if a function with the given name was found.
26 bool GetRealFunctionAddress(const char *func_name, uptr *func_addr);
28 // returns true if the old function existed, false on failure.
29 bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func);
30 } // namespace __interception
32 #if defined(_DLL)
33 # define INTERCEPT_FUNCTION_WIN(func) \
34 ::__interception::GetRealFunctionAddress( \
35 #func, (::__interception::uptr*)&REAL(func))
36 #else
37 # define INTERCEPT_FUNCTION_WIN(func) \
38 ::__interception::OverrideFunction( \
39 (::__interception::uptr)func, \
40 (::__interception::uptr)WRAP(func), \
41 (::__interception::uptr*)&REAL(func))
42 #endif
44 #define INTERCEPT_FUNCTION_VER_WIN(func, symver) \
45 INTERCEPT_FUNCTION_WIN(func)
47 #endif // INTERCEPTION_WIN_H
48 #endif // _WIN32