OLD | NEW |
1 // Copyright 2012 Google Inc. All Rights Reserved. | 1 // Copyright 2012 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with 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 | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 class LenientIATPatcherTest : public testing::Test { | 32 class LenientIATPatcherTest : public testing::Test { |
33 public: | 33 public: |
34 using ImportTable = std::vector<FunctionPointer>; | 34 using ImportTable = std::vector<FunctionPointer>; |
35 | 35 |
36 LenientIATPatcherTest() : test_dll_(nullptr) { | 36 LenientIATPatcherTest() : test_dll_(nullptr) { |
37 } | 37 } |
38 | 38 |
39 void SetUp() override { | 39 void SetUp() override { |
40 base::FilePath path = | 40 base::FilePath path = |
| 41 #ifndef _WIN64 |
41 testing::GetExeRelativePath(L"test_dll.dll"); | 42 testing::GetExeRelativePath(L"test_dll.dll"); |
| 43 #else |
| 44 testing::GetExeRelativePath(L"test_dll_x64.dll"); |
| 45 #endif |
42 test_dll_ = ::LoadLibrary(path.value().c_str()); | 46 test_dll_ = ::LoadLibrary(path.value().c_str()); |
43 ASSERT_NE(nullptr, test_dll_); | 47 ASSERT_NE(nullptr, test_dll_); |
44 } | 48 } |
45 | 49 |
46 void TearDown() override { | 50 void TearDown() override { |
47 if (test_dll_ != nullptr) { | 51 if (test_dll_ != nullptr) { |
48 ::FreeLibrary(test_dll_); | 52 ::FreeLibrary(test_dll_); |
49 test_dll_ = nullptr; | 53 test_dll_ = nullptr; |
50 } | 54 } |
51 } | 55 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // to remain unchanged. | 162 // to remain unchanged. |
159 ImportTable iat_before = GetIAT(test_dll_); | 163 ImportTable iat_before = GetIAT(test_dll_); |
160 auto result = PatchIATForModule(test_dll_, patches, on_unprotect); | 164 auto result = PatchIATForModule(test_dll_, patches, on_unprotect); |
161 ASSERT_NE(0u, PATCH_FAILED_ACCESS_VIOLATION & result); | 165 ASSERT_NE(0u, PATCH_FAILED_ACCESS_VIOLATION & result); |
162 ImportTable iat_after = GetIAT(test_dll_); | 166 ImportTable iat_after = GetIAT(test_dll_); |
163 EXPECT_EQ(iat_before, iat_after); | 167 EXPECT_EQ(iat_before, iat_after); |
164 } | 168 } |
165 | 169 |
166 } // namespace asan | 170 } // namespace asan |
167 } // namespace agent | 171 } // namespace agent |
OLD | NEW |