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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 static NtOpenThreadFunction nt_open_thread = | 65 static NtOpenThreadFunction nt_open_thread = |
66 reinterpret_cast<NtOpenThreadFunction>( | 66 reinterpret_cast<NtOpenThreadFunction>( |
67 GetProcAddress(LoadLibrary(L"ntdll.dll"), "NtOpenThread")); | 67 GetProcAddress(LoadLibrary(L"ntdll.dll"), "NtOpenThread")); |
68 DCHECK(nt_open_thread); | 68 DCHECK(nt_open_thread); |
69 return nt_open_thread(thread_handle, | 69 return nt_open_thread(thread_handle, |
70 desired_access, | 70 desired_access, |
71 object_attributes, | 71 object_attributes, |
72 static_cast<const void*>(client_id)); | 72 static_cast<const void*>(client_id)); |
73 } | 73 } |
74 | 74 |
| 75 NTSTATUS NtQueryObject(HANDLE handle, |
| 76 OBJECT_INFORMATION_CLASS object_information_class, |
| 77 void* object_information, |
| 78 ULONG object_information_length, |
| 79 ULONG* return_length) { |
| 80 static decltype(::NtQueryObject)* nt_query_object = |
| 81 reinterpret_cast<decltype(::NtQueryObject)*>( |
| 82 GetProcAddress(LoadLibrary(L"ntdll.dll"), "NtQueryObject")); |
| 83 DCHECK(nt_query_object); |
| 84 return nt_query_object(handle, |
| 85 object_information_class, |
| 86 object_information, |
| 87 object_information_length, |
| 88 return_length); |
| 89 } |
| 90 |
75 // Explicit instantiations with the only 2 valid template arguments to avoid | 91 // Explicit instantiations with the only 2 valid template arguments to avoid |
76 // putting the body of the function in the header. | 92 // putting the body of the function in the header. |
77 template NTSTATUS NtOpenThread<process_types::internal::Traits32>( | 93 template NTSTATUS NtOpenThread<process_types::internal::Traits32>( |
78 PHANDLE thread_handle, | 94 PHANDLE thread_handle, |
79 ACCESS_MASK desired_access, | 95 ACCESS_MASK desired_access, |
80 POBJECT_ATTRIBUTES object_attributes, | 96 POBJECT_ATTRIBUTES object_attributes, |
81 const process_types::CLIENT_ID<process_types::internal::Traits32>* | 97 const process_types::CLIENT_ID<process_types::internal::Traits32>* |
82 client_id); | 98 client_id); |
83 | 99 |
84 template NTSTATUS NtOpenThread<process_types::internal::Traits64>( | 100 template NTSTATUS NtOpenThread<process_types::internal::Traits64>( |
85 PHANDLE thread_handle, | 101 PHANDLE thread_handle, |
86 ACCESS_MASK desired_access, | 102 ACCESS_MASK desired_access, |
87 POBJECT_ATTRIBUTES object_attributes, | 103 POBJECT_ATTRIBUTES object_attributes, |
88 const process_types::CLIENT_ID<process_types::internal::Traits64>* | 104 const process_types::CLIENT_ID<process_types::internal::Traits64>* |
89 client_id); | 105 client_id); |
90 | 106 |
91 } // namespace crashpad | 107 } // namespace crashpad |
OLD | NEW |