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 |
8 namespace sandbox { | 10 namespace sandbox { |
9 | 11 |
10 const wchar_t kNtdllName[] = L"ntdll.dll"; | 12 const wchar_t kNtdllName[] = L"ntdll.dll"; |
11 const wchar_t kKerneldllName[] = L"kernel32.dll"; | 13 const wchar_t kKerneldllName[] = L"kernel32.dll"; |
12 const wchar_t kKernelBasedllName[] = L"kernelbase.dll"; | 14 const wchar_t kKernelBasedllName[] = L"kernelbase.dll"; |
13 | 15 |
14 // Defines the supported C++ types encoding to numeric id. Like a poor's man | 16 // Defines the supported C++ types encoding to numeric id. Like a poor's man |
15 // RTTI. Note that true C++ RTTI will not work because the types are not | 17 // RTTI. Note that true C++ RTTI will not work because the types are not |
16 // polymorphic anyway. | 18 // polymorphic anyway. |
17 enum ArgType { | 19 enum ArgType { |
18 INVALID_TYPE = 0, | 20 INVALID_TYPE = 0, |
19 WCHAR_TYPE, | 21 WCHAR_TYPE, |
20 UINT32_TYPE, | 22 UINT32_TYPE, |
21 UNISTR_TYPE, | 23 UNISTR_TYPE, |
22 VOIDPTR_TYPE, | 24 VOIDPTR_TYPE, |
23 INPTR_TYPE, | 25 INPTR_TYPE, |
24 INOUTPTR_TYPE, | 26 INOUTPTR_TYPE, |
25 LAST_TYPE | 27 LAST_TYPE |
26 }; | 28 }; |
27 | 29 |
28 // Encapsulates a pointer to a buffer and the size of the buffer. | 30 // Encapsulates a pointer to a buffer and the size of the buffer. |
29 class CountedBuffer { | 31 class CountedBuffer { |
30 public: | 32 public: |
31 CountedBuffer(void* buffer, uint32 size) : size_(size), buffer_(buffer) {} | 33 CountedBuffer(void* buffer, uint32_t size) : size_(size), buffer_(buffer) {} |
32 | 34 |
33 uint32 Size() const { | 35 uint32_t Size() const { return size_; } |
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 size_; | 42 uint32_t 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 |