OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef SANDBOX_WIN_SRC_INTERNAL_TYPES_H_ | 5 #ifndef SANDBOX_WIN_SRC_INTERNAL_TYPES_H_ |
6 #define SANDBOX_WIN_SRC_INTERNAL_TYPES_H_ | 6 #define SANDBOX_WIN_SRC_INTERNAL_TYPES_H_ |
7 | 7 |
8 #include <stdint.h> | |
9 | |
10 namespace sandbox { | 8 namespace sandbox { |
11 | 9 |
12 const wchar_t kNtdllName[] = L"ntdll.dll"; | 10 const wchar_t kNtdllName[] = L"ntdll.dll"; |
13 const wchar_t kKerneldllName[] = L"kernel32.dll"; | 11 const wchar_t kKerneldllName[] = L"kernel32.dll"; |
14 const wchar_t kKernelBasedllName[] = L"kernelbase.dll"; | 12 const wchar_t kKernelBasedllName[] = L"kernelbase.dll"; |
15 | 13 |
16 // Defines the supported C++ types encoding to numeric id. Like a poor's man | 14 // Defines the supported C++ types encoding to numeric id. Like a poor's man |
17 // RTTI. Note that true C++ RTTI will not work because the types are not | 15 // RTTI. Note that true C++ RTTI will not work because the types are not |
18 // polymorphic anyway. | 16 // polymorphic anyway. |
19 enum ArgType { | 17 enum ArgType { |
20 INVALID_TYPE = 0, | 18 INVALID_TYPE = 0, |
21 WCHAR_TYPE, | 19 WCHAR_TYPE, |
22 UINT32_TYPE, | 20 UINT32_TYPE, |
23 UNISTR_TYPE, | 21 UNISTR_TYPE, |
24 VOIDPTR_TYPE, | 22 VOIDPTR_TYPE, |
25 INPTR_TYPE, | 23 INPTR_TYPE, |
26 INOUTPTR_TYPE, | 24 INOUTPTR_TYPE, |
27 LAST_TYPE | 25 LAST_TYPE |
28 }; | 26 }; |
29 | 27 |
30 // Encapsulates a pointer to a buffer and the size of the buffer. | 28 // Encapsulates a pointer to a buffer and the size of the buffer. |
31 class CountedBuffer { | 29 class CountedBuffer { |
32 public: | 30 public: |
33 CountedBuffer(void* buffer, uint32_t size) : size_(size), buffer_(buffer) {} | 31 CountedBuffer(void* buffer, uint32 size) : size_(size), buffer_(buffer) {} |
34 | 32 |
35 uint32_t Size() const { return size_; } | 33 uint32 Size() const { |
| 34 return size_; |
| 35 } |
36 | 36 |
37 void* Buffer() const { | 37 void* Buffer() const { |
38 return buffer_; | 38 return buffer_; |
39 } | 39 } |
40 | 40 |
41 private: | 41 private: |
42 uint32_t size_; | 42 uint32 size_; |
43 void* buffer_; | 43 void* buffer_; |
44 }; | 44 }; |
45 | 45 |
46 // Helper class to convert void-pointer packed ints for both | 46 // Helper class to convert void-pointer packed ints for both |
47 // 32 and 64 bit builds. This construct is non-portable. | 47 // 32 and 64 bit builds. This construct is non-portable. |
48 class IPCInt { | 48 class IPCInt { |
49 public: | 49 public: |
50 explicit IPCInt(void* buffer) { | 50 explicit IPCInt(void* buffer) { |
51 buffer_.vp = buffer; | 51 buffer_.vp = buffer; |
52 } | 52 } |
(...skipping 14 matching lines...) Expand all Loading... |
67 private: | 67 private: |
68 union U { | 68 union U { |
69 void* vp; | 69 void* vp; |
70 unsigned __int32 i32; | 70 unsigned __int32 i32; |
71 } buffer_; | 71 } buffer_; |
72 }; | 72 }; |
73 | 73 |
74 } // namespace sandbox | 74 } // namespace sandbox |
75 | 75 |
76 #endif // SANDBOX_WIN_SRC_INTERNAL_TYPES_H_ | 76 #endif // SANDBOX_WIN_SRC_INTERNAL_TYPES_H_ |
OLD | NEW |