OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_WIN_IAT_PATCH_FUNCTION_H_ | 5 #ifndef BASE_WIN_IAT_PATCH_FUNCTION_H_ |
6 #define BASE_WIN_IAT_PATCH_FUNCTION_H_ | 6 #define BASE_WIN_IAT_PATCH_FUNCTION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
11 #include "base/base_api.h" | 11 #include "base/base_export.h" |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 namespace win { | 15 namespace win { |
16 | 16 |
17 // A class that encapsulates Import Address Table patching helpers and restores | 17 // A class that encapsulates Import Address Table patching helpers and restores |
18 // the original function in the destructor. | 18 // the original function in the destructor. |
19 // | 19 // |
20 // It will intercept functions for a specific DLL imported from another DLL. | 20 // It will intercept functions for a specific DLL imported from another DLL. |
21 // This is the case when, for example, we want to intercept | 21 // This is the case when, for example, we want to intercept |
22 // CertDuplicateCertificateContext function (exported from crypt32.dll) called | 22 // CertDuplicateCertificateContext function (exported from crypt32.dll) called |
23 // by wininet.dll. | 23 // by wininet.dll. |
24 class BASE_API IATPatchFunction { | 24 class BASE_EXPORT IATPatchFunction { |
25 public: | 25 public: |
26 IATPatchFunction(); | 26 IATPatchFunction(); |
27 ~IATPatchFunction(); | 27 ~IATPatchFunction(); |
28 | 28 |
29 // Intercept a function in an import table of a specific | 29 // Intercept a function in an import table of a specific |
30 // module. Save the original function and the import | 30 // module. Save the original function and the import |
31 // table address. These values will be used later | 31 // table address. These values will be used later |
32 // during Unpatch | 32 // during Unpatch |
33 // | 33 // |
34 // Arguments: | 34 // Arguments: |
(...skipping 29 matching lines...) Expand all Loading... |
64 void* original_function_; | 64 void* original_function_; |
65 IMAGE_THUNK_DATA* iat_thunk_; | 65 IMAGE_THUNK_DATA* iat_thunk_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(IATPatchFunction); | 67 DISALLOW_COPY_AND_ASSIGN(IATPatchFunction); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace win | 70 } // namespace win |
71 } // namespace base | 71 } // namespace base |
72 | 72 |
73 #endif // BASE_WIN_IAT_PATCH_FUNCTION_H_ | 73 #endif // BASE_WIN_IAT_PATCH_FUNCTION_H_ |
OLD | NEW |