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_FILESYSTEM_DISPATCHER_H__ 6 #define SANDBOX_SRC_FILESYSTEM_DISPATCHER_H__ 7 8 #include "base/basictypes.h" 9 #include "base/strings/string16.h" 10 #include "sandbox/win/src/crosscall_server.h" 11 #include "sandbox/win/src/sandbox_policy_base.h" 12 13 namespace sandbox { 14 15 // This class handles file system-related IPC calls. 16 class FilesystemDispatcher : public Dispatcher { 17 public: 18 explicit FilesystemDispatcher(PolicyBase* policy_base); ~FilesystemDispatcher()19 ~FilesystemDispatcher() {} 20 21 // Dispatcher interface. 22 virtual bool SetupService(InterceptionManager* manager, int service); 23 24 private: 25 // Processes IPC requests coming from calls to NtCreateFile in the target. 26 bool NtCreateFile(IPCInfo* ipc, base::string16* name, DWORD attributes, 27 DWORD desired_access, DWORD file_attributes, 28 DWORD share_access, DWORD create_disposition, 29 DWORD create_options); 30 31 // Processes IPC requests coming from calls to NtOpenFile in the target. 32 bool NtOpenFile(IPCInfo* ipc, base::string16* name, DWORD attributes, 33 DWORD desired_access, DWORD share_access, 34 DWORD create_options); 35 36 // Processes IPC requests coming from calls to NtQueryAttributesFile in the 37 // target. 38 bool NtQueryAttributesFile(IPCInfo* ipc, base::string16* name, 39 DWORD attributes, 40 CountedBuffer* info); 41 42 // Processes IPC requests coming from calls to NtQueryFullAttributesFile in 43 // the target. 44 bool NtQueryFullAttributesFile(IPCInfo* ipc, base::string16* name, 45 DWORD attributes, CountedBuffer* info); 46 47 // Processes IPC requests coming from calls to NtSetInformationFile with the 48 // rename information class. 49 bool NtSetInformationFile(IPCInfo* ipc, HANDLE handle, 50 CountedBuffer* status, 51 CountedBuffer* info, DWORD length, 52 DWORD info_class); 53 54 PolicyBase* policy_base_; 55 DISALLOW_COPY_AND_ASSIGN(FilesystemDispatcher); 56 }; 57 58 } // namespace sandbox 59 60 #endif // SANDBOX_SRC_FILESYSTEM_DISPATCHER_H__ 61