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

Unified Diff: handler/win/crashy_test_program.cc

Issue 1405243002: Fix CRITICAL_SECTION test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 2 months 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 | snapshot/win/end_to_end_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: handler/win/crashy_test_program.cc
diff --git a/handler/win/crashy_test_program.cc b/handler/win/crashy_test_program.cc
index 0694a88b5fa18c16777f911aa308e008844a4bcf..5eaa284f33e73ce3085359c1382a16dba5c20af8 100644
--- a/handler/win/crashy_test_program.cc
+++ b/handler/win/crashy_test_program.cc
@@ -117,9 +117,20 @@ int CrashyMain(int argc, char* argv[]) {
AllocateMemoryOfVariousProtections();
- CrashpadInitializeCriticalSectionEx(
- &g_test_critical_section, 0, RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO);
- EnterCriticalSection(&g_test_critical_section);
+
+ DWORD cs_flags = 0;
+
+ // We can only force the .DebugInfo critical section on Win 8 and later.
+ DWORD version = GetVersion();
+ DWORD major_version = LOBYTE(LOWORD(version));
+ DWORD minor_version = HIBYTE(LOWORD(version));
+ if (major_version >= 6 && minor_version >= 2)
Mark Mentovai 2015/10/16 03:36:44 This condition doesn’t seem quite right, it won’t
scottmg 2015/10/16 19:29:00 It happens to work because we're unmanifested, but
+ cs_flags = RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO;
+
+ if (CrashpadInitializeCriticalSectionEx(
+ &g_test_critical_section, 0, cs_flags)) {
+ EnterCriticalSection(&g_test_critical_section);
+ }
SomeCrashyFunction();
« no previous file with comments | « no previous file | snapshot/win/end_to_end_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698