Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: sandbox/win/src/Wow64.cc

Issue 109843003: Replace wstring with string16 in sandbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sandbox/win/sandbox_poc/sandbox.cc ('k') | sandbox/win/src/crosscall_server.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // The 32 bit version is available, cleanup the child. 135 // The 32 bit version is available, cleanup the child.
136 return Restore64Code(child_->Process(), patch_info); 136 return Restore64Code(child_->Process(), patch_info);
137 } 137 }
138 138
139 bool Wow64::RunWowHelper(void* buffer) { 139 bool Wow64::RunWowHelper(void* buffer) {
140 COMPILE_ASSERT(sizeof(buffer) <= sizeof(DWORD), unsupported_64_bits); 140 COMPILE_ASSERT(sizeof(buffer) <= sizeof(DWORD), unsupported_64_bits);
141 141
142 // Get the path to the helper (beside the exe). 142 // Get the path to the helper (beside the exe).
143 wchar_t prog_name[MAX_PATH]; 143 wchar_t prog_name[MAX_PATH];
144 GetModuleFileNameW(NULL, prog_name, MAX_PATH); 144 GetModuleFileNameW(NULL, prog_name, MAX_PATH);
145 std::wstring path(prog_name); 145 base::string16 path(prog_name);
146 size_t name_pos = path.find_last_of(L"\\"); 146 size_t name_pos = path.find_last_of(L"\\");
147 if (std::wstring::npos == name_pos) 147 if (base::string16::npos == name_pos)
148 return false; 148 return false;
149 path.resize(name_pos + 1); 149 path.resize(name_pos + 1);
150 150
151 std::wstringstream command; 151 std::basic_stringstream<base::char16> command;
152 command << std::hex << std::showbase << L"\"" << path << 152 command << std::hex << std::showbase << L"\"" << path <<
153 L"wow_helper.exe\" " << child_->ProcessId() << " " << 153 L"wow_helper.exe\" " << child_->ProcessId() << " " <<
154 bit_cast<ULONG>(buffer); 154 bit_cast<ULONG>(buffer);
155 155
156 scoped_ptr_malloc<wchar_t> writable_command(_wcsdup(command.str().c_str())); 156 scoped_ptr_malloc<wchar_t> writable_command(_wcsdup(command.str().c_str()));
157 157
158 STARTUPINFO startup_info = {0}; 158 STARTUPINFO startup_info = {0};
159 startup_info.cb = sizeof(startup_info); 159 startup_info.cb = sizeof(startup_info);
160 PROCESS_INFORMATION temp_process_info = {}; 160 PROCESS_INFORMATION temp_process_info = {};
161 if (!::CreateProcess(NULL, writable_command.get(), NULL, NULL, FALSE, 0, NULL, 161 if (!::CreateProcess(NULL, writable_command.get(), NULL, NULL, FALSE, 0, NULL,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 SIZE_T read; 211 SIZE_T read;
212 if (!::ReadProcessMemory(child_->Process(), ntdll_, &buffer, kBufferSize, 212 if (!::ReadProcessMemory(child_->Process(), ntdll_, &buffer, kBufferSize,
213 &read)) 213 &read))
214 return false; 214 return false;
215 if (kBufferSize != read) 215 if (kBufferSize != read)
216 return false; 216 return false;
217 return true; 217 return true;
218 } 218 }
219 219
220 } // namespace sandbox 220 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/sandbox_poc/sandbox.cc ('k') | sandbox/win/src/crosscall_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698