michael@0: // Copyright (c) 2006-2011 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #include "sandbox/win/src/nt_internals.h" michael@0: #include "sandbox/win/src/sandbox_types.h" michael@0: michael@0: #ifndef SANDBOX_SRC_PROCESS_THREAD_INTERCEPTION_H__ michael@0: #define SANDBOX_SRC_PROCESS_THREAD_INTERCEPTION_H__ michael@0: michael@0: namespace sandbox { michael@0: michael@0: extern "C" { michael@0: michael@0: typedef BOOL (WINAPI *CreateProcessWFunction)( michael@0: LPCWSTR lpApplicationName, michael@0: LPWSTR lpCommandLine, michael@0: LPSECURITY_ATTRIBUTES lpProcessAttributes, michael@0: LPSECURITY_ATTRIBUTES lpThreadAttributes, michael@0: BOOL bInheritHandles, michael@0: DWORD dwCreationFlags, michael@0: LPVOID lpEnvironment, michael@0: LPCWSTR lpCurrentDirectory, michael@0: LPSTARTUPINFOW lpStartupInfo, michael@0: LPPROCESS_INFORMATION lpProcessInformation); michael@0: michael@0: typedef BOOL (WINAPI *CreateProcessAFunction)( michael@0: LPCSTR lpApplicationName, michael@0: LPSTR lpCommandLine, michael@0: LPSECURITY_ATTRIBUTES lpProcessAttributes, michael@0: LPSECURITY_ATTRIBUTES lpThreadAttributes, michael@0: BOOL bInheritHandles, michael@0: DWORD dwCreationFlags, michael@0: LPVOID lpEnvironment, michael@0: LPCSTR lpCurrentDirectory, michael@0: LPSTARTUPINFOA lpStartupInfo, michael@0: LPPROCESS_INFORMATION lpProcessInformation); michael@0: michael@0: typedef HANDLE (WINAPI *CreateThreadFunction)( michael@0: LPSECURITY_ATTRIBUTES lpThreadAttributes, michael@0: SIZE_T dwStackSize, michael@0: LPTHREAD_START_ROUTINE lpStartAddress, michael@0: PVOID lpParameter, michael@0: DWORD dwCreationFlags, michael@0: LPDWORD lpThreadId); michael@0: michael@0: typedef LCID (WINAPI *GetUserDefaultLCIDFunction)(); michael@0: michael@0: // Interception of NtOpenThread on the child process. michael@0: SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenThread( michael@0: NtOpenThreadFunction orig_OpenThread, PHANDLE thread, michael@0: ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes, michael@0: PCLIENT_ID client_id); michael@0: michael@0: // Interception of NtOpenProcess on the child process. michael@0: SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenProcess( michael@0: NtOpenProcessFunction orig_OpenProcess, PHANDLE process, michael@0: ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes, michael@0: PCLIENT_ID client_id); michael@0: michael@0: // Interception of NtOpenProcessToken on the child process. michael@0: SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenProcessToken( michael@0: NtOpenProcessTokenFunction orig_OpenProcessToken, HANDLE process, michael@0: ACCESS_MASK desired_access, PHANDLE token); michael@0: michael@0: // Interception of NtOpenProcessTokenEx on the child process. michael@0: SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenProcessTokenEx( michael@0: NtOpenProcessTokenExFunction orig_OpenProcessTokenEx, HANDLE process, michael@0: ACCESS_MASK desired_access, ULONG handle_attributes, PHANDLE token); michael@0: michael@0: // Interception of CreateProcessW and A in kernel32.dll. michael@0: SANDBOX_INTERCEPT BOOL WINAPI TargetCreateProcessW( michael@0: CreateProcessWFunction orig_CreateProcessW, LPCWSTR application_name, michael@0: LPWSTR command_line, LPSECURITY_ATTRIBUTES process_attributes, michael@0: LPSECURITY_ATTRIBUTES thread_attributes, BOOL inherit_handles, DWORD flags, michael@0: LPVOID environment, LPCWSTR current_directory, LPSTARTUPINFOW startup_info, michael@0: LPPROCESS_INFORMATION process_information); michael@0: michael@0: SANDBOX_INTERCEPT BOOL WINAPI TargetCreateProcessA( michael@0: CreateProcessAFunction orig_CreateProcessA, LPCSTR application_name, michael@0: LPSTR command_line, LPSECURITY_ATTRIBUTES process_attributes, michael@0: LPSECURITY_ATTRIBUTES thread_attributes, BOOL inherit_handles, DWORD flags, michael@0: LPVOID environment, LPCSTR current_directory, LPSTARTUPINFOA startup_info, michael@0: LPPROCESS_INFORMATION process_information); michael@0: michael@0: // Interception of CreateThread in kernel32.dll. michael@0: SANDBOX_INTERCEPT HANDLE WINAPI TargetCreateThread( michael@0: CreateThreadFunction orig_CreateThread, michael@0: LPSECURITY_ATTRIBUTES thread_attributes, SIZE_T stack_size, michael@0: LPTHREAD_START_ROUTINE start_address, PVOID parameter, michael@0: DWORD creation_flags, LPDWORD thread_id); michael@0: michael@0: // Interception of GetUserDefaultLCID in kernel32.dll. michael@0: SANDBOX_INTERCEPT LCID WINAPI TargetGetUserDefaultLCID( michael@0: GetUserDefaultLCIDFunction orig_GetUserDefaultLCID); michael@0: michael@0: } // extern "C" michael@0: michael@0: } // namespace sandbox michael@0: michael@0: #endif // SANDBOX_SRC_PROCESS_THREAD_INTERCEPTION_H__