Back to index

lightning-sunbird  0.9+nobinonly
Classes | Typedefs | Functions
supersede.h File Reference
#include "setup.h"
#include "version.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  structGreVer
struct  structGreInfo

Typedefs

typedef struct structGreVer
typedef struct structGreInfo

Functions

grever * CreateGVerNode (void)
BOOL ResolveSupersede (siC *siCObject, greInfo *gre)
void DeleteGverList (grever *gverHead)

Class Documentation

struct structGreVer

Definition at line 45 of file supersede.h.

Collaboration diagram for structGreVer:
Class Members
char greHomePath
char greInstaller
char greUserAgent
grever * next
verBlock version
struct structGreInfo

Definition at line 55 of file supersede.h.

Collaboration diagram for structGreInfo:
Class Members
grever * greInstalledList
grever * greSupersedeList
char homePath
char installerAppPath
verBlock maxVersion
verBlock minVersion
siC * siCGreComponent
char uninstallerAppPath
char userAgent

Typedef Documentation

typedef struct structGreInfo

Definition at line 54 of file supersede.h.

typedef struct structGreVer

Definition at line 44 of file supersede.h.


Function Documentation

grever* CreateGVerNode ( void  )

Definition at line 49 of file supersede.c.

{
  grever *gverNode;

  if((gverNode = NS_GlobalAlloc(sizeof(struct structGreVer))) == NULL)
    return(NULL);

  gverNode->greHomePath[0]         = '\0';
  gverNode->greInstaller[0]        = '\0';
  gverNode->greUserAgent[0]        = '\0';
  gverNode->version.ullMajor       = 0;
  gverNode->version.ullMinor       = 0;
  gverNode->version.ullRelease     = 0;
  gverNode->version.ullBuild       = 0;
  gverNode->next                   = NULL;
  return(gverNode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void DeleteGverList ( grever *  gverHead)

Definition at line 67 of file supersede.c.

{
  grever *tmp;

  while(gverHead != NULL)
  {
    tmp = gverHead;
    gverHead = gverHead->next;
    FreeMemory(&tmp);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL ResolveSupersede ( siC *  siCObject,
greInfo *  gre 
)

Definition at line 373 of file supersede.c.

{
  DWORD dwIndex;
  char  szFilePath[MAX_BUF];
  char  szSupersedeFile[MAX_BUF];
  char  szSupersedeVersion[MAX_BUF];
  char  szType[MAX_BUF_TINY];
  char  szKey[MAX_BUF_TINY];
  verBlock  vbVersionNew;
  verBlock  vbFileVersion;

  siCObject->bSupersede = FALSE;
  if(siCObject->dwAttributes & SIC_SUPERSEDE)
  {
    dwIndex = 0;
    GetConfigIniProfileString(siCObject->szReferenceName, "SupersedeType", "", szType, sizeof(szType));
    if(*szType !='\0')
    {
      if(lstrcmpi(szType, "File Exists") == 0)
      {
        wsprintf(szKey, "SupersedeFile%d", dwIndex);        
        GetConfigIniProfileString(siCObject->szReferenceName, szKey, "", szSupersedeFile, sizeof(szSupersedeFile));
        while(*szSupersedeFile != '\0')
        {
          DecryptString(szFilePath, szSupersedeFile);
          if(FileExists(szFilePath))
          {
            wsprintf(szKey, "SupersedeMinVersion%d",dwIndex);
            GetConfigIniProfileString(siCObject->szReferenceName, szKey, "", szSupersedeVersion, sizeof(szSupersedeVersion));
            if(*szSupersedeVersion != '\0')
            {
              if(GetFileVersion(szFilePath,&vbFileVersion))
              {
                /* 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(vbFileVersion,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, "SupersedeFile%d", ++dwIndex);        
          GetConfigIniProfileString(siCObject->szReferenceName, szKey, "", szSupersedeFile, sizeof(szSupersedeFile));
        }
      }
      else if(lstrcmpi(szType, "GRE") == 0)
      {
        /* save the GRE component */
        aGre->siCGreComponent = siCObject;

        /* If -fgre is passed in, and the current product to install is !GRE,
         * and the current component is 'Component GRE' then select and
         * disable it to force it to be installed regardless of supersede
         * rules.
         *
         * If the product is GRE, then it won't have a 'Component GRE', but
         * rather a 'Component XPCOM', in which case it will always get
         * installed */
        if((gbForceInstallGre) && (lstrcmpi(sgProduct.szProductNameInternal, "GRE") != 0))
        {
          siCObject->dwAttributes |= SIC_SELECTED;
          siCObject->dwAttributes |= SIC_DISABLED;
        }
        else
          ResolveSupersedeGre(siCObject, aGre);
      }
    }

    if(siCObject->bSupersede)
    {
      siCObject->dwAttributes &= ~SIC_SELECTED;
      siCObject->dwAttributes |= SIC_DISABLED;
      siCObject->dwAttributes |= SIC_INVISIBLE;
    }
    else
      /* Make sure to unset the DISABLED bit.  If the Setup Type is other than
       * Custom, then we don't care if it's DISABLED or not because this flag
       * is only used in the Custom dialogs.
       *
       * 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
       * SiCNodeSetItemsSelected() function that called ResolveSupersede(). */
      siCObject->dwAttributes &= ~SIC_DISABLED;
  }
  return(siCObject->bSupersede);
}

Here is the call graph for this function:

Here is the caller graph for this function: