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

This commit is contained in:
ssu%netscape.com 1999-11-16 05:59:35 +00:00
Родитель 830101554e
Коммит a5d7b36847
8 изменённых файлов: 305 добавлений и 109 удалений

Просмотреть файл

@ -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); 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() /* update the disk space available info in the dialog. GetDiskSpaceAvailable()
returns value in bytes, therefore a division by 1000 is required to be in returns value in kbytes */
kilobytes */ ullDSBuf = GetDiskSpaceAvailable(sgProduct.szPath);
if((ullDSBuf = GetDiskSpaceAvailable(sgProduct.szPath)) > 1000)
ullDSBuf /= 1000;
else
ullDSBuf = 0;
_ui64toa(ullDSBuf, tchBuffer, 10); _ui64toa(ullDSBuf, tchBuffer, 10);
ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), PP_ROOT_ONLY); ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), PP_ROOT_ONLY);
RemoveBackSlash(szBuf); RemoveBackSlash(szBuf);
@ -929,7 +924,7 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON
bReturn = TRUE; bReturn = TRUE;
/* update the disk space required info in the dialog. It is already /* update the disk space required info in the dialog. It is already
in Kilobytes (unlike what GetDiskSpaceAvailable() returns) */ in Kilobytes */
ullDSBuf = GetDiskSpaceRequired(DSR_DESTINATION); ullDSBuf = GetDiskSpaceRequired(DSR_DESTINATION);
_ui64toa(ullDSBuf, tchBuffer, 10); _ui64toa(ullDSBuf, tchBuffer, 10);
ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), PP_ROOT_ONLY); ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), PP_ROOT_ONLY);
@ -1448,15 +1443,20 @@ void DlgSequenceNext()
do do
{ {
hrValue = VerifyDiskSpace(); hrValue = VerifyDiskSpace();
if(hrValue == FALSE) if(hrValue == IDOK)
{ {
/* show previous visible window */ /* show previous visible window */
DlgSequencePrev(); DlgSequencePrev();
break; break;
} }
else if(hrValue == IDCANCEL)
{
AskCancelDlg(hWndMain);
hrValue = IDRETRY;
}
}while(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 out of this case because we need to show the previous dialog */
break; break;

Просмотреть файл

@ -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 <ssu@netscape.com>
*/
#ifndef _DIALOGS_H_ #ifndef _DIALOGS_H_
#define _DIALOGS_H_ #define _DIALOGS_H_

Просмотреть файл

@ -429,6 +429,9 @@ BOOL LocateJar(siC *siCObject)
{ {
/* jar file found. Unset attribute to download from the net */ /* jar file found. Unset attribute to download from the net */
siCObject->dwAttributes &= ~SIC_DOWNLOAD_REQUIRED; 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; bRet = TRUE;
} }
else else
@ -453,6 +456,9 @@ BOOL LocateJar(siC *siCObject)
{ {
/* jar file found. Unset attribute to download from the net */ /* jar file found. Unset attribute to download from the net */
siCObject->dwAttributes &= ~SIC_DOWNLOAD_REQUIRED; 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; bRet = TRUE;
/* found what we're looking for. No need to continue */ /* 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 */ /* jar file found. Unset attribute to download from the net */
siCObject->dwAttributes &= ~SIC_DOWNLOAD_REQUIRED; 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; bRet = TRUE;
} }
} }
@ -1147,7 +1156,8 @@ HRESULT InitSCoreFile()
if((siCFCoreFile.szMessage = NS_GlobalAlloc(MAX_BUF)) == NULL) if((siCFCoreFile.szMessage = NS_GlobalAlloc(MAX_BUF)) == NULL)
return(1); return(1);
siCFCoreFile.bCleanup = TRUE; siCFCoreFile.bCleanup = TRUE;
siCFCoreFile.ullInstallSize = 0;
return(0); return(0);
} }
@ -1165,12 +1175,15 @@ siC *CreateSiCNode()
if((siCNode = NS_GlobalAlloc(sizeof(struct sinfoComponent))) == NULL) if((siCNode = NS_GlobalAlloc(sizeof(struct sinfoComponent))) == NULL)
exit(1); exit(1);
siCNode->dwAttributes = 0; siCNode->dwAttributes = 0;
siCNode->ullInstallSize = 0; siCNode->ullInstallSize = 0;
siCNode->ullInstallSizeSystem = 0; siCNode->ullInstallSizeSystem = 0;
siCNode->ullInstallSizeArchive = 0;
if((siCNode->szArchiveName = NS_GlobalAlloc(MAX_BUF)) == NULL) if((siCNode->szArchiveName = NS_GlobalAlloc(MAX_BUF)) == NULL)
exit(1); exit(1);
if((siCNode->szArchivePath = NS_GlobalAlloc(MAX_BUF)) == NULL)
exit(1);
if((siCNode->szDescriptionShort = NS_GlobalAlloc(MAX_BUF)) == NULL) if((siCNode->szDescriptionShort = NS_GlobalAlloc(MAX_BUF)) == NULL)
exit(1); exit(1);
if((siCNode->szDescriptionLong = NS_GlobalAlloc(MAX_BUF)) == NULL) if((siCNode->szDescriptionLong = NS_GlobalAlloc(MAX_BUF)) == NULL)
@ -1212,6 +1225,7 @@ void SiCNodeDelete(siC *siCTemp)
siCTemp->Next = NULL; siCTemp->Next = NULL;
siCTemp->Prev = NULL; siCTemp->Prev = NULL;
FreeMemory(&(siCTemp->szArchivePath));
FreeMemory(&(siCTemp->szArchiveName)); FreeMemory(&(siCTemp->szArchiveName));
FreeMemory(&(siCTemp->szDescriptionLong)); FreeMemory(&(siCTemp->szDescriptionLong));
FreeMemory(&(siCTemp->szDescriptionShort)); FreeMemory(&(siCTemp->szDescriptionShort));
@ -1452,6 +1466,70 @@ ULONGLONG SiCNodeGetInstallSize(DWORD dwIndex, BOOL bIncludeInvisible)
return(0L); 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 */ /* retrieve Index of node containing short description */
int SiCNodeGetIndexDS(char *szInDescriptionShort) int SiCNodeGetIndexDS(char *szInDescriptionShort)
{ {
@ -1540,7 +1618,7 @@ BOOL IsWin95Debute()
ULONGLONG GetDiskSpaceRequired(DWORD dwType) ULONGLONG GetDiskSpaceRequired(DWORD dwType)
{ {
ULONGLONG ullTotalSize = 0; ULONGLONG ullTotalSize = 0;
siC *siCTemp = siComponents; siC *siCTemp = siComponents;
if(siCTemp != NULL) if(siCTemp != NULL)
{ {
@ -1555,6 +1633,11 @@ ULONGLONG GetDiskSpaceRequired(DWORD dwType)
case DSR_SYSTEM: case DSR_SYSTEM:
ullTotalSize += siCTemp->ullInstallSizeSystem; ullTotalSize += siCTemp->ullInstallSizeSystem;
break; break;
case DSR_TEMP:
if(LocateJar(siCTemp) == FALSE)
ullTotalSize += siCTemp->ullInstallSizeArchive;
break;
} }
} }
@ -1572,12 +1655,23 @@ ULONGLONG GetDiskSpaceRequired(DWORD dwType)
case DSR_SYSTEM: case DSR_SYSTEM:
ullTotalSize += siCTemp->ullInstallSizeSystem; ullTotalSize += siCTemp->ullInstallSizeSystem;
break; break;
case DSR_TEMP:
if(LocateJar(siCTemp) == FALSE)
ullTotalSize += siCTemp->ullInstallSizeArchive;
break;
} }
} }
siCTemp = siCTemp->Next; 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); return(ullTotalSize);
} }
@ -1627,126 +1721,181 @@ ULONGLONG GetDiskSpaceAvailable(LPSTR szPath)
} }
ullReturn = uliFreeBytesAvailableToCaller.QuadPart; ullReturn = uliFreeBytesAvailableToCaller.QuadPart;
} }
if(ullReturn > 1024)
ullReturn /= 1024;
else
ullReturn = 0;
return(ullReturn); 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() HRESULT VerifyDiskSpace()
{ {
ULONGLONG ullDSAPath; ULONGLONG ullDSAPath;
ULONGLONG ullDSRPath; ULONGLONG ullDSRPath;
ULONGLONG ullDSASysPath; ULONGLONG ullDSASysPath;
ULONGLONG ullDSRSysPath; ULONGLONG ullDSRSysPath;
ULONGLONG ullDSATempPath;
ULONGLONG ullDSRTempPath;
ULONGLONG ullDSTotalAvailable; ULONGLONG ullDSTotalAvailable;
ULONGLONG ullDSTotalRequired; ULONGLONG ullDSTotalRequired;
char szDSAPath[MAX_BUF]; HRESULT hRetValue = TRUE;
char szDSRPath[MAX_BUF];
char szDSASysPath[MAX_BUF];
char szDSRSysPath[MAX_BUF];
char szSysPath[MAX_BUF]; char szSysPath[MAX_BUF];
char szBuf1[MAX_BUF];
char szBuf2[MAX_BUF];
char szBuf3[MAX_BUF];
char szBufPath[MAX_BUF]; char szBufPath[MAX_BUF];
char szBufSysPath[MAX_BUF]; char szBufSysPath[MAX_BUF];
char szBufMsg[MAX_BUF]; char szBufTempPath[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);
/* Calculate disk space for destination path */
ullDSAPath = GetDiskSpaceAvailable(sgProduct.szPath); ullDSAPath = GetDiskSpaceAvailable(sgProduct.szPath);
ullDSRPath = GetDiskSpaceRequired(DSR_DESTINATION); ullDSRPath = GetDiskSpaceRequired(DSR_DESTINATION);
if(GetSystemDirectory(szSysPath, MAX_BUF) != 0) if(GetSystemDirectory(szSysPath, MAX_BUF) != 0)
{ {
/* Calculate disk space for system path */
ullDSASysPath = GetDiskSpaceAvailable(szSysPath); ullDSASysPath = GetDiskSpaceAvailable(szSysPath);
ullDSRSysPath = GetDiskSpaceRequired(DSR_SYSTEM); ullDSRSysPath = GetDiskSpaceRequired(DSR_SYSTEM);
}
else
{
ullDSASysPath = 0;
ullDSRSysPath = 0;
ZeroMemory(szSysPath, MAX_BUF);
}
ParsePath(sgProduct.szPath, szBufPath, sizeof(szBufPath), PP_ROOT_ONLY); /* Calculate disk space for temp path */
ParsePath(szSysPath, szBufSysPath, sizeof(szBufSysPath), PP_ROOT_ONLY); ullDSATempPath = GetDiskSpaceAvailable(szTempDir);
ullDSRTempPath = GetDiskSpaceRequired(DSR_TEMP);
AppendBackSlash(szBufPath, sizeof(szBufPath)); ParsePath(sgProduct.szPath, szBufPath, sizeof(szBufPath), PP_ROOT_ONLY);
AppendBackSlash(szBufSysPath, sizeof(szBufSysPath)); 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 */ AppendBackSlash(szBufPath, sizeof(szBufPath));
if(lstrcmpi(szBufPath, szBufSysPath) == 0) 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 */ /* check TEMP drive */
ullDSTotalRequired = ullDSRPath + ullDSRSysPath; if(ullDSATempPath < ullDSRTempPath)
ullDSTotalAvailable = ullDSAPath;
if(ullDSTotalAvailable < ullDSTotalRequired)
{ {
_ui64toa(ullDSTotalAvailable, szDSAPath, 10); return(ErrorMsgDiskSpace(ullDSATempPath, ullDSRTempPath, szTempDir, TRUE));
_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);
}
} }
}
else /* check SYSTEM drive */
{
/* check disk space for system only */
if(ullDSASysPath < ullDSRSysPath) if(ullDSASysPath < ullDSRSysPath)
{ {
_ui64toa(ullDSASysPath, szDSASysPath, 10); return(ErrorMsgDiskSpace(ullDSASysPath, ullDSRSysPath, szSysPath, TRUE));
_ui64toa(ullDSRSysPath, szDSRSysPath, 10); }
lstrcpy(szBuf1, "\n\n ");
lstrcat(szBuf1, sgProduct.szPath); /* check Destination drive */
lstrcat(szBuf1, "\n\n "); if(ullDSAPath < ullDSRPath)
lstrcpy(szBuf2, szDSRPath); {
lstrcat(szBuf2, "\n "); return(ErrorMsgDiskSpace(ullDSAPath, ullDSRPath, sgProduct.szPath, FALSE));
lstrcpy(szBuf3, szDSAPath); }
lstrcat(szBuf3, "\n\n"); }
wsprintf(szBufSysMsg, szDlgDiskSpaceCheckSysMsg, szBuf1, szBuf2, szBuf3); else
return(MessageBox(hWndMain, szBufSysMsg, szDlgDiskSpaceCheckTitle, MB_RETRYCANCEL | MB_ICONQUESTION | MB_DEFBUTTON2 | MB_APPLMODAL | MB_SETFOREGROUND)); {
/* 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 */ return(FALSE);
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);
} }
HRESULT ParseComponentAttributes(char *szAttribute) HRESULT ParseComponentAttributes(char *szAttribute)
@ -1814,10 +1963,17 @@ void InitSiComponents(char *szFileIni)
/* get install size required in system for component. Sould be in Kilobytes */ /* get install size required in system for component. Sould be in Kilobytes */
GetPrivateProfileString(szComponentItem, "Install Size System", "", szBuf, MAX_BUF, szFileIni); GetPrivateProfileString(szComponentItem, "Install Size System", "", szBuf, MAX_BUF, szFileIni);
if(*szBuf != '\0') if(*szBuf != '\0')
siCTemp->ullInstallSizeSystem = atol(szBuf); siCTemp->ullInstallSizeSystem = _atoi64(szBuf);
else else
siCTemp->ullInstallSizeSystem = 0; 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 */ /* get attributes of component */
GetPrivateProfileString(szComponentItem, "Attributes", "", szBuf, MAX_BUF, szFileIni); GetPrivateProfileString(szComponentItem, "Attributes", "", szBuf, MAX_BUF, szFileIni);
siCTemp->dwAttributes = ParseComponentAttributes(szBuf); 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", "", siSDObject.szCoreFile, MAX_BUF, szFileIniConfig);
GetPrivateProfileString("SmartDownload-Netscape Install", "core_file_path", "", siSDObject.szCoreFilePath, 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); GetPrivateProfileString("SmartDownload-Netscape Install", "core_dir", "", siSDObject.szCoreDir, MAX_BUF, szFileIniConfig);

Просмотреть файл

@ -61,6 +61,8 @@ void SiCNodeSetItemsSelected(DWORD dwItems, DWORD *dwItemsSelected)
char *SiCNodeGetDescriptionLong(DWORD dwIndex, BOOL bIncludeInvisible); char *SiCNodeGetDescriptionLong(DWORD dwIndex, BOOL bIncludeInvisible);
siC *SiCNodeGetObject(DWORD dwIndex, BOOL bIncludeInvisibleObjs); siC *SiCNodeGetObject(DWORD dwIndex, BOOL bIncludeInvisibleObjs);
ULONGLONG SiCNodeGetInstallSize(DWORD dwIndex, BOOL bIncludeInvisible); ULONGLONG SiCNodeGetInstallSize(DWORD dwIndex, BOOL bIncludeInvisible);
ULONGLONG SiCNodeGetInstallSizeSystem(DWORD dwIndex, BOOL bIncludeInvisible);
ULONGLONG SiCNodeGetInstallSizeArchive(DWORD dwIndex, BOOL bIncludeInvisible);
void InitSiComponents(char *szFileIni); void InitSiComponents(char *szFileIni);
HRESULT ParseComponentAttributes(char *szBuf); HRESULT ParseComponentAttributes(char *szBuf);
void InitSiComponents(char *szFileIni); void InitSiComponents(char *szFileIni);
@ -108,6 +110,7 @@ BOOL IsWin95Debute(void);
ULONGLONG GetDiskSpaceRequired(DWORD dwType); ULONGLONG GetDiskSpaceRequired(DWORD dwType);
ULONGLONG GetDiskSpaceAvailable(LPSTR szPath); ULONGLONG GetDiskSpaceAvailable(LPSTR szPath);
HRESULT VerifyDiskSpace(void); HRESULT VerifyDiskSpace(void);
HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSRequired, LPSTR szPath, BOOL bCrutialMsg);
void SetCustomType(void); void SetCustomType(void);
void GetAlternateArchiveSearchPath(LPSTR lpszCmdLine); void GetAlternateArchiveSearchPath(LPSTR lpszCmdLine);
BOOL NeedReboot(void); BOOL NeedReboot(void);

Просмотреть файл

@ -18,6 +18,7 @@
# Rights Reserved. # Rights Reserved.
# #
# Contributor(s): # Contributor(s):
# Sean Su <ssu@netscape.com>
DEPTH=..\..\..\.. DEPTH=..\..\..\..

Просмотреть файл

@ -126,6 +126,7 @@ typedef int PRInt32;
/* DSR: Disk Space Required */ /* DSR: Disk Space Required */
#define DSR_DESTINATION 0 #define DSR_DESTINATION 0
#define DSR_SYSTEM 1 #define DSR_SYSTEM 1
#define DSR_TEMP 2
typedef HRESULT (_cdecl *SDI_NETINSTALL) (LPSDISTRUCT); typedef HRESULT (_cdecl *SDI_NETINSTALL) (LPSDISTRUCT);
@ -249,10 +250,11 @@ typedef struct sinfoSmartDownload
typedef struct sinfoCoreFile typedef struct sinfoCoreFile
{ {
LPSTR szSource; LPSTR szSource;
LPSTR szDestination; LPSTR szDestination;
BOOL bCleanup; LPSTR szMessage;
LPSTR szMessage; BOOL bCleanup;
ULONGLONG ullInstallSize;
} siCF; } siCF;
typedef struct sinfoComponentDep siCD; typedef struct sinfoComponentDep siCD;
@ -268,8 +270,10 @@ struct sinfoComponent
{ {
ULONGLONG ullInstallSize; ULONGLONG ullInstallSize;
ULONGLONG ullInstallSizeSystem; ULONGLONG ullInstallSizeSystem;
ULONGLONG ullInstallSizeArchive;
DWORD dwAttributes; DWORD dwAttributes;
LPSTR szArchiveName; LPSTR szArchiveName;
LPSTR szArchivePath;
LPSTR szDescriptionShort; LPSTR szDescriptionShort;
LPSTR szDescriptionLong; LPSTR szDescriptionLong;
LPSTR szParameter; LPSTR szParameter;

Просмотреть файл

@ -18,6 +18,7 @@
#define IDS_ERROR_DETERMINING_DISK_SPACE 14 #define IDS_ERROR_DETERMINING_DISK_SPACE 14
#define IDS_DLG_DISK_SPACE_CHECK_TITLE 15 #define IDS_DLG_DISK_SPACE_CHECK_TITLE 15
#define IDS_DLG_DISK_SPACE_CHECK_SYS_MSG 16 #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_DLG_DISK_SPACE_CHECK_MSG 17
#define IDS_ERROR_CREATE_DIRECTORY 18 #define IDS_ERROR_CREATE_DIRECTORY 18
#define IDS_STR_FILE_NUMBER 19 #define IDS_STR_FILE_NUMBER 19

Просмотреть файл

@ -321,10 +321,10 @@ END
STRINGTABLE DISCARDABLE STRINGTABLE DISCARDABLE
BEGIN BEGIN
IDS_DLG_DISK_SPACE_CHECK_SYS_MSG IDS_DLG_DISK_SPACE_CHECK_CRUTIAL_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." "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 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 IDS_ERROR_CREATE_DIRECTORY
"Could not create folder: %sMake sure you have access to create the folder." "Could not create folder: %sMake sure you have access to create the folder."
IDS_STR_FILE_NUMBER "File count:" IDS_STR_FILE_NUMBER "File count:"