OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <Aclapi.h> | 5 #include <Aclapi.h> |
6 #include <windows.h> | 6 #include <windows.h> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "sandbox/win/tests/validation_tests/commands.h" | 9 #include "sandbox/win/tests/validation_tests/commands.h" |
10 | 10 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 HDESK desktop = ::GetThreadDesktop(::GetCurrentThreadId()); | 260 HDESK desktop = ::GetThreadDesktop(::GetCurrentThreadId()); |
261 if (desktop) { | 261 if (desktop) { |
262 HANDLE test_handle; | 262 HANDLE test_handle; |
263 if (::DuplicateHandle(::GetCurrentProcess(), desktop, | 263 if (::DuplicateHandle(::GetCurrentProcess(), desktop, |
264 ::GetCurrentProcess(), &test_handle, | 264 ::GetCurrentProcess(), &test_handle, |
265 WRITE_DAC, FALSE, 0)) { | 265 WRITE_DAC, FALSE, 0)) { |
266 DWORD result = ::SetSecurityInfo(test_handle, SE_WINDOW_OBJECT, | 266 DWORD result = ::SetSecurityInfo(test_handle, SE_WINDOW_OBJECT, |
267 DACL_SECURITY_INFORMATION, NULL, NULL, | 267 DACL_SECURITY_INFORMATION, NULL, NULL, |
268 NULL, NULL); | 268 NULL, NULL); |
269 ::CloseHandle(test_handle); | 269 ::CloseHandle(test_handle); |
270 if (result != ERROR_ACCESS_DENIED) { | 270 if (result == ERROR_SUCCESS) { |
271 return SBOX_TEST_SUCCEEDED; | 271 return SBOX_TEST_SUCCEEDED; |
272 } | 272 } |
273 } else if (::GetLastError() != ERROR_ACCESS_DENIED) { | 273 } else if (::GetLastError() != ERROR_ACCESS_DENIED) { |
274 return SBOX_TEST_FAILED; | 274 return SBOX_TEST_FAILED; |
275 } | 275 } |
276 } | 276 } |
277 | 277 |
278 // Open by name with WRITE_DAC. | 278 // Open by name with WRITE_DAC. |
279 desktop = ::OpenDesktop(desktop_name, 0, FALSE, WRITE_DAC); | 279 desktop = ::OpenDesktop(desktop_name, 0, FALSE, WRITE_DAC); |
280 if (desktop || ::GetLastError() != ERROR_ACCESS_DENIED) { | 280 if (desktop || ::GetLastError() != ERROR_ACCESS_DENIED) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 324 } |
325 | 325 |
326 if (!::VirtualFree(memory, 0, MEM_RELEASE)) | 326 if (!::VirtualFree(memory, 0, MEM_RELEASE)) |
327 return SBOX_TEST_FAILED; | 327 return SBOX_TEST_FAILED; |
328 | 328 |
329 return SBOX_TEST_SUCCEEDED; | 329 return SBOX_TEST_SUCCEEDED; |
330 } | 330 } |
331 | 331 |
332 | 332 |
333 } // namespace sandbox | 333 } // namespace sandbox |
OLD | NEW |