OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SANDBOX_SRC_WOW64_H__ | 5 #ifndef SANDBOX_SRC_WOW64_H__ |
6 #define SANDBOX_SRC_WOW64_H__ | 6 #define SANDBOX_SRC_WOW64_H__ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "sandbox/src/sandbox_types.h" | 11 #include "sandbox/src/sandbox_types.h" |
12 | 12 |
13 namespace sandbox { | 13 namespace sandbox { |
14 | 14 |
15 class TargetProcess; | 15 class TargetProcess; |
16 | 16 |
17 // This class wraps the code needed to interact with the Windows On Windows | 17 // This class wraps the code needed to interact with the Windows On Windows |
18 // subsystem on 64 bit OSes, from the point of view of interceptions. | 18 // subsystem on 64 bit OSes, from the point of view of interceptions. |
19 class Wow64 { | 19 class Wow64 { |
20 public: | 20 public: |
21 Wow64(TargetProcess* child, HMODULE ntdll) | 21 Wow64(TargetProcess* child, HMODULE ntdll) |
22 : child_(child), ntdll_(ntdll), init_(false), dll_load_(NULL), | 22 : child_(child), ntdll_(ntdll), dll_load_(NULL), continue_load_(NULL) {} |
23 continue_load_(NULL) {} | |
24 ~Wow64(); | 23 ~Wow64(); |
25 | 24 |
26 // Waits for the 32 bit DLL to get loaded on the child process. This function | 25 // Waits for the 32 bit DLL to get loaded on the child process. This function |
27 // will return immediately if not running under WOW, or launch the helper | 26 // will return immediately if not running under WOW, or launch the helper |
28 // process and wait until ntdll is ready. | 27 // process and wait until ntdll is ready. |
29 bool WaitForNtdll(DWORD timeout_ms); | 28 bool WaitForNtdll(); |
30 | |
31 // Returns true if this is a 32 bit process running on a 64 bit OS. | |
32 bool IsWow64(); | |
33 | 29 |
34 private: | 30 private: |
35 // Runs the WOW helper process, passing the address of a buffer allocated on | 31 // Runs the WOW helper process, passing the address of a buffer allocated on |
36 // the child (one page). | 32 // the child (one page). |
37 bool RunWowHelper(void* buffer, DWORD timeout_ms); | 33 bool RunWowHelper(void* buffer); |
38 | 34 |
39 // This method receives "notifications" whenever a DLL is mapped on the child. | 35 // This method receives "notifications" whenever a DLL is mapped on the child. |
40 bool DllMapped(DWORD timeout_ms); | 36 bool DllMapped(); |
41 | 37 |
42 // Returns true if ntdll.dll is mapped on the child. | 38 // Returns true if ntdll.dll is mapped on the child. |
43 bool NtdllPresent(); | 39 bool NtdllPresent(); |
44 | 40 |
45 TargetProcess* child_; // Child process. | 41 TargetProcess* child_; // Child process. |
46 HMODULE ntdll_; // ntdll on the parent. | 42 HMODULE ntdll_; // ntdll on the parent. |
47 HANDLE dll_load_; // Event that is signaled on dll load. | 43 HANDLE dll_load_; // Event that is signaled on dll load. |
48 HANDLE continue_load_; // Event to signal to continue execution on the child. | 44 HANDLE continue_load_; // Event to signal to continue execution on the child. |
49 bool init_; // Initialization control. | |
50 bool is_wow64_; // true on WOW64 environments. | |
51 DISALLOW_IMPLICIT_CONSTRUCTORS(Wow64); | 45 DISALLOW_IMPLICIT_CONSTRUCTORS(Wow64); |
52 }; | 46 }; |
53 | 47 |
54 } // namespace sandbox | 48 } // namespace sandbox |
55 | 49 |
56 #endif // SANDBOX_SRC_WOW64_H__ | 50 #endif // SANDBOX_SRC_WOW64_H__ |
OLD | NEW |