bRv          = FALSE; szMessage[0] = NULL; szMessage[1] = NULL; szMessage[2] = NULL; bContinue    = TRUE; iIndex       = -1;
bRv             = FALSE; gdwUpgradeValue = UG_NONE; szMessage[0]    = NULL; szMessage[1]    = NULL; szMessage[2]    = NULL; bContinue       = TRUE; iIndex          = -1;
BOOL CheckLegacy(HWND hDlg){  char      szSection[MAX_BUF];  char      szFilename[MAX_BUF];  LPSTR     szMessage[3];  char      szIndex[MAX_BUF];  char      szVersionNew[MAX_BUF];  char      szDecryptedFilePath[MAX_BUF];  int       iIndex;  BOOL      bContinue;  BOOL      bRv;  DWORD     dwRv0;  DWORD     dwRv1;  verBlock  vbVersionNew;  verBlock  vbVersionOld;  bRv          = FALSE;  szMessage[0] = NULL;  szMessage[1] = NULL;  szMessage[2] = NULL;  bContinue    = TRUE;  iIndex       = -1;  while(bContinue)  {    ZeroMemory(szFilename,      sizeof(szFilename));    ZeroMemory(szVersionNew,    sizeof(szVersionNew));    ++iIndex;    itoa(iIndex, szIndex, 10);    lstrcpy(szSection, "Legacy Check");    lstrcat(szSection, szIndex);    dwRv0 = GetPrivateProfileString(szSection, "Filename", "", szFilename, MAX_BUF, szFileIniConfig);    dwRv1 = GetPrivateProfileString(szSection, "Version", "", szVersionNew, MAX_BUF, szFileIniConfig);    if(dwRv0 == 0L)    {      bContinue = FALSE;    }    else if(*szFilename != '\0')    {      if((szMessage[0] = NS_GlobalAlloc(MAX_BUF)) == NULL)      {        bRv = TRUE;        break;      }      if((szMessage[1] = NS_GlobalAlloc(MAX_BUF)) == NULL)      {        bRv = TRUE;        break;      }      if((szMessage[2] = NS_GlobalAlloc(MAX_BUF)) == NULL)      {        bRv = TRUE;        break;      }      lstrcpy(szMessage[0], sgProduct.szPath);      if(*sgProduct.szSubPath != '\0')      {        AppendBackSlash(szMessage[0], MAX_BUF);        lstrcat(szMessage[0], sgProduct.szSubPath);      }      GetPrivateProfileString(szSection, "Message0", "", szMessage[1], MAX_BUF, szFileIniConfig);      GetPrivateProfileString(szSection, "Message1", "", szMessage[2], MAX_BUF, szFileIniConfig);      if((*szMessage[1] == '\0') && (*szMessage[2] == '\0'))        /* no message string input. so just continue with the next check */        continue;      DecryptString(szDecryptedFilePath, szFilename);      if((dwRv1 == 0L) || (*szVersionNew == '\0'))      {        if(FileExists(szDecryptedFilePath))        {          MessageBeep(MB_ICONEXCLAMATION);          if((gdwUpgradeValue = DialogBoxParam(hSetupRscInst, MAKEINTRESOURCE(DLG_UPGRADE), hDlgCurrent, DlgProcUpgrade, (LPARAM)szMessage)) == UG_GOBACK)          {            bRv = TRUE;            break;          }        }        /* file does not exist, so it's okay.  Continue with the next check */        continue;      }      if(GetFileVersion(szDecryptedFilePath, &vbVersionOld))      {        TranslateVersionStr(szVersionNew, &vbVersionNew);        if(CompareVersion(vbVersionOld, vbVersionNew) < 0)        {          MessageBeep(MB_ICONEXCLAMATION);          if((gdwUpgradeValue = DialogBoxParam(hSetupRscInst, MAKEINTRESOURCE(DLG_UPGRADE), hDlgCurrent, DlgProcUpgrade, (LPARAM)szMessage)) == UG_GOBACK)          {            bRv = TRUE;            break;          }        }      }    }  }  FreeMemory(&szMessage[0]);  FreeMemory(&szMessage[1]);  FreeMemory(&szMessage[2]);  /* returning TRUE means the user wants to go back and choose a different destination path   * returning FALSE means the user is ignoring the warning   */  return(bRv);}