Index: base/metrics/field_trial.cc |
diff --git a/base/metrics/field_trial.cc b/base/metrics/field_trial.cc |
index f3c16d2a1ae865f3880fbf06217c6ab9dd80f4aa..dddc29100d241d5ebfab62673eb930c42c61f3aa 100644 |
--- a/base/metrics/field_trial.cc |
+++ b/base/metrics/field_trial.cc |
@@ -14,6 +14,8 @@ |
#include "base/logging.h" |
#include "base/metrics/field_trial_param_associator.h" |
#include "base/process/memory.h" |
+#include "base/process/process_handle.h" |
+#include "base/process/process_info.h" |
#include "base/rand_util.h" |
#include "base/strings/string_number_conversions.h" |
#include "base/strings/string_split.h" |
@@ -1142,6 +1144,17 @@ SharedMemoryHandle DeserializeImpl(const std::string& switch_value) { |
if (!base::StringToInt(tokens[0], &field_trial_handle)) |
return SharedMemoryHandle(); |
RawHandle handle = reinterpret_cast<RawHandle>(field_trial_handle); |
+#if defined(OS_WIN) |
+ if (base::IsCurrentProcessElevated()) { |
+ // base::LaunchElevatedProcess doesn't have a way to duplicate the handle, |
+ // but this process can since by definition it's not sandboxed. |
+ base::ProcessId parent_pid = base::GetParentProcessId(GetCurrentProcess()); |
+ HANDLE parent_handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, parent_pid); |
+ DuplicateHandle(parent_handle, handle, GetCurrentProcess(), &handle, 0, |
+ FALSE, DUPLICATE_SAME_ACCESS); |
+ CloseHandle(parent_handle); |
+ } |
(unused - use chromium)
2017/06/30 16:15:18
Having OS-dependent elevantion-level-dependent cod
Alexei Svitkine (slow)
2017/06/30 16:20:37
I agree this is not ideal. But I don't have a sugg
|
+#endif |
base::UnguessableToken guid; |
if (!DeserializeGUIDFromStringPieces(tokens[1], tokens[2], &guid)) |