OLD | NEW |
1 // Copyright (c) 2011 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 #include "sandbox/src/wow64.h" | 5 #include "sandbox/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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 // 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 |
84 // 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 |
85 // 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 |
86 // 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 |
87 // 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 |
88 // 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 |
89 // our caller. | 89 // our caller. |
90 bool Wow64::WaitForNtdll() { | 90 bool Wow64::WaitForNtdll() { |
91 if (base::win::GetWOW64Status() != base::win::WOW64_ENABLED) | 91 if (base::win::OSInfo::GetInstance()->wow64_status() != |
| 92 base::win::OSInfo::WOW64_ENABLED) |
92 return true; | 93 return true; |
93 | 94 |
94 const size_t page_size = 4096; | 95 const size_t page_size = 4096; |
95 | 96 |
96 // Create some default manual reset un-named events, not signaled. | 97 // Create some default manual reset un-named events, not signaled. |
97 dll_load_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); | 98 dll_load_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); |
98 continue_load_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); | 99 continue_load_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); |
99 HANDLE current_process = ::GetCurrentProcess(); | 100 HANDLE current_process = ::GetCurrentProcess(); |
100 HANDLE remote_load, remote_continue; | 101 HANDLE remote_load, remote_continue; |
101 DWORD access = EVENT_MODIFY_STATE | SYNCHRONIZE; | 102 DWORD access = EVENT_MODIFY_STATE | SYNCHRONIZE; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 SIZE_T read; | 211 SIZE_T read; |
211 if (!::ReadProcessMemory(child_->Process(), ntdll_, &buffer, kBufferSize, | 212 if (!::ReadProcessMemory(child_->Process(), ntdll_, &buffer, kBufferSize, |
212 &read)) | 213 &read)) |
213 return false; | 214 return false; |
214 if (kBufferSize != read) | 215 if (kBufferSize != read) |
215 return false; | 216 return false; |
216 return true; | 217 return true; |
217 } | 218 } |
218 | 219 |
219 } // namespace sandbox | 220 } // namespace sandbox |
OLD | NEW |