Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #include "sandbox/win/src/sandbox_utils.h" |
michael@0 | 6 | |
michael@0 | 7 | #include <windows.h> |
michael@0 | 8 | |
michael@0 | 9 | #include "base/logging.h" |
michael@0 | 10 | #include "base/win/windows_version.h" |
michael@0 | 11 | #include "sandbox/win/src/internal_types.h" |
michael@0 | 12 | |
michael@0 | 13 | namespace sandbox { |
michael@0 | 14 | |
michael@0 | 15 | bool IsXPSP2OrLater() { |
michael@0 | 16 | base::win::Version version = base::win::GetVersion(); |
michael@0 | 17 | return (version > base::win::VERSION_XP) || |
michael@0 | 18 | ((version == base::win::VERSION_XP) && |
michael@0 | 19 | (base::win::OSInfo::GetInstance()->service_pack().major >= 2)); |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | void InitObjectAttribs(const std::wstring& name, |
michael@0 | 23 | ULONG attributes, |
michael@0 | 24 | HANDLE root, |
michael@0 | 25 | OBJECT_ATTRIBUTES* obj_attr, |
michael@0 | 26 | UNICODE_STRING* uni_name) { |
michael@0 | 27 | static RtlInitUnicodeStringFunction RtlInitUnicodeString; |
michael@0 | 28 | if (!RtlInitUnicodeString) { |
michael@0 | 29 | HMODULE ntdll = ::GetModuleHandle(kNtdllName); |
michael@0 | 30 | RtlInitUnicodeString = reinterpret_cast<RtlInitUnicodeStringFunction>( |
michael@0 | 31 | GetProcAddress(ntdll, "RtlInitUnicodeString")); |
michael@0 | 32 | DCHECK(RtlInitUnicodeString); |
michael@0 | 33 | } |
michael@0 | 34 | RtlInitUnicodeString(uni_name, name.c_str()); |
michael@0 | 35 | InitializeObjectAttributes(obj_attr, uni_name, attributes, root, NULL); |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | }; // namespace sandbox |