1 // Copyright 2015 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "ipc/handle_attachment_win.h" 6 7 #include <windows.h> 8 9 namespace IPC { 10 namespace internal { 11 HandleAttachmentWin(const HANDLE & handle)12HandleAttachmentWin::HandleAttachmentWin(const HANDLE& handle) { 13 HANDLE duplicated_handle; 14 BOOL result = 15 ::DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(), 16 &duplicated_handle, 0, FALSE, DUPLICATE_SAME_ACCESS); 17 if (result) { 18 handle_.Set(duplicated_handle); 19 } 20 } 21 HandleAttachmentWin(const HANDLE & handle,FromWire from_wire)22HandleAttachmentWin::HandleAttachmentWin(const HANDLE& handle, 23 FromWire from_wire) 24 : handle_(handle) {} 25 ~HandleAttachmentWin()26HandleAttachmentWin::~HandleAttachmentWin() {} 27 GetType() const28MessageAttachment::Type HandleAttachmentWin::GetType() const { 29 return Type::WIN_HANDLE; 30 } 31 32 } // namespace internal 33 } // namespace IPC 34