int DownloadFiles(char *szInputIniFile, char *szDownloadDir, char *szProxyServer, char *szProxyPort, char *szProxyUser, char *szProxyPasswd, BOOL bShowRetryMsg, BOOL bIgnoreNetworkError, char *szFailedFile, DWORD dwFailedFileSize)
int DownloadFiles(char *szInputIniFile, char *szDownloadDir, char *szProxyServer, char *szProxyPort, char *szProxyUser, char *szProxyPasswd, BOOL bShowRetryMsg, int *iNetRetries, BOOL bIgnoreAllNetworkErrors, char *szFailedFile, DWORD dwFailedFileSize)
int DownloadFiles(char *szInputIniFile, char *szDownloadDir, char *szProxyServer, char *szProxyPort, char *szProxyUser, char *szProxyPasswd, BOOL bShowRetryMsg, BOOL bIgnoreNetworkError, char *szFailedFile, DWORD dwFailedFileSize){  char      szCurrentFile[MAX_BUF];  char      szIndex[MAX_ITOA];  char      szSection[MAX_INI_SK];  char      szSavedCwd[MAX_BUF_MEDIUM];  int       rv;  int       iFileDownloadRetries;  DWORD     dwTotalEstDownloadSize;  if(szInputIniFile == NULL)    return(WIZ_ERROR_UNDEFINED);  if(szFailedFile)    ZeroMemory(szFailedFile, dwFailedFileSize);  GetCurrentDirectory(sizeof(szSavedCwd), szSavedCwd);  SetCurrentDirectory(szDownloadDir);  rv                        = WIZ_OK;  dwTotalEstDownloadSize    = 0;  giTotalArchivesToDownload = 0;  glLastBytesSoFar          = 0;  glAbsoluteBytesSoFar      = 0;  gbUrlChanged              = TRUE;  gbDlgDownloadMinimized    = FALSE;  gbDlgDownloadJustMinimized = FALSE;  gbCancelDownload          = FALSE;  gbShowDownloadRetryMsg    = bShowRetryMsg;  gszConfigIniFile          = szInputIniFile;  GetTotalArchivesToDownload(&giTotalArchivesToDownload, &dwTotalEstDownloadSize);  glTotalKb                 = dwTotalEstDownloadSize;  InitDownloadDlg();  for(giIndex = 0; giIndex < giTotalArchivesToDownload; giIndex++)  {    gbUrlChanged = TRUE;    itoa(giIndex, szIndex, 10);    lstrcpy(szSection, "File");    lstrcat(szSection, szIndex);    GetPrivateProfileString(szSection, "url", "", gszUrl, sizeof(gszUrl), gszConfigIniFile);    if(*gszUrl == '\0')      continue;    GetPrivateProfileString(szSection, "desc", "", gszCurrentDownloadFileDescription, sizeof(gszCurrentDownloadFileDescription), gszConfigIniFile);    if(gbDlgDownloadMinimized)      SetMinimizedDownloadTitle((int)GetPercentSoFar());    else    {      SetStatusUrl();      SetRestoredDownloadTitle();    }    iFileDownloadRetries = 0;    do    {      /* save the file name to be downloaded */      ParsePath(gszUrl, szCurrentFile, sizeof(szCurrentFile), TRUE, PP_FILENAME_ONLY);      /* Download starts here */      if((szProxyServer != NULL) && (szProxyPort != NULL) &&         (*szProxyServer != '\0') && (*szProxyPort != '\0'))        /* If proxy info is provided, use HTTP proxy */        rv = DownloadViaProxy(gszUrl, szProxyServer, szProxyPort, szProxyUser, szProxyPasswd);      else      {        /* is this an HTTP URL? */        if(strncmp(gszUrl, kHTTP, lstrlen(kHTTP)) == 0)          rv = DownloadViaHTTP(gszUrl);        /* or is this an FTP URL? */        else if(strncmp(gszUrl, kFTP, lstrlen(kFTP)) == 0)          rv = DownloadViaFTP(gszUrl);      }      if(rv == nsFTPConn::E_USER_CANCEL)      {        char szFile[MAX_BUF];        lstrcpy(szFile, szDownloadDir);        AppendBackSlash(szFile, sizeof(szFile));        lstrcat(szFile, szCurrentFile);        if(FileExists(szFile))          DeleteFile(szFile);        /* break out of the do loop */        break;      }    } while((rv != nsFTPConn::E_USER_CANCEL) && (rv != nsFTPConn::OK) && (iFileDownloadRetries++ < MAX_FILE_DOWNLOAD_RETRIES));    if(rv == nsFTPConn::E_USER_CANCEL)      /* break out of for() loop */      break;    if((rv != nsFTPConn::OK) && (iFileDownloadRetries >= MAX_FILE_DOWNLOAD_RETRIES) && !bIgnoreNetworkError)    {      /* too many retries from failed downloads */      char szMsg[MAX_BUF];      if(szFailedFile && ((DWORD)lstrlen(szCurrentFile) <= dwFailedFileSize))        lstrcpy(szFailedFile, szCurrentFile);      GetPrivateProfileString("Strings", "Error Too Many Network Errors", "", szMsg, sizeof(szMsg), szFileIniConfig);      if(*szMsg != '\0')      {        char szBuf[MAX_BUF];        wsprintf(szBuf, szMsg, szCurrentFile);        PrintError(szBuf, ERROR_CODE_HIDE);      }      /* Set return value and break out of for() loop.       * We don't want to continue if there were too       * many network errors on any file. */      rv = WIZ_TOO_MANY_NETWORK_ERRORS;      break;    }  }  DeInitDownloadDlg();  SetCurrentDirectory(szSavedCwd);  return(rv);}