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