process_thread_interception.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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
  3. // found in the LICENSE file.
  4. #ifndef SANDBOX_WIN_SRC_PROCESS_THREAD_INTERCEPTION_H_
  5. #define SANDBOX_WIN_SRC_PROCESS_THREAD_INTERCEPTION_H_
  6. #include <windows.h>
  7. #include "sandbox/win/src/nt_internals.h"
  8. #include "sandbox/win/src/sandbox_types.h"
  9. namespace sandbox {
  10. namespace {
  11. using CreateThreadFunction = decltype(&::CreateThread);
  12. using GetUserDefaultLCIDFunction = decltype(&::GetUserDefaultLCID);
  13. } // namespace
  14. extern "C" {
  15. // Interception of NtOpenThread on the child process.
  16. SANDBOX_INTERCEPT NTSTATUS WINAPI
  17. TargetNtOpenThread(NtOpenThreadFunction orig_OpenThread,
  18. PHANDLE thread,
  19. ACCESS_MASK desired_access,
  20. POBJECT_ATTRIBUTES object_attributes,
  21. PCLIENT_ID client_id);
  22. // Interception of NtOpenProcess on the child process.
  23. SANDBOX_INTERCEPT NTSTATUS WINAPI
  24. TargetNtOpenProcess(NtOpenProcessFunction orig_OpenProcess,
  25. PHANDLE process,
  26. ACCESS_MASK desired_access,
  27. POBJECT_ATTRIBUTES object_attributes,
  28. PCLIENT_ID client_id);
  29. // Interception of NtOpenProcessToken on the child process.
  30. SANDBOX_INTERCEPT NTSTATUS WINAPI
  31. TargetNtOpenProcessToken(NtOpenProcessTokenFunction orig_OpenProcessToken,
  32. HANDLE process,
  33. ACCESS_MASK desired_access,
  34. PHANDLE token);
  35. // Interception of NtOpenProcessTokenEx on the child process.
  36. SANDBOX_INTERCEPT NTSTATUS WINAPI
  37. TargetNtOpenProcessTokenEx(NtOpenProcessTokenExFunction orig_OpenProcessTokenEx,
  38. HANDLE process,
  39. ACCESS_MASK desired_access,
  40. ULONG handle_attributes,
  41. PHANDLE token);
  42. // Interception of CreateThread in kernel32.dll.
  43. SANDBOX_INTERCEPT HANDLE WINAPI
  44. TargetCreateThread(CreateThreadFunction orig_CreateThread,
  45. LPSECURITY_ATTRIBUTES thread_attributes,
  46. SIZE_T stack_size,
  47. LPTHREAD_START_ROUTINE start_address,
  48. LPVOID parameter,
  49. DWORD creation_flags,
  50. LPDWORD thread_id);
  51. } // extern "C"
  52. } // namespace sandbox
  53. #endif // SANDBOX_WIN_SRC_PROCESS_THREAD_INTERCEPTION_H_