Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Side by Side Diff: sandbox/src/internal_types.h

Issue 10689170: Move the Windows sandbox to sandbox/win (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on top of tree (properly this time) Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sandbox/src/interceptors_64.cc ('k') | sandbox/src/ipc_ping_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SANDBOX_SRC_INTERNAL_TYPES_H_
6 #define SANDBOX_SRC_INTERNAL_TYPES_H_
7
8 namespace sandbox {
9
10 const wchar_t kNtdllName[] = L"ntdll.dll";
11 const wchar_t kKerneldllName[] = L"kernel32.dll";
12
13 // Defines the supported C++ types encoding to numeric id. Like a poor's man
14 // RTTI. Note that true C++ RTTI will not work because the types are not
15 // polymorphic anyway.
16 enum ArgType {
17 INVALID_TYPE = 0,
18 WCHAR_TYPE,
19 ULONG_TYPE,
20 UNISTR_TYPE,
21 VOIDPTR_TYPE,
22 INPTR_TYPE,
23 INOUTPTR_TYPE,
24 LAST_TYPE
25 };
26
27 // Encapsulates a pointer to a buffer and the size of the buffer.
28 class CountedBuffer {
29 public:
30 CountedBuffer(void* buffer, uint32 size) : size_(size), buffer_(buffer) {}
31
32 uint32 Size() const {
33 return size_;
34 }
35
36 void* Buffer() const {
37 return buffer_;
38 }
39
40 private:
41 uint32 size_;
42 void* buffer_;
43 };
44
45 // Helper class to convert void-pointer packed ints for both
46 // 32 and 64 bit builds. This construct is non-portable.
47 class IPCInt {
48 public:
49 explicit IPCInt(void* buffer) {
50 buffer_.vp = buffer;
51 }
52
53 explicit IPCInt(unsigned __int32 i32) {
54 buffer_.vp = NULL;
55 buffer_.i32 = i32;
56 }
57
58 unsigned __int32 As32Bit() const {
59 return buffer_.i32;
60 }
61
62 void* AsVoidPtr() const {
63 return buffer_.vp;
64 }
65
66 private:
67 union U {
68 void* vp;
69 unsigned __int32 i32;
70 } buffer_;
71 };
72
73 } // namespace sandbox
74
75 #endif // SANDBOX_SRC_INTERNAL_TYPES_H_
OLDNEW
« no previous file with comments | « sandbox/src/interceptors_64.cc ('k') | sandbox/src/ipc_ping_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698