finish supersede functionality in windows installer
This commit is contained in:
dprice%netscape.com 2002-05-31 09:15:54 +00:00
Родитель 69cc7dd5f8
Коммит 55c9515c99
3 изменённых файлов: 49 добавлений и 29 удалений

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

@ -2970,7 +2970,7 @@ void SiCNodeSetItemsSelected(DWORD dwSetupType)
* selected the destination path for the product. The destination path is * selected the destination path for the product. The destination path is
* critical to the checking of the Force Upgrade. */ * critical to the checking of the Force Upgrade. */
ResolveForceUpgrade(siCNode); ResolveForceUpgrade(siCNode);
ResolveSupercede(siCNode); ResolveSupersede(siCNode);
siCNode = siCNode->Next; siCNode = siCNode->Next;
} while((siCNode != NULL) && (siCNode != siComponents)); } while((siCNode != NULL) && (siCNode != siComponents));
@ -3006,14 +3006,14 @@ void SiCNodeSetItemsSelected(DWORD 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).
* Don't select components that are superceded */ * Don't select components that are Superseded */
if(!siCNode->bSupercede) if(!siCNode->bSupersede)
siCNode->dwAttributes |= SIC_SELECTED; siCNode->dwAttributes |= SIC_SELECTED;
if(*szOverrideAttributes != '\0') if(*szOverrideAttributes != '\0')
siCNode->dwAttributes = ParseComponentAttributes(szOverrideAttributes, siCNode->dwAttributes, TRUE); siCNode->dwAttributes = ParseComponentAttributes(szOverrideAttributes, siCNode->dwAttributes, TRUE);
} }
else if(!(siCNode->dwAttributes & SIC_DISABLED) && !siCNode->bForceUpgrade && !siCNode->bSupercede) else if(!(siCNode->dwAttributes & SIC_DISABLED) && !siCNode->bForceUpgrade && !siCNode->bSupersede)
{ {
/* Custom setup type detected and the component is /* Custom setup type detected and the component is
* not DISABLED and FORCE_UPGRADE. Reset the component's * not DISABLED and FORCE_UPGRADE. Reset the component's
@ -3962,10 +3962,10 @@ HRESULT ParseComponentAttributes(char *szAttribute, DWORD dwAttributes, BOOL bOv
else if(strstr(szBuf, "ADDITIONAL")) else if(strstr(szBuf, "ADDITIONAL"))
dwAttributes |= SIC_ADDITIONAL; dwAttributes |= SIC_ADDITIONAL;
if(strstr(szBuf, "NOTSUPERCEDE")) if(strstr(szBuf, "NOTSUPERSEDE"))
dwAttributes &= ~SIC_SUPERCEDE; dwAttributes &= ~SIC_SUPERSEDE;
else if(strstr(szBuf, "SUPERCEDE")) else if(strstr(szBuf, "SUPERSEDE"))
dwAttributes |= SIC_SUPERCEDE; dwAttributes |= SIC_SUPERSEDE;
return(dwAttributes); return(dwAttributes);
@ -3998,42 +3998,62 @@ siC *SiCNodeFind(siC *siCHeadNode, char *szInReferenceName)
return(NULL); return(NULL);
} }
BOOL ResolveSupercede(siC *siCObject) BOOL ResolveSupersede(siC *siCObject)
{ {
DWORD dwIndex; DWORD dwIndex;
char szFilePath[MAX_BUF]; char szFilePath[MAX_BUF];
char szSupercedeFile[MAX_BUF]; char szSupersedeFile[MAX_BUF];
char szSupersedeVersion[MAX_BUF];
char szType[MAX_BUF_TINY]; char szType[MAX_BUF_TINY];
char szKey[MAX_BUF_TINY]; char szKey[MAX_BUF_TINY];
verBlock vbVersionNew;
verBlock vbVersionOld;
siCObject->bSupercede = FALSE; siCObject->bSupersede = FALSE;
if(siCObject->dwAttributes & SIC_SUPERCEDE) if(siCObject->dwAttributes & SIC_SUPERSEDE)
{ {
dwIndex = 0; dwIndex = 0;
GetPrivateProfileString(siCObject->szReferenceName, "SupercedeType", "", szType, sizeof(szType), szFileIniConfig); GetPrivateProfileString(siCObject->szReferenceName, "SupersedeType", "", szType, sizeof(szType), szFileIniConfig);
if(*szType !='\0') if(*szType !='\0')
{ {
if(lstrcmpi(szType, "File Exists") == 0) if(lstrcmpi(szType, "File Exists") == 0)
{ {
wsprintf(szKey, "SupercedeFile%d", dwIndex); wsprintf(szKey, "SupersedeFile%d", dwIndex);
GetPrivateProfileString(siCObject->szReferenceName, szKey, "", szSupercedeFile, sizeof(szSupercedeFile), szFileIniConfig); GetPrivateProfileString(siCObject->szReferenceName, szKey, "", szSupersedeFile, sizeof(szSupersedeFile), szFileIniConfig);
while(*szSupercedeFile != '\0') while(*szSupersedeFile != '\0')
{ {
DecryptString(szFilePath, szSupercedeFile); DecryptString(szFilePath, szSupersedeFile);
if(FileExists(szFilePath)) if(FileExists(szFilePath))
{ {
siCObject->bSupercede = TRUE; wsprintf(szKey, "SupersedeMinVersion%d",dwIndex);
GetPrivateProfileString(siCObject->szReferenceName, szKey, "", szSupersedeVersion, sizeof(szSupersedeVersion), szFileIniConfig);
/* Found at least one file, so break out of while loop */ if(*szSupersedeVersion != '\0')
break; {
if (GetFileVersion(szFilePath,&vbVersionOld))
{
/* If we can get the version, and it is greater than or equal to the SupersedeVersion
* set supersede. If we cannot get the version, do not supersede the file. */
TranslateVersionStr(szSupersedeVersion, &vbVersionNew);
if ( CompareVersion(vbVersionOld,vbVersionNew) >= 0)
{
siCObject->bSupersede = TRUE;
break; /* Found at least one file, so break out of while loop */
}
}
}
else
{ /* The file exists, and there's no version to check. set Supersede */
siCObject->bSupersede = TRUE;
break; /* Found at least one file, so break out of while loop */
}
} }
wsprintf(szKey, "SupercedeFile%d", ++dwIndex); wsprintf(szKey, "SupersedeFile%d", ++dwIndex);
GetPrivateProfileString(siCObject->szReferenceName, szKey, "", szSupercedeFile, sizeof(szSupercedeFile), szFileIniConfig); GetPrivateProfileString(siCObject->szReferenceName, szKey, "", szSupersedeFile, sizeof(szSupersedeFile), szFileIniConfig);
} }
} }
} }
if(siCObject->bSupercede) if(siCObject->bSupersede)
{ {
siCObject->dwAttributes &= ~SIC_SELECTED; siCObject->dwAttributes &= ~SIC_SELECTED;
siCObject->dwAttributes |= SIC_DISABLED; siCObject->dwAttributes |= SIC_DISABLED;
@ -4045,10 +4065,10 @@ BOOL ResolveSupercede(siC *siCObject)
* *
* 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
* via the config.ini, it's default value will be restored in the * via the config.ini, it's default value will be restored in the
* SiCNodeSetItemsSelected() function that called ResolveSupercede(). */ * SiCNodeSetItemsSelected() function that called ResolveSupersede(). */
siCObject->dwAttributes &= ~SIC_DISABLED; siCObject->dwAttributes &= ~SIC_DISABLED;
} }
return(siCObject->bSupercede); return(siCObject->bSupersede);
} }
BOOL ResolveForceUpgrade(siC *siCObject) BOOL ResolveForceUpgrade(siC *siCObject)

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

@ -191,7 +191,7 @@ int CRCCheckArchivesStartup(char *szCorruptedArchiveList,
DWORD dwCorruptedArchiveListSize, DWORD dwCorruptedArchiveListSize,
BOOL bIncludeTempPath); BOOL bIncludeTempPath);
BOOL ResolveForceUpgrade(siC *siCObject); BOOL ResolveForceUpgrade(siC *siCObject);
BOOL ResolveSupercede(siC *siCObject); BOOL ResolveSupersede(siC *siCObject);
void RestoreInvisibleFlag(siC *siCNode); void RestoreInvisibleFlag(siC *siCNode);
void RestoreAdditionalFlag(siC *siCNode); void RestoreAdditionalFlag(siC *siCNode);
void SwapFTPAndHTTP(char *szInUrl, DWORD dwInUrlSize); void SwapFTPAndHTTP(char *szInUrl, DWORD dwInUrlSize);

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

@ -196,7 +196,7 @@ typedef int PRInt32;
#define SIC_IGNORE_DOWNLOAD_ERROR 0x00000100 #define SIC_IGNORE_DOWNLOAD_ERROR 0x00000100
#define SIC_IGNORE_XPINSTALL_ERROR 0x00000200 #define SIC_IGNORE_XPINSTALL_ERROR 0x00000200
#define SIC_UNCOMPRESS 0x00000400 #define SIC_UNCOMPRESS 0x00000400
#define SIC_SUPERCEDE 0x00000800 #define SIC_SUPERSEDE 0x00000800
/* AC: Additional Components */ /* AC: Additional Components */
#define AC_NONE 0 #define AC_NONE 0
@ -448,7 +448,7 @@ struct sinfoComponent
LPSTR szParameter; LPSTR szParameter;
LPSTR szReferenceName; LPSTR szReferenceName;
BOOL bForceUpgrade; BOOL bForceUpgrade;
BOOL bSupercede; BOOL bSupersede;
int iNetRetries; int iNetRetries;
int iCRCRetries; int iCRCRetries;
int iNetTimeOuts; int iNetTimeOuts;