summaryrefslogtreecommitdiffstats
path: root/rlz
diff options
context:
space:
mode:
authorrvargas <rvargas@chromium.org>2015-02-13 10:07:59 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-13 18:08:56 +0000
commit6c690f1c2e035deda117ac13e6d5a23f4be6e3c6 (patch)
treec952889b9cb7f754c39b8e3071aa046c5031c7c1 /rlz
parentddea13be3be19fd889fb5953470faf154836e973 (diff)
downloadchromium_src-6c690f1c2e035deda117ac13e6d5a23f4be6e3c6.zip
chromium_src-6c690f1c2e035deda117ac13e6d5a23f4be6e3c6.tar.gz
chromium_src-6c690f1c2e035deda117ac13e6d5a23f4be6e3c6.tar.bz2
Move GetProcessIntegrityLevel to file_info.h and remove the handle argument.
BUG=417532 Review URL: https://codereview.chromium.org/921913002 Cr-Commit-Position: refs/heads/master@{#316242}
Diffstat (limited to 'rlz')
-rw-r--r--rlz/win/lib/process_info.cc15
-rw-r--r--rlz/win/lib/registry_util.cc13
2 files changed, 12 insertions, 16 deletions
diff --git a/rlz/win/lib/process_info.cc b/rlz/win/lib/process_info.cc
index 4b83f38..8fc5565 100644
--- a/rlz/win/lib/process_info.cc
+++ b/rlz/win/lib/process_info.cc
@@ -9,7 +9,7 @@
#include <windows.h>
#include "base/memory/scoped_ptr.h"
-#include "base/process/process_handle.h"
+#include "base/process/process_info.h"
#include "base/strings/string16.h"
#include "base/win/scoped_handle.h"
#include "base/win/win_util.h"
@@ -100,12 +100,13 @@ bool ProcessInfo::HasAdminRights() {
has_rights = true;
} else if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
TOKEN_ELEVATION_TYPE elevation;
- base::IntegrityLevel level;
-
- if (SUCCEEDED(GetElevationType(&elevation)) &&
- base::GetProcessIntegrityLevel(base::GetCurrentProcessHandle(), &level))
- has_rights = (elevation == TokenElevationTypeFull) ||
- (level == base::HIGH_INTEGRITY);
+ if (SUCCEEDED(GetElevationType(&elevation))) {
+ base::IntegrityLevel level = base::GetCurrentProcessIntegrityLevel();
+ if (level != base::INTEGRITY_UNKNOWN) {
+ has_rights = (elevation == TokenElevationTypeFull) ||
+ (level == base::HIGH_INTEGRITY);
+ }
+ }
} else {
long group = 0;
if (GetUserGroup(&group))
diff --git a/rlz/win/lib/registry_util.cc b/rlz/win/lib/registry_util.cc
index 61197d2..8fba7dd 100644
--- a/rlz/win/lib/registry_util.cc
+++ b/rlz/win/lib/registry_util.cc
@@ -7,7 +7,7 @@
#include "rlz/win/lib/registry_util.h"
-#include "base/process/process_handle.h"
+#include "base/process/process_info.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h"
#include "base/win/windows_version.h"
@@ -58,15 +58,10 @@ bool HasUserKeyAccess(bool write_access) {
}
if (write_access) {
- if (base::win::GetVersion() < base::win::VERSION_VISTA) return true;
- base::ProcessHandle process_handle = base::GetCurrentProcessHandle();
- base::IntegrityLevel level = base::INTEGRITY_UNKNOWN;
+ if (base::win::GetVersion() < base::win::VERSION_VISTA)
+ return true;
- if (!base::GetProcessIntegrityLevel(process_handle, &level)) {
- ASSERT_STRING("UserKey::HasAccess: Cannot determine Integrity Level.");
- return false;
- }
- if (level <= base::LOW_INTEGRITY) {
+ if (base::GetCurrentProcessIntegrityLevel() <= base::LOW_INTEGRITY) {
ASSERT_STRING("UserKey::HasAccess: Cannot write from Low Integrity.");
return false;
}