Bug 757711 - Service does not get replaced for newer builds since bug 748764; r=ehsan, a=akeybl.
authorBrian R. Bondy <netzen@gmail.com>
Wed, 23 May 2012 17:28:08 -0400
changeset 95867 2056622a1ac05b0e98f5e3084cbacc70f7841771
parent 95866 17bdb597ba39a4cf857aa49f5d57dbf533ee3712
child 95868 f937f9e12e9bf6303c874aaa84586d43335c65c1
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, akeybl
bugs757711, 748764
milestone14.0a2
Bug 757711 - Service does not get replaced for newer builds since bug 748764; r=ehsan, a=akeybl.
toolkit/components/maintenanceservice/serviceinstall.cpp
--- a/toolkit/components/maintenanceservice/serviceinstall.cpp
+++ b/toolkit/components/maintenanceservice/serviceinstall.cpp
@@ -261,16 +261,21 @@ SvcInstall(SvcInstallAction action)
         bytesNeeded, &bytesNeeded)) {
       LOG(("Could open service but could not query service config.  (%d)\n", 
            GetLastError()));
       return FALSE;
     }
     QUERY_SERVICE_CONFIGW &serviceConfig = 
       *reinterpret_cast<QUERY_SERVICE_CONFIGW*>(serviceConfigBuffer.get());
 
+    // Ensure the service path is not quoted. We own this memory and know it to
+    // be large enough for the quoted path, so it is large enough for the
+    // unquoted path.  This function cannot fail.
+    PathUnquoteSpacesW(serviceConfig.lpBinaryPathName);
+
     // Obtain the existing maintenanceservice file's version number and
     // the new file's version number.  Versions are in the format of
     // A.B.C.D.
     DWORD existingA, existingB, existingC, existingD;
     DWORD newA, newB, newC, newD; 
     BOOL obtainedExistingVersionInfo = 
       GetVersionNumberFromPath(serviceConfig.lpBinaryPathName, 
                                existingA, existingB, 
@@ -400,17 +405,17 @@ SvcInstall(SvcInstallAction action)
   
   // If the service does not exist and we are upgrading, don't install it.
   if (UpgradeSvc == action) {
     // The service does not exist and we are upgrading, so don't install it
     return TRUE;
   }
 
   // Quote the path only if it contains spaces.
-  PathQuoteSpaces(newServiceBinaryPath);
+  PathQuoteSpacesW(newServiceBinaryPath);
   // The service does not already exist so create the service as on demand
   schService.own(CreateServiceW(schSCManager, SVC_NAME, SVC_DISPLAY_NAME,
                                 SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
                                 SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL,
                                 newServiceBinaryPath, NULL, NULL, NULL, 
                                 NULL, NULL));
   if (!schService) {
     LOG(("Could not create Windows service. "