OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cloud_print/service/win/service_controller.h" | 5 #include "cloud_print/service/win/service_controller.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlcom.h> | 8 #include <atlcom.h> |
9 #include <atlctl.h> | 9 #include <atlctl.h> |
10 | 10 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 293 } |
294 | 294 |
295 DWORD config_size = 0; | 295 DWORD config_size = 0; |
296 ::QueryServiceConfig(service.Get(), NULL, 0, &config_size); | 296 ::QueryServiceConfig(service.Get(), NULL, 0, &config_size); |
297 if (!config_size) | 297 if (!config_size) |
298 return; | 298 return; |
299 | 299 |
300 std::vector<uint8> buffer(config_size, 0); | 300 std::vector<uint8> buffer(config_size, 0); |
301 QUERY_SERVICE_CONFIG* config = | 301 QUERY_SERVICE_CONFIG* config = |
302 reinterpret_cast<QUERY_SERVICE_CONFIG*>(&buffer[0]); | 302 reinterpret_cast<QUERY_SERVICE_CONFIG*>(&buffer[0]); |
303 if (!::QueryServiceConfig(service.Get(), config, buffer.size(), | 303 if (!::QueryServiceConfig(service.Get(), config, |
| 304 static_cast<DWORD>(buffer.size()), |
304 &config_size) || | 305 &config_size) || |
305 config_size != buffer.size()) { | 306 config_size != buffer.size()) { |
306 return; | 307 return; |
307 } | 308 } |
308 | 309 |
309 command_line_ = base::CommandLine::FromString(config->lpBinaryPathName); | 310 command_line_ = base::CommandLine::FromString(config->lpBinaryPathName); |
310 if (!command_line_.HasSwitch(kServiceSwitch)) { | 311 if (!command_line_.HasSwitch(kServiceSwitch)) { |
311 state_ = STATE_NOT_FOUND; | 312 state_ = STATE_NOT_FOUND; |
312 return; | 313 return; |
313 } | 314 } |
314 is_logging_enabled_ = command_line_.HasSwitch(switches::kEnableLogging); | 315 is_logging_enabled_ = command_line_.HasSwitch(switches::kEnableLogging); |
315 user_ = config->lpServiceStartName; | 316 user_ = config->lpServiceStartName; |
316 } | 317 } |
317 | 318 |
318 bool ServiceController::is_logging_enabled() const { | 319 bool ServiceController::is_logging_enabled() const { |
319 return command_line_.HasSwitch(switches::kEnableLogging); | 320 return command_line_.HasSwitch(switches::kEnableLogging); |
320 } | 321 } |
OLD | NEW |