Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2071)

Unified Diff: snapshot/win/pe_image_reader_test.cc

Issue 1493933002: win: Placate more OS versions in the PEImageReader test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: snapshot/win/pe_image_reader_test.cc
diff --git a/snapshot/win/pe_image_reader_test.cc b/snapshot/win/pe_image_reader_test.cc
index 759aa2197b44f35d5f50ed70700150af352304b6..46795cfba18dcda9ad811230643823251ee12b83 100644
--- a/snapshot/win/pe_image_reader_test.cc
+++ b/snapshot/win/pe_image_reader_test.cc
@@ -93,12 +93,23 @@ void TestVSFixedFileInfo(ProcessReaderWin* process_reader,
}
}
- // Use BaseName() to ensure that GetModuleVersionAndType() finds the
- // already-loaded module with the specified name. Otherwise, dwFileVersionMS
- // may not match.
+ base::FilePath module_path(module.name);
+
+ const DWORD version = GetVersion();
+ const int major_version = LOBYTE(LOWORD(version));
+ const int minor_version = HIBYTE(LOWORD(version));
+ if (major_version > 6 || (major_version == 6 && minor_version >= 2)) {
+ // Windows 8 or later.
+ //
+ // Use BaseName() to ensure that GetModuleVersionAndType() finds the
+ // already-loaded module with the specified name. Otherwise, dwFileVersionMS
+ // may not match. This appears to be related to the changes made in Windows
+ // 8.1 to GetVersion() and GetVersionEx() for non-manifested applications
+ module_path = module_path.BaseName();
+ }
+
VS_FIXEDFILEINFO expected;
- const bool expected_rv = GetModuleVersionAndType(
- base::FilePath(module.name).BaseName(), &expected);
+ const bool expected_rv = GetModuleVersionAndType(module_path, &expected);
ASSERT_TRUE(expected_rv || !known_dll);
EXPECT_EQ(expected_rv, observed_rv);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698