OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "sandbox/win/src/wow64.h" | 5 #include "sandbox/win/src/wow64.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return false; | 66 return false; |
67 return true; | 67 return true; |
68 } | 68 } |
69 | 69 |
70 typedef BOOL (WINAPI* IsWow64ProcessFunction)(HANDLE process, BOOL* wow64); | 70 typedef BOOL (WINAPI* IsWow64ProcessFunction)(HANDLE process, BOOL* wow64); |
71 | 71 |
72 } // namespace | 72 } // namespace |
73 | 73 |
74 namespace sandbox { | 74 namespace sandbox { |
75 | 75 |
| 76 Wow64::Wow64(TargetProcess* child, HMODULE ntdll) |
| 77 : child_(child), ntdll_(ntdll), dll_load_(NULL), continue_load_(NULL) { |
| 78 } |
| 79 |
76 Wow64::~Wow64() { | 80 Wow64::~Wow64() { |
77 } | 81 } |
78 | 82 |
79 // The basic idea is to allocate one page of memory on the child, and initialize | 83 // The basic idea is to allocate one page of memory on the child, and initialize |
80 // the first part of it with our version of PatchInfo32. Then launch the helper | 84 // the first part of it with our version of PatchInfo32. Then launch the helper |
81 // process passing it that address on the child. The helper process will patch | 85 // process passing it that address on the child. The helper process will patch |
82 // the 64 bit version of NtMapViewOfFile, and the interception will signal the | 86 // the 64 bit version of NtMapViewOfFile, and the interception will signal the |
83 // first event on the buffer. We'll be waiting on that event and after the 32 | 87 // first event on the buffer. We'll be waiting on that event and after the 32 |
84 // bit version of ntdll is loaded, we'll remove the interception and return to | 88 // bit version of ntdll is loaded, we'll remove the interception and return to |
85 // our caller. | 89 // our caller. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 SIZE_T read; | 214 SIZE_T read; |
211 if (!::ReadProcessMemory(child_->Process(), ntdll_, &buffer, kBufferSize, | 215 if (!::ReadProcessMemory(child_->Process(), ntdll_, &buffer, kBufferSize, |
212 &read)) | 216 &read)) |
213 return false; | 217 return false; |
214 if (kBufferSize != read) | 218 if (kBufferSize != read) |
215 return false; | 219 return false; |
216 return true; | 220 return true; |
217 } | 221 } |
218 | 222 |
219 } // namespace sandbox | 223 } // namespace sandbox |
OLD | NEW |