1 : // Copyright 2014 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Implementations of the Asan system interceptors. These are simple
16 : // pass-throughs to the original functions for the purpose of Asan
17 : // compatibility.
18 :
19 : #include "windows.h"
20 :
21 m : extern "C" {
22 :
23 m : BOOL WINAPI asan_ReadFile(HANDLE hFile,
24 m : LPVOID lpBuffer,
25 m : DWORD nNumberOfBytesToRead,
26 m : LPDWORD lpNumberOfBytesRead,
27 m : LPOVERLAPPED lpOverlapped) {
28 m : return ::ReadFile(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead,
29 m : lpOverlapped);
30 m : }
31 :
32 m : BOOL WINAPI asan_ReadFileEx(
33 m : HANDLE hFile,
34 m : LPVOID lpBuffer,
35 m : DWORD nNumberOfBytesToRead,
36 m : LPOVERLAPPED lpOverlapped,
37 m : LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) {
38 m : return ::ReadFileEx(hFile, lpBuffer, nNumberOfBytesToRead, lpOverlapped,
39 m : lpCompletionRoutine);
40 m : }
41 :
42 m : BOOL WINAPI asan_WriteFile(HANDLE hFile,
43 m : LPCVOID lpBuffer,
44 m : DWORD nNumberOfBytesToWrite,
45 m : LPDWORD lpNumberOfBytesWritten,
46 m : LPOVERLAPPED lpOverlapped) {
47 m : return ::WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite,
48 m : lpNumberOfBytesWritten, lpOverlapped);
49 m : }
50 :
51 m : BOOL WINAPI asan_WriteFileEx(
52 m : HANDLE hFile,
53 m : LPCVOID lpBuffer,
54 m : DWORD nNumberOfBytesToWrite,
55 m : LPOVERLAPPED lpOverlapped,
56 m : LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) {
57 m : return ::WriteFileEx(hFile, lpBuffer, nNumberOfBytesToWrite, lpOverlapped,
58 m : lpCompletionRoutine);
59 m : }
60 :
61 m : long WINAPI asan_InterlockedCompareExchange(long volatile* Destination,
62 m : long Exchange,
63 m : long Comperand) {
64 m : return ::InterlockedCompareExchange(Destination, Exchange, Comperand);
65 m : }
66 :
67 m : long WINAPI asan_InterlockedIncrement(long* lpAddend) {
68 m : return ::InterlockedIncrement(lpAddend);
69 m : }
70 :
71 m : long WINAPI asan_InterlockedDecrement(long* lpAddend) {
72 m : return ::InterlockedDecrement(lpAddend);
73 m : }
74 :
75 m : long WINAPI asan_InterlockedExchange(long volatile* Target, long Value) {
76 m : return ::InterlockedExchange(Target, Value);
77 m : }
78 :
79 m : long WINAPI asan_InterlockedExchangeAdd(long volatile* Addend, long Value) {
80 m : return ::InterlockedExchangeAdd(Addend, Value);
81 m : }
82 :
83 m : } // extern "C"
|