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

Side by Side Diff: remoting/host/host_service_win.cc

Issue 9617027: Chromoting: Implemented security attention sequence (SAS) emulation on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 9 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/host_mock_objects.cc ('k') | remoting/host/plugin/host_script_object.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 // This file implements the Windows service controlling Me2Me host processes 5 // This file implements the Windows service controlling Me2Me host processes
6 // running within user sessions. 6 // running within user sessions.
7 7
8 #include "remoting/host/host_service_win.h" 8 #include "remoting/host/host_service_win.h"
9 9
10 #include <windows.h> 10 #include <windows.h>
11 #include <wtsapi32.h> 11 #include <wtsapi32.h>
12 #include <stdio.h> 12 #include <stdio.h>
13 13
14 #include "base/at_exit.h" 14 #include "base/at_exit.h"
15 #include "base/base_paths.h" 15 #include "base/base_paths.h"
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/file_util.h" 18 #include "base/file_util.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/message_loop.h" 20 #include "base/message_loop.h"
21 #include "base/path_service.h" 21 #include "base/path_service.h"
22 #include "base/stringprintf.h" 22 #include "base/stringprintf.h"
23 #include "base/threading/thread.h"
23 #include "base/utf_string_conversions.h" 24 #include "base/utf_string_conversions.h"
24 #include "base/win/wrapped_window_proc.h" 25 #include "base/win/wrapped_window_proc.h"
25 26
26 #include "remoting/host/host_service_resource.h" 27 #include "remoting/host/host_service_resource.h"
27 #include "remoting/base/scoped_sc_handle_win.h" 28 #include "remoting/base/scoped_sc_handle_win.h"
28 #include "remoting/host/wts_console_observer_win.h" 29 #include "remoting/host/wts_console_observer_win.h"
29 #include "remoting/host/wts_session_process_launcher_win.h" 30 #include "remoting/host/wts_session_process_launcher_win.h"
30 31
31 using base::StringPrintf; 32 using base::StringPrintf;
32 33
33 namespace { 34 namespace {
34 35
35 // Service name. 36 // Service name.
36 const char kServiceName[] = "chromoting"; 37 const char kServiceName[] = "chromoting";
37 // TODO(alexeypa): investigate and migrate this over to Chrome's i18n framework. 38 // TODO(alexeypa): investigate and migrate this over to Chrome's i18n framework.
38 const char kMuiStringFormat[] = "@%ls,-%d"; 39 const char kMuiStringFormat[] = "@%ls,-%d";
39 const char kServiceDependencies[] = ""; 40 const char kServiceDependencies[] = "";
40 41
41 const char kServiceCommandLineFormat[] = "\"%ls\" --host-binary=\"%ls\""; 42 const char kServiceCommandLineFormat[] = "\"%ls\" --host-binary=\"%ls\"";
42 43
43 const DWORD kServiceStopTimeoutMs = 30 * 1000; 44 const DWORD kServiceStopTimeoutMs = 30 * 1000;
44 45
45 // Session id that does not represent any session. 46 // Session id that does not represent any session.
46 const uint32 kInvalidSession = 0xffffffff; 47 const uint32 kInvalidSession = 0xffffffff;
47 48
49 const char kIoThreadName[] = "I/O thread";
50
48 // A window class for the session change notifications window. 51 // A window class for the session change notifications window.
49 static const char kSessionNotificationWindowClass[] = 52 static const char kSessionNotificationWindowClass[] =
50 "Chromoting_SessionNotificationWindow"; 53 "Chromoting_SessionNotificationWindow";
51 54
52 // Command line actions and switches: 55 // Command line actions and switches:
53 // "run" sumply runs the service as usual. 56 // "run" sumply runs the service as usual.
54 const char kRunActionName[] = "run"; 57 const char kRunActionName[] = "run";
55 58
56 // "install" requests the service to be installed. 59 // "install" requests the service to be installed.
57 const char kInstallActionName[] = "install"; 60 const char kInstallActionName[] = "install";
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 347
345 printf("The service has been removed successfully.\n"); 348 printf("The service has been removed successfully.\n");
346 return kSuccessExitCode; 349 return kSuccessExitCode;
347 } 350 }
348 351
349 int HostService::Run() { 352 int HostService::Run() {
350 return (this->*run_routine_)(); 353 return (this->*run_routine_)();
351 } 354 }
352 355
353 void HostService::RunMessageLoop() { 356 void HostService::RunMessageLoop() {
354 WtsSessionProcessLauncher launcher(this, host_binary_); 357 // Launch the I/O thread.
358 base::Thread io_thread(kIoThreadName);
359 base::Thread::Options io_thread_options(MessageLoop::TYPE_IO, 0);
360 if (!io_thread.StartWithOptions(io_thread_options)) {
361 shutting_down_ = true;
362 stopped_event_.Signal();
363 return;
364 }
365
366 WtsSessionProcessLauncher launcher(this, host_binary_, &io_thread);
355 367
356 // Run the service. 368 // Run the service.
357 message_loop_->Run(); 369 message_loop_->Run();
358 370
359 // Clean up the observers by emulating detaching from the console. 371 // Clean up the observers by emulating detaching from the console.
360 shutting_down_ = true; 372 shutting_down_ = true;
361 OnSessionChange(); 373 OnSessionChange();
362 374
363 // Release the control handler. 375 // Release the control handler.
364 stopped_event_.Signal(); 376 stopped_event_.Signal();
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 } 579 }
568 580
569 remoting::HostService* service = remoting::HostService::GetInstance(); 581 remoting::HostService* service = remoting::HostService::GetInstance();
570 if (!service->InitWithCommandLine(command_line)) { 582 if (!service->InitWithCommandLine(command_line)) {
571 usage(argv[0]); 583 usage(argv[0]);
572 return kUsageExitCode; 584 return kUsageExitCode;
573 } 585 }
574 586
575 return service->Run(); 587 return service->Run();
576 } 588 }
OLDNEW
« no previous file with comments | « remoting/host/host_mock_objects.cc ('k') | remoting/host/plugin/host_script_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698