From 82ffeaa0f0866e04e9e3b4f36fe27143cc2f233e Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Thu, 5 Nov 2015 15:08:28 -0500 Subject: [PATCH] win: crashpad_util_test ProcessInfo.Handles doesn't work with CONOUT$ In 2eeaa3ac549a, I added a check to make sure that the expected CONOUT$ handle was found. Its omission seemed to be unintentional. The tests passed for me on Windows 10, but failed on the bots. I can reproduce the failures locally on Windows 7. Doing the inheritance test with a file other than CONOUT$ fixes the immediate problem, but we should find out why this CONOUT$ handle isn't showing up in the handles list on Windows 7, fix it, and add back a test. R=scottmg@chromium.org Review URL: https://codereview.chromium.org/1428753009 . --- util/win/process_info_test.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/util/win/process_info_test.cc b/util/win/process_info_test.cc index a6f9dc1c..7bf0f4ef 100644 --- a/util/win/process_info_test.cc +++ b/util/win/process_info_test.cc @@ -538,14 +538,16 @@ TEST(ProcessInfo, Handles) { ASSERT_TRUE(file.is_valid()); SECURITY_ATTRIBUTES security_attributes = {0}; + security_attributes.nLength = sizeof(security_attributes); security_attributes.bInheritHandle = true; - ScopedFileHandle inherited_file(CreateFile(L"CONOUT$", - GENERIC_WRITE, - 0, - &security_attributes, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - nullptr)); + ScopedFileHandle inherited_file(CreateFile( + temp_dir.path().Append(FILE_PATH_LITERAL("inheritable")).value().c_str(), + GENERIC_WRITE, + 0, + &security_attributes, + CREATE_NEW, + FILE_ATTRIBUTE_NORMAL, + nullptr)); ASSERT_TRUE(inherited_file.is_valid()); HKEY key;