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

Unified Diff: cloud_print/service/win/cloud_print_service.cc

Issue 10222011: Adding Windows service template for Cloud Print connector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cloud_print/service/win/cloud_print_service.h ('k') | cloud_print/service/win/cloud_print_service.rc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cloud_print/service/win/cloud_print_service.cc
===================================================================
--- cloud_print/service/win/cloud_print_service.cc (revision 0)
+++ cloud_print/service/win/cloud_print_service.cc (revision 0)
@@ -0,0 +1,41 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cloud_print/service/win/cloud_print_service.h"
+
+#include "cloud_print/service/win/resource.h"
+
+class CloudPrintServiceModule
+ : public ATL::CAtlServiceModuleT<CloudPrintServiceModule, IDS_SERVICENAME> {
+ public:
+ DECLARE_REGISTRY_APPID_RESOURCEID(IDR_CLOUDPRINTSERVICE,
+ "{8013FB7C-2E3E-4992-B8BD-05C0C4AB0627}")
+ HRESULT InitializeSecurity() throw() {
+ // TODO(gene): Check if we need to call CoInitializeSecurity and provide
+ // the appropriate security settings for service.
+ return S_OK;
+ }
+};
+
+CloudPrintServiceModule _AtlModule;
+
+int WINAPI WinMain(__in HINSTANCE hInstance,
+ __in HINSTANCE hPrevInstance,
+ __in LPSTR lpCmdLine,
+ __in int nCmdShow) {
+ // Handle service unstall case manually.
+ // Service install is handled through ATL, command line flag "/Service"
+ // http://msdn.microsoft.com/en-US/library/z8868y94(v=vs.80).aspx
+ if (StrStrA(lpCmdLine, "/UninstallService") != NULL) {
+ _AtlModule.Uninstall();
+ return 0;
+ }
+
+ // TODO(gene): When running this program with "/Service" flag it fails
+ // silently if command prompt is not elevated.
+ // Consider adding manifest to require elevated prompt, or at least
+ // print warning in this case.
+ return _AtlModule.WinMain(nCmdShow);
+}
+
« no previous file with comments | « cloud_print/service/win/cloud_print_service.h ('k') | cloud_print/service/win/cloud_print_service.rc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698