blob: cccdd4432c42496d8b4a3bca756a417ecae69b1e [file] [log] [blame]
Avi Drissmanea1be232022-09-14 23:29:061// Copyright 2015 The Chromium Authors
erikcheneece6c32015-07-07 22:13:112// 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
9namespace IPC {
10namespace internal {
11
Wez51eaaad2017-08-09 05:51:3812HandleAttachmentWin::HandleAttachmentWin(const HANDLE& handle) {
erikchen3d87ecf72016-01-08 02:17:0413 HANDLE duplicated_handle;
14 BOOL result =
15 ::DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(),
16 &duplicated_handle, 0, FALSE, DUPLICATE_SAME_ACCESS);
17 if (result) {
Wez51eaaad2017-08-09 05:51:3818 handle_.Set(duplicated_handle);
erikchen3d87ecf72016-01-08 02:17:0419 }
20}
erikcheneece6c32015-07-07 22:13:1121
sammc57ed9f982016-03-10 06:28:3522HandleAttachmentWin::HandleAttachmentWin(const HANDLE& handle,
23 FromWire from_wire)
Wez51eaaad2017-08-09 05:51:3824 : handle_(handle) {}
sammc57ed9f982016-03-10 06:28:3525
Wez51eaaad2017-08-09 05:51:3826HandleAttachmentWin::~HandleAttachmentWin() {}
erikcheneece6c32015-07-07 22:13:1127
sammc6ed3efb2016-11-23 03:17:3528MessageAttachment::Type HandleAttachmentWin::GetType() const {
29 return Type::WIN_HANDLE;
erikcheneece6c32015-07-07 22:13:1130}
31
32} // namespace internal
33} // namespace IPC