fixing bug #25410. The size shown under the custom install is now the

download size (size of archive), not installation size.

Also has code to help fix bug #21034.  Added code place holder to show the
new Additions dialog.

Fixed problem with not calculating disk space required properly.  It would
not take into account components that get installed outside the user
selected folder (such as the case with security module, which needs to be
installed in a centralized place).  This required the installer to be link
in nsreg_s.dll in order to tap into the Netscape registry to anticipate
where the modules might be installed at.

affects only windows.
This commit is contained in:
ssu%netscape.com 2000-01-29 23:39:47 +00:00
Родитель dfb2dec2df
Коммит 7da2097bff
6 изменённых файлов: 629 добавлений и 60 удалений

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

@ -571,25 +571,29 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara
{
dwSetupType = ST_RADIO0;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType0.dwItems, diSetupType.stSetupType0.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType0.dwCItems, diSetupType.stSetupType0.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType0.dwAItems, diSetupType.stSetupType0.dwAItemsSelected);
}
else if(IsDlgButtonChecked(hDlg, IDC_RADIO_ST1) == BST_CHECKED)
{
dwSetupType = ST_RADIO1;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType1.dwItems, diSetupType.stSetupType1.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType1.dwCItems, diSetupType.stSetupType1.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType1.dwAItems, diSetupType.stSetupType1.dwAItemsSelected);
}
else if(IsDlgButtonChecked(hDlg, IDC_RADIO_ST2) == BST_CHECKED)
{
dwSetupType = ST_RADIO2;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType2.dwItems, diSetupType.stSetupType2.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType2.dwCItems, diSetupType.stSetupType2.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType2.dwAItems, diSetupType.stSetupType2.dwAItemsSelected);
}
else if(IsDlgButtonChecked(hDlg, IDC_RADIO_ST3) == BST_CHECKED)
{
dwSetupType = ST_RADIO3;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType3.dwItems, diSetupType.stSetupType3.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType3.dwCItems, diSetupType.stSetupType3.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType3.dwAItems, diSetupType.stSetupType3.dwAItemsSelected);
}
/* set the next dialog to be shown depending on the
@ -821,6 +825,7 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON
if(GetClientRect(hDlg, &rDlg))
SetWindowPos(hDlg, HWND_TOP, (dwScreenX/2)-(rDlg.right/2), (dwScreenY/2)-(rDlg.bottom/2), 0, 0, SWP_NOSIZE);
#ifdef XXX_SSU
/* update the disk space available info in the dialog. GetDiskSpaceAvailable()
returns value in kbytes */
ullDSBuf = GetDiskSpaceAvailable(sgProduct.szPath);
@ -831,6 +836,7 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON
lstrcat(szBuf, tchBuffer);
lstrcat(szBuf, " K");
SetDlgItemText(hDlg, IDC_STATIC_DRIVE_SPACE_AVAILABLE, szBuf);
#endif
OldListBoxWndProc = SubclassWindow(hwndLBComponents, (WNDPROC)NewListBoxWndProc);
break;
@ -888,7 +894,7 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON
NULL);
siCTemp = SiCNodeGetObject(lpdis->itemID, FALSE);
_ui64toa(siCTemp->ullInstallSize, tchBuffer, 10);
_ui64toa(siCTemp->ullInstallSizeArchive, tchBuffer, 10);
lstrcat(tchBuffer, " K");
/* calculate clipping region. The region being the entire listbox window */
@ -932,13 +938,233 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON
/* update the disk space required info in the dialog. It is already
in Kilobytes */
ullDSBuf = GetDiskSpaceRequired(DSR_DESTINATION);
ullDSBuf = GetDiskSpaceRequired(DSR_DOWNLOAD_SIZE);
_ui64toa(ullDSBuf, tchBuffer, 10);
// ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), PP_ROOT_ONLY);
// RemoveBackSlash(szBuf);
// lstrcat(szBuf, " - ");
lstrcpy(szBuf, tchBuffer);
lstrcat(szBuf, " K");
SetDlgItemText(hDlg, IDC_STATIC_DRIVE_SPACE_REQUIRED, szBuf);
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_LIST_COMPONENTS:
/* to update the long description for each component the user selected */
if((dwIndex = SendMessage(hwndLBComponents, LB_GETCURSEL, 0, 0)) != LB_ERR)
SetDlgItemText(hDlg, IDC_STATIC_DESCRIPTION, SiCNodeGetDescriptionLong(dwIndex, FALSE));
break;
case ID_WIZNEXT:
dwItems = ListView_GetItemCount(hwndLBComponents);
dwArrayIndex = 0;
for(dwCurrentItem = 0; dwCurrentItem < dwItems; dwCurrentItem++)
{
if(ListView_GetCheckState(hwndLBComponents, dwCurrentItem))
{
dwItemsSelected[dwArrayIndex] = dwCurrentItem;
++dwArrayIndex;
}
}
SiCNodeSetItemsSelected(dwItems, dwItemsSelected);
DestroyWindow(hDlg);
PostMessage(hWndMain, WM_COMMAND, ID_WIZNEXT, 0);
break;
case ID_WIZBACK:
DestroyWindow(hDlg);
PostMessage(hWndMain, WM_COMMAND, ID_WIZBACK, 0);
break;
case IDCANCEL:
AskCancelDlg(hDlg);
break;
default:
break;
}
break;
}
return(bReturn);
}
LRESULT CALLBACK DlgProcSelectAdditions(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam)
{
BOOL bReturn = FALSE;
siC *siCTemp;
DWORD dwCurrentItem;
DWORD dwArrayIndex;
DWORD dwIndex;
DWORD dwItems = MAX_BUF;
DWORD dwItemsSelected[MAX_BUF];
HWND hwndLBComponents;
RECT rDlg;
RECT rLBComponentSize;
RECT rListBox;
TCHAR tchBuffer[MAX_BUF];
TEXTMETRIC tm;
DWORD y;
HDC hdcComponentSize;
LPDRAWITEMSTRUCT lpdis;
RECT rTemp;
ULONGLONG ullDSBuf;
char szBuf[MAX_BUF];
hwndLBComponents = GetDlgItem(hDlg, IDC_LIST_COMPONENTS);
switch(msg)
{
case WM_INITDIALOG:
SetWindowText(hDlg, diSelectComponents.szTitle);
siCTemp = siComponents;
if(siCTemp != NULL)
{
if(!(siCTemp->dwAttributes & SIC_INVISIBLE))
lbAddItem(hwndLBComponents, siCTemp);
siCTemp = siCTemp->Next;
while((siCTemp != siComponents) && (siCTemp != NULL))
{
if(!(siCTemp->dwAttributes & SIC_INVISIBLE))
lbAddItem(hwndLBComponents, siCTemp);
siCTemp = siCTemp->Next;
}
SetFocus(hwndLBComponents);
SendMessage(hwndLBComponents, LB_SETCURSEL, 0, 0);
SetDlgItemText(hDlg, IDC_STATIC_DESCRIPTION, SiCNodeGetDescriptionLong(0, FALSE));
}
if(GetClientRect(hDlg, &rDlg))
SetWindowPos(hDlg, HWND_TOP, (dwScreenX/2)-(rDlg.right/2), (dwScreenY/2)-(rDlg.bottom/2), 0, 0, SWP_NOSIZE);
#ifdef XXX_SSU
/* update the disk space available info in the dialog. GetDiskSpaceAvailable()
returns value in kbytes */
ullDSBuf = GetDiskSpaceAvailable(sgProduct.szPath);
_ui64toa(ullDSBuf, tchBuffer, 10);
ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), PP_ROOT_ONLY);
RemoveBackSlash(szBuf);
lstrcat(szBuf, " - ");
lstrcat(szBuf, tchBuffer);
lstrcat(szBuf, " K");
SetDlgItemText(hDlg, IDC_STATIC_DRIVE_SPACE_AVAILABLE, szBuf);
#endif
OldListBoxWndProc = SubclassWindow(hwndLBComponents, (WNDPROC)NewListBoxWndProc);
break;
case WM_DRAWITEM:
lpdis = (LPDRAWITEMSTRUCT)lParam;
// If there are no list box items, skip this message.
if(lpdis->itemID == -1)
break;
SendMessage(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID, (LPARAM)tchBuffer);
GetClientRect(lpdis->hwndItem, &rTemp);
hdcComponentSize = GetDC(lpdis->hwndItem);
SelectObject(hdcComponentSize, GetCurrentObject(lpdis->hDC, OBJ_FONT));
if((lpdis->itemAction & ODA_FOCUS) && (lpdis->itemState & ODS_SELECTED))
{
// remove the focus rect on the previous selected item
DrawFocusRect(lpdis->hDC, &(lpdis->rcItem));
}
if(lpdis->itemAction & ODA_FOCUS)
{
if((lpdis->itemState & ODS_SELECTED) &&
!(lpdis->itemState & ODS_FOCUS))
{
SetTextColor(lpdis->hDC, GetSysColor(COLOR_WINDOWTEXT));
SetBkColor(lpdis->hDC, GetSysColor(COLOR_WINDOW));
SetTextColor(hdcComponentSize, GetSysColor(COLOR_WINDOWTEXT));
SetBkColor(hdcComponentSize, GetSysColor(COLOR_WINDOW));
}
else
{
SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT));
SetTextColor(hdcComponentSize, GetSysColor(COLOR_HIGHLIGHTTEXT));
SetBkColor(hdcComponentSize, GetSysColor(COLOR_HIGHLIGHT));
}
}
if(lpdis->itemAction & (ODA_DRAWENTIRE | ODA_FOCUS))
{
// Display the text associated with the item.
GetTextMetrics(lpdis->hDC, &tm);
y = (lpdis->rcItem.bottom + lpdis->rcItem.top - tm.tmHeight) / 2;
ExtTextOut(lpdis->hDC,
CX_CHECKBOX + 5,
y,
ETO_OPAQUE | ETO_CLIPPED,
&(lpdis->rcItem),
tchBuffer,
strlen(tchBuffer),
NULL);
siCTemp = SiCNodeGetObject(lpdis->itemID, FALSE);
_ui64toa(siCTemp->ullInstallSizeArchive, tchBuffer, 10);
lstrcat(tchBuffer, " K");
/* calculate clipping region. The region being the entire listbox window */
GetClientRect(hwndLBComponents, &rListBox);
if(lpdis->rcItem.bottom > rListBox.bottom)
rLBComponentSize.bottom = rListBox.bottom - 1;
else
rLBComponentSize.bottom = lpdis->rcItem.bottom - 1;
rLBComponentSize.left = lpdis->rcItem.right - 50;
rLBComponentSize.right = lpdis->rcItem.right;
if(lpdis->rcItem.top < rListBox.top)
rLBComponentSize.top = rListBox.top + 1;
else
rLBComponentSize.top = lpdis->rcItem.top + 1;
/* set text alignment */
SetTextAlign(hdcComponentSize, TA_RIGHT);
/* output string */
ExtTextOut(hdcComponentSize,
lpdis->rcItem.right - 3,
y,
ETO_OPAQUE | ETO_CLIPPED,
&(rLBComponentSize),
tchBuffer,
strlen(tchBuffer),
NULL);
}
DrawCheck(lpdis);
// draw the focus rect on the selected item
if((lpdis->itemAction & ODA_FOCUS) &&
(lpdis->itemState & ODS_FOCUS))
{
DrawFocusRect(lpdis->hDC, &(lpdis->rcItem));
}
ReleaseDC(lpdis->hwndItem, hdcComponentSize);
bReturn = TRUE;
/* update the disk space required info in the dialog. It is already
in Kilobytes */
ullDSBuf = GetDiskSpaceRequired(DSR_DOWNLOAD_SIZE);
_ui64toa(ullDSBuf, tchBuffer, 10);
// ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), PP_ROOT_ONLY);
// RemoveBackSlash(szBuf);
// lstrcat(szBuf, " - ");
lstrcpy(szBuf, tchBuffer);
lstrcat(szBuf, " K");
SetDlgItemText(hDlg, IDC_STATIC_DRIVE_SPACE_REQUIRED, szBuf);
break;
@ -1414,6 +1640,7 @@ void DlgSequenceNext()
InstantiateDialog(dwWizardState, diLicense.szTitle, DlgProcLicense);
else
PostMessage(hWndMain, WM_COMMAND, ID_WIZNEXT, 0);
break;
case DLG_LICENSE:

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

@ -931,10 +931,14 @@ HRESULT InitDlgSetupType(diST *diDialog)
if((diDialog->szReadmeApp = NS_GlobalAlloc(MAX_BUF)) == NULL)
return(1);
diDialog->stSetupType0.dwItems = 0;
diDialog->stSetupType1.dwItems = 0;
diDialog->stSetupType2.dwItems = 0;
diDialog->stSetupType3.dwItems = 0;
diDialog->stSetupType0.dwCItems = 0;
diDialog->stSetupType1.dwCItems = 0;
diDialog->stSetupType2.dwCItems = 0;
diDialog->stSetupType3.dwCItems = 0;
diDialog->stSetupType0.dwAItems = 0;
diDialog->stSetupType1.dwAItems = 0;
diDialog->stSetupType2.dwAItems = 0;
diDialog->stSetupType3.dwAItems = 0;
if((diDialog->stSetupType0.szDescriptionShort = NS_GlobalAlloc(MAX_BUF)) == NULL)
return(1);
if((diDialog->stSetupType0.szDescriptionLong = NS_GlobalAlloc(MAX_BUF)) == NULL)
@ -1217,6 +1221,8 @@ siC *CreateSiCNode()
exit(1);
if((siCNode->szArchivePath = NS_GlobalAlloc(MAX_BUF)) == NULL)
exit(1);
if((siCNode->szDestinationPath = 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)
@ -1258,6 +1264,7 @@ void SiCNodeDelete(siC *siCTemp)
siCTemp->Next = NULL;
siCTemp->Prev = NULL;
FreeMemory(&(siCTemp->szDestinationPath));
FreeMemory(&(siCTemp->szArchivePath));
FreeMemory(&(siCTemp->szArchiveName));
FreeMemory(&(siCTemp->szDescriptionLong));
@ -1628,6 +1635,54 @@ siC *SiCNodeGetObject(DWORD dwIndex, BOOL bIncludeInvisibleObjs)
return(NULL);
}
dsN *CreateDSNode()
{
dsN *dsNode;
if((dsNode = NS_GlobalAlloc(sizeof(struct diskSpaceNode))) == NULL)
exit(1);
dsNode->ullSpaceRequired = 0;
if((dsNode->szPath = NS_GlobalAlloc(MAX_BUF)) == NULL)
exit(1);
dsNode->Next = dsNode;
dsNode->Prev = dsNode;
return(dsNode);
}
void DsNodeInsert(dsN **dsNHead, dsN *dsNTemp)
{
if(*dsNHead == NULL)
{
*dsNHead = dsNTemp;
(*dsNHead)->Next = *dsNHead;
(*dsNHead)->Prev = *dsNHead;
}
else
{
dsNTemp->Next = *dsNHead;
dsNTemp->Prev = (*dsNHead)->Prev;
(*dsNHead)->Prev->Next = dsNTemp;
(*dsNHead)->Prev = dsNTemp;
}
}
void DsNodeDelete(dsN **dsNTemp)
{
if(*dsNTemp != NULL)
{
(*dsNTemp)->Next->Prev = (*dsNTemp)->Prev;
(*dsNTemp)->Prev->Next = (*dsNTemp)->Next;
(*dsNTemp)->Next = NULL;
(*dsNTemp)->Prev = NULL;
FreeMemory(&((*dsNTemp)->szPath));
FreeMemory(dsNTemp);
}
}
BOOL IsWin95Debute()
{
HINSTANCE hLib;
@ -1668,7 +1723,8 @@ ULONGLONG GetDiskSpaceRequired(DWORD dwType)
break;
case DSR_TEMP:
if(LocateJar(siCTemp) == FALSE)
case DSR_DOWNLOAD_SIZE:
if((LocateJar(siCTemp) == FALSE) || (dwType == DSR_DOWNLOAD_SIZE))
ullTotalSize += siCTemp->ullInstallSizeArchive;
break;
}
@ -1690,7 +1746,8 @@ ULONGLONG GetDiskSpaceRequired(DWORD dwType)
break;
case DSR_TEMP:
if(LocateJar(siCTemp) == FALSE)
case DSR_DOWNLOAD_SIZE:
if((LocateJar(siCTemp) == FALSE) || (dwType == DSR_DOWNLOAD_SIZE))
ullTotalSize += siCTemp->ullInstallSizeArchive;
break;
}
@ -1809,8 +1866,105 @@ HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSRequired, LPS
return(MessageBox(hWndMain, szBufMsg, szDlgDiskSpaceCheckTitle, dwDlgType | MB_ICONEXCLAMATION | MB_DEFBUTTON2 | MB_APPLMODAL | MB_SETFOREGROUND));
}
void UpdatePathDiskSpaceRequired(LPSTR szPath, ULONGLONG ullSize, dsN **dsnComponentDSRequirement)
{
BOOL bFound = FALSE;
dsN *dsnTemp = *dsnComponentDSRequirement;
if(ullSize > 0)
{
do
{
if(*dsnComponentDSRequirement == NULL)
{
*dsnComponentDSRequirement = CreateDSNode();
dsnTemp = *dsnComponentDSRequirement;
strcpy(dsnTemp->szPath, szPath);
dsnTemp->ullSpaceRequired = ullSize;
bFound = TRUE;
}
else if(lstrcmpi(dsnTemp->szPath, szPath) == 0)
{
dsnTemp->ullSpaceRequired += ullSize;
bFound = TRUE;
}
else
dsnTemp = dsnTemp->Next;
} while((dsnTemp != *dsnComponentDSRequirement) && (dsnTemp != NULL) && (bFound == FALSE));
if(bFound == FALSE)
{
dsnTemp = CreateDSNode();
strcpy(dsnTemp->szPath, szPath);
dsnTemp->ullSpaceRequired = ullSize;
DsNodeInsert(dsnComponentDSRequirement, dsnTemp);
}
}
}
HRESULT InitComponentDiskSpaceInfo(dsN **dsnComponentDSRequirement)
{
DWORD dwIndex0;
siC *siCObject = NULL;
HRESULT hResult = 0;
char szBuf[MAX_BUF];
char szIndex0[MAX_BUF];
char szSysPath[MAX_BUF];
char szBufSysPath[MAX_BUF];
char szBufTempPath[MAX_BUF];
if(GetSystemDirectory(szSysPath, MAX_BUF) == 0)
{
ZeroMemory(szSysPath, MAX_BUF);
ZeroMemory(szBufSysPath, MAX_BUF);
}
else
{
ParsePath(szSysPath, szBufSysPath, sizeof(szBufSysPath), PP_ROOT_ONLY);
AppendBackSlash(szBufSysPath, sizeof(szBufSysPath));
}
ParsePath(szTempDir, szBufTempPath, sizeof(szBufTempPath), PP_ROOT_ONLY);
AppendBackSlash(szBufTempPath, sizeof(szBufTempPath));
dwIndex0 = 0;
itoa(dwIndex0, szIndex0, 10);
siCObject = SiCNodeGetObject(dwIndex0, TRUE);
while(siCObject)
{
if(siCObject->dwAttributes & SIC_SELECTED)
{
if(*(siCObject->szDestinationPath) == '\0')
ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), PP_ROOT_ONLY);
else
ParsePath(siCObject->szDestinationPath, szBuf, sizeof(szBuf), PP_ROOT_ONLY);
AppendBackSlash(szBuf, sizeof(szBuf));
UpdatePathDiskSpaceRequired(szBuf, siCObject->ullInstallSize, dsnComponentDSRequirement);
if(*szBufSysPath != '\0')
UpdatePathDiskSpaceRequired(szBufSysPath, siCObject->ullInstallSizeSystem, dsnComponentDSRequirement);
if(*szBufTempPath != '\0')
UpdatePathDiskSpaceRequired(szBufTempPath, siCObject->ullInstallSizeArchive, dsnComponentDSRequirement);
}
++dwIndex0;
itoa(dwIndex0, szIndex0, 10);
siCObject = SiCNodeGetObject(dwIndex0, TRUE);
}
/* take the uncompressed size of core into account */
if(*szBufTempPath != '\0')
UpdatePathDiskSpaceRequired(szBufTempPath, siCFCoreFile.ullInstallSize, dsnComponentDSRequirement);
return(hResult);
}
HRESULT VerifyDiskSpace()
{
#ifdef XXX_SSU
ULONGLONG ullDSAPath;
ULONGLONG ullDSRPath;
ULONGLONG ullDSASysPath;
@ -1819,12 +1973,42 @@ HRESULT VerifyDiskSpace()
ULONGLONG ullDSRTempPath;
ULONGLONG ullDSTotalAvailable;
ULONGLONG ullDSTotalRequired;
HRESULT hRetValue = TRUE;
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;
dsN *dsnTemp = NULL;
InitComponentDiskSpaceInfo(&dsnComponentDSRequirement);
if(dsnComponentDSRequirement != NULL)
{
dsnTemp = dsnComponentDSRequirement;
do
{
if(dsnTemp != NULL)
{
ullDSAvailable = GetDiskSpaceAvailable(dsnTemp->szPath);
if(ullDSAvailable < dsnTemp->ullSpaceRequired)
{
hRetValue = ErrorMsgDiskSpace(ullDSAvailable, dsnTemp->ullSpaceRequired, dsnTemp->szPath, FALSE);
break;
}
dsnTemp = dsnTemp->Next;
}
} while((dsnTemp != dsnComponentDSRequirement) && (dsnTemp != NULL));
}
DeInitDSNode(&dsnComponentDSRequirement);
#ifdef XXX_SSU
/* Calculate disk space for destination path */
ullDSAPath = GetDiskSpaceAvailable(sgProduct.szPath);
ullDSRPath = GetDiskSpaceRequired(DSR_DESTINATION);
@ -1927,8 +2111,9 @@ HRESULT VerifyDiskSpace()
}
}
}
#endif
return(FALSE);
return(hRetValue);
}
HRESULT ParseComponentAttributes(char *szAttribute)
@ -1958,6 +2143,7 @@ void InitSiComponents(char *szFileIni)
char szBuf[MAX_BUF];
char szComponentItem[MAX_BUF];
char szDependency[MAX_BUF];
char szDPSection[MAX_BUF];
siC *siCTemp;
siCD *siCDepTemp;
@ -2035,6 +2221,12 @@ void InitSiComponents(char *szFileIni)
GetPrivateProfileString(szComponentItem, szDependency, "", szBuf, MAX_BUF, szFileIni);
}
// locate previous path if necessary
lstrcpy(szDPSection, szComponentItem);
lstrcat(szDPSection, "-Destination Path");
if(LocatePreviousPath(szDPSection, siCTemp->szDestinationPath, MAX_PATH) == FALSE)
ZeroMemory(siCTemp->szDestinationPath, MAX_PATH);
/* inserts the newly created component into the global component queue */
SiCNodeInsert(&siComponents, siCTemp);
@ -2157,6 +2349,32 @@ void DeInitSiComponents()
SiCNodeDelete(siCTemp);
}
void DeInitDSNode(dsN **dsnComponentDSRequirement)
{
dsN *dsNTemp;
if(*dsnComponentDSRequirement == NULL)
{
return;
}
else if(((*dsnComponentDSRequirement)->Prev == NULL) || ((*dsnComponentDSRequirement)->Prev == *dsnComponentDSRequirement))
{
DsNodeDelete(dsnComponentDSRequirement);
return;
}
else
{
dsNTemp = (*dsnComponentDSRequirement)->Prev;
}
while(dsNTemp != *dsnComponentDSRequirement)
{
DsNodeDelete(&dsNTemp);
dsNTemp = (*dsnComponentDSRequirement)->Prev;
}
DsNodeDelete(&dsNTemp);
}
BOOL ResolveComponentDependency(siCD *siCDInDependency)
{
int dwIndex;
@ -2311,7 +2529,7 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine)
GetPrivateProfileString("General", "Product Name", "", sgProduct.szProductName, MAX_BUF, szFileIniConfig);
/* get main install path */
if(LocatePreviousPath(sgProduct.szPath, MAX_PATH) == FALSE)
if(LocatePreviousPath("Locate Previous Product Path", sgProduct.szPath, MAX_PATH) == FALSE)
{
GetPrivateProfileString("General", "Path", "", szBuf, MAX_BUF, szFileIniConfig);
DecryptString(sgProduct.szPath, szBuf);
@ -2478,25 +2696,29 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine)
{
dwSetupType = ST_RADIO0;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType0.dwItems, diSetupType.stSetupType0.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType0.dwCItems, diSetupType.stSetupType0.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType0.dwAItems, diSetupType.stSetupType0.dwAItemsSelected);
}
else if((lstrcmpi(szBuf, "Setup Type 1") == 0) && diSetupType.stSetupType1.bVisible)
{
dwSetupType = ST_RADIO1;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType1.dwItems, diSetupType.stSetupType1.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType1.dwCItems, diSetupType.stSetupType1.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType1.dwAItems, diSetupType.stSetupType1.dwAItemsSelected);
}
else if((lstrcmpi(szBuf, "Setup Type 2") == 0) && diSetupType.stSetupType2.bVisible)
{
dwSetupType = ST_RADIO2;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType2.dwItems, diSetupType.stSetupType2.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType2.dwCItems, diSetupType.stSetupType2.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType2.dwAItems, diSetupType.stSetupType2.dwAItemsSelected);
}
else if((lstrcmpi(szBuf, "Setup Type 3") == 0) && diSetupType.stSetupType3.bVisible)
{
dwSetupType = ST_RADIO3;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType3.dwItems, diSetupType.stSetupType3.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType3.dwCItems, diSetupType.stSetupType3.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType3.dwAItems, diSetupType.stSetupType3.dwAItemsSelected);
}
else
{
@ -2504,25 +2726,29 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine)
{
dwSetupType = ST_RADIO0;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType0.dwItems, diSetupType.stSetupType0.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType0.dwCItems, diSetupType.stSetupType0.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType0.dwAItems, diSetupType.stSetupType0.dwAItemsSelected);
}
else if(diSetupType.stSetupType1.bVisible)
{
dwSetupType = ST_RADIO1;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType1.dwItems, diSetupType.stSetupType1.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType1.dwCItems, diSetupType.stSetupType1.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType1.dwAItems, diSetupType.stSetupType1.dwAItemsSelected);
}
else if(diSetupType.stSetupType2.bVisible)
{
dwSetupType = ST_RADIO2;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType2.dwItems, diSetupType.stSetupType2.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType2.dwCItems, diSetupType.stSetupType2.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType2.dwAItems, diSetupType.stSetupType2.dwAItemsSelected);
}
else if(diSetupType.stSetupType3.bVisible)
{
dwSetupType = ST_RADIO3;
dwTempSetupType = dwSetupType;
SiCNodeSetItemsSelected(diSetupType.stSetupType3.dwItems, diSetupType.stSetupType3.dwItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType3.dwCItems, diSetupType.stSetupType3.dwCItemsSelected);
SiCNodeSetItemsSelected(diSetupType.stSetupType3.dwAItems, diSetupType.stSetupType3.dwAItemsSelected);
}
}
@ -2567,11 +2793,77 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine)
return(0);
}
BOOL LocatePreviousPath(LPSTR szPath, DWORD dwPathSize)
BOOL LocatePreviousPath(LPSTR szMainSectionName, LPSTR szPath, DWORD dwPathSize)
{
DWORD dwIndex;
char szIndex[MAX_BUF];
char szSection[MAX_BUF];
char szValue[MAX_BUF];
BOOL bFound;
bFound = FALSE;
dwIndex = -1;
while(!bFound)
{
++dwIndex;
itoa(dwIndex, szIndex, 10);
lstrcpy(szSection, szMainSectionName);
lstrcat(szSection, szIndex);
GetPrivateProfileString(szSection, "Key", "", szValue, MAX_BUF, szFileIniConfig);
if(*szValue != '\0')
bFound = LocatePathNscpReg(szSection, szPath, dwPathSize);
else
{
GetPrivateProfileString(szSection, "HKey", "", szValue, MAX_BUF, szFileIniConfig);
if(*szValue != '\0')
bFound = LocatePathWinReg(szSection, szPath, dwPathSize);
else
{
GetPrivateProfileString(szSection, "Path", "", szValue, MAX_BUF, szFileIniConfig);
if(*szValue != '\0')
bFound = LocatePath(szSection, szPath, dwPathSize);
else
break;
}
}
}
return(bFound);
}
BOOL LocatePathNscpReg(LPSTR szSection, LPSTR szPath, DWORD dwPathSize)
{
char szKey[MAX_BUF];
char szContainsFilename[MAX_BUF];
char szBuf[MAX_BUF];
BOOL bReturn;
bReturn = FALSE;
GetPrivateProfileString(szSection, "Key", "", szKey, MAX_BUF, szFileIniConfig);
if(*szKey != '\0')
{
bReturn = FALSE;
ZeroMemory(szPath, dwPathSize);
VR_GetPath(szKey, MAX_BUF, szBuf);
if(*szBuf != '\0')
{
GetPrivateProfileString(szSection, "Contains Filename", "", szContainsFilename, MAX_BUF, szFileIniConfig);
if(lstrcmpi(szContainsFilename, "TRUE") == 0)
ParsePath(szBuf, szPath, dwPathSize, PP_PATH_ONLY);
else
lstrcpy(szPath, szBuf);
bReturn = TRUE;
}
}
return(bReturn);
}
BOOL LocatePathWinReg(LPSTR szSection, LPSTR szPath, DWORD dwPathSize)
{
char szHKey[MAX_BUF];
char szHRoot[MAX_BUF];
char szName[MAX_BUF];
@ -2583,12 +2875,8 @@ BOOL LocatePreviousPath(LPSTR szPath, DWORD dwPathSize)
HKEY hkeyRoot;
bReturn = FALSE;
dwIndex = 0;
itoa(dwIndex, szIndex, 10);
lstrcpy(szSection, "Locate Previous Product Path");
lstrcat(szSection, szIndex);
GetPrivateProfileString(szSection, "HKey", "", szHKey, MAX_BUF, szFileIniConfig);
while(*szHKey != '\0')
if(*szHKey != '\0')
{
bReturn = FALSE;
ZeroMemory(szPath, dwPathSize);
@ -2603,10 +2891,10 @@ BOOL LocatePreviousPath(LPSTR szPath, DWORD dwPathSize)
bDecryptKey = TRUE;
GetPrivateProfileString(szSection, "Contains Filename", "", szBuf, MAX_BUF, szFileIniConfig);
if(lstrcmpi(szBuf, "FALSE") == 0)
bContainsFilename = FALSE;
else
if(lstrcmpi(szBuf, "TRUE") == 0)
bContainsFilename = TRUE;
else
bContainsFilename = FALSE;
if(lstrcmpi(szHRoot, "HKEY_CLASSES_ROOT") == 0)
hkeyRoot = HKEY_CLASSES_ROOT;
@ -2663,17 +2951,26 @@ BOOL LocatePreviousPath(LPSTR szPath, DWORD dwPathSize)
bReturn = TRUE;
}
// break if a valid path was found, else keep looking
if(bReturn == TRUE)
break;
}
}
++dwIndex;
itoa(dwIndex, szIndex, 10);
lstrcpy(szSection, "Locate Previous Product Path");
lstrcat(szSection, szIndex);
GetPrivateProfileString(szSection, "HKey", "", szHKey, MAX_BUF, szFileIniConfig);
return(bReturn);
}
BOOL LocatePath(LPSTR szSection, LPSTR szPath, DWORD dwPathSize)
{
char szPathKey[MAX_BUF];
BOOL bReturn;
bReturn = FALSE;
GetPrivateProfileString(szSection, "Path", "", szPathKey, MAX_BUF, szFileIniConfig);
if(*szPathKey != '\0')
{
bReturn = FALSE;
ZeroMemory(szPath, dwPathSize);
DecryptString(szPath, szPathKey);
bReturn = TRUE;
}
return(bReturn);
@ -2704,17 +3001,18 @@ void STGetComponents(LPSTR szSection, st *stSetupType, LPSTR szFileIniConfig)
stSetupType->bVisible = TRUE;
dwIndex = 0;
stSetupType->dwItems = 0;
stSetupType->dwCItems = 0;
itoa(dwIndex, szIndex, 10);
lstrcpy(szKey, "C");
lstrcat(szKey, szIndex);
GetPrivateProfileString(szSection, szKey, "", szBuf, MAX_BUF, szFileIniConfig);
while(*szBuf != '\0')
{
/* hack used to determine the numerical value of the component */
if(lstrlen(szBuf) > 8)
{
++stSetupType->dwItems;
stSetupType->dwItemsSelected[dwIndex] = atoi(&szBuf[9]);
++stSetupType->dwCItems;
stSetupType->dwCItemsSelected[dwIndex] = atoi(&szBuf[9]);
}
++dwIndex;
@ -2723,6 +3021,28 @@ void STGetComponents(LPSTR szSection, st *stSetupType, LPSTR szFileIniConfig)
lstrcat(szKey, szIndex);
GetPrivateProfileString(szSection, szKey, "", szBuf, MAX_BUF, szFileIniConfig);
}
dwIndex = 0;
stSetupType->dwAItems = 0;
itoa(dwIndex, szIndex, 10);
lstrcpy(szKey, "A");
lstrcat(szKey, szIndex);
GetPrivateProfileString(szSection, szKey, "", szBuf, MAX_BUF, szFileIniConfig);
while(*szBuf != '\0')
{
/* hack used to determine the numerical value of the component */
if(lstrlen(szBuf) > 8)
{
++stSetupType->dwAItems;
stSetupType->dwAItemsSelected[dwIndex] = atoi(&szBuf[9]);
}
++dwIndex;
itoa(dwIndex, szIndex, 10);
lstrcpy(szKey, "A");
lstrcat(szKey, szIndex);
GetPrivateProfileString(szSection, szKey, "", szBuf, MAX_BUF, szFileIniConfig);
}
}
void GetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, LPSTR szReturnValue, DWORD dwSize)

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

@ -25,6 +25,15 @@
#ifndef _EXTRA_H_
#define _EXTRA_H_
typedef struct diskSpaceNode dsN;
struct diskSpaceNode
{
ULONGLONG ullSpaceRequired;
LPSTR szPath;
dsN *Next;
dsN *Prev;
};
BOOL InitApplication(HINSTANCE hInstance, HINSTANCE hSetupRscInst);
BOOL InitInstance(HINSTANCE hInstance, DWORD dwCmdShow);
void PrintError(LPSTR szMsg, DWORD dwErrorCodeSH);
@ -114,7 +123,17 @@ HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSReq
void SetCustomType(void);
void GetAlternateArchiveSearchPath(LPSTR lpszCmdLine);
BOOL NeedReboot(void);
BOOL LocatePreviousPath(LPSTR szPath, DWORD dwPathSize);
BOOL LocatePreviousPath(LPSTR szMainSectionName, LPSTR szPath, DWORD dwPathSize);
BOOL LocatePathNscpReg(LPSTR szSection, LPSTR szPath, DWORD dwPathSize);
BOOL LocatePathWinReg(LPSTR szSection, LPSTR szPath, DWORD dwPathSize);
BOOL LocatePath(LPSTR szSection, LPSTR szPath, DWORD dwPathSize);
int VR_GetPath(char *component_path, unsigned long sizebuf, char *buf);
dsN *CreateDSNode();
void DsNodeInsert(dsN **dsNHead, dsN *dsNTemp);
void DsNodeDelete(dsN **dsNTemp);
void DeInitDSNode(dsN **dsnComponentDSRequirement);
void UpdatePathDiskSpaceRequired(LPSTR szPath, ULONGLONG ullInstallSize, dsN **dsnComponentDSRequirement);
HRESULT InitComponentDiskSpaceInfo(dsN **dsnComponentDSRequirement);
BOOL bSDInit;

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

@ -39,6 +39,7 @@ OBJS = \
$(NULL)
LLIBS= \
$(DIST)\lib\nsreg_s.lib \
$(DIST)\lib\jar_s.lib \
$(DIST)\lib\zlib_s.lib \
$(NULL)

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

@ -127,6 +127,7 @@ typedef int PRInt32;
#define DSR_DESTINATION 0
#define DSR_SYSTEM 1
#define DSR_TEMP 2
#define DSR_DOWNLOAD_SIZE 3
typedef HRESULT (_cdecl *SDI_NETINSTALL) (LPSDISTRUCT);
@ -158,8 +159,10 @@ typedef struct dlgLicense
typedef struct stStruct
{
BOOL bVisible;
DWORD dwItems;
DWORD dwItemsSelected[MAX_BUF];
DWORD dwCItems;
DWORD dwCItemsSelected[MAX_BUF];
DWORD dwAItems;
DWORD dwAItemsSelected[MAX_BUF];
LPSTR szDescriptionShort;
LPSTR szDescriptionLong;
} st;
@ -279,6 +282,7 @@ struct sinfoComponent
DWORD dwAttributes;
LPSTR szArchiveName;
LPSTR szArchivePath;
LPSTR szDestinationPath;
LPSTR szDescriptionShort;
LPSTR szDescriptionLong;
LPSTR szParameter;

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

@ -69,7 +69,7 @@ END
DLG_SETUP_TYPE DIALOGEX 51, 56, 315, 205
STYLE WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Sans Serif"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "",IDC_RADIO_ST0,"Button",BS_AUTORADIOBUTTON |
WS_TABSTOP,102,31,65,8
@ -97,32 +97,30 @@ END
DLG_SELECT_COMPONENTS DIALOGEX 51, 56, 315, 205
STYLE WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Sans Serif", 0, 0, 0x1
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "< &Back",ID_WIZBACK,134,186,53,12
DEFPUSHBUTTON "&Next >",ID_WIZNEXT,188,186,53,12
PUSHBUTTON "&Cancel",IDCANCEL,252,186,53,12
LTEXT "Select the components you want to install, clear the components you do not want to install. ",
IDC_STATIC,101,10,204,19,NOT WS_GROUP
LTEXT "C&omponents",IDC_STATIC,101,32,204,8
GROUPBOX "Description",IDC_STATIC,101,112,204,22
LTEXT "Component Description",IDC_STATIC_DESCRIPTION,106,121,
LTEXT "C&omponents",IDC_STATIC,101,32,103,8
GROUPBOX "Description",IDC_STATIC,101,124,204,22
LTEXT "Component Description",IDC_STATIC_DESCRIPTION,106,133,
195,8
GROUPBOX "&Disk space information",IDC_STATIC,101,140,204,33
LTEXT "Space Required on",IDC_STATIC,106,150,94,8,NOT WS_GROUP
LTEXT "DRIVE",IDC_STATIC_DRIVE_SPACE_REQUIRED,106,160,94,8,NOT
GROUPBOX "&Disk space information",IDC_STATIC,101,150,204,23
LTEXT "Total download size:",IDC_STATIC,106,160,91,8,NOT
WS_GROUP
LTEXT "Space Available on",IDC_STATIC,207,150,94,8,NOT
RTEXT "",IDC_STATIC_DRIVE_SPACE_REQUIRED,206,160,94,8,NOT
WS_GROUP
LTEXT "DRIVE",IDC_STATIC_DRIVE_SPACE_AVAILABLE,207,160,94,8,
NOT WS_GROUP
CONTROL 108,IDC_STATIC,"Static",SS_BITMAP,11,11,80,160,
WS_EX_CLIENTEDGE
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,11,179,295,1,
WS_EX_STATICEDGE
LISTBOX IDC_LIST_COMPONENTS,101,42,204,64,LBS_OWNERDRAWFIXED |
LISTBOX IDC_LIST_COMPONENTS,101,42,204,78,LBS_OWNERDRAWFIXED |
LBS_HASSTRINGS | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_HSCROLL | WS_GROUP | WS_TABSTOP
LTEXT "Download Size",IDC_STATIC,201,32,103,8,0,WS_EX_RIGHT
END
DLG_WINDOWS_INTEGRATION DIALOGEX 51, 56, 315, 205
@ -325,7 +323,7 @@ BEGIN
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 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."
"Setup has detected insufficient disk space to continue with installation process 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:"