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

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

Issue 1485853003: Revert of Remove kuint16max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kint2
Patch Set: Created 5 years 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 | « net/tools/dns_fuzz_stub/dns_fuzz_stub.cc ('k') | sandbox/win/src/sandbox_nt_util.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_SANDBOX_NT_UTIL_H_ 5 #ifndef SANDBOX_SRC_SANDBOX_NT_UTIL_H_
6 #define SANDBOX_SRC_SANDBOX_NT_UTIL_H_ 6 #define SANDBOX_SRC_SANDBOX_NT_UTIL_H_
7 7
8 #include <intrin.h> 8 #include <intrin.h>
9 #include <stdint.h>
10 9
11 #include "base/macros.h" 10 #include "base/basictypes.h"
12 #include "sandbox/win/src/nt_internals.h" 11 #include "sandbox/win/src/nt_internals.h"
13 #include "sandbox/win/src/sandbox_nt_types.h" 12 #include "sandbox/win/src/sandbox_nt_types.h"
14 13
15 // Placement new and delete to be used from ntdll interception code. 14 // Placement new and delete to be used from ntdll interception code.
16 void* __cdecl operator new(size_t size, sandbox::AllocationType type, 15 void* __cdecl operator new(size_t size, sandbox::AllocationType type,
17 void* near_to = NULL); 16 void* near_to = NULL);
18 void __cdecl operator delete(void* memory, sandbox::AllocationType type); 17 void __cdecl operator delete(void* memory, sandbox::AllocationType type);
19 // Add operator delete that matches the placement form of the operator new 18 // Add operator delete that matches the placement form of the operator new
20 // above. This is required by compiler to generate code to call operator delete 19 // above. This is required by compiler to generate code to call operator delete
21 // in case the object's constructor throws an exception. 20 // in case the object's constructor throws an exception.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // or write. 94 // or write.
96 // Note that write intent implies destruction of the buffer content (we actually 95 // Note that write intent implies destruction of the buffer content (we actually
97 // write) 96 // write)
98 bool ValidParameter(void* buffer, size_t size, RequiredAccess intent); 97 bool ValidParameter(void* buffer, size_t size, RequiredAccess intent);
99 98
100 // Copies data from a user buffer to our buffer. Returns the operation status. 99 // Copies data from a user buffer to our buffer. Returns the operation status.
101 NTSTATUS CopyData(void* destination, const void* source, size_t bytes); 100 NTSTATUS CopyData(void* destination, const void* source, size_t bytes);
102 101
103 // Copies the name from an object attributes. 102 // Copies the name from an object attributes.
104 NTSTATUS AllocAndCopyName(const OBJECT_ATTRIBUTES* in_object, 103 NTSTATUS AllocAndCopyName(const OBJECT_ATTRIBUTES* in_object,
105 wchar_t** out_name, 104 wchar_t** out_name, uint32* attributes, HANDLE* root);
106 uint32_t* attributes,
107 HANDLE* root);
108 105
109 // Determine full path name from object root and path. 106 // Determine full path name from object root and path.
110 NTSTATUS AllocAndGetFullPath(HANDLE root, 107 NTSTATUS AllocAndGetFullPath(HANDLE root,
111 wchar_t* path, 108 wchar_t* path,
112 wchar_t** full_path); 109 wchar_t** full_path);
113 110
114 // Initializes our ntdll level heap 111 // Initializes our ntdll level heap
115 bool InitHeap(); 112 bool InitHeap();
116 113
117 // Returns true if the provided handle refers to the current process. 114 // Returns true if the provided handle refers to the current process.
(...skipping 12 matching lines...) Expand all
130 // The returned buffer must be freed with a placement delete from the ntdll 127 // The returned buffer must be freed with a placement delete from the ntdll
131 // level allocator: 128 // level allocator:
132 // 129 //
133 // UNICODE_STRING* name = GetPEImageInfoFromModule(HMODULE module, &flags); 130 // UNICODE_STRING* name = GetPEImageInfoFromModule(HMODULE module, &flags);
134 // if (!name) { 131 // if (!name) {
135 // // probably not a valid dll 132 // // probably not a valid dll
136 // return; 133 // return;
137 // } 134 // }
138 // InsertYourLogicHere(name); 135 // InsertYourLogicHere(name);
139 // operator delete(name, NT_ALLOC); 136 // operator delete(name, NT_ALLOC);
140 UNICODE_STRING* GetImageInfoFromModule(HMODULE module, uint32_t* flags); 137 UNICODE_STRING* GetImageInfoFromModule(HMODULE module, uint32* flags);
141 138
142 // Returns the full path and filename for a given dll. 139 // Returns the full path and filename for a given dll.
143 // May return NULL if the provided address is not backed by a named section, or 140 // May return NULL if the provided address is not backed by a named section, or
144 // if the current OS version doesn't support the call. The returned buffer must 141 // if the current OS version doesn't support the call. The returned buffer must
145 // be freed with a placement delete (see GetImageNameFromModule example). 142 // be freed with a placement delete (see GetImageNameFromModule example).
146 UNICODE_STRING* GetBackingFilePath(PVOID address); 143 UNICODE_STRING* GetBackingFilePath(PVOID address);
147 144
148 // Returns the last component of a path that contains the module name. 145 // Returns the last component of a path that contains the module name.
149 // It will return NULL if the path ends with the path separator. The returned 146 // It will return NULL if the path ends with the path separator. The returned
150 // buffer must be freed with a placement delete (see GetImageNameFromModule 147 // buffer must be freed with a placement delete (see GetImageNameFromModule
(...skipping 27 matching lines...) Expand all
178 bool changed_; 175 bool changed_;
179 void* address_; 176 void* address_;
180 size_t bytes_; 177 size_t bytes_;
181 ULONG old_protect_; 178 ULONG old_protect_;
182 179
183 DISALLOW_COPY_AND_ASSIGN(AutoProtectMemory); 180 DISALLOW_COPY_AND_ASSIGN(AutoProtectMemory);
184 }; 181 };
185 182
186 // Returns true if the file_rename_information structure is supported by our 183 // Returns true if the file_rename_information structure is supported by our
187 // rename handler. 184 // rename handler.
188 bool IsSupportedRenameCall(FILE_RENAME_INFORMATION* file_info, 185 bool IsSupportedRenameCall(FILE_RENAME_INFORMATION* file_info, DWORD length,
189 DWORD length, 186 uint32 file_info_class);
190 uint32_t file_info_class);
191 187
192 } // namespace sandbox 188 } // namespace sandbox
193 189
194 190
195 #endif // SANDBOX_SRC_SANDBOX_NT_UTIL_H__ 191 #endif // SANDBOX_SRC_SANDBOX_NT_UTIL_H__
OLDNEW
« no previous file with comments | « net/tools/dns_fuzz_stub/dns_fuzz_stub.cc ('k') | sandbox/win/src/sandbox_nt_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698