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

Side by Side Diff: sandbox/win/src/policy_engine_params.h

Issue 1538283002: Switch to standard integer types in sandbox/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: macros Created 4 years, 12 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
« no previous file with comments | « sandbox/win/src/policy_engine_opcodes.cc ('k') | sandbox/win/src/policy_engine_processor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_SRC_POLICY_ENGINE_PARAMS_H__ 5 #ifndef SANDBOX_SRC_POLICY_ENGINE_PARAMS_H__
6 #define SANDBOX_SRC_POLICY_ENGINE_PARAMS_H__ 6 #define SANDBOX_SRC_POLICY_ENGINE_PARAMS_H__
7 7
8 #include "base/basictypes.h" 8 #include <stdint.h>
9
9 #include "sandbox/win/src/internal_types.h" 10 #include "sandbox/win/src/internal_types.h"
10 #include "sandbox/win/src/nt_internals.h" 11 #include "sandbox/win/src/nt_internals.h"
11 #include "sandbox/win/src/sandbox_nt_util.h" 12 #include "sandbox/win/src/sandbox_nt_util.h"
12 13
13 // This header defines the classes that allow the low level policy to select 14 // This header defines the classes that allow the low level policy to select
14 // the input parameters. In order to better make sense of this header is 15 // the input parameters. In order to better make sense of this header is
15 // recommended that you check policy_engine_opcodes.h first. 16 // recommended that you check policy_engine_opcodes.h first.
16 17
17 namespace sandbox { 18 namespace sandbox {
18 19
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // original C++ type. This allows the policy to treat any set of supported 55 // original C++ type. This allows the policy to treat any set of supported
55 // argument types uniformily and with some type safety. 56 // argument types uniformily and with some type safety.
56 // 57 //
57 // TODO(cpu): support not fully implemented yet for unicode string and will 58 // TODO(cpu): support not fully implemented yet for unicode string and will
58 // probably add other types as well. 59 // probably add other types as well.
59 class ParameterSet { 60 class ParameterSet {
60 public: 61 public:
61 ParameterSet() : real_type_(INVALID_TYPE), address_(NULL) {} 62 ParameterSet() : real_type_(INVALID_TYPE), address_(NULL) {}
62 63
63 // Retrieve the stored parameter. If the type does not match ulong fail. 64 // Retrieve the stored parameter. If the type does not match ulong fail.
64 bool Get(uint32* destination) const { 65 bool Get(uint32_t* destination) const {
65 if (real_type_ != UINT32_TYPE) { 66 if (real_type_ != UINT32_TYPE) {
66 return false; 67 return false;
67 } 68 }
68 *destination = Void2TypePointerCopy<uint32>(); 69 *destination = Void2TypePointerCopy<uint32_t>();
69 return true; 70 return true;
70 } 71 }
71 72
72 // Retrieve the stored parameter. If the type does not match void* fail. 73 // Retrieve the stored parameter. If the type does not match void* fail.
73 bool Get(const void** destination) const { 74 bool Get(const void** destination) const {
74 if (real_type_ != VOIDPTR_TYPE) { 75 if (real_type_ != VOIDPTR_TYPE) {
75 return false; 76 return false;
76 } 77 }
77 *destination = Void2TypePointerCopy<void*>(); 78 *destination = Void2TypePointerCopy<void*>();
78 return true; 79 return true;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 : ParameterSet(WCHAR_TYPE, address) {} 146 : ParameterSet(WCHAR_TYPE, address) {}
146 }; 147 };
147 148
148 template<> 149 template<>
149 class ParameterSetEx<wchar_t const*> : public ParameterSet { 150 class ParameterSetEx<wchar_t const*> : public ParameterSet {
150 public: 151 public:
151 ParameterSetEx(const void* address) 152 ParameterSetEx(const void* address)
152 : ParameterSet(WCHAR_TYPE, address) {} 153 : ParameterSet(WCHAR_TYPE, address) {}
153 }; 154 };
154 155
155 156 template <>
156 template<> 157 class ParameterSetEx<uint32_t> : public ParameterSet {
157 class ParameterSetEx<uint32> : public ParameterSet {
158 public: 158 public:
159 ParameterSetEx(const void* address) 159 ParameterSetEx(const void* address)
160 : ParameterSet(UINT32_TYPE, address) {} 160 : ParameterSet(UINT32_TYPE, address) {}
161 }; 161 };
162 162
163 template<> 163 template<>
164 class ParameterSetEx<UNICODE_STRING> : public ParameterSet { 164 class ParameterSetEx<UNICODE_STRING> : public ParameterSet {
165 public: 165 public:
166 ParameterSetEx(const void* address) 166 ParameterSetEx(const void* address)
167 : ParameterSet(UNISTR_TYPE, address) {} 167 : ParameterSet(UNISTR_TYPE, address) {}
(...skipping 25 matching lines...) Expand all
193 return reinterpret_cast<CountedParameterSetBase*>(this); 193 return reinterpret_cast<CountedParameterSetBase*>(this);
194 } 194 }
195 195
196 int count; 196 int count;
197 ParameterSet parameters[T::PolParamLast]; 197 ParameterSet parameters[T::PolParamLast];
198 }; 198 };
199 199
200 } // namespace sandbox 200 } // namespace sandbox
201 201
202 #endif // SANDBOX_SRC_POLICY_ENGINE_PARAMS_H__ 202 #endif // SANDBOX_SRC_POLICY_ENGINE_PARAMS_H__
OLDNEW
« no previous file with comments | « sandbox/win/src/policy_engine_opcodes.cc ('k') | sandbox/win/src/policy_engine_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698