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

Side by Side Diff: sandbox/tests/validation_tests/commands.cc

Issue 757001: Second round of sbox changes for 64 bit port... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sandbox/src/sharedmem_ipc_server.cc ('k') | sandbox/tests/validation_tests/suite.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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 <windows.h> 5 #include <windows.h>
6 #include <string> 6 #include <string>
7 7
8 #include "sandbox/tests/validation_tests/commands.h" 8 #include "sandbox/tests/validation_tests/commands.h"
9 9
10 #include "sandbox/tests/common/controller.h" 10 #include "sandbox/tests/common/controller.h"
11 11
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 return TestValidWindow(window); 80 return TestValidWindow(window);
81 } 81 }
82 82
83 int TestValidWindow(HWND window) { 83 int TestValidWindow(HWND window) {
84 if (::IsWindow(window)) 84 if (::IsWindow(window))
85 return SBOX_TEST_SUCCEEDED; 85 return SBOX_TEST_SUCCEEDED;
86 86
87 return SBOX_TEST_DENIED; 87 return SBOX_TEST_DENIED;
88 } 88 }
89 89
90 SBOX_TESTS_COMMAND int OpenProcess(int argc, wchar_t **argv) { 90 SBOX_TESTS_COMMAND int OpenProcessCmd(int argc, wchar_t **argv) {
91 if (1 != argc) 91 if (1 != argc)
92 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; 92 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
93 93
94 DWORD process_id = _wtoi(argv[0]); 94 DWORD process_id = _wtoi(argv[0]);
95
96 return TestOpenProcess(process_id); 95 return TestOpenProcess(process_id);
97 } 96 }
98 97
99 int TestOpenProcess(DWORD process_id) { 98 int TestOpenProcess(DWORD process_id) {
100 HANDLE process = ::OpenProcess(PROCESS_VM_READ, 99 HANDLE process = ::OpenProcess(PROCESS_VM_READ,
101 FALSE, // Do not inherit handle. 100 FALSE, // Do not inherit handle.
102 process_id); 101 process_id);
103 if (NULL == process) { 102 if (NULL == process) {
104 if (ERROR_ACCESS_DENIED == ::GetLastError()) { 103 if (ERROR_ACCESS_DENIED == ::GetLastError()) {
105 return SBOX_TEST_DENIED; 104 return SBOX_TEST_DENIED;
106 } else { 105 } else {
107 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; 106 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
108 } 107 }
109 } else { 108 } else {
110 ::CloseHandle(process); 109 ::CloseHandle(process);
111 return SBOX_TEST_SUCCEEDED; 110 return SBOX_TEST_SUCCEEDED;
112 } 111 }
113 } 112 }
114 113
115 SBOX_TESTS_COMMAND int OpenThread(int argc, wchar_t **argv) { 114 SBOX_TESTS_COMMAND int OpenThreadCmd(int argc, wchar_t **argv) {
116 if (1 != argc) 115 if (1 != argc)
117 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; 116 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
118 117
119 DWORD thread_id = _wtoi(argv[0]); 118 DWORD thread_id = _wtoi(argv[0]);
120
121 return TestOpenThread(thread_id); 119 return TestOpenThread(thread_id);
122 } 120 }
123 121
124 int TestOpenThread(DWORD thread_id) { 122 int TestOpenThread(DWORD thread_id) {
125 123
126 HANDLE thread = ::OpenThread(THREAD_QUERY_INFORMATION, 124 HANDLE thread = ::OpenThread(THREAD_QUERY_INFORMATION,
127 FALSE, // Do not inherit handles. 125 FALSE, // Do not inherit handles.
128 thread_id); 126 thread_id);
129 127
130 if (NULL == thread) { 128 if (NULL == thread) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 if (NULL == sbox_desk) { 243 if (NULL == sbox_desk) {
246 return SBOX_TEST_FAILED; 244 return SBOX_TEST_FAILED;
247 } 245 }
248 if (::SwitchDesktop(sbox_desk)) { 246 if (::SwitchDesktop(sbox_desk)) {
249 return SBOX_TEST_SUCCEEDED; 247 return SBOX_TEST_SUCCEEDED;
250 } 248 }
251 return SBOX_TEST_DENIED; 249 return SBOX_TEST_DENIED;
252 } 250 }
253 251
254 } // namespace sandbox 252 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/src/sharedmem_ipc_server.cc ('k') | sandbox/tests/validation_tests/suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698