Files
cef/cef3/patch/patches/sandbox_1011.patch
Marshall Greenblatt 7ab98f71da Fix svn:eol-style property.
git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1453@1473 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2013-10-18 16:59:40 +00:00

30 lines
1.2 KiB
Diff

Index: sandbox_win.cc
===================================================================
--- sandbox_win.cc (revision 202711)
+++ sandbox_win.cc (working copy)
@@ -589,8 +589,23 @@
cmd_line->AppendArg(base::StringPrintf("/prefetch:%d", base::Hash(type_str)));
if (!in_sandbox) {
+ base::LaunchOptions options = base::LaunchOptions();
base::ProcessHandle process = 0;
- base::LaunchProcess(*cmd_line, base::LaunchOptions(), &process);
+
+ static HANDLE hJobObject = NULL;
+ JOBOBJECT_BASIC_LIMIT_INFORMATION jblinfo = {0};
+ // Create an object for child processes only if the current job allows this,
+ // otherwise CreateProcess with CREATE_BREAKAWAY_FROM_JOB will fail with 'access denied'.
+ bool createObject = !hJobObject &&
+ (!::QueryInformationJobObject(NULL, JobObjectBasicLimitInformation, &jblinfo, sizeof(jblinfo), NULL) ||
+ (jblinfo.LimitFlags & JOB_OBJECT_LIMIT_BREAKAWAY_OK));
+ if (createObject) {
+ hJobObject = CreateJobObject(NULL, NULL);
+ base::SetJobObjectAsKillOnJobClose(hJobObject);
+ }
+ options.job_handle = hJobObject;
+
+ base::LaunchProcess(*cmd_line, options, &process);
g_broker_services->AddTargetPeer(process);
return process;
}