Commits

Anonymous committed 1978508

CWS-TOOLING: integrate CWS vistainstall_DEV300
2009-03-24 11:33:59 +0100 dv r269931 : #i100470# Enhanced running office check to ignore missing program folder, etc.
2009-03-24 11:07:25 +0100 dv r269922 : #i100500# Environment flag WITH_VC_REDIST got lost

  • Participants
  • Parent commits 03958e9

Comments (0)

Files changed (3)

File setup_native/source/win32/customactions/shellextensions/checkpatches.cxx

 #include <string>
 #include <queue>
 #include <stdio.h>
+#include <strsafe.h>
 
 #include <systools/win32/uwinapi.h>
 

File setup_native/source/win32/customactions/shellextensions/checkrunningoffice.cxx

             return ERROR_SUCCESS;
     
         std::_tstring sRenameSrc = sOfficeInstallPath + TEXT("program");
-        std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_1");
+        std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_test");
     
         bool bSuccess = MoveFile( sRenameSrc.c_str(), sRenameDst.c_str() );
     
         }
         else
         {
+            DWORD  dwError = GetLastError();
+            LPVOID lpMsgBuf;
+            // When there is no program folder, there could be no running office
+            if ( dwError == ERROR_FILE_NOT_FOUND )
+                return ERROR_SUCCESS;
+            // The destination folder should never exist, don't know what to do here
+            if ( dwError == ERROR_ALREADY_EXISTS )
+                return ERROR_SUCCESS;
+            
+            if ( FormatMessage( 
+                FORMAT_MESSAGE_ALLOCATE_BUFFER | 
+                FORMAT_MESSAGE_FROM_SYSTEM | 
+                FORMAT_MESSAGE_IGNORE_INSERTS,
+                NULL,
+                GetLastError(),
+                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+                (LPTSTR) &lpMsgBuf,
+                0,
+                NULL ))
+            {
+                OutputDebugStringFormat( TEXT("Error Code %d: %s"), dwError, lpMsgBuf );
+                LocalFree( lpMsgBuf );
+            }
+            else
+                OutputDebugStringFormat( TEXT("Error Code %d: Unknown"), dwError );
+            
             MsiSetProperty( handle, TEXT("OFFICERUNS"), TEXT("1") );
             SetMsiErrorCode( MSI_ERROR_OFFICE_IS_RUNNING );
         }

File setup_native/source/win32/customactions/shellextensions/vistaspecial.cxx

     std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION"));
 
     std::_tstring sRenameSrc = sOfficeInstallPath + TEXT("program");
-    std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_1");
+    std::_tstring sRenameDst = sOfficeInstallPath + TEXT("program_old");
 
 //    MessageBox(NULL, sRenameSrc.c_str(), "OFFICEINSTALLLOCATION", MB_OK);
 
 extern "C" UINT __stdcall RemovePrgFolder( MSIHANDLE handle )
 {
     std::_tstring sOfficeInstallPath = GetMsiProperty(handle, TEXT("OFFICEINSTALLLOCATION"));
-    std::_tstring sRemoveDir = sOfficeInstallPath + TEXT("program_1");
+    std::_tstring sRemoveDir = sOfficeInstallPath + TEXT("program_old");
 
 //    MessageBox(NULL, sRemoveDir.c_str(), "REMOVING OLD DIR", MB_OK);