[Commits] Rev 2942: Split long (> 80 char) lines in file:///H:/bzr/5.2-windows-packaging-upgrade/

Vladislav Vaintroub wlad at montyprogram.com
Sun Jan 30 01:00:28 EET 2011


At file:///H:/bzr/5.2-windows-packaging-upgrade/

------------------------------------------------------------
revno: 2942
revision-id: wlad at montyprogram.com-20110129230036-yv8rxvuemb8i52o6
parent: wlad at montyprogram.com-20110129145117-bi1icba468zpxkzc
committer: Vladislav Vaintroub <wlad at montyprogram.com>
branch nick: 5.2-windows-packaging-upgrade
timestamp: Sun 2011-01-30 00:00:36 +0100
message:
  Split long (> 80 char) lines
-------------- next part --------------
=== modified file 'win/packaging/ca/CustomAction.cpp'
--- a/win/packaging/ca/CustomAction.cpp	2011-01-28 21:45:40 +0000
+++ b/win/packaging/ca/CustomAction.cpp	2011-01-29 23:00:36 +0000
@@ -69,8 +69,12 @@
   return WcaFinalize(er); 
 }
 
-/* Check for if directory is empty during install, sets "<PROPERTY>_NOT_EMPTY" otherise */
-extern "C" UINT __stdcall CheckDirectoryEmpty(MSIHANDLE hInstall, const wchar_t *PropertyName)
+/* 
+  Check for if directory is empty during install, sets "<PROPERTY>_NOT_EMPTY" 
+  otherise 
+*/
+extern "C" UINT __stdcall CheckDirectoryEmpty(MSIHANDLE hInstall, 
+  const wchar_t *PropertyName)
 {
   HRESULT hr = S_OK;
   UINT er = ERROR_SUCCESS;
@@ -111,7 +115,8 @@
   }
 
   if(empty)
-    WcaLog(LOGMSG_STANDARD, "Directory %S is empty or non-existent", PropertyName);
+    WcaLog(LOGMSG_STANDARD, "Directory %S is empty or non-existent", 
+      PropertyName);
   else
     WcaLog(LOGMSG_STANDARD, "Directory %S is NOT empty", PropertyName);
 
@@ -224,22 +229,22 @@
 
   It can happen that SERVICENAME or DATADIR 
   MSI properties are in inconsistent state after somebody upgraded database 
-  We catch this case during uninstall. In particular, either service is not removed
-  even if SERVICENAME was set (but this name is reused by someone else) or data 
-  directory is not removed (if it is used by someone else). To find out whether 
-  service name and datadirectory are in use For every service, configuration is
-  read and checked as follows:
+  We catch this case during uninstall. In particular, either service is not 
+  removed even if SERVICENAME was set (but this name is reused by someone else) 
+  or data directory is not removed (if it is used by someone else). To find out 
+  whether service name and datadirectory are in use For every service, 
+  configuration is read and checked as follows:
 
   - look if a service has to do something with mysql
-  - If so, check its name against SERVICENAME. if match, check binary path against 
-    INSTALLDIR\bin.  If binary path does not match, then service runs under different 
-    installation and won't be removed.
-  - Check options file for datadir and look if this is inside this installation's 
-  datadir don't remove datadir if this is the case.
+  - If so, check its name against SERVICENAME. if match, check binary path 
+    against INSTALLDIR\bin.  If binary path does not match, then service runs 
+    under different installation and won't be removed.
+  - Check options file for datadir and look if this is inside this 
+    installation's datadir don't remove datadir if this is the case.
 
-  "Don't remove" in this context means that custom action is removing SERVICENAME property
-  or CLEANUPDATA property, which later on in course of installation mean that either datadir
-  or service is retained.
+  "Don't remove" in this context means that custom action is removing 
+  SERVICENAME property or CLEANUPDATA property, which later on in course of 
+  installation mean that either datadir or service is retained.
 */
 
 void CheckServiceConfig(
@@ -261,7 +266,8 @@
     goto end;
   }
 
-  WcaLog(LOGMSG_STANDARD, "MySQL service %S found: CommandLine= %S", other_servicename, commandline);
+  WcaLog(LOGMSG_STANDARD, "MySQL service %S found: CommandLine= %S", 
+    other_servicename, commandline);
   if (wcsstr(argv[0], bindir))
   {
     WcaLog(LOGMSG_STANDARD, "executable under bin directory");
@@ -280,7 +286,8 @@
   else if (!same_bindir)
   {
     WcaLog(LOGMSG_STANDARD, 
-      "Service name matches, but not the executable path directory, mine is %S", bindir);
+      "Service name matches, but not the executable path directory, mine is %S",
+      bindir);
     WcaSetProperty(L"SERVICENAME", L"");
   }
 
@@ -298,8 +305,8 @@
 
   WcaLog(LOGMSG_STANDARD, "parsed defaults file is %S", defaults_file);
 
-  if (GetPrivateProfileStringW(L"mysqld", L"datadir", NULL, current_datadir, MAX_PATH, 
-    defaults_file) == 0)
+  if (GetPrivateProfileStringW(L"mysqld", L"datadir", NULL, current_datadir, 
+    MAX_PATH, defaults_file) == 0)
   {
     WcaLog(LOGMSG_STANDARD, 
       "Cannot find datadir in ini file '%S'", defaults_file);
@@ -310,16 +317,19 @@
   strip_quotes(current_datadir);
 
   /* Convert to Windows path */
-  if (GetFullPathNameW(current_datadir, MAX_PATH, normalized_current_datadir, NULL))
+  if (GetFullPathNameW(current_datadir, MAX_PATH, normalized_current_datadir, 
+    NULL))
   {
     /* Add backslash to be compatible with directory formats in MSI */
     wcsncat(normalized_current_datadir, L"\\", MAX_PATH+1);
-    WcaLog(LOGMSG_STANDARD, "normalized current datadir is '%S'", normalized_current_datadir);
+    WcaLog(LOGMSG_STANDARD, "normalized current datadir is '%S'", 
+      normalized_current_datadir);
   }
 
   if (_wcsicmp(datadir, normalized_current_datadir) == 0 && !same_bindir)
   {
-    WcaLog(LOGMSG_STANDARD, "database directory from current installation, but different mysqld.exe");
+    WcaLog(LOGMSG_STANDARD, "database directory from current installation, but "
+      "different mysqld.exe");
     WcaSetProperty(L"CLEANUPDATA", L"");
   }
 
@@ -334,22 +344,21 @@
   would normally mean user has done an upgrade of the database and in this case 
   uninstall should neither delete service nor database directory.
 
-  If this function find that service is modified by user (mysqld.exe used by service
-  does not point to the installation bin directory), MSI public variable SERVICENAME is 
-  removed, if DATADIR is used by some other service, variables DATADIR and CLEANUPDATA
-  are removed.
-
-  The effect of variable removal is that service does not get uninstalled and datadir
-  is not touched by uninstallation.
-
-  Note that this function is running without elevation and does not use anything that would
-  require special privileges.
-
+  If this function find that service is modified by user (mysqld.exe used by 
+  service does not point to the installation bin directory), MSI public variable
+  SERVICENAME is removed, if DATADIR is used by some other service, variables 
+  DATADIR and CLEANUPDATA are removed.
+
+  The effect of variable removal is that service does not get uninstalled and 
+  datadir is not touched by uninstallation.
+
+  Note that this function is running without elevation and does not use anything
+  that would require special privileges.
 */
 extern "C" UINT CheckDBInUse(MSIHANDLE hInstall)
 {
   static BYTE buf[256*1024]; /* largest possible buffer for EnumServices */
-  static char config_buffer[8*1024]; /*largest possible buffer for QueryServiceConfig */
+  static char config_buffer[8*1024]; /*largest for QueryServiceConfig's */
   HRESULT hr = S_OK;
   UINT er = ERROR_SUCCESS;
   wchar_t *servicename= NULL;
@@ -372,7 +381,8 @@
   WcaLog(LOGMSG_STANDARD,"SERVICENAME=%S, DATADIR=%S, bindir=%S",
     servicename, datadir, bindir);
 
-  scm = OpenSCManager(NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_CONNECT);  
+  scm = OpenSCManager(NULL, NULL, 
+    SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_CONNECT);  
   if (scm == NULL) 
   { 
     ExitOnFailure(E_FAIL, "OpenSCManager failed");
@@ -396,17 +406,21 @@
   info = (LPENUM_SERVICE_STATUS_PROCESS)buf; 
   for (ULONG i=0; i < num_services; i++)
   {
-    SC_HANDLE service= OpenServiceW(scm, info[i].lpServiceName, SERVICE_QUERY_CONFIG);
+    SC_HANDLE service= OpenServiceW(scm, info[i].lpServiceName, 
+      SERVICE_QUERY_CONFIG);
     if (!service)
       continue;
     WcaLog(LOGMSG_VERBOSE, "Checking Service %S", info[i].lpServiceName);
-    QUERY_SERVICE_CONFIGW *config= (QUERY_SERVICE_CONFIGW *)(void *)config_buffer;
+    QUERY_SERVICE_CONFIGW *config= 
+      (QUERY_SERVICE_CONFIGW *)(void *)config_buffer;
     DWORD needed;
-    BOOL ok= QueryServiceConfigW(service, config,sizeof(config_buffer), &needed);
+    BOOL ok= QueryServiceConfigW(service, config,sizeof(config_buffer), 
+      &needed);
     CloseServiceHandle(service);
     if (ok)
     {
-       CheckServiceConfig(servicename, datadir, bindir, info[i].lpServiceName, config);
+       CheckServiceConfig(servicename, datadir, bindir, info[i].lpServiceName,
+         config);
     }
   }
 
@@ -453,14 +467,16 @@
     }
     if(CheckServiceExists(ServiceName))
     {
-      ErrorMsg= L"A service with the same name already exists. Please use a different name.";
+      ErrorMsg= L"A service with the same name already exists." 
+        "Please use a different name.";
       goto err;
     }
   }
 
   DWORD SkipNetworkingLen= MAX_PATH;
 
-  MsiGetPropertyW(hInstall, L"SKIPNETWORKING", SkipNetworking, &SkipNetworkingLen);
+  MsiGetPropertyW(hInstall, L"SKIPNETWORKING", SkipNetworking, 
+    &SkipNetworkingLen);
   MsiGetPropertyW(hInstall, L"PORT", Port, &PortLen);
   
   if(SkipNetworking[0]==0 && Port[0] != 0)
@@ -487,14 +503,16 @@
     }
     if (haveInvalidPort)
     {
-      ErrorMsg = L"Invalid port number. Please use a number between 1025 and 65535.";
+      ErrorMsg = 
+        L"Invalid port number. Please use a number between 1025 and 65535.";
       goto err;
     }
 
     short port = (short)_wtoi(Port);
     if (!IsPortFree(port))
     {
-      ErrorMsg = L"The TCP Port you selected is already in use. Please choose a different port.";
+      ErrorMsg = L"The TCP Port you selected is already in use. " 
+        "Please choose a different port.";
       goto err;
     }
   }
@@ -592,7 +610,8 @@
 
 
 /*
-  Enables/disables optional "Launch upgrade wizard" checkbox at the end of installation
+  Enables/disables optional "Launch upgrade wizard" checkbox at the end of 
+  installation.
 */
 #define MAX_VERSION_PROPERTY_SIZE 64
 
@@ -631,7 +650,8 @@
   }
  
 
-  SC_HANDLE scm = OpenSCManager(NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_CONNECT);  
+  SC_HANDLE scm = OpenSCManager(NULL, NULL, 
+    SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_CONNECT);  
   if (scm == NULL) 
   { 
     hr = HRESULT_FROM_WIN32(GetLastError());
@@ -663,7 +683,8 @@
     QUERY_SERVICE_CONFIGW *config= 
       (QUERY_SERVICE_CONFIGW*)(void *)config_buffer;
     DWORD needed;
-    BOOL ok= QueryServiceConfigW(service, config,sizeof(config_buffer), &needed);
+    BOOL ok= QueryServiceConfigW(service, config,sizeof(config_buffer),
+      &needed);
     CloseServiceHandle(service);
     if (ok)
     {
@@ -671,7 +692,8 @@
       int major;
       int minor;
       wchar_t program[MAX_PATH]={0};
-      GetMySQLVersion(config->lpBinaryPathName, program, &isMySQL, &major, &minor);
+      GetMySQLVersion(config->lpBinaryPathName, program, &isMySQL, &major,
+        &minor);
       
       /* 
         Only look for services that have mysqld.exe outside of the current



More information about the commits mailing list