OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "sandbox/win/src/process_mitigations.h" | 5 #include "sandbox/win/src/process_mitigations.h" |
6 | 6 |
7 #include <d3d9.h> | 7 #include <d3d9.h> |
8 #include <initguid.h> | 8 #include <initguid.h> |
9 #include <opmapi.h> | 9 #include <opmapi.h> |
10 #include <psapi.h> | 10 #include <psapi.h> |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 (MEM_EXECUTE_OPTION_DISABLE | MEM_EXECUTE_OPTION_PERMANENT)) { | 941 (MEM_EXECUTE_OPTION_DISABLE | MEM_EXECUTE_OPTION_PERMANENT)) { |
942 return SBOX_TEST_FOURTH_ERROR; | 942 return SBOX_TEST_FOURTH_ERROR; |
943 } | 943 } |
944 } | 944 } |
945 | 945 |
946 return SBOX_TEST_SUCCEEDED; | 946 return SBOX_TEST_SUCCEEDED; |
947 } | 947 } |
948 | 948 |
949 #if !defined(_WIN64) // DEP is always enabled on 64-bit. | 949 #if !defined(_WIN64) // DEP is always enabled on 64-bit. |
950 TEST(ProcessMitigationsTest, CheckDep) { | 950 TEST(ProcessMitigationsTest, CheckDep) { |
951 if (base::win::GetVersion() > base::win::VERSION_WIN7) | 951 if (base::win::GetVersion() >= base::win::VERSION_WIN8) |
952 return; | 952 return; |
953 | 953 |
954 TestRunner runner; | 954 TestRunner runner; |
955 sandbox::TargetPolicy* policy = runner.GetPolicy(); | 955 sandbox::TargetPolicy* policy = runner.GetPolicy(); |
956 | 956 |
957 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_DEP | | 957 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_DEP | |
958 MITIGATION_DEP_NO_ATL_THUNK | | 958 MITIGATION_DEP_NO_ATL_THUNK | |
959 MITIGATION_SEHOP), | 959 MITIGATION_SEHOP), |
960 SBOX_ALL_OK); | 960 SBOX_ALL_OK); |
961 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDep")); | 961 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckDep")); |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 cmd = cmd.Append(L"calc.exe"); | 1805 cmd = cmd.Append(L"calc.exe"); |
1806 | 1806 |
1807 std::wstring test_command(base::StringPrintf(L"TestChildProcess %ls 0x%08X", | 1807 std::wstring test_command(base::StringPrintf(L"TestChildProcess %ls 0x%08X", |
1808 cmd.value().c_str(), | 1808 cmd.value().c_str(), |
1809 STATUS_ACCESS_VIOLATION)); | 1809 STATUS_ACCESS_VIOLATION)); |
1810 | 1810 |
1811 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(test_command.c_str())); | 1811 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(test_command.c_str())); |
1812 } | 1812 } |
1813 | 1813 |
1814 } // namespace sandbox | 1814 } // namespace sandbox |
OLD | NEW |