Commit 24b4ca38 authored by Bruce Dawson's avatar Bruce Dawson Committed by Commit Bot

Use DUPLICATE_SAME_ACCESS to duplicate privileges

When launching a process with admin rights we can't duplicate the
process handle with dwDesiredAccess == PROCESS_QUERY_INFORMATION.
But we don't need to - we just need the same rights we have to the
original handle. So we should instead set dwOptions to
DUPLICATE_SAME_ACCESS.

This is an update to correct the flaw added in crrev.com/c/1155498

Bug: 871522
Change-Id: Ib5e526c1a1dfef07e6bb5e6d4d64e12c2d4c3eed
Reviewed-on: https://chromium-review.googlesource.com/1173499Reviewed-by: default avatarNick Carter <nick@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583000}
parent 98d05a08
...@@ -18,7 +18,7 @@ void ChildProcessData::SetHandle(base::ProcessHandle process) { ...@@ -18,7 +18,7 @@ void ChildProcessData::SetHandle(base::ProcessHandle process) {
} else { } else {
BOOL result = BOOL result =
::DuplicateHandle(::GetCurrentProcess(), process, ::GetCurrentProcess(), ::DuplicateHandle(::GetCurrentProcess(), process, ::GetCurrentProcess(),
&handle_to_set, PROCESS_QUERY_INFORMATION, FALSE, 0); &handle_to_set, 0, FALSE, DUPLICATE_SAME_ACCESS);
auto err = GetLastError(); auto err = GetLastError();
CHECK(result) << process << " " << err; CHECK(result) << process << " " << err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment