15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "sandbox/win/src/nt_internals.h"
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "sandbox/win/src/sandbox_types.h"
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef SANDBOX_SRC_TARGET_INTERCEPTIONS_H__
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SANDBOX_SRC_TARGET_INTERCEPTIONS_H__
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace sandbox {
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern "C" {
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Interception of NtMapViewOfSection on the child process.
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// It should never be called directly. This function provides the means to
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// detect dlls being loaded, so we can patch them if needed.
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtMapViewOfSection(
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    NtMapViewOfSectionFunction orig_MapViewOfSection, HANDLE section,
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    HANDLE process, PVOID *base, ULONG_PTR zero_bits, SIZE_T commit_size,
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    PLARGE_INTEGER offset, PSIZE_T view_size, SECTION_INHERIT inherit,
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    ULONG allocation_type, ULONG protect);
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Interception of NtUnmapViewOfSection on the child process.
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// It should never be called directly. This function provides the means to
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// detect dlls being unloaded, so we can clean up our interceptions.
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)SANDBOX_INTERCEPT NTSTATUS WINAPI TargetNtUnmapViewOfSection(
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    NtUnmapViewOfSectionFunction orig_UnmapViewOfSection, HANDLE process,
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    PVOID base);
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // extern "C"
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace sandbox
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // SANDBOX_SRC_TARGET_INTERCEPTIONS_H__
36