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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 sizeof(name), | 80 sizeof(name), |
81 &name_length)) { | 81 &name_length)) { |
82 pipe_name.assign(name); | 82 pipe_name.assign(name); |
83 } | 83 } |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 // Use the default pipe name if we couldn't query its name. | 87 // Use the default pipe name if we couldn't query its name. |
88 if (pipe_name.empty()) { | 88 if (pipe_name.empty()) { |
89 pipe_name = UTF8ToUTF16( | 89 pipe_name = UTF8ToUTF16( |
90 StringPrintf(kCreateProcessDefaultPipeNameFormat, session_id)); | 90 base::StringPrintf(kCreateProcessDefaultPipeNameFormat, session_id)); |
91 } | 91 } |
92 | 92 |
93 // Try to connect to the named pipe. | 93 // Try to connect to the named pipe. |
94 base::win::ScopedHandle pipe; | 94 base::win::ScopedHandle pipe; |
95 for (int i = 0; i < kPipeConnectMaxAttempts; ++i) { | 95 for (int i = 0; i < kPipeConnectMaxAttempts; ++i) { |
96 pipe.Set(CreateFile(pipe_name.c_str(), | 96 pipe.Set(CreateFile(pipe_name.c_str(), |
97 GENERIC_READ | GENERIC_WRITE, | 97 GENERIC_READ | GENERIC_WRITE, |
98 0, | 98 0, |
99 NULL, | 99 NULL, |
100 OPEN_EXISTING, | 100 OPEN_EXISTING, |
(...skipping 518 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 |