IDB: Make readonly transactions wait for earlier readwrite transactions
[chromium-blink-merge.git] / sandbox / win / src / interception_internal.h
blob810478addb6a956bbb832fa86295a3f419a942c2
1 // Copyright (c) 2006-2010 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.
5 // Defines InterceptionManager, the class in charge of setting up interceptions
6 // for the sandboxed process. For more details see:
7 // http://dev.chromium.org/developers/design-documents/sandbox .
9 #ifndef SANDBOX_SRC_INTERCEPTION_INTERNAL_H_
10 #define SANDBOX_SRC_INTERCEPTION_INTERNAL_H_
12 #include "sandbox/win/src/sandbox_types.h"
14 namespace sandbox {
16 const int kMaxThunkDataBytes = 64;
18 enum InterceptorId;
20 // The following structures contain variable size fields at the end, and will be
21 // used to transfer information between two processes. In order to guarantee
22 // our ability to follow the chain of structures, the alignment should be fixed,
23 // hence this pragma.
24 #pragma pack(push, 4)
26 // Structures for the shared memory that contains patching information
27 // for the InterceptionAgent.
28 // A single interception:
29 struct FunctionInfo {
30 size_t record_bytes; // rounded to sizeof(size_t) bytes
31 InterceptionType type;
32 InterceptorId id;
33 const void* interceptor_address;
34 char function[1]; // placeholder for null terminated name
35 // char interceptor[] // followed by the interceptor function
38 // A single dll:
39 struct DllPatchInfo {
40 size_t record_bytes; // rounded to sizeof(size_t) bytes
41 size_t offset_to_functions;
42 int num_functions;
43 bool unload_module;
44 wchar_t dll_name[1]; // placeholder for null terminated name
45 // FunctionInfo function_info[] // followed by the functions to intercept
48 // All interceptions:
49 struct SharedMemory {
50 int num_intercepted_dlls;
51 void* interceptor_base;
52 DllPatchInfo dll_list[1]; // placeholder for the list of dlls
55 // Dummy single thunk:
56 struct ThunkData {
57 char data[kMaxThunkDataBytes];
60 // In-memory representation of the interceptions for a given dll:
61 struct DllInterceptionData {
62 size_t data_bytes;
63 size_t used_bytes;
64 void* base;
65 int num_thunks;
66 #if defined(_WIN64)
67 int dummy; // Improve alignment.
68 #endif
69 ThunkData thunks[1];
72 #pragma pack(pop)
74 } // namespace sandbox
76 #endif // SANDBOX_SRC_INTERCEPTION_INTERNAL_H_