From ef69bc64eb41e261b2c09d8679bafef100ce252c Mon Sep 17 00:00:00 2001 From: "ssu%netscape.com" Date: Thu, 20 Feb 2003 00:31:54 +0000 Subject: [PATCH] fixing bug 190362 - MFCEmbed installer crashing during setup. r=sgehani, sr=dveditz, a=dbaron --- xpinstall/packager/stage_mfcembed.pl | 19 +++-- xpinstall/packager/stage_mozilla.pl | 4 - xpinstall/packager/win_mfcembed/config.it | 81 +++++++++++++++----- xpinstall/packager/win_mfcembed/makeall.pl | 64 +++++++++------- xpinstall/packager/win_mfcembed/mfcembed.jst | 7 ++ xpinstall/packager/win_mfcembed/runapp.bat | 15 +++- xpinstall/wizard/windows/setup/extra.c | 7 +- 7 files changed, 136 insertions(+), 61 deletions(-) diff --git a/xpinstall/packager/stage_mfcembed.pl b/xpinstall/packager/stage_mfcembed.pl index 0a8e795d2e83..3d899fd1b8e6 100644 --- a/xpinstall/packager/stage_mfcembed.pl +++ b/xpinstall/packager/stage_mfcembed.pl @@ -49,18 +49,21 @@ sub StageProduct StageUtils::CleanupStage($aDirStage, $aProductName); StageUtils::CleanupDistPackages("$aDirSrcDist/packages", $aProductName); - StageUtils::CopyAdditionalPackage("$dirMozPackager/pkgs-mfcembed-win", $dirDistPackagesProductName); - StageUtils::CopyAdditionalPackage("$dirMozPackager/pkgs-mfcembed-win-supp", $dirDistPackagesProductName); + StageUtils::CopyAdditionalPackage("$dirMozPackager/xpcom-win.pkg", $dirDistPackagesProductName); + StageUtils::CopyAdditionalPackage("$dirMozPackager/pkgs-mfcembed-win", $dirDistPackagesProductName); + StageUtils::CopyAdditionalPackage("$dirMozPackager/pkgs-mfcembed-win-supp", $dirDistPackagesProductName); StageUtils::CopyAdditionalPackage("$dirMozRoot/embedding/config/basebrowser-win-supp", $dirDistPackagesProductName); StageUtils::CopyAdditionalPackage("$dirMozRoot/embedding/config/gre-win-supp", $dirDistPackagesProductName); - mkdir("$aDirStage", 775) if (!(-e "$aDirStage")); - mkdir("$aDirStage/$aProductName", 775) if (!(-e "$aDirStage/$aProductName")); + mkdir("$aDirStage", 775) if (!(-e "$aDirStage")); + mkdir("$aDirStage/$aProductName", 775) if (!(-e "$aDirStage/$aProductName")); + mkdir("$aDirStage/$aProductName/mfcembed", 775) if (!(-e "$aDirStage/$aProductName/mfcembed")); # Call pkgcp.pl on each of the package list - system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName\" -f \"$dirDistPackagesProductName/pkgs-mfcembed-win\" -o $aOsPkg -v"); - system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/gre_app_support\" -d \"$dirStageProductName\" -f \"$dirDistPackagesProductName/pkgs-mfcembed-win-supp\" -o $aOsPkg -v"); - system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName\" -f \"$dirDistPackagesProductName/basebrowser-win-supp\" -o $aOsPkg -v"); - system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName\" -f \"$dirDistPackagesProductName/gre-win-supp\" -o $aOsPkg -v"); + system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist\" -d \"$dirStageProductName\" -f \"$dirDistPackagesProductName/xpcom-win.pkg\" -o $aOsPkg -v"); + system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName/mfcembed\" -f \"$dirDistPackagesProductName/pkgs-mfcembed-win\" -o $aOsPkg -v"); + system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/gre_app_support\" -d \"$dirStageProductName/mfcembed\" -f \"$dirDistPackagesProductName/pkgs-mfcembed-win-supp\" -o $aOsPkg -v"); + system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName/mfcembed\" -f \"$dirDistPackagesProductName/basebrowser-win-supp\" -o $aOsPkg -v"); + system("perl \"$dirMozPackager/pkgcp.pl\" -s \"$aDirSrcDist/bin\" -d \"$dirStageProductName/mfcembed\" -f \"$dirDistPackagesProductName/gre-win-supp\" -o $aOsPkg -v"); } diff --git a/xpinstall/packager/stage_mozilla.pl b/xpinstall/packager/stage_mozilla.pl index 3815456bb0dd..12f0cb3e0667 100644 --- a/xpinstall/packager/stage_mozilla.pl +++ b/xpinstall/packager/stage_mozilla.pl @@ -53,10 +53,6 @@ sub StageProduct StageUtils::CopyAdditionalPackage("$dirMozPackager/packages-win", $dirDistPackagesProductName); # StageUtils::GeneratePackagesFromSinglePackage($inOs, "$dirMozPackager/packages-win", $dirDistPackagesProductName); - # Not needed right now since it only copies xpcom-win.pkg. - # This pkg file should be part of the GRE build. - #StageUtils::CopyAdditionalPackage("$dirMozPackager/xpcom-win.pkg", $dirDistPackagesProductName); - # Call CreateStage() to create the aProductName stage dir using the packages # in dist/packages. StageUtils::CreateStage($aDirSrcDist, $dirStageProductName, $dirDistPackagesProductName, $aOsPkg); diff --git a/xpinstall/packager/win_mfcembed/config.it b/xpinstall/packager/win_mfcembed/config.it index 17bbf8de167b..f3889a5adb2d 100644 --- a/xpinstall/packager/win_mfcembed/config.it +++ b/xpinstall/packager/win_mfcembed/config.it @@ -94,6 +94,33 @@ Default Setup Type=Setup Type 0 ; TRUE Refresh Icons=FALSE +; Setting to control whether or not GRE should be installed to app's dir +; to be used as a private/local GRE. +; +; Possible values (default is 'Shared'): +; Local +; Shared +; +; If this key is set to 'Local', make +; sure to provide a GRE Private Key= below! +GRE Type=Shared + +; Private key that overrides the default shared key +; (HKEY_LOCAL_MACHINE\Software\mozilla.org\GRE) set by GRE's installer. +; This key will be created under HKEY_LOCAL_MACHINE and should be +; declared in the following format: +; +; Software\[company name]\[product name] +; (ie: Software\mozilla.org\GRE_PRIVATE) +; +; If it is not in the above format, the GRE installer/uninstaller can +; fail to work properly. +; The value to Prodduct Name Internal= (at the beginning of this +; config.ini file) will be appended as follows: +; +; Software\mozilla.org\GRE_PRIVATE_[Product Name Internal] +GRE Private Key=Software\mozilla.org\GRE_PRIVATE + ; This section contains info on how to send error information in case of ; either a download or xpinstall error. ; By default, this feature is enabled, unless disabled. @@ -174,8 +201,10 @@ Readme App=notepad.exe ; List of components to install/enable for this Setup Type. ; All other components not listed here will be disabled if ; this Setup Type is selected. -C0=Component MFCEmbed -C1=Component Uninstaller +C0=Component XPCOM +C1=Component GRE +C2=Component MFCEmbed +C3=Component Uninstaller [Dialog Select Components] Show Dialog=FALSE @@ -386,16 +415,33 @@ Close All Process Windows=TRUE ; will be superseded. ; -;[Component XPCOM] -;Description Short=Mozilla XPCOM -;;*** LOCALIZE ME BABY *** -;Description Long=Install Engine -;Archive=xpcom.xpi -;$InstallSize$:xpcom -;$InstallSizeSystem$ -;$InstallSizeArchive$:xpcom.xpi -;Attributes=SELECTED|INVISIBLE|FORCE_UPGRADE -;Force Upgrade File0=[SETUP PATH]\xpcom.dll +[Component XPCOM] +Description Short=Mozilla XPCOM +;*** LOCALIZE ME BABY *** +Description Long=Install Engine +Archive=xpcom.xpi +$InstallSize$:xpcom +$InstallSizeSystem$ +$InstallSizeArchive$:xpcom.xpi +Attributes=SELECTED|INVISIBLE|DOWNLOAD_ONLY + +[Component GRE] +;*** LOCALIZE ME BABY *** +Description Short=GRE +;*** LOCALIZE ME BABY *** +Description Long=Gecko Runtime Environment +Archive=gre-win32-installer.zip +Archive Uncompressed=gre-win32-installer.exe +$InstallSize$:gre +$InstallSizeSystem$ +$InstallSizeArchive$:gre-win32-installer.zip +Attributes=SELECTED|UNCOMPRESS|SUPERSEDE|LAUNCHAPP|INVISIBLE +Parameter=-mmi -ma -app $ProductName$ -app_path "[SETUP PATH]\$MainExeFile$" +SupersedeType=GRE +SupersedeWinReg0=HKEY_LOCAL_MACHINE\Software\mozilla.org\GRE +SupersedeVersion0=1.3.0.0 +SupersedeMinVersion=1.3.0.0 +SupersedeMaxVersion=1.3.0.0 [Component MFCEmbed] Description Short=MFCEmbed @@ -430,6 +476,11 @@ $InstallSize$:xpcom Cleanup=TRUE ;*** LOCALIZE ME BABY *** Message=Preparing Install, please wait... +; Status= values: Disabled, Enabled +; If nothing is set, default value is Enabled. If set to Disabled, +; it will then use GRE as the xpinstall engine, in which case, there +; should be a GRE component in this installer package! +Status=Enabled [Redirect] Status=Disabled @@ -673,9 +724,3 @@ Description1=North America ;*** LOCALIZE ME BABY *** Domain1=$ArchiveUrl$ -;RunApp section -[RunApp0] -Timing=pre launchapp -Wait=TRUE -Target=gre-win32-installer.exe -Parameters=-mmi -ma -app mfcembed -app_path "[SETUP PATH]"\mfcembed.exe diff --git a/xpinstall/packager/win_mfcembed/makeall.pl b/xpinstall/packager/win_mfcembed/makeall.pl index a9855170e40f..362b148b1285 100644 --- a/xpinstall/packager/win_mfcembed/makeall.pl +++ b/xpinstall/packager/win_mfcembed/makeall.pl @@ -75,7 +75,27 @@ ParseArgv(@ARGV); $gDirPackager = "$topsrcdir/xpinstall/packager"; $gDirDistInstall = "$inDistPath/inst_mfcembed"; -$gDirStageProduct = "$inStagePath"; +$gDirDistInstGre = "$inDistPath/inst_gre"; +$gDirStageProduct = "$inStagePath/mfcembed"; +$seiFileNameGeneric = "nsinstall.exe"; +$seiFileNameSpecific = "mfcembed-win32-installer.exe"; +$seiStubRootName = "mfcembed-win32-stub-installer"; +$seiFileNameSpecificStub = "$seiStubRootName.exe"; +$seuFileNameSpecific = "MfcEmbedUninstall.exe"; +$seuzFileNameSpecific = "mfcembeduninstall.zip"; +$seiGreFileNameSpecific = "gre-win32-installer.exe"; +$seizGreFileNameSpecific = "gre-win32-installer.zip"; + +# set environment vars for use by other .pl scripts called from this script. +if($versionParts[2] eq "0") +{ + $versionMain = "$versionParts[0]\.$versionParts[1]"; +} +else +{ + $versionMain = "$versionParts[0]\.$versionParts[1]\.$versionParts[2]"; +} +print "The display version is: $versionMain\n"; # Build GRE installer package first before building Mozilla! GRE installer is required by the mozilla installer. @@ -91,30 +111,21 @@ if(system("perl \"$gDirPackager/make_stage.pl\" -pn mfcembed -os win -sd \"$inSt die "\n Error: perl \"$gDirPackager/make_stage.pl\" -pn mfcembed -os win -sd \"$inStagePath\" -dd \"$inDistPath\"\n"; } +# Copy the GRE installer to the Ns' stage area +if(!(-e "$gDirDistInstGre/$seiGreFileNameSpecific")) +{ + die "\"$gDirDistInstGre/$seiGreFileNameSpecific\": file missing\n"; +} +mkdir "$gDirStageProduct/gre"; +copy("$gDirDistInstGre/$seiGreFileNameSpecific", "$gDirStageProduct/gre") || + die "copy(\"$gDirDistInstGre/$seiGreFileNameSpecific\", \"$gDirStageProduct/gre\"): $!\n"; + # Until we really figure out what to do with this batch file, this will get it # into the installer, at least print "\n Copying runapp.bat $gDirStageProduct/mfcembed/gre_app_support\n"; copy("runapp.bat", "$gDirStageProduct/mfcembed/gre_app_support") || die "copy runapp.bat $gDirStageProduct/mfcembed/gre_app_support: $!\n"; - -$seiFileNameGeneric = "nsinstall.exe"; -$seiFileNameSpecific = "mfcembed-win32-installer.exe"; -$seiStubRootName = "mfcembed-win32-stub-installer"; -$seiFileNameSpecificStub = "$seiStubRootName.exe"; -$seuFileNameSpecific = "MfcEmbedUninstall.exe"; -$seuzFileNameSpecific = "mfcembeduninstall.zip"; - -# set environment vars for use by other .pl scripts called from this script. -if($versionParts[2] eq "0") -{ - $versionMain = "$versionParts[0]\.$versionParts[1]"; -} -else -{ - $versionMain = "$versionParts[0]\.$versionParts[1]\.$versionParts[2]"; -} -print "The display version is: $versionMain\n"; $ENV{WIZ_nameCompany} = "mozilla.org"; $ENV{WIZ_nameProduct} = "MfcEmbed"; $ENV{WIZ_nameProductInternal} = "MfcEmbed"; # product name without any version string @@ -140,7 +151,8 @@ if(!(-d "$gDirStageProduct")) } # List of components for to create xpi files from -@gComponentList = ("mfcembed"); +@gComponentList = ("xpcom", + "mfcembed"); if(VerifyComponents()) # return value of 0 means no errors encountered { @@ -180,19 +192,17 @@ else mkdir ("$gDirDistInstall/setup",0775); } +if(!(-e "$inDistPath/inst_gre/$seiGreFileNameSpecific")) +{ + die "\"$inDistPath/inst_gre/$seiGreFileNameSpecific\": file missing\n"; +} +MakeExeZip("$inDistPath/inst_gre", $seiGreFileNameSpecific, $seizGreFileNameSpecific); if(MakeXpiFile()) { exit(1); } -# Grab xpcom from mozilla build -copy("$gDirDistInstall/../install/xpi/xpcom.xpi", "$gDirDistInstall") || - die "copy $gDirDistInstall/../install/xpi/xpcom.xpi $gDirDistInstall: $!\n"; -copy("$gDirDistInstall/../install/xpi/xpcom.xpi", "$gDirDistInstall/xpi") || - die "copy $gDirDistInstall/../install/xpi/xpcom.xpi $gDirDistInstall/xpi: $!\n"; - - if(MakeUninstall()) { exit(1); diff --git a/xpinstall/packager/win_mfcembed/mfcembed.jst b/xpinstall/packager/win_mfcembed/mfcembed.jst index 4aaff558e764..4a470b4529ad 100644 --- a/xpinstall/packager/win_mfcembed/mfcembed.jst +++ b/xpinstall/packager/win_mfcembed/mfcembed.jst @@ -158,6 +158,13 @@ if(verifyDiskSpace(fProgram, srDest)) fSubdir = getFolder("Program", "components"); File.dirCreate(fSubdir); + // Let the uninstaller know about this generated file. + logComment("Installing: " + fProgram + ".autoreg"); + logComment("Create Folder: " + fProgram + "components"); + logComment("Installing: " + fProgram + "components\\xpti.dat"); + logComment("Installing: " + fProgram + "components\\xptitemp.dat"); + logComment("Installing: " + fProgram + "components\\compreg.dat"); + // check return value if( err == SUCCESS ) { diff --git a/xpinstall/packager/win_mfcembed/runapp.bat b/xpinstall/packager/win_mfcembed/runapp.bat index ae161975f98e..cc1c6ee26888 100755 --- a/xpinstall/packager/win_mfcembed/runapp.bat +++ b/xpinstall/packager/win_mfcembed/runapp.bat @@ -2,9 +2,18 @@ REM -------------------------------------------------------- REM Modify GRE_DIR below to match your GRE install location REM -------------------------------------------------------- -set GRE_VERSION=1.3a -set GRE_DIR=c:\Program Files\mozilla.org\GRE\%GRE_VERSION% +set GRE_VERSION=1.3b -set PATH=%PATH%;%GRE_DIR%;%GRE_DIR%\components +if exist "%ProgramFiles%\nul" set GRE_DIR=%ProgramFiles%\common files\mozilla.org\GRE\%GRE_VERSION% +if not exist "%ProgramFiles%\nul" set GRE_DIR=c:\Program Files\common files\mozilla.org\GRE\%GRE_VERSION% + +if not exist "%GRE_DIR%\nul" echo. +if not exist "%GRE_DIR%\nul" echo. GRE version %GRE_VERSION% not found at: %GRE_DIR% +if not exist "%GRE_DIR%\nul" echo. +if not exist "%GRE_DIR%\nul" goto end + +set PATH=%GRE_DIR%;%GRE_DIR%\components;%PATH% mfcembed.exe -console +goto end +:end diff --git a/xpinstall/wizard/windows/setup/extra.c b/xpinstall/wizard/windows/setup/extra.c index 76e8676427c3..6af74bcb9fbb 100644 --- a/xpinstall/wizard/windows/setup/extra.c +++ b/xpinstall/wizard/windows/setup/extra.c @@ -2306,6 +2306,10 @@ HRESULT LaunchApps() HRESULT ProcessGre(greInfo *aGre) { char greUninstallCommand[MAX_BUF]; + + if(!aGre) + return(WIZ_OK); + /* If aGre->homePath does not exist, it means that a compatible version of GRE was * not found on the system, so we need to install one. We also need to get the * path to where it's going to install the GRE for in case we need to use it @@ -2327,7 +2331,8 @@ HRESULT ProcessGre(greInfo *aGre) * in the config.ini file. */ /* Unset "Component GRE"'s SELECTED attribute so it doesn't get spawned again later from LaunchApps() */ - aGre->siCGreComponent->dwAttributes &= ~SIC_SELECTED; + if(aGre->siCGreComponent) + aGre->siCGreComponent->dwAttributes &= ~SIC_SELECTED; /* Log the GRE uninstall command to call in order for this app's uninstaller to * uninstall GRE.