OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sandbox/win/src/process_mitigations_win32k_dispatcher.h" | 5 #include "sandbox/win/src/process_mitigations_win32k_dispatcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/unguessable_token.h" |
11 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
12 #include "sandbox/win/src/interception.h" | 13 #include "sandbox/win/src/interception.h" |
13 #include "sandbox/win/src/interceptors.h" | 14 #include "sandbox/win/src/interceptors.h" |
14 #include "sandbox/win/src/ipc_tags.h" | 15 #include "sandbox/win/src/ipc_tags.h" |
15 #include "sandbox/win/src/process_mitigations_win32k_interception.h" | 16 #include "sandbox/win/src/process_mitigations_win32k_interception.h" |
16 #include "sandbox/win/src/process_mitigations_win32k_policy.h" | 17 #include "sandbox/win/src/process_mitigations_win32k_policy.h" |
17 | 18 |
18 namespace sandbox { | 19 namespace sandbox { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 base::SharedMemoryHandle GetSharedMemoryHandle(const ClientInfo& client_info, | 23 base::SharedMemoryHandle GetSharedMemoryHandle(const ClientInfo& client_info, |
23 HANDLE handle) { | 24 HANDLE handle) { |
24 HANDLE result_handle = nullptr; | 25 HANDLE result_handle = nullptr; |
25 intptr_t handle_int = reinterpret_cast<intptr_t>(handle); | 26 intptr_t handle_int = reinterpret_cast<intptr_t>(handle); |
26 if (handle_int <= 0 || | 27 if (handle_int <= 0 || |
27 !::DuplicateHandle(client_info.process, handle, ::GetCurrentProcess(), | 28 !::DuplicateHandle(client_info.process, handle, ::GetCurrentProcess(), |
28 &result_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) { | 29 &result_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) { |
29 result_handle = nullptr; | 30 result_handle = nullptr; |
30 } | 31 } |
31 return base::SharedMemoryHandle(result_handle); | 32 return base::SharedMemoryHandle(result_handle, |
| 33 base::UnguessableToken::Create()); |
32 } | 34 } |
33 | 35 |
34 } // namespace | 36 } // namespace |
35 | 37 |
36 ProtectedVideoOutput::~ProtectedVideoOutput() { | 38 ProtectedVideoOutput::~ProtectedVideoOutput() { |
37 ProcessMitigationsWin32KLockdownPolicy::DestroyOPMProtectedOutputAction( | 39 ProcessMitigationsWin32KLockdownPolicy::DestroyOPMProtectedOutputAction( |
38 handle_); | 40 handle_); |
39 } | 41 } |
40 | 42 |
41 scoped_refptr<ProtectedVideoOutput> | 43 scoped_refptr<ProtectedVideoOutput> |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 if (!status) { | 570 if (!status) { |
569 memcpy(buffer.memory(), &requested_info, | 571 memcpy(buffer.memory(), &requested_info, |
570 sizeof(DXGKMDT_OPM_REQUESTED_INFORMATION)); | 572 sizeof(DXGKMDT_OPM_REQUESTED_INFORMATION)); |
571 } | 573 } |
572 ipc->return_info.nt_status = status; | 574 ipc->return_info.nt_status = status; |
573 return true; | 575 return true; |
574 } | 576 } |
575 | 577 |
576 } // namespace sandbox | 578 } // namespace sandbox |
577 | 579 |
OLD | NEW |