OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 #include "components/policy/core/common/policy_loader_win.h" | 5 #include "components/policy/core/common/policy_loader_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <ntdsapi.h> // For Ds[Un]Bind | 8 #include <ntdsapi.h> // For Ds[Un]Bind |
9 #include <rpc.h> // For struct GUID | 9 #include <rpc.h> // For struct GUID |
10 #include <shlwapi.h> // For PathIsUNC() | 10 #include <shlwapi.h> // For PathIsUNC() |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 base::ScopedNativeLibrary kernel32_lib_; | 206 base::ScopedNativeLibrary kernel32_lib_; |
207 | 207 |
208 IsWow64Process is_wow_64_process_; | 208 IsWow64Process is_wow_64_process_; |
209 Wow64DisableWow64FSRedirection wow_64_disable_wow_64_fs_redirection_; | 209 Wow64DisableWow64FSRedirection wow_64_disable_wow_64_fs_redirection_; |
210 Wow64RevertWow64FSRedirection wow_64_revert_wow_64_fs_redirection_; | 210 Wow64RevertWow64FSRedirection wow_64_revert_wow_64_fs_redirection_; |
211 | 211 |
212 DISALLOW_COPY_AND_ASSIGN(Wow64Functions); | 212 DISALLOW_COPY_AND_ASSIGN(Wow64Functions); |
213 }; | 213 }; |
214 | 214 |
215 // Global Wow64Function instance used by ScopedDisableWow64Redirection below. | 215 // Global Wow64Function instance used by ScopedDisableWow64Redirection below. |
216 static base::LazyInstance<Wow64Functions> g_wow_64_functions = | 216 static base::LazyInstance<Wow64Functions>::DestructorAtExit g_wow_64_functions = |
217 LAZY_INSTANCE_INITIALIZER; | 217 LAZY_INSTANCE_INITIALIZER; |
218 | 218 |
219 // Scoper that switches off Wow64 File System Redirection during its lifetime. | 219 // Scoper that switches off Wow64 File System Redirection during its lifetime. |
220 class ScopedDisableWow64Redirection { | 220 class ScopedDisableWow64Redirection { |
221 public: | 221 public: |
222 ScopedDisableWow64Redirection() | 222 ScopedDisableWow64Redirection() |
223 : active_(false), | 223 : active_(false), |
224 previous_state_(NULL) { | 224 previous_state_(NULL) { |
225 Wow64Functions* wow64 = g_wow_64_functions.Pointer(); | 225 Wow64Functions* wow64 = g_wow_64_functions.Pointer(); |
226 if (wow64->is_valid() && wow64->IsWow64()) { | 226 if (wow64->is_valid() && wow64->IsWow64()) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 return ::GetAppliedGPOList(flags, machine_name, sid_user, extension_guid, | 259 return ::GetAppliedGPOList(flags, machine_name, sid_user, extension_guid, |
260 gpo_list); | 260 gpo_list); |
261 } | 261 } |
262 | 262 |
263 BOOL FreeGPOList(PGROUP_POLICY_OBJECT gpo_list) override { | 263 BOOL FreeGPOList(PGROUP_POLICY_OBJECT gpo_list) override { |
264 return ::FreeGPOList(gpo_list); | 264 return ::FreeGPOList(gpo_list); |
265 } | 265 } |
266 }; | 266 }; |
267 | 267 |
268 // The default windows GPO list provider used for PolicyLoaderWin. | 268 // The default windows GPO list provider used for PolicyLoaderWin. |
269 static base::LazyInstance<WinGPOListProvider> g_win_gpo_list_provider = | 269 static base::LazyInstance<WinGPOListProvider>::DestructorAtExit |
270 LAZY_INSTANCE_INITIALIZER; | 270 g_win_gpo_list_provider = LAZY_INSTANCE_INITIALIZER; |
271 | 271 |
272 // Parses |gpo_dict| according to |schema| and writes the resulting policy | 272 // Parses |gpo_dict| according to |schema| and writes the resulting policy |
273 // settings to |policy| for the given |scope| and |level|. | 273 // settings to |policy| for the given |scope| and |level|. |
274 void ParsePolicy(const RegistryDict* gpo_dict, | 274 void ParsePolicy(const RegistryDict* gpo_dict, |
275 PolicyLevel level, | 275 PolicyLevel level, |
276 PolicyScope scope, | 276 PolicyScope scope, |
277 const Schema& schema, | 277 const Schema& schema, |
278 PolicyMap* policy) { | 278 PolicyMap* policy) { |
279 if (!gpo_dict) | 279 if (!gpo_dict) |
280 return; | 280 return; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 | 620 |
621 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { | 621 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { |
622 DCHECK(object == user_policy_changed_event_.handle() || | 622 DCHECK(object == user_policy_changed_event_.handle() || |
623 object == machine_policy_changed_event_.handle()) | 623 object == machine_policy_changed_event_.handle()) |
624 << "unexpected object signaled policy reload, obj = " | 624 << "unexpected object signaled policy reload, obj = " |
625 << std::showbase << std::hex << object; | 625 << std::showbase << std::hex << object; |
626 Reload(false); | 626 Reload(false); |
627 } | 627 } |
628 | 628 |
629 } // namespace policy | 629 } // namespace policy |
OLD | NEW |