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/plugin/daemon_controller.h" | 5 #include "remoting/host/plugin/daemon_controller.h" |
6 | 6 |
7 #include <objbase.h> | 7 #include <objbase.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 ::OpenSCManagerW(NULL, SERVICES_ACTIVE_DATABASE, | 283 ::OpenSCManagerW(NULL, SERVICES_ACTIVE_DATABASE, |
284 SC_MANAGER_CONNECT | SC_MANAGER_ENUMERATE_SERVICE)); | 284 SC_MANAGER_CONNECT | SC_MANAGER_ENUMERATE_SERVICE)); |
285 if (!scmanager.IsValid()) { | 285 if (!scmanager.IsValid()) { |
286 DWORD error = GetLastError(); | 286 DWORD error = GetLastError(); |
287 LOG_GETLASTERROR(ERROR) | 287 LOG_GETLASTERROR(ERROR) |
288 << "Failed to connect to the service control manager"; | 288 << "Failed to connect to the service control manager"; |
289 return error; | 289 return error; |
290 } | 290 } |
291 | 291 |
292 ScopedScHandle service( | 292 ScopedScHandle service( |
293 ::OpenServiceW(scmanager, UTF8ToUTF16(kWindowsServiceName).c_str(), | 293 ::OpenServiceW(scmanager, kWindowsServiceName, SERVICE_QUERY_STATUS)); |
294 SERVICE_QUERY_STATUS)); | |
295 if (!service.IsValid()) { | 294 if (!service.IsValid()) { |
296 DWORD error = GetLastError(); | 295 DWORD error = GetLastError(); |
297 if (error != ERROR_SERVICE_DOES_NOT_EXIST) { | 296 if (error != ERROR_SERVICE_DOES_NOT_EXIST) { |
298 LOG_GETLASTERROR(ERROR) | 297 LOG_GETLASTERROR(ERROR) |
299 << "Failed to open to the '" << kWindowsServiceName << "' service"; | 298 << "Failed to open to the '" << kWindowsServiceName << "' service"; |
300 } | 299 } |
301 return error; | 300 return error; |
302 } | 301 } |
303 | 302 |
304 service_out->Set(service.Take()); | 303 service_out->Set(service.Take()); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 done_callback.Run(HResultToAsyncResult(hr)); | 419 done_callback.Run(HResultToAsyncResult(hr)); |
421 } | 420 } |
422 | 421 |
423 } // namespace | 422 } // namespace |
424 | 423 |
425 scoped_ptr<DaemonController> remoting::DaemonController::Create() { | 424 scoped_ptr<DaemonController> remoting::DaemonController::Create() { |
426 return scoped_ptr<DaemonController>(new DaemonControllerWin()); | 425 return scoped_ptr<DaemonController>(new DaemonControllerWin()); |
427 } | 426 } |
428 | 427 |
429 } // namespace remoting | 428 } // namespace remoting |
OLD | NEW |