/chromium-webcl/src/sandbox/win/src/interceptors_64.h

https://bitbucket.org/peixuan/chromium_r197479_base · C Header · 169 lines · 89 code · 37 blank · 43 comment · 0 complexity · 610245c0070c91782ff5b9f2ad92b6c9 MD5 · raw file

  1. // Copyright (c) 2011 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. #include "sandbox/win/src/nt_internals.h"
  5. #include "sandbox/win/src/sandbox_types.h"
  6. #ifndef SANDBOX_SRC_INTERCEPTORS_64_H_
  7. #define SANDBOX_SRC_INTERCEPTORS_64_H_
  8. namespace sandbox {
  9. extern "C" {
  10. // Interception of NtMapViewOfSection on the child process.
  11. // It should never be called directly. This function provides the means to
  12. // detect dlls being loaded, so we can patch them if needed.
  13. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtMapViewOfSection64(
  14. HANDLE section, HANDLE process, PVOID *base, ULONG_PTR zero_bits,
  15. SIZE_T commit_size, PLARGE_INTEGER offset, PSIZE_T view_size,
  16. SECTION_INHERIT inherit, ULONG allocation_type, ULONG protect);
  17. // Interception of NtUnmapViewOfSection on the child process.
  18. // It should never be called directly. This function provides the means to
  19. // detect dlls being unloaded, so we can clean up our interceptions.
  20. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtUnmapViewOfSection64(HANDLE process,
  21. PVOID base);
  22. // -----------------------------------------------------------------------
  23. // Interceptors without IPC.
  24. // Interception of NtSetInformationThread on the child process.
  25. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtSetInformationThread64(
  26. HANDLE thread, NT_THREAD_INFORMATION_CLASS thread_info_class,
  27. PVOID thread_information, ULONG thread_information_bytes);
  28. // Interception of NtOpenThreadToken on the child process.
  29. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenThreadToken64(
  30. HANDLE thread, ACCESS_MASK desired_access, BOOLEAN open_as_self,
  31. PHANDLE token);
  32. // Interception of NtOpenThreadTokenEx on the child process.
  33. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenThreadTokenEx64(
  34. HANDLE thread, ACCESS_MASK desired_access, BOOLEAN open_as_self,
  35. ULONG handle_attributes, PHANDLE token);
  36. // Interception of CreateThread on the child process.
  37. SANDBOX_INTERCEPT HANDLE WINAPI TargetCreateThread64(
  38. LPSECURITY_ATTRIBUTES thread_attributes, SIZE_T stack_size,
  39. LPTHREAD_START_ROUTINE start_address, PVOID parameter,
  40. DWORD creation_flags, LPDWORD thread_id);
  41. // Interception of GetUserDefaultLCID on the child process.
  42. SANDBOX_INTERCEPT LCID WINAPI TargetGetUserDefaultLCID64();
  43. // -----------------------------------------------------------------------
  44. // Interceptors handled by the file system dispatcher.
  45. // Interception of NtCreateFile on the child process.
  46. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtCreateFile64(
  47. PHANDLE file, ACCESS_MASK desired_access,
  48. POBJECT_ATTRIBUTES object_attributes, PIO_STATUS_BLOCK io_status,
  49. PLARGE_INTEGER allocation_size, ULONG file_attributes, ULONG sharing,
  50. ULONG disposition, ULONG options, PVOID ea_buffer, ULONG ea_length);
  51. // Interception of NtOpenFile on the child process.
  52. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenFile64(
  53. PHANDLE file, ACCESS_MASK desired_access,
  54. POBJECT_ATTRIBUTES object_attributes, PIO_STATUS_BLOCK io_status,
  55. ULONG sharing, ULONG options);
  56. // Interception of NtQueryAtttributesFile on the child process.
  57. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtQueryAttributesFile64(
  58. POBJECT_ATTRIBUTES object_attributes,
  59. PFILE_BASIC_INFORMATION file_attributes);
  60. // Interception of NtQueryFullAtttributesFile on the child process.
  61. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtQueryFullAttributesFile64(
  62. POBJECT_ATTRIBUTES object_attributes,
  63. PFILE_NETWORK_OPEN_INFORMATION file_attributes);
  64. // Interception of NtSetInformationFile on the child process.
  65. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtSetInformationFile64(
  66. HANDLE file, PIO_STATUS_BLOCK io_status, PVOID file_information,
  67. ULONG length, FILE_INFORMATION_CLASS file_information_class);
  68. // -----------------------------------------------------------------------
  69. // Interceptors handled by the named pipe dispatcher.
  70. // Interception of CreateNamedPipeW in kernel32.dll
  71. SANDBOX_INTERCEPT HANDLE WINAPI TargetCreateNamedPipeW64(
  72. LPCWSTR pipe_name, DWORD open_mode, DWORD pipe_mode, DWORD max_instance,
  73. DWORD out_buffer_size, DWORD in_buffer_size, DWORD default_timeout,
  74. LPSECURITY_ATTRIBUTES security_attributes);
  75. // -----------------------------------------------------------------------
  76. // Interceptors handled by the process-thread dispatcher.
  77. // Interception of NtOpenThread on the child process.
  78. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenThread64(
  79. PHANDLE thread, ACCESS_MASK desired_access,
  80. POBJECT_ATTRIBUTES object_attributes, PCLIENT_ID client_id);
  81. // Interception of NtOpenProcess on the child process.
  82. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenProcess64(
  83. PHANDLE process, ACCESS_MASK desired_access,
  84. POBJECT_ATTRIBUTES object_attributes, PCLIENT_ID client_id);
  85. // Interception of NtOpenProcessToken on the child process.
  86. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenProcessToken64(
  87. HANDLE process, ACCESS_MASK desired_access, PHANDLE token);
  88. // Interception of NtOpenProcessTokenEx on the child process.
  89. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenProcessTokenEx64(
  90. HANDLE process, ACCESS_MASK desired_access, ULONG handle_attributes,
  91. PHANDLE token);
  92. // Interception of CreateProcessW in kernel32.dll.
  93. SANDBOX_INTERCEPT BOOL WINAPI TargetCreateProcessW64(
  94. LPCWSTR application_name, LPWSTR command_line,
  95. LPSECURITY_ATTRIBUTES process_attributes,
  96. LPSECURITY_ATTRIBUTES thread_attributes, BOOL inherit_handles, DWORD flags,
  97. LPVOID environment, LPCWSTR current_directory, LPSTARTUPINFOW startup_info,
  98. LPPROCESS_INFORMATION process_information);
  99. // Interception of CreateProcessA in kernel32.dll.
  100. SANDBOX_INTERCEPT BOOL WINAPI TargetCreateProcessA64(
  101. LPCSTR application_name, LPSTR command_line,
  102. LPSECURITY_ATTRIBUTES process_attributes,
  103. LPSECURITY_ATTRIBUTES thread_attributes, BOOL inherit_handles, DWORD flags,
  104. LPVOID environment, LPCSTR current_directory, LPSTARTUPINFOA startup_info,
  105. LPPROCESS_INFORMATION process_information);
  106. // -----------------------------------------------------------------------
  107. // Interceptors handled by the registry dispatcher.
  108. // Interception of NtCreateKey on the child process.
  109. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtCreateKey64(
  110. PHANDLE key, ACCESS_MASK desired_access,
  111. POBJECT_ATTRIBUTES object_attributes, ULONG title_index,
  112. PUNICODE_STRING class_name, ULONG create_options, PULONG disposition);
  113. // Interception of NtOpenKey on the child process.
  114. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenKey64(
  115. PHANDLE key, ACCESS_MASK desired_access,
  116. POBJECT_ATTRIBUTES object_attributes);
  117. // Interception of NtOpenKeyEx on the child process.
  118. SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenKeyEx64(
  119. PHANDLE key, ACCESS_MASK desired_access,
  120. POBJECT_ATTRIBUTES object_attributes, ULONG open_options);
  121. // -----------------------------------------------------------------------
  122. // Interceptors handled by the sync dispatcher.
  123. // Interception of CreateEventW on the child process.
  124. SANDBOX_INTERCEPT HANDLE WINAPI TargetCreateEventW64(
  125. LPSECURITY_ATTRIBUTES security_attributes, BOOL manual_reset,
  126. BOOL initial_state, LPCWSTR name);
  127. // Interception of OpenEventW on the child process.
  128. SANDBOX_INTERCEPT HANDLE WINAPI TargetOpenEventW64(
  129. ACCESS_MASK desired_access, BOOL inherit_handle, LPCWSTR name);
  130. } // extern "C"
  131. } // namespace sandbox
  132. #endif // SANDBOX_SRC_INTERCEPTORS_64_H_