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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 EXPECT_EQ(0, observed.dwFileFlags & ~observed.dwFileFlagsMask); | 86 EXPECT_EQ(0, observed.dwFileFlags & ~observed.dwFileFlagsMask); |
87 EXPECT_EQ(VOS_NT_WINDOWS32, observed.dwFileOS); | 87 EXPECT_EQ(VOS_NT_WINDOWS32, observed.dwFileOS); |
88 if (known_dll) { | 88 if (known_dll) { |
89 EXPECT_EQ(VFT_DLL, observed.dwFileType); | 89 EXPECT_EQ(VFT_DLL, observed.dwFileType); |
90 } else { | 90 } else { |
91 EXPECT_TRUE(observed.dwFileType == VFT_APP || | 91 EXPECT_TRUE(observed.dwFileType == VFT_APP || |
92 observed.dwFileType == VFT_DLL); | 92 observed.dwFileType == VFT_DLL); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 // Use BaseName() to ensure that GetModuleVersionAndType() finds the | 96 base::FilePath module_path(module.name); |
97 // already-loaded module with the specified name. Otherwise, dwFileVersionMS | 97 |
98 // may not match. | 98 const DWORD version = GetVersion(); |
| 99 const int major_version = LOBYTE(LOWORD(version)); |
| 100 const int minor_version = HIBYTE(LOWORD(version)); |
| 101 if (major_version > 6 || (major_version == 6 && minor_version >= 2)) { |
| 102 // Windows 8 or later. |
| 103 // |
| 104 // Use BaseName() to ensure that GetModuleVersionAndType() finds the |
| 105 // already-loaded module with the specified name. Otherwise, dwFileVersionMS |
| 106 // may not match. This appears to be related to the changes made in Windows |
| 107 // 8.1 to GetVersion() and GetVersionEx() for non-manifested applications |
| 108 module_path = module_path.BaseName(); |
| 109 } |
| 110 |
99 VS_FIXEDFILEINFO expected; | 111 VS_FIXEDFILEINFO expected; |
100 const bool expected_rv = GetModuleVersionAndType( | 112 const bool expected_rv = GetModuleVersionAndType(module_path, &expected); |
101 base::FilePath(module.name).BaseName(), &expected); | |
102 ASSERT_TRUE(expected_rv || !known_dll); | 113 ASSERT_TRUE(expected_rv || !known_dll); |
103 | 114 |
104 EXPECT_EQ(expected_rv, observed_rv); | 115 EXPECT_EQ(expected_rv, observed_rv); |
105 | 116 |
106 if (observed_rv && expected_rv) { | 117 if (observed_rv && expected_rv) { |
107 EXPECT_EQ(expected.dwSignature, observed.dwSignature); | 118 EXPECT_EQ(expected.dwSignature, observed.dwSignature); |
108 EXPECT_EQ(expected.dwStrucVersion, observed.dwStrucVersion); | 119 EXPECT_EQ(expected.dwStrucVersion, observed.dwStrucVersion); |
109 EXPECT_EQ(expected.dwFileVersionMS, observed.dwFileVersionMS); | 120 EXPECT_EQ(expected.dwFileVersionMS, observed.dwFileVersionMS); |
110 EXPECT_EQ(expected.dwFileVersionLS, observed.dwFileVersionLS); | 121 EXPECT_EQ(expected.dwFileVersionLS, observed.dwFileVersionLS); |
111 EXPECT_EQ(expected.dwProductVersionMS, observed.dwProductVersionMS); | 122 EXPECT_EQ(expected.dwProductVersionMS, observed.dwProductVersionMS); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 164 |
154 for (const auto& module : modules) { | 165 for (const auto& module : modules) { |
155 SCOPED_TRACE(base::UTF16ToUTF8(module.name)); | 166 SCOPED_TRACE(base::UTF16ToUTF8(module.name)); |
156 TestVSFixedFileInfo(&process_reader, module, false); | 167 TestVSFixedFileInfo(&process_reader, module, false); |
157 } | 168 } |
158 } | 169 } |
159 | 170 |
160 } // namespace | 171 } // namespace |
161 } // namespace test | 172 } // namespace test |
162 } // namespace crashpad | 173 } // namespace crashpad |
OLD | NEW |