From a5d7b3684783aece542c1d4e23e1b9673e3eeeb8 Mon Sep 17 00:00:00 2001 From: "ssu%netscape.com" Date: Tue, 16 Nov 1999 05:59:35 +0000 Subject: [PATCH] fixing bug #17109. It now takes into account the size of the .xpi file to be downloaded as part of the amount of disk space required. r=sgehani --- xpinstall/wizard/windows/setup/dialogs.c | 20 +- xpinstall/wizard/windows/setup/dialogs.h | 24 ++ xpinstall/wizard/windows/setup/extra.c | 347 +++++++++++++----- xpinstall/wizard/windows/setup/extra.h | 3 + xpinstall/wizard/windows/setup/makefile.win | 1 + xpinstall/wizard/windows/setup/setup.h | 12 +- xpinstall/wizard/windows/setuprsc/setuprsc.h | 1 + xpinstall/wizard/windows/setuprsc/setuprsc.rc | 6 +- 8 files changed, 305 insertions(+), 109 deletions(-) diff --git a/xpinstall/wizard/windows/setup/dialogs.c b/xpinstall/wizard/windows/setup/dialogs.c index 663e4f331e28..ccd9a96fae8b 100644 --- a/xpinstall/wizard/windows/setup/dialogs.c +++ b/xpinstall/wizard/windows/setup/dialogs.c @@ -815,13 +815,8 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON SetWindowPos(hDlg, HWND_TOP, (dwScreenX/2)-(rDlg.right/2), (dwScreenY/2)-(rDlg.bottom/2), 0, 0, SWP_NOSIZE); /* update the disk space available info in the dialog. GetDiskSpaceAvailable() - returns value in bytes, therefore a division by 1000 is required to be in - kilobytes */ - if((ullDSBuf = GetDiskSpaceAvailable(sgProduct.szPath)) > 1000) - ullDSBuf /= 1000; - else - ullDSBuf = 0; - + returns value in kbytes */ + ullDSBuf = GetDiskSpaceAvailable(sgProduct.szPath); _ui64toa(ullDSBuf, tchBuffer, 10); ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), PP_ROOT_ONLY); RemoveBackSlash(szBuf); @@ -929,7 +924,7 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON bReturn = TRUE; /* update the disk space required info in the dialog. It is already - in Kilobytes (unlike what GetDiskSpaceAvailable() returns) */ + in Kilobytes */ ullDSBuf = GetDiskSpaceRequired(DSR_DESTINATION); _ui64toa(ullDSBuf, tchBuffer, 10); ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), PP_ROOT_ONLY); @@ -1448,15 +1443,20 @@ void DlgSequenceNext() do { hrValue = VerifyDiskSpace(); - if(hrValue == FALSE) + if(hrValue == IDOK) { /* show previous visible window */ DlgSequencePrev(); break; } + else if(hrValue == IDCANCEL) + { + AskCancelDlg(hWndMain); + hrValue = IDRETRY; + } }while(hrValue == IDRETRY); - if(hrValue == FALSE) + if(hrValue == IDOK) { /* break out of this case because we need to show the previous dialog */ break; diff --git a/xpinstall/wizard/windows/setup/dialogs.h b/xpinstall/wizard/windows/setup/dialogs.h index cb8171e84892..69db4adf955b 100644 --- a/xpinstall/wizard/windows/setup/dialogs.h +++ b/xpinstall/wizard/windows/setup/dialogs.h @@ -1,3 +1,27 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is Mozilla Communicator client code, + * released March 31, 1998. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + * Sean Su + */ + #ifndef _DIALOGS_H_ #define _DIALOGS_H_ diff --git a/xpinstall/wizard/windows/setup/extra.c b/xpinstall/wizard/windows/setup/extra.c index 8248b8f338ef..cf6db16d42fb 100644 --- a/xpinstall/wizard/windows/setup/extra.c +++ b/xpinstall/wizard/windows/setup/extra.c @@ -429,6 +429,9 @@ BOOL LocateJar(siC *siCObject) { /* 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, sgProduct.szAlternateArchiveSearchPath); + AppendBackSlash(siCObject->szArchivePath, MAX_BUF); bRet = TRUE; } else @@ -453,6 +456,9 @@ BOOL LocateJar(siC *siCObject) { /* 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; /* found what we're looking for. No need to continue */ @@ -474,6 +480,9 @@ BOOL LocateJar(siC *siCObject) { /* 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, szSetupDirTemp); + AppendBackSlash(siCObject->szArchivePath, MAX_BUF); bRet = TRUE; } } @@ -1147,7 +1156,8 @@ HRESULT InitSCoreFile() if((siCFCoreFile.szMessage = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); - siCFCoreFile.bCleanup = TRUE; + siCFCoreFile.bCleanup = TRUE; + siCFCoreFile.ullInstallSize = 0; return(0); } @@ -1165,12 +1175,15 @@ siC *CreateSiCNode() if((siCNode = NS_GlobalAlloc(sizeof(struct sinfoComponent))) == NULL) exit(1); - siCNode->dwAttributes = 0; - siCNode->ullInstallSize = 0; - siCNode->ullInstallSizeSystem = 0; + siCNode->dwAttributes = 0; + siCNode->ullInstallSize = 0; + siCNode->ullInstallSizeSystem = 0; + siCNode->ullInstallSizeArchive = 0; if((siCNode->szArchiveName = NS_GlobalAlloc(MAX_BUF)) == NULL) exit(1); + if((siCNode->szArchivePath = NS_GlobalAlloc(MAX_BUF)) == NULL) + exit(1); if((siCNode->szDescriptionShort = NS_GlobalAlloc(MAX_BUF)) == NULL) exit(1); if((siCNode->szDescriptionLong = NS_GlobalAlloc(MAX_BUF)) == NULL) @@ -1212,6 +1225,7 @@ void SiCNodeDelete(siC *siCTemp) siCTemp->Next = NULL; siCTemp->Prev = NULL; + FreeMemory(&(siCTemp->szArchivePath)); FreeMemory(&(siCTemp->szArchiveName)); FreeMemory(&(siCTemp->szDescriptionLong)); FreeMemory(&(siCTemp->szDescriptionShort)); @@ -1452,6 +1466,70 @@ ULONGLONG SiCNodeGetInstallSize(DWORD dwIndex, BOOL bIncludeInvisible) return(0L); } +ULONGLONG SiCNodeGetInstallSizeSystem(DWORD dwIndex, BOOL bIncludeInvisible) +{ + DWORD dwCount = 0; + siC *siCTemp = siComponents; + + if(siCTemp != NULL) + { + if((bIncludeInvisible == TRUE) || ((bIncludeInvisible == FALSE) && (!(siCTemp->dwAttributes & SIC_INVISIBLE)))) + { + if(dwIndex == 0) + return(siCTemp->ullInstallSizeSystem); + + ++dwCount; + } + + siCTemp = siCTemp->Next; + while((siCTemp != NULL) && (siCTemp != siComponents)) + { + if((bIncludeInvisible == TRUE) || ((bIncludeInvisible == FALSE) && (!(siCTemp->dwAttributes & SIC_INVISIBLE)))) + { + if(dwIndex == dwCount) + return(siCTemp->ullInstallSizeSystem); + + ++dwCount; + } + + siCTemp = siCTemp->Next; + } + } + return(0L); +} + +ULONGLONG SiCNodeGetInstallSizeArchive(DWORD dwIndex, BOOL bIncludeInvisible) +{ + DWORD dwCount = 0; + siC *siCTemp = siComponents; + + if(siCTemp != NULL) + { + if((bIncludeInvisible == TRUE) || ((bIncludeInvisible == FALSE) && (!(siCTemp->dwAttributes & SIC_INVISIBLE)))) + { + if(dwIndex == 0) + return(siCTemp->ullInstallSizeArchive); + + ++dwCount; + } + + siCTemp = siCTemp->Next; + while((siCTemp != NULL) && (siCTemp != siComponents)) + { + if((bIncludeInvisible == TRUE) || ((bIncludeInvisible == FALSE) && (!(siCTemp->dwAttributes & SIC_INVISIBLE)))) + { + if(dwIndex == dwCount) + return(siCTemp->ullInstallSizeArchive); + + ++dwCount; + } + + siCTemp = siCTemp->Next; + } + } + return(0L); +} + /* retrieve Index of node containing short description */ int SiCNodeGetIndexDS(char *szInDescriptionShort) { @@ -1540,7 +1618,7 @@ BOOL IsWin95Debute() ULONGLONG GetDiskSpaceRequired(DWORD dwType) { ULONGLONG ullTotalSize = 0; - siC *siCTemp = siComponents; + siC *siCTemp = siComponents; if(siCTemp != NULL) { @@ -1555,6 +1633,11 @@ ULONGLONG GetDiskSpaceRequired(DWORD dwType) case DSR_SYSTEM: ullTotalSize += siCTemp->ullInstallSizeSystem; break; + + case DSR_TEMP: + if(LocateJar(siCTemp) == FALSE) + ullTotalSize += siCTemp->ullInstallSizeArchive; + break; } } @@ -1572,12 +1655,23 @@ ULONGLONG GetDiskSpaceRequired(DWORD dwType) case DSR_SYSTEM: ullTotalSize += siCTemp->ullInstallSizeSystem; break; + + case DSR_TEMP: + if(LocateJar(siCTemp) == FALSE) + ullTotalSize += siCTemp->ullInstallSizeArchive; + break; } } siCTemp = siCTemp->Next; } } + + /* add the amount of disk space it will take for the + xpinstall engine in the TEMP area */ + if(dwType == DSR_TEMP) + ullTotalSize += siCFCoreFile.ullInstallSize; + return(ullTotalSize); } @@ -1627,126 +1721,181 @@ ULONGLONG GetDiskSpaceAvailable(LPSTR szPath) } ullReturn = uliFreeBytesAvailableToCaller.QuadPart; } + + if(ullReturn > 1024) + ullReturn /= 1024; + else + ullReturn = 0; + return(ullReturn); } +HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSRequired, LPSTR szPath, BOOL bCrutialMsg) +{ + char szBuf1[MAX_BUF]; + char szBuf2[MAX_BUF]; + char szBuf3[MAX_BUF]; + char szBufRootPath[MAX_BUF]; + char szBufMsg[MAX_BUF]; + char szDSAvailable[MAX_BUF]; + char szDSRequired[MAX_BUF]; + char szDlgDiskSpaceCheckTitle[MAX_BUF]; + char szDlgDiskSpaceCheckMsg[MAX_BUF]; + DWORD dwDlgType; + + if(NS_LoadString(hSetupRscInst, IDS_DLG_DISK_SPACE_CHECK_TITLE, szDlgDiskSpaceCheckTitle, MAX_BUF) != WIZ_OK) + exit(1); + + if(bCrutialMsg) + { + dwDlgType = MB_RETRYCANCEL; + if(NS_LoadString(hSetupRscInst, IDS_DLG_DISK_SPACE_CHECK_CRUTIAL_MSG, szDlgDiskSpaceCheckMsg, MAX_BUF) != WIZ_OK) + exit(1); + } + else + { + dwDlgType = MB_OKCANCEL; + if(NS_LoadString(hSetupRscInst, IDS_DLG_DISK_SPACE_CHECK_MSG, szDlgDiskSpaceCheckMsg, MAX_BUF) != WIZ_OK) + exit(1); + } + + ParsePath(szPath, szBufRootPath, sizeof(szBufRootPath), PP_ROOT_ONLY); + RemoveBackSlash(szBufRootPath); + + _ui64toa(ullDSAvailable, szDSAvailable, 10); + _ui64toa(ullDSRequired, szDSRequired, 10); + + lstrcpy(szBuf1, "\n\n "); + lstrcat(szBuf1, szPath); + lstrcat(szBuf1, "\n\n "); + lstrcpy(szBuf2, szDSRequired); + lstrcat(szBuf2, " K\n "); + lstrcpy(szBuf3, szDSAvailable); + lstrcat(szBuf3, " K\n\n"); + wsprintf(szBufMsg, szDlgDiskSpaceCheckMsg, szBufRootPath, szBuf1, szBuf2, szBuf3); + return(MessageBox(hWndMain, szBufMsg, szDlgDiskSpaceCheckTitle, dwDlgType | MB_ICONEXCLAMATION | MB_DEFBUTTON2 | MB_APPLMODAL | MB_SETFOREGROUND)); +} + HRESULT VerifyDiskSpace() { ULONGLONG ullDSAPath; ULONGLONG ullDSRPath; ULONGLONG ullDSASysPath; ULONGLONG ullDSRSysPath; + ULONGLONG ullDSATempPath; + ULONGLONG ullDSRTempPath; ULONGLONG ullDSTotalAvailable; ULONGLONG ullDSTotalRequired; - char szDSAPath[MAX_BUF]; - char szDSRPath[MAX_BUF]; - char szDSASysPath[MAX_BUF]; - char szDSRSysPath[MAX_BUF]; + HRESULT hRetValue = TRUE; char szSysPath[MAX_BUF]; - char szBuf1[MAX_BUF]; - char szBuf2[MAX_BUF]; - char szBuf3[MAX_BUF]; char szBufPath[MAX_BUF]; char szBufSysPath[MAX_BUF]; - char szBufMsg[MAX_BUF]; - char szBufSysMsg[MAX_BUF]; - char szDlgDiskSpaceCheckTitle[MAX_BUF]; - char szDlgDiskSpaceCheckMsg[MAX_BUF]; - char szDlgDiskSpaceCheckSysMsg[MAX_BUF]; - - if(NS_LoadString(hSetupRscInst, IDS_DLG_DISK_SPACE_CHECK_TITLE, szDlgDiskSpaceCheckTitle, MAX_BUF) != WIZ_OK) - exit(1); - if(NS_LoadString(hSetupRscInst, IDS_DLG_DISK_SPACE_CHECK_MSG, szDlgDiskSpaceCheckMsg, MAX_BUF) != WIZ_OK) - exit(1); - if(NS_LoadString(hSetupRscInst, IDS_DLG_DISK_SPACE_CHECK_SYS_MSG, szDlgDiskSpaceCheckSysMsg, MAX_BUF) != WIZ_OK) - exit(1); + char szBufTempPath[MAX_BUF]; + /* 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); + } - ParsePath(sgProduct.szPath, szBufPath, sizeof(szBufPath), PP_ROOT_ONLY); - ParsePath(szSysPath, szBufSysPath, sizeof(szBufSysPath), PP_ROOT_ONLY); + /* Calculate disk space for temp path */ + ullDSATempPath = GetDiskSpaceAvailable(szTempDir); + ullDSRTempPath = GetDiskSpaceRequired(DSR_TEMP); - AppendBackSlash(szBufPath, sizeof(szBufPath)); - AppendBackSlash(szBufSysPath, sizeof(szBufSysPath)); + 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); - /* check to see if system path is the same as sgProduct.szPath */ - if(lstrcmpi(szBufPath, szBufSysPath) == 0) + 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(ullDSAPath, ullDSRPath, sgProduct.szPath, FALSE)); + } + else + { + if((lstrcmpi(szBufPath, szBufTempPath) != 0) && + (lstrcmpi(szBufPath, szBufSysPath) != 0) && + (lstrcmpi(szBufTempPath, szBufSysPath) != 0)) { - /* check disk space for both system and destination */ - ullDSTotalRequired = ullDSRPath + ullDSRSysPath; - ullDSTotalAvailable = ullDSAPath; - - if(ullDSTotalAvailable < ullDSTotalRequired) + /* check TEMP drive */ + if(ullDSATempPath < ullDSRTempPath) { - _ui64toa(ullDSTotalAvailable, szDSAPath, 10); - _ui64toa(ullDSTotalRequired, szDSRPath, 10); - lstrcpy(szBuf1, "\n\n "); - lstrcat(szBuf1, sgProduct.szPath); - lstrcat(szBuf1, "\n\n "); - lstrcpy(szBuf2, szDSRPath); - lstrcat(szBuf2, "\n "); - lstrcpy(szBuf3, szDSAPath); - lstrcat(szBuf3, "\n\n"); - wsprintf(szBufMsg, szDlgDiskSpaceCheckMsg, szBuf1, szBuf2, szBuf3); - if(MessageBox(hWndMain, szBufMsg, szDlgDiskSpaceCheckTitle, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON1 | MB_APPLMODAL | MB_SETFOREGROUND) == IDYES) - { - return(FALSE); - } - else - { - return(TRUE); - } + return(ErrorMsgDiskSpace(ullDSATempPath, ullDSRTempPath, szTempDir, TRUE)); } - } - else - { - /* check disk space for system only */ + + /* check SYSTEM drive */ if(ullDSASysPath < ullDSRSysPath) { - _ui64toa(ullDSASysPath, szDSASysPath, 10); - _ui64toa(ullDSRSysPath, szDSRSysPath, 10); - lstrcpy(szBuf1, "\n\n "); - lstrcat(szBuf1, sgProduct.szPath); - lstrcat(szBuf1, "\n\n "); - lstrcpy(szBuf2, szDSRPath); - lstrcat(szBuf2, "\n "); - lstrcpy(szBuf3, szDSAPath); - lstrcat(szBuf3, "\n\n"); - wsprintf(szBufSysMsg, szDlgDiskSpaceCheckSysMsg, szBuf1, szBuf2, szBuf3); - return(MessageBox(hWndMain, szBufSysMsg, szDlgDiskSpaceCheckTitle, MB_RETRYCANCEL | MB_ICONQUESTION | MB_DEFBUTTON2 | MB_APPLMODAL | MB_SETFOREGROUND)); + 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)); } } } - /* check disk space for destination only */ - if(ullDSAPath < ullDSRPath) - { - _ui64toa(ullDSAPath, szDSAPath, 10); - _ui64toa(ullDSRPath, szDSRPath, 10); - lstrcpy(szBuf1, "\n\n "); - lstrcat(szBuf1, sgProduct.szPath); - lstrcat(szBuf1, "\n\n "); - lstrcpy(szBuf2, szDSRPath); - lstrcat(szBuf2, "\n "); - lstrcpy(szBuf3, szDSAPath); - lstrcat(szBuf3, "\n\n"); - wsprintf(szBufMsg, szDlgDiskSpaceCheckMsg, szBuf1, szBuf2, szBuf3); - if(MessageBox(hWndMain, szBufMsg, szDlgDiskSpaceCheckTitle, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON1 | MB_APPLMODAL | MB_SETFOREGROUND) == IDYES) - { - return(FALSE); - } - else - { - return(TRUE); - } - } - return(TRUE); + return(FALSE); } HRESULT ParseComponentAttributes(char *szAttribute) @@ -1814,10 +1963,17 @@ void InitSiComponents(char *szFileIni) /* get install size required in system for component. Sould be in Kilobytes */ GetPrivateProfileString(szComponentItem, "Install Size System", "", szBuf, MAX_BUF, szFileIni); if(*szBuf != '\0') - siCTemp->ullInstallSizeSystem = atol(szBuf); + siCTemp->ullInstallSizeSystem = _atoi64(szBuf); else siCTemp->ullInstallSizeSystem = 0; + /* get install size required in temp for component. Sould be in Kilobytes */ + GetPrivateProfileString(szComponentItem, "Install Size Archive", "", szBuf, MAX_BUF, szFileIni); + if(*szBuf != '\0') + siCTemp->ullInstallSizeArchive = _atoi64(szBuf); + else + siCTemp->ullInstallSizeArchive = 0; + /* get attributes of component */ GetPrivateProfileString(szComponentItem, "Attributes", "", szBuf, MAX_BUF, szFileIni); siCTemp->dwAttributes = ParseComponentAttributes(szBuf); @@ -2325,6 +2481,13 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) } } + /* get install size required in temp for component core. Sould be in Kilobytes */ + GetPrivateProfileString("Core", "Install Size", "", szBuf, MAX_BUF, szFileIniConfig); + if(*szBuf != '\0') + siCFCoreFile.ullInstallSize = _atoi64(szBuf); + else + siCFCoreFile.ullInstallSize = 0; + GetPrivateProfileString("SmartDownload-Netscape Install", "core_file", "", siSDObject.szCoreFile, MAX_BUF, szFileIniConfig); GetPrivateProfileString("SmartDownload-Netscape Install", "core_file_path", "", siSDObject.szCoreFilePath, MAX_BUF, szFileIniConfig); GetPrivateProfileString("SmartDownload-Netscape Install", "core_dir", "", siSDObject.szCoreDir, MAX_BUF, szFileIniConfig); diff --git a/xpinstall/wizard/windows/setup/extra.h b/xpinstall/wizard/windows/setup/extra.h index a9ffb088803a..fc357bf33225 100644 --- a/xpinstall/wizard/windows/setup/extra.h +++ b/xpinstall/wizard/windows/setup/extra.h @@ -61,6 +61,8 @@ void SiCNodeSetItemsSelected(DWORD dwItems, DWORD *dwItemsSelected) char *SiCNodeGetDescriptionLong(DWORD dwIndex, BOOL bIncludeInvisible); siC *SiCNodeGetObject(DWORD dwIndex, BOOL bIncludeInvisibleObjs); ULONGLONG SiCNodeGetInstallSize(DWORD dwIndex, BOOL bIncludeInvisible); +ULONGLONG SiCNodeGetInstallSizeSystem(DWORD dwIndex, BOOL bIncludeInvisible); +ULONGLONG SiCNodeGetInstallSizeArchive(DWORD dwIndex, BOOL bIncludeInvisible); void InitSiComponents(char *szFileIni); HRESULT ParseComponentAttributes(char *szBuf); void InitSiComponents(char *szFileIni); @@ -108,6 +110,7 @@ BOOL IsWin95Debute(void); ULONGLONG GetDiskSpaceRequired(DWORD dwType); ULONGLONG GetDiskSpaceAvailable(LPSTR szPath); HRESULT VerifyDiskSpace(void); +HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSRequired, LPSTR szPath, BOOL bCrutialMsg); void SetCustomType(void); void GetAlternateArchiveSearchPath(LPSTR lpszCmdLine); BOOL NeedReboot(void); diff --git a/xpinstall/wizard/windows/setup/makefile.win b/xpinstall/wizard/windows/setup/makefile.win index 10db7974b9f6..9d222894ce76 100644 --- a/xpinstall/wizard/windows/setup/makefile.win +++ b/xpinstall/wizard/windows/setup/makefile.win @@ -18,6 +18,7 @@ # Rights Reserved. # # Contributor(s): +# Sean Su DEPTH=..\..\..\.. diff --git a/xpinstall/wizard/windows/setup/setup.h b/xpinstall/wizard/windows/setup/setup.h index 63dcfd1929f8..080696dca3e9 100644 --- a/xpinstall/wizard/windows/setup/setup.h +++ b/xpinstall/wizard/windows/setup/setup.h @@ -126,6 +126,7 @@ typedef int PRInt32; /* DSR: Disk Space Required */ #define DSR_DESTINATION 0 #define DSR_SYSTEM 1 +#define DSR_TEMP 2 typedef HRESULT (_cdecl *SDI_NETINSTALL) (LPSDISTRUCT); @@ -249,10 +250,11 @@ typedef struct sinfoSmartDownload typedef struct sinfoCoreFile { - LPSTR szSource; - LPSTR szDestination; - BOOL bCleanup; - LPSTR szMessage; + LPSTR szSource; + LPSTR szDestination; + LPSTR szMessage; + BOOL bCleanup; + ULONGLONG ullInstallSize; } siCF; typedef struct sinfoComponentDep siCD; @@ -268,8 +270,10 @@ struct sinfoComponent { ULONGLONG ullInstallSize; ULONGLONG ullInstallSizeSystem; + ULONGLONG ullInstallSizeArchive; DWORD dwAttributes; LPSTR szArchiveName; + LPSTR szArchivePath; LPSTR szDescriptionShort; LPSTR szDescriptionLong; LPSTR szParameter; diff --git a/xpinstall/wizard/windows/setuprsc/setuprsc.h b/xpinstall/wizard/windows/setuprsc/setuprsc.h index 3fc450e48a26..fcd0023e38f7 100644 --- a/xpinstall/wizard/windows/setuprsc/setuprsc.h +++ b/xpinstall/wizard/windows/setuprsc/setuprsc.h @@ -18,6 +18,7 @@ #define IDS_ERROR_DETERMINING_DISK_SPACE 14 #define IDS_DLG_DISK_SPACE_CHECK_TITLE 15 #define IDS_DLG_DISK_SPACE_CHECK_SYS_MSG 16 +#define IDS_DLG_DISK_SPACE_CHECK_CRUTIAL_MSG 16 #define IDS_DLG_DISK_SPACE_CHECK_MSG 17 #define IDS_ERROR_CREATE_DIRECTORY 18 #define IDS_STR_FILE_NUMBER 19 diff --git a/xpinstall/wizard/windows/setuprsc/setuprsc.rc b/xpinstall/wizard/windows/setuprsc/setuprsc.rc index 35522c83b865..9495a24ed7a2 100644 --- a/xpinstall/wizard/windows/setuprsc/setuprsc.rc +++ b/xpinstall/wizard/windows/setuprsc/setuprsc.rc @@ -321,10 +321,10 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_DLG_DISK_SPACE_CHECK_SYS_MSG - "Setup has detected insufficient disk space on: %s Required: %s Available: %sThis folder is where some Windows related files need to be installed to. You will need to make available more disk space by uninstalling some software. You if have already done so, you can click Retry, or if you would like to cancel the setup, click Cancel." + IDS_DLG_DISK_SPACE_CHECK_CRUTIAL_MSG + "Setup has detected insufficient disk space to continue with installation on %s for the path: %sRequired: %sAvailable: %sClick Retry if more disk space has been made available, or click Cancel to cancel Setup." IDS_DLG_DISK_SPACE_CHECK_MSG - "Setup has detected insufficient disk space on: %s Required: %s Available: %sfor the selection[s] chosen. Would you like to go back and make changes to either the destination folder or other selection[s]?" + "Setup has detected insufficient disk space to continue with installation on %s for the path: %sRequired: %sAvailable: %sClick OK to go back and choose a different destination path, or click Cancel to cancel Setup." IDS_ERROR_CREATE_DIRECTORY "Could not create folder: %sMake sure you have access to create the folder." IDS_STR_FILE_NUMBER "File count:"