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

Side by Side Diff: cloud_print/service/win/service_controller.cc

Issue 1408623002: Add cloud_print to the GN build. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 5 years, 2 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
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698