summaryrefslogtreecommitdiffstats
path: root/base/process_util_win.cc
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-11-01 12:19:54 +0000
committerIain Merrick <husky@google.com>2010-11-03 10:21:10 +0000
commit731df977c0511bca2206b5f333555b1205ff1f43 (patch)
tree0e750b949b3f00a1ac11fda25d3c2de512f2b465 /base/process_util_win.cc
parent5add15e10e7bb80512f2c597ca57221314abe577 (diff)
downloadexternal_chromium-731df977c0511bca2206b5f333555b1205ff1f43.zip
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.gz
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.bz2
Merge Chromium at r63472 : Initial merge by git.
Change-Id: Ifb9ee821af006a5f2211e81471be93ae440a1f5a
Diffstat (limited to 'base/process_util_win.cc')
-rw-r--r--base/process_util_win.cc27
1 files changed, 19 insertions, 8 deletions
diff --git a/base/process_util_win.cc b/base/process_util_win.cc
index c5d7790..92077b1 100644
--- a/base/process_util_win.cc
+++ b/base/process_util_win.cc
@@ -14,11 +14,11 @@
#include "base/command_line.h"
#include "base/debug_util.h"
-#include "base/histogram.h"
#include "base/logging.h"
-#include "base/scoped_handle_win.h"
+#include "base/metrics/histogram.h"
#include "base/scoped_ptr.h"
-#include "base/win_util.h"
+#include "base/win/scoped_handle.h"
+#include "base/win/windows_version.h"
// userenv.dll is required for CreateEnvironmentBlock().
#pragma comment(lib, "userenv.lib")
@@ -47,7 +47,6 @@ long WINAPI StackDumpExceptionFilter(EXCEPTION_POINTERS* info) {
}
// Connects back to a console if available.
-// Only necessary on Windows, no-op on other platforms.
void AttachToConsole() {
if (!AttachConsole(ATTACH_PARENT_PROCESS)) {
unsigned int result = GetLastError();
@@ -119,6 +118,18 @@ bool OpenPrivilegedProcessHandle(ProcessId pid, ProcessHandle* handle) {
return true;
}
+bool OpenProcessHandleWithAccess(ProcessId pid,
+ uint32 access_flags,
+ ProcessHandle* handle) {
+ ProcessHandle result = OpenProcess(access_flags, FALSE, pid);
+
+ if (result == INVALID_HANDLE_VALUE)
+ return false;
+
+ *handle = result;
+ return true;
+}
+
void CloseProcessHandle(ProcessHandle process) {
CloseHandle(process);
}
@@ -144,7 +155,7 @@ bool GetProcessIntegrityLevel(ProcessHandle process, IntegrityLevel *level) {
if (!level)
return false;
- if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA)
+ if (base::win::GetVersion() < base::win::VERSION_VISTA)
return false;
HANDLE process_token;
@@ -152,7 +163,7 @@ bool GetProcessIntegrityLevel(ProcessHandle process, IntegrityLevel *level) {
&process_token))
return false;
- ScopedHandle scoped_process_token(process_token);
+ base::win::ScopedHandle scoped_process_token(process_token);
DWORD token_info_length = 0;
if (GetTokenInformation(process_token, TokenIntegrityLevel, NULL, 0,
@@ -315,8 +326,8 @@ bool GetAppOutput(const CommandLine& cl, std::string* output) {
}
// Ensure we don't leak the handles.
- ScopedHandle scoped_out_read(out_read);
- ScopedHandle scoped_out_write(out_write);
+ base::win::ScopedHandle scoped_out_read(out_read);
+ base::win::ScopedHandle scoped_out_write(out_write);
// Ensure the read handle to the pipe for STDOUT is not inherited.
if (!SetHandleInformation(out_read, HANDLE_FLAG_INHERIT, 0)) {