fixing bug 190484 - After GRE install, user is asked to restart computer, ending rest of install. r=sgehani, sr=dveditz, a=asa

This commit is contained in:
ssu%netscape.com 2003-02-20 05:15:26 +00:00
parent 572f20a150
commit e04594fbed
8 changed files with 283 additions and 166 deletions

View File

@ -55,9 +55,9 @@ ParseArgv(@ARGV);
$DEPTH = "$topsrcdir" if !defined($DEPTH);
$cwdBuilder = "$topsrcdir/xpinstall/wizard/windows/builder";
$verPartial = "5.0.0.";
$verPartial = "1.3.0.";
$ver = $verPartial . GetVersion($DEPTH);
$verGre = "1.3b.0.0";
$verGre = $verPartial . "0";
$gDistInstallPath = "$inDistPath/install";
$gPackagerPath = "$topsrcdir/xpinstall/packager";

View File

@ -2810,177 +2810,178 @@ void CommitInstall(void)
char szInstallLogFile[MAX_BUF];
long RetrieveResults;
LogISShared();
LogISDestinationPath();
LogISSetupType();
LogISComponentsSelected();
LogISComponentsToDownload();
LogISDiskSpace(gdsnComponentDSRequirement);
LogISShared();
LogISDestinationPath();
LogISSetupType();
LogISComponentsSelected();
LogISComponentsToDownload();
LogISDiskSpace(gdsnComponentDSRequirement);
lstrcpy(szDestPath, sgProduct.szPath);
if(*sgProduct.szSubPath != '\0')
{
AppendBackSlash(szDestPath, sizeof(szDestPath));
lstrcat(szDestPath, sgProduct.szSubPath);
}
AppendBackSlash(szDestPath, sizeof(szDestPath));
lstrcpy(szDestPath, sgProduct.szPath);
if(*sgProduct.szSubPath != '\0')
{
AppendBackSlash(szDestPath, sizeof(szDestPath));
lstrcat(szDestPath, sgProduct.szSubPath);
}
AppendBackSlash(szDestPath, sizeof(szDestPath));
/* Create the destination path here in case it had not been created,
* as in the case of silent or auto mode installs */
CreateDirectoriesAll(szDestPath, ADD_TO_UNINSTALL_LOG);
/* Create the destination path here in case it had not been created,
* as in the case of silent or auto mode installs */
CreateDirectoriesAll(szDestPath, ADD_TO_UNINSTALL_LOG);
/* Set global var, that determines where the log file is to update, to
* not use the TEMP dir *before* the FileCopy() calls because we want
* to log the FileCopy() calls to where the log files were copied to.
* This is possible because the logging, that is done within the
* FileCopy() function, is done after the actual copy
*/
gbILUseTemp = FALSE;
/* Set global var, that determines where the log file is to update, to
* not use the TEMP dir *before* the FileCopy() calls because we want
* to log the FileCopy() calls to where the log files were copied to.
* This is possible because the logging, that is done within the
* FileCopy() function, is done after the actual copy
*/
gbILUseTemp = FALSE;
/* copy the install_wizard.log file from the temp\ns_temp dir to
* the destination dir and use the new destination file to continue
* logging.
*/
lstrcpy(szInstallLogFile, szTempDir);
AppendBackSlash(szInstallLogFile, sizeof(szInstallLogFile));
lstrcat(szInstallLogFile, FILE_INSTALL_LOG);
FileCopy(szInstallLogFile, szDestPath, FALSE, FALSE);
DeleteFile(szInstallLogFile);
/* copy the install_wizard.log file from the temp\ns_temp dir to
* the destination dir and use the new destination file to continue
* logging.
*/
lstrcpy(szInstallLogFile, szTempDir);
AppendBackSlash(szInstallLogFile, sizeof(szInstallLogFile));
lstrcat(szInstallLogFile, FILE_INSTALL_LOG);
FileCopy(szInstallLogFile, szDestPath, FALSE, FALSE);
DeleteFile(szInstallLogFile);
/* copy the install_status.log file from the temp\ns_temp dir to
* the destination dir and use the new destination file to continue
* logging.
*/
lstrcpy(szInstallLogFile, szTempDir);
AppendBackSlash(szInstallLogFile, sizeof(szInstallLogFile));
lstrcat(szInstallLogFile, FILE_INSTALL_STATUS_LOG);
FileCopy(szInstallLogFile, szDestPath, FALSE, FALSE);
DeleteFile(szInstallLogFile);
/* copy the install_status.log file from the temp\ns_temp dir to
* the destination dir and use the new destination file to continue
* logging.
*/
lstrcpy(szInstallLogFile, szTempDir);
AppendBackSlash(szInstallLogFile, sizeof(szInstallLogFile));
lstrcat(szInstallLogFile, FILE_INSTALL_STATUS_LOG);
FileCopy(szInstallLogFile, szDestPath, FALSE, FALSE);
DeleteFile(szInstallLogFile);
/* PRE_DOWNLOAD process file manipulation functions */
RetrieveResults = WIZ_OK;
if(sgProduct.bInstallFiles)
{
ProcessFileOpsForAll(T_PRE_DOWNLOAD);
RetrieveResults = RetrieveArchives();
}
/* PRE_DOWNLOAD process file manipulation functions */
RetrieveResults = WIZ_OK;
if(sgProduct.bInstallFiles)
{
ProcessFileOpsForAll(T_PRE_DOWNLOAD);
RetrieveResults = RetrieveArchives();
}
if(RetrieveResults == WIZ_OK)
{
if(sgProduct.bInstallFiles)
{
/* Check to see if Turbo is required. If so, set the
* appropriate Windows registry keys */
SetTurboArgs();
if(RetrieveResults == WIZ_OK)
{
if(sgProduct.bInstallFiles)
{
/* Check to see if Turbo is required. If so, set the
* appropriate Windows registry keys */
SetTurboArgs();
if(gbDownloadTriggered || gbPreviousUnfinishedDownload)
SetSetupState(SETUP_STATE_UNPACK_XPCOM);
if(gbDownloadTriggered || gbPreviousUnfinishedDownload)
SetSetupState(SETUP_STATE_UNPACK_XPCOM);
/* POST_DOWNLOAD process file manipulation functions */
ProcessFileOpsForAll(T_POST_DOWNLOAD);
/* PRE_XPCOM process file manipulation functions */
ProcessFileOpsForAll(T_PRE_XPCOM);
/* POST_DOWNLOAD process file manipulation functions */
ProcessFileOpsForAll(T_POST_DOWNLOAD);
/* PRE_XPCOM process file manipulation functions */
ProcessFileOpsForAll(T_PRE_XPCOM);
if(ProcessXpinstallEngine() != WIZ_OK)
{
bSDUserCanceled = TRUE;
CleanupXpcomFile();
PostQuitMessage(0);
if(ProcessXpinstallEngine() != WIZ_OK)
{
bSDUserCanceled = TRUE;
CleanupXpcomFile();
PostQuitMessage(0);
return;
}
return;
}
if(gbDownloadTriggered || gbPreviousUnfinishedDownload)
SetSetupState(SETUP_STATE_INSTALL_XPI); // clears and sets new setup state
if(gbDownloadTriggered || gbPreviousUnfinishedDownload)
SetSetupState(SETUP_STATE_INSTALL_XPI); // clears and sets new setup state
/* POST_XPCOM process file manipulation functions */
ProcessFileOpsForAll(T_POST_XPCOM);
/* PRE_SMARTUPDATE process file manipulation functions */
ProcessFileOpsForAll(T_PRE_SMARTUPDATE);
/* POST_XPCOM process file manipulation functions */
ProcessFileOpsForAll(T_POST_XPCOM);
/* PRE_SMARTUPDATE process file manipulation functions */
ProcessFileOpsForAll(T_PRE_SMARTUPDATE);
/* save the installer files in the local machine */
if(diAdditionalOptions.bSaveInstaller)
SaveInstallerFiles();
/* save the installer files in the local machine */
if(diAdditionalOptions.bSaveInstaller)
SaveInstallerFiles();
if(CheckInstances())
{
bSDUserCanceled = TRUE;
CleanupXpcomFile();
PostQuitMessage(0);
if(CheckInstances())
{
bSDUserCanceled = TRUE;
CleanupXpcomFile();
PostQuitMessage(0);
return;
}
return;
}
lstrcat(szDestPath, "uninstall\\");
CreateDirectoriesAll(szDestPath, ADD_TO_UNINSTALL_LOG);
hrErr = SmartUpdateJars();
}
else
hrErr = WIZ_OK;
lstrcat(szDestPath, "uninstall\\");
CreateDirectoriesAll(szDestPath, ADD_TO_UNINSTALL_LOG);
hrErr = SmartUpdateJars();
}
else
hrErr = WIZ_OK;
if((hrErr == WIZ_OK) || (hrErr == 999))
{
if(sgProduct.bInstallFiles)
UpdateJSProxyInfo();
if((hrErr == WIZ_OK) || (hrErr == 999))
{
if(sgProduct.bInstallFiles)
UpdateJSProxyInfo();
/* POST_SMARTUPDATE process file manipulation functions */
ProcessFileOpsForAll(T_POST_SMARTUPDATE);
if(sgProduct.bInstallFiles)
{
/* PRE_LAUNCHAPP process file manipulation functions */
ProcessFileOpsForAll(T_PRE_LAUNCHAPP);
/* POST_SMARTUPDATE process file manipulation functions */
ProcessFileOpsForAll(T_POST_SMARTUPDATE);
LaunchApps();
if(sgProduct.bInstallFiles)
{
/* PRE_LAUNCHAPP process file manipulation functions */
ProcessFileOpsForAll(T_PRE_LAUNCHAPP);
// XXX ignore. Part of testings.
/* Prepend GRE's path to the application's App Paths key
* in the windows registry. If this install instance happens
* to be installing GRE, the function will not prepend the
* GRE path. */
//AddGrePathToApplicationAppPathsKey();
LaunchApps();
/* POST_LAUNCHAPP process file manipulation functions */
ProcessFileOpsForAll(T_POST_LAUNCHAPP);
/* DEPEND_REBOOT process file manipulation functions */
ProcessFileOpsForAll(T_DEPEND_REBOOT);
// XXX ignore. Part of testings.
/* Prepend GRE's path to the application's App Paths key
* in the windows registry. If this install instance happens
* to be installing GRE, the function will not prepend the
* GRE path. */
//AddGrePathToApplicationAppPathsKey();
// Refresh system icons if necessary
if(gSystemInfo.bRefreshIcons)
RefreshIcons();
/* POST_LAUNCHAPP process file manipulation functions */
ProcessFileOpsForAll(T_POST_LAUNCHAPP);
/* DEPEND_REBOOT process file manipulation functions */
ProcessFileOpsForAll(T_DEPEND_REBOOT);
UnsetSetupState(); // clear setup state
ClearWinRegUninstallFileDeletion();
if(!gbIgnoreProgramFolderX)
ProcessProgramFolderShowCmd();
// Refresh system icons if necessary
if(gSystemInfo.bRefreshIcons)
RefreshIcons();
CleanupArgsRegistry();
CleanupPreviousVersionRegKeys();
}
UnsetSetupState(); // clear setup state
ClearWinRegUninstallFileDeletion();
if(!gbIgnoreProgramFolderX)
ProcessProgramFolderShowCmd();
if(NeedReboot())
{
CleanupXpcomFile();
hDlgCurrent = InstantiateDialog(hWndMain, DLG_RESTART, diReboot.szTitle, DlgProcReboot);
}
else
{
CleanupXpcomFile();
PostQuitMessage(0);
}
}
else
{
CleanupXpcomFile();
PostQuitMessage(0);
}
}
CleanupArgsRegistry();
CleanupPreviousVersionRegKeys();
}
CleanupXpcomFile();
if(NeedReboot())
{
LogExitStatus("Reboot");
if(sgProduct.mode == NORMAL)
hDlgCurrent = InstantiateDialog(hWndMain, DLG_RESTART, diReboot.szTitle, DlgProcReboot);
else
{
bSDUserCanceled = TRUE;
CleanupXpcomFile();
CleanupArgsRegistry();
PostQuitMessage(0);
}
gbProcessingXpnstallFiles = FALSE;
}
else
PostQuitMessage(0);
}
else
{
CleanupXpcomFile();
PostQuitMessage(0);
}
}
else
{
bSDUserCanceled = TRUE;
CleanupXpcomFile();
CleanupArgsRegistry();
PostQuitMessage(0);
}
gbProcessingXpnstallFiles = FALSE;
}

View File

@ -97,6 +97,7 @@ LPSTR szProxyDLLPath;
LPFNDLLFUNC lpfnProgressUpd;
HINSTANCE hGREAppInstallerProxyDLL;
BOOL gGreInstallerHasRun = FALSE;
BOOL CheckProcessNT4(LPSTR szProcessName, DWORD dwProcessNameSize);
DWORD GetTitleIdx(HWND hWnd, LPTSTR Title[], DWORD LastIndex, LPTSTR Name);
PPERF_OBJECT FindObject (PPERF_DATA pData, DWORD TitleIndex);
@ -590,8 +591,8 @@ HRESULT Initialize(HINSTANCE hInstance)
char szBuf[MAX_BUF];
char szCurrentProcessDir[MAX_BUF];
bSDUserCanceled = FALSE;
hDlgMessage = NULL;
bSDUserCanceled = FALSE;
hDlgMessage = NULL;
/* load strings from setup.exe */
if(NS_LoadStringAlloc(hInstance, IDS_ERROR_GLOBALALLOC, &szEGlobalAlloc, MAX_BUF))
@ -627,14 +628,14 @@ HRESULT Initialize(HINSTANCE hInstance)
}
}
dwWizardState = DLG_NONE;
dwTempSetupType = dwWizardState;
siComponents = NULL;
bCreateDestinationDir = FALSE;
bReboot = FALSE;
gdwUpgradeValue = UG_NONE;
gdwSiteSelectorStatus = SS_SHOW;
gbILUseTemp = TRUE;
dwWizardState = DLG_NONE;
dwTempSetupType = dwWizardState;
siComponents = NULL;
bCreateDestinationDir = FALSE;
bReboot = FALSE;
gdwUpgradeValue = UG_NONE;
gdwSiteSelectorStatus = SS_SHOW;
gbILUseTemp = TRUE;
gbIgnoreRunAppX = FALSE;
gbIgnoreProgramFolderX = FALSE;
@ -781,7 +782,12 @@ void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize)
*/
int MozCopyStr(LPSTR szSrc, LPSTR szDest, DWORD dwDestBufSize)
{
DWORD length = lstrlen(szSrc) + 1;
DWORD length;
assert(szSrc);
assert(szDest);
length = lstrlen(szSrc) + 1;
strncpy(szDest, szSrc, dwDestBufSize);
if(length > dwDestBufSize)
{
@ -2331,6 +2337,7 @@ 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() */
gGreInstallerHasRun = TRUE;
if(aGre->siCGreComponent)
aGre->siCGreComponent->dwAttributes &= ~SIC_SELECTED;
@ -2973,7 +2980,6 @@ HRESULT InitSetupGeneral()
return(1);
*sgProduct.grePrivateKey = '\0';
return(0);
}
@ -6570,7 +6576,7 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine)
diWindowsIntegration.bShowDialog = FALSE;
diProgramFolder.bShowDialog = FALSE;
diQuickLaunch.bShowDialog = FALSE;
diAdditionalOptions.bShowDialog = FALSE;
diAdditionalOptions.bShowDialog = FALSE;
diAdvancedSettings.bShowDialog = FALSE;
diStartInstall.bShowDialog = FALSE;
diDownload.bShowDialog = FALSE;
@ -6721,6 +6727,9 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine)
}
}
/* clean up previous exit status log file */
DeleteExitStatusFile();
iRv = StartupCheckArchives();
return(iRv);
}
@ -7653,10 +7662,38 @@ HRESULT FileExists(LPSTR szFile)
BOOL NeedReboot()
{
if(diReboot.dwShowDialog == AUTO)
return(bReboot);
else
return(diReboot.dwShowDialog);
if(GreInstallerNeedsReboot())
return(TRUE);
if(diReboot.dwShowDialog == AUTO)
return(bReboot);
else
return(diReboot.dwShowDialog);
}
/* Function: GreInstallerNeedsReboot()
* in: none.
* out: Boolean value on whether or not GRE installer needed a
* when it ran last.
* purpose: To check if this is not the GRE installer and that the GRE installer
* has been run needed a reboot.
*/
BOOL GreInstallerNeedsReboot()
{
BOOL greReboot = FALSE;
/* if this setup is not installing GRE *and* the GRE Setup has been run, then
* check for GRE setup's exit value, if one exists */
if((lstrcmpi(sgProduct.szProductNameInternal, "GRE") != 0) && gGreInstallerHasRun)
{
char status[MAX_BUF];
GetGreSetupExitStatus(status, sizeof(status));
/* if a reboot is detected from the GRE setup run, then
* simply return TRUE for reboot is needed. */
if(lstrcmpi(status, "Reboot") == 0)
greReboot = TRUE;
}
return(greReboot);
}
BOOL DeleteWGetLog(void)

View File

@ -222,6 +222,7 @@ void LaunchOneComponent(siC *siCObject, greInfo *aGre);
HRESULT ProcessXpinstallEngine(void);
void GetXpinstallPath(char *aPath, int aPathBufSize);
int AddGrePathToApplicationAppPathsKey(void);
BOOL GreInstallerNeedsReboot(void);
#endif /* _EXTRA_H_ */

View File

@ -27,6 +27,8 @@
#include "xpi.h"
#define E_USER_CANCEL -813
#define SECTION_EXIT_STATUS "Exit Status"
#define KEY_STATUS "Status"
int AppendToGlobalMessageStream(char *szInfo)
{
@ -582,3 +584,72 @@ void LogMSTurboMode(BOOL bTurboMode)
AppendToGlobalMessageStream(szMessageStream);
}
/* Function: GetExitStatusLogFile()
* in: aProductName, aLogFileBufSize
* in/out: aLogFile
* purpose: To build the full filename of the exit log file
* located in the TEMP dir given aProductName.
*/
void GetExitStatusLogFile(LPSTR aProductName, LPSTR aLogFile, DWORD aLogFileBufSize)
{
char buf[MAX_BUF];
char logFilename[MAX_BUF];
if(!aProductName || !aLogFile)
return;
*aLogFile = '\0';
lstrcpy(buf, szOSTempDir);
MozCopyStr(szOSTempDir, buf, sizeof(buf));
AppendBackSlash(buf, sizeof(buf));
_snprintf(logFilename, sizeof(logFilename), SETUP_EXIT_STATUS_LOG, aProductName);
logFilename[sizeof(logFilename) - 1] = '\0';
_snprintf(aLogFile, aLogFileBufSize, "%s%s", buf, logFilename);
aLogFile[aLogFileBufSize - 1] = '\0';
}
/* Function: DeleteExitStatusFile()
* in: none.
* out: none
* purpose: To delete the setup's exit status file located in
* the TEMP dir.
*/
void DeleteExitStatusFile()
{
char logFile[MAX_BUF];
GetExitStatusLogFile(sgProduct.szProductNameInternal, logFile, sizeof(logFile));
if(FileExists(logFile))
DeleteFile(logFile);
}
/* Function: LogExitStatus()
* in: status to log.
* out: none
* purpose: To log the exit status of this setup. We're normally
* trying to log the need for a reboot.
*/
void LogExitStatus(LPSTR status)
{
char logFile[MAX_BUF];
GetExitStatusLogFile(sgProduct.szProductNameInternal, logFile, sizeof(logFile));
WritePrivateProfileString(SECTION_EXIT_STATUS, KEY_STATUS, status, logFile);
}
/* Function: GetGreSetupExitStatus()
* in: none
* out: aStatus - status read in from the exit status log file
* purpose: To read the exis status from the GRE setup that was run
* from within this setup.
*/
void GetGreSetupExitStatus(LPSTR aStatus, DWORD aStatusBufSize)
{
char logFile[MAX_BUF];
*aStatus = '\0';
GetExitStatusLogFile("GRE", logFile, sizeof(logFile));
if(FileExists(logFile))
GetPrivateProfileString(SECTION_EXIT_STATUS, KEY_STATUS, "", aStatus, aStatusBufSize, logFile);
}

View File

@ -50,6 +50,9 @@ void LogMSDownloadStatus(int iDownloadStatus);
void LogMSDownloadProtocol(DWORD dwProtocolType);
void LogMSXPInstallStatus(char *szFile, int iErr);
void LogMSTurboMode(BOOL bTurboMode);
void DeleteExitStatusFile(void);
void LogExitStatus(LPSTR status);
void GetGreSetupExitStatus(LPSTR aStatus, DWORD aStatusBufSize);
#endif /* _LOGGING_H_ */

View File

@ -205,12 +205,13 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmd
}
}
/* garbage collection */
DeInitSetupGeneral();
if(iRv != WIZ_SETUP_ALREADY_RUNNING)
/* Do clean up before exiting from the application */
DeInitialize();
/* garbage collection */
DeInitSetupGeneral();
return(msg.wParam);
} /* End of WinMain */

View File

@ -108,6 +108,9 @@ typedef int PRInt32;
#define GRE_SETUP_DIR_NAME "Setup GRE"
/* filename which contains this product setup's exit status */
#define SETUP_EXIT_STATUS_LOG "%s Setup Exit Status.log"
/* LOCAL GRE defines */
#define GRE_TYPE_NOT_SET -1
#define GRE_SHARED 0