dwWizardState = DLG_ADVANCED_SETTINGS;
dwWizardState = DLG_QUICK_LAUNCH;
void DlgSequenceNext(){  HRESULT hrValue;  HRESULT hrErr;  char    szDestPath[MAX_BUF];  char    szInstallLogFile[MAX_BUF];  BOOL    bDone = FALSE;  do  {    switch(dwWizardState)    {      case DLG_NONE:        dwWizardState = DLG_WELCOME;        gbProcessingXpnstallFiles = FALSE;        if(diWelcome.bShowDialog)        {          hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diWelcome.szTitle, DlgProcWelcome);          bDone = TRUE;        }        break;      case DLG_WELCOME:        dwWizardState = DLG_LICENSE;        gbProcessingXpnstallFiles = FALSE;        if(diLicense.bShowDialog)        {          hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diLicense.szTitle, DlgProcLicense);          bDone = TRUE;        }        break;      case DLG_LICENSE:        dwWizardState = DLG_SETUP_TYPE;        gbProcessingXpnstallFiles = FALSE;        if(diSetupType.bShowDialog)        {          hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSetupType.szTitle, DlgProcSetupType);          bDone = TRUE;        }        else        {          CheckWizardStateCustom(DLG_ADVANCED_SETTINGS);        }        break;      case DLG_SETUP_TYPE:        dwWizardState = DLG_SELECT_COMPONENTS;        gbProcessingXpnstallFiles = FALSE;        if(diSelectComponents.bShowDialog)        {          hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSelectComponents.szTitle, DlgProcSelectComponents);          bDone = TRUE;        }        break;      case DLG_SELECT_COMPONENTS:        dwWizardState = DLG_SELECT_ADDITIONAL_COMPONENTS;        gbProcessingXpnstallFiles = FALSE;        if((diSelectAdditionalComponents.bShowDialog) && (GetAdditionalComponentsCount() > 0))        {          hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSelectAdditionalComponents.szTitle, DlgProcSelectAdditionalComponents);          bDone = TRUE;        }        break;      case DLG_SELECT_ADDITIONAL_COMPONENTS:        dwWizardState = DLG_WINDOWS_INTEGRATION;        gbProcessingXpnstallFiles = FALSE;        if(diWindowsIntegration.bShowDialog)        {          hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diWindowsIntegration.szTitle, DlgProcWindowsIntegration);          bDone = TRUE;        }        break;      case DLG_WINDOWS_INTEGRATION:        dwWizardState = DLG_PROGRAM_FOLDER;        gbProcessingXpnstallFiles = FALSE;        if(diProgramFolder.bShowDialog)        {          hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diProgramFolder.szTitle, DlgProcProgramFolder);          bDone = TRUE;        }        else        {          dwWizardState = DLG_ADVANCED_SETTINGS;        }        break;      case DLG_PROGRAM_FOLDER:        dwWizardState = DLG_ADVANCED_SETTINGS;        gbProcessingXpnstallFiles = FALSE;        if(diAdvancedSettings.bShowDialog)        {          hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diAdvancedSettings.szTitle, DlgProcAdvancedSettings);          bDone = TRUE;        }        else        {          dwWizardState = DLG_ADVANCED_SETTINGS;        }        break;      case DLG_ADVANCED_SETTINGS:        dwWizardState = DLG_DOWNLOAD_OPTIONS;        gbProcessingXpnstallFiles = FALSE;        do        {          hrValue = VerifyDiskSpace();          if(hrValue == IDOK)          {            /* show previous visible window */            dwWizardState = DLG_SELECT_COMPONENTS;            DlgSequencePrev();            bDone = TRUE;            break;          }          else if(hrValue == IDCANCEL)          {            AskCancelDlg(hWndMain);            hrValue = IDRETRY;          }        }while(hrValue == IDRETRY);        if(hrValue == IDOK)        {          /* break out of this case because we need to show the previous dialog */          bDone = TRUE;          break;        }        if((diDownloadOptions.bShowDialog == TRUE) && (GetTotalArchivesToDownload() > 0))        {          hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diDownloadOptions.szTitle, DlgProcDownloadOptions);          bDone = TRUE;        }        else        {          dwWizardState = DLG_DOWNLOAD_OPTIONS;        }        break;      case DLG_DOWNLOAD_OPTIONS:        dwWizardState = DLG_START_INSTALL;        gbProcessingXpnstallFiles = FALSE;        if(diStartInstall.bShowDialog)        {          hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diStartInstall.szTitle, DlgProcStartInstall);          bDone = TRUE;        }        break;      default:        dwWizardState = DLG_START_INSTALL;        gbProcessingXpnstallFiles = TRUE;        LogISDestinationPath();        LogISSetupType();        LogISComponentsSelected();        LogISComponentsToDownload();        LogISDiskSpace(gdsnComponentDSRequirement);        lstrcpy(szDestPath, sgProduct.szPath);        if(*sgProduct.szSubPath != '\0')        {          AppendBackSlash(szDestPath, sizeof(szDestPath));          lstrcat(szDestPath, sgProduct.szSubPath);        }        AppendBackSlash(szDestPath, sizeof(szDestPath));        /* Set global var, that determines where the log file is to update, to         * not use the TEMP dir *before* the FileCopy() calls because we want         * to log the FileCopy() calls to where the log files were copied to.         * This is possible because the logging, that is done within the         * FileCopy() function, is done after the actual copy         */        gbILUseTemp = FALSE;        /* copy the install_wizard.log file from the temp\ns_temp dir to         * the destination dir and use the new destination file to continue         * logging.         */        lstrcpy(szInstallLogFile, szTempDir);        AppendBackSlash(szInstallLogFile, sizeof(szInstallLogFile));        lstrcat(szInstallLogFile, FILE_INSTALL_LOG);        FileCopy(szInstallLogFile, szDestPath, FALSE, FALSE);        DeleteFile(szInstallLogFile);        /* copy the install_status.log file from the temp\ns_temp dir to         * the destination dir and use the new destination file to continue         * logging.         */        lstrcpy(szInstallLogFile, szTempDir);        AppendBackSlash(szInstallLogFile, sizeof(szInstallLogFile));        lstrcat(szInstallLogFile, FILE_INSTALL_STATUS_LOG);        FileCopy(szInstallLogFile, szDestPath, FALSE, FALSE);        DeleteFile(szInstallLogFile);        /* PRE_DOWNLOAD process file manipulation functions */        ProcessFileOps(T_PRE_DOWNLOAD, NULL);        /* log if the user selected the turbo mode or not */        if(diStartInstall.bTurboModeEnabled)        {          LogISTurboMode(diStartInstall.bTurboMode);          LogMSTurboMode(diStartInstall.bTurboMode);        }        if(RetrieveArchives() == WIZ_OK)        {          /* POST_DOWNLOAD process file manipulation functions */          ProcessFileOps(T_POST_DOWNLOAD, NULL);          /* PRE_XPCOM process file manipulation functions */          ProcessFileOps(T_PRE_XPCOM, NULL);          if(ProcessXpcomFile() != FO_SUCCESS)          {            bSDUserCanceled = TRUE;            CleanupXpcomFile();            PostQuitMessage(0);            /* break out of switch statment */            bDone = TRUE;            break;          }          /* POST_XPCOM process file manipulation functions */          ProcessFileOps(T_POST_XPCOM, NULL);          /* PRE_SMARTUPDATE process file manipulation functions */          ProcessFileOps(T_PRE_SMARTUPDATE, NULL);          /* save the installer files in the local machine */          if(diDownloadOptions.bSaveInstaller)            SaveInstallerFiles();          if(CheckInstances())          {            bSDUserCanceled = TRUE;            CleanupXpcomFile();            PostQuitMessage(0);            /* break out of switch statment */            bDone = TRUE;            break;          }          lstrcat(szDestPath, "uninstall\\");          CreateDirectoriesAll(szDestPath, TRUE);          /* save the installer files in the local machine */          if(diDownloadOptions.bSaveInstaller)            SaveInstallerFiles();          hrErr = SmartUpdateJars();          if((hrErr == WIZ_OK) || (hrErr == 999))          {            UpdateJSProxyInfo();            /* POST_SMARTUPDATE process file manipulation functions */            ProcessFileOps(T_POST_SMARTUPDATE, NULL);            /* PRE_LAUNCHAPP process file manipulation functions */            ProcessFileOps(T_PRE_LAUNCHAPP, NULL);            LaunchApps();            /* POST_LAUNCHAPP process file manipulation functions */            ProcessFileOps(T_POST_LAUNCHAPP, NULL);            /* DEPEND_REBOOT process file manipulation functions */            ProcessFileOps(T_DEPEND_REBOOT, NULL);            ClearWinRegUninstallFileDeletion();            if(!gbIgnoreProgramFolderX)              ProcessProgramFolderShowCmd();            CleanupArgsRegistry();            CleanupPreviousVersionRegKeys();            if(NeedReboot())            {              CleanupXpcomFile();              hDlgCurrent = InstantiateDialog(hWndMain, DLG_RESTART, diReboot.szTitle, DlgProcReboot);            }            else            {              CleanupXpcomFile();              PostQuitMessage(0);            }          }          else          {            CleanupXpcomFile();            PostQuitMessage(0);          }        }        else        {          bSDUserCanceled = TRUE;          CleanupXpcomFile();          CleanupArgsRegistry();          PostQuitMessage(0);        }        gbProcessingXpnstallFiles = FALSE;        bDone = TRUE;        break;    }  } while(!bDone);}