OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cloud_print/service/win/cloud_print_service.h" |
| 6 |
| 7 #include "cloud_print/service/win/resource.h" |
| 8 |
| 9 class CloudPrintServiceModule |
| 10 : public ATL::CAtlServiceModuleT<CloudPrintServiceModule, IDS_SERVICENAME> { |
| 11 public: |
| 12 DECLARE_REGISTRY_APPID_RESOURCEID(IDR_CLOUDPRINTSERVICE, |
| 13 "{8013FB7C-2E3E-4992-B8BD-05C0C4AB0627}") |
| 14 HRESULT InitializeSecurity() throw() { |
| 15 // TODO(gene): Check if we need to call CoInitializeSecurity and provide |
| 16 // the appropriate security settings for service. |
| 17 return S_OK; |
| 18 } |
| 19 }; |
| 20 |
| 21 CloudPrintServiceModule _AtlModule; |
| 22 |
| 23 int WINAPI WinMain(__in HINSTANCE hInstance, |
| 24 __in HINSTANCE hPrevInstance, |
| 25 __in LPSTR lpCmdLine, |
| 26 __in int nCmdShow) { |
| 27 // Handle service unstall case manually. |
| 28 // Service install is handled through ATL, command line flag "/Service" |
| 29 // http://msdn.microsoft.com/en-US/library/z8868y94(v=vs.80).aspx |
| 30 if (StrStrA(lpCmdLine, "/UninstallService") != NULL) { |
| 31 _AtlModule.Uninstall(); |
| 32 return 0; |
| 33 } |
| 34 |
| 35 // TODO(gene): When running this program with "/Service" flag it fails |
| 36 // silently if command prompt is not elevated. |
| 37 // Consider adding manifest to require elevated prompt, or at least |
| 38 // print warning in this case. |
| 39 return _AtlModule.WinMain(nCmdShow); |
| 40 } |
| 41 |
OLD | NEW |