Supports overriding certain component default attributes for different

Setup Types.  This especially allows us to have different components displayed
in the Additional Components dialog for different Setup Types.
  (Bug 122607, r=ssu, sr=dveditz, a=asa)
This commit is contained in:
curt%netscape.com 2002-03-27 05:24:26 +00:00
Родитель 79cf58115f
Коммит 31a197ad21
4 изменённых файлов: 69 добавлений и 73 удалений

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

@ -780,11 +780,6 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara
dwTempSetupType = dwSetupType; dwTempSetupType = dwSetupType;
} }
/* set the next dialog to be shown depending on the
what the user selected */
dwWizardState = DLG_SETUP_TYPE;
CheckWizardStateCustom(DLG_ADVANCED_SETTINGS);
DestroyWindow(hDlg); DestroyWindow(hDlg);
DlgSequenceNext(); DlgSequenceNext();
break; break;
@ -1512,8 +1507,6 @@ LRESULT CALLBACK DlgProcWindowsIntegration(HWND hDlg, UINT msg, WPARAM wParam, L
case IDWIZBACK: case IDWIZBACK:
dwWizardState = DLG_WINDOWS_INTEGRATION; dwWizardState = DLG_WINDOWS_INTEGRATION;
CheckWizardStateCustom(DLG_SETUP_TYPE);
DestroyWindow(hDlg); DestroyWindow(hDlg);
DlgSequencePrev(); DlgSequencePrev();
break; break;
@ -2576,17 +2569,6 @@ HWND InstantiateDialog(HWND hParent, DWORD dwDlgID, LPSTR szTitle, WNDPROC wpDlg
return(hDlg); return(hDlg);
} }
BOOL CheckWizardStateCustom(DWORD dwDefault)
{
if(sgProduct.dwCustomType != dwSetupType)
{
dwWizardState = dwDefault;
return(FALSE);
}
return(TRUE);
}
/* /*
* Check to see if turbo is enabled. If so, do the following: * Check to see if turbo is enabled. If so, do the following:
* * Log the turbo status that use had chosen. * * Log the turbo status that use had chosen.
@ -2666,16 +2648,13 @@ void DlgSequenceNext()
hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSetupType.szTitle, DlgProcSetupType); hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSetupType.szTitle, DlgProcSetupType);
bDone = TRUE; bDone = TRUE;
} }
else
{
CheckWizardStateCustom(DLG_ADVANCED_SETTINGS);
}
break; break;
case DLG_SETUP_TYPE: case DLG_SETUP_TYPE:
dwWizardState = DLG_SELECT_COMPONENTS; dwWizardState = DLG_SELECT_COMPONENTS;
gbProcessingXpnstallFiles = FALSE; gbProcessingXpnstallFiles = FALSE;
if(diSelectComponents.bShowDialog) if((diSelectComponents.bShowDialog) && (sgProduct.dwCustomType == dwSetupType))
{ {
hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSelectComponents.szTitle, DlgProcSelectComponents); hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSelectComponents.szTitle, DlgProcSelectComponents);
bDone = TRUE; bDone = TRUE;
@ -2705,7 +2684,7 @@ void DlgSequenceNext()
case DLG_WINDOWS_INTEGRATION: case DLG_WINDOWS_INTEGRATION:
dwWizardState = DLG_PROGRAM_FOLDER; dwWizardState = DLG_PROGRAM_FOLDER;
gbProcessingXpnstallFiles = FALSE; gbProcessingXpnstallFiles = FALSE;
if(diProgramFolder.bShowDialog) if(diProgramFolder.bShowDialog && (sgProduct.dwCustomType == dwSetupType))
{ {
hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diProgramFolder.szTitle, DlgProcProgramFolder); hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diProgramFolder.szTitle, DlgProcProgramFolder);
bDone = TRUE; bDone = TRUE;
@ -2984,14 +2963,11 @@ void DlgSequencePrev()
case DLG_QUICK_LAUNCH: case DLG_QUICK_LAUNCH:
dwWizardState = DLG_PROGRAM_FOLDER; dwWizardState = DLG_PROGRAM_FOLDER;
gbProcessingXpnstallFiles = FALSE; gbProcessingXpnstallFiles = FALSE;
if(CheckWizardStateCustom(DLG_SELECT_COMPONENTS)) if(diProgramFolder.bShowDialog && (sgProduct.dwCustomType == dwSetupType))
{
if(diProgramFolder.bShowDialog)
{ {
hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diProgramFolder.szTitle, DlgProcProgramFolder); hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diProgramFolder.szTitle, DlgProcProgramFolder);
bDone = TRUE; bDone = TRUE;
} }
}
break; break;
case DLG_PROGRAM_FOLDER: case DLG_PROGRAM_FOLDER:
@ -3017,7 +2993,7 @@ void DlgSequencePrev()
case DLG_SELECT_ADDITIONAL_COMPONENTS: case DLG_SELECT_ADDITIONAL_COMPONENTS:
dwWizardState = DLG_SELECT_COMPONENTS; dwWizardState = DLG_SELECT_COMPONENTS;
gbProcessingXpnstallFiles = FALSE; gbProcessingXpnstallFiles = FALSE;
if(diSelectComponents.bShowDialog) if(diSelectComponents.bShowDialog && (sgProduct.dwCustomType == dwSetupType))
{ {
hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSelectComponents.szTitle, DlgProcSelectComponents); hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSelectComponents.szTitle, DlgProcSelectComponents);
bDone = TRUE; bDone = TRUE;

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

@ -56,7 +56,6 @@ void ShowMessage(LPSTR szMessage, BOOL bShow);
void DrawCheck(LPDRAWITEMSTRUCT lpdis, DWORD dwACFlag); void DrawCheck(LPDRAWITEMSTRUCT lpdis, DWORD dwACFlag);
void InvalidateLBCheckbox(HWND hwndListBox); void InvalidateLBCheckbox(HWND hwndListBox);
void ProcessWindowsMessages(void); void ProcessWindowsMessages(void);
BOOL CheckWizardStateCustom(DWORD dwDefault);
LPSTR GetStartInstallMessage(void); LPSTR GetStartInstallMessage(void);
void AppendStringWOAmpersand(LPSTR szInputString, DWORD dwInputStringSize, LPSTR szString); void AppendStringWOAmpersand(LPSTR szInputString, DWORD dwInputStringSize, LPSTR szString);
void TruncateString(HWND hWnd, LPSTR szInPath, LPSTR szOutPath, DWORD dwOutPathBufSize); void TruncateString(HWND hWnd, LPSTR szInPath, LPSTR szOutPath, DWORD dwOutPathBufSize);

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

@ -2893,21 +2893,27 @@ BOOL IsInList(DWORD dwCurrentItem, DWORD dwItems, DWORD *dwItemsSelected)
return(FALSE); return(FALSE);
} }
// This function:
// - Zeros the SELECTED and ADDITIONAL attributes of all components.
// - Set all attributes as specified for the specific Setup Type
// - Overrides attributes designated in any [Component XXX-Overwrite-Setup TypeX]
// sections for the specific Setup Type.
void SiCNodeSetItemsSelected(DWORD dwSetupType) void SiCNodeSetItemsSelected(DWORD dwSetupType)
{ {
siC *siCNode; siC *siCNode;
char szBuf[MAX_BUF]; char szBuf[MAX_BUF];
char szIndex0[MAX_BUF];
char szSTSection[MAX_BUF]; char szSTSection[MAX_BUF];
char szComponentKey[MAX_BUF]; char szComponentKey[MAX_BUF];
char szComponentSection[MAX_BUF]; char szComponentSection[MAX_BUF];
char szOverrideSection[MAX_BUF];
char szOverrideAttributes[MAX_BUF];
DWORD dwIndex0; DWORD dwIndex0;
lstrcpy(szSTSection, "Setup Type"); lstrcpy(szSTSection, "Setup Type");
itoa(dwSetupType, szBuf, 10); itoa(dwSetupType, szBuf, 10);
lstrcat(szSTSection, szBuf); lstrcat(szSTSection, szBuf);
/* for each component in the global list, unset its SELECTED attribute */ // For each component in the global list unset its SELECTED and ADDITIONAL attributes
siCNode = siComponents; siCNode = siComponents;
do do
{ {
@ -2915,6 +2921,7 @@ void SiCNodeSetItemsSelected(DWORD dwSetupType)
break; break;
siCNode->dwAttributes &= ~SIC_SELECTED; siCNode->dwAttributes &= ~SIC_SELECTED;
siCNode->dwAttributes &= ~SIC_ADDITIONAL;
/* Force Upgrade needs to be performed here because the user has just /* Force Upgrade needs to be performed here because the user has just
* selected the destination path for the product. The destination path is * selected the destination path for the product. The destination path is
@ -2923,27 +2930,36 @@ void SiCNodeSetItemsSelected(DWORD dwSetupType)
siCNode = siCNode->Next; siCNode = siCNode->Next;
} while((siCNode != NULL) && (siCNode != siComponents)); } while((siCNode != NULL) && (siCNode != siComponents));
/* for each component in a setup type, set its attribute to be SELECTED */ /* for each component in a setup type, set its ATTRIBUTES to the right values */
dwIndex0 = 0; dwIndex0 = 0;
itoa(dwIndex0, szIndex0, 10); wsprintf(szComponentKey, "C%d", dwIndex0);
lstrcpy(szComponentKey, "C");
lstrcat(szComponentKey, szIndex0);
GetPrivateProfileString(szSTSection, szComponentKey, "", szComponentSection, sizeof(szComponentSection), szFileIniConfig); GetPrivateProfileString(szSTSection, szComponentKey, "", szComponentSection, sizeof(szComponentSection), szFileIniConfig);
while(*szComponentSection != '\0') while(*szComponentSection != '\0')
{ {
if((siCNode = SiCNodeFind(siComponents, szComponentSection)) != NULL) if((siCNode = SiCNodeFind(siComponents, szComponentSection)) != NULL)
{ {
wsprintf(szOverrideSection, "%s-Override-%s", siCNode->szReferenceName, szSTSection);
GetPrivateProfileString(szOverrideSection, "Attributes", "", szOverrideAttributes, sizeof(szOverrideAttributes), szFileIniConfig);
if((siCNode->lRandomInstallPercentage != 0) && if((siCNode->lRandomInstallPercentage != 0) &&
(siCNode->lRandomInstallPercentage <= siCNode->lRandomInstallValue) && (siCNode->lRandomInstallPercentage <= siCNode->lRandomInstallValue) &&
!(siCNode->dwAttributes & SIC_DISABLED)) !(siCNode->dwAttributes & SIC_DISABLED))
{
/* Random Install Percentage check passed *and* the component /* Random Install Percentage check passed *and* the component
* is not DISABLED */ * is not DISABLED */
if(*szOverrideAttributes != '\0')
siCNode->dwAttributes = ParseComponentAttributes(szOverrideAttributes, siCNode->dwAttributes, TRUE);
siCNode->dwAttributes &= ~SIC_SELECTED; siCNode->dwAttributes &= ~SIC_SELECTED;
}
else if(sgProduct.dwCustomType != dwSetupType) else if(sgProduct.dwCustomType != dwSetupType)
{
/* Setup Type other than custom detected, so /* Setup Type other than custom detected, so
* make sure all components from this Setup Type * make sure all components from this Setup Type
* is selected (regardless if it's DISABLED or not). */ * is selected (regardless if it's DISABLED or not). */
siCNode->dwAttributes |= SIC_SELECTED; siCNode->dwAttributes |= SIC_SELECTED;
if(*szOverrideAttributes != '\0')
siCNode->dwAttributes = ParseComponentAttributes(szOverrideAttributes, siCNode->dwAttributes, TRUE);
}
else if(!(siCNode->dwAttributes & SIC_DISABLED) && !siCNode->bForceUpgrade) else if(!(siCNode->dwAttributes & SIC_DISABLED) && !siCNode->bForceUpgrade)
{ {
/* Custom setup type detected and the component is /* Custom setup type detected and the component is
@ -2954,14 +2970,14 @@ void SiCNodeSetItemsSelected(DWORD dwSetupType)
* Dialogs as not selected and DISABLED. Not sure why we * Dialogs as not selected and DISABLED. Not sure why we
* want this, but marketing might find it useful someday. */ * want this, but marketing might find it useful someday. */
GetPrivateProfileString(siCNode->szReferenceName, "Attributes", "", szBuf, sizeof(szBuf), szFileIniConfig); GetPrivateProfileString(siCNode->szReferenceName, "Attributes", "", szBuf, sizeof(szBuf), szFileIniConfig);
siCNode->dwAttributes = ParseComponentAttributes(szBuf); siCNode->dwAttributes = ParseComponentAttributes(szBuf, 0, FALSE);
if(*szOverrideAttributes != '\0')
siCNode->dwAttributes = ParseComponentAttributes(szOverrideAttributes, siCNode->dwAttributes, TRUE);
} }
} }
++dwIndex0; ++dwIndex0;
itoa(dwIndex0, szIndex0, 10); wsprintf(szComponentKey, "C%d", dwIndex0);
lstrcpy(szComponentKey, "C");
lstrcat(szComponentKey, szIndex0);
GetPrivateProfileString(szSTSection, szComponentKey, "", szComponentSection, sizeof(szComponentSection), szFileIniConfig); GetPrivateProfileString(szSTSection, szComponentKey, "", szComponentSection, sizeof(szComponentSection), szFileIniConfig);
} }
} }
@ -3849,43 +3865,48 @@ DWORD ParseOSType(char *szOSType)
return(dwOSType); return(dwOSType);
} }
HRESULT ParseComponentAttributes(char *szAttribute) HRESULT ParseComponentAttributes(char *szAttribute, DWORD dwAttributes, BOOL bOverride)
{ {
char szBuf[MAX_BUF]; char szBuf[MAX_BUF];
DWORD dwAttributes = 0;
lstrcpy(szBuf, szAttribute); lstrcpy(szBuf, szAttribute);
strupr(szBuf); strupr(szBuf);
if(strstr(szBuf, "SELECTED") && !strstr(szBuf, "UNSELECTED")) if(bOverride != TRUE)
/* Check for SELECTED attribute only. Since strstr will also return a {
* SELECTED attribute for UNSELECTED, we need to make sure it's not the if(strstr(szBuf, "LAUNCHAPP"))
* UNSELECTED attribute. dwAttributes |= SIC_LAUNCHAPP;
* if(strstr(szBuf, "DOWNLOAD_ONLY"))
* Even though we're already checking for the UNSELECTED attribute dwAttributes |= SIC_DOWNLOAD_ONLY;
* later on in this function, we're trying not to be order dependent. if(strstr(szBuf, "FORCE_UPGRADE"))
*/ dwAttributes |= SIC_FORCE_UPGRADE;
dwAttributes |= SIC_SELECTED; if(strstr(szBuf, "IGNORE_DOWNLOAD_ERROR"))
if(strstr(szBuf, "INVISIBLE")) dwAttributes |= SIC_IGNORE_DOWNLOAD_ERROR;
dwAttributes |= SIC_INVISIBLE; if(strstr(szBuf, "IGNORE_XPINSTALL_ERROR"))
if(strstr(szBuf, "LAUNCHAPP")) dwAttributes |= SIC_IGNORE_XPINSTALL_ERROR;
dwAttributes |= SIC_LAUNCHAPP; if(strstr(szBuf, "UNCOMPRESS"))
if(strstr(szBuf, "DOWNLOAD_ONLY")) dwAttributes |= SIC_UNCOMPRESS;
dwAttributes |= SIC_DOWNLOAD_ONLY; }
if(strstr(szBuf, "ADDITIONAL"))
dwAttributes |= SIC_ADDITIONAL;
if(strstr(szBuf, "DISABLED"))
dwAttributes |= SIC_DISABLED;
if(strstr(szBuf, "UNSELECTED")) if(strstr(szBuf, "UNSELECTED"))
dwAttributes &= ~SIC_SELECTED; dwAttributes &= ~SIC_SELECTED;
if(strstr(szBuf, "FORCE_UPGRADE")) else if(strstr(szBuf, "SELECTED"))
dwAttributes |= SIC_FORCE_UPGRADE; dwAttributes |= SIC_SELECTED;
if(strstr(szBuf, "IGNORE_DOWNLOAD_ERROR"))
dwAttributes |= SIC_IGNORE_DOWNLOAD_ERROR; if(strstr(szBuf, "INVISIBLE"))
if(strstr(szBuf, "IGNORE_XPINSTALL_ERROR")) dwAttributes |= SIC_INVISIBLE;
dwAttributes |= SIC_IGNORE_XPINSTALL_ERROR; else if(strstr(szBuf, "VISIBLE"))
if(strstr(szBuf, "UNCOMPRESS")) dwAttributes &= ~SIC_INVISIBLE;
dwAttributes |= SIC_UNCOMPRESS;
if(strstr(szBuf, "DISABLED"))
dwAttributes |= SIC_DISABLED;
if(strstr(szBuf, "ENABLED"))
dwAttributes &= ~SIC_DISABLED;
if(strstr(szBuf, "NOTADDITIONAL"))
dwAttributes &= ~SIC_ADDITIONAL;
else if(strstr(szBuf, "ADDITIONAL"))
dwAttributes |= SIC_ADDITIONAL;
return(dwAttributes); return(dwAttributes);
} }
@ -3952,7 +3973,7 @@ BOOL ResolveForceUpgrade(siC *siCObject)
} }
else else
/* Make sure to unset the DISABLED bit. If the Setup Type is other than /* Make sure to unset the DISABLED bit. If the Setup Type is other than
* Cutsom, then we don't care if it's DISABLED or not because this flag * Custom, then we don't care if it's DISABLED or not because this flag
* is only used in the Custom dialogs. * is only used in the Custom dialogs.
* *
* If the Setup Type is Custom and this component is DISABLED by default * If the Setup Type is Custom and this component is DISABLED by default
@ -4056,7 +4077,7 @@ void InitSiComponents(char *szFileIni)
/* get attributes of component */ /* get attributes of component */
GetPrivateProfileString(szComponentSection, "Attributes", "", szBuf, sizeof(szBuf), szFileIni); GetPrivateProfileString(szComponentSection, "Attributes", "", szBuf, sizeof(szBuf), szFileIni);
siCTemp->dwAttributes = ParseComponentAttributes(szBuf); siCTemp->dwAttributes = ParseComponentAttributes(szBuf, 0, FALSE);
/* get the random percentage value and select or deselect the component (by default) for /* get the random percentage value and select or deselect the component (by default) for
* installation */ * installation */
@ -4156,7 +4177,7 @@ void ResetComponentAttributes(char *szFileIni)
siCTemp = SiCNodeGetObject(dwCounter, TRUE, AC_ALL); siCTemp = SiCNodeGetObject(dwCounter, TRUE, AC_ALL);
GetPrivateProfileString(szComponentItem, "Attributes", "", szBuf, sizeof(szBuf), szFileIni); GetPrivateProfileString(szComponentItem, "Attributes", "", szBuf, sizeof(szBuf), szFileIni);
siCTemp->dwAttributes = ParseComponentAttributes(szBuf); siCTemp->dwAttributes = ParseComponentAttributes(szBuf, 0, FALSE);
} }
} }

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

@ -73,7 +73,7 @@ ULONGLONG SiCNodeGetInstallSizeSystem(DWORD dwIndex, BOOL bIncludeInvisi
ULONGLONG SiCNodeGetInstallSizeArchive(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag); ULONGLONG SiCNodeGetInstallSizeArchive(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag);
siC *SiCNodeFind(siC *siComponents, char *szInReferenceName); siC *SiCNodeFind(siC *siComponents, char *szInReferenceName);
void InitSiComponents(char *szFileIni); void InitSiComponents(char *szFileIni);
HRESULT ParseComponentAttributes(char *szBuf); HRESULT ParseComponentAttributes(char *szBuf, DWORD dwAttributes, BOOL bOverride);
void InitSiteSelector(char *szFileIni); void InitSiteSelector(char *szFileIni);
void DeInitSiCDependencies(siCD *siCDDependencies); void DeInitSiCDependencies(siCD *siCDDependencies);
BOOL ResolveDependencies(DWORD dwIndex); BOOL ResolveDependencies(DWORD dwIndex);