| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 26 // the functionality exposed by GetModuleHandleEx. | 26 // the functionality exposed by GetModuleHandleEx. |
| 27 bool GetModuleHandleHelper(DWORD flags, const wchar_t* module_name, | 27 bool GetModuleHandleHelper(DWORD flags, const wchar_t* module_name, |
| 28 HMODULE* module); | 28 HMODULE* module); |
| 29 | 29 |
| 30 // Returns true if the current OS is Windows XP SP2 or later. | 30 // Returns true if the current OS is Windows XP SP2 or later. |
| 31 bool IsXPSP2OrLater(); | 31 bool IsXPSP2OrLater(); |
| 32 | 32 |
| 33 void InitObjectAttribs(const std::wstring& name, ULONG attributes, HANDLE root, | 33 void InitObjectAttribs(const std::wstring& name, ULONG attributes, HANDLE root, |
| 34 OBJECT_ATTRIBUTES* obj_attr, UNICODE_STRING* uni_name); | 34 OBJECT_ATTRIBUTES* obj_attr, UNICODE_STRING* uni_name); |
| 35 | 35 |
| 36 // The next 2 functions are copied from base\string_util.h and have been | |
| 37 // slighty modified because we don't want to depend on ICU. | |
| 38 template <class string_type> | |
| 39 inline typename string_type::value_type* WriteInto(string_type* str, | |
| 40 size_t length_with_null) { | |
| 41 str->reserve(length_with_null); | |
| 42 str->resize(length_with_null - 1); | |
| 43 return &((*str)[0]); | |
| 44 } | |
| 45 | |
| 46 std::string WideToMultiByte(const std::wstring& wide); | |
| 47 | |
| 48 }; // namespace sandbox | 36 }; // namespace sandbox |
| 49 | 37 |
| 50 #endif // SANDBOX_SRC_SANDBOX_UTILS_H__ | 38 #endif // SANDBOX_SRC_SANDBOX_UTILS_H__ |
| OLD | NEW |