| 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 mapping_name.c_str())); | 569 mapping_name.c_str())); |
| 570 ASSERT_TRUE(mapping.is_valid()) << ErrorMessage("CreateFileMapping"); | 570 ASSERT_TRUE(mapping.is_valid()) << ErrorMessage("CreateFileMapping"); |
| 571 | 571 |
| 572 ProcessInfo info; | 572 ProcessInfo info; |
| 573 info.Initialize(GetCurrentProcess()); | 573 info.Initialize(GetCurrentProcess()); |
| 574 bool found_file_handle = false; | 574 bool found_file_handle = false; |
| 575 bool found_inherited_file_handle = false; | 575 bool found_inherited_file_handle = false; |
| 576 bool found_key_handle = false; | 576 bool found_key_handle = false; |
| 577 bool found_mapping_handle = false; | 577 bool found_mapping_handle = false; |
| 578 for (auto handle : info.Handles()) { | 578 for (auto handle : info.Handles()) { |
| 579 const int handle_int = implicit_cast<int>(handle.handle); | 579 if (handle.handle == HandleToInt(file.get())) { |
| 580 if (handle_int == HandleToInt(file.get())) { | |
| 581 EXPECT_FALSE(found_file_handle); | 580 EXPECT_FALSE(found_file_handle); |
| 582 found_file_handle = true; | 581 found_file_handle = true; |
| 583 EXPECT_EQ(L"File", handle.type_name); | 582 EXPECT_EQ(L"File", handle.type_name); |
| 584 EXPECT_EQ(1, handle.handle_count); | 583 EXPECT_EQ(1, handle.handle_count); |
| 585 EXPECT_NE(0u, handle.pointer_count); | 584 EXPECT_NE(0u, handle.pointer_count); |
| 586 EXPECT_EQ(STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE | SYNCHRONIZE, | 585 EXPECT_EQ(STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE | SYNCHRONIZE, |
| 587 handle.granted_access & STANDARD_RIGHTS_ALL); | 586 handle.granted_access & STANDARD_RIGHTS_ALL); |
| 588 EXPECT_EQ(0, handle.attributes); | 587 EXPECT_EQ(0, handle.attributes); |
| 589 } | 588 } |
| 590 if (handle_int == HandleToInt(inherited_file.get())) { | 589 if (handle.handle == HandleToInt(inherited_file.get())) { |
| 591 EXPECT_FALSE(found_inherited_file_handle); | 590 EXPECT_FALSE(found_inherited_file_handle); |
| 592 found_inherited_file_handle = true; | 591 found_inherited_file_handle = true; |
| 593 EXPECT_EQ(L"File", handle.type_name); | 592 EXPECT_EQ(L"File", handle.type_name); |
| 594 EXPECT_EQ(1, handle.handle_count); | 593 EXPECT_EQ(1, handle.handle_count); |
| 595 EXPECT_NE(0u, handle.pointer_count); | 594 EXPECT_NE(0u, handle.pointer_count); |
| 596 EXPECT_EQ(STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE | SYNCHRONIZE, | 595 EXPECT_EQ(STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE | SYNCHRONIZE, |
| 597 handle.granted_access & STANDARD_RIGHTS_ALL); | 596 handle.granted_access & STANDARD_RIGHTS_ALL); |
| 598 | 597 |
| 599 // OBJ_INHERIT from ntdef.h, but including that conflicts with other | 598 // OBJ_INHERIT from ntdef.h, but including that conflicts with other |
| 600 // headers. | 599 // headers. |
| 601 const int kObjInherit = 0x2; | 600 const int kObjInherit = 0x2; |
| 602 EXPECT_EQ(kObjInherit, handle.attributes); | 601 EXPECT_EQ(kObjInherit, handle.attributes); |
| 603 } | 602 } |
| 604 if (handle_int == HandleToInt(scoped_key.get())) { | 603 if (handle.handle == HandleToInt(scoped_key.get())) { |
| 605 EXPECT_FALSE(found_key_handle); | 604 EXPECT_FALSE(found_key_handle); |
| 606 found_key_handle = true; | 605 found_key_handle = true; |
| 607 EXPECT_EQ(L"Key", handle.type_name); | 606 EXPECT_EQ(L"Key", handle.type_name); |
| 608 EXPECT_EQ(1, handle.handle_count); | 607 EXPECT_EQ(1, handle.handle_count); |
| 609 EXPECT_NE(0u, handle.pointer_count); | 608 EXPECT_NE(0u, handle.pointer_count); |
| 610 EXPECT_EQ(STANDARD_RIGHTS_READ, | 609 EXPECT_EQ(STANDARD_RIGHTS_READ, |
| 611 handle.granted_access & STANDARD_RIGHTS_ALL); | 610 handle.granted_access & STANDARD_RIGHTS_ALL); |
| 612 EXPECT_EQ(0, handle.attributes); | 611 EXPECT_EQ(0, handle.attributes); |
| 613 } | 612 } |
| 614 if (handle_int == HandleToInt(mapping.get())) { | 613 if (handle.handle == HandleToInt(mapping.get())) { |
| 615 EXPECT_FALSE(found_mapping_handle); | 614 EXPECT_FALSE(found_mapping_handle); |
| 616 found_mapping_handle = true; | 615 found_mapping_handle = true; |
| 617 EXPECT_EQ(L"Section", handle.type_name); | 616 EXPECT_EQ(L"Section", handle.type_name); |
| 618 EXPECT_EQ(1, handle.handle_count); | 617 EXPECT_EQ(1, handle.handle_count); |
| 619 EXPECT_NE(0u, handle.pointer_count); | 618 EXPECT_NE(0u, handle.pointer_count); |
| 620 EXPECT_EQ(DELETE | READ_CONTROL | WRITE_DAC | WRITE_OWNER | | 619 EXPECT_EQ(DELETE | READ_CONTROL | WRITE_DAC | WRITE_OWNER | |
| 621 STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE, | 620 STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE, |
| 622 handle.granted_access & STANDARD_RIGHTS_ALL); | 621 handle.granted_access & STANDARD_RIGHTS_ALL); |
| 623 EXPECT_EQ(0, handle.attributes); | 622 EXPECT_EQ(0, handle.attributes); |
| 624 } | 623 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 639 EXPECT_TRUE( | 638 EXPECT_TRUE( |
| 640 info.LoggingRangeIsFullyReadable(CheckedRange<WinVMAddress, WinVMSize>( | 639 info.LoggingRangeIsFullyReadable(CheckedRange<WinVMAddress, WinVMSize>( |
| 641 reinterpret_cast<WinVMAddress>(safe_memory.get()), kAllocationSize))); | 640 reinterpret_cast<WinVMAddress>(safe_memory.get()), kAllocationSize))); |
| 642 EXPECT_FALSE(info.LoggingRangeIsFullyReadable( | 641 EXPECT_FALSE(info.LoggingRangeIsFullyReadable( |
| 643 CheckedRange<WinVMAddress, WinVMSize>(0, 1024))); | 642 CheckedRange<WinVMAddress, WinVMSize>(0, 1024))); |
| 644 } | 643 } |
| 645 | 644 |
| 646 } // namespace | 645 } // namespace |
| 647 } // namespace test | 646 } // namespace test |
| 648 } // namespace crashpad | 647 } // namespace crashpad |
| OLD | NEW |