OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains unit tests for PEImage. | 5 // This file contains unit tests for PEImage. |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "base/pe_image.h" | 8 #include "base/win/pe_image.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 | 10 |
| 11 namespace base { |
| 12 namespace win { |
| 13 |
11 // Just counts the number of invocations. | 14 // Just counts the number of invocations. |
12 bool ExportsCallback(const PEImage &image, | 15 bool ExportsCallback(const PEImage &image, |
13 DWORD ordinal, | 16 DWORD ordinal, |
14 DWORD hint, | 17 DWORD hint, |
15 LPCSTR name, | 18 LPCSTR name, |
16 PVOID function, | 19 PVOID function, |
17 LPCSTR forward, | 20 LPCSTR forward, |
18 PVOID cookie) { | 21 PVOID cookie) { |
19 int* count = reinterpret_cast<int*>(cookie); | 22 int* count = reinterpret_cast<int*>(cookie); |
20 (*count)++; | 23 (*count)++; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 EXPECT_TRUE(pe.GetProcOrdinal("RegEnumKeyExW", &ordinal)); | 207 EXPECT_TRUE(pe.GetProcOrdinal("RegEnumKeyExW", &ordinal)); |
205 | 208 |
206 FARPROC address1 = pe.GetProcAddress("RegEnumKeyExW"); | 209 FARPROC address1 = pe.GetProcAddress("RegEnumKeyExW"); |
207 FARPROC address2 = pe.GetProcAddress(reinterpret_cast<char*>(ordinal)); | 210 FARPROC address2 = pe.GetProcAddress(reinterpret_cast<char*>(ordinal)); |
208 EXPECT_TRUE(address1 != NULL); | 211 EXPECT_TRUE(address1 != NULL); |
209 EXPECT_TRUE(address2 != NULL); | 212 EXPECT_TRUE(address2 != NULL); |
210 EXPECT_TRUE(address1 == address2); | 213 EXPECT_TRUE(address1 == address2); |
211 | 214 |
212 FreeLibrary(module); | 215 FreeLibrary(module); |
213 } | 216 } |
| 217 |
| 218 } // namespace win |
| 219 } // namespace base |
OLD | NEW |