security/sandbox/win/src/process_thread_interception.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Copyright (c) 2006-2011 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 #include "sandbox/win/src/nt_internals.h"
michael@0 6 #include "sandbox/win/src/sandbox_types.h"
michael@0 7
michael@0 8 #ifndef SANDBOX_SRC_PROCESS_THREAD_INTERCEPTION_H__
michael@0 9 #define SANDBOX_SRC_PROCESS_THREAD_INTERCEPTION_H__
michael@0 10
michael@0 11 namespace sandbox {
michael@0 12
michael@0 13 extern "C" {
michael@0 14
michael@0 15 typedef BOOL (WINAPI *CreateProcessWFunction)(
michael@0 16 LPCWSTR lpApplicationName,
michael@0 17 LPWSTR lpCommandLine,
michael@0 18 LPSECURITY_ATTRIBUTES lpProcessAttributes,
michael@0 19 LPSECURITY_ATTRIBUTES lpThreadAttributes,
michael@0 20 BOOL bInheritHandles,
michael@0 21 DWORD dwCreationFlags,
michael@0 22 LPVOID lpEnvironment,
michael@0 23 LPCWSTR lpCurrentDirectory,
michael@0 24 LPSTARTUPINFOW lpStartupInfo,
michael@0 25 LPPROCESS_INFORMATION lpProcessInformation);
michael@0 26
michael@0 27 typedef BOOL (WINAPI *CreateProcessAFunction)(
michael@0 28 LPCSTR lpApplicationName,
michael@0 29 LPSTR lpCommandLine,
michael@0 30 LPSECURITY_ATTRIBUTES lpProcessAttributes,
michael@0 31 LPSECURITY_ATTRIBUTES lpThreadAttributes,
michael@0 32 BOOL bInheritHandles,
michael@0 33 DWORD dwCreationFlags,
michael@0 34 LPVOID lpEnvironment,
michael@0 35 LPCSTR lpCurrentDirectory,
michael@0 36 LPSTARTUPINFOA lpStartupInfo,
michael@0 37 LPPROCESS_INFORMATION lpProcessInformation);
michael@0 38
michael@0 39 typedef HANDLE (WINAPI *CreateThreadFunction)(
michael@0 40 LPSECURITY_ATTRIBUTES lpThreadAttributes,
michael@0 41 SIZE_T dwStackSize,
michael@0 42 LPTHREAD_START_ROUTINE lpStartAddress,
michael@0 43 PVOID lpParameter,
michael@0 44 DWORD dwCreationFlags,
michael@0 45 LPDWORD lpThreadId);
michael@0 46
michael@0 47 typedef LCID (WINAPI *GetUserDefaultLCIDFunction)();
michael@0 48
michael@0 49 // Interception of NtOpenThread on the child process.
michael@0 50 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenThread(
michael@0 51 NtOpenThreadFunction orig_OpenThread, PHANDLE thread,
michael@0 52 ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes,
michael@0 53 PCLIENT_ID client_id);
michael@0 54
michael@0 55 // Interception of NtOpenProcess on the child process.
michael@0 56 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenProcess(
michael@0 57 NtOpenProcessFunction orig_OpenProcess, PHANDLE process,
michael@0 58 ACCESS_MASK desired_access, POBJECT_ATTRIBUTES object_attributes,
michael@0 59 PCLIENT_ID client_id);
michael@0 60
michael@0 61 // Interception of NtOpenProcessToken on the child process.
michael@0 62 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenProcessToken(
michael@0 63 NtOpenProcessTokenFunction orig_OpenProcessToken, HANDLE process,
michael@0 64 ACCESS_MASK desired_access, PHANDLE token);
michael@0 65
michael@0 66 // Interception of NtOpenProcessTokenEx on the child process.
michael@0 67 SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtOpenProcessTokenEx(
michael@0 68 NtOpenProcessTokenExFunction orig_OpenProcessTokenEx, HANDLE process,
michael@0 69 ACCESS_MASK desired_access, ULONG handle_attributes, PHANDLE token);
michael@0 70
michael@0 71 // Interception of CreateProcessW and A in kernel32.dll.
michael@0 72 SANDBOX_INTERCEPT BOOL WINAPI TargetCreateProcessW(
michael@0 73 CreateProcessWFunction orig_CreateProcessW, LPCWSTR application_name,
michael@0 74 LPWSTR command_line, LPSECURITY_ATTRIBUTES process_attributes,
michael@0 75 LPSECURITY_ATTRIBUTES thread_attributes, BOOL inherit_handles, DWORD flags,
michael@0 76 LPVOID environment, LPCWSTR current_directory, LPSTARTUPINFOW startup_info,
michael@0 77 LPPROCESS_INFORMATION process_information);
michael@0 78
michael@0 79 SANDBOX_INTERCEPT BOOL WINAPI TargetCreateProcessA(
michael@0 80 CreateProcessAFunction orig_CreateProcessA, LPCSTR application_name,
michael@0 81 LPSTR command_line, LPSECURITY_ATTRIBUTES process_attributes,
michael@0 82 LPSECURITY_ATTRIBUTES thread_attributes, BOOL inherit_handles, DWORD flags,
michael@0 83 LPVOID environment, LPCSTR current_directory, LPSTARTUPINFOA startup_info,
michael@0 84 LPPROCESS_INFORMATION process_information);
michael@0 85
michael@0 86 // Interception of CreateThread in kernel32.dll.
michael@0 87 SANDBOX_INTERCEPT HANDLE WINAPI TargetCreateThread(
michael@0 88 CreateThreadFunction orig_CreateThread,
michael@0 89 LPSECURITY_ATTRIBUTES thread_attributes, SIZE_T stack_size,
michael@0 90 LPTHREAD_START_ROUTINE start_address, PVOID parameter,
michael@0 91 DWORD creation_flags, LPDWORD thread_id);
michael@0 92
michael@0 93 // Interception of GetUserDefaultLCID in kernel32.dll.
michael@0 94 SANDBOX_INTERCEPT LCID WINAPI TargetGetUserDefaultLCID(
michael@0 95 GetUserDefaultLCIDFunction orig_GetUserDefaultLCID);
michael@0 96
michael@0 97 } // extern "C"
michael@0 98
michael@0 99 } // namespace sandbox
michael@0 100
michael@0 101 #endif // SANDBOX_SRC_PROCESS_THREAD_INTERCEPTION_H__

mercurial