| 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 "remoting/host/win/launch_process_with_token.h" | 5 #include "remoting/host/win/launch_process_with_token.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <winternl.h> | 8 #include <winternl.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 }; | 320 }; |
| 321 | 321 |
| 322 string16 desktop; | 322 string16 desktop; |
| 323 if (desktop_name) | 323 if (desktop_name) |
| 324 desktop = desktop_name; | 324 desktop = desktop_name; |
| 325 | 325 |
| 326 // Allocate a large enough buffer to hold the CreateProcessRequest structure | 326 // Allocate a large enough buffer to hold the CreateProcessRequest structure |
| 327 // and three NULL-terminated string parameters. | 327 // and three NULL-terminated string parameters. |
| 328 size_t size = sizeof(CreateProcessRequest) + sizeof(wchar_t) * | 328 size_t size = sizeof(CreateProcessRequest) + sizeof(wchar_t) * |
| 329 (application_name.size() + command_line.size() + desktop.size() + 3); | 329 (application_name.size() + command_line.size() + desktop.size() + 3); |
| 330 scoped_array<char> buffer(new char[size]); | 330 scoped_ptr<char[]> buffer(new char[size]); |
| 331 memset(buffer.get(), 0, size); | 331 memset(buffer.get(), 0, size); |
| 332 | 332 |
| 333 // Marshal the input parameters. | 333 // Marshal the input parameters. |
| 334 CreateProcessRequest* request = | 334 CreateProcessRequest* request = |
| 335 reinterpret_cast<CreateProcessRequest*>(buffer.get()); | 335 reinterpret_cast<CreateProcessRequest*>(buffer.get()); |
| 336 request->size = size; | 336 request->size = size; |
| 337 request->process_id = GetCurrentProcessId(); | 337 request->process_id = GetCurrentProcessId(); |
| 338 request->use_default_token = TRUE; | 338 request->use_default_token = TRUE; |
| 339 // Always pass CREATE_SUSPENDED to avoid a race between the created process | 339 // Always pass CREATE_SUSPENDED to avoid a race between the created process |
| 340 // exiting too soon and OpenProcess() call below. | 340 // exiting too soon and OpenProcess() call below. |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 return false; | 619 return false; |
| 620 } | 620 } |
| 621 | 621 |
| 622 CHECK(process_info.IsValid()); | 622 CHECK(process_info.IsValid()); |
| 623 process_out->Set(process_info.TakeProcessHandle()); | 623 process_out->Set(process_info.TakeProcessHandle()); |
| 624 thread_out->Set(process_info.TakeThreadHandle()); | 624 thread_out->Set(process_info.TakeThreadHandle()); |
| 625 return true; | 625 return true; |
| 626 } | 626 } |
| 627 | 627 |
| 628 } // namespace remoting | 628 } // namespace remoting |
| OLD | NEW |