Back to index

lightning-sunbird  0.9+nobinonly
Functions
ifuncns.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

HRESULT TimingCheck (DWORD dwTiming, LPSTR szSection, LPSTR szFile)
HRESULT FileUncompress (LPSTR szFrom, LPSTR szTo)
HRESULT ProcessXpcomFile (void)
HRESULT CleanupXpcomFile (void)
HRESULT ProcessUncompressFile (DWORD dwTiming, char *szSectionPrefix)
HRESULT FileMove (LPSTR szFrom, LPSTR szTo)
HRESULT ProcessMoveFile (DWORD dwTiming, char *szSectionPrefix)
HRESULT FileCopy (LPSTR szFrom, LPSTR szTo, BOOL bFailIfExists, BOOL bDnu)
HRESULT ProcessCopyFile (DWORD dwTiming, char *szSectionPrefix)
HRESULT ProcessCreateDirectory (DWORD dwTiming, char *szSectionPrefix)
HRESULT ProcessCreateCustomFiles (DWORD dwTiming)
HRESULT FileDelete (LPSTR szDestination)
HRESULT ProcessDeleteFile (DWORD dwTiming, char *szSectionPrefix)
HRESULT DirectoryRemove (LPSTR szDestination, BOOL bRemoveSubdirs)
HRESULT ProcessRemoveDirectory (DWORD dwTiming, char *szSectionPrefix)
HRESULT ProcessRunApp (DWORD dwTiming, char *szSectionPrefix)
HRESULT ProcessOS2INI (ULONG ulTiming, char *szSectionPrefix)
HRESULT CreateALink (LPSTR lpszPathObj, LPSTR lpszPathLink, LPSTR lpszDesc, LPSTR lpszWorkingPath, LPSTR lpszArgs, LPSTR lpszIconFullPath, int iIcon)
HRESULT ProcessProgramFolder (DWORD dwTiming, char *szSectionPrefix)
HRESULT ProcessProgramFolderShowCmd (void)
HRESULT CreateDirectoriesAll (char *szPath, BOOL bLogForUninstall)
void ProcessFileOps (DWORD dwTiming, char *szSectionPrefix)
HRESULT FileCopySequential (LPSTR szSourcePath, LPSTR szDestPath, LPSTR szFilename)
HRESULT ProcessCopyFileSequential (DWORD dwTiming, char *szSectionPrefix)
void UpdateInstallLog (PSZ szKey, PSZ szString, BOOL bDnu)
void UpdateInstallStatusLog (PSZ szString)
void UpdateJSProxyInfo (void)
int VerifyArchive (LPSTR szArchive)
HRESULT ProcessSetVersionRegistry (DWORD dwTiming, char *szSectionPrefix)
char * BuildNumberedString (DWORD dwIndex, char *szInputStringPrefix, char *szInputString, char *szOutBuf, DWORD dwOutBufSize)
void GetUserAgentShort (char *szUserAgent, char *szOutUAShort, DWORD dwOutUAShortSize)
void CleanupPreviousVersionINIKeys (void)
HRESULT CleanupArgsRegistry ()
void ProcessFileOpsForSelectedComponents (DWORD dwTiming)
void ProcessFileOpsForAll (DWORD dwTiming)

Function Documentation

char* BuildNumberedString ( DWORD  dwIndex,
char *  szInputStringPrefix,
char *  szInputString,
char *  szOutBuf,
DWORD  dwOutBufSize 
)

Definition at line 156 of file ifuncns.c.

{
  if((szInputStringPrefix) && (*szInputStringPrefix != '\0'))
    wsprintf(szOutBuf, "%s-%s%d", szInputStringPrefix, szInputString, dwIndex);
  else
    wsprintf(szOutBuf, "%s%d", szInputString, dwIndex);

  return(szOutBuf);
}

Definition at line 561 of file ifuncns.c.

Definition at line 145 of file ifuncns.c.

{
  char  szIndex[MAX_BUF];
  char  szSection[MAX_BUF];
  char  szValue[MAX_BUF];
  char  szPath[MAX_BUF];
  char  szBuf[MAX_BUF];
  char  szDecrypt[MAX_BUF];
  char  szMainSectionName[] = "Cleanup Previous Product INIApps";
  char  szApp[MAX_BUF];
  char  szKey[MAX_BUF];
  char  szDirKey[MAX_BUF];
  char  szCleanupProduct[MAX_BUF];
  char  szCurrentVersion[MAX_BUF_TINY];
  char  szUserAgent[MAX_BUF];
  char  szIni[MAX_BUF];
  BOOL  bFound;
  ULONG ulAppsLength, ulIndex;
  CHAR* szApps;
  HINI  hini = HINI_USERPROFILE;

  strcpy(szPath, sgProduct.szPath);
  if(*sgProduct.szSubPath != '\0')
  {
    AppendBackSlash(szPath, sizeof(szPath));
    strcat(szPath, sgProduct.szSubPath);
  }
  AppendBackSlash(szPath, sizeof(szPath));

  bFound  = FALSE;
  ulIndex = -1;
  while(!bFound)
  {
    ++ulIndex;
    itoa(ulIndex, szIndex, 10);
    strcpy(szSection, szMainSectionName);
    strcat(szSection, szIndex);

    GetPrivateProfileString(szSection, "Product Name", "", szValue, sizeof(szValue), szFileIniConfig);
    if(*szValue != '\0') {
      GetPrivateProfileString(szSection, "Product Name", "", szCleanupProduct, sizeof(szCleanupProduct), szFileIniConfig);
      GetPrivateProfileString(szSection, "Current Version", "", szCurrentVersion, sizeof(szCurrentVersion), szFileIniConfig);

      GetPrivateProfileString(szSection, "Key",                "", szBuf,           sizeof(szBuf),           szFileIniConfig);
      GetPrivateProfileString(szSection, "Decrypt Key",        "", szDecrypt,       sizeof(szDecrypt),       szFileIniConfig);
      memset(szKey, 0, sizeof(szKey));
      if(stricmp(szDecrypt, "TRUE") == 0)
        DecryptString(szDirKey, szBuf);
      else
        strcpy(szDirKey, szBuf);

      sprintf(szUserAgent, "%s %s", szCleanupProduct, szCurrentVersion);

      PrfQueryProfileSize(HINI_USERPROFILE, NULL, NULL, &ulAppsLength);
      szApps = (char*)malloc(ulAppsLength+1);
      PrfQueryProfileString(HINI_USERPROFILE, NULL, NULL, NULL, szApps, ulAppsLength);
      szApps[ulAppsLength] = '\0';
      while (*szApps) {
        if (strncmp(szApps, szCleanupProduct, strlen(szCleanupProduct)) == 0) {
          if (strncmp(szApps, szUserAgent, strlen(szUserAgent)) != 0) {
            char szKey[MAX_BUF];
            PrfQueryProfileString(HINI_USERPROFILE, szApps, szDirKey, "", szKey, MAX_BUF);
            if (szKey[0]) {
              AppendBackSlash(szKey, sizeof(szKey));
              if (stricmp(szKey, szPath) == 0) {
                PrfWriteProfileString(HINI_USER, szApps, NULL, NULL);
              }
            }
          }
        }
        szApps = strchr(szApps, '\0')+1;
      }
    } else {
      GetPrivateProfileString(szSection, "App", "", szValue, sizeof(szValue), szFileIniConfig);
      if(*szValue != '\0') {
        GetPrivateProfileString(szSection, "App",                 "", szBuf,           sizeof(szBuf),          szFileIniConfig);
        GetPrivateProfileString(szSection, "Decrypt App",         "", szDecrypt,       sizeof(szDecrypt),      szFileIniConfig);
        memset(szApp, 0, sizeof(szApp));
        if(stricmp(szDecrypt, "TRUE") == 0)
          DecryptString(szApp, szBuf);
        else
          strcpy(szApp, szBuf);
  
        GetPrivateProfileString(szSection, "Key",                "", szBuf,           sizeof(szBuf),           szFileIniConfig);
        GetPrivateProfileString(szSection, "Decrypt Key",        "", szDecrypt,       sizeof(szDecrypt),       szFileIniConfig);
        memset(szDirKey, 0, sizeof(szKey));
        if(stricmp(szDecrypt, "TRUE") == 0)
          DecryptString(szDirKey, szBuf);
        else
          strcpy(szDirKey, szBuf);
  
        GetPrivateProfileString(szSection, "INI", "", szIni,  sizeof(szIni),  szFileIniConfig);
        if (szIni[0]) {
          BOOL bDecryptINI;
          GetPrivateProfileString(szSection, "Decrypt INI", "", szBuf,   sizeof(szBuf),   szFileIniConfig);
          if(stricmp(szBuf, "FALSE")) {
            DecryptString(szBuf, szIni);
            strcpy(szIni, szBuf);
          }
          hini = PrfOpenProfile((HAB)0, szIni);
        }
  
        PrfQueryProfileString(hini, szApp, szDirKey, "", szKey, MAX_BUF);
        if (szKey[0]) {
          AppendBackSlash(szKey, sizeof(szKey));
          if (stricmp(szKey, szPath) == 0) {
            PrfWriteProfileString(hini, szApp, NULL, NULL);
          }
        }
        if (szIni[0]) {
          PrfCloseProfile(hini);
        }
      }
      else
      {
        break;
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 546 of file ifuncns.c.

{
  /* If xpcom file is not used (gre is used instead), then
   * just return */
  if(siCFXpcomFile.bStatus != STATUS_ENABLED)
    return;

  if(siCFXpcomFile.bCleanup == TRUE)
    DirectoryRemove(siCFXpcomFile.szDestination, TRUE);

  return;
}
HRESULT CreateALink ( LPSTR  lpszPathObj,
LPSTR  lpszPathLink,
LPSTR  lpszDesc,
LPSTR  lpszWorkingPath,
LPSTR  lpszArgs,
LPSTR  lpszIconFullPath,
int  iIcon 
)

Definition at line 54 of file shortcut.cpp.

{ 
    HRESULT    hres; 
    IShellLink *psl;
    char       lpszFullPath[MAX_BUF];

    lstrcpy(lpszFullPath, lpszPathLink);
    lstrcat(lpszFullPath, "\\");
    lstrcat(lpszFullPath, lpszDesc);
    lstrcat(lpszFullPath, ".lnk");

    CreateDirectory(lpszPathLink, NULL);
    CoInitialize(NULL);

    // Get a pointer to the IShellLink interface. 
    hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (LPVOID *)&psl); 
    if(SUCCEEDED(hres))
    { 
        IPersistFile* ppf; 
 
        // Set the path to the shortcut target, and add the 
        // description. 
        psl->SetPath(lpszPathObj);

        // Do not set the description at this time.  We need to fix this
        // parameter so it can be passed in independent of the shortcut name
        // itself.  Comment this code out for now until a real fix can be done.
        // psl->SetDescription(lpszDesc);

        if(lpszWorkingPath)
            psl->SetWorkingDirectory(lpszWorkingPath);
        if(lpszArgs)
            psl->SetArguments(lpszArgs);
        psl->SetIconLocation(lpszIconFullPath, iIcon);
 
        // Query IShellLink for the IPersistFile interface for saving the 
        // shortcut in persistent storage. 
        hres = psl->QueryInterface(IID_IPersistFile, (LPVOID FAR *)&ppf); 
        if(SUCCEEDED(hres))
        { 
            WORD wsz[MAX_BUF]; 
 
            // Ensure that the string is ANSI. 
            MultiByteToWideChar(CP_ACP, 0, lpszFullPath, -1, (wchar_t *)wsz, MAX_BUF);
 
            // Save the link by calling IPersistFile::Save. 
            hres = ppf->Save((wchar_t *)wsz, TRUE); 
            ppf->Release(); 
        } 
        psl->Release(); 
    } 
    CoUninitialize();

    return hres;
} 
HRESULT CreateDirectoriesAll ( char *  szPath,
BOOL  bLogForUninstall 
)

Definition at line 1214 of file ifuncns.c.

{
  int     i;
  int     iLen = lstrlen(szPath);
  char    szCreatePath[MAX_BUF];
  HRESULT hrResult = WIZ_OK;

  ZeroMemory(szCreatePath, MAX_BUF);
  memcpy(szCreatePath, szPath, iLen);
  for(i = 0; i < iLen; i++)
  {
    if((iLen > 1) &&
      ((i != 0) && ((szPath[i] == '\\') || (szPath[i] == '/'))) &&
      (!((szPath[0] == '\\') && (i == 1)) && !((szPath[1] == ':') && (i == 2))))
    {
      szCreatePath[i] = '\0';
      if(FileExists(szCreatePath) == FALSE)
      {
        if(!CreateDirectory(szCreatePath, NULL))
          return(WIZ_ERROR_CREATE_DIRECTORY);

        if(bLogForUninstall)
          UpdateInstallLog(KEY_CREATE_FOLDER, szCreatePath, FALSE);
      }
      szCreatePath[i] = szPath[i];
    }
  }
  return(hrResult);
}
HRESULT DirectoryRemove ( LPSTR  szDestination,
BOOL  bRemoveSubdirs 
)

Definition at line 1337 of file ifuncns.c.

{
  HANDLE          hFile;
  WIN32_FIND_DATA fdFile;
  char            szDestTemp[MAX_BUF];
  BOOL            bFound;

  if(!FileExists(szDestination))
    return(FO_SUCCESS);

  if(bRemoveSubdirs == TRUE)
  {
    lstrcpy(szDestTemp, szDestination);
    AppendBackSlash(szDestTemp, sizeof(szDestTemp));
    lstrcat(szDestTemp, "*");

    bFound = TRUE;
    hFile = FindFirstFile(szDestTemp, &fdFile);
    while((hFile != INVALID_HANDLE_VALUE) && (bFound == TRUE))
    {
      if((lstrcmpi(fdFile.cFileName, ".") != 0) && (lstrcmpi(fdFile.cFileName, "..") != 0))
      {
        /* create full path */
        lstrcpy(szDestTemp, szDestination);
        AppendBackSlash(szDestTemp, sizeof(szDestTemp));
        lstrcat(szDestTemp, fdFile.cFileName);

        if(fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
        {
          DirectoryRemove(szDestTemp, bRemoveSubdirs);
        }
        else
        {
          DeleteFile(szDestTemp);
        }
      }

      bFound = FindNextFile(hFile, &fdFile);
    }

    FindClose(hFile);
  }
  
  RemoveDirectory(szDestination);
  return(FO_SUCCESS);
}
HRESULT FileCopy ( LPSTR  szFrom,
LPSTR  szTo,
BOOL  bFailIfExists,
BOOL  bDnu 
)

Definition at line 728 of file ifuncns.c.

{
  HANDLE          hFile;
  WIN32_FIND_DATA fdFile;
  char            szFromDir[MAX_BUF];
  char            szFromTemp[MAX_BUF];
  char            szToTemp[MAX_BUF];
  char            szBuf[MAX_BUF];
  BOOL            bFound;

  if(FileExists(szFrom))
  {
    /* The file in the From file path exists */
    CreateDirectoriesAll(szTo, !bDnu);
    ParsePath(szFrom, szBuf, sizeof(szBuf), FALSE, PP_FILENAME_ONLY);
    lstrcpy(szToTemp, szTo);
    AppendBackSlash(szToTemp, sizeof(szToTemp));
    lstrcat(szToTemp, szBuf);
    CopyFile(szFrom, szToTemp, bFailIfExists);
    wsprintf(szBuf, "%s to %s", szFrom, szToTemp);
    UpdateInstallLog(KEY_COPY_FILE, szBuf, bDnu);

    return(FO_SUCCESS);
  }

  /* The file in the From file path does not exist.  Assume to contain wild args and */
  /* proceed acordingly.                                                             */
  ParsePath(szFrom, szFromDir, sizeof(szFromDir), FALSE, PP_PATH_ONLY);

  if((hFile = FindFirstFile(szFrom, &fdFile)) == INVALID_HANDLE_VALUE)
    bFound = FALSE;
  else
    bFound = TRUE;

  while(bFound)
  {
    if((lstrcmpi(fdFile.cFileName, ".") != 0) && (lstrcmpi(fdFile.cFileName, "..") != 0))
    {
      /* create full path string including filename for source */
      lstrcpy(szFromTemp, szFromDir);
      AppendBackSlash(szFromTemp, sizeof(szFromTemp));
      lstrcat(szFromTemp, fdFile.cFileName);

      /* create full path string including filename for destination */
      lstrcpy(szToTemp, szTo);
      AppendBackSlash(szToTemp, sizeof(szToTemp));
      lstrcat(szToTemp, fdFile.cFileName);

      CopyFile(szFromTemp, szToTemp, bFailIfExists);

      /* log the file copy command */
      wsprintf(szBuf, "%s to %s", szFromTemp, szToTemp);
      UpdateInstallLog(KEY_COPY_FILE, szBuf, bDnu);
    }

    bFound = FindNextFile(hFile, &fdFile);
  }

  FindClose(hFile);
  return(FO_SUCCESS);
}
HRESULT FileCopySequential ( LPSTR  szSourcePath,
LPSTR  szDestPath,
LPSTR  szFilename 
)

Definition at line 790 of file ifuncns.c.

{
  int             iFilenameOnlyLen;
  char            szDestFullFilename[MAX_BUF];
  char            szSourceFullFilename[MAX_BUF];
  char            szSearchFilename[MAX_BUF];
  char            szSearchDestFullFilename[MAX_BUF];
  char            szFilenameOnly[MAX_BUF];
  char            szFilenameExtensionOnly[MAX_BUF];
  char            szNumber[MAX_BUF];
  long            dwNumber;
  long            dwMaxNumber;
  LPSTR           szDotPtr;
  HANDLE          hFile;
  WIN32_FIND_DATA fdFile;
  BOOL            bFound;

  lstrcpy(szSourceFullFilename, szSourcePath);
  AppendBackSlash(szSourceFullFilename, sizeof(szSourceFullFilename));
  lstrcat(szSourceFullFilename, szFilename);

  if(FileExists(szSourceFullFilename))
  {
    /* zero out the memory */
    ZeroMemory(szSearchFilename,        sizeof(szSearchFilename));
    ZeroMemory(szFilenameOnly,          sizeof(szFilenameOnly));
    ZeroMemory(szFilenameExtensionOnly, sizeof(szFilenameExtensionOnly));

    /* parse for the filename w/o extention and also only the extension */
    if((szDotPtr = strstr(szFilename, ".")) != NULL)
    {
      *szDotPtr = '\0';
      lstrcpy(szSearchFilename, szFilename);
      lstrcpy(szFilenameOnly, szFilename);
      lstrcpy(szFilenameExtensionOnly, &szDotPtr[1]);
      *szDotPtr = '.';
    }
    else
    {
      lstrcpy(szFilenameOnly, szFilename);
      lstrcpy(szSearchFilename, szFilename);
    }

    /* create the wild arg filename to search for in the szDestPath */
    lstrcat(szSearchFilename, "*.*");
    lstrcpy(szSearchDestFullFilename, szDestPath);
    AppendBackSlash(szSearchDestFullFilename, sizeof(szSearchDestFullFilename));
    lstrcat(szSearchDestFullFilename, szSearchFilename);

    iFilenameOnlyLen = lstrlen(szFilenameOnly);
    dwNumber         = 0;
    dwMaxNumber      = 0;

    /* find the largest numbered filename in the szDestPath */
    if((hFile = FindFirstFile(szSearchDestFullFilename, &fdFile)) == INVALID_HANDLE_VALUE)
      bFound = FALSE;
    else
      bFound = TRUE;

    while(bFound)
    {
       ZeroMemory(szNumber, sizeof(szNumber));
      if((lstrcmpi(fdFile.cFileName, ".") != 0) && (lstrcmpi(fdFile.cFileName, "..") != 0))
      {
        lstrcpy(szNumber, &fdFile.cFileName[iFilenameOnlyLen]);
        dwNumber = atoi(szNumber);
        if(dwNumber > dwMaxNumber)
          dwMaxNumber = dwNumber;
      }

      bFound = FindNextFile(hFile, &fdFile);
    }

    FindClose(hFile);

    lstrcpy(szDestFullFilename, szDestPath);
    AppendBackSlash(szDestFullFilename, sizeof(szDestFullFilename));
    lstrcat(szDestFullFilename, szFilenameOnly);
    itoa(dwMaxNumber + 1, szNumber, 10);
    lstrcat(szDestFullFilename, szNumber);

    if(*szFilenameExtensionOnly != '\0')
    {
      lstrcat(szDestFullFilename, ".");
      lstrcat(szDestFullFilename, szFilenameExtensionOnly);
    }

    CopyFile(szSourceFullFilename, szDestFullFilename, TRUE);
  }

  return(FO_SUCCESS);
}
HRESULT FileDelete ( LPSTR  szDestination)

Definition at line 1270 of file ifuncns.c.

{
  HANDLE          hFile;
  WIN32_FIND_DATA fdFile;
  char            szBuf[MAX_BUF];
  char            szPathOnly[MAX_BUF];
  BOOL            bFound;

  if(FileExists(szDestination))
  {
    /* The file in the From file path exists */
    DeleteFile(szDestination);
    return(FO_SUCCESS);
  }

  /* The file in the From file path does not exist.  Assume to contain wild args and */
  /* proceed acordingly.                                                             */
  ParsePath(szDestination, szPathOnly, sizeof(szPathOnly), FALSE, PP_PATH_ONLY);

  if((hFile = FindFirstFile(szDestination, &fdFile)) == INVALID_HANDLE_VALUE)
    bFound = FALSE;
  else
    bFound = TRUE;

  while(bFound)
  {
    if(!(fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
    {
      lstrcpy(szBuf, szPathOnly);
      AppendBackSlash(szBuf, sizeof(szBuf));
      lstrcat(szBuf, fdFile.cFileName);

      DeleteFile(szBuf);
    }

    bFound = FindNextFile(hFile, &fdFile);
  }

  FindClose(hFile);
  return(FO_SUCCESS);
}
HRESULT FileMove ( LPSTR  szFrom,
LPSTR  szTo 
)

Definition at line 625 of file ifuncns.c.

{
  HANDLE          hFile;
  WIN32_FIND_DATA fdFile;
  char            szFromDir[MAX_BUF];
  char            szFromTemp[MAX_BUF];
  char            szToTemp[MAX_BUF];
  char            szBuf[MAX_BUF];
  BOOL            bFound;

  /* From file path exists and To file path does not exist */
  if((FileExists(szFrom)) && (!FileExists(szTo)))
  {
    MoveFile(szFrom, szTo);

    /* log the file move command */
    wsprintf(szBuf, "%s to %s", szFrom, szTo);
    UpdateInstallLog(KEY_MOVE_FILE, szBuf, FALSE);

    return(FO_SUCCESS);
  }
  /* From file path exists and To file path exists */
  if(FileExists(szFrom) && FileExists(szTo))
  {
    /* Since the To file path exists, assume it to be a directory and proceed.      */
    /* We don't care if it's a file.  If it is a file, then config.ini needs to be  */
    /* corrected to remove the file before attempting a MoveFile().                 */
    lstrcpy(szToTemp, szTo);
    AppendBackSlash(szToTemp, sizeof(szToTemp));
    ParsePath(szFrom, szBuf, sizeof(szBuf), FALSE, PP_FILENAME_ONLY);
    lstrcat(szToTemp, szBuf);
    MoveFile(szFrom, szToTemp);

    /* log the file move command */
    wsprintf(szBuf, "%s to %s", szFrom, szToTemp);
    UpdateInstallLog(KEY_MOVE_FILE, szBuf, FALSE);

    return(FO_SUCCESS);
  }

  ParsePath(szFrom, szFromDir, sizeof(szFromDir), FALSE, PP_PATH_ONLY);

  if((hFile = FindFirstFile(szFrom, &fdFile)) == INVALID_HANDLE_VALUE)
    bFound = FALSE;
  else
    bFound = TRUE;

  while(bFound)
  {
    if((lstrcmpi(fdFile.cFileName, ".") != 0) && (lstrcmpi(fdFile.cFileName, "..") != 0))
    {
      /* create full path string including filename for source */
      lstrcpy(szFromTemp, szFromDir);
      AppendBackSlash(szFromTemp, sizeof(szFromTemp));
      lstrcat(szFromTemp, fdFile.cFileName);

      /* create full path string including filename for destination */
      lstrcpy(szToTemp, szTo);
      AppendBackSlash(szToTemp, sizeof(szToTemp));
      lstrcat(szToTemp, fdFile.cFileName);

      MoveFile(szFromTemp, szToTemp);

      /* log the file move command */
      wsprintf(szBuf, "%s to %s", szFromTemp, szToTemp);
      UpdateInstallLog(KEY_MOVE_FILE, szBuf, FALSE);
    }

    bFound = FindNextFile(hFile, &fdFile);
  }

  FindClose(hFile);
  return(FO_SUCCESS);
}
HRESULT FileUncompress ( LPSTR  szFrom,
LPSTR  szTo 
)

Definition at line 465 of file ifuncns.c.

{
  char  szBuf[MAX_BUF];
  DWORD dwReturn;
  void  *vZip;

  dwReturn = FO_SUCCESS;
  /* Check for the existance of the from (source) file */
  if(!FileExists(szFrom))
    return(FO_ERROR_FILE_NOT_FOUND);

  /* Check for the existance of the to (destination) path */
  dwReturn = FileExists(szTo);
  if(dwReturn && !(dwReturn & FILE_ATTRIBUTE_DIRECTORY))
  {
    /* found a file with the same name as the destination path */
    return(FO_ERROR_DESTINATION_CONFLICT);
  }
  else if(!dwReturn)
  {
    lstrcpy(szBuf, szTo);
    AppendBackSlash(szBuf, sizeof(szBuf));
    CreateDirectoriesAll(szBuf, DO_NOT_ADD_TO_UNINSTALL_LOG);
  }

  GetCurrentDirectory(MAX_BUF, szBuf);
  if(SetCurrentDirectory(szTo) == FALSE)
    return(FO_ERROR_CHANGE_DIR);

  if((dwReturn = ZIP_OpenArchive(szFrom, &vZip)) != ZIP_OK)
    return(dwReturn);

  /* 1st parameter should be NULL or it will fail */
  /* It indicates extract the entire archive */
  dwReturn = ExtractDirEntries(NULL, vZip);
  ZIP_CloseArchive(&vZip);

  if(SetCurrentDirectory(szBuf) == FALSE)
    return(FO_ERROR_CHANGE_DIR);

  return(dwReturn);
}
void GetUserAgentShort ( char *  szUserAgent,
char *  szOutUAShort,
DWORD  dwOutUAShortSize 
)

Definition at line 166 of file ifuncns.c.

{
  char *ptrFirstSpace = NULL;

  ZeroMemory(szOutUAShort, dwOutUAShortSize);
  if((szUserAgent == NULL) || (*szUserAgent == '\0'))
    return;

  ptrFirstSpace = strstr(szUserAgent, " ");
  if(ptrFirstSpace != NULL)
  {
    *ptrFirstSpace = '\0';
    lstrcpy(szOutUAShort, szUserAgent);
    *ptrFirstSpace = ' ';
  }
}
HRESULT ProcessCopyFile ( DWORD  dwTiming,
char *  szSectionPrefix 
)

Definition at line 883 of file ifuncns.c.

{
  DWORD dwIndex;
  char  szBuf[MAX_BUF];
  char  szSection[MAX_BUF];
  char  szSource[MAX_BUF];
  char  szDestination[MAX_BUF];
  BOOL  bFailIfExists;
  BOOL  bDnu;

  dwIndex = 0;
  BuildNumberedString(dwIndex, szSectionPrefix, "Copy File", szSection, sizeof(szSection));
  GetConfigIniProfileString(szSection, "Source", "", szBuf, sizeof(szBuf));
  while(*szBuf != '\0')
  {
    if(TimingCheck(dwTiming, szSection))
    {
      DecryptString(szSource, szBuf);
      GetConfigIniProfileString(szSection, "Destination", "", szBuf, sizeof(szBuf));
      DecryptString(szDestination, szBuf);

      GetConfigIniProfileString(szSection, "Do Not Uninstall", "", szBuf, sizeof(szBuf));
      if(lstrcmpi(szBuf, "TRUE") == 0)
        bDnu = TRUE;
      else
        bDnu = FALSE;

      GetConfigIniProfileString(szSection, "Fail If Exists", "", szBuf, sizeof(szBuf));
      if(lstrcmpi(szBuf, "TRUE") == 0)
        bFailIfExists = TRUE;
      else
        bFailIfExists = FALSE;

      FileCopy(szSource, szDestination, bFailIfExists, bDnu);
    }

    ++dwIndex;
    BuildNumberedString(dwIndex, szSectionPrefix, "Copy File", szSection, sizeof(szSection));
    GetConfigIniProfileString(szSection, "Source", "", szBuf, sizeof(szBuf));
  }
  return(FO_SUCCESS);
}
HRESULT ProcessCopyFileSequential ( DWORD  dwTiming,
char *  szSectionPrefix 
)

Definition at line 926 of file ifuncns.c.

{
  DWORD dwIndex;
  char  szBuf[MAX_BUF];
  char  szSection[MAX_BUF];
  char  szSource[MAX_BUF];
  char  szDestination[MAX_BUF];
  char  szFilename[MAX_BUF];

  dwIndex = 0;
  BuildNumberedString(dwIndex, szSectionPrefix, "Copy File Sequential", szSection, sizeof(szSection));
  GetConfigIniProfileString(szSection, "Filename", "", szFilename, sizeof(szFilename));
  while(*szFilename != '\0')
  {
    if(TimingCheck(dwTiming, szSection))
    {
      GetConfigIniProfileString(szSection, "Source", "", szBuf, sizeof(szBuf));
      DecryptString(szSource, szBuf);

      GetConfigIniProfileString(szSection, "Destination", "", szBuf, sizeof(szBuf));
      DecryptString(szDestination, szBuf);

      FileCopySequential(szSource, szDestination, szFilename);
    }

    ++dwIndex;
    BuildNumberedString(dwIndex, szSectionPrefix, "Copy File Sequential", szSection, sizeof(szSection));
    GetConfigIniProfileString(szSection, "Filename", "", szFilename, sizeof(szFilename));
  }
  return(FO_SUCCESS);
}

Definition at line 2307 of file ifuncns.c.

{
  DWORD dwCompIndex;
  DWORD dwFileIndex;
  DWORD dwSectIndex;
  DWORD dwKVIndex;
  siC   *siCObject = NULL;
  char  szBufTiny[MAX_BUF_TINY];
  char  szSection[MAX_BUF_TINY];
  char  szBuf[MAX_BUF];
  char  szFileName[MAX_BUF];
  char  szDefinedSection[MAX_BUF]; 
  char  szDefinedKey[MAX_BUF]; 
  char  szDefinedValue[MAX_BUF];

  dwCompIndex   = 0;
  siCObject = SiCNodeGetObject(dwCompIndex, TRUE, AC_ALL);

  while(siCObject)
  {
    dwFileIndex   = 0;
    wsprintf(szSection,"%s-Configuration File%d",siCObject->szReferenceName,dwFileIndex);
    siCObject = SiCNodeGetObject(++dwCompIndex, TRUE, AC_ALL);
    if(TimingCheck(dwTiming, szSection) == FALSE)
    {
      continue;
    }

    GetConfigIniProfileString(szSection, "FileName", "", szBuf, sizeof(szBuf));
    while (*szBuf != '\0')
    {
      DecryptString(szFileName, szBuf);
      if(FileExists(szFileName))
      {
        DeleteFile(szFileName);
      }

      /* TO DO - Support a File Type for something other than .ini */
      dwSectIndex = 0;
      wsprintf(szBufTiny, "Section%d",dwSectIndex);
      GetConfigIniProfileString(szSection, szBufTiny, "", szDefinedSection, sizeof(szDefinedSection));
      while(*szDefinedSection != '\0')
      {  
        dwKVIndex =0;
        wsprintf(szBufTiny,"Section%d-Key%d",dwSectIndex,dwKVIndex);
        GetConfigIniProfileString(szSection, szBufTiny, "", szDefinedKey, sizeof(szDefinedKey));
        while(*szDefinedKey != '\0')
        {
          wsprintf(szBufTiny,"Section%d-Value%d",dwSectIndex,dwKVIndex);
          GetConfigIniProfileString(szSection, szBufTiny, "", szBuf, sizeof(szBuf));
          DecryptString(szDefinedValue, szBuf);
          if(WritePrivateProfileString(szDefinedSection, szDefinedKey, szDefinedValue, szFileName) == 0)
          {
            char szEWPPS[MAX_BUF];
            char szBuf[MAX_BUF];
            char szBuf2[MAX_BUF];
            if(GetPrivateProfileString("Messages", "ERROR_WRITEPRIVATEPROFILESTRING", "", szEWPPS, sizeof(szEWPPS), szFileIniInstall))
            {
              wsprintf(szBuf, "%s\n    [%s]\n    %s=%s", szFileName, szDefinedSection, szDefinedKey, szDefinedValue);
              wsprintf(szBuf2, szEWPPS, szBuf);
              PrintError(szBuf2, ERROR_CODE_SHOW);
            }
            return(FO_ERROR_WRITE);
          }
          wsprintf(szBufTiny,"Section%d-Key%d",dwSectIndex,++dwKVIndex);
          GetConfigIniProfileString(szSection, szBufTiny, "", szDefinedKey, sizeof(szDefinedKey));
        } /* while(*szDefinedKey != '\0')  */

        wsprintf(szBufTiny, "Section%d",++dwSectIndex);
        GetConfigIniProfileString(szSection, szBufTiny, "", szDefinedSection, sizeof(szDefinedSection));
      } /*       while(*szDefinedSection != '\0') */

      wsprintf(szSection,"%s-Configuration File%d",siCObject->szReferenceName,++dwFileIndex);
      GetConfigIniProfileString(szSection, "FileName", "", szBuf, sizeof(szBuf));
    } /* while(*szBuf != '\0') */
  } /* while(siCObject) */
  return (FO_SUCCESS);
}
HRESULT ProcessCreateDirectory ( DWORD  dwTiming,
char *  szSectionPrefix 
)

Definition at line 1244 of file ifuncns.c.

{
  DWORD dwIndex;
  char  szBuf[MAX_BUF];
  char  szSection[MAX_BUF];
  char  szDestination[MAX_BUF];

  dwIndex = 0;
  BuildNumberedString(dwIndex, szSectionPrefix, "Create Directory", szSection, sizeof(szSection));
  GetConfigIniProfileString(szSection, "Destination", "", szBuf, sizeof(szBuf));
  while(*szBuf != '\0')
  {
    if(TimingCheck(dwTiming, szSection))
    {
      DecryptString(szDestination, szBuf);
      AppendBackSlash(szDestination, sizeof(szDestination));
      CreateDirectoriesAll(szDestination, ADD_TO_UNINSTALL_LOG);
    }

    ++dwIndex;
    BuildNumberedString(dwIndex, szSectionPrefix, "Create Directory", szSection, sizeof(szSection));
    GetConfigIniProfileString(szSection, "Destination", "", szBuf, sizeof(szBuf));
  }
  return(FO_SUCCESS);
}
HRESULT ProcessDeleteFile ( DWORD  dwTiming,
char *  szSectionPrefix 
)

Definition at line 1312 of file ifuncns.c.

{
  DWORD dwIndex;
  char  szBuf[MAX_BUF];
  char  szSection[MAX_BUF];
  char  szDestination[MAX_BUF];

  dwIndex = 0;
  BuildNumberedString(dwIndex, szSectionPrefix, "Delete File", szSection, sizeof(szSection));
  GetConfigIniProfileString(szSection, "Destination", "", szBuf, sizeof(szBuf));
  while(*szBuf != '\0')
  {
    if(TimingCheck(dwTiming, szSection))
    {
      DecryptString(szDestination, szBuf);
      FileDelete(szDestination);
    }

    ++dwIndex;
    BuildNumberedString(dwIndex, szSectionPrefix, "Delete File", szSection, sizeof(szSection));
    GetConfigIniProfileString(szSection, "Destination", "", szBuf, sizeof(szBuf));
  }
  return(FO_SUCCESS);
}
void ProcessFileOps ( DWORD  dwTiming,
char *  szSectionPrefix 
)

Definition at line 348 of file ifuncns.c.

{
  if(sgProduct.bInstallFiles)
  {
    ProcessUncompressFile(dwTiming, szSectionPrefix);
    ProcessCreateDirectory(dwTiming, szSectionPrefix);
    ProcessMoveFile(dwTiming, szSectionPrefix);
    ProcessCopyFile(dwTiming, szSectionPrefix);
    ProcessCopyFileSequential(dwTiming, szSectionPrefix);
    ProcessSelfRegisterFile(dwTiming, szSectionPrefix);
    ProcessDeleteFile(dwTiming, szSectionPrefix);
    ProcessRemoveDirectory(dwTiming, szSectionPrefix);
    if(!gbIgnoreRunAppX)
      ProcessRunApp(dwTiming, szSectionPrefix);
  }

  // This is the only operation we do if we are not installing files
  ProcessWinReg(dwTiming, szSectionPrefix);

  if(sgProduct.bInstallFiles)
  {
    ProcessProgramFolder(dwTiming, szSectionPrefix);
    ProcessSetVersionRegistry(dwTiming, szSectionPrefix);
  }
}

Definition at line 392 of file ifuncns.c.

Definition at line 374 of file ifuncns.c.

{
  DWORD dwIndex0;
  siC   *siCObject = NULL;

  dwIndex0  = 0;
  siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL);
  while(siCObject)
  {
    if(siCObject->dwAttributes & SIC_SELECTED)
      /* Since the archive is selected, we need to process the file ops here */
      ProcessFileOps(dwTiming, siCObject->szReferenceName);

    ++dwIndex0;
    siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL);
  } /* while(siCObject) */
}
HRESULT ProcessMoveFile ( DWORD  dwTiming,
char *  szSectionPrefix 
)

Definition at line 700 of file ifuncns.c.

{
  DWORD dwIndex;
  char  szBuf[MAX_BUF];
  char  szSection[MAX_BUF];
  char  szSource[MAX_BUF];
  char  szDestination[MAX_BUF];

  dwIndex = 0;
  BuildNumberedString(dwIndex, szSectionPrefix, "Move File", szSection, sizeof(szSection));
  GetConfigIniProfileString(szSection, "Source", "", szBuf, sizeof(szBuf));
  while(*szBuf != '\0')
  {
    if(TimingCheck(dwTiming, szSection))
    {
      DecryptString(szSource, szBuf);
      GetConfigIniProfileString(szSection, "Destination", "", szBuf, sizeof(szBuf));
      DecryptString(szDestination, szBuf);
      FileMove(szSource, szDestination);
    }

    ++dwIndex;
    BuildNumberedString(dwIndex, szSectionPrefix, "Move File", szSection, sizeof(szSection));
    GetConfigIniProfileString(szSection, "Source", "", szBuf, sizeof(szBuf));
  }
  return(FO_SUCCESS);
}
HRESULT ProcessOS2INI ( ULONG  ulTiming,
char *  szSectionPrefix 
)

Definition at line 1345 of file ifuncns.c.

{
  char    szBuf[MAX_BUF];
  char    szApp[MAX_BUF];
  char    szKey[MAX_BUF];
  char    szValue[MAX_BUF];
  char    szDecrypt[MAX_BUF];
  char    szSection[MAX_BUF];
  BOOL    bDnu;
  ULONG   ulIndex;
  ULONG   ulSize;

  ulIndex = 0;
  BuildNumberedString(ulIndex, szSectionPrefix, "OS2 INI", szSection, sizeof(szSection));
  GetPrivateProfileString(szSection, "App", "", szBuf, sizeof(szBuf), szFileIniConfig);
  while(*szBuf != '\0')
  {
    if(TimingCheck(ulTiming, szSection, szFileIniConfig))
    {
      GetPrivateProfileString(szSection, "App",                 "", szBuf,           sizeof(szBuf),          szFileIniConfig);
      GetPrivateProfileString(szSection, "Decrypt App",         "", szDecrypt,       sizeof(szDecrypt),      szFileIniConfig);
      memset(szApp, 0, sizeof(szApp));
      if(stricmp(szDecrypt, "TRUE") == 0)
        DecryptString(szApp, szBuf);
      else
        strcpy(szApp, szBuf);

      GetPrivateProfileString(szSection, "Key",                "", szBuf,           sizeof(szBuf),           szFileIniConfig);
      GetPrivateProfileString(szSection, "Decrypt Key",        "", szDecrypt,       sizeof(szDecrypt),       szFileIniConfig);
      memset(szKey, 0, sizeof(szKey));
      if(stricmp(szDecrypt, "TRUE") == 0)
        DecryptString(szKey, szBuf);
      else
        strcpy(szKey, szBuf);

      GetPrivateProfileString(szSection, "Key Value",          "", szBuf,           sizeof(szBuf), szFileIniConfig);
      GetPrivateProfileString(szSection, "Decrypt Key Value",  "", szDecrypt,       sizeof(szDecrypt), szFileIniConfig);
      memset(szValue, 0, sizeof(szValue));
      if(stricmp(szDecrypt, "TRUE") == 0)
        DecryptString(szValue, szBuf);
      else
        strcpy(szValue, szBuf);

      GetPrivateProfileString(szSection, "Size",                "", szBuf,           sizeof(szBuf), szFileIniConfig);
      if(*szBuf != '\0')
        ulSize = atoi(szBuf);
      else
        ulSize = 0;

      GetPrivateProfileString(szSection,
                              "Do Not Uninstall",
                              "",
                              szBuf,
                              sizeof(szBuf),
                              szFileIniConfig);
      if(stricmp(szBuf, "TRUE") == 0)
        bDnu = TRUE;
      else
        bDnu = FALSE;

      PrfWriteProfileString(HINI_USERPROFILE, szApp, szKey, szValue);
      /* log the win reg command */
      sprintf(szBuf, "%s [%s]", szApp, szKey);
      UpdateInstallLog(KEY_STORE_INI_ENTRY, szBuf, bDnu);
    }

    ++ulIndex;
    BuildNumberedString(ulIndex, szSectionPrefix, "OS2 INI", szSection, sizeof(szSection));
    GetPrivateProfileString(szSection, "App", "", szBuf, sizeof(szBuf), szFileIniConfig);
  }
  return(FO_SUCCESS);
}

Here is the call graph for this function:

Here is the caller graph for this function:

HRESULT ProcessProgramFolder ( DWORD  dwTiming,
char *  szSectionPrefix 
)

Definition at line 2179 of file ifuncns.c.

{
  DWORD dwIndex0;
  DWORD dwIndex1;
  DWORD dwIconId;
  DWORD dwRestrictedAccess;
  char  szIndex1[MAX_BUF];
  char  szBuf[MAX_BUF];
  char  szSection0[MAX_BUF];
  char  szSection1[MAX_BUF];
  char  szProgramFolder[MAX_BUF];
  char  szFile[MAX_BUF];
  char  szArguments[MAX_BUF];
  char  szWorkingDir[MAX_BUF];
  char  szDescription[MAX_BUF];
  char  szIconPath[MAX_BUF];

  dwIndex0 = 0;
  BuildNumberedString(dwIndex0, szSectionPrefix, "Program Folder", szSection0, sizeof(szSection0));
  GetConfigIniProfileString(szSection0, "Program Folder", "", szBuf, sizeof(szBuf));
  while(*szBuf != '\0')
  {
    if(TimingCheck(dwTiming, szSection0))
    {
      DecryptString(szProgramFolder, szBuf);

      dwIndex1 = 0;
      itoa(dwIndex1, szIndex1, 10);
      lstrcpy(szSection1, szSection0);
      lstrcat(szSection1, "-Shortcut");
      lstrcat(szSection1, szIndex1);
      GetConfigIniProfileString(szSection1, "File", "", szBuf, sizeof(szBuf));
      while(*szBuf != '\0')
      {
        DecryptString(szFile, szBuf);
        GetConfigIniProfileString(szSection1, "Arguments",    "", szBuf, sizeof(szBuf));
        DecryptString(szArguments, szBuf);
        GetConfigIniProfileString(szSection1, "Working Dir",  "", szBuf, sizeof(szBuf));
        DecryptString(szWorkingDir, szBuf);
        GetConfigIniProfileString(szSection1, "Description",  "", szBuf, sizeof(szBuf));
        DecryptString(szDescription, szBuf);
        GetConfigIniProfileString(szSection1, "Icon Path",    "", szBuf, sizeof(szBuf));
        DecryptString(szIconPath, szBuf);
        GetConfigIniProfileString(szSection1, "Icon Id",      "", szBuf, sizeof(szBuf));
        if(*szBuf != '\0')
          dwIconId = atol(szBuf);
        else
          dwIconId = 0;

        GetConfigIniProfileString(szSection1, "Restricted Access",    "", szBuf, sizeof(szBuf));
        dwRestrictedAccess = ParseRestrictedAccessKey(szBuf);
        if((dwRestrictedAccess == RA_IGNORE) ||
          ((dwRestrictedAccess == RA_ONLY_RESTRICTED) && gbRestrictedAccess) ||
          ((dwRestrictedAccess == RA_ONLY_NONRESTRICTED) && !gbRestrictedAccess))
        {
          CreateALink(szFile, szProgramFolder, szDescription, szWorkingDir, szArguments, szIconPath, dwIconId);
          lstrcpy(szBuf, szProgramFolder);
          AppendBackSlash(szBuf, sizeof(szBuf));
          lstrcat(szBuf, szDescription);
          UpdateInstallLog(KEY_WINDOWS_SHORTCUT, szBuf, FALSE);
        }

        ++dwIndex1;
        itoa(dwIndex1, szIndex1, 10);
        lstrcpy(szSection1, szSection0);
        lstrcat(szSection1, "-Shortcut");
        lstrcat(szSection1, szIndex1);
        GetConfigIniProfileString(szSection1, "File", "", szBuf, sizeof(szBuf));
      }
    }

    ++dwIndex0;
    BuildNumberedString(dwIndex0, szSectionPrefix, "Program Folder", szSection0, sizeof(szSection0));
    GetConfigIniProfileString(szSection0, "Program Folder", "", szBuf, sizeof(szBuf));
  }
  return(FO_SUCCESS);
}

Definition at line 2257 of file ifuncns.c.

{
  DWORD dwIndex0;
  int   iShowFolder;
  char  szBuf[MAX_BUF];
  char  szSection0[MAX_BUF];
  char  szProgramFolder[MAX_BUF];

  dwIndex0 = 0;
  BuildNumberedString(dwIndex0, NULL, "Program Folder", szSection0, sizeof(szSection0));
  GetConfigIniProfileString(szSection0, "Program Folder", "", szBuf, sizeof(szBuf));
  while(*szBuf != '\0')
  {
    DecryptString(szProgramFolder, szBuf);
    GetConfigIniProfileString(szSection0, "Show Folder", "", szBuf, sizeof(szBuf));

    if(strcmpi(szBuf, "HIDE") == 0)
      iShowFolder = SW_HIDE;
    else if(strcmpi(szBuf, "MAXIMIZE") == 0)
      iShowFolder = SW_MAXIMIZE;
    else if(strcmpi(szBuf, "MINIMIZE") == 0)
      iShowFolder = SW_MINIMIZE;
    else if(strcmpi(szBuf, "RESTORE") == 0)
      iShowFolder = SW_RESTORE;
    else if(strcmpi(szBuf, "SHOW") == 0)
      iShowFolder = SW_SHOW;
    else if(strcmpi(szBuf, "SHOWMAXIMIZED") == 0)
      iShowFolder = SW_SHOWMAXIMIZED;
    else if(strcmpi(szBuf, "SHOWMINIMIZED") == 0)
      iShowFolder = SW_SHOWMINIMIZED;
    else if(strcmpi(szBuf, "SHOWMINNOACTIVE") == 0)
      iShowFolder = SW_SHOWMINNOACTIVE;
    else if(strcmpi(szBuf, "SHOWNA") == 0)
      iShowFolder = SW_SHOWNA;
    else if(strcmpi(szBuf, "SHOWNOACTIVATE") == 0)
      iShowFolder = SW_SHOWNOACTIVATE;
    else if(strcmpi(szBuf, "SHOWNORMAL") == 0)
      iShowFolder = SW_SHOWNORMAL;

    if(iShowFolder != SW_HIDE)
      if(sgProduct.mode != SILENT)
        WinSpawn(szProgramFolder, NULL, NULL, iShowFolder, WS_WAIT);

    ++dwIndex0;
    BuildNumberedString(dwIndex0, NULL, "Program Folder", szSection0, sizeof(szSection0));
    GetConfigIniProfileString(szSection0, "Program Folder", "", szBuf, sizeof(szBuf));
  }
  return(FO_SUCCESS);
}
HRESULT ProcessRemoveDirectory ( DWORD  dwTiming,
char *  szSectionPrefix 
)

Definition at line 1384 of file ifuncns.c.

{
  DWORD dwIndex;
  char  szBuf[MAX_BUF];
  char  szSection[MAX_BUF];
  char  szDestination[MAX_BUF];
  BOOL  bRemoveSubdirs;

  dwIndex = 0;
  BuildNumberedString(dwIndex, szSectionPrefix, "Remove Directory", szSection, sizeof(szSection));
  GetConfigIniProfileString(szSection, "Destination", "", szBuf, sizeof(szBuf));
  while(*szBuf != '\0')
  {
    if(TimingCheck(dwTiming, szSection))
    {
      DecryptString(szDestination, szBuf);
      GetConfigIniProfileString(szSection, "Remove subdirs", "", szBuf, sizeof(szBuf));
      bRemoveSubdirs = FALSE;
      if(lstrcmpi(szBuf, "TRUE") == 0)
        bRemoveSubdirs = TRUE;

      DirectoryRemove(szDestination, bRemoveSubdirs);
    }

    ++dwIndex;
    BuildNumberedString(dwIndex, szSectionPrefix, "Remove Directory", szSection, sizeof(szSection));
    GetConfigIniProfileString(szSection, "Destination", "", szBuf, sizeof(szBuf));
  }
  return(FO_SUCCESS);
}
HRESULT ProcessRunApp ( DWORD  dwTiming,
char *  szSectionPrefix 
)

Definition at line 1415 of file ifuncns.c.

{
  DWORD dwIndex;
  char  szBuf[MAX_BUF];
  char  szSection[MAX_BUF];
  char  szTarget[MAX_BUF];
  char  szParameters[MAX_BUF];
  char  szWorkingDir[MAX_BUF];
  BOOL  bRunApp;
  BOOL  bWait;

  dwIndex = 0;
  BuildNumberedString(dwIndex, szSectionPrefix, "RunApp", szSection, sizeof(szSection));
  GetConfigIniProfileString(szSection, "Target", "", szBuf, sizeof(szBuf));
  while(*szBuf != '\0')
  {
    if(TimingCheck(dwTiming, szSection))
    {
      DecryptString(szTarget, szBuf);
      GetConfigIniProfileString(szSection, "Parameters", "", szBuf, sizeof(szBuf));
      DecryptString(szParameters, szBuf);

      bRunApp = MeetCondition(szSection);

      GetConfigIniProfileString(szSection, "WorkingDir", "", szBuf, sizeof(szBuf));
      DecryptString(szWorkingDir, szBuf);

      GetConfigIniProfileString(szSection, "Wait", "", szBuf, sizeof(szBuf));
      if(lstrcmpi(szBuf, "FALSE") == 0)
        bWait = FALSE;
      else
        bWait = TRUE;

      if ((bRunApp == TRUE) && FileExists(szTarget))
      {
        if((dwTiming == T_DEPEND_REBOOT) && (NeedReboot() == TRUE))
        {
          lstrcat(szTarget, " ");
          lstrcat(szTarget, szParameters);
          SetWinReg(HKEY_CURRENT_USER,
                    "Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce",
                    TRUE,
                    "Netscape",
                    TRUE,
                    REG_SZ,
                    szTarget,
                    lstrlen(szTarget),
                    FALSE,
                    FALSE);
        }
        else
        {
          GetConfigIniProfileString(szSection, "Message", "", szBuf, sizeof(szBuf));
          if ( szBuf[0] != '\0' )
            ShowMessage(szBuf, TRUE);  
          WinSpawn(szTarget, szParameters, szWorkingDir, SW_SHOWNORMAL, bWait);
          if ( szBuf[0] != '\0' )
            ShowMessage(szBuf, FALSE);  
        }
      }
    }

    ++dwIndex;
    BuildNumberedString(dwIndex, szSectionPrefix, "RunApp", szSection, sizeof(szSection));
    GetConfigIniProfileString(szSection, "Target", "", szBuf, sizeof(szBuf));
  }
  return(FO_SUCCESS);
}
HRESULT ProcessSetVersionRegistry ( DWORD  dwTiming,
char *  szSectionPrefix 
)

Definition at line 421 of file ifuncns.c.

{
  DWORD   dwIndex;
  BOOL    bIsDirectory;
  char    szBuf[MAX_BUF];
  char    szSection[MAX_BUF_TINY];
  char    szRegistryKey[MAX_BUF];
  char    szPath[MAX_BUF];
  char    szVersion[MAX_BUF_TINY];

  dwIndex = 0;
  BuildNumberedString(dwIndex, szSectionPrefix, "Version Registry", szSection, sizeof(szSection));
  GetConfigIniProfileString(szSection, "Registry Key", "", szRegistryKey, sizeof(szRegistryKey));
  while(*szRegistryKey != '\0')
  {
    if(TimingCheck(dwTiming, szSection))
    {
      GetConfigIniProfileString(szSection, "Version", "", szVersion, sizeof(szVersion));
      GetConfigIniProfileString(szSection, "Path",    "", szBuf,     sizeof(szBuf));
      DecryptString(szPath, szBuf);
      if(FileExists(szPath) & FILE_ATTRIBUTE_DIRECTORY)
        bIsDirectory = TRUE;
      else
        bIsDirectory = FALSE;

      lstrcpy(szBuf, sgProduct.szPath);
      if(sgProduct.szSubPath != '\0')
      {
        AppendBackSlash(szBuf, sizeof(szBuf));
        lstrcat(szBuf, sgProduct.szSubPath);
      }

      VR_CreateRegistry(VR_DEFAULT_PRODUCT_NAME, szBuf, NULL);
      VR_Install(szRegistryKey, szPath, szVersion, bIsDirectory);
      VR_Close();
    }

    ++dwIndex;
    BuildNumberedString(dwIndex, szSectionPrefix, "Version Registry", szSection, sizeof(szSection));
    GetConfigIniProfileString(szSection, "Registry Key", "", szRegistryKey, sizeof(szRegistryKey));
  }
  return(FO_SUCCESS);
}
HRESULT ProcessUncompressFile ( DWORD  dwTiming,
char *  szSectionPrefix 
)

Definition at line 571 of file ifuncns.c.

{
  DWORD   dwIndex;
  BOOL    bOnlyIfExists;
  char    szBuf[MAX_BUF];
  char    szSection[MAX_BUF];
  char    szSource[MAX_BUF];
  char    szDestination[MAX_BUF];

  dwIndex = 0;
  BuildNumberedString(dwIndex, szSectionPrefix, "Uncompress File", szSection, sizeof(szSection));
  GetConfigIniProfileString(szSection, "Source", "", szBuf, sizeof(szBuf));
  while(*szBuf != '\0')
  {
    if(TimingCheck(dwTiming, szSection))
    {
      DecryptString(szSource, szBuf);
      GetConfigIniProfileString(szSection, "Destination", "", szBuf, sizeof(szBuf));
      DecryptString(szDestination, szBuf);
      GetConfigIniProfileString(szSection, "Only If Exists", "", szBuf, sizeof(szBuf));
      if(lstrcmpi(szBuf, "TRUE") == 0)
        bOnlyIfExists = TRUE;
      else
        bOnlyIfExists = FALSE;

      if((!bOnlyIfExists) || (bOnlyIfExists && FileExists(szDestination)))
      {
        DWORD dwErr;

        GetConfigIniProfileString(szSection, "Message", "", szBuf, sizeof(szBuf));
        ShowMessage(szBuf, TRUE);
        if((dwErr = FileUncompress(szSource, szDestination)) != FO_SUCCESS)
        {
          char szMsg[MAX_BUF];
          char szErrorString[MAX_BUF];

          ShowMessage(szBuf, FALSE);
          GetConfigIniProfileString("Strings", "Error File Uncompress", "", szErrorString, sizeof(szErrorString));
          wsprintf(szMsg, szErrorString, szSource, dwErr);
          PrintError(szMsg, ERROR_CODE_HIDE);
          return(dwErr);
        }

        ShowMessage(szBuf, FALSE);
      }
    }

    ++dwIndex;
    BuildNumberedString(dwIndex, szSectionPrefix, "Uncompress File", szSection, sizeof(szSection));
    GetConfigIniProfileString(szSection, "Source", "", szBuf, sizeof(szBuf));
  }
  return(FO_SUCCESS);
}

Definition at line 508 of file ifuncns.c.

{
  char szSource[MAX_BUF];
  char szDestination[MAX_BUF];
  DWORD dwErr;

  if((dwErr = FileUncompress(siCFXpcomFile.szSource, siCFXpcomFile.szDestination)) != FO_SUCCESS)
  {
    char szMsg[MAX_BUF];
    char szErrorString[MAX_BUF];

    if(*siCFXpcomFile.szMessage != '\0')
      ShowMessage(siCFXpcomFile.szMessage, FALSE);

    LogISProcessXpcomFile(LIS_FAILURE, dwErr);
    GetConfigIniProfileString("Strings", "Error File Uncompress", "", szErrorString, sizeof(szErrorString));
    wsprintf(szMsg, szErrorString, siCFXpcomFile.szSource, dwErr);
    PrintError(szMsg, ERROR_CODE_HIDE);
    return(dwErr);
  }
  LogISProcessXpcomFile(LIS_SUCCESS, dwErr);

  /* copy msvcrt.dll and msvcirt.dll to the bin of the Xpcom temp dir:
   *   (c:\temp\Xpcom.ns\bin)
   * This is incase these files do not exist on the system */
  lstrcpy(szSource, siCFXpcomFile.szDestination);
  AppendBackSlash(szSource, sizeof(szSource));
  lstrcat(szSource, "ms*.dll");

  lstrcpy(szDestination, siCFXpcomFile.szDestination);
  AppendBackSlash(szDestination, sizeof(szDestination));

  lstrcat(szDestination, "bin");

  FileCopy(szSource, szDestination, TRUE, FALSE);
  return(FO_SUCCESS);
}
HRESULT TimingCheck ( DWORD  dwTiming,
LPSTR  szSection,
LPSTR  szFile 
)

Definition at line 50 of file ifuncns.c.

{
  char szBuf[MAX_BUF_TINY];

  GetPrivateProfileString(szSection, "Timing", "", szBuf, sizeof(szBuf), szFile);
  if(*szBuf != '\0')
  {
    switch(dwTiming)
    {
      case T_PRE_DOWNLOAD:
        if(stricmp(szBuf, "pre download") == 0)
          return(TRUE);
        break;

      case T_POST_DOWNLOAD:
        if(stricmp(szBuf, "post download") == 0)
          return(TRUE);
        break;

      case T_PRE_XPCOM:
        if(stricmp(szBuf, "pre xpcom") == 0)
          return(TRUE);
        break;

      case T_POST_XPCOM:
        if(stricmp(szBuf, "post xpcom") == 0)
          return(TRUE);
        break;

      case T_PRE_SMARTUPDATE:
        if(stricmp(szBuf, "pre smartupdate") == 0)
          return(TRUE);
        break;

      case T_POST_SMARTUPDATE:
        if(stricmp(szBuf, "post smartupdate") == 0)
          return(TRUE);
        break;

      case T_PRE_LAUNCHAPP:
        if(stricmp(szBuf, "pre launchapp") == 0)
          return(TRUE);
        break;

      case T_POST_LAUNCHAPP:
        if(stricmp(szBuf, "post launchapp") == 0)
          return(TRUE);
        break;

      case T_PRE_ARCHIVE:
        if(stricmp(szBuf, "pre archive") == 0)
          return(TRUE);
        break;

      case T_POST_ARCHIVE:
        if(stricmp(szBuf, "post archive") == 0)
          return(TRUE);
        break;

      case T_DEPEND_REBOOT:
        if(stricmp(szBuf, "depend reboot") == 0)
          return(TRUE);
        break;
    }
  }
  return(FALSE);
}
void UpdateInstallLog ( PSZ  szKey,
PSZ  szString,
BOOL  bDnu 
)

Definition at line 1051 of file ifuncns.c.

{
  FILE *fInstallLog;
  char szBuf[MAX_BUF];
  char szFileInstallLog[MAX_BUF];

  if(gbILUseTemp)
  {
    lstrcpy(szFileInstallLog, szTempDir);
    AppendBackSlash(szFileInstallLog, sizeof(szFileInstallLog));
  }
  else
  {
    lstrcpy(szFileInstallLog, sgProduct.szPath);
    AppendBackSlash(szFileInstallLog, sizeof(szFileInstallLog));
    lstrcat(szFileInstallLog, sgProduct.szSubPath);
    AppendBackSlash(szFileInstallLog, sizeof(szFileInstallLog));
  }

  CreateDirectoriesAll(szFileInstallLog, !bDnu);
  lstrcat(szFileInstallLog, FILE_INSTALL_LOG);

  if((fInstallLog = fopen(szFileInstallLog, "a+t")) != NULL)
  {
    if(bDnu)
      wsprintf(szBuf, "     ** (*dnu*) %s%s\n", szKey, szString);
    else
      wsprintf(szBuf, "     ** %s%s\n", szKey, szString);

    fwrite(szBuf, sizeof(char), lstrlen(szBuf), fInstallLog);
    fclose(fInstallLog);
  }
}
void UpdateInstallStatusLog ( PSZ  szString)

Definition at line 1085 of file ifuncns.c.

{
  FILE *fInstallLog;
  char szFileInstallStatusLog[MAX_BUF];

  if(gbILUseTemp)
  {
    lstrcpy(szFileInstallStatusLog, szTempDir);
    AppendBackSlash(szFileInstallStatusLog, sizeof(szFileInstallStatusLog));
  }
  else
  {
    lstrcpy(szFileInstallStatusLog, sgProduct.szPath);
    AppendBackSlash(szFileInstallStatusLog, sizeof(szFileInstallStatusLog));
    lstrcat(szFileInstallStatusLog, sgProduct.szSubPath);
    AppendBackSlash(szFileInstallStatusLog, sizeof(szFileInstallStatusLog));
  }

  CreateDirectoriesAll(szFileInstallStatusLog, DO_NOT_ADD_TO_UNINSTALL_LOG);
  lstrcat(szFileInstallStatusLog, FILE_INSTALL_STATUS_LOG);

  if((fInstallLog = fopen(szFileInstallStatusLog, "a+t")) != NULL)
  {
    fwrite(szString, sizeof(char), lstrlen(szString), fInstallLog);
    fclose(fInstallLog);
  }
}

Definition at line 1113 of file ifuncns.c.

{
  FILE *fJSFile;
  char szBuf[MAX_BUF];
  char szJSFile[MAX_BUF];

  if((*diAdvancedSettings.szProxyServer != '\0') || (*diAdvancedSettings.szProxyPort != '\0'))
  {
    lstrcpy(szJSFile, sgProduct.szPath);
    if(*sgProduct.szSubPath != '\0')
    {
      AppendBackSlash(szJSFile, sizeof(szJSFile));
      lstrcat(szJSFile, sgProduct.szSubPath);
    }
    AppendBackSlash(szJSFile, sizeof(szJSFile));
    lstrcat(szJSFile, "defaults\\pref\\");
    CreateDirectoriesAll(szJSFile, ADD_TO_UNINSTALL_LOG);
    lstrcat(szJSFile, FILE_ALL_JS);

    if((fJSFile = fopen(szJSFile, "a+t")) != NULL)
    {
      ZeroMemory(szBuf, sizeof(szBuf));
      if(*diAdvancedSettings.szProxyServer != '\0')
      {
        if(diAdditionalOptions.dwUseProtocol == UP_FTP)
          wsprintf(szBuf,
                   "pref(\"network.proxy.ftp\", \"%s\");\n",
                   diAdvancedSettings.szProxyServer);
        else
          wsprintf(szBuf,
                   "pref(\"network.proxy.http\", \"%s\");\n",
                   diAdvancedSettings.szProxyServer);
      }

      if(*diAdvancedSettings.szProxyPort != '\0')
      {
        if(diAdditionalOptions.dwUseProtocol == UP_FTP)
          wsprintf(szBuf,
                   "pref(\"network.proxy.ftp_port\", %s);\n",
                   diAdvancedSettings.szProxyPort);
        else
          wsprintf(szBuf,
                   "pref(\"network.proxy.http_port\", %s);\n",
                   diAdvancedSettings.szProxyPort);
      }

      lstrcat(szBuf, "pref(\"network.proxy.type\", 1);\n");

      fwrite(szBuf, sizeof(char), lstrlen(szBuf), fJSFile);
      fclose(fJSFile);
    }
  }
}
int VerifyArchive ( LPSTR  szArchive)

Definition at line 402 of file ifuncns.c.

{
  void *vZip;
  int  iTestRv;

  /* Check for the existance of the from (source) file */
  if(!FileExists(szArchive))
    return(FO_ERROR_FILE_NOT_FOUND);

  if((iTestRv = ZIP_OpenArchive(szArchive, &vZip)) == ZIP_OK)
  {
    /* 1st parameter should be NULL or it will fail */
    /* It indicates extract the entire archive */
    iTestRv = ZIP_TestArchive(vZip);
    ZIP_CloseArchive(&vZip);
  }
  return(iTestRv);
}