| 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::OSInfo::GetInstance()->wow64_status() != | 91 if (base::win::GetWOW64Status() != base::win::WOW64_ENABLED) |
| 92 base::win::OSInfo::WOW64_ENABLED) | |
| 93 return true; | 92 return true; |
| 94 | 93 |
| 95 const size_t page_size = 4096; | 94 const size_t page_size = 4096; |
| 96 | 95 |
| 97 // Create some default manual reset un-named events, not signaled. | 96 // Create some default manual reset un-named events, not signaled. |
| 98 dll_load_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); | 97 dll_load_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); |
| 99 continue_load_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); | 98 continue_load_ = ::CreateEvent(NULL, TRUE, FALSE, NULL); |
| 100 HANDLE current_process = ::GetCurrentProcess(); | 99 HANDLE current_process = ::GetCurrentProcess(); |
| 101 HANDLE remote_load, remote_continue; | 100 HANDLE remote_load, remote_continue; |
| 102 DWORD access = EVENT_MODIFY_STATE | SYNCHRONIZE; | 101 DWORD access = EVENT_MODIFY_STATE | SYNCHRONIZE; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 SIZE_T read; | 210 SIZE_T read; |
| 212 if (!::ReadProcessMemory(child_->Process(), ntdll_, &buffer, kBufferSize, | 211 if (!::ReadProcessMemory(child_->Process(), ntdll_, &buffer, kBufferSize, |
| 213 &read)) | 212 &read)) |
| 214 return false; | 213 return false; |
| 215 if (kBufferSize != read) | 214 if (kBufferSize != read) |
| 216 return false; | 215 return false; |
| 217 return true; | 216 return true; |
| 218 } | 217 } |
| 219 | 218 |
| 220 } // namespace sandbox | 219 } // namespace sandbox |
| OLD | NEW |