| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/src/sandbox_policy_base.h" | 5 #include "sandbox/src/sandbox_policy_base.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "sandbox/src/filesystem_dispatcher.h" | 9 #include "sandbox/src/filesystem_dispatcher.h" |
| 10 #include "sandbox/src/filesystem_policy.h" | 10 #include "sandbox/src/filesystem_policy.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 return dispatch->SetupService(manager, service); | 382 return dispatch->SetupService(manager, service); |
| 383 } | 383 } |
| 384 | 384 |
| 385 // We service IPC_PING_TAG message which is a way to test a round trip of the | 385 // We service IPC_PING_TAG message which is a way to test a round trip of the |
| 386 // IPC subsystem. We receive a integer cookie and we are expected to return the | 386 // IPC subsystem. We receive a integer cookie and we are expected to return the |
| 387 // cookie times two (or three) and the current tick count. | 387 // cookie times two (or three) and the current tick count. |
| 388 bool PolicyBase::Ping(IPCInfo* ipc, void* arg1) { | 388 bool PolicyBase::Ping(IPCInfo* ipc, void* arg1) { |
| 389 uint32 tag = ipc->ipc_tag; | 389 uint32 tag = ipc->ipc_tag; |
| 390 | 390 |
| 391 switch (tag) { | 391 switch (tag) { |
| 392 #ifndef _WIN64 // TODO(gregoryd): To build this code for 64-bits Windows we |
| 393 // need to make sure IPC is fully ported to Win64. |
| 392 case IPC_PING1_TAG: { | 394 case IPC_PING1_TAG: { |
| 393 uint32 cookie = bit_cast<uint32>(arg1); | 395 uint32 cookie = bit_cast<uint32>(arg1); |
| 394 COMPILE_ASSERT(sizeof(cookie) == sizeof(arg1), breaks_with_64_bit); | 396 COMPILE_ASSERT(sizeof(cookie) == sizeof(arg1), breaks_with_64_bit); |
| 395 | 397 |
| 396 ipc->return_info.extended_count = 2; | 398 ipc->return_info.extended_count = 2; |
| 397 ipc->return_info.extended[0].unsigned_int = ::GetTickCount(); | 399 ipc->return_info.extended[0].unsigned_int = ::GetTickCount(); |
| 398 ipc->return_info.extended[1].unsigned_int = 2 * cookie; | 400 ipc->return_info.extended[1].unsigned_int = 2 * cookie; |
| 399 return true; | 401 return true; |
| 400 } | 402 } |
| 403 #endif |
| 401 case IPC_PING2_TAG: { | 404 case IPC_PING2_TAG: { |
| 402 CountedBuffer* io_buffer = reinterpret_cast<CountedBuffer*>(arg1); | 405 CountedBuffer* io_buffer = reinterpret_cast<CountedBuffer*>(arg1); |
| 403 if (sizeof(uint32) != io_buffer->Size()) | 406 if (sizeof(uint32) != io_buffer->Size()) |
| 404 return false; | 407 return false; |
| 405 | 408 |
| 406 uint32* cookie = reinterpret_cast<uint32*>(io_buffer->Buffer()); | 409 uint32* cookie = reinterpret_cast<uint32*>(io_buffer->Buffer()); |
| 407 *cookie = (*cookie) * 3; | 410 *cookie = (*cookie) * 3; |
| 408 return true; | 411 return true; |
| 409 } | 412 } |
| 410 default: return false; | 413 default: return false; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 439 return false; | 442 return false; |
| 440 | 443 |
| 441 if (!manager.InitializeInterceptions()) | 444 if (!manager.InitializeInterceptions()) |
| 442 return false; | 445 return false; |
| 443 | 446 |
| 444 // Finally, setup imports on the target so the interceptions can work. | 447 // Finally, setup imports on the target so the interceptions can work. |
| 445 return SetupNtdllImports(target); | 448 return SetupNtdllImports(target); |
| 446 } | 449 } |
| 447 | 450 |
| 448 } // namespace sandbox | 451 } // namespace sandbox |
| OLD | NEW |