Print Preview: Refactoring print/cancel button and print summary.
[chromium-blink-merge.git] / content / common / section_util_win.cc
blob3d245b17bbe43bd17e19aa5b692688843471c988
1 // Copyright (c) 2011 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.
5 #include "content/common/section_util_win.h"
7 namespace chrome {
9 HANDLE GetSectionFromProcess(HANDLE section, HANDLE process, bool read_only) {
10 HANDLE valid_section = NULL;
11 DWORD access = STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ;
12 if (!read_only)
13 access |= FILE_MAP_WRITE;
14 DuplicateHandle(process, section, GetCurrentProcess(), &valid_section, access,
15 FALSE, 0);
16 return valid_section;
19 HANDLE GetSectionForProcess(HANDLE section, HANDLE process, bool read_only) {
20 HANDLE valid_section = NULL;
21 DWORD access = STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ;
22 if (!read_only)
23 access |= FILE_MAP_WRITE;
24 DuplicateHandle(GetCurrentProcess(), section, process, &valid_section, access,
25 FALSE, 0);
26 return valid_section;
29 } // namespace chrome