summaryrefslogtreecommitdiffstats
path: root/sandbox/win/src/target_process.cc
diff options
context:
space:
mode:
authorjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-28 02:12:54 +0000
committerjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-28 02:12:54 +0000
commit210f33c82b462ce93d8f26843c244ed0ff0b971c (patch)
tree1cf6fa361ac896d02f9fb81c4bae422caaf8a16a /sandbox/win/src/target_process.cc
parent2d91c0336cf6097e9d87d8999c95b3fadbe0c084 (diff)
downloadchromium_src-210f33c82b462ce93d8f26843c244ed0ff0b971c.zip
chromium_src-210f33c82b462ce93d8f26843c244ed0ff0b971c.tar.gz
chromium_src-210f33c82b462ce93d8f26843c244ed0ff0b971c.tar.bz2
Move STARTUPINFO manipulation into SpawnTarget
Review URL: https://chromiumcodereview.appspot.com/10878071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153606 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/win/src/target_process.cc')
-rw-r--r--sandbox/win/src/target_process.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/sandbox/win/src/target_process.cc b/sandbox/win/src/target_process.cc
index 074a483..7d75fd6 100644
--- a/sandbox/win/src/target_process.cc
+++ b/sandbox/win/src/target_process.cc
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/win/pe_image.h"
+#include "base/win/startup_information.h"
#include "base/win/windows_version.h"
#include "sandbox/win/src/crosscall_server.h"
#include "sandbox/win/src/crosscall_client.h"
@@ -130,29 +131,26 @@ TargetProcess::~TargetProcess() {
// object.
DWORD TargetProcess::Create(const wchar_t* exe_path,
const wchar_t* command_line,
- const wchar_t* desktop,
+ const base::win::StartupInformation& startup_info,
base::win::ScopedProcessInformation* target_info) {
exe_name_.reset(_wcsdup(exe_path));
// the command line needs to be writable by CreateProcess().
scoped_ptr_malloc<wchar_t> cmd_line(_wcsdup(command_line));
- scoped_ptr_malloc<wchar_t> desktop_name(desktop ? _wcsdup(desktop) : NULL);
// Start the target process suspended.
DWORD flags =
CREATE_SUSPENDED | CREATE_UNICODE_ENVIRONMENT | DETACHED_PROCESS;
+ if (startup_info.has_extended_startup_info())
+ flags |= EXTENDED_STARTUPINFO_PRESENT;
+
if (base::win::GetVersion() < base::win::VERSION_WIN8) {
// Windows 8 implements nested jobs, but for older systems we need to
// break out of any job we're in to enforce our restrictions.
flags |= CREATE_BREAKAWAY_FROM_JOB;
}
- STARTUPINFO startup_info = {sizeof(STARTUPINFO)};
- if (desktop) {
- startup_info.lpDesktop = desktop_name.get();
- }
-
base::win::ScopedProcessInformation process_info;
if (!::CreateProcessAsUserW(lockdown_token_,
@@ -164,7 +162,7 @@ DWORD TargetProcess::Create(const wchar_t* exe_path,
flags,
NULL, // Use the environment of the caller.
NULL, // Use current directory of the caller.
- &startup_info,
+ startup_info.startup_info(),
process_info.Receive())) {
return ::GetLastError();
}