OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. 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 13 matching lines...) Expand all Loading... |
24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
27 #include "gtest/gtest.h" | 27 #include "gtest/gtest.h" |
28 #include "test/errors.h" | 28 #include "test/errors.h" |
29 #include "test/scoped_temp_dir.h" | 29 #include "test/scoped_temp_dir.h" |
30 #include "test/paths.h" | 30 #include "test/paths.h" |
31 #include "test/win/child_launcher.h" | 31 #include "test/win/child_launcher.h" |
32 #include "util/file/file_io.h" | 32 #include "util/file/file_io.h" |
33 #include "util/misc/uuid.h" | 33 #include "util/misc/uuid.h" |
| 34 #include "util/win/get_function.h" |
34 #include "util/win/scoped_handle.h" | 35 #include "util/win/scoped_handle.h" |
35 | 36 |
36 namespace crashpad { | 37 namespace crashpad { |
37 namespace test { | 38 namespace test { |
38 namespace { | 39 namespace { |
39 | 40 |
40 const wchar_t kNtdllName[] = L"\\ntdll.dll"; | 41 const wchar_t kNtdllName[] = L"\\ntdll.dll"; |
41 | 42 |
42 bool IsProcessWow64(HANDLE process_handle) { | 43 bool IsProcessWow64(HANDLE process_handle) { |
43 static decltype(IsWow64Process)* is_wow64_process = | 44 static const auto is_wow64_process = |
44 reinterpret_cast<decltype(IsWow64Process)*>( | 45 GET_FUNCTION(L"kernel32.dll", ::IsWow64Process); |
45 GetProcAddress(LoadLibrary(L"kernel32.dll"), "IsWow64Process")); | |
46 if (!is_wow64_process) | 46 if (!is_wow64_process) |
47 return false; | 47 return false; |
48 BOOL is_wow64; | 48 BOOL is_wow64; |
49 if (!is_wow64_process(process_handle, &is_wow64)) { | 49 if (!is_wow64_process(process_handle, &is_wow64)) { |
50 PLOG(ERROR) << "IsWow64Process"; | 50 PLOG(ERROR) << "IsWow64Process"; |
51 return false; | 51 return false; |
52 } | 52 } |
53 return is_wow64; | 53 return is_wow64; |
54 } | 54 } |
55 | 55 |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 } | 619 } |
620 } | 620 } |
621 EXPECT_TRUE(found_file_handle); | 621 EXPECT_TRUE(found_file_handle); |
622 EXPECT_TRUE(found_key_handle); | 622 EXPECT_TRUE(found_key_handle); |
623 EXPECT_TRUE(found_mapping_handle); | 623 EXPECT_TRUE(found_mapping_handle); |
624 } | 624 } |
625 | 625 |
626 } // namespace | 626 } // namespace |
627 } // namespace test | 627 } // namespace test |
628 } // namespace crashpad | 628 } // namespace crashpad |
OLD | NEW |