BOOL LocateJar(siC *siCObject, LPSTR szPath, DWORD dwPathSize)
BOOL LocateJar(siC *siCObject, LPSTR szPath, DWORD dwPathSize, BOOL bIncludeTempDir)
BOOL LocateJar(siC *siCObject, LPSTR szPath, DWORD dwPathSize){  BOOL bRet;  char szBuf[MAX_BUF * 2];  char szSEADirTemp[MAX_BUF];  char szSetupDirTemp[MAX_BUF];  char szTempDirTemp[MAX_BUF];  char szArchiveLstFile[MAX_BUF];  char *szBufPtr;  int  iLen;  /* initialize default behavior */  bRet = FALSE;  if(szPath != NULL)    ZeroMemory(szPath, dwPathSize);  siCObject->dwAttributes |= SIC_DOWNLOAD_REQUIRED;  lstrcpy(szSEADirTemp, sgProduct.szAlternateArchiveSearchPath);  AppendBackSlash(szSEADirTemp, sizeof(szSEADirTemp));  lstrcat(szSEADirTemp, siCObject->szArchiveName);  /* XXX_QUICK_FIX    * checking sgProduct.szAlternateArchiveSearchPath for empty string   * should be done prior to AppendBackSlash() above.   * This is a quick fix for the time frame that we are currently in. */  if((*sgProduct.szAlternateArchiveSearchPath != '\0') && (FileExists(szSEADirTemp)))  {    /* jar file found.  Unset attribute to download from the net */    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;    /* save path where archive is located */    if(szPath != NULL)      lstrcpy(szPath, sgProduct.szAlternateArchiveSearchPath);  }  else  {    lstrcpy(szSetupDirTemp, szSetupDir);    lstrcpy(szTempDirTemp,  szTempDir);    AppendBackSlash(szSetupDirTemp, sizeof(szSetupDirTemp));    AppendBackSlash(szTempDirTemp, sizeof(szTempDirTemp));    if(lstrcmpi(szTempDirTemp, szSetupDirTemp) == 0)    {      /* check the temp dir for the .xpi file */      lstrcpy(szBuf, szTempDirTemp);      AppendBackSlash(szBuf, sizeof(szBuf));      lstrcat(szBuf, siCObject->szArchiveName);      if(FileExists(szBuf))      {#ifdef XXX_SSU        /* jar file found.  Unset attribute to download from the net */        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;#endif        /* if the archive name is in the archive.lst file, then it was uncompressed         * by the self extracting .exe file.  Assume that the .xpi file exists.         * This is a safe assumption because the self extracting.exe creates the         * archive.lst with what it uncompresses everytime it is run. */        lstrcpy(szArchiveLstFile, szTempDirTemp);        AppendBackSlash(szArchiveLstFile, sizeof(szArchiveLstFile));        lstrcat(szArchiveLstFile, "Archive.lst");        GetPrivateProfileString("Archives", NULL, "", szBuf, (MAX_BUF * 2), szArchiveLstFile);        if(*szBuf != '\0')        {          szBufPtr = szBuf;          while(*szBufPtr != '\0')          {            if(lstrcmpi(siCObject->szArchiveName, szBufPtr) == 0)            {              /* jar file found.  Unset attribute to download from the net */              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;              /* found what we're looking for.  No need to continue */              break;            }            iLen = lstrlen(szBufPtr);            szBufPtr += iLen +1;          }        }        /* save path where archive is located */        if(szPath != NULL)          lstrcpy(szPath, szTempDirTemp);      }    }    else    {      /* check the setup dir for the .xpi file */      lstrcpy(szBuf, szSetupDirTemp);      AppendBackSlash(szBuf, sizeof(szBuf));      lstrcat(szBuf, siCObject->szArchiveName);      if(FileExists(szBuf))      {        /* jar file found.  Unset attribute to download from the net */        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;        /* save path where archive is located */        if(szPath != NULL)          lstrcpy(szPath, szSetupDirTemp);      }      else      {        /* check the ns_temp dir for the .xpi file */        lstrcpy(szBuf, szTempDirTemp);        AppendBackSlash(szBuf, sizeof(szBuf));        lstrcat(szBuf, siCObject->szArchiveName);        if(FileExists(szBuf))        {#ifdef XXX_SSU          /* jar file found.  Unset attribute to download from the net */          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;#endif          /* save path where archive is located */          if(szPath != NULL)            lstrcpy(szPath, szTempDirTemp);        }      }    }  }  return(bRet);}