summaryrefslogtreecommitdiffstats
path: root/rlz
diff options
context:
space:
mode:
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;
}