OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/process_util.h" | 5 #include "base/process_util.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <io.h> | 8 #include <io.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #include <userenv.h> | 10 #include <userenv.h> |
11 #include <psapi.h> | 11 #include <psapi.h> |
12 | 12 |
13 #include <ios> | 13 #include <ios> |
14 | 14 |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/debug_util.h" | 16 #include "base/debug_util.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
19 #include "base/scoped_handle_win.h" | 19 #include "base/scoped_handle_win.h" |
20 #include "base/scoped_ptr.h" | 20 #include "base/scoped_ptr.h" |
21 #include "base/win_util.h" | 21 #include "base/win/windows_version.h" |
22 | 22 |
23 // userenv.dll is required for CreateEnvironmentBlock(). | 23 // userenv.dll is required for CreateEnvironmentBlock(). |
24 #pragma comment(lib, "userenv.lib") | 24 #pragma comment(lib, "userenv.lib") |
25 | 25 |
26 namespace base { | 26 namespace base { |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 // System pagesize. This value remains constant on x86/64 architectures. | 30 // System pagesize. This value remains constant on x86/64 architectures. |
31 const int PAGESIZE_KB = 4; | 31 const int PAGESIZE_KB = 4; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 // We're screwed. | 149 // We're screwed. |
150 NOTREACHED(); | 150 NOTREACHED(); |
151 return 0; | 151 return 0; |
152 } | 152 } |
153 | 153 |
154 bool GetProcessIntegrityLevel(ProcessHandle process, IntegrityLevel *level) { | 154 bool GetProcessIntegrityLevel(ProcessHandle process, IntegrityLevel *level) { |
155 if (!level) | 155 if (!level) |
156 return false; | 156 return false; |
157 | 157 |
158 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) | 158 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
159 return false; | 159 return false; |
160 | 160 |
161 HANDLE process_token; | 161 HANDLE process_token; |
162 if (!OpenProcessToken(process, TOKEN_QUERY | TOKEN_QUERY_SOURCE, | 162 if (!OpenProcessToken(process, TOKEN_QUERY | TOKEN_QUERY_SOURCE, |
163 &process_token)) | 163 &process_token)) |
164 return false; | 164 return false; |
165 | 165 |
166 ScopedHandle scoped_process_token(process_token); | 166 ScopedHandle scoped_process_token(process_token); |
167 | 167 |
168 DWORD token_info_length = 0; | 168 DWORD token_info_length = 0; |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 | 887 |
888 PERFORMANCE_INFORMATION info; | 888 PERFORMANCE_INFORMATION info; |
889 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { | 889 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { |
890 LOG(ERROR) << "Failed to fetch internal performance info."; | 890 LOG(ERROR) << "Failed to fetch internal performance info."; |
891 return 0; | 891 return 0; |
892 } | 892 } |
893 return (info.CommitTotal * system_info.dwPageSize) / 1024; | 893 return (info.CommitTotal * system_info.dwPageSize) / 1024; |
894 } | 894 } |
895 | 895 |
896 } // namespace base | 896 } // namespace base |
OLD | NEW |