| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <initguid.h> | 5 #include <initguid.h> |
| 6 #include <d3d9.h> | 6 #include <d3d9.h> |
| 7 #include <Opmapi.h> | 7 #include <Opmapi.h> |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 ProcessExtensionPointDisablePolicy, | 92 ProcessExtensionPointDisablePolicy, |
| 93 &policy, sizeof(policy))) { | 93 &policy, sizeof(policy))) { |
| 94 return false; | 94 return false; |
| 95 } | 95 } |
| 96 return policy.DisableExtensionPoints; | 96 return policy.DisableExtensionPoints; |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool CheckWin10FontPolicy() { | 99 bool CheckWin10FontPolicy() { |
| 100 PROCESS_MITIGATION_FONT_DISABLE_POLICY policy = {}; | 100 PROCESS_MITIGATION_FONT_DISABLE_POLICY policy = {}; |
| 101 if (!get_process_mitigation_policy(::GetCurrentProcess(), | 101 if (!get_process_mitigation_policy(::GetCurrentProcess(), |
| 102 ProcessFontDisablePolicy, &policy, | 102 ProcessDynamicCodePolicy, &policy, |
| 103 sizeof(policy))) { | 103 sizeof(policy))) { |
| 104 return false; | 104 return false; |
| 105 } | 105 } |
| 106 return policy.DisableNonSystemFonts; | 106 return policy.DisableNonSystemFonts; |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool CheckWin10ImageLoadNoRemotePolicy() { | 109 bool CheckWin10ImageLoadNoRemotePolicy() { |
| 110 PROCESS_MITIGATION_IMAGE_LOAD_POLICY policy = {}; | 110 PROCESS_MITIGATION_ASLR_POLICY policy = {}; |
| 111 if (!get_process_mitigation_policy(::GetCurrentProcess(), | 111 if (!get_process_mitigation_policy(::GetCurrentProcess(), |
| 112 ProcessImageLoadPolicy, &policy, | 112 ProcessImageLoadPolicy, &policy, |
| 113 sizeof(policy))) { | 113 sizeof(policy))) { |
| 114 return false; | 114 return false; |
| 115 } | 115 } |
| 116 return policy.NoRemoteImages; | 116 return policy.NoRemoteImages; |
| 117 } | 117 } |
| 118 | 118 |
| 119 void TestWin10ImageLoadRemote(bool is_success_test) { | 119 void TestWin10ImageLoadRemote(bool is_success_test) { |
| 120 // ***Insert your manual testing share UNC path here! | 120 // ***Insert your manual testing share UNC path here! |
| (...skipping 16 matching lines...) Expand all Loading... |
| 137 } | 137 } |
| 138 | 138 |
| 139 std::wstring test = L"TestChildProcess "; | 139 std::wstring test = L"TestChildProcess "; |
| 140 test += unc.c_str(); | 140 test += unc.c_str(); |
| 141 EXPECT_EQ((is_success_test ? sandbox::SBOX_TEST_SUCCEEDED | 141 EXPECT_EQ((is_success_test ? sandbox::SBOX_TEST_SUCCEEDED |
| 142 : sandbox::SBOX_TEST_FAILED), | 142 : sandbox::SBOX_TEST_FAILED), |
| 143 runner.RunTest(test.c_str())); | 143 runner.RunTest(test.c_str())); |
| 144 } | 144 } |
| 145 | 145 |
| 146 bool CheckWin10ImageLoadNoLowLabelPolicy() { | 146 bool CheckWin10ImageLoadNoLowLabelPolicy() { |
| 147 PROCESS_MITIGATION_IMAGE_LOAD_POLICY policy = {}; | 147 PROCESS_MITIGATION_ASLR_POLICY policy = {}; |
| 148 if (!get_process_mitigation_policy(::GetCurrentProcess(), | 148 if (!get_process_mitigation_policy(::GetCurrentProcess(), |
| 149 ProcessImageLoadPolicy, &policy, | 149 ProcessImageLoadPolicy, &policy, |
| 150 sizeof(policy))) { | 150 sizeof(policy))) { |
| 151 return false; | 151 return false; |
| 152 } | 152 } |
| 153 return policy.NoLowMandatoryLabelImages; | 153 return policy.NoLowMandatoryLabelImages; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void TestWin10ImageLoadLowLabel(bool is_success_test) { | 156 void TestWin10ImageLoadLowLabel(bool is_success_test) { |
| 157 // Setup a mandatory low executable for this test (calc.exe). | 157 // Setup a mandatory low executable for this test (calc.exe). |
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 cmd = cmd.Append(L"calc.exe"); | 1340 cmd = cmd.Append(L"calc.exe"); |
| 1341 | 1341 |
| 1342 std::wstring test_command(base::StringPrintf(L"TestChildProcess %ls 0x%08X", | 1342 std::wstring test_command(base::StringPrintf(L"TestChildProcess %ls 0x%08X", |
| 1343 cmd.value().c_str(), | 1343 cmd.value().c_str(), |
| 1344 STATUS_ACCESS_VIOLATION)); | 1344 STATUS_ACCESS_VIOLATION)); |
| 1345 | 1345 |
| 1346 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(test_command.c_str())); | 1346 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(test_command.c_str())); |
| 1347 } | 1347 } |
| 1348 | 1348 |
| 1349 } // namespace sandbox | 1349 } // namespace sandbox |
| OLD | NEW |