Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Unified Diff: sandbox/win/src/process_policy_test.cc

Issue 92173002: Merge 237541 "Revert of https://codereview.chromium.org/71013004/" (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1721/src/
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/win/src/policy_target_test.cc ('k') | sandbox/win/src/restricted_token_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/win/src/process_policy_test.cc
===================================================================
--- sandbox/win/src/process_policy_test.cc (revision 237598)
+++ sandbox/win/src/process_policy_test.cc (working copy)
@@ -50,12 +50,8 @@
// Create the process with the unicode version of the API.
sandbox::SboxTestResult ret1 = sandbox::SBOX_TEST_FAILED;
- PROCESS_INFORMATION temp_process_info = {};
- if (::CreateProcessW(exe_name, const_cast<wchar_t*>(cmd_line), NULL, NULL,
- FALSE, 0, NULL, NULL, &si, &temp_process_info)) {
- pi.Set(temp_process_info);
- ret1 = sandbox::SBOX_TEST_SUCCEEDED;
- } else {
+ if (!::CreateProcessW(exe_name, const_cast<wchar_t*>(cmd_line), NULL, NULL,
+ FALSE, 0, NULL, NULL, &si, pi.Receive())) {
DWORD last_error = GetLastError();
if ((ERROR_NOT_ENOUGH_QUOTA == last_error) ||
(ERROR_ACCESS_DENIED == last_error) ||
@@ -64,6 +60,8 @@
} else {
ret1 = sandbox::SBOX_TEST_FAILED;
}
+ } else {
+ ret1 = sandbox::SBOX_TEST_SUCCEEDED;
}
pi.Close();
@@ -75,13 +73,10 @@
std::string narrow_cmd_line;
if (cmd_line)
narrow_cmd_line = base::SysWideToMultiByte(cmd_line, CP_UTF8);
- if (::CreateProcessA(
+ if (!::CreateProcessA(
exe_name ? base::SysWideToMultiByte(exe_name, CP_UTF8).c_str() : NULL,
cmd_line ? const_cast<char*>(narrow_cmd_line.c_str()) : NULL,
- NULL, NULL, FALSE, 0, NULL, NULL, &sia, &temp_process_info)) {
- pi.Set(temp_process_info);
- ret2 = sandbox::SBOX_TEST_SUCCEEDED;
- } else {
+ NULL, NULL, FALSE, 0, NULL, NULL, &sia, pi.Receive())) {
DWORD last_error = GetLastError();
if ((ERROR_NOT_ENOUGH_QUOTA == last_error) ||
(ERROR_ACCESS_DENIED == last_error) ||
@@ -90,6 +85,8 @@
} else {
ret2 = sandbox::SBOX_TEST_FAILED;
}
+ } else {
+ ret2 = sandbox::SBOX_TEST_SUCCEEDED;
}
if (ret1 == ret2)
@@ -218,14 +215,13 @@
string16 path = MakeFullPathToSystem32(argv[0]);
+ base::win::ScopedProcessInformation pi;
STARTUPINFOW si = {sizeof(si)};
- PROCESS_INFORMATION temp_process_info = {};
if (!::CreateProcessW(path.c_str(), NULL, NULL, NULL, FALSE, CREATE_SUSPENDED,
- NULL, NULL, &si, &temp_process_info)) {
+ NULL, NULL, &si, pi.Receive())) {
return SBOX_TEST_FAILED;
}
- base::win::ScopedProcessInformation pi(temp_process_info);
HANDLE token = NULL;
BOOL result =
« no previous file with comments | « sandbox/win/src/policy_target_test.cc ('k') | sandbox/win/src/restricted_token_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698