process_thread_dispatcher.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #ifndef SANDBOX_WIN_SRC_PROCESS_THREAD_DISPATCHER_H_
  5. #define SANDBOX_WIN_SRC_PROCESS_THREAD_DISPATCHER_H_
  6. #include <stdint.h>
  7. #include "sandbox/win/src/crosscall_server.h"
  8. #include "sandbox/win/src/ipc_tags.h"
  9. #include "sandbox/win/src/sandbox_policy_base.h"
  10. namespace sandbox {
  11. // This class handles process and thread-related IPC calls.
  12. class ThreadProcessDispatcher : public Dispatcher {
  13. public:
  14. explicit ThreadProcessDispatcher();
  15. ThreadProcessDispatcher(const ThreadProcessDispatcher&) = delete;
  16. ThreadProcessDispatcher& operator=(const ThreadProcessDispatcher&) = delete;
  17. ~ThreadProcessDispatcher() override {}
  18. // Dispatcher interface.
  19. bool SetupService(InterceptionManager* manager, IpcTag service) override;
  20. private:
  21. // Processes IPC requests coming from calls to NtOpenThread() in the target.
  22. bool NtOpenThread(IPCInfo* ipc, uint32_t desired_access, uint32_t thread_id);
  23. // Processes IPC requests coming from calls to NtOpenProcess() in the target.
  24. bool NtOpenProcess(IPCInfo* ipc,
  25. uint32_t desired_access,
  26. uint32_t process_id);
  27. // Processes IPC requests from calls to NtOpenProcessToken() in the target.
  28. bool NtOpenProcessToken(IPCInfo* ipc,
  29. HANDLE process,
  30. uint32_t desired_access);
  31. // Processes IPC requests from calls to NtOpenProcessTokenEx() in the target.
  32. bool NtOpenProcessTokenEx(IPCInfo* ipc,
  33. HANDLE process,
  34. uint32_t desired_access,
  35. uint32_t attributes);
  36. // Processes IPC requests coming from calls to CreateThread() in the target.
  37. bool CreateThread(IPCInfo* ipc,
  38. SIZE_T stack_size,
  39. LPTHREAD_START_ROUTINE start_address,
  40. LPVOID parameter,
  41. DWORD creation_flags);
  42. };
  43. } // namespace sandbox
  44. #endif // SANDBOX_WIN_SRC_PROCESS_THREAD_DISPATCHER_H_