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 3 // found in the LICENSE file. 4 5 #ifndef SANDBOX_SRC_REGISTRY_DISPATCHER_H_ 6 #define SANDBOX_SRC_REGISTRY_DISPATCHER_H_ 7 8 #include <stdint.h> 9 10 #include <string> 11 12 #include "base/macros.h" 13 #include "sandbox/win/src/crosscall_server.h" 14 #include "sandbox/win/src/ipc_tags.h" 15 #include "sandbox/win/src/sandbox_policy_base.h" 16 17 namespace sandbox { 18 19 // This class handles registry-related IPC calls. 20 class RegistryDispatcher : public Dispatcher { 21 public: 22 explicit RegistryDispatcher(PolicyBase* policy_base); ~RegistryDispatcher()23 ~RegistryDispatcher() override {} 24 25 // Dispatcher interface. 26 bool SetupService(InterceptionManager* manager, IpcTag service) override; 27 28 private: 29 // Processes IPC requests coming from calls to NtCreateKey in the target. 30 bool NtCreateKey(IPCInfo* ipc, 31 std::wstring* name, 32 uint32_t attributes, 33 HANDLE root, 34 uint32_t desired_access, 35 uint32_t title_index, 36 uint32_t create_options); 37 38 // Processes IPC requests coming from calls to NtOpenKey in the target. 39 bool NtOpenKey(IPCInfo* ipc, 40 std::wstring* name, 41 uint32_t attributes, 42 HANDLE root, 43 uint32_t desired_access); 44 45 PolicyBase* policy_base_; 46 DISALLOW_COPY_AND_ASSIGN(RegistryDispatcher); 47 }; 48 49 } // namespace sandbox 50 51 #endif // SANDBOX_SRC_REGISTRY_DISPATCHER_H_ 52