1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/sandbox/win/src/Wow64.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +// Copyright (c) 2011 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +#ifndef SANDBOX_SRC_WOW64_H__ 1.9 +#define SANDBOX_SRC_WOW64_H__ 1.10 + 1.11 +#include <windows.h> 1.12 + 1.13 +#include "base/basictypes.h" 1.14 +#include "sandbox/win/src/sandbox_types.h" 1.15 + 1.16 +namespace sandbox { 1.17 + 1.18 +class TargetProcess; 1.19 + 1.20 +// This class wraps the code needed to interact with the Windows On Windows 1.21 +// subsystem on 64 bit OSes, from the point of view of interceptions. 1.22 +class Wow64 { 1.23 + public: 1.24 + Wow64(TargetProcess* child, HMODULE ntdll) 1.25 + : child_(child), ntdll_(ntdll), dll_load_(NULL), continue_load_(NULL) {} 1.26 + ~Wow64(); 1.27 + 1.28 + // Waits for the 32 bit DLL to get loaded on the child process. This function 1.29 + // will return immediately if not running under WOW, or launch the helper 1.30 + // process and wait until ntdll is ready. 1.31 + bool WaitForNtdll(); 1.32 + 1.33 + private: 1.34 + // Runs the WOW helper process, passing the address of a buffer allocated on 1.35 + // the child (one page). 1.36 + bool RunWowHelper(void* buffer); 1.37 + 1.38 + // This method receives "notifications" whenever a DLL is mapped on the child. 1.39 + bool DllMapped(); 1.40 + 1.41 + // Returns true if ntdll.dll is mapped on the child. 1.42 + bool NtdllPresent(); 1.43 + 1.44 + TargetProcess* child_; // Child process. 1.45 + HMODULE ntdll_; // ntdll on the parent. 1.46 + HANDLE dll_load_; // Event that is signaled on dll load. 1.47 + HANDLE continue_load_; // Event to signal to continue execution on the child. 1.48 + DISALLOW_IMPLICIT_CONSTRUCTORS(Wow64); 1.49 +}; 1.50 + 1.51 +} // namespace sandbox 1.52 + 1.53 +#endif // SANDBOX_SRC_WOW64_H__