Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: sandbox/win/src/process_mitigations_win32k_dispatcher.cc

Issue 2849243002: Get rid of all pid references from base::SharedMemoryHandle. (Closed)
Patch Set: fix invalid handle Chrome IPC. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/public/cpp/system/platform_handle.cc ('k') | sandbox/win/tests/common/controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 10 matching lines...) Expand all
21 21
22 base::SharedMemoryHandle GetSharedMemoryHandle(const ClientInfo& client_info, 22 base::SharedMemoryHandle GetSharedMemoryHandle(const ClientInfo& client_info,
23 HANDLE handle) { 23 HANDLE handle) {
24 HANDLE result_handle = nullptr; 24 HANDLE result_handle = nullptr;
25 intptr_t handle_int = reinterpret_cast<intptr_t>(handle); 25 intptr_t handle_int = reinterpret_cast<intptr_t>(handle);
26 if (handle_int <= 0 || 26 if (handle_int <= 0 ||
27 !::DuplicateHandle(client_info.process, handle, ::GetCurrentProcess(), 27 !::DuplicateHandle(client_info.process, handle, ::GetCurrentProcess(),
28 &result_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) { 28 &result_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) {
29 result_handle = nullptr; 29 result_handle = nullptr;
30 } 30 }
31 return base::SharedMemoryHandle(result_handle, ::GetCurrentProcessId()); 31 return base::SharedMemoryHandle(result_handle);
32 } 32 }
33 33
34 } // namespace 34 } // namespace
35 35
36 ProtectedVideoOutput::~ProtectedVideoOutput() { 36 ProtectedVideoOutput::~ProtectedVideoOutput() {
37 ProcessMitigationsWin32KLockdownPolicy::DestroyOPMProtectedOutputAction( 37 ProcessMitigationsWin32KLockdownPolicy::DestroyOPMProtectedOutputAction(
38 handle_); 38 handle_);
39 } 39 }
40 40
41 scoped_refptr<ProtectedVideoOutput> 41 scoped_refptr<ProtectedVideoOutput>
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 if (!status) { 568 if (!status) {
569 memcpy(buffer.memory(), &requested_info, 569 memcpy(buffer.memory(), &requested_info,
570 sizeof(DXGKMDT_OPM_REQUESTED_INFORMATION)); 570 sizeof(DXGKMDT_OPM_REQUESTED_INFORMATION));
571 } 571 }
572 ipc->return_info.nt_status = status; 572 ipc->return_info.nt_status = status;
573 return true; 573 return true;
574 } 574 }
575 575
576 } // namespace sandbox 576 } // namespace sandbox
577 577
OLDNEW
« no previous file with comments | « mojo/public/cpp/system/platform_handle.cc ('k') | sandbox/win/tests/common/controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698