blob: a3f0f2b0c0bc20913c517cbf12411be29e858728 [file] [log] [blame]
Timur Iskhodzhanov07bb9f12012-02-22 13:59:49 +00001//===-- interception_linux.cc -----------------------------------*- 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.
11//
12// Windows-specific interception methods.
13//===----------------------------------------------------------------------===//
14
15#ifdef _WIN32
16
17#include <windows.h>
18
19namespace __interception {
20
21bool GetRealFunctionAddress(const char *func_name, void **func_addr) {
22 const char *DLLS[] = {
23 "msvcr80.dll",
24 "msvcr90.dll",
25 "kernel32.dll",
26 NULL
27 };
28 *func_addr = NULL;
29 for (size_t i = 0; *func_addr == NULL && DLLS[i]; ++i) {
30 *func_addr = GetProcAddress(GetModuleHandleA(DLLS[i]), func_name);
31 }
32 return (*func_addr != NULL);
33}
34} // namespace __interception
35
36#endif // _WIN32