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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 if (!NT_SUCCESS(status)) { | 80 if (!NT_SUCCESS(status)) { |
81 NTSTATUS_LOG(ERROR, status) << "NtQuerySystemInformation"; | 81 NTSTATUS_LOG(ERROR, status) << "NtQuerySystemInformation"; |
82 return nullptr; | 82 return nullptr; |
83 } | 83 } |
84 | 84 |
85 process_types::SYSTEM_PROCESS_INFORMATION<Traits>* process = | 85 process_types::SYSTEM_PROCESS_INFORMATION<Traits>* process = |
86 reinterpret_cast<process_types::SYSTEM_PROCESS_INFORMATION<Traits>*>( | 86 reinterpret_cast<process_types::SYSTEM_PROCESS_INFORMATION<Traits>*>( |
87 buffer->get()); | 87 buffer->get()); |
88 DWORD process_id = GetProcessId(process_handle); | 88 DWORD process_id = GetProcessId(process_handle); |
89 do { | 89 for (;;) { |
90 if (process->UniqueProcessId == process_id) | 90 if (process->UniqueProcessId == process_id) |
91 return process; | 91 return process; |
92 } while (process = NextProcess(process)); | 92 process = NextProcess(process); |
| 93 if (!process) |
| 94 break; |
| 95 } |
93 | 96 |
94 LOG(ERROR) << "process " << process_id << " not found"; | 97 LOG(ERROR) << "process " << process_id << " not found"; |
95 return nullptr; | 98 return nullptr; |
96 } | 99 } |
97 | 100 |
98 template <class Traits> | 101 template <class Traits> |
99 HANDLE OpenThread( | 102 HANDLE OpenThread( |
100 const process_types::SYSTEM_THREAD_INFORMATION<Traits>& thread_info) { | 103 const process_types::SYSTEM_THREAD_INFORMATION<Traits>& thread_info) { |
101 HANDLE handle; | 104 HANDLE handle; |
102 ACCESS_MASK query_access = | 105 ACCESS_MASK query_access = |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 thread.stack_region_size = 0; | 404 thread.stack_region_size = 0; |
402 } else { | 405 } else { |
403 thread.stack_region_size = base - limit; | 406 thread.stack_region_size = base - limit; |
404 } | 407 } |
405 } | 408 } |
406 threads_.push_back(thread); | 409 threads_.push_back(thread); |
407 } | 410 } |
408 } | 411 } |
409 | 412 |
410 } // namespace crashpad | 413 } // namespace crashpad |
OLD | NEW |