From 82ec0b91dac2cbf9ff8a3fa71b2e42bbaca702cb Mon Sep 17 00:00:00 2001 From: "ssu%netscape.com" Date: Thu, 2 Aug 2001 22:02:48 +0000 Subject: [PATCH] fixing bug 93327 - Win32 installer cannot CRC check .exe files. r=dveditz, sr=mscott. affects windows platforms only --- xpinstall/packager/windows/config.it | 54 ++++++++---------------- xpinstall/packager/windows/makeall.pl | 33 +++++++++++---- xpinstall/packager/windows/makecfgini.pl | 8 ++-- xpinstall/wizard/windows/setup/extra.c | 50 +++++++++++++++++++--- xpinstall/wizard/windows/setup/logging.c | 10 ++++- xpinstall/wizard/windows/setup/logging.h | 2 + xpinstall/wizard/windows/setup/setup.h | 2 + 7 files changed, 104 insertions(+), 55 deletions(-) diff --git a/xpinstall/packager/windows/config.it b/xpinstall/packager/windows/config.it index 94d985d237c..a324e2708f1 100644 --- a/xpinstall/packager/windows/config.it +++ b/xpinstall/packager/windows/config.it @@ -607,10 +607,10 @@ OS=NT51 Description Short=$CompanyName$ Uninstaller ;*** LOCALIZE ME BABY *** Description Long=Uninstaller for $ProductName$ -Archive=$UninstallFile$ -$InstallSize$:$UninstallFile$ +Archive=$UninstallFileZip$ +$InstallSize$:$UninstallFileZip$ $InstallSizeSystem$ -$InstallSizeArchive$:$UninstallFile$ +$InstallSizeArchive$:$UninstallFileZip$ Attributes=SELECTED|INVISIBLE|DOWNLOAD_ONLY ;Since the uninstaller program is going to be installed into the Windows folder, @@ -741,35 +741,25 @@ Message= ; the app runs once upon windows reboot. ;Uncompress FileX sections -;[Uncompress File0] -;Timing=post download -;Source=[XPI PATH]\xpcom.xpi -;Destination=[SETUP PATH] -;Message=Configuring Seamonkey, please wait... +[Uncompress File0] +Timing=post smartupdate +Source=[XPI PATH]\$UninstallFileZip$ +Destination=[WINDIR] +;*** LOCALIZE ME BABY *** +Message=Installing the uninstaller, please wait... +Only If Exists=FALSE -;[Uncompress File1] -;Timing=post download -;Source=[XPI PATH]\extratest.xpi -;Destination=[SETUP PATH] -;Message=Configuring Extra test files, please wait... - -;Move FileX sections -;[Move File0] -;Timing=post download -;Source=[SETUP PATH]\bin\* -;Destination=[SETUP PATH]\program - -;[Move File1] -;Timing=post download -;Source=[SETUP PATH]\ftmain\* -;Destination=[SETUP PATH]\program ;Copy FileX sections +;Copy the uninstaller to the [Setup Path]\Uninstall folder. +;This copy is to be used when the user installed on a system with +;restricted access. [Copy File0] -Timing=post launchapp -Source=[JRE BIN PATH]\np*.dll -Destination=[SETUP PATH]\Plugins +Timing=post smartupdate +Source=[WINDIR]\$UninstallFile$ +Destination=[SETUP PATH]\Uninstall Fail If Exists=FALSE +Do Not Uninstall=FALSE [Copy File1] Timing=post smartupdate @@ -778,16 +768,6 @@ Destination=[WINDIR] Fail If Exists=FALSE Do Not Uninstall=TRUE -;Copy the uninstaller to the [Setup Path]\Uninstall folder. -;This copy is to be used when the user installed on a system with -;restricted access. -[Copy File2] -Timing=post smartupdate -Source=[XPI PATH]\$UninstallFile$ -Destination=[SETUP PATH]\Uninstall -Fail If Exists=FALSE -Do Not Uninstall=FALSE - ;Copy File SequentialX sections [Copy File Sequential0] diff --git a/xpinstall/packager/windows/makeall.pl b/xpinstall/packager/windows/makeall.pl index f8e4a0fa6a8..8b29cb1d033 100644 --- a/xpinstall/packager/windows/makeall.pl +++ b/xpinstall/packager/windows/makeall.pl @@ -26,6 +26,8 @@ # This perl script builds the xpi, config.ini, and js files. # +use Cwd; + # Make sure MOZ_SRC is set. if($ENV{MOZ_SRC} eq "") { @@ -64,15 +66,17 @@ $seiFileNameGeneric = "nsinstall.exe"; $seiFileNameSpecific = "mozilla-win32-installer.exe"; $seiFileNameSpecificStub = "mozilla-win32-stub-installer.exe"; $seuFileNameSpecific = "MozillaUninstall.exe"; +$seuzFileNameSpecific = "mozillauninstall.zip"; # set environment vars for use by other .pl scripts called from this script. -$ENV{WIZ_userAgent} = "0.9.2 (en)"; # ie: "0.9 (en)" -$ENV{WIZ_userAgentShort} = "0.9.2"; # ie: "0.9" -$ENV{WIZ_xpinstallVersion} = "0.9.2"; # ie: "0.9.0" +$ENV{WIZ_userAgent} = "0.9.4 (en)"; # ie: "0.9 (en)" +$ENV{WIZ_userAgentShort} = "0.9.4"; # ie: "0.9" +$ENV{WIZ_xpinstallVersion} = "0.9.4"; # ie: "0.9.0" $ENV{WIZ_nameCompany} = "mozilla.org"; $ENV{WIZ_nameProduct} = "Mozilla"; $ENV{WIZ_fileMainExe} = "Mozilla.exe"; $ENV{WIZ_fileUninstall} = $seuFileNameSpecific; +$ENV{WIZ_fileUninstallZip} = $seuzFileNameSpecific; # Set the location of the local tmp stage directory $gLocalTmpStage = $inStagePath; @@ -292,6 +296,21 @@ if((!(-e "$ENV{MOZ_SRC}\\redist\\microsoft\\system\\msvcrt.dll")) || # end of script exit(0); +sub MakeExeZip +{ + my($aSrcDir, $aExeFile, $aZipFile) = @_; + my($saveCwdir); + + $saveCwdir = cwd(); + chdir($aSrcDir); + if(system("$ENV{MOZ_TOOLS}\\bin\\zip $inDistPath\\xpi\\$aZipFile $aExeFile")) + { + chdir($saveCwdir); + die "\n Error: $ENV{MOZ_TOOLS}\\bin\\zip $inDistPath\\xpi\\$aZipFile $aExeFile"; + } + chdir($saveCwdir); +} + sub PrintUsage { die "usage: $0 [options] @@ -401,11 +420,9 @@ sub MakeUninstall print "\n Error: $inDistPath\\nsztool.exe $inDistPath\\$seuFileNameSpecific $inDistPath\\uninstall\\*.*\n"; return(1); } - if(system("copy $inDistPath\\$seuFileNameSpecific $inDistPath\\xpi")) - { - print "\n Error: copy $inDistPath\\$seuFileNameSpecific $inDistPath\\xpi\n"; - return(1); - } + + MakeExeZip($inDistPath, $seuFileNameSpecific, $seuzFileNameSpecific); + unlink <$inDistPath\\$seuFileNameSpecific>; return(0); } diff --git a/xpinstall/packager/windows/makecfgini.pl b/xpinstall/packager/windows/makecfgini.pl index b18772851f9..b15c710c5f5 100644 --- a/xpinstall/packager/windows/makecfgini.pl +++ b/xpinstall/packager/windows/makecfgini.pl @@ -91,6 +91,7 @@ $nameCompany = $ENV{WIZ_nameCompany}; $nameProduct = $ENV{WIZ_nameProduct}; $fileMainExe = $ENV{WIZ_fileMainExe}; $fileUninstall = $ENV{WIZ_fileUninstall}; +$fileUninstallZip = $ENV{WIZ_fileUninstallZip}; $inDomain; $inRedirDomain; @@ -129,9 +130,9 @@ while($line = ) $componentName = $colonSplit[1]; chop($componentName); - if($componentName =~ /\$UninstallFile\$/i) + if($componentName =~ /\$UninstallFileZip\$/i) { - $installSize = OutputInstallSizeArchive("$inXpiPath\\$fileUninstall"); + $installSize = OutputInstallSizeArchive("$inXpiPath\\$fileUninstallZip") * 2; } else { @@ -170,7 +171,7 @@ while($line = ) { $componentName = $colonSplit[1]; chop($componentName); - $componentName =~ s/\$UninstallFile\$/$fileUninstall/gi; + $componentName =~ s/\$UninstallFileZip\$/$fileUninstallZip/gi; $installSizeArchive = OutputInstallSizeArchive("$inXpiPath\\$componentName"); } @@ -194,6 +195,7 @@ while($line = ) $line =~ s/\$ProductName\$/$nameProduct/gi; $line =~ s/\$MainExeFile\$/$fileMainExe/gi; $line =~ s/\$UninstallFile\$/$fileUninstall/gi; + $line =~ s/\$UninstallFileZip\$/$fileUninstallZip/gi; print fpOutIni $line; } } diff --git a/xpinstall/wizard/windows/setup/extra.c b/xpinstall/wizard/windows/setup/extra.c index 0c927d45722..645a1d271c0 100644 --- a/xpinstall/wizard/windows/setup/extra.c +++ b/xpinstall/wizard/windows/setup/extra.c @@ -1906,7 +1906,6 @@ HRESULT LaunchApps() BOOL bArchiveFound; siC *siCObject = NULL; char szArchive[MAX_BUF]; - char szBuf[MAX_BUF]; char szMsg[MAX_BUF]; LogISLaunchApps(W_START); @@ -1944,13 +1943,39 @@ HRESULT LaunchApps() if(bArchiveFound) { char szParameterBuf[MAX_BUF]; + char szSpawnFile[MAX_BUF]; + char szMessageString[MAX_BUF]; + DWORD dwErr = FO_SUCCESS; + + wsprintf(szMessageString, szMsg, siCObject->szDescriptionShort); + ShowMessage(szMessageString, TRUE); + DecryptString(szParameterBuf, siCObject->szParameter); + + lstrcpy(szSpawnFile, szArchive); + if(siCObject->dwAttributes & SIC_UNCOMPRESS) + { + if((dwErr = FileUncompress(szArchive, szTempDir)) == FO_SUCCESS) + { + lstrcpy(szSpawnFile, szTempDir); + AppendBackSlash(szSpawnFile, sizeof(szSpawnFile)); + lstrcat(szSpawnFile, siCObject->szArchiveNameUncompressed); + } + + LogISLaunchAppsComponentUncompress(siCObject->szDescriptionShort, dwErr); + if(dwErr != FO_SUCCESS) + { + ShowMessage(szMessageString, FALSE); + continue; + } + } LogISLaunchAppsComponent(siCObject->szDescriptionShort); - wsprintf(szBuf, szMsg, siCObject->szDescriptionShort); - ShowMessage(szBuf, TRUE); - DecryptString(szParameterBuf, siCObject->szParameter); - WinSpawn(szArchive, szParameterBuf, szTempDir, SW_SHOWNORMAL, TRUE); - ShowMessage(szBuf, FALSE); + WinSpawn(szSpawnFile, szParameterBuf, szTempDir, SW_SHOWNORMAL, TRUE); + + if(siCObject->dwAttributes & SIC_UNCOMPRESS) + FileDelete(szSpawnFile); + + ShowMessage(szMessageString, FALSE); } } ++dwIndex0; @@ -2577,6 +2602,8 @@ siC *CreateSiCNode() if((siCNode->szArchiveName = NS_GlobalAlloc(MAX_BUF)) == NULL) exit(1); + if((siCNode->szArchiveNameUncompressed = NS_GlobalAlloc(MAX_BUF)) == NULL) + exit(1); if((siCNode->szArchivePath = NS_GlobalAlloc(MAX_BUF)) == NULL) exit(1); if((siCNode->szDestinationPath = NS_GlobalAlloc(MAX_BUF)) == NULL) @@ -2633,6 +2660,7 @@ void SiCNodeDelete(siC *siCTemp) FreeMemory(&(siCTemp->szDestinationPath)); FreeMemory(&(siCTemp->szArchivePath)); FreeMemory(&(siCTemp->szArchiveName)); + FreeMemory(&(siCTemp->szArchiveNameUncompressed)); FreeMemory(&(siCTemp->szParameter)); FreeMemory(&(siCTemp->szReferenceName)); FreeMemory(&(siCTemp->szDescriptionLong)); @@ -3822,6 +3850,8 @@ HRESULT ParseComponentAttributes(char *szAttribute) dwAttributes |= SIC_IGNORE_DOWNLOAD_ERROR; if(strstr(szBuf, "IGNORE_XPINSTALL_ERROR")) dwAttributes |= SIC_IGNORE_XPINSTALL_ERROR; + if(strstr(szBuf, "UNCOMPRESS")) + dwAttributes |= SIC_UNCOMPRESS; return(dwAttributes); } @@ -3946,6 +3976,14 @@ void InitSiComponents(char *szFileIni) /* store name of archive for component */ lstrcpy(siCTemp->szArchiveName, szBuf); + + /* store name of the uncompressed archive for the component */ + GetPrivateProfileString(szComponentSection, + "Archive Uncompressed", + "", + siCTemp->szArchiveNameUncompressed, + sizeof(szBuf), + szFileIni); /* get short description of component */ GetPrivateProfileString(szComponentSection, "Description Short", "", szBuf, sizeof(szBuf), szFileIni); diff --git a/xpinstall/wizard/windows/setup/logging.c b/xpinstall/wizard/windows/setup/logging.c index 224b8576f1e..1565cb50636 100644 --- a/xpinstall/wizard/windows/setup/logging.c +++ b/xpinstall/wizard/windows/setup/logging.c @@ -382,7 +382,15 @@ void LogISLaunchAppsComponent(char *szComponentName) { char szBuf[MAX_BUF]; - wsprintf(szBuf, " %s\n", szComponentName); + wsprintf(szBuf, " launching %s\n", szComponentName); + UpdateInstallStatusLog(szBuf); +} + +void LogISLaunchAppsComponentUncompress(char *szComponentName, DWORD dwErr) +{ + char szBuf[MAX_BUF]; + + wsprintf(szBuf, " uncompressing %s: %d\n", szComponentName, dwErr); UpdateInstallStatusLog(szBuf); } diff --git a/xpinstall/wizard/windows/setup/logging.h b/xpinstall/wizard/windows/setup/logging.h index 12c3437084e..e98c1fa59dc 100644 --- a/xpinstall/wizard/windows/setup/logging.h +++ b/xpinstall/wizard/windows/setup/logging.h @@ -38,6 +38,8 @@ void LogISXPInstallComponent(char *szComponentName); void LogISXPInstallComponentResult(DWORD dwErrorNumber); void LogISLaunchApps(int iWhen); void LogISLaunchAppsComponent(char *szComponentName); +void LogISLaunchAppsComponentUncompress(char *szComponentName, + DWORD dwErr); void LogISProcessXpcomFile(int iStatus, int iResult); void LogISDiskSpace(dsN *dsnComponentDSRequirement); void LogISTurboMode(BOOL bTurboMode); diff --git a/xpinstall/wizard/windows/setup/setup.h b/xpinstall/wizard/windows/setup/setup.h index 81eb3f124fa..8f32f91b405 100644 --- a/xpinstall/wizard/windows/setup/setup.h +++ b/xpinstall/wizard/windows/setup/setup.h @@ -195,6 +195,7 @@ typedef int PRInt32; #define SIC_FORCE_UPGRADE 0x00000080 #define SIC_IGNORE_DOWNLOAD_ERROR 0x00000100 #define SIC_IGNORE_XPINSTALL_ERROR 0x00000200 +#define SIC_UNCOMPRESS 0x00000400 /* AC: Additional Components */ #define AC_NONE 0 @@ -414,6 +415,7 @@ struct sinfoComponent long lRandomInstallValue; DWORD dwAttributes; LPSTR szArchiveName; + LPSTR szArchiveNameUncompressed; LPSTR szArchivePath; LPSTR szDestinationPath; LPSTR szDescriptionShort;