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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
531 TEST(ProcessInfo, Handles) { | 531 TEST(ProcessInfo, Handles) { |
532 ScopedTempDir temp_dir; | 532 ScopedTempDir temp_dir; |
533 | 533 |
534 ScopedFileHandle file(LoggingOpenFileForWrite( | 534 ScopedFileHandle file(LoggingOpenFileForWrite( |
535 temp_dir.path().Append(FILE_PATH_LITERAL("test_file")), | 535 temp_dir.path().Append(FILE_PATH_LITERAL("test_file")), |
536 FileWriteMode::kTruncateOrCreate, | 536 FileWriteMode::kTruncateOrCreate, |
537 FilePermissions::kWorldReadable)); | 537 FilePermissions::kWorldReadable)); |
538 ASSERT_TRUE(file.is_valid()); | 538 ASSERT_TRUE(file.is_valid()); |
539 | 539 |
540 SECURITY_ATTRIBUTES security_attributes = {0}; | 540 SECURITY_ATTRIBUTES security_attributes = {0}; |
541 security_attributes.nLength = sizeof(security_attributes); | |
Mark Mentovai
2015/11/05 19:42:01
I originally thought that this would be the proble
| |
541 security_attributes.bInheritHandle = true; | 542 security_attributes.bInheritHandle = true; |
542 ScopedFileHandle inherited_file(CreateFile(L"CONOUT$", | 543 ScopedFileHandle inherited_file(CreateFile( |
543 GENERIC_WRITE, | 544 temp_dir.path().Append(FILE_PATH_LITERAL("inheritable")).value().c_str(), |
544 0, | 545 GENERIC_WRITE, |
545 &security_attributes, | 546 0, |
546 OPEN_EXISTING, | 547 &security_attributes, |
547 FILE_ATTRIBUTE_NORMAL, | 548 CREATE_NEW, |
548 nullptr)); | 549 FILE_ATTRIBUTE_NORMAL, |
550 nullptr)); | |
549 ASSERT_TRUE(inherited_file.is_valid()); | 551 ASSERT_TRUE(inherited_file.is_valid()); |
550 | 552 |
551 HKEY key; | 553 HKEY key; |
552 ASSERT_EQ(ERROR_SUCCESS, | 554 ASSERT_EQ(ERROR_SUCCESS, |
553 RegOpenKeyEx( | 555 RegOpenKeyEx( |
554 HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft", 0, KEY_READ, &key)); | 556 HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft", 0, KEY_READ, &key)); |
555 ScopedRegistryKey scoped_key(key); | 557 ScopedRegistryKey scoped_key(key); |
556 ASSERT_TRUE(scoped_key.is_valid()); | 558 ASSERT_TRUE(scoped_key.is_valid()); |
557 | 559 |
558 std::wstring mapping_name = | 560 std::wstring mapping_name = |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
637 EXPECT_TRUE( | 639 EXPECT_TRUE( |
638 info.LoggingRangeIsFullyReadable(CheckedRange<WinVMAddress, WinVMSize>( | 640 info.LoggingRangeIsFullyReadable(CheckedRange<WinVMAddress, WinVMSize>( |
639 reinterpret_cast<WinVMAddress>(safe_memory.get()), kAllocationSize))); | 641 reinterpret_cast<WinVMAddress>(safe_memory.get()), kAllocationSize))); |
640 EXPECT_FALSE(info.LoggingRangeIsFullyReadable( | 642 EXPECT_FALSE(info.LoggingRangeIsFullyReadable( |
641 CheckedRange<WinVMAddress, WinVMSize>(0, 1024))); | 643 CheckedRange<WinVMAddress, WinVMSize>(0, 1024))); |
642 } | 644 } |
643 | 645 |
644 } // namespace | 646 } // namespace |
645 } // namespace test | 647 } // namespace test |
646 } // namespace crashpad | 648 } // namespace crashpad |
OLD | NEW |