Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2041)

Unified Diff: remoting/host/win/elevation_helpers.cc

Issue 2961333002: Fix field trials not working in utility processes. (Closed)
Patch Set: review comment Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« base/process/process_info_win.cc ('K') | « remoting/host/win/elevation_helpers.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/win/elevation_helpers.cc
diff --git a/remoting/host/win/elevation_helpers.cc b/remoting/host/win/elevation_helpers.cc
deleted file mode 100644
index dee90162d9469f3a007957bfe2a8d3a85bc5f0f0..0000000000000000000000000000000000000000
--- a/remoting/host/win/elevation_helpers.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "remoting/host/win/elevation_helpers.h"
-
-#include <windows.h>
-
-#include "base/logging.h"
-#include "base/win/scoped_handle.h"
-
-namespace {
-
-void GetCurrentProcessToken(base::win::ScopedHandle* scoped_handle) {
- DCHECK(scoped_handle);
-
- HANDLE process_token;
- OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &process_token);
- scoped_handle->Set(process_token);
- DCHECK(scoped_handle->IsValid());
-}
-
-} // namespace
-
-namespace remoting {
-
-bool IsProcessElevated() {
- base::win::ScopedHandle scoped_process_token;
- GetCurrentProcessToken(&scoped_process_token);
-
- // Unlike TOKEN_ELEVATION_TYPE which returns TokenElevationTypeDefault when
- // UAC is turned off, TOKEN_ELEVATION returns whether the process is elevated.
- DWORD size;
- TOKEN_ELEVATION elevation;
- if (!GetTokenInformation(scoped_process_token.Get(), TokenElevation,
- &elevation, sizeof(elevation), &size)) {
- PLOG(ERROR) << "GetTokenInformation() failed";
- return false;
- }
- return elevation.TokenIsElevated != 0;
-}
-
-bool CurrentProcessHasUiAccess() {
- base::win::ScopedHandle scoped_process_token;
- GetCurrentProcessToken(&scoped_process_token);
-
- DWORD size;
- DWORD uiaccess_value = 0;
- if (!GetTokenInformation(scoped_process_token.Get(), TokenUIAccess,
- &uiaccess_value, sizeof(uiaccess_value), &size)) {
- PLOG(ERROR) << "GetTokenInformation() failed";
- return false;
- }
- return uiaccess_value != 0;
-}
-
-} // namespace remoting
« base/process/process_info_win.cc ('K') | « remoting/host/win/elevation_helpers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698