Revert 285458 "Disable exceptions on Windows in all builds (take 3)"
[chromium-blink-merge.git] / sandbox / win / BUILD.gn
blob3c5bca61001cea3c08156bd169d8df054f305ac2
1 # Copyright 2014 The Chromium Authors. All rights reserved.\r
2 # Use of this source code is governed by a BSD-style license that can be\r
3 # found in the LICENSE file.\r
4 \r
5 source_set("sandbox") {\r
6   sources = [\r
7     "src/acl.cc",\r
8     "src/acl.h",\r
9     "src/app_container.cc",\r
10     "src/app_container.h",\r
11     "src/broker_services.cc",\r
12     "src/broker_services.h",\r
13     "src/crosscall_client.h",\r
14     "src/crosscall_params.h",\r
15     "src/crosscall_server.cc",\r
16     "src/crosscall_server.h",\r
17     "src/eat_resolver.cc",\r
18     "src/eat_resolver.h",\r
19     "src/filesystem_dispatcher.cc",\r
20     "src/filesystem_dispatcher.h",\r
21     "src/filesystem_interception.cc",\r
22     "src/filesystem_interception.h",\r
23     "src/filesystem_policy.cc",\r
24     "src/filesystem_policy.h",\r
25     "src/handle_closer.cc",\r
26     "src/handle_closer.h",\r
27     "src/handle_closer_agent.cc",\r
28     "src/handle_closer_agent.h",\r
29     "src/handle_dispatcher.cc",\r
30     "src/handle_dispatcher.h",\r
31     "src/handle_interception.cc",\r
32     "src/handle_interception.h",\r
33     "src/handle_policy.cc",\r
34     "src/handle_policy.h",\r
35     "src/handle_table.cc",\r
36     "src/handle_table.h",\r
37     "src/interception.cc",\r
38     "src/interception.h",\r
39     "src/interception_agent.cc",\r
40     "src/interception_agent.h",\r
41     "src/interception_internal.h",\r
42     "src/interceptors.h",\r
43     "src/internal_types.h",\r
44     "src/ipc_tags.h",\r
45     "src/job.cc",\r
46     "src/job.h",\r
47     "src/named_pipe_dispatcher.cc",\r
48     "src/named_pipe_dispatcher.h",\r
49     "src/named_pipe_interception.cc",\r
50     "src/named_pipe_interception.h",\r
51     "src/named_pipe_policy.cc",\r
52     "src/named_pipe_policy.h",\r
53     "src/nt_internals.h",\r
54     "src/policy_broker.cc",\r
55     "src/policy_broker.h",\r
56     "src/policy_engine_opcodes.cc",\r
57     "src/policy_engine_opcodes.h",\r
58     "src/policy_engine_params.h",\r
59     "src/policy_engine_processor.cc",\r
60     "src/policy_engine_processor.h",\r
61     "src/policy_low_level.cc",\r
62     "src/policy_low_level.h",\r
63     "src/policy_params.h",\r
64     "src/policy_target.cc",\r
65     "src/policy_target.h",\r
66     "src/process_mitigations.cc",\r
67     "src/process_mitigations.h",\r
68     "src/process_thread_dispatcher.cc",\r
69     "src/process_thread_dispatcher.h",\r
70     "src/process_thread_interception.cc",\r
71     "src/process_thread_interception.h",\r
72     "src/process_thread_policy.cc",\r
73     "src/process_thread_policy.h",\r
74     "src/registry_dispatcher.cc",\r
75     "src/registry_dispatcher.h",\r
76     "src/registry_interception.cc",\r
77     "src/registry_interception.h",\r
78     "src/registry_policy.cc",\r
79     "src/registry_policy.h",\r
80     "src/resolver.cc",\r
81     "src/resolver.h",\r
82     "src/restricted_token_utils.cc",\r
83     "src/restricted_token_utils.h",\r
84     "src/restricted_token.cc",\r
85     "src/restricted_token.h",\r
86     "src/sandbox_factory.h",\r
87     "src/sandbox_globals.cc",\r
88     "src/sandbox_nt_types.h",\r
89     "src/sandbox_nt_util.cc",\r
90     "src/sandbox_nt_util.h",\r
91     "src/sandbox_policy_base.cc",\r
92     "src/sandbox_policy_base.h",\r
93     "src/sandbox_policy.h",\r
94     "src/sandbox_types.h",\r
95     "src/sandbox_utils.cc",\r
96     "src/sandbox_utils.h",\r
97     "src/sandbox.cc",\r
98     "src/sandbox.h",\r
99     "src/security_level.h",\r
100     "src/service_resolver.cc",\r
101     "src/service_resolver.h",\r
102     "src/shared_handles.cc",\r
103     "src/shared_handles.h",\r
104     "src/sharedmem_ipc_client.cc",\r
105     "src/sharedmem_ipc_client.h",\r
106     "src/sharedmem_ipc_server.cc",\r
107     "src/sharedmem_ipc_server.h",\r
108     "src/sid.cc",\r
109     "src/sid.h",\r
110     "src/sync_dispatcher.cc",\r
111     "src/sync_dispatcher.h",\r
112     "src/sync_interception.cc",\r
113     "src/sync_interception.h",\r
114     "src/sync_policy.cc",\r
115     "src/sync_policy.h",\r
116     "src/target_interceptions.cc",\r
117     "src/target_interceptions.h",\r
118     "src/target_process.cc",\r
119     "src/target_process.h",\r
120     "src/target_services.cc",\r
121     "src/target_services.h",\r
122     "src/win_utils.cc",\r
123     "src/win_utils.h",\r
124     "src/win2k_threadpool.cc",\r
125     "src/win2k_threadpool.h",\r
126     "src/window.cc",\r
127     "src/window.h",\r
128   ]\r
130   if (cpu_arch == "x64" ){\r
131     sources += [\r
132       "src/interceptors_64.cc",\r
133       "src/interceptors_64.h",\r
134       "src/resolver_64.cc",\r
135       "src/service_resolver_64.cc",\r
136       "src/Wow64_64.cc",\r
137     ]\r
138   } else if (cpu_arch == "x86") {\r
139     sources += [\r
140       "src/resolver_32.cc",\r
141       "src/service_resolver_32.cc",\r
142       "src/sidestep_resolver.cc",\r
143       "src/sidestep_resolver.h",\r
144       "src/sidestep/ia32_modrm_map.cpp",\r
145       "src/sidestep/ia32_opcode_map.cpp",\r
146       "src/sidestep/mini_disassembler_types.h",\r
147       "src/sidestep/mini_disassembler.cpp",\r
148       "src/sidestep/mini_disassembler.h",\r
149       "src/sidestep/preamble_patcher_with_stub.cpp",\r
150       "src/sidestep/preamble_patcher.h",\r
151       "src/Wow64.cc",\r
152       "src/Wow64.h",\r
153     ]\r
154   }\r
156   deps = [\r
157     ":copy_wow_helper",\r
158     "//base",\r
159   ]\r
162 if (cpu_arch == "x86") {\r
163   # Make a target that copies the wow_helper files to the out dir.\r
164   #\r
165   # TODO(brettw) we can probably just build this now that we have proper\r
166   # toolchain support.\r
167   copy("copy_wow_helper") {\r
168     sources = [\r
169       "wow_helper/wow_helper.exe",\r
170       "wow_helper/wow_helper.pdb",\r
171     ]\r
172     outputs = [ "$root_out_dir/{{source_file_part}}" ]\r
173   }\r
176 test("sbox_integration_tests") {\r
177   sources = [\r
178     "src/app_container_test.cc",\r
179     "src/file_policy_test.cc",\r
180     "src/handle_inheritance_test.cc",\r
181     "src/handle_policy_test.cc",\r
182     "tests/integration_tests/integration_tests_test.cc",\r
183     "src/handle_closer_test.cc",\r
184     "src/integrity_level_test.cc",\r
185     "src/ipc_ping_test.cc",\r
186     "src/named_pipe_policy_test.cc",\r
187     "src/policy_target_test.cc",\r
188     "src/process_mitigations_test.cc",\r
189     "src/process_policy_test.cc",\r
190     "src/registry_policy_test.cc",\r
191     "src/sync_policy_test.cc",\r
192     "src/sync_policy_test.h",\r
193     "src/unload_dll_test.cc",\r
194     "tests/common/controller.cc",\r
195     "tests/common/controller.h",\r
196     "tests/common/test_utils.cc",\r
197     "tests/common/test_utils.h",\r
198     "tests/integration_tests/integration_tests.cc",\r
199   ]\r
201   deps = [\r
202     ":sandbox",\r
203     "//testing/gtest",\r
204   ]\r
207 test("sbox_validation_tests") {\r
208   sources = [\r
209     "tests/common/controller.cc",\r
210     "tests/common/controller.h",\r
211     "tests/validation_tests/unit_tests.cc",\r
212     "tests/validation_tests/commands.cc",\r
213     "tests/validation_tests/commands.h",\r
214     "tests/validation_tests/suite.cc",\r
215   ]\r
217   deps = [\r
218     ":sandbox",\r
219     "//testing/gtest",\r
220   ]\r
223 test("sbox_unittests") {\r
224   sources = [\r
225     "src/app_container_unittest.cc",\r
226     "src/interception_unittest.cc",\r
227     "src/service_resolver_unittest.cc",\r
228     "src/restricted_token_unittest.cc",\r
229     "src/job_unittest.cc",\r
230     "src/sid_unittest.cc",\r
231     "src/policy_engine_unittest.cc",\r
232     "src/policy_low_level_unittest.cc",\r
233     "src/policy_opcodes_unittest.cc",\r
234     "src/ipc_unittest.cc",\r
235     "src/threadpool_unittest.cc",\r
236     "src/win_utils_unittest.cc",\r
237     "tests/common/test_utils.cc",\r
238     "tests/common/test_utils.h",\r
239     "tests/unit_tests/unit_tests.cc",\r
240   ]\r
242   deps = [\r
243     ":sandbox",\r
244     "//testing/gtest",\r
245   ]\r
248 test("sandbox_poc") {\r
249   sources = [\r
250     "sandbox_poc/main_ui_window.cc",\r
251     "sandbox_poc/main_ui_window.h",\r
252     "sandbox_poc/resource.h",\r
253     "sandbox_poc/sandbox.cc",\r
254     "sandbox_poc/sandbox.h",\r
255     "sandbox_poc/sandbox.ico",\r
256     "sandbox_poc/sandbox.rc",\r
257   ]\r
259   configs -= [ "//build/config/win:console" ]\r
260   configs += [ "//build/config/win:windowed" ]\r
262   libs = [ "comctl32.lib" ]\r
264   deps = [\r
265     ":sandbox",\r
266     ":pocdll",\r
267   ]\r
270 shared_library("pocdll") {\r
271   sources = [\r
272     "sandbox_poc/pocdll/exports.h",\r
273     "sandbox_poc/pocdll/fs.cc",\r
274     "sandbox_poc/pocdll/handles.cc",\r
275     "sandbox_poc/pocdll/invasive.cc",\r
276     "sandbox_poc/pocdll/network.cc",\r
277     "sandbox_poc/pocdll/pocdll.cc",\r
278     "sandbox_poc/pocdll/processes_and_threads.cc",\r
279     "sandbox_poc/pocdll/registry.cc",\r
280     "sandbox_poc/pocdll/spyware.cc",\r
281     "sandbox_poc/pocdll/utils.h",\r
282   ]\r
284   defines = [ "POCDLL_EXPORTS" ]\r