Home | History | Annotate | Download | only in wow_helper
      1 // Copyright (c) 2006-2008 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 
      5 #ifndef SANDBOX_WOW_HELPER_TARGET_CODE_H__
      6 #define SANDBOX_WOW_HELPER_TARGET_CODE_H__
      7 
      8 #include "sandbox/win/src/nt_internals.h"
      9 
     10 namespace sandbox {
     11 
     12 extern "C" {
     13 
     14 // Holds the information needed for the interception of NtMapViewOfSection.
     15 // Changes of this structure must be synchronized with changes of PatchInfo32
     16 // on sandbox/win/src/wow64.cc.
     17 struct PatchInfo {
     18   HANDLE dll_load;  // Event to signal the broker.
     19   HANDLE continue_load;  // Event to wait for the broker.
     20   HANDLE section;  // First argument of the call.
     21   NtMapViewOfSectionFunction orig_MapViewOfSection;
     22   NtSignalAndWaitForSingleObjectFunction signal_and_wait;
     23   void* patch_location;
     24 };
     25 
     26 // Interception of NtMapViewOfSection on the child process.
     27 // It should never be called directly. This function provides the means to
     28 // detect dlls being loaded, so we can patch them if needed.
     29 NTSTATUS WINAPI TargetNtMapViewOfSection(
     30     PatchInfo* patch_info, HANDLE process, PVOID* base, ULONG_PTR zero_bits,
     31     SIZE_T commit_size, PLARGE_INTEGER offset, PSIZE_T view_size,
     32     SECTION_INHERIT inherit, ULONG allocation_type, ULONG protect);
     33 
     34 // Marker of the end of TargetNtMapViewOfSection.
     35 NTSTATUS WINAPI TargetEnd();
     36 
     37 } // extern "C"
     38 
     39 }  // namespace sandbox
     40 
     41 #endif  // SANDBOX_WOW_HELPER_TARGET_CODE_H__
     42