lstrcpy(szBuf, sgProduct.szPath); AppendBackSlash(szBuf, sizeof(szBuf));
void DlgSequenceNext(){  HRESULT hrValue;  HRESULT hrErr;  char    szBuf[MAX_PATH];  switch(dwWizardState)  {    case DLG_NONE:      dwWizardState = DLG_WELCOME;      gbProcessingXpnstallFiles = FALSE;      if(diWelcome.bShowDialog)        hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diWelcome.szTitle, DlgProcWelcome);      else        PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);      break;    case DLG_WELCOME:      dwWizardState = DLG_LICENSE;      gbProcessingXpnstallFiles = FALSE;      if(diLicense.bShowDialog)        hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diLicense.szTitle, DlgProcLicense);      else        PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);      break;    case DLG_LICENSE:      dwWizardState = DLG_SETUP_TYPE;      gbProcessingXpnstallFiles = FALSE;      if(diSetupType.bShowDialog)        hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSetupType.szTitle, DlgProcSetupType);      else      {        CheckWizardStateCustom(DLG_ADVANCED_SETTINGS);        PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);      }      break;    case DLG_SETUP_TYPE:      dwWizardState = DLG_SELECT_COMPONENTS;      gbProcessingXpnstallFiles = FALSE;      if(diSelectComponents.bShowDialog)        hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSelectComponents.szTitle, DlgProcSelectComponents);      else        PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);      break;    case DLG_SELECT_COMPONENTS:      dwWizardState = DLG_SELECT_ADDITIONAL_COMPONENTS;      gbProcessingXpnstallFiles = FALSE;      if((diSelectAdditionalComponents.bShowDialog) && (GetAdditionalComponentsCount() > 0))        hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diSelectAdditionalComponents.szTitle, DlgProcSelectAdditionalComponents);      else        PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);      break;    case DLG_SELECT_ADDITIONAL_COMPONENTS:      dwWizardState = DLG_WINDOWS_INTEGRATION;      gbProcessingXpnstallFiles = FALSE;      if(diWindowsIntegration.bShowDialog)        hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diWindowsIntegration.szTitle, DlgProcWindowsIntegration);      else        PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);      break;    case DLG_WINDOWS_INTEGRATION:      dwWizardState = DLG_PROGRAM_FOLDER;      gbProcessingXpnstallFiles = FALSE;      if(diProgramFolder.bShowDialog)        hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diProgramFolder.szTitle, DlgProcProgramFolder);      else      {        dwWizardState = DLG_ADVANCED_SETTINGS;        PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);      }      break;    case DLG_PROGRAM_FOLDER:      dwWizardState = DLG_ADVANCED_SETTINGS;      gbProcessingXpnstallFiles = FALSE;      if(diAdvancedSettings.bShowDialog)        hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diAdvancedSettings.szTitle, DlgAdvancedSettings);      else      {        dwWizardState = DLG_ADVANCED_SETTINGS;        PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);      }      break;    case DLG_ADVANCED_SETTINGS:      dwWizardState = DLG_START_INSTALL;      gbProcessingXpnstallFiles = FALSE;      do      {        hrValue = VerifyDiskSpace();        if(hrValue == IDOK)        {          /* show previous visible window */          dwWizardState = DLG_ADVANCED_SETTINGS;          DlgSequencePrev();          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 */        break;      }      if(diStartInstall.bShowDialog)        hDlgCurrent = InstantiateDialog(hWndMain, dwWizardState, diStartInstall.szTitle, DlgProcStartInstall);      else        PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);      break;    default:      dwWizardState = DLG_START_INSTALL;      gbProcessingXpnstallFiles = TRUE;      /* PRE_DOWNLOAD process file manipulation functions */      ProcessFileOps(T_PRE_DOWNLOAD);      if(RetrieveArchives() == WIZ_OK)      {        /* POST_DOWNLOAD process file manipulation functions */        ProcessFileOps(T_POST_DOWNLOAD);        /* PRE_XPCOM process file manipulation functions */        ProcessFileOps(T_PRE_XPCOM);        ProcessXpcomFile();        /* POST_XPCOM process file manipulation functions */        ProcessFileOps(T_POST_XPCOM);        /* PRE_SMARTUPDATE process file manipulation functions */        ProcessFileOps(T_PRE_SMARTUPDATE);        /* save the installer files in the local machine */        if(bSaveInstallerFiles)          SaveInstallerFiles();        if(CheckInstances())        {          CleanupXpcomFile();          PostQuitMessage(0);          /* break out of switch statment */          break;        }        if(gdwUpgradeValue == UG_DELETE)        {          char szMessage[MAX_BUF];          NS_LoadString(hSetupRscInst, IDS_STR_DELETING_DESTINATION_DIR, szMessage, sizeof(szMessage));          ShowMessage(szMessage, TRUE);          DirectoryRemove(sgProduct.szPath, TRUE);          lstrcpy(szBuf, sgProduct.szPath);          AppendBackSlash(szBuf, sizeof(szBuf));          CreateDirectoriesAll(szBuf, TRUE);          ShowMessage(szMessage, FALSE);        }        lstrcpy(szBuf, sgProduct.szPath);        AppendBackSlash(szBuf, sizeof(szBuf));        lstrcat(szBuf, "Uninstall\\");        CreateDirectoriesAll(szBuf, TRUE);        hrErr = SmartUpdateJars();        if((hrErr == WIZ_OK) || (hrErr == 999))        {          /* POST_SMARTUPDATE process file manipulation functions */          ProcessFileOps(T_POST_SMARTUPDATE);          /* PRE_LAUNCHAPP process file manipulation functions */          ProcessFileOps(T_PRE_LAUNCHAPP);          LaunchApps();          /* POST_LAUNCHAPP process file manipulation functions */          ProcessFileOps(T_POST_LAUNCHAPP);          /* DEPEND_REBOOT process file manipulation functions */          ProcessFileOps(T_DEPEND_REBOOT);          ProcessProgramFolderShowCmd();          if(NeedReboot())          {            CleanupXpcomFile();            hDlgCurrent = InstantiateDialog(hWndMain, DLG_RESTART, diReboot.szTitle, DlgProcReboot);          }          else          {            CleanupXpcomFile();            PostQuitMessage(0);          }        }        else        {          CleanupXpcomFile();          PostQuitMessage(0);        }      }      else      {        bSDUserCanceled = TRUE;        CleanupXpcomFile();        PostQuitMessage(0);      }      gbProcessingXpnstallFiles = FALSE;      break;  }}