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

Side by Side Diff: remoting/host/win/launch_process_with_token.cc

Issue 121123002: Update uses of UTF conversions in ppapi/, printing/, remoting/, rlz/, sandbox/, skia/, sql/, sync/,… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months 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 | « remoting/host/win/host_service.cc ('k') | remoting/host/win/rdp_client_window.cc » ('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 "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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 } 52 }
53 53
54 // Connects to the executor server corresponding to |session_id|. 54 // Connects to the executor server corresponding to |session_id|.
55 bool ConnectToExecutionServer(uint32 session_id, 55 bool ConnectToExecutionServer(uint32 session_id,
56 base::win::ScopedHandle* pipe_out) { 56 base::win::ScopedHandle* pipe_out) {
57 base::string16 pipe_name; 57 base::string16 pipe_name;
58 58
59 // Use winsta!WinStationQueryInformationW() to determine the process creation 59 // Use winsta!WinStationQueryInformationW() to determine the process creation
60 // pipe name for the session. 60 // pipe name for the session.
61 base::FilePath winsta_path(base::GetNativeLibraryName(UTF8ToUTF16("winsta"))); 61 base::FilePath winsta_path(
62 base::GetNativeLibraryName(base::UTF8ToUTF16("winsta")));
62 base::ScopedNativeLibrary winsta(winsta_path); 63 base::ScopedNativeLibrary winsta(winsta_path);
63 if (winsta.is_valid()) { 64 if (winsta.is_valid()) {
64 PWINSTATIONQUERYINFORMATIONW win_station_query_information = 65 PWINSTATIONQUERYINFORMATIONW win_station_query_information =
65 static_cast<PWINSTATIONQUERYINFORMATIONW>( 66 static_cast<PWINSTATIONQUERYINFORMATIONW>(
66 winsta.GetFunctionPointer("WinStationQueryInformationW")); 67 winsta.GetFunctionPointer("WinStationQueryInformationW"));
67 if (win_station_query_information) { 68 if (win_station_query_information) {
68 wchar_t name[MAX_PATH]; 69 wchar_t name[MAX_PATH];
69 ULONG name_length; 70 ULONG name_length;
70 if (win_station_query_information(0, 71 if (win_station_query_information(0,
71 session_id, 72 session_id,
72 kCreateProcessPipeNameClass, 73 kCreateProcessPipeNameClass,
73 name, 74 name,
74 sizeof(name), 75 sizeof(name),
75 &name_length)) { 76 &name_length)) {
76 pipe_name.assign(name); 77 pipe_name.assign(name);
77 } 78 }
78 } 79 }
79 } 80 }
80 81
81 // Use the default pipe name if we couldn't query its name. 82 // Use the default pipe name if we couldn't query its name.
82 if (pipe_name.empty()) { 83 if (pipe_name.empty()) {
83 pipe_name = UTF8ToUTF16( 84 pipe_name = base::UTF8ToUTF16(
84 base::StringPrintf(kCreateProcessDefaultPipeNameFormat, session_id)); 85 base::StringPrintf(kCreateProcessDefaultPipeNameFormat, session_id));
85 } 86 }
86 87
87 // Try to connect to the named pipe. 88 // Try to connect to the named pipe.
88 base::win::ScopedHandle pipe; 89 base::win::ScopedHandle pipe;
89 for (int i = 0; i < kPipeConnectMaxAttempts; ++i) { 90 for (int i = 0; i < kPipeConnectMaxAttempts; ++i) {
90 pipe.Set(CreateFile(pipe_name.c_str(), 91 pipe.Set(CreateFile(pipe_name.c_str(),
91 GENERIC_READ | GENERIC_WRITE, 92 GENERIC_READ | GENERIC_WRITE,
92 0, 93 0,
93 NULL, 94 NULL,
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 519
519 base::win::ScopedProcessInformation process_info(temp_process_info); 520 base::win::ScopedProcessInformation process_info(temp_process_info);
520 521
521 CHECK(process_info.IsValid()); 522 CHECK(process_info.IsValid());
522 process_out->Set(process_info.TakeProcessHandle()); 523 process_out->Set(process_info.TakeProcessHandle());
523 thread_out->Set(process_info.TakeThreadHandle()); 524 thread_out->Set(process_info.TakeThreadHandle());
524 return true; 525 return true;
525 } 526 }
526 527
527 } // namespace remoting 528 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/win/host_service.cc ('k') | remoting/host/win/rdp_client_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698