handle_attachment_win.cc 922 B

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