OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Information about the current process. | 5 // Information about the current process. |
6 | 6 |
7 #include "rlz/win/lib/process_info.h" | 7 #include "rlz/win/lib/process_info.h" |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 #include <Sddl.h> // For ConvertSidToStringSid. | 10 #include <Sddl.h> // For ConvertSidToStringSid. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 if (!evaluated) { | 165 if (!evaluated) { |
166 if (IsRunningAsSystem()) { | 166 if (IsRunningAsSystem()) { |
167 has_rights = true; | 167 has_rights = true; |
168 } else if (base::win::GetVersion() >= base::win::VERSION_VISTA) { | 168 } else if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
169 TOKEN_ELEVATION_TYPE elevation; | 169 TOKEN_ELEVATION_TYPE elevation; |
170 base::IntegrityLevel level; | 170 base::IntegrityLevel level; |
171 | 171 |
172 if (SUCCEEDED(GetElevationType(&elevation)) && | 172 if (SUCCEEDED(GetElevationType(&elevation)) && |
173 base::GetProcessIntegrityLevel(base::GetCurrentProcessHandle(), &level)) | 173 base::GetProcessIntegrityLevel(base::GetCurrentProcessHandle(), &level)) |
174 has_rights = (elevation == TokenElevationTypeFull) || | 174 has_rights = (elevation == TokenElevationTypeFull) || |
175 (level == HIGH_INTEGRITY); | 175 (level == base::HIGH_INTEGRITY); |
176 } else { | 176 } else { |
177 long group = 0; | 177 long group = 0; |
178 if (GetUserGroup(&group)) | 178 if (GetUserGroup(&group)) |
179 has_rights = (group == DOMAIN_ALIAS_RID_ADMINS); | 179 has_rights = (group == DOMAIN_ALIAS_RID_ADMINS); |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 evaluated = true; | 183 evaluated = true; |
184 if (!has_rights) | 184 if (!has_rights) |
185 ASSERT_STRING("ProcessInfo::HasAdminRights: Does not have admin rights."); | 185 ASSERT_STRING("ProcessInfo::HasAdminRights: Does not have admin rights."); |
186 | 186 |
187 return has_rights; | 187 return has_rights; |
188 } | 188 } |
189 | 189 |
190 }; // namespace | 190 }; // namespace |
OLD | NEW |