michael@0: // Copyright (c) 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: #ifndef SANDBOX_SRC_WOW64_H__ michael@0: #define SANDBOX_SRC_WOW64_H__ michael@0: michael@0: #include michael@0: michael@0: #include "base/basictypes.h" michael@0: #include "sandbox/win/src/sandbox_types.h" michael@0: michael@0: namespace sandbox { michael@0: michael@0: class TargetProcess; michael@0: michael@0: // This class wraps the code needed to interact with the Windows On Windows michael@0: // subsystem on 64 bit OSes, from the point of view of interceptions. michael@0: class Wow64 { michael@0: public: michael@0: Wow64(TargetProcess* child, HMODULE ntdll) michael@0: : child_(child), ntdll_(ntdll), dll_load_(NULL), continue_load_(NULL) {} michael@0: ~Wow64(); michael@0: michael@0: // Waits for the 32 bit DLL to get loaded on the child process. This function michael@0: // will return immediately if not running under WOW, or launch the helper michael@0: // process and wait until ntdll is ready. michael@0: bool WaitForNtdll(); michael@0: michael@0: private: michael@0: // Runs the WOW helper process, passing the address of a buffer allocated on michael@0: // the child (one page). michael@0: bool RunWowHelper(void* buffer); michael@0: michael@0: // This method receives "notifications" whenever a DLL is mapped on the child. michael@0: bool DllMapped(); michael@0: michael@0: // Returns true if ntdll.dll is mapped on the child. michael@0: bool NtdllPresent(); michael@0: michael@0: TargetProcess* child_; // Child process. michael@0: HMODULE ntdll_; // ntdll on the parent. michael@0: HANDLE dll_load_; // Event that is signaled on dll load. michael@0: HANDLE continue_load_; // Event to signal to continue execution on the child. michael@0: DISALLOW_IMPLICIT_CONSTRUCTORS(Wow64); michael@0: }; michael@0: michael@0: } // namespace sandbox michael@0: michael@0: #endif // SANDBOX_SRC_WOW64_H__