diff --git a/xpinstall/wizard/windows/setup/dialogs.c b/xpinstall/wizard/windows/setup/dialogs.c index 922a88a71f4..4652ef49ce2 100644 --- a/xpinstall/wizard/windows/setup/dialogs.c +++ b/xpinstall/wizard/windows/setup/dialogs.c @@ -260,7 +260,7 @@ LRESULT CALLBACK DlgProcLicense(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) LRESULT CALLBACK DlgProcUpgrade(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { char szBuf[MAX_BUF]; - LPSTR *szMessage; + LPSTR *szStrList; RECT rDlg; switch(msg) @@ -269,10 +269,11 @@ LRESULT CALLBACK DlgProcUpgrade(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) NS_LoadString(hSetupRscInst, IDS_MB_WARNING_STR, szBuf, sizeof(szBuf)); SetWindowText(hDlg, szBuf); - szMessage = (LPSTR *)lParam; + szStrList = (LPSTR *)lParam; - SetDlgItemText(hDlg, IDC_MESSAGE0, szMessage[0]); - SetDlgItemText(hDlg, IDC_MESSAGE1, szMessage[1]); + SetDlgItemText(hDlg, IDC_DELETE_PATH, szStrList[0]); + SetDlgItemText(hDlg, IDC_MESSAGE0, szStrList[1]); + SetDlgItemText(hDlg, IDC_MESSAGE1, szStrList[2]); if(GetClientRect(hDlg, &rDlg)) SetWindowPos(hDlg, HWND_TOP, (dwScreenX/2)-(rDlg.right/2), (dwScreenY/2)-(rDlg.bottom/2), 0, 0, SWP_NOSIZE); @@ -1667,8 +1668,10 @@ LRESULT CALLBACK DlgAdvancedSettings(HWND hDlg, UINT msg, WPARAM wParam, LONG lP { case WM_INITDIALOG: SetWindowText(hDlg, diAdvancedSettings.szTitle); - SetDlgItemText(hDlg, IDC_MESSAGE0, diAdvancedSettings.szMessage0); - SetDlgItemText(hDlg, IDC_MESSAGE1, diAdvancedSettings.szMessage1); + SetDlgItemText(hDlg, IDC_MESSAGE0, diAdvancedSettings.szMessage0); + SetDlgItemText(hDlg, IDC_MESSAGE1, diAdvancedSettings.szMessage1); + SetDlgItemText(hDlg, IDC_EDIT_PROXY_SERVER, diAdvancedSettings.szProxyServer); + SetDlgItemText(hDlg, IDC_EDIT_PROXY_PORT, diAdvancedSettings.szProxyPort); if(GetClientRect(hDlg, &rDlg)) SetWindowPos(hDlg, HWND_TOP, (dwScreenX/2)-(rDlg.right/2), (dwScreenY/2)-(rDlg.bottom/2), 0, 0, SWP_NOSIZE); @@ -1696,7 +1699,7 @@ LRESULT CALLBACK DlgAdvancedSettings(HWND hDlg, UINT msg, WPARAM wParam, LONG lP else SendMessage(hwndCBSiteSelector, CB_SETCURSEL, 0, 0); - if(bSaveInstallerFiles) + if(diAdvancedSettings.bSaveInstaller) CheckDlgButton(hDlg, IDC_CHECK_SAVE_INSTALLER_FILES, BST_CHECKED); else CheckDlgButton(hDlg, IDC_CHECK_SAVE_INSTALLER_FILES, BST_UNCHECKED); @@ -1713,18 +1716,13 @@ LRESULT CALLBACK DlgAdvancedSettings(HWND hDlg, UINT msg, WPARAM wParam, LONG lP /* get the state of the Save Installer Files checkbox */ if(IsDlgButtonChecked(hDlg, IDC_CHECK_SAVE_INSTALLER_FILES) == BST_CHECKED) - bSaveInstallerFiles = TRUE; + diAdvancedSettings.bSaveInstaller = TRUE; else - bSaveInstallerFiles = FALSE; + diAdvancedSettings.bSaveInstaller = FALSE; /* get the proxy server and port information */ - GetDlgItemText(hDlg, IDC_EDIT_PROXY_SERVER, sgProduct.szProxyServer, MAX_BUF); - GetDlgItemText(hDlg, IDC_EDIT_PROXY_PORT, sgProduct.szProxyPort, MAX_BUF); - if((*sgProduct.szProxyServer == '\0') || (*sgProduct.szProxyPort == '\0')) - { - ZeroMemory(sgProduct.szProxyServer, MAX_BUF); - ZeroMemory(sgProduct.szProxyPort, MAX_BUF); - } + GetDlgItemText(hDlg, IDC_EDIT_PROXY_SERVER, diAdvancedSettings.szProxyServer, MAX_BUF); + GetDlgItemText(hDlg, IDC_EDIT_PROXY_PORT, diAdvancedSettings.szProxyPort, MAX_BUF); DestroyWindow(hDlg); PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0); @@ -2312,12 +2310,12 @@ void DlgSequenceNext() /* PRE_SMARTUPDATE process file manipulation functions */ ProcessFileOps(T_PRE_SMARTUPDATE); - /* save the installer files in the local machine */ - if(bSaveInstallerFiles) - SaveInstallerFiles(); - if(CheckInstances()) { + /* save the installer files in the local machine */ + if(diAdvancedSettings.bSaveInstaller) + SaveInstallerFiles(); + CleanupXpcomFile(); PostQuitMessage(0); @@ -2325,27 +2323,39 @@ void DlgSequenceNext() break; } + lstrcpy(szBuf, sgProduct.szPath); + if(*sgProduct.szSubPath != '\0') + { + AppendBackSlash(szBuf, sizeof(szBuf)); + lstrcat(szBuf, sgProduct.szSubPath); + } + AppendBackSlash(szBuf, sizeof(szBuf)); + if(gdwUpgradeValue == UG_DELETE) { char szMessage[MAX_BUF]; + NS_LoadString(hSetupRscInst, IDS_STR_DELETING_DESTINATION_DIR, szMessage, sizeof(szMessage)); ShowMessage(szMessage, TRUE); - DirectoryRemove(sgProduct.szPath, TRUE); - - lstrcpy(szBuf, sgProduct.szPath); - AppendBackSlash(szBuf, sizeof(szBuf)); + DirectoryRemove(szBuf, TRUE); CreateDirectoriesAll(szBuf, TRUE); ShowMessage(szMessage, FALSE); } - lstrcpy(szBuf, sgProduct.szPath); - AppendBackSlash(szBuf, sizeof(szBuf)); lstrcat(szBuf, "Uninstall\\"); CreateDirectoriesAll(szBuf, TRUE); + /* save the installer files in the local machine */ + if(diAdvancedSettings.bSaveInstaller) + SaveInstallerFiles(); + hrErr = SmartUpdateJars(); if((hrErr == WIZ_OK) || (hrErr == 999)) { +#ifdef XXX_DISABLED_BUG_39015 + UpdateJSProxyInfo(); +#endif + /* POST_SMARTUPDATE process file manipulation functions */ ProcessFileOps(T_POST_SMARTUPDATE); /* PRE_LAUNCHAPP process file manipulation functions */ diff --git a/xpinstall/wizard/windows/setup/extern.h b/xpinstall/wizard/windows/setup/extern.h index 29a9fa721ed..6dded7982e6 100644 --- a/xpinstall/wizard/windows/setup/extern.h +++ b/xpinstall/wizard/windows/setup/extern.h @@ -72,7 +72,6 @@ extern BOOL bSDUserCanceled; extern BOOL bIdiArchivesExists; extern BOOL bCreateDestinationDir; extern BOOL bReboot; -extern BOOL bSaveInstallerFiles; extern setupGen sgProduct; extern diS diSetup; diff --git a/xpinstall/wizard/windows/setup/extra.c b/xpinstall/wizard/windows/setup/extra.c index ab25996befc..76961960348 100644 --- a/xpinstall/wizard/windows/setup/extra.c +++ b/xpinstall/wizard/windows/setup/extra.c @@ -233,7 +233,6 @@ HRESULT Initialize(HINSTANCE hInstance) bSDInit = FALSE; bSDUserCanceled = FALSE; - bSaveInstallerFiles = FALSE; hDlgMessage = NULL; DetermineOSVersion(); @@ -781,7 +780,7 @@ HRESULT GetConfigIni() return(hResult); } -BOOL LocateJar(siC *siCObject, LPSTR szPath, DWORD dwPathSize) +BOOL LocateJar(siC *siCObject, LPSTR szPath, DWORD dwPathSize, BOOL bIncludeTempDir) { BOOL bRet; char szBuf[MAX_BUF * 2]; @@ -835,14 +834,15 @@ BOOL LocateJar(siC *siCObject, LPSTR szPath, DWORD dwPathSize) if(FileExists(szBuf)) { -#ifdef XXX_SSU - /* jar file found. Unset attribute to download from the net */ - siCObject->dwAttributes &= ~SIC_DOWNLOAD_REQUIRED; - /* save the path of where jar was found at */ - lstrcpy(siCObject->szArchivePath, szTempDirTemp); - AppendBackSlash(siCObject->szArchivePath, MAX_BUF); - bRet = TRUE; -#endif + if(bIncludeTempDir == TRUE) + { + /* jar file found. Unset attribute to download from the net */ + siCObject->dwAttributes &= ~SIC_DOWNLOAD_REQUIRED; + /* save the path of where jar was found at */ + lstrcpy(siCObject->szArchivePath, szTempDirTemp); + AppendBackSlash(siCObject->szArchivePath, MAX_BUF); + bRet = TRUE; + } /* if the archive name is in the archive.lst file, then it was uncompressed * by the self extracting .exe file. Assume that the .xpi file exists. @@ -910,14 +910,15 @@ BOOL LocateJar(siC *siCObject, LPSTR szPath, DWORD dwPathSize) if(FileExists(szBuf)) { -#ifdef XXX_SSU - /* jar file found. Unset attribute to download from the net */ - siCObject->dwAttributes &= ~SIC_DOWNLOAD_REQUIRED; - /* save the path of where jar was found at */ - lstrcpy(siCObject->szArchivePath, szTempDirTemp); - AppendBackSlash(siCObject->szArchivePath, MAX_BUF); - bRet = TRUE; -#endif + if(bIncludeTempDir == TRUE) + { + /* jar file found. Unset attribute to download from the net */ + siCObject->dwAttributes &= ~SIC_DOWNLOAD_REQUIRED; + /* save the path of where jar was found at */ + lstrcpy(siCObject->szArchivePath, szTempDirTemp); + AppendBackSlash(siCObject->szArchivePath, MAX_BUF); + bRet = TRUE; + } /* save path where archive is located */ if(szPath != NULL) @@ -1151,6 +1152,7 @@ long RetrieveArchives() AppendBackSlash(szFileIdiGetArchives, sizeof(szFileIdiGetArchives)); lstrcat(szFileIdiGetArchives, FILE_IDI_GETARCHIVES); + lResult = WIZ_OK; dwIndex0 = 0; dwCounter = 0; itoa(dwIndex0, szIndex0, 10); @@ -1161,7 +1163,7 @@ long RetrieveArchives() if(siCObject->dwAttributes & SIC_SELECTED) { /* only download jars if not already in the local machine */ - if(LocateJar(siCObject, NULL, 0) == FALSE) + if(LocateJar(siCObject, NULL, 0, FALSE) == FALSE) { lstrcpy(szSComponent, "Component"); lstrcat(szSComponent, szIndex0); @@ -1200,17 +1202,43 @@ long RetrieveArchives() WritePrivateProfileString("Execution", "exe_param", siSDObject.szExeParam, szFileIdiGetArchives); /* proxy support */ - if((*sgProduct.szProxyServer != '\0') && (*sgProduct.szProxyPort != '\0')) + if((*diAdvancedSettings.szProxyServer != '\0') && (*diAdvancedSettings.szProxyPort != '\0')) { - WritePrivateProfileString("Proxy", "server", sgProduct.szProxyServer, szFileIdiGetArchives); - WritePrivateProfileString("Proxy", "port", sgProduct.szProxyPort, szFileIdiGetArchives); + WritePrivateProfileString("Proxy", "server", diAdvancedSettings.szProxyServer, szFileIdiGetArchives); + WritePrivateProfileString("Proxy", "port", diAdvancedSettings.szProxyPort, szFileIdiGetArchives); } - if((lResult = SdArchives(szFileIdiGetArchives, szTempDir)) != 0) - return(lResult); + lResult = SdArchives(szFileIdiGetArchives, szTempDir); + + if((lResult == 0) || (lResult == 2)) + { + dwIndex0 = 0; + siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL); + while(siCObject) + { + if(siCObject->dwAttributes & SIC_SELECTED) + { + /* only download jars if not already in the local machine */ + if(LocateJar(siCObject, NULL, 0, TRUE) == FALSE) + { + char szEFileNotFound[MAX_BUF]; + + if(NS_LoadString(hSetupRscInst, IDS_ERROR_FILE_NOT_FOUND, szEFileNotFound, MAX_BUF) == WIZ_OK) + { + wsprintf(szBuf, szEFileNotFound, siCObject->szArchiveName); + PrintError(szBuf, ERROR_CODE_HIDE); + } + lResult = 3; // not all .xpi files were downloaded + } + } + + ++dwIndex0; + siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL); + } + } } - return(0); + return(lResult); } void RemoveBackSlash(LPSTR szInput) @@ -1713,12 +1741,17 @@ void DeInitDlgProgramFolder(diPF *diDialog) HRESULT InitDlgAdvancedSettings(diAS *diDialog) { - diDialog->bShowDialog = FALSE; + diDialog->bShowDialog = FALSE; + diDialog->bSaveInstaller = FALSE; if((diDialog->szTitle = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); - if((diDialog->szMessage0 = NS_GlobalAlloc(MAX_BUF)) == NULL) + if((diDialog->szMessage0 = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); - if((diDialog->szMessage1 = NS_GlobalAlloc(MAX_BUF)) == NULL) + if((diDialog->szMessage1 = NS_GlobalAlloc(MAX_BUF)) == NULL) + return(1); + if((diDialog->szProxyServer = NS_GlobalAlloc(MAX_BUF)) == NULL) + return(1); + if((diDialog->szProxyPort = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); return(0); @@ -1729,6 +1762,8 @@ void DeInitDlgAdvancedSettings(diAS *diDialog) FreeMemory(&(diDialog->szTitle)); FreeMemory(&(diDialog->szMessage0)); FreeMemory(&(diDialog->szMessage1)); + FreeMemory(&(diDialog->szProxyServer)); + FreeMemory(&(diDialog->szProxyPort)); } HRESULT InitDlgStartInstall(diSI *diDialog) @@ -1775,6 +1810,10 @@ HRESULT InitSetupGeneral() if((sgProduct.szPath = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); + if((sgProduct.szSubPath = NS_GlobalAlloc(MAX_BUF)) == NULL) + return(1); + if((sgProduct.szProgramName = NS_GlobalAlloc(MAX_BUF)) == NULL) + return(1); if((sgProduct.szProductName = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); if((sgProduct.szProgramFolderName = NS_GlobalAlloc(MAX_BUF)) == NULL) @@ -1785,10 +1824,6 @@ HRESULT InitSetupGeneral() return(1); if((sgProduct.szParentProcessFilename = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); - if((sgProduct.szProxyServer = NS_GlobalAlloc(MAX_BUF)) == NULL) - return(1); - if((sgProduct.szProxyPort = NS_GlobalAlloc(MAX_BUF)) == NULL) - return(1); if((szTempSetupPath = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); if((sgProduct.szSetupTitle0 = NS_GlobalAlloc(MAX_BUF)) == NULL) @@ -1810,13 +1845,13 @@ HRESULT InitSetupGeneral() void DeInitSetupGeneral() { FreeMemory(&(sgProduct.szPath)); + FreeMemory(&(sgProduct.szSubPath)); + FreeMemory(&(sgProduct.szProgramName)); FreeMemory(&(sgProduct.szProductName)); FreeMemory(&(sgProduct.szProgramFolderName)); FreeMemory(&(sgProduct.szProgramFolderPath)); FreeMemory(&(sgProduct.szAlternateArchiveSearchPath)); FreeMemory(&(sgProduct.szParentProcessFilename)); - FreeMemory(&(sgProduct.szProxyServer)); - FreeMemory(&(sgProduct.szProxyPort)); FreeMemory(&(szTempSetupPath)); FreeMemory(&(sgProduct.szSetupTitle0)); FreeMemory(&(sgProduct.szSetupTitle1)); @@ -2552,7 +2587,7 @@ ULONGLONG GetDiskSpaceRequired(DWORD dwType) case DSR_TEMP: case DSR_DOWNLOAD_SIZE: - if((LocateJar(siCTemp, NULL, 0) == FALSE) || (dwType == DSR_DOWNLOAD_SIZE)) + if((LocateJar(siCTemp, NULL, 0, FALSE) == FALSE) || (dwType == DSR_DOWNLOAD_SIZE)) ullTotalSize += siCTemp->ullInstallSizeArchive; break; } @@ -2575,7 +2610,7 @@ ULONGLONG GetDiskSpaceRequired(DWORD dwType) case DSR_TEMP: case DSR_DOWNLOAD_SIZE: - if((LocateJar(siCTemp, NULL, 0) == FALSE) || (dwType == DSR_DOWNLOAD_SIZE)) + if((LocateJar(siCTemp, NULL, 0, FALSE) == FALSE) || (dwType == DSR_DOWNLOAD_SIZE)) ullTotalSize += siCTemp->ullInstallSizeArchive; break; } @@ -2804,21 +2839,6 @@ HRESULT InitComponentDiskSpaceInfo(dsN **dsnComponentDSRequirement) HRESULT VerifyDiskSpace() { -#ifdef XXX_SSU - ULONGLONG ullDSAPath; - ULONGLONG ullDSRPath; - ULONGLONG ullDSASysPath; - ULONGLONG ullDSRSysPath; - ULONGLONG ullDSATempPath; - ULONGLONG ullDSRTempPath; - ULONGLONG ullDSTotalAvailable; - ULONGLONG ullDSTotalRequired; - char szSysPath[MAX_BUF]; - char szBufPath[MAX_BUF]; - char szBufSysPath[MAX_BUF]; - char szBufTempPath[MAX_BUF]; -#endif - ULONGLONG ullDSAvailable; HRESULT hRetValue = FALSE; dsN *dsnComponentDSRequirement = NULL; @@ -2847,112 +2867,6 @@ HRESULT VerifyDiskSpace() } DeInitDSNode(&dsnComponentDSRequirement); - -#ifdef XXX_SSU - /* Calculate disk space for destination path */ - ullDSAPath = GetDiskSpaceAvailable(sgProduct.szPath); - ullDSRPath = GetDiskSpaceRequired(DSR_DESTINATION); - - if(GetSystemDirectory(szSysPath, MAX_BUF) != 0) - { - /* Calculate disk space for system path */ - ullDSASysPath = GetDiskSpaceAvailable(szSysPath); - ullDSRSysPath = GetDiskSpaceRequired(DSR_SYSTEM); - } - else - { - ullDSASysPath = 0; - ullDSRSysPath = 0; - ZeroMemory(szSysPath, MAX_BUF); - } - - /* Calculate disk space for temp path */ - ullDSATempPath = GetDiskSpaceAvailable(szTempDir); - ullDSRTempPath = GetDiskSpaceRequired(DSR_TEMP); - - ParsePath(sgProduct.szPath, szBufPath, sizeof(szBufPath), PP_ROOT_ONLY); - ParsePath(szSysPath, szBufSysPath, sizeof(szBufSysPath), PP_ROOT_ONLY); - ParsePath(szTempDir, szBufTempPath, sizeof(szBufTempPath), PP_ROOT_ONLY); - - AppendBackSlash(szBufPath, sizeof(szBufPath)); - AppendBackSlash(szBufSysPath, sizeof(szBufSysPath)); - AppendBackSlash(szBufTempPath, sizeof(szBufTempPath)); - - /* destination == temp == system */ - if((lstrcmpi(szBufPath, szBufTempPath) == 0) && - (lstrcmpi(szBufPath, szBufSysPath) == 0)) - { - ullDSTotalRequired = ullDSRPath + ullDSRTempPath + ullDSRSysPath; - ullDSTotalAvailable = ullDSAPath; - - if(ullDSTotalAvailable < ullDSTotalRequired) - return(ErrorMsgDiskSpace(ullDSTotalAvailable, ullDSTotalRequired, sgProduct.szPath, FALSE)); - } - else - { - if((lstrcmpi(szBufPath, szBufTempPath) != 0) && - (lstrcmpi(szBufPath, szBufSysPath) != 0) && - (lstrcmpi(szBufTempPath, szBufSysPath) != 0)) - { - /* check TEMP drive */ - if(ullDSATempPath < ullDSRTempPath) - { - return(ErrorMsgDiskSpace(ullDSATempPath, ullDSRTempPath, szTempDir, TRUE)); - } - - /* check SYSTEM drive */ - if(ullDSASysPath < ullDSRSysPath) - { - return(ErrorMsgDiskSpace(ullDSASysPath, ullDSRSysPath, szSysPath, TRUE)); - } - - /* check Destination drive */ - if(ullDSAPath < ullDSRPath) - { - return(ErrorMsgDiskSpace(ullDSAPath, ullDSRPath, sgProduct.szPath, FALSE)); - } - } - else - { - /* temp == system */ - if(lstrcmpi(szBufTempPath, szBufSysPath) == 0) - { - /* check temp + system */ - if(ullDSATempPath < (ullDSRTempPath + ullDSRSysPath)) - return(ErrorMsgDiskSpace(ullDSATempPath, (ullDSRTempPath + ullDSRSysPath), szTempDir, TRUE)); - - /* check destination only */ - if(ullDSAPath < ullDSRPath) - return(ErrorMsgDiskSpace(ullDSAPath, ullDSRPath, sgProduct.szPath, FALSE)); - } - - /* destination == temp */ - if(lstrcmpi(szBufPath, szBufTempPath) == 0) - { - /* check destination + temp */ - if(ullDSAPath < (ullDSRPath + ullDSRTempPath)) - return(ErrorMsgDiskSpace(ullDSAPath, (ullDSRPath + ullDSRTempPath), sgProduct.szPath, FALSE)); - - /* check system only */ - if(ullDSASysPath < ullDSRSysPath) - return(ErrorMsgDiskSpace(ullDSASysPath, ullDSRSysPath, szSysPath, TRUE)); - } - - /* destination == system */ - if(lstrcmpi(szBufPath, szBufSysPath) == 0) - { - /* check destination + system */ - if(ullDSAPath < (ullDSRPath + ullDSRSysPath)) - return(ErrorMsgDiskSpace(ullDSAPath, (ullDSRPath + ullDSRSysPath), sgProduct.szPath, FALSE)); - - /* check temp only */ - if(ullDSATempPath < ullDSRTempPath) - return(ErrorMsgDiskSpace(ullDSATempPath, ullDSRTempPath, szTempDir, TRUE)); - } - } - } -#endif - return(hRetValue); } @@ -3947,19 +3861,24 @@ BOOL CheckLegacy(HWND hDlg) { char szSection[MAX_BUF]; char szFilename[MAX_BUF]; - LPSTR szMessage[2]; + LPSTR szMessage[3]; char szIndex[MAX_BUF]; char szVersionNew[MAX_BUF]; char szDecryptedFilePath[MAX_BUF]; int iIndex; BOOL bContinue; + BOOL bRv; DWORD dwRv0; DWORD dwRv1; verBlock vbVersionNew; verBlock vbVersionOld; - bContinue = TRUE; - iIndex = -1; + bRv = FALSE; + szMessage[0] = NULL; + szMessage[1] = NULL; + szMessage[2] = NULL; + bContinue = TRUE; + iIndex = -1; while(bContinue) { ZeroMemory(szFilename, sizeof(szFilename)); @@ -3979,13 +3898,31 @@ BOOL CheckLegacy(HWND hDlg) else if(*szFilename != '\0') { if((szMessage[0] = NS_GlobalAlloc(MAX_BUF)) == NULL) - return(1); + { + bRv = TRUE; + break; + } if((szMessage[1] = NS_GlobalAlloc(MAX_BUF)) == NULL) - return(1); + { + bRv = TRUE; + break; + } + if((szMessage[2] = NS_GlobalAlloc(MAX_BUF)) == NULL) + { + bRv = TRUE; + break; + } - GetPrivateProfileString(szSection, "Message0", "", szMessage[0], MAX_BUF, szFileIniConfig); - GetPrivateProfileString(szSection, "Message1", "", szMessage[1], MAX_BUF, szFileIniConfig); - if((*szMessage[0] == '\0') && (*szMessage[1] == '\0')) + lstrcpy(szMessage[0], sgProduct.szPath); + if(*sgProduct.szSubPath != '\0') + { + AppendBackSlash(szMessage[0], MAX_BUF); + lstrcat(szMessage[0], sgProduct.szSubPath); + } + + GetPrivateProfileString(szSection, "Message0", "", szMessage[1], MAX_BUF, szFileIniConfig); + GetPrivateProfileString(szSection, "Message1", "", szMessage[2], MAX_BUF, szFileIniConfig); + if((*szMessage[1] == '\0') && (*szMessage[2] == '\0')) /* no message string input. so just continue with the next check */ continue; @@ -3996,7 +3933,10 @@ BOOL CheckLegacy(HWND hDlg) { MessageBeep(MB_ICONEXCLAMATION); if((gdwUpgradeValue = DialogBoxParam(hSetupRscInst, MAKEINTRESOURCE(DLG_UPGRADE), hDlgCurrent, DlgProcUpgrade, (LPARAM)szMessage)) == UG_GOBACK) - return(TRUE); + { + bRv = TRUE; + break; + } } /* file does not exist, so it's okay. Continue with the next check */ continue; @@ -4009,17 +3949,23 @@ BOOL CheckLegacy(HWND hDlg) { MessageBeep(MB_ICONEXCLAMATION); if((gdwUpgradeValue = DialogBoxParam(hSetupRscInst, MAKEINTRESOURCE(DLG_UPGRADE), hDlgCurrent, DlgProcUpgrade, (LPARAM)szMessage)) == UG_GOBACK) - return(TRUE); + { + bRv = TRUE; + break; + } } } - FreeMemory(&szMessage[0]); - FreeMemory(&szMessage[1]); } } + + FreeMemory(&szMessage[0]); + FreeMemory(&szMessage[1]); + FreeMemory(&szMessage[2]); + /* returning TRUE means the user wants to go back and choose a different destination path * returning FALSE means the user is ignoring the warning */ - return(FALSE); + return(bRv); } COLORREF DecryptFontColor(LPSTR szColor) @@ -4050,6 +3996,7 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) { HDC hdc; char szBuf[MAX_BUF]; + char szPreviousPath[MAX_BUF]; char szShowDialog[MAX_BUF]; if(CheckInstances()) @@ -4094,13 +4041,75 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) /* get product name description */ GetPrivateProfileString("General", "Product Name", "", sgProduct.szProductName, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("General", "Sub Path", "", sgProduct.szSubPath, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("General", "Program Name", "", sgProduct.szProgramName, MAX_BUF, szFileIniConfig); /* get main install path */ - if(LocatePreviousPath("Locate Previous Product Path", sgProduct.szPath, MAX_PATH) == FALSE) + if(LocatePreviousPath("Locate Previous Product Path", szPreviousPath, sizeof(szPreviousPath)) == FALSE) { GetPrivateProfileString("General", "Path", "", szBuf, MAX_BUF, szFileIniConfig); DecryptString(sgProduct.szPath, szBuf); } + else + { + /* If the previous path is located in the regsitry, then we need to check to see if the path from + * the regsitry plus the Sub Path contains the Program Name file. If it does, then we have the + * correct path, so just use it. + * + * If it does not contain the Program Name file, then check the parent path (from the registry) + + * SubPath. If this path contains the Program Name file, then we found an older path format. We + * then need to use the parent path as the default path. + * + * Only do the older path format checking if the Sub Path= and Program Name= keys exist. If + * either are not set, then assume that the path from the registry is what we want. + */ + if((*sgProduct.szSubPath != '\0') && (*sgProduct.szProgramName != '\0')) + { + /* If the Sub Path= and Program Name= keys exist, do extra parsing for the correct path */ + lstrcpy(szBuf, szPreviousPath); + AppendBackSlash(szBuf, sizeof(szBuf)); + lstrcat(szBuf, sgProduct.szSubPath); + AppendBackSlash(szBuf, sizeof(szBuf)); + lstrcat(szBuf, sgProduct.szProgramName); + + /* Check to see if PreviousPath + SubPath + ProgramName exists. If it does, then we have the + * correct path. + */ + if(FileExists(szBuf)) + { + lstrcpy(sgProduct.szPath, szPreviousPath); + } + else + { + /* If not, try parent of PreviousPath + SubPath + ProgramName. + * If this exists, then we need to use the parent path of PreviousPath. + */ + RemoveBackSlash(szPreviousPath); + ParsePath(szPreviousPath, szBuf, sizeof(szBuf), PP_PATH_ONLY); + AppendBackSlash(szBuf, sizeof(szBuf)); + lstrcat(szBuf, sgProduct.szSubPath); + AppendBackSlash(szBuf, sizeof(szBuf)); + lstrcat(szBuf, sgProduct.szProgramName); + + if(FileExists(szBuf)) + { + RemoveBackSlash(szPreviousPath); + ParsePath(szPreviousPath, szBuf, sizeof(szBuf), PP_PATH_ONLY); + lstrcpy(sgProduct.szPath, szBuf); + } + else + { + /* If we still can't locate ProgramName file, then use the default in the config.ini */ + GetPrivateProfileString("General", "Path", "", szBuf, MAX_BUF, szFileIniConfig); + DecryptString(sgProduct.szPath, szBuf); + } + } + } + else + { + lstrcpy(sgProduct.szPath, szPreviousPath); + } + } RemoveBackSlash(sgProduct.szPath); /* make a copy of sgProduct.szPath to be used in the Setup Type dialog */ @@ -4237,10 +4246,15 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) diProgramFolder.bShowDialog = TRUE; /* Advanced Settings dialog */ - GetPrivateProfileString("Dialog Advanced Settings", "Show Dialog", "", szShowDialog, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog Advanced Settings", "Title", "", diAdvancedSettings.szTitle, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog Advanced Settings", "Message0", "", diAdvancedSettings.szMessage0, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog Advanced Settings", "Message1", "", diAdvancedSettings.szMessage1, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Advanced Settings", "Show Dialog", "", szShowDialog, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Advanced Settings", "Title", "", diAdvancedSettings.szTitle, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Advanced Settings", "Message0", "", diAdvancedSettings.szMessage0, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Advanced Settings", "Message1", "", diAdvancedSettings.szMessage1, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Advanced Settings", "Proxy Server", "", diAdvancedSettings.szProxyServer, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Advanced Settings", "Proxy Port", "", diAdvancedSettings.szProxyPort, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Advanced Settings", "Save Installer", "", szBuf, MAX_BUF, szFileIniConfig); + if(lstrcmpi(szBuf, "TRUE") == 0) + diAdvancedSettings.bSaveInstaller = TRUE; if(lstrcmpi(szShowDialog, "TRUE") == 0) diAdvancedSettings.bShowDialog = TRUE; @@ -4497,7 +4511,7 @@ DWORD GetTotalArchivesToDownload() { if(siCObject->dwAttributes & SIC_SELECTED) { - if(LocateJar(siCObject, NULL, 0) == FALSE) + if(LocateJar(siCObject, NULL, 0, FALSE) == FALSE) { ++dwTotalArchivesToDownload; } @@ -4949,10 +4963,20 @@ HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize) else if(lstrcmpi(szVariable, "SETUP PATH") == 0) { lstrcpy(szVariable, sgProduct.szPath); + if(*sgProduct.szSubPath != '\0') + { + AppendBackSlash(szVariable, dwVariableSize); + lstrcat(szVariable, sgProduct.szSubPath); + } } else if(lstrcmpi(szVariable, "Default Path") == 0) { lstrcpy(szVariable, sgProduct.szPath); + if(*sgProduct.szSubPath != '\0') + { + AppendBackSlash(szVariable, dwVariableSize); + lstrcat(szVariable, sgProduct.szSubPath); + } } else if(lstrcmpi(szVariable, "SETUP STARTUP PATH") == 0) { @@ -5101,7 +5125,7 @@ HRESULT DecryptString(LPSTR szOutputStr, LPSTR szInputStr) } else { - bDecrypted = DecryptVariable(szVariable, MAX_BUF); + bDecrypted = DecryptVariable(szVariable, sizeof(szVariable)); } if(!bDecrypted) @@ -5381,8 +5405,15 @@ void CleanTempFiles() void DeInitialize() { + char szBuf[MAX_BUF]; + if(bCreateDestinationDir) - DirectoryRemove(sgProduct.szPath, FALSE); + { + lstrcpy(szBuf, sgProduct.szPath); + AppendBackSlash(szBuf, sizeof(szBuf)); + DirectoryRemove(szBuf, FALSE); + } + if(hbmpBoxChecked) DeleteObject(hbmpBoxChecked); if(hbmpBoxCheckedDisabled) @@ -5409,10 +5440,6 @@ void DeInitialize() FreeMemory(&szTempDir); FreeMemory(&szOSTempDir); - FreeMemory(&sgProduct.szProgramFolderPath); - FreeMemory(&sgProduct.szProgramFolderName); - FreeMemory(&sgProduct.szProductName); - FreeMemory(&sgProduct.szPath); FreeMemory(&szSetupDir); FreeMemory(&szFileIniConfig); FreeMemory(&szEGlobalAlloc); @@ -5437,6 +5464,11 @@ void SaveInstallerFiles() lstrcpy(szDestination, sgProduct.szPath); AppendBackSlash(szDestination, sizeof(szDestination)); + if(*sgProduct.szSubPath != '\0') + { + lstrcat(szDestination, sgProduct.szSubPath); + AppendBackSlash(szDestination, sizeof(szDestination)); + } lstrcat(szDestination, "Install"); AppendBackSlash(szDestination, sizeof(szDestination)); @@ -5488,7 +5520,7 @@ void SaveInstallerFiles() siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL); while(siCObject) { - LocateJar(siCObject, szArchivePath, sizeof(szArchivePath)); + LocateJar(siCObject, szArchivePath, sizeof(szArchivePath), FALSE); if(*szArchivePath != '\0') { lstrcpy(szBuf, szArchivePath); diff --git a/xpinstall/wizard/windows/setup/extra.h b/xpinstall/wizard/windows/setup/extra.h index 5697117c442..27740db03e3 100644 --- a/xpinstall/wizard/windows/setup/extra.h +++ b/xpinstall/wizard/windows/setup/extra.h @@ -128,7 +128,7 @@ BOOL DeleteIniRedirect(void); HRESULT LaunchApps(void); HRESULT FileExists(LPSTR szFile); int ExtractDirEntries(char* directory,void* vZip); -BOOL LocateJar(siC *siCObject, LPSTR szPath, DWORD dwPathSize); +BOOL LocateJar(siC *siCObject, LPSTR szPath, DWORD dwPathSize, BOOL bIncludeTempDir); HRESULT AddArchiveToIdiFile(siC *siCObject, char *szSComponent, char *szSFile, char *szFileIdiGetArchives); int SiCNodeGetIndexDS(char *szInDescriptionShort); void ViewSiComponents(void); diff --git a/xpinstall/wizard/windows/setup/ifuncns.c b/xpinstall/wizard/windows/setup/ifuncns.c index 23519dd374b..bc9134a8c3f 100644 --- a/xpinstall/wizard/windows/setup/ifuncns.c +++ b/xpinstall/wizard/windows/setup/ifuncns.c @@ -696,6 +696,48 @@ void UpdateInstallLog(LPSTR szKey, LPSTR szDir) } } +void UpdateJSProxyInfo() +{ + FILE *fJSFile; + char szBuf[MAX_BUF]; + char szJSFile[MAX_BUF]; + + if((*diAdvancedSettings.szProxyServer != '\0') || (*diAdvancedSettings.szProxyPort != '\0')) + { + lstrcpy(szJSFile, sgProduct.szPath); + if(*sgProduct.szSubPath != '\0') + { + AppendBackSlash(szJSFile, sizeof(szJSFile)); + lstrcat(szJSFile, sgProduct.szSubPath); + } + AppendBackSlash(szJSFile, sizeof(szJSFile)); + lstrcat(szJSFile, "defaults\\pref\\"); + CreateDirectoriesAll(szJSFile, TRUE); + lstrcat(szJSFile, FILE_ALL_JS); + + if((fJSFile = fopen(szJSFile, "a+t")) != NULL) + { + ZeroMemory(szBuf, sizeof(szBuf)); + if(*diAdvancedSettings.szProxyServer != '\0') + { + lstrcpy(szBuf, "user_pref(\"network.proxy.ftp\", \""); + lstrcat(szBuf, diAdvancedSettings.szProxyServer); + lstrcat(szBuf, "\");\n"); + } + + if(*diAdvancedSettings.szProxyPort != '\0') + { + lstrcat(szBuf, "user_pref(\"network.proxy.ftp_port\", "); + lstrcat(szBuf, diAdvancedSettings.szProxyPort); + lstrcat(szBuf, ");\n"); + } + + fwrite(szBuf, sizeof(char), lstrlen(szBuf), fJSFile); + fclose(fJSFile); + } + } +} + HRESULT CreateDirectoriesAll(char* szPath, BOOL bLogForUninstall) { int i; diff --git a/xpinstall/wizard/windows/setup/ifuncns.h b/xpinstall/wizard/windows/setup/ifuncns.h index 45c19801acf..544af7c3217 100644 --- a/xpinstall/wizard/windows/setup/ifuncns.h +++ b/xpinstall/wizard/windows/setup/ifuncns.h @@ -64,5 +64,6 @@ void UpdateInstallLog(LPSTR szKey, LPSTR szDir); int RegisterDll32(char *File); HRESULT FileSelfRegister(LPSTR szFilename, LPSTR szDestination); HRESULT ProcessSelfRegisterFile(DWORD dwTiming); +void UpdateJSProxyInfo(void); #endif diff --git a/xpinstall/wizard/windows/setup/setup.c b/xpinstall/wizard/windows/setup/setup.c index ca81e0fc323..dbf84ad0692 100644 --- a/xpinstall/wizard/windows/setup/setup.c +++ b/xpinstall/wizard/windows/setup/setup.c @@ -72,7 +72,6 @@ BOOL bSDUserCanceled; BOOL bIdiArchivesExists; BOOL bCreateDestinationDir; BOOL bReboot; -BOOL bSaveInstallerFiles; setupGen sgProduct; diS diSetup; diff --git a/xpinstall/wizard/windows/setup/setup.h b/xpinstall/wizard/windows/setup/setup.h index 38de67d9281..2a56794c234 100644 --- a/xpinstall/wizard/windows/setup/setup.h +++ b/xpinstall/wizard/windows/setup/setup.h @@ -65,6 +65,7 @@ typedef int PRInt32; #define FILE_INI_REDIRECT "redirect.ini" #define WIZ_TEMP_DIR "ns_temp" #define FILE_INSTALL_LOG "install.log" +#define FILE_ALL_JS "all.js" /* UG: Upgrade */ #define UG_NONE 0 @@ -242,6 +243,9 @@ typedef struct dlgAdvancedSettings LPSTR szTitle; LPSTR szMessage0; LPSTR szMessage1; + LPSTR szProxyServer; + LPSTR szProxyPort; + BOOL bSaveInstaller; } diAS; typedef struct dlgStartInstall @@ -264,13 +268,13 @@ typedef struct setupStruct DWORD dwCustomType; DWORD dwNumberOfComponents; LPSTR szPath; + LPSTR szSubPath; + LPSTR szProgramName; LPSTR szProductName; LPSTR szProgramFolderName; LPSTR szProgramFolderPath; LPSTR szAlternateArchiveSearchPath; LPSTR szParentProcessFilename; - LPSTR szProxyServer; - LPSTR szProxyPort; LPSTR szSetupTitle0; COLORREF crSetupTitle0FontColor; int iSetupTitle0FontSize; diff --git a/xpinstall/wizard/windows/setup/xpi.c b/xpinstall/wizard/windows/setup/xpi.c index d3e1bae225e..f0d35dd7d36 100644 --- a/xpinstall/wizard/windows/setup/xpi.c +++ b/xpinstall/wizard/windows/setup/xpi.c @@ -169,7 +169,13 @@ HRESULT SmartUpdateJars() ShowMessage(szMsgSmartUpdateStart, TRUE); if(InitializeXPIStub() == WIZ_OK) { - hrResult = pfnXpiInit(sgProduct.szPath, cbXPIProgress); + lstrcpy(szBuf, sgProduct.szPath); + if(*sgProduct.szSubPath != '\0') + { + AppendBackSlash(szBuf, sizeof(szBuf)); + lstrcat(szBuf, sgProduct.szSubPath); + } + hrResult = pfnXpiInit(szBuf, cbXPIProgress); ShowMessage(szMsgSmartUpdateStart, FALSE); InitProgressDlg(); diff --git a/xpinstall/wizard/windows/setuprsc/setuprsc.h b/xpinstall/wizard/windows/setuprsc/setuprsc.h index bd430438a00..0d1c6cc4cfe 100644 --- a/xpinstall/wizard/windows/setuprsc/setuprsc.h +++ b/xpinstall/wizard/windows/setuprsc/setuprsc.h @@ -100,6 +100,7 @@ #define IDC_EDIT_PROXY_SERVER 1062 #define IDC_EDIT_PROXY_PORT 1063 #define IDC_TAB1 1064 +#define IDC_DELETE_PATH 1065 #define DLG_WELCOME 2001 #define DLG_LICENSE 2002 #define DLG_SETUP_TYPE 2003 @@ -148,7 +149,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 112 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1065 +#define _APS_NEXT_CONTROL_VALUE 1066 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/xpinstall/wizard/windows/setuprsc/setuprsc.rc b/xpinstall/wizard/windows/setuprsc/setuprsc.rc index b479e9defb4..e378fefad03 100644 --- a/xpinstall/wizard/windows/setuprsc/setuprsc.rc +++ b/xpinstall/wizard/windows/setuprsc/setuprsc.rc @@ -252,13 +252,13 @@ END DLG_ADVANCED_SETTINGS DIALOGEX 51, 56, 315, 205 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -FONT 8, "MS Sans Serif", 0, 0, 0x1 +FONT 8, "MS Sans Serif" BEGIN COMBOBOX IDC_LIST_SITE_SELECTOR,101,49,206,124,CBS_DROPDOWNLIST | CBS_SORT | CBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_EDIT_PROXY_SERVER,147,82,152,14,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_PROXY_PORT,147,99,152,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_PROXY_SERVER,147,83,152,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_PROXY_PORT,147,100,152,12,ES_AUTOHSCROLL CONTROL "Save installer files locally", IDC_CHECK_SAVE_INSTALLER_FILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,159,204,9 @@ -301,15 +301,16 @@ BEGIN LTEXT "Space Available:",IDC_STATIC,206,148,94,9 END -DLG_UPGRADE DIALOG DISCARDABLE 51, 56, 306, 134 +DLG_UPGRADE DIALOG DISCARDABLE 51, 56, 306, 157 STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Sans Serif" BEGIN - DEFPUSHBUTTON "&Delete",ID_DELETE,59,106,53,14 - PUSHBUTTON "&Ignore",ID_IGNORE,126,106,53,14 - PUSHBUTTON "&Back",IDWIZBACK,193,106,53,14 - LTEXT "",IDC_MESSAGE0,16,13,272,37,NOT WS_GROUP - LTEXT "",IDC_MESSAGE1,16,53,272,42,NOT WS_GROUP + DEFPUSHBUTTON "&Back",IDWIZBACK,160,131,53,14 + PUSHBUTTON "&Delete",ID_DELETE,93,131,53,14 + LTEXT "",IDC_MESSAGE0,16,13,272,30,NOT WS_GROUP + LTEXT "",IDC_MESSAGE1,16,47,272,38,NOT WS_GROUP + LTEXT "",IDC_DELETE_PATH,21,103,260,13,SS_CENTERIMAGE + GROUPBOX "Destination Directory",IDC_STATIC,15,94,272,25 END @@ -347,7 +348,7 @@ BEGIN DLG_UPGRADE, DIALOG BEGIN - BOTTOMMARGIN, 133 + BOTTOMMARGIN, 156 END END #endif // APSTUDIO_INVOKED