1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/sandbox/win/src/interception_internal.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,76 @@ 1.4 +// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +// Defines InterceptionManager, the class in charge of setting up interceptions 1.9 +// for the sandboxed process. For more details see: 1.10 +// http://dev.chromium.org/developers/design-documents/sandbox . 1.11 + 1.12 +#ifndef SANDBOX_SRC_INTERCEPTION_INTERNAL_H_ 1.13 +#define SANDBOX_SRC_INTERCEPTION_INTERNAL_H_ 1.14 + 1.15 +#include "sandbox/win/src/sandbox_types.h" 1.16 + 1.17 +namespace sandbox { 1.18 + 1.19 +const int kMaxThunkDataBytes = 64; 1.20 + 1.21 +enum InterceptorId; 1.22 + 1.23 +// The following structures contain variable size fields at the end, and will be 1.24 +// used to transfer information between two processes. In order to guarantee 1.25 +// our ability to follow the chain of structures, the alignment should be fixed, 1.26 +// hence this pragma. 1.27 +#pragma pack(push, 4) 1.28 + 1.29 +// Structures for the shared memory that contains patching information 1.30 +// for the InterceptionAgent. 1.31 +// A single interception: 1.32 +struct FunctionInfo { 1.33 + size_t record_bytes; // rounded to sizeof(size_t) bytes 1.34 + InterceptionType type; 1.35 + InterceptorId id; 1.36 + const void* interceptor_address; 1.37 + char function[1]; // placeholder for null terminated name 1.38 + // char interceptor[] // followed by the interceptor function 1.39 +}; 1.40 + 1.41 +// A single dll: 1.42 +struct DllPatchInfo { 1.43 + size_t record_bytes; // rounded to sizeof(size_t) bytes 1.44 + size_t offset_to_functions; 1.45 + int num_functions; 1.46 + bool unload_module; 1.47 + wchar_t dll_name[1]; // placeholder for null terminated name 1.48 + // FunctionInfo function_info[] // followed by the functions to intercept 1.49 +}; 1.50 + 1.51 +// All interceptions: 1.52 +struct SharedMemory { 1.53 + int num_intercepted_dlls; 1.54 + void* interceptor_base; 1.55 + DllPatchInfo dll_list[1]; // placeholder for the list of dlls 1.56 +}; 1.57 + 1.58 +// Dummy single thunk: 1.59 +struct ThunkData { 1.60 + char data[kMaxThunkDataBytes]; 1.61 +}; 1.62 + 1.63 +// In-memory representation of the interceptions for a given dll: 1.64 +struct DllInterceptionData { 1.65 + size_t data_bytes; 1.66 + size_t used_bytes; 1.67 + void* base; 1.68 + int num_thunks; 1.69 +#if defined(_WIN64) 1.70 + int dummy; // Improve alignment. 1.71 +#endif 1.72 + ThunkData thunks[1]; 1.73 +}; 1.74 + 1.75 +#pragma pack(pop) 1.76 + 1.77 +} // namespace sandbox 1.78 + 1.79 +#endif // SANDBOX_SRC_INTERCEPTION_INTERNAL_H_