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