OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_UTILS_H__ | 5 #ifndef SANDBOX_SRC_SANDBOX_UTILS_H_ |
6 #define SANDBOX_SRC_SANDBOX_UTILS_H__ | 6 #define SANDBOX_SRC_SANDBOX_UTILS_H_ |
7 | |
8 #include <windows.h> | |
9 #include <string> | |
10 | 7 |
11 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/strings/string16.h" |
12 #include "sandbox/win/src/nt_internals.h" | 10 #include "sandbox/win/src/nt_internals.h" |
13 | 11 |
14 namespace sandbox { | 12 namespace sandbox { |
15 | 13 |
| 14 // Returns a pointer to the IPC shared memory. |
| 15 void* GetGlobalIPCMemory(); |
| 16 |
| 17 // Returns a pointer to the Policy shared memory. |
| 18 void* GetGlobalPolicyMemory(); |
| 19 |
| 20 // Copies data from a user buffer to our buffer. Returns the operation status. |
| 21 NTSTATUS CopyData(void* destination, const void* source, size_t bytes); |
| 22 |
| 23 // Copies the name from an object attributes. |
| 24 NTSTATUS AllocAndCopyName(const OBJECT_ATTRIBUTES* in_object, |
| 25 wchar_t** out_name, uint32* attributes, HANDLE* root); |
| 26 // Returns the last component of a path that contains the module name. |
| 27 // It will return NULL if the path ends with the path separator. The returned |
| 28 // buffer must be freed with a placement delete (see GetImageNameFromModule |
| 29 // example). |
| 30 UNICODE_STRING* ExtractModuleName(const UNICODE_STRING* module_path); |
| 31 |
16 // Returns true if the current OS is Windows XP SP2 or later. | 32 // Returns true if the current OS is Windows XP SP2 or later. |
17 bool IsXPSP2OrLater(); | 33 bool IsXPSP2OrLater(); |
18 | 34 |
19 void InitObjectAttribs(const std::wstring& name, | 35 void InitObjectAttribs(const string16& name, |
20 ULONG attributes, | 36 ULONG attributes, |
21 HANDLE root, | 37 HANDLE root, |
22 OBJECT_ATTRIBUTES* obj_attr, | 38 OBJECT_ATTRIBUTES* obj_attr, |
23 UNICODE_STRING* uni_name); | 39 UNICODE_STRING* uni_name); |
24 | 40 |
25 }; // namespace sandbox | 41 } // namespace sandbox |
26 | 42 |
27 #endif // SANDBOX_SRC_SANDBOX_UTILS_H__ | 43 #endif // SANDBOX_SRC_SANDBOX_UTILS_H_ |
OLD | NEW |