Back to index

lightning-sunbird  0.9+nobinonly
dialogs.c
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla Communicator client code, released
00016  * March 31, 1998.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Sean Su <ssu@netscape.com>
00025  *   Curt Patrick <curt@netscape.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 #include "extern.h"
00042 #include "extra.h"
00043 #include "dialogs.h"
00044 #include "ifuncns.h"
00045 #include "xpistub.h"
00046 #include "xpi.h"
00047 #include "logging.h"
00048 #include <logkeys.h>
00049 
00050 static PFNWP OldListBoxWndProc;
00051 static BOOL    gbProcessingXpnstallFiles;
00052 static DWORD   gdwACFlag;
00053 static DWORD   gdwIndexLastSelected;
00054 
00055 BOOL AskCancelDlg(HWND hDlg)
00056 {
00057   char szDlgQuitTitle[MAX_BUF];
00058   char szDlgQuitMsg[MAX_BUF];
00059   char szMsg[MAX_BUF];
00060   BOOL bRv = FALSE;
00061 
00062   if((sgProduct.ulMode != SILENT) && (sgProduct.ulMode != AUTO))
00063   {
00064     if(!GetPrivateProfileString("Messages", "DLGQUITTITLE", "", szDlgQuitTitle, sizeof(szDlgQuitTitle), szFileIniInstall))
00065       WinPostQueueMsg(0, WM_QUIT, 1, 0);
00066     else if(!GetPrivateProfileString("Messages", "DLGQUITMSG", "", szDlgQuitMsg, sizeof(szDlgQuitMsg), szFileIniInstall))
00067       WinPostQueueMsg(0, WM_QUIT, 1, 0);
00068     else if(WinMessageBox(HWND_DESKTOP, hDlg, szDlgQuitMsg, szDlgQuitTitle, 0, MB_YESNO | MB_ICONQUESTION | MB_MOVEABLE | MB_DEFBUTTON2 | MB_APPLMODAL) == MBID_YES)
00069     {
00070       WinDestroyWindow(hDlg);
00071       WinPostQueueMsg(0, WM_QUIT, 0, 0);
00072       bRv = TRUE;
00073     }
00074   }
00075   else
00076   {
00077     GetPrivateProfileString("Strings", "Message Cancel Setup AUTO mode", "", szMsg, sizeof(szMsg), szFileIniConfig);
00078     ShowMessage(szMsg, TRUE);
00079     DosSleep(5000);
00080     ShowMessage(szMsg, FALSE);
00081     bRv = TRUE;
00082   }
00083 
00084   return(bRv);
00085 } 
00086 
00087 /* This function relayouts a dialog so that the values used in the */
00088 /* resource files represent real pixel values and are from the upper */
00089 /* left like windows. It does NOT reposition the dialog itself. */
00090 /* It also uses windows type sizing which means that the size specified in */
00091 /* the resource file is the size of the inner dialog */
00092 /* Note that for optimum display at 1024x768, ALL y value in the */
00093 /* resource file must be even */
00094 /* This does NOT work on controls that are bitmaps. */
00095 void AdjustDialogSize(HWND hwndDlg)
00096 {
00097   FONTMETRICS fm;
00098   HPS hps;
00099   float duX, duY;
00100   LONG cxDlgFrame, cyDlgFrame, cyTitleBar;
00101   SWP swpCurrent, swpDlg;
00102   HENUM henum;
00103   HWND hwndNext;
00104   USHORT id;
00105   CHAR classname[4];
00106 
00107   hps = WinGetPS(hwndDlg);
00108   GpiQueryFontMetrics(hps, sizeof(FONTMETRICS), &fm);
00109   WinReleasePS(hps);
00110   duX = fm.lAveCharWidth*0.25;
00111   duY = fm.lMaxBaselineExt*0.125;
00112   cxDlgFrame = WinQuerySysValue(HWND_DESKTOP, SV_CXDLGFRAME);
00113   cyDlgFrame = WinQuerySysValue(HWND_DESKTOP, SV_CYDLGFRAME);
00114   cyTitleBar = WinQuerySysValue(HWND_DESKTOP, SV_CYTITLEBAR);
00115 
00116   WinQueryWindowPos(hwndDlg, &swpDlg);
00117   swpDlg.cx = ((swpDlg.cx-(cxDlgFrame*2))/duX)+(cxDlgFrame*2);
00118   swpDlg.cy = ((swpDlg.cy-cyTitleBar-(cyDlgFrame*2))/duY)+cyTitleBar+(cyDlgFrame*2);
00119   WinSetWindowPos(hwndDlg, 0, 0, 0,
00120                   swpDlg.cx,
00121                   swpDlg.cy,
00122                   SWP_SIZE);
00123 
00124   henum = WinBeginEnumWindows(hwndDlg);
00125   while ((hwndNext = WinGetNextWindow(henum)) != NULLHANDLE)
00126   {
00127     id = WinQueryWindowUShort( hwndNext, QWS_ID );
00128     if ((id == FID_TITLEBAR) ||
00129         (id == FID_SYSMENU) ||
00130         (id == FID_MINMAX) ||
00131         (id == FID_MENU))
00132     {
00133       continue;
00134     }
00135     WinQueryWindowPos(hwndNext, &swpCurrent);
00136     WinQueryClassName(hwndNext, 4, classname);
00137     if (strcmp(classname, "#6") == 0) {
00138       swpCurrent.x += 3;
00139       swpCurrent.y += 3;
00140       swpCurrent.cx -= 6;
00141       swpCurrent.cy -= 6;
00142       WinSetWindowPos(hwndNext, 0,
00143                       (swpCurrent.x-4)/duX+cyDlgFrame+3,
00144                       (swpCurrent.y-4)/duY+cyDlgFrame+3,
00145                       swpCurrent.cx/duX-6,
00146                       swpCurrent.cy/duY-6,
00147                       SWP_MOVE | SWP_SIZE);
00148     } else {
00149       WinSetWindowPos(hwndNext, 0,
00150                       (swpCurrent.x-4)/duX+cyDlgFrame,
00151                       (swpCurrent.y-4)/duY+cyDlgFrame,
00152                       swpCurrent.cx/duX,
00153                       swpCurrent.cy/duY,
00154                       SWP_MOVE | SWP_SIZE);
00155     }
00156   }
00157 }
00158 
00159 MRESULT EXPENTRY DlgProcWelcome(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
00160 {
00161   BOOL rc;
00162   char szBuf[MAX_BUF];
00163   SWP  swpDlg;
00164   
00165   switch(msg)
00166   {
00167     case WM_INITDLG:
00168       AdjustDialogSize(hDlg);
00169       WinSetPresParam(hDlg, PP_FONTNAMESIZE,
00170                       strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
00171       /* Initialize controls */
00172       WinSetWindowText(hDlg, diWelcome.szTitle);
00173       sprintf(szBuf, diWelcome.szMessage0, sgProduct.szProductName, sgProduct.szProductName);
00174       strcat(szBuf, "\n\n");
00175       strcat(szBuf, diWelcome.szMessage1);
00176       strcat(szBuf, "\n\n");
00177       strcat(szBuf, diWelcome.szMessage2);
00178       WinSetDlgItemText(hDlg, IDC_STATIC0, szBuf);
00179 //      WinSetDlgItemText(hDlg, IDC_STATIC1, diWelcome.szMessage1);
00180 //      WinSetDlgItemText(hDlg, IDC_STATIC2, diWelcome.szMessage2);
00181       WinSetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szNext_);
00182       WinSetDlgItemText(hDlg, IDCANCEL, sgInstallGui.szCancel_);
00183 
00184       /* Center dialog */
00185       WinQueryWindowPos(hDlg, &swpDlg);
00186       WinSetWindowPos(hDlg,
00187                       HWND_TOP,
00188                       (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
00189                       (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
00190                       0,
00191                       0,
00192                       SWP_MOVE);
00193       break;
00194 
00195     case WM_CLOSE:
00196       AskCancelDlg(hDlg);
00197       return (MRESULT)TRUE;
00198       break;
00199 
00200     case WM_COMMAND:
00201       switch ( SHORT1FROMMP( mp1 ) )
00202       {
00203         case IDWIZNEXT:
00204           WinDestroyWindow(hDlg);
00205           DlgSequence(NEXT_DLG);
00206           break;
00207 
00208         case DID_CANCEL:
00209           AskCancelDlg(hDlg);
00210           return (MRESULT)TRUE;
00211           break;
00212 
00213         default:
00214           break;
00215       }
00216       break;
00217   }
00218   return(WinDefDlgProc(hDlg, msg, mp1, mp2));
00219 }
00220 
00221 MRESULT EXPENTRY DlgProcLicense(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
00222 {
00223   char            szBuf[MAX_BUF];
00224   LPSTR           szLicenseFilenameBuf = NULL;
00225   DWORD           dwFileSize;
00226   DWORD           dwBytesRead;
00227   HANDLE          hFLicense;
00228   FILE            *fLicense;
00229   SWP             swpDlg;
00230 
00231   switch(msg)
00232   {
00233     case WM_INITDLG:
00234       AdjustDialogSize(hDlg);
00235       WinSetPresParam(hDlg, PP_FONTNAMESIZE,
00236                       strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
00237       /* Initialize controls */
00238       WinSetWindowText(hDlg, diLicense.szTitle);
00239       WinSetDlgItemText(hDlg, IDC_MESSAGE0, diLicense.szMessage0);
00240       WinSetDlgItemText(hDlg, IDC_MESSAGE1, diLicense.szMessage1);
00241       WinSetDlgItemText(hDlg, IDWIZBACK, sgInstallGui.szBack_);
00242       WinSetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szAccept_);
00243       WinSetDlgItemText(hDlg, DID_CANCEL, sgInstallGui.szDecline_);
00244 
00245       /* If LICENSE.TXT exists, read it into the MLE */
00246       strcpy(szBuf, szSetupDir);
00247       AppendBackSlash(szBuf, sizeof(szBuf));
00248       strcat(szBuf, diLicense.szLicenseFilename);
00249 
00250       if((fLicense = fopen(szBuf, "rb")) != NULL)
00251       {
00252         fseek(fLicense, 0L, SEEK_END);
00253         dwFileSize = ftell(fLicense);
00254         fseek(fLicense, 0L, SEEK_SET);
00255         if((szLicenseFilenameBuf = NS_GlobalAlloc(dwFileSize+1)) != NULL) {
00256           dwBytesRead = fread(szLicenseFilenameBuf, sizeof(char), dwFileSize, fLicense);
00257           szLicenseFilenameBuf[dwFileSize] = '\0';
00258           WinSetDlgItemText(hDlg, IDC_EDIT_LICENSE, szLicenseFilenameBuf);
00259           FreeMemory(&szLicenseFilenameBuf);
00260         }
00261         fclose(fLicense);
00262       }
00263 
00264       /* Center dialog */
00265       WinQueryWindowPos(hDlg, &swpDlg);
00266       WinSetWindowPos(hDlg,
00267                       HWND_TOP,
00268                       (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
00269                       (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
00270                       0,
00271                       0,
00272                       SWP_MOVE);
00273       break;
00274 
00275     case WM_CLOSE:
00276       AskCancelDlg(hDlg);
00277       return (MRESULT)TRUE;
00278       break;
00279 
00280     case WM_COMMAND:
00281       switch ( SHORT1FROMMP( mp1 ) )
00282       {
00283         case IDWIZNEXT:
00284           WinDestroyWindow(hDlg);
00285           DlgSequence(NEXT_DLG);
00286           break;
00287 
00288         case IDWIZBACK:
00289           WinDestroyWindow(hDlg);
00290           DlgSequence(PREV_DLG);
00291           break;
00292 
00293         case IDCANCEL:
00294           AskCancelDlg(hDlg);
00295           return (MRESULT)TRUE;
00296           break;
00297 
00298         default:
00299           break;
00300       }
00301       break;
00302   }
00303   return(WinDefDlgProc(hDlg, msg, mp1, mp2));
00304 }
00305 
00306 /* This is our custom directory dialog - pulled from widget with extra voodoo */
00307 MRESULT EXPENTRY DirDialogProc( HWND hwndDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
00308 {
00309    char szBuf[MAX_BUF];
00310    PFILEDLG pfiledlg;
00311    HRESULT hresult;
00312 
00313    switch ( msg ) {
00314       case WM_INITDLG:
00315          {
00316          SWP swpDlgOrig;
00317          SWP swpDlgNew;
00318          SWP swpDirST;
00319          SWP swpDirLB;
00320          SWP swpDriveST;
00321          SWP swpDriveCB;
00322          SWP swpDriveCBEF;
00323          SWP swpOK;
00324          SWP swpCancel;
00325          HWND hwndDirST;
00326          HWND hwndDirLB;
00327          HWND hwndDriveST;
00328          HWND hwndDriveCB;
00329          HWND hwndOK;
00330          HWND hwndCancel;
00331          HWND hwndEF;
00332          HENUM henum;
00333          HWND hwndNext;
00334          ULONG ulCurY, ulCurX;
00335 
00336          WinSetPresParam(hwndDlg, PP_FONTNAMESIZE,
00337                          strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
00338          hwndDirST = WinWindowFromID(hwndDlg, DID_DIRECTORY_TXT);
00339          hwndDirLB = WinWindowFromID(hwndDlg, DID_DIRECTORY_LB);
00340          hwndDriveST = WinWindowFromID(hwndDlg, DID_DRIVE_TXT);
00341          hwndDriveCB = WinWindowFromID(hwndDlg, DID_DRIVE_CB);
00342          hwndOK = WinWindowFromID(hwndDlg, DID_OK);
00343          hwndCancel = WinWindowFromID(hwndDlg, DID_CANCEL);
00344          
00345 #define SPACING 10
00346          // Reposition drives combobox
00347          ulCurY = SPACING;
00348          ulCurX = SPACING + gSystemInfo.lDlgFrameX;
00349          WinQueryWindowPos(hwndOK, &swpOK);
00350          WinSetWindowPos(hwndOK, 0, ulCurX, ulCurY, 0, 0, SWP_MOVE);
00351          ulCurY += swpOK.cy + SPACING;
00352          WinQueryWindowPos(hwndCancel, &swpCancel);
00353          WinSetWindowPos(hwndCancel, 0, ulCurX+swpOK.cx+10, SPACING, 0, 0, SWP_MOVE);
00354          WinQueryWindowPos(hwndDirLB, &swpDirLB);
00355          WinSetWindowPos(hwndDirLB, 0, ulCurX, ulCurY, 0, 0, SWP_MOVE);
00356          ulCurY += swpDirLB.cy + SPACING;
00357          WinQueryWindowPos(hwndDirST, &swpDirST);
00358          WinSetWindowPos(hwndDirST, 0, ulCurX, ulCurY, 0, 0, SWP_MOVE);
00359          ulCurY += swpDirST.cy + SPACING;
00360          WinQueryWindowPos(hwndDriveCB, &swpDriveCB);
00361          WinQueryWindowPos(WinWindowFromID(hwndDriveCB, CBID_EDIT), &swpDriveCBEF);
00362          WinSetWindowPos(hwndDriveCB, 0, ulCurX, ulCurY-(swpDriveCB.cy-swpDriveCBEF.cy)+5,
00363                                          swpDirLB.cx,
00364                                          swpDriveCB.cy,
00365                                          SWP_SIZE | SWP_MOVE);
00366          ulCurY += swpDriveCBEF.cy + SPACING;
00367          WinQueryWindowPos(hwndDriveST, &swpDriveST);
00368          WinSetWindowPos(hwndDriveST, 0, ulCurX, ulCurY, 0, 0, SWP_MOVE);
00369          ulCurY += swpDriveST.cy + SPACING;
00370          // Create an entryfield
00371          hwndEF = WinCreateWindow(hwndDlg, WC_ENTRYFIELD, "", ES_MARGIN | WS_VISIBLE | ES_AUTOSCROLL,
00372                                   ulCurX+3, ulCurY+3,
00373                                   swpDirLB.cx-6, swpDriveCBEF.cy, hwndDlg, HWND_TOP, 777, NULL, NULL);
00374          WinSendMsg(hwndEF, EM_SETTEXTLIMIT, CCHMAXPATH, 0);
00375          ulCurY += swpDriveCBEF.cy + SPACING;
00376 
00377          // Hide unused stuff
00378          henum = WinBeginEnumWindows(hwndDlg);
00379          while ((hwndNext = WinGetNextWindow(henum)) != NULLHANDLE)
00380          {
00381            USHORT usID = WinQueryWindowUShort(hwndNext, QWS_ID);
00382            if (usID != DID_DIRECTORY_TXT &&
00383                usID != DID_DIRECTORY_LB &&
00384                usID != DID_DRIVE_TXT &&
00385                usID != DID_DRIVE_CB &&
00386                usID != DID_OK &&
00387                usID != DID_CANCEL &&
00388                usID != FID_TITLEBAR &&
00389                usID != FID_SYSMENU &&
00390                usID != 777 &&
00391                usID != FID_MINMAX) 
00392            {
00393              WinShowWindow(hwndNext, FALSE);
00394            }
00395          }
00396 
00397          WinSetWindowPos(hwndDlg,
00398                          HWND_TOP,
00399                          (gSystemInfo.lScreenX/2)-((swpDirLB.cx+2*SPACING+2*gSystemInfo.lDlgFrameX)/2),
00400                          (gSystemInfo.lScreenY/2)-((ulCurY+2*gSystemInfo.lDlgFrameY+gSystemInfo.lTitleBarY)/2),
00401                          swpDirLB.cx+2*SPACING+2*gSystemInfo.lDlgFrameX,
00402                          ulCurY+2*gSystemInfo.lDlgFrameY+gSystemInfo.lTitleBarY,
00403                          SWP_MOVE | SWP_SIZE);
00404          }
00405          break;
00406       case WM_CONTROL:
00407          {
00408            if (SHORT1FROMMP(mp1) != 777) {
00409              pfiledlg = (PFILEDLG)WinQueryWindowPtr(hwndDlg, QWL_USER);
00410              RemoveBackSlash(pfiledlg->szFullFile);
00411              WinSetWindowText(WinWindowFromID(hwndDlg,777), pfiledlg->szFullFile);
00412            }
00413          }
00414          break;
00415       case WM_COMMAND:
00416         switch ( SHORT1FROMMP( mp1 ) ) {
00417         case DID_OK:
00418           WinQueryDlgItemText(hwndDlg, 777, MAX_BUF, szBuf);
00419           if(*szBuf != '\0')
00420              hresult = FileExists(szBuf);
00421 
00422           if ((*szBuf == '\0') || ((hresult == TRUE) && (hresult != FILE_DIRECTORY)))
00423           {
00424             char szEDestinationPath[MAX_BUF];
00425 
00426             GetPrivateProfileString("Messages", "ERROR_DESTINATION_PATH", "", szEDestinationPath, sizeof(szEDestinationPath), szFileIniInstall);
00427             WinMessageBox(HWND_DESKTOP, hwndDlg, szEDestinationPath, NULL, 0, MB_OK | MB_ICONEXCLAMATION);
00428             return (MRESULT)TRUE;
00429           }
00430 
00431           if (isFAT(szBuf)) {
00432             GetPrivateProfileString("Messages", "ERROR_FILESYSTEM", "", szBuf, sizeof(szBuf), szFileIniInstall);
00433             WinMessageBox(HWND_DESKTOP, hwndDlg, szBuf, NULL, 0, MB_OK | MB_ICONEXCLAMATION);
00434             return (MRESULT)TRUE;
00435           }
00436 
00437           if(hresult == FALSE)
00438           {
00439             char szMsgCreateDirectory[MAX_BUF];
00440             char szStrCreateDirectory[MAX_BUF];
00441             char szBufTemp[MAX_BUF];
00442             char szBufTemp2[MAX_BUF];
00443 
00444             GetPrivateProfileString("Messages", "STR_CREATE_DIRECTORY", "", szStrCreateDirectory, sizeof(szStrCreateDirectory), szFileIniInstall);
00445             if(GetPrivateProfileString("Messages", "MSG_CREATE_DIRECTORY", "", szMsgCreateDirectory, sizeof(szMsgCreateDirectory), szFileIniInstall))
00446             {
00447               strcpy(szBufTemp, "\n\n");
00448               strcat(szBufTemp, szBuf);
00449               RemoveBackSlash(szBufTemp);
00450               strcat(szBufTemp, "\n\n");
00451               sprintf(szBufTemp2, szMsgCreateDirectory, szBufTemp);
00452             }
00453 
00454             if(WinMessageBox(HWND_DESKTOP, hwndDlg, szBufTemp2, szStrCreateDirectory, 0, MB_YESNO | MB_ICONQUESTION) == IDYES)
00455             {
00456               char szBuf2[MAX_PATH];
00457 
00458               AppendBackSlash(szBuf, sizeof(szBuf));
00459               if(CreateDirectoriesAll(szBuf, TRUE) == FALSE)
00460               {
00461                 char szECreateDirectory[MAX_BUF];
00462 
00463                 strcpy(szBufTemp, "\n\n");
00464                 strcat(szBufTemp, szBuf);
00465                 RemoveBackSlash(szBufTemp);
00466                 strcat(szBufTemp, "\n\n");
00467 
00468                 if(GetPrivateProfileString("Messages", "ERROR_CREATE_DIRECTORY", "", szECreateDirectory, sizeof(szECreateDirectory), szFileIniInstall))
00469                   sprintf(szBuf, szECreateDirectory, szBufTemp);
00470 
00471                 WinMessageBox(HWND_DESKTOP, hwndDlg, szBuf, "", 0, MB_OK | MB_ERROR);
00472                 return (MRESULT)TRUE;
00473               }
00474             } else {
00475              return (MRESULT)TRUE;
00476             }
00477           }
00478           RemoveBackSlash(szBuf);
00479           strcpy(szTempSetupPath, szBuf);
00480           break;
00481 
00482 
00483         }
00484        break;
00485    }      
00486    return WinDefFileDlgProc(hwndDlg, msg, mp1, mp2);
00487 }
00488 
00489 BOOL BrowseForDirectory(HWND hDlg, char *szCurrDir)
00490 { 
00491   FILEDLG        filedlg;
00492   char           ftitle[MAX_PATH];
00493   char           szBuf[MAX_BUF];
00494   char           szSearchPathBuf[MAX_BUF];
00495   char           szDlgBrowseTitle[MAX_BUF];
00496   BOOL           bRet;
00497   char*          caret;
00498 
00499   memset(szDlgBrowseTitle, 0, sizeof(szDlgBrowseTitle));
00500   GetPrivateProfileString("Messages", "DLGBROWSETITLE", "", szDlgBrowseTitle, sizeof(szDlgBrowseTitle), szFileIniInstall);
00501 
00502   memset(&filedlg, 0, sizeof(FILEDLG));
00503   filedlg.cbSize = sizeof(FILEDLG);
00504   filedlg.pszTitle = szDlgBrowseTitle;
00505   strcpy(filedlg.szFullFile, szCurrDir);
00506   strncat(filedlg.szFullFile, "\\", 1);
00507   strncat(filedlg.szFullFile, "^", 1);
00508   filedlg.fl = FDS_OPEN_DIALOG | FDS_CENTER;
00509   filedlg.pfnDlgProc = DirDialogProc;
00510   WinFileDlg(HWND_DESKTOP, hDlg, &filedlg);
00511   caret = strstr(filedlg.szFullFile, "^");
00512   if (caret) {
00513     *(caret-1) = '\0';
00514   } else {
00515     /* Something went horribly wrong. Usually this means they typed a filename */
00516     /* that actually exists. */
00517     /* If this is the case, use the parent directory */
00518   }
00519 
00520   if (filedlg.lReturn == DID_OK) {
00521     bRet = TRUE;
00522   } else {
00523     strcpy(szTempSetupPath, szCurrDir);
00524     bRet = FALSE;
00525   }
00526 
00527   return(bRet);
00528 }
00529 
00530 void TruncateString(HWND hWnd, LPSTR szInURL, LPSTR szOutString, DWORD dwOutStringBufSize)
00531 {
00532   HPS           hpsWnd;
00533   SWP           swpWnd;
00534   RECTL         rectlString = {0,0,1000,1000};
00535   char          *ptr = NULL;
00536   int           iHalfLen;
00537   int           iOutStringLen;
00538 
00539   if((DWORD)strlen(szInURL) > dwOutStringBufSize)
00540     return;
00541 
00542   memset(szOutString, 0, dwOutStringBufSize);
00543   strcpy(szOutString, szInURL);
00544   iOutStringLen = strlen(szOutString);
00545 
00546   hpsWnd = WinGetPS(hWnd);
00547 
00548 
00549   WinQueryWindowPos(hWnd, &swpWnd);
00550 
00551   WinDrawText(hpsWnd, iOutStringLen, szOutString,
00552                               &rectlString, 0, 0, 
00553                               DT_BOTTOM | DT_QUERYEXTENT | DT_TEXTATTRS);
00554   while(rectlString.xRight > swpWnd.cx)
00555   {
00556     iHalfLen = iOutStringLen / 2;
00557     if(iHalfLen == 2)
00558       break;
00559 
00560     ptr = szOutString + iHalfLen;
00561     memmove(ptr - 1, ptr, strlen(ptr) + 1);
00562     szOutString[iHalfLen - 2] = '.';
00563     szOutString[iHalfLen - 1] = '.';
00564     szOutString[iHalfLen]     = '.';
00565     iOutStringLen = strlen(szOutString);
00566     rectlString.xLeft = rectlString.yBottom = 0;
00567     rectlString.xRight = rectlString.yTop = 1000;
00568     WinDrawText(hpsWnd, iOutStringLen, szOutString,
00569                 &rectlString, 0, 0, 
00570                 DT_BOTTOM | DT_QUERYEXTENT | DT_TEXTATTRS);
00571   }
00572 
00573   WinReleasePS(hpsWnd);
00574 }
00575 
00576 
00577 MRESULT EXPENTRY DlgProcSetupType(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
00578 {
00579   HWND          hRadioSt0;
00580   HWND          hStaticSt0;
00581   HWND          hRadioSt1;
00582   HWND          hStaticSt1;
00583   HWND          hRadioSt2;
00584   HWND          hStaticSt2;
00585   HWND          hRadioSt3;
00586   HWND          hStaticSt3;
00587   HWND          hReadme;
00588   HWND          hDestinationPath;
00589   SWP           swpDlg;
00590   char          szBuf[MAX_BUF];
00591   char          szBufTemp[MAX_BUF];
00592   char          szBufTemp2[MAX_BUF];
00593   HRESULT       hresult;
00594   HOBJECT       hobject;
00595 
00596   hRadioSt0   = WinWindowFromID(hDlg, IDC_RADIO_ST0);
00597   hStaticSt0  = WinWindowFromID(hDlg, IDC_STATIC_ST0_DESCRIPTION);
00598   hRadioSt1   = WinWindowFromID(hDlg, IDC_RADIO_ST1);
00599   hStaticSt1  = WinWindowFromID(hDlg, IDC_STATIC_ST1_DESCRIPTION);
00600   hRadioSt2   = WinWindowFromID(hDlg, IDC_RADIO_ST2);
00601   hStaticSt2  = WinWindowFromID(hDlg, IDC_STATIC_ST2_DESCRIPTION);
00602   hRadioSt3   = WinWindowFromID(hDlg, IDC_RADIO_ST3);
00603   hStaticSt3  = WinWindowFromID(hDlg, IDC_STATIC_ST3_DESCRIPTION);
00604   hReadme     = WinWindowFromID(hDlg, IDC_README);
00605 
00606   switch(msg)
00607   {
00608     case WM_INITDLG:
00609       AdjustDialogSize(hDlg);
00610       WinSetPresParam(hDlg, PP_FONTNAMESIZE,
00611                       strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
00612       WinSetWindowText(hDlg, diSetupType.szTitle);
00613 
00614       hDestinationPath = WinWindowFromID(hDlg, IDC_EDIT_DESTINATION); /* handle to the static destination path text window */
00615       strcpy(szTempSetupPath, sgProduct.szPath);
00616       TruncateString(hDestinationPath, szTempSetupPath, szBuf, sizeof(szBuf));
00617 
00618       WinSetDlgItemText(hDlg, IDC_EDIT_DESTINATION, szBuf);
00619       WinSetDlgItemText(hDlg, IDC_STATIC_MSG0, diSetupType.szMessage0);
00620 
00621       if(diSetupType.stSetupType0.bVisible)
00622       {
00623         WinSetDlgItemText(hDlg, IDC_RADIO_ST0, diSetupType.stSetupType0.szDescriptionShort);
00624         WinSetDlgItemText(hDlg, IDC_STATIC_ST0_DESCRIPTION, diSetupType.stSetupType0.szDescriptionLong);
00625         WinShowWindow(hRadioSt0, TRUE);
00626         WinShowWindow(hStaticSt0, TRUE);
00627       }
00628       else
00629       {
00630         WinShowWindow(hRadioSt0, FALSE);
00631         WinShowWindow(hStaticSt0, FALSE);
00632       }
00633 
00634       if(diSetupType.stSetupType1.bVisible)
00635       {
00636         WinSetDlgItemText(hDlg, IDC_RADIO_ST1, diSetupType.stSetupType1.szDescriptionShort);
00637         WinSetDlgItemText(hDlg, IDC_STATIC_ST1_DESCRIPTION, diSetupType.stSetupType1.szDescriptionLong);
00638         WinShowWindow(hRadioSt1, TRUE);
00639         WinShowWindow(hStaticSt1, TRUE);
00640       }
00641       else
00642       {
00643         WinShowWindow(hRadioSt1, FALSE);
00644         WinShowWindow(hStaticSt1, FALSE);
00645       }
00646 
00647       if(diSetupType.stSetupType2.bVisible)
00648       {
00649         WinSetDlgItemText(hDlg, IDC_RADIO_ST2, diSetupType.stSetupType2.szDescriptionShort);
00650         WinSetDlgItemText(hDlg, IDC_STATIC_ST2_DESCRIPTION, diSetupType.stSetupType2.szDescriptionLong);
00651         WinShowWindow(hRadioSt2, TRUE);
00652         WinShowWindow(hStaticSt2, TRUE);
00653       }
00654       else
00655       {
00656         WinShowWindow(hRadioSt2, FALSE);
00657         WinShowWindow(hStaticSt2, FALSE);
00658       }
00659 
00660       if(diSetupType.stSetupType3.bVisible)
00661       {
00662         WinSetDlgItemText(hDlg, IDC_RADIO_ST3, diSetupType.stSetupType3.szDescriptionShort);
00663         WinSetDlgItemText(hDlg, IDC_STATIC_ST3_DESCRIPTION, diSetupType.stSetupType3.szDescriptionLong);
00664         WinShowWindow(hRadioSt3, TRUE);
00665         WinShowWindow(hStaticSt3, TRUE);
00666       }
00667       else
00668       {
00669         WinShowWindow(hRadioSt3, FALSE);
00670         WinShowWindow(hStaticSt3, FALSE);
00671       }
00672 
00673       /* enable the appropriate radio button */
00674       switch(ulTempSetupType)
00675       {
00676         case ST_RADIO0:
00677           WinCheckButton(hDlg, IDC_RADIO_ST0, 1);
00678           WinSetFocus(HWND_DESKTOP, hRadioSt0);
00679           break;
00680 
00681         case ST_RADIO1:
00682           WinCheckButton(hDlg, IDC_RADIO_ST1, 1);
00683           WinSetFocus(HWND_DESKTOP, hRadioSt1);
00684           break;
00685 
00686         case ST_RADIO2:
00687           WinCheckButton(hDlg, IDC_RADIO_ST2, 1);
00688           WinSetFocus(HWND_DESKTOP, hRadioSt2);
00689           break;
00690 
00691         case ST_RADIO3:
00692           WinCheckButton(hDlg, IDC_RADIO_ST3, 1);
00693           WinSetFocus(HWND_DESKTOP, hRadioSt3);
00694           break;
00695       }
00696 
00697       WinQueryWindowPos(hDlg, &swpDlg);
00698       WinSetWindowPos(hDlg,
00699                       HWND_TOP,
00700                       (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
00701                       (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
00702                       0,
00703                       0,
00704                       SWP_MOVE);
00705 
00706       strcpy(szBuf, szSetupDir);
00707       AppendBackSlash(szBuf, sizeof(szBuf));
00708       strcat(szBuf, diSetupType.szReadmeFilename);
00709       if((*diSetupType.szReadmeFilename == '\0') || (FileExists(szBuf) == FALSE))
00710         WinShowWindow(hReadme, FALSE);
00711       else
00712         WinShowWindow(hReadme, TRUE);
00713 
00714       WinSetDlgItemText(hDlg, IDC_DESTINATION, sgInstallGui.szDestinationDirectory);
00715       WinSetDlgItemText(hDlg, IDC_BUTTON_BROWSE, sgInstallGui.szBrowse_);
00716       WinSetDlgItemText(hDlg, IDWIZBACK, sgInstallGui.szBack_);
00717       WinSetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szNext_);
00718       WinSetDlgItemText(hDlg, IDCANCEL, sgInstallGui.szCancel_);
00719       WinSetDlgItemText(hDlg, IDC_README, sgInstallGui.szReadme_);
00720 
00721       if(sgProduct.bLockPath)
00722         WinEnableWindow(WinWindowFromID(hDlg, IDC_BUTTON_BROWSE), FALSE);
00723       else
00724         WinEnableWindow(WinWindowFromID(hDlg, IDC_BUTTON_BROWSE), TRUE);
00725 
00726       break;
00727 
00728     case WM_CLOSE:
00729       AskCancelDlg(hDlg);
00730       return (MRESULT)TRUE;
00731       break;
00732 
00733     case WM_COMMAND:
00734       switch ( SHORT1FROMMP( mp1 ) )
00735       {
00736         case IDC_BUTTON_BROWSE:
00737           if(WinQueryButtonCheckstate(hDlg, IDC_RADIO_ST0)      == 1)
00738             ulTempSetupType = ST_RADIO0;
00739           else if(WinQueryButtonCheckstate(hDlg, IDC_RADIO_ST1) == 1)
00740             ulTempSetupType = ST_RADIO1;
00741           else if(WinQueryButtonCheckstate(hDlg, IDC_RADIO_ST2) == 1)
00742             ulTempSetupType = ST_RADIO2;
00743           else if(WinQueryButtonCheckstate(hDlg, IDC_RADIO_ST3) == 1)
00744             ulTempSetupType = ST_RADIO3;
00745 
00746           BrowseForDirectory(hDlg, szTempSetupPath);
00747 
00748           hDestinationPath = WinWindowFromID(hDlg, IDC_EDIT_DESTINATION); /* handle to the static destination path text window */
00749           TruncateString(hDestinationPath, szTempSetupPath, szBuf, sizeof(szBuf));
00750           WinSetDlgItemText(hDlg, IDC_EDIT_DESTINATION, szBuf);
00751           return (MRESULT)TRUE;
00752           break;
00753 
00754         case IDC_README:
00755           {
00756           char fullReadme[CCHMAXPATH];
00757           strcpy(fullReadme, szSetupDir);
00758           strcat(fullReadme, diSetupType.szReadmeFilename);
00759 
00760           if(*diSetupType.szReadmeApp == '\0')
00761             WinSpawn(diSetupType.szReadmeFilename, NULL, szSetupDir, FALSE);
00762           else
00763             WinSpawn(diSetupType.szReadmeApp, fullReadme, szSetupDir, FALSE);
00764           }
00765           return (MRESULT)TRUE;
00766           break;
00767 
00768         case IDWIZNEXT:
00769           strcpy(sgProduct.szPath, szTempSetupPath);
00770 
00771           strcpy(szBuf, sgProduct.szPath);
00772 
00773           if (isFAT(szBuf)) {
00774             GetPrivateProfileString("Messages", "ERROR_FILESYSTEM", "", szBuf, sizeof(szBuf), szFileIniInstall);
00775             WinMessageBox(HWND_DESKTOP, hDlg, szBuf, NULL, 0, MB_OK | MB_ICONEXCLAMATION);
00776             return (MRESULT)TRUE;
00777           }
00778 
00779           hresult = FileExists(szBuf);
00780           if ((hresult == TRUE) && (hresult != FILE_DIRECTORY))
00781           {
00782             char szEDestinationPath[MAX_BUF];
00783 
00784             GetPrivateProfileString("Messages", "ERROR_DESTINATION_PATH", "", szEDestinationPath, sizeof(szEDestinationPath), szFileIniInstall);
00785             WinMessageBox(HWND_DESKTOP, hDlg, szEDestinationPath, NULL, 0, MB_OK | MB_ICONEXCLAMATION);
00786             return (MRESULT)TRUE;
00787           }
00788 
00789           if(FileExists(szBuf) == FALSE)
00790           {
00791             char szMsgCreateDirectory[MAX_BUF];
00792             char szStrCreateDirectory[MAX_BUF];
00793 
00794             GetPrivateProfileString("Messages", "STR_CREATE_DIRECTORY", "", szStrCreateDirectory, sizeof(szStrCreateDirectory), szFileIniInstall);
00795             if(GetPrivateProfileString("Messages", "MSG_CREATE_DIRECTORY", "", szMsgCreateDirectory, sizeof(szMsgCreateDirectory), szFileIniInstall))
00796             {
00797               strcpy(szBufTemp, "\n\n");
00798               strcat(szBufTemp, szBuf);
00799               RemoveBackSlash(szBufTemp);
00800               strcat(szBufTemp, "\n\n");
00801               sprintf(szBufTemp2, szMsgCreateDirectory, szBufTemp);
00802             }
00803 
00804             if(WinMessageBox(HWND_DESKTOP, hDlg, szBufTemp2, szStrCreateDirectory, 0, MB_YESNO | MB_ICONQUESTION) == MBID_YES)
00805             {
00806               char szBuf2[MAX_PATH];
00807 
00808               /* append a backslash to the path because CreateDirectoriesAll()
00809                  uses a backslash to determine directories */
00810               AppendBackSlash(szBuf, sizeof(szBuf));
00811               if(CreateDirectoriesAll(szBuf, TRUE) == FALSE)
00812               {
00813                 char szECreateDirectory[MAX_BUF];
00814 
00815                 strcpy(szBufTemp, "\n\n");
00816                 strcat(szBufTemp, sgProduct.szPath);
00817                 RemoveBackSlash(szBufTemp);
00818                 strcat(szBufTemp, "\n\n");
00819 
00820                 if(GetPrivateProfileString("Messages", "ERROR_CREATE_DIRECTORY", "", szECreateDirectory, sizeof(szECreateDirectory), szFileIniInstall))
00821                   sprintf(szBuf, szECreateDirectory, szBufTemp);
00822 
00823                 WinMessageBox(HWND_DESKTOP, hDlg, szBuf, "", 0, MB_OK | MB_ERROR);
00824                 return (MRESULT)TRUE;
00825               }
00826 
00827               if(*sgProduct.szSubPath != '\0')
00828               {
00829                  /* log the subpath for uninstallation.  This subpath does not normally get logged
00830                   * for uninstallation due to a chicken and egg problem with creating the log file
00831                   * and the directory its in */
00832                 strcpy(szBuf2, szBuf);
00833                 AppendBackSlash(szBuf2, sizeof(szBuf2));
00834                 strcat(szBuf2, sgProduct.szSubPath);
00835                 UpdateInstallLog(KEY_CREATE_FOLDER, szBuf2, FALSE);
00836               }
00837 
00838               bCreateDestinationDir = TRUE;
00839             }
00840             else
00841             {
00842               return (MRESULT)TRUE;
00843             }
00844           }
00845 
00846           /* retrieve and save the state of the selected radio button */
00847           if(WinQueryButtonCheckstate(hDlg, IDC_RADIO_ST0)      == 1)
00848           {
00849             SiCNodeSetItemsSelected(ST_RADIO0);
00850 
00851             ulSetupType     = ST_RADIO0;
00852             ulTempSetupType = ulSetupType;
00853           }
00854           else if(WinQueryButtonCheckstate(hDlg, IDC_RADIO_ST1) == 1)
00855           {
00856             SiCNodeSetItemsSelected(ST_RADIO1);
00857 
00858             ulSetupType     = ST_RADIO1;
00859             ulTempSetupType = ulSetupType;
00860           }
00861           else if(WinQueryButtonCheckstate(hDlg, IDC_RADIO_ST2) == 1)
00862           {
00863             SiCNodeSetItemsSelected(ST_RADIO2);
00864 
00865             ulSetupType     = ST_RADIO2;
00866             ulTempSetupType = ulSetupType;
00867           }
00868           else if(WinQueryButtonCheckstate(hDlg, IDC_RADIO_ST3) == 1)
00869           {
00870             SiCNodeSetItemsSelected(ST_RADIO3);
00871 
00872             ulSetupType     = ST_RADIO3;
00873             ulTempSetupType = ulSetupType;
00874           }
00875 
00876           WinDestroyWindow(hDlg);
00877           DlgSequence(NEXT_DLG);
00878           break;
00879 
00880         case IDWIZBACK:
00881           ulTempSetupType = ulSetupType;
00882           strcpy(sgProduct.szPath, szTempSetupPath);
00883           WinDestroyWindow(hDlg);
00884           DlgSequence(PREV_DLG);
00885           break;
00886 
00887         case IDCANCEL:
00888           AskCancelDlg(hDlg);
00889           return (MRESULT)TRUE;
00890           break;
00891 
00892         default:
00893           break;
00894       }
00895       break;
00896   }
00897   return(WinDefDlgProc(hDlg, msg, mp1, mp2));
00898 }
00899 
00900 void DrawLBText(POWNERITEM poi, DWORD dwACFlag)
00901 {
00902   siC     *siCTemp  = NULL;
00903   CHAR   chBuffer[MAX_BUF];
00904   DWORD      y;
00905 
00906   siCTemp = SiCNodeGetObject(poi->idItem, FALSE, dwACFlag);
00907   if(siCTemp != NULL)
00908   {
00909     WinSendMsg(poi->hwnd, LM_QUERYITEMTEXT, MPFROM2SHORT(poi->idItem, MAX_BUF), (MPARAM)chBuffer);
00910 
00911     if (poi->fsState != poi->fsStateOld) {
00912       if (!(siCTemp->dwAttributes & SIC_DISABLED))
00913         WinInvertRect(poi->hps, &poi->rclItem);
00914     } else {
00915        ULONG flags = DT_TEXTATTRS | DT_LEFT | DT_VCENTER;
00916        RECTL rclTemp = poi->rclItem;
00917        rclTemp.xLeft += CX_CHECKBOX+4+4;
00918        if(siCTemp->dwAttributes & SIC_DISABLED)
00919          flags |= DT_HALFTONE;
00920        WinFillRect(poi->hps, &rclTemp, CLR_BACKGROUND);
00921        WinDrawText(poi->hps, -1, chBuffer, &rclTemp, 0, 0,
00922                    flags);
00923        if (poi->fsState) {
00924          if (!(siCTemp->dwAttributes & SIC_DISABLED))
00925            WinInvertRect(poi->hps, &poi->rclItem);
00926        }
00927     }
00928     poi->fsState = poi->fsStateOld = 0;
00929   }
00930 }
00931 
00932 void DrawCheck(POWNERITEM poi, DWORD dwACFlag)
00933 {
00934   siC     *siCTemp  = NULL;
00935   HBITMAP hbmpCheckBox;
00936   POINTL ptl;
00937 
00938   siCTemp = SiCNodeGetObject(poi->idItem, FALSE, dwACFlag);
00939   if(siCTemp != NULL)
00940   {
00941     if(!(siCTemp->dwAttributes & SIC_SELECTED))
00942       /* Component is not selected.  Use the unchecked bitmap regardless if the 
00943        * component is disabled or not.  The unchecked bitmap looks the same if
00944        * it's disabled or enabled. */
00945       hbmpCheckBox = GpiLoadBitmap(poi->hps, hSetupRscInst, IDB_BOX_UNCHECKED, CX_CHECKBOX, CY_CHECKBOX);
00946     else if(siCTemp->dwAttributes & SIC_DISABLED)
00947       /* Component is checked and disabled */
00948       hbmpCheckBox = GpiLoadBitmap(poi->hps, hSetupRscInst, IDB_BOX_CHECKED_DISABLED, CX_CHECKBOX, CY_CHECKBOX);
00949     else
00950       /* Component is checked and enabled */
00951       hbmpCheckBox = GpiLoadBitmap(poi->hps, hSetupRscInst, IDB_BOX_CHECKED, CX_CHECKBOX, CY_CHECKBOX);
00952 
00953     ptl.x = poi->rclItem.xLeft+4;
00954     ptl.y = poi->rclItem.yBottom+4; 
00955     WinDrawBitmap(poi->hps, hbmpCheckBox, NULL, &ptl, 0, 0, DBM_NORMAL);
00956     GpiDeleteBitmap(hbmpCheckBox);
00957   }
00958 }
00959 
00960 void InvalidateLBCheckbox(HWND hwndListBox)
00961 {
00962   RECTL rcCheckArea;
00963 
00964   // retrieve the rectangle of all list items to update.
00965   WinQueryWindowRect(hwndListBox, &rcCheckArea);
00966 
00967   // Set the right coordinate of the rectangle to be the same
00968   //   as the right edge of the bitmap drawn.
00969   // But if a screen reader is being used we want to redraw the text
00970   //   as well as the checkbox so we do not set the right coordinate.
00971   if(!gSystemInfo.bScreenReader)
00972     rcCheckArea.xRight = CX_CHECKBOX;
00973 
00974   // It then invalidates the checkbox region to be redrawn.
00975   // Invalidating the region sends a WM_DRAWITEM message to
00976   // the dialog, which redraws the region given the
00977   // node attirbute, in this case it is a bitmap of a
00978   // checked/unchecked checkbox.
00979   WinInvalidateRect(hwndListBox, &rcCheckArea, TRUE);
00980 }
00981   
00982 void ToggleCheck(HWND hwndListBox, DWORD dwIndex, DWORD dwACFlag)
00983 {
00984   BOOL  bMoreToResolve;
00985   LPSTR szToggledReferenceName = NULL;
00986   DWORD dwAttributes;
00987   CHAR tchBuffer[MAX_BUF];
00988 
00989   // Checks to see if the checkbox is checked or not checked, and
00990   // toggles the node attributes appropriately.
00991   dwAttributes = SiCNodeGetAttributes(dwIndex, FALSE, dwACFlag);
00992   if(!(dwAttributes & SIC_DISABLED))
00993   {
00994     if(dwAttributes & SIC_SELECTED)
00995     {
00996       SiCNodeSetAttributes(dwIndex, SIC_SELECTED, FALSE, FALSE, dwACFlag, hwndListBox);
00997 
00998       szToggledReferenceName = SiCNodeGetReferenceName(dwIndex, FALSE, dwACFlag);
00999       ResolveDependees(szToggledReferenceName, hwndListBox);
01000     }
01001     else
01002     {
01003       SiCNodeSetAttributes(dwIndex, SIC_SELECTED, TRUE, FALSE, dwACFlag, hwndListBox);
01004       bMoreToResolve = ResolveDependencies(dwIndex, hwndListBox);
01005 
01006       while(bMoreToResolve)
01007         bMoreToResolve = ResolveDependencies(-1, hwndListBox);
01008 
01009       szToggledReferenceName = SiCNodeGetReferenceName(dwIndex, FALSE, dwACFlag);
01010       ResolveDependees(szToggledReferenceName, hwndListBox);
01011     }
01012     InvalidateLBCheckbox(hwndListBox);
01013   }
01014 }
01015 
01016 // ************************************************************************
01017 // FUNCTION : NewListBoxWndProc( HWND, UINT, WPARAM, LPARAM )
01018 // PURPOSE  : Processes messages for "LISTBOX" class.
01019 // COMMENTS : Prevents the user from moving the window
01020 //            by dragging the titlebar.
01021 // ************************************************************************
01022 MRESULT APIENTRY NewListBoxWndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
01023 {
01024   POINTS ptspointerpos;
01025   USHORT fsflags;
01026   ULONG ulIndex;
01027   
01028   switch(msg)
01029   {
01030     case WM_CHAR:
01031       fsflags = SHORT1FROMMP(mp1);
01032       if (SHORT2FROMMP(mp2) == VK_SPACE) {
01033         if (!(fsflags & KC_KEYUP)) {
01034           ulIndex = WinSendMsg(hWnd,
01035                                LM_QUERYSELECTION,
01036                                0,
01037                                0);
01038           ToggleCheck(hWnd, ulIndex, gdwACFlag);
01039         }
01040       }
01041       break;
01042 
01043     case WM_BUTTON1DOWN:
01044       ptspointerpos.x = SHORT1FROMMP(mp1);
01045       ptspointerpos.y = SHORT2FROMMP(mp1);
01046 
01047       if((ptspointerpos.x >= 0) && (ptspointerpos.x <= CX_CHECKBOX+4+4))
01048       {
01049         MRESULT mr = (OldListBoxWndProc)(hWnd, msg, mp1, mp2);
01050         ulIndex = WinSendMsg(hWnd, LM_QUERYSELECTION, LIT_FIRST, 0);
01051         ToggleCheck(hWnd, ulIndex, gdwACFlag);
01052         return mr;
01053       }
01054       break;
01055   }
01056 
01057   return(OldListBoxWndProc)(hWnd, msg, mp1, mp2);
01058 }
01059 
01060 MRESULT EXPENTRY DlgProcSelectComponents(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
01061 {
01062   BOOL                bReturn = FALSE;
01063   siC                 *siCTemp;
01064   DWORD               dwIndex;
01065   DWORD               dwItems = MAX_BUF;
01066   HWND                hwndLBComponents;
01067   SWP                 swpDlg;
01068   CHAR                tchBuffer[MAX_BUF];
01069   POWNERITEM          pOwnerItem;
01070   ULONG               ulDSBuf;
01071   char                szBuf[MAX_BUF];
01072 
01073   hwndLBComponents  = WinWindowFromID(hDlg, IDC_LIST_COMPONENTS);
01074 
01075   switch(msg)
01076   {
01077     case WM_INITDLG:
01078       AdjustDialogSize(hDlg);
01079       WinSetPresParam(hDlg, PP_FONTNAMESIZE,
01080                       strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
01081       WinSetWindowText(hDlg, diSelectComponents.szTitle);
01082       WinSetDlgItemText(hDlg, IDC_MESSAGE0, diSelectComponents.szMessage0);
01083 
01084       siCTemp = siComponents;
01085       if(siCTemp != NULL)
01086       {
01087         if((!(siCTemp->dwAttributes & SIC_INVISIBLE)) && (!(siCTemp->dwAttributes & SIC_ADDITIONAL)))
01088           WinSendMsg(hwndLBComponents, LM_INSERTITEM, LIT_END, (MPARAM)siCTemp->szDescriptionShort);
01089 
01090         siCTemp = siCTemp->Next;
01091         while((siCTemp != siComponents) && (siCTemp != NULL))
01092         {
01093           if((!(siCTemp->dwAttributes & SIC_INVISIBLE)) && (!(siCTemp->dwAttributes & SIC_ADDITIONAL)))
01094             WinSendMsg(hwndLBComponents, LM_INSERTITEM, LIT_END, (MPARAM)siCTemp->szDescriptionShort);
01095 
01096           siCTemp = siCTemp->Next;
01097         }
01098         WinSetFocus(HWND_DESKTOP, hwndLBComponents);
01099         WinSendMsg(hwndLBComponents, LM_SELECTITEM, 0, 0);
01100         WinSetDlgItemText(hDlg, IDC_STATIC_DESCRIPTION, SiCNodeGetDescriptionLong(0, FALSE, AC_COMPONENTS));
01101       }
01102 
01103       WinQueryWindowPos(hDlg, &swpDlg);
01104       WinSetWindowPos(hDlg,
01105                       HWND_TOP,
01106                       (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
01107                       (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
01108                       0,
01109                       0,
01110                       SWP_MOVE);
01111 
01112       /* update the disk space available info in the dialog.  GetDiskSpaceAvailable()
01113          returns value in kbytes */
01114       ulDSBuf = GetDiskSpaceAvailable(sgProduct.szPath);
01115       _itoa(ulDSBuf, tchBuffer, 10);
01116       ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), FALSE, PP_ROOT_ONLY);
01117       RemoveBackSlash(szBuf);
01118       strcat(szBuf, "   ");
01119       strcat(szBuf, tchBuffer);
01120       strcat(szBuf, " KB");
01121       WinSetDlgItemText(hDlg, IDC_SPACE_AVAILABLE, szBuf);
01122 
01123       WinSetDlgItemText(hDlg, IDC_STATIC1, sgInstallGui.szComponents_);
01124       WinSetDlgItemText(hDlg, IDC_STATIC2, sgInstallGui.szDescription);
01125       WinSetDlgItemText(hDlg, IDC_STATIC3, sgInstallGui.szTotalDownloadSize);
01126       WinSetDlgItemText(hDlg, IDC_STATIC4, sgInstallGui.szSpaceAvailable);
01127       WinSetDlgItemText(hDlg, IDWIZBACK, sgInstallGui.szBack_);
01128       WinSetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szNext_);
01129       WinSetDlgItemText(hDlg, IDCANCEL, sgInstallGui.szCancel_);
01130 
01131       gdwACFlag = AC_COMPONENTS;
01132       OldListBoxWndProc = WinSubclassWindow(hwndLBComponents, (PFNWP)NewListBoxWndProc);
01133       break;
01134 
01135     case WM_MEASUREITEM:
01136       return MRFROM2SHORT(CX_CHECKBOX+4+4, 0);
01137 
01138     case WM_DRAWITEM:
01139       pOwnerItem = (POWNERITEM)mp2;
01140 
01141       // If there are no list box items, skip this message.
01142       if(pOwnerItem->idItem == -1)
01143         break;
01144 
01145       DrawLBText(pOwnerItem, AC_COMPONENTS);
01146       DrawCheck(pOwnerItem, AC_COMPONENTS);
01147 
01148       /* update the disk space required info in the dialog.  It is already
01149          in Kilobytes */
01150       ulDSBuf = GetDiskSpaceRequired(DSR_DOWNLOAD_SIZE);
01151       _itoa(ulDSBuf, tchBuffer, 10);
01152       strcpy(szBuf, tchBuffer);
01153       strcat(szBuf, " KB");
01154       
01155       WinSetDlgItemText(hDlg, IDC_DOWNLOAD_SIZE, szBuf);
01156       return (MRESULT)TRUE;
01157       break;
01158 
01159     case WM_CONTROL:
01160       switch ( SHORT1FROMMP( mp1 ) )
01161       {
01162         case IDC_LIST_COMPONENTS:
01163           /* to update the long description for each component the user selected */
01164           if((dwIndex = WinSendMsg(hwndLBComponents, LM_QUERYSELECTION, 0, 0)) != LIT_NONE)
01165             WinSetDlgItemText(hDlg, IDC_STATIC_DESCRIPTION, SiCNodeGetDescriptionLong(dwIndex, FALSE, AC_COMPONENTS));
01166           break;
01167       }
01168       break;
01169 
01170     case WM_CLOSE:
01171       AskCancelDlg(hDlg);
01172       return (MRESULT)TRUE;
01173       break;
01174 
01175     case WM_COMMAND:
01176       switch ( SHORT1FROMMP( mp1 ) )
01177       {
01178         case IDWIZNEXT:
01179           WinDestroyWindow(hDlg);
01180           DlgSequence(NEXT_DLG);
01181           break;
01182 
01183         case IDWIZBACK:
01184           WinDestroyWindow(hDlg);
01185           DlgSequence(PREV_DLG);
01186           break;
01187 
01188         case IDCANCEL:
01189           AskCancelDlg(hDlg);
01190           return (MRESULT)TRUE;
01191           break;
01192 
01193         default:
01194           break;
01195       }
01196       break;
01197   }
01198 
01199   return(WinDefDlgProc(hDlg, msg, mp1, mp2));
01200 }
01201 
01202 MRESULT EXPENTRY DlgProcSelectAdditionalComponents(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
01203 {
01204   BOOL                bReturn = FALSE;
01205   siC                 *siCTemp;
01206   DWORD               dwIndex;
01207   DWORD               dwItems = MAX_BUF;
01208   HWND                hwndLBComponents;
01209   SWP                 swpDlg;
01210   CHAR                tchBuffer[MAX_BUF];
01211   POWNERITEM          pOwnerItem;
01212   ULONG               ulDSBuf;
01213   char                szBuf[MAX_BUF];
01214 
01215   hwndLBComponents  = WinWindowFromID(hDlg, IDC_LIST_COMPONENTS);
01216 
01217   switch(msg)
01218   {
01219     case WM_INITDLG:
01220       AdjustDialogSize(hDlg);
01221       WinSetPresParam(hDlg, PP_FONTNAMESIZE,
01222                       strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
01223       WinSetWindowText(hDlg, diSelectAdditionalComponents.szTitle);
01224       WinSetDlgItemText(hDlg, IDC_MESSAGE0, diSelectAdditionalComponents.szMessage0);
01225 
01226       siCTemp = siComponents;
01227       if(siCTemp != NULL)
01228       {
01229         if((!(siCTemp->dwAttributes & SIC_INVISIBLE)) && (siCTemp->dwAttributes & SIC_ADDITIONAL))
01230           WinSendMsg(hwndLBComponents, LM_INSERTITEM, LIT_END, (MPARAM)siCTemp->szDescriptionShort);
01231 
01232         siCTemp = siCTemp->Next;
01233         while((siCTemp != siComponents) && (siCTemp != NULL))
01234         {
01235           if((!(siCTemp->dwAttributes & SIC_INVISIBLE)) && (siCTemp->dwAttributes & SIC_ADDITIONAL))
01236             WinSendMsg(hwndLBComponents, LM_INSERTITEM, LIT_END, (MPARAM)siCTemp->szDescriptionShort);
01237 
01238           siCTemp = siCTemp->Next;
01239         }
01240         WinSetFocus(HWND_DESKTOP, hwndLBComponents);
01241         WinSendMsg(hwndLBComponents, LM_SELECTITEM, 0, 0);
01242         WinSetDlgItemText(hDlg, IDC_STATIC_DESCRIPTION, SiCNodeGetDescriptionLong(0, FALSE, AC_ADDITIONAL_COMPONENTS));
01243       }
01244 
01245       WinQueryWindowPos(hDlg, &swpDlg);
01246       WinSetWindowPos(hDlg,
01247                       HWND_TOP,
01248                       (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
01249                       (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
01250                       0,
01251                       0,
01252                       SWP_MOVE);
01253 
01254       /* update the disk space available info in the dialog.  GetDiskSpaceAvailable()
01255          returns value in kbytes */
01256       ulDSBuf = GetDiskSpaceAvailable(sgProduct.szPath);
01257       _itoa(ulDSBuf, tchBuffer, 10);
01258       ParsePath(sgProduct.szPath, szBuf, sizeof(szBuf), FALSE, PP_ROOT_ONLY);
01259       RemoveBackSlash(szBuf);
01260       strcat(szBuf, "   ");
01261       strcat(szBuf, tchBuffer);
01262       strcat(szBuf, " KB");
01263       WinSetDlgItemText(hDlg, IDC_SPACE_AVAILABLE, szBuf);
01264 
01265       WinSetDlgItemText(hDlg, IDC_STATIC1, sgInstallGui.szAdditionalComponents_);
01266       WinSetDlgItemText(hDlg, IDC_STATIC2, sgInstallGui.szDescription);
01267       WinSetDlgItemText(hDlg, IDC_STATIC3, sgInstallGui.szTotalDownloadSize);
01268       WinSetDlgItemText(hDlg, IDC_STATIC4, sgInstallGui.szSpaceAvailable);
01269       WinSetDlgItemText(hDlg, IDWIZBACK, sgInstallGui.szBack_);
01270       WinSetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szNext_);
01271       WinSetDlgItemText(hDlg, IDCANCEL, sgInstallGui.szCancel_);
01272 
01273       gdwACFlag = AC_ADDITIONAL_COMPONENTS;
01274       OldListBoxWndProc = WinSubclassWindow(hwndLBComponents, (PFNWP)NewListBoxWndProc);
01275       break;
01276 
01277     case WM_MEASUREITEM:
01278       return MRFROM2SHORT(CX_CHECKBOX+4+4, 0);
01279 
01280     case WM_DRAWITEM:
01281       pOwnerItem = (POWNERITEM)mp2;
01282 
01283       // If there are no list box items, skip this message.
01284       if(pOwnerItem->idItem == -1)
01285         break;
01286 
01287       DrawLBText(pOwnerItem, AC_ADDITIONAL_COMPONENTS);
01288       DrawCheck(pOwnerItem, AC_ADDITIONAL_COMPONENTS);
01289 
01290       /* update the disk space required info in the dialog.  It is already
01291          in Kilobytes */
01292       ulDSBuf = GetDiskSpaceRequired(DSR_DOWNLOAD_SIZE);
01293       _itoa(ulDSBuf, tchBuffer, 10);
01294       strcpy(szBuf, tchBuffer);
01295       strcat(szBuf, " KB");
01296       
01297       WinSetDlgItemText(hDlg, IDC_DOWNLOAD_SIZE, szBuf);
01298       return (MRESULT)TRUE;
01299       break;
01300 
01301     case WM_CONTROL:
01302       switch ( SHORT1FROMMP( mp1 ) )
01303       {
01304         case IDC_LIST_COMPONENTS:
01305           /* to update the long description for each component the user selected */
01306           if((dwIndex = WinSendMsg(hwndLBComponents, LM_QUERYSELECTION, 0, 0)) != LIT_NONE)
01307             WinSetDlgItemText(hDlg, IDC_STATIC_DESCRIPTION, SiCNodeGetDescriptionLong(dwIndex, FALSE, AC_ADDITIONAL_COMPONENTS));
01308           break;
01309       }
01310       break;
01311 
01312     case WM_CLOSE:
01313       AskCancelDlg(hDlg);
01314       return (MRESULT)TRUE;
01315       break;
01316 
01317     case WM_COMMAND:
01318       switch ( SHORT1FROMMP( mp1 ) )
01319       {
01320         case IDWIZNEXT:
01321           WinDestroyWindow(hDlg);
01322           DlgSequence(NEXT_DLG);
01323           break;
01324 
01325         case IDWIZBACK:
01326           WinDestroyWindow(hDlg);
01327           DlgSequence(PREV_DLG);
01328           break;
01329 
01330         case IDCANCEL:
01331           AskCancelDlg(hDlg);
01332           return (MRESULT)TRUE;
01333           break;
01334 
01335         default:
01336           break;
01337       }
01338       break;
01339   }
01340 
01341   return(WinDefDlgProc(hDlg, msg, mp1, mp2));
01342 }
01343 
01344 MRESULT APIENTRY DlgProcOS2Integration(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
01345 {
01346   char szBuf[MAX_BUF];
01347   HWND hcbCheck0;
01348   HWND hcbCheck1;
01349   HWND hcbCheck2;
01350   HWND hcbCheck3;
01351   HWND hDestinationPath;
01352   SWP                 swpDlg;
01353 
01354   hcbCheck0 = WinWindowFromID(hDlg, IDC_CHECK0);
01355   hcbCheck1 = WinWindowFromID(hDlg, IDC_CHECK1);
01356   hcbCheck2 = WinWindowFromID(hDlg, IDC_CHECK2);
01357   hcbCheck3 = WinWindowFromID(hDlg, IDC_CHECK3);
01358 
01359   switch(msg)
01360   {
01361     case WM_INITDLG:
01362       AdjustDialogSize(hDlg);
01363       WinSetPresParam(hDlg, PP_FONTNAMESIZE,
01364                       strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
01365       WinSetWindowText(hDlg, diOS2Integration.szTitle);
01366 
01367       if (diOS2Integration.szHomeDirectory[0]) {
01368         strcpy(szTempSetupPath, diOS2Integration.szHomeDirectory);
01369         hDestinationPath = WinWindowFromID(hDlg, IDC_EDIT_DESTINATION); /* handle to the static destination path text window */
01370         TruncateString(hDestinationPath, szTempSetupPath, szBuf, sizeof(szBuf));
01371       } else {
01372         strcpy(szTempSetupPath, sgProduct.szPath);
01373         hDestinationPath = WinWindowFromID(hDlg, IDC_EDIT_DESTINATION); /* handle to the static destination path text window */
01374         TruncateString(hDestinationPath, szTempSetupPath, szBuf, sizeof(szBuf));
01375       }
01376 
01377       WinSetDlgItemText(hDlg, IDC_EDIT_DESTINATION, szBuf);
01378 
01379       WinSetDlgItemText(hDlg, IDC_MESSAGE0, diOS2Integration.szMessage0);
01380       WinSetDlgItemText(hDlg, IDC_MESSAGE1, diOS2Integration.szMessage1);
01381 
01382       if(diOS2Integration.oiCBMakeDefaultBrowser.bEnabled)
01383       {
01384         WinShowWindow(hcbCheck0, TRUE);
01385         WinCheckButton(hDlg, IDC_CHECK0, diOS2Integration.oiCBMakeDefaultBrowser.bCheckBoxState);
01386         WinSetDlgItemText(hDlg, IDC_CHECK0, diOS2Integration.oiCBMakeDefaultBrowser.szDescription);
01387       }
01388       else
01389         WinShowWindow(hcbCheck0, FALSE);
01390 
01391       if(diOS2Integration.oiCBAssociateHTML.bEnabled)
01392       {
01393         WinShowWindow(hcbCheck1, TRUE);
01394         WinCheckButton(hDlg, IDC_CHECK1, diOS2Integration.oiCBAssociateHTML.bCheckBoxState);
01395         WinSetDlgItemText(hDlg, IDC_CHECK1, diOS2Integration.oiCBAssociateHTML.szDescription);
01396       }
01397       else
01398         WinShowWindow(hcbCheck1, FALSE);
01399 
01400       if(diOS2Integration.oiCBUpdateCONFIGSYS.bEnabled)
01401       {
01402         WinShowWindow(hcbCheck2, TRUE);
01403         WinCheckButton(hDlg, IDC_CHECK2, diOS2Integration.oiCBUpdateCONFIGSYS.bCheckBoxState);
01404         WinSetDlgItemText(hDlg, IDC_CHECK2, diOS2Integration.oiCBUpdateCONFIGSYS.szDescription);
01405       }
01406       else
01407         WinShowWindow(hcbCheck2, FALSE);
01408 
01409       WinQueryWindowPos(hDlg, &swpDlg);
01410       WinSetWindowPos(hDlg,
01411                       HWND_TOP,
01412                       (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
01413                       (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
01414                       0,
01415                       0,
01416                       SWP_MOVE);
01417 
01418       WinSetDlgItemText(hDlg, IDC_BUTTON_BROWSE, sgInstallGui.szBrowse_);
01419       WinSetDlgItemText(hDlg, IDWIZBACK, sgInstallGui.szBack_);
01420       WinSetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szNext_);
01421       WinSetDlgItemText(hDlg, IDCANCEL, sgInstallGui.szCancel_);
01422       break;
01423 
01424     case WM_CLOSE:
01425       AskCancelDlg(hDlg);
01426       return (MRESULT)TRUE;
01427       break;
01428 
01429     case WM_COMMAND:
01430       switch ( SHORT1FROMMP( mp1 ) )
01431       {
01432         case IDC_BUTTON_BROWSE:
01433           if (BrowseForDirectory(hDlg, szTempSetupPath)) {
01434             strcpy(diOS2Integration.szHomeDirectory, szTempSetupPath);
01435           }
01436 
01437           hDestinationPath = WinWindowFromID(hDlg, IDC_EDIT_DESTINATION); /* handle to the static destination path text window */
01438           TruncateString(hDestinationPath, szTempSetupPath, szBuf, sizeof(szBuf));
01439           WinSetDlgItemText(hDlg, IDC_EDIT_DESTINATION, szBuf);
01440           return (MRESULT)TRUE;
01441           break;
01442         case IDWIZNEXT:
01443           if(diOS2Integration.oiCBMakeDefaultBrowser.bEnabled)
01444           {
01445             if(WinQueryButtonCheckstate(hDlg, IDC_CHECK0) == 1)
01446               diOS2Integration.oiCBMakeDefaultBrowser.bCheckBoxState = TRUE;
01447             else
01448               diOS2Integration.oiCBMakeDefaultBrowser.bCheckBoxState = FALSE;
01449           }
01450 
01451           if(diOS2Integration.oiCBAssociateHTML.bEnabled)
01452           {
01453             if(WinQueryButtonCheckstate(hDlg, IDC_CHECK1) == 1)
01454               diOS2Integration.oiCBAssociateHTML.bCheckBoxState = TRUE;
01455             else
01456               diOS2Integration.oiCBAssociateHTML.bCheckBoxState = FALSE;
01457           }
01458 
01459           if(diOS2Integration.oiCBUpdateCONFIGSYS.bEnabled)
01460           {
01461             if(WinQueryButtonCheckstate(hDlg, IDC_CHECK2) == 1)
01462               diOS2Integration.oiCBUpdateCONFIGSYS.bCheckBoxState = TRUE;
01463             else
01464               diOS2Integration.oiCBUpdateCONFIGSYS.bCheckBoxState = FALSE;
01465           }
01466 
01467           WinDestroyWindow(hDlg);
01468           DlgSequence(NEXT_DLG);
01469           break;
01470 
01471         case IDWIZBACK:
01472           WinDestroyWindow(hDlg);
01473           DlgSequence(PREV_DLG);
01474           break;
01475 
01476         case IDCANCEL:
01477           AskCancelDlg(hDlg);
01478           return (MRESULT)TRUE;
01479           break;
01480 
01481         default:
01482           break;
01483       }
01484       break;
01485   }
01486   return(WinDefDlgProc(hDlg, msg, mp1, mp2));
01487 }
01488 
01489 void SaveDownloadProtocolOption(HWND hDlg)
01490 {
01491   if(WinQueryButtonCheckstate(hDlg, IDC_USE_FTP) == 1)
01492     diAdditionalOptions.dwUseProtocol = UP_FTP;
01493   else if(WinQueryButtonCheckstate(hDlg, IDC_USE_HTTP) == 1)
01494     diAdditionalOptions.dwUseProtocol = UP_HTTP;
01495 }
01496 
01497 MRESULT EXPENTRY DlgProcAdvancedSettings(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
01498 {
01499   SWP   swpDlg;
01500   char  szBuf[MAX_BUF];
01501 
01502   switch(msg)
01503   {
01504     case WM_INITDLG:
01505       AdjustDialogSize(hDlg);
01506       WinSetPresParam(hDlg, PP_FONTNAMESIZE,
01507                       strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
01508       WinSetWindowText(hDlg, diAdvancedSettings.szTitle);
01509       WinSetDlgItemText(hDlg, IDC_MESSAGE0,          diAdvancedSettings.szMessage0);
01510       WinSetDlgItemText(hDlg, IDC_EDIT_PROXY_SERVER, diAdvancedSettings.szProxyServer);
01511       WinSetDlgItemText(hDlg, IDC_EDIT_PROXY_PORT,   diAdvancedSettings.szProxyPort);
01512       WinSetDlgItemText(hDlg, IDC_EDIT_PROXY_USER,   diAdvancedSettings.szProxyUser);
01513       WinSetDlgItemText(hDlg, IDC_EDIT_PROXY_PASSWD, diAdvancedSettings.szProxyPasswd);
01514 
01515       WinQueryWindowPos(hDlg, &swpDlg);
01516       WinSetWindowPos(hDlg,
01517                       HWND_TOP,
01518                       (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
01519                       (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
01520                       0,
01521                       0,
01522                       SWP_MOVE);
01523 
01524       GetPrivateProfileString("Strings", "IDC Use FTP", "", szBuf, sizeof(szBuf), szFileIniConfig);
01525       WinSetDlgItemText(hDlg, IDC_USE_FTP, szBuf);
01526       GetPrivateProfileString("Strings", "IDC Use HTTP", "", szBuf, sizeof(szBuf), szFileIniConfig);
01527       WinSetDlgItemText(hDlg, IDC_USE_HTTP, szBuf);
01528 
01529       WinSetDlgItemText(hDlg, IDC_STATIC, sgInstallGui.szProxySettings);
01530       WinSetDlgItemText(hDlg, IDC_STATIC1, sgInstallGui.szServer);
01531       WinSetDlgItemText(hDlg, IDC_STATIC2, sgInstallGui.szPort);
01532       WinSetDlgItemText(hDlg, IDC_STATIC3, sgInstallGui.szUserId);
01533       WinSetDlgItemText(hDlg, IDC_STATIC4, sgInstallGui.szPassword);
01534       WinSetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szOk_);
01535       WinSetDlgItemText(hDlg, IDCANCEL, sgInstallGui.szCancel_);
01536 
01537       switch(diAdditionalOptions.dwUseProtocol)
01538       {
01539         case UP_HTTP:
01540           WinCheckButton(hDlg, IDC_USE_FTP,  0);
01541           WinCheckButton(hDlg, IDC_USE_HTTP, 1);
01542           break;
01543 
01544         case UP_FTP:
01545         default:
01546           WinCheckButton(hDlg, IDC_USE_FTP,  1);
01547           WinCheckButton(hDlg, IDC_USE_HTTP, 0);
01548           break;
01549 
01550       }
01551 
01552       if((diAdditionalOptions.bShowProtocols) && (diAdditionalOptions.bUseProtocolSettings))
01553       {
01554         WinShowWindow(WinWindowFromID(hDlg, IDC_USE_FTP),  TRUE);
01555         WinShowWindow(WinWindowFromID(hDlg, IDC_USE_HTTP), TRUE);
01556       }
01557       else
01558       {
01559         WinShowWindow(WinWindowFromID(hDlg, IDC_USE_FTP),  FALSE);
01560         WinShowWindow(WinWindowFromID(hDlg, IDC_USE_HTTP), FALSE);
01561       }
01562 
01563       break;
01564 
01565     case WM_CLOSE:
01566       AskCancelDlg(hDlg);
01567       return (MRESULT)TRUE;
01568       break;
01569 
01570     case WM_COMMAND:
01571       switch ( SHORT1FROMMP( mp1 ) )
01572       {
01573         case IDWIZNEXT:
01574           /* get the proxy server and port information */
01575           WinQueryDlgItemText(hDlg, IDC_EDIT_PROXY_SERVER, MAX_BUF, diAdvancedSettings.szProxyServer);
01576           WinQueryDlgItemText(hDlg, IDC_EDIT_PROXY_PORT,   MAX_BUF, diAdvancedSettings.szProxyPort);
01577           WinQueryDlgItemText(hDlg, IDC_EDIT_PROXY_USER,   MAX_BUF, diAdvancedSettings.szProxyUser);
01578           WinQueryDlgItemText(hDlg, IDC_EDIT_PROXY_PASSWD, MAX_BUF, diAdvancedSettings.szProxyPasswd);
01579 
01580           SaveDownloadProtocolOption(hDlg);
01581           WinDestroyWindow(hDlg);
01582           DlgSequence(NEXT_DLG);
01583           break;
01584 
01585         case IDWIZBACK:
01586         case IDCANCEL:
01587           WinDestroyWindow(hDlg);
01588           DlgSequence(PREV_DLG);
01589           break;
01590 
01591         default:
01592           break;
01593       }
01594       break;
01595   }
01596   return(WinDefDlgProc(hDlg, msg, mp1, mp2));
01597 }
01598 
01599 void SaveAdditionalOptions(HWND hDlg, HWND hwndCBSiteSelector)
01600 {
01601   int iIndex;
01602 
01603   /* get selected item from the site selector's pull down list */
01604   iIndex = WinSendMsg(hwndCBSiteSelector, LM_QUERYSELECTION, 0, 0);
01605   WinSendMsg(hwndCBSiteSelector, LM_QUERYITEMTEXT, MPFROM2SHORT(iIndex, MAX_BUF), (MPARAM)szSiteSelectorDescription);
01606 
01607   /* get the state of the Save Installer Files checkbox */
01608   if(WinQueryButtonCheckstate(hDlg, IDC_CHECK_SAVE_INSTALLER_FILES) == 1)
01609     diAdditionalOptions.bSaveInstaller = TRUE;
01610   else
01611     diAdditionalOptions.bSaveInstaller = FALSE;
01612 
01613   /* get the state of the Recapture Homepage checkbox */
01614   if(WinQueryButtonCheckstate(hDlg, IDC_CHECK_RECAPTURE_HOMEPAGE) == 1)
01615     diAdditionalOptions.bRecaptureHomepage = TRUE;
01616   else
01617     diAdditionalOptions.bRecaptureHomepage = FALSE;
01618 }
01619 
01620 MRESULT EXPENTRY DlgProcAdditionalOptions(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
01621 {
01622   SWP   swpDlg;
01623   char  szBuf[MAX_BUF];
01624   HWND  hwndCBSiteSelector;
01625   int   iIndex;
01626   ssi   *ssiTemp;
01627   char  szCBDefault[MAX_BUF];
01628 
01629   hwndCBSiteSelector = WinWindowFromID(hDlg, IDC_LIST_SITE_SELECTOR);
01630 
01631   switch(msg)
01632   {
01633     case WM_INITDLG:
01634       AdjustDialogSize(hDlg);
01635       WinSetPresParam(hDlg, PP_FONTNAMESIZE,
01636                       strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
01637 //      if(gdwSiteSelectorStatus == SS_HIDE)
01638 //      {
01639 //        WinShowWindow(WinWindowFromID(hDlg, IDC_MESSAGE0),  FALSE);
01640 //        WinShowWindow(WinWindowFromID(hDlg, IDC_LIST_SITE_SELECTOR),  FALSE);
01641 //      }
01642 
01643       if(diAdditionalOptions.bShowHomepageOption == FALSE)
01644       {
01645         WinShowWindow(WinWindowFromID(hDlg, IDC_MESSAGE0),  FALSE);
01646         WinShowWindow(WinWindowFromID(hDlg, IDC_CHECK_RECAPTURE_HOMEPAGE),  FALSE);
01647       }
01648 
01649       if(GetTotalArchivesToDownload() == 0)
01650      {
01651         WinShowWindow(WinWindowFromID(hDlg, IDC_MESSAGE1),  FALSE);
01652         WinShowWindow(WinWindowFromID(hDlg, IDC_CHECK_SAVE_INSTALLER_FILES),  FALSE);
01653         WinShowWindow(WinWindowFromID(hDlg, IDC_EDIT_LOCAL_INSTALLER_PATH), FALSE);
01654         WinShowWindow(WinWindowFromID(hDlg, IDC_BUTTON_PROXY_SETTINGS), FALSE);
01655       }
01656 
01657       WinSetWindowText(hDlg, diAdditionalOptions.szTitle);
01658       WinSetDlgItemText(hDlg, IDC_MESSAGE0, diAdditionalOptions.szMessage0);
01659       WinSetDlgItemText(hDlg, IDC_MESSAGE1, diAdditionalOptions.szMessage1);
01660 
01661       GetPrivateProfileString("Strings", "IDC Save Installer Files", "", szBuf, sizeof(szBuf), szFileIniConfig);
01662       WinSetDlgItemText(hDlg, IDC_CHECK_SAVE_INSTALLER_FILES, szBuf);
01663       GetPrivateProfileString("Strings", "IDC Recapture Homepage", "", szBuf, sizeof(szBuf), szFileIniConfig);
01664       WinSetDlgItemText(hDlg, IDC_CHECK_RECAPTURE_HOMEPAGE, szBuf);
01665 
01666       GetSaveInstallerPath(szBuf, sizeof(szBuf));
01667       WinSetDlgItemText(hDlg, IDC_EDIT_LOCAL_INSTALLER_PATH, szBuf);
01668 
01669       WinSetDlgItemText(hDlg, IDC_BUTTON_PROXY_SETTINGS, sgInstallGui.szProxySettings_);
01670       WinSetDlgItemText(hDlg, IDWIZBACK, sgInstallGui.szBack_);
01671       WinSetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szNext_);
01672       WinSetDlgItemText(hDlg, IDCANCEL, sgInstallGui.szCancel_);
01673 
01674       WinQueryWindowPos(hDlg, &swpDlg);
01675       WinSetWindowPos(hDlg,
01676                       HWND_TOP,
01677                       (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
01678                       (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
01679                       0,
01680                       0,
01681                       SWP_MOVE);
01682 
01683       ssiTemp = ssiSiteSelector;
01684       do
01685       {
01686         if(ssiTemp == NULL)
01687           break;
01688 
01689         WinSendMsg(hwndCBSiteSelector, LM_INSERTITEM, 0, (LPARAM)(ssiTemp->szDescription));
01690         ssiTemp = ssiTemp->Next;
01691       } while(ssiTemp != ssiSiteSelector);
01692 
01693       if((szSiteSelectorDescription == NULL) || (*szSiteSelectorDescription == '\0'))
01694       {
01695           if(GetPrivateProfileString("Messages", "CB_DEFAULT", "", szCBDefault, sizeof(szCBDefault), szFileIniInstall) &&
01696           ((iIndex = WinSendMsg(hwndCBSiteSelector, LM_SEARCHSTRING, MPFROM2SHORT(0, LIT_FIRST), (LPARAM)szCBDefault)) != LIT_NONE))
01697           WinSendMsg(hwndCBSiteSelector, LM_SELECTITEM, (WPARAM)iIndex, 0);
01698         else
01699           WinSendMsg(hwndCBSiteSelector, LM_SELECTITEM, 0, 0);
01700       }
01701       else if((iIndex = WinSendMsg(hwndCBSiteSelector, LM_SEARCHSTRING, MPFROM2SHORT(0, LIT_FIRST), (LPARAM)szSiteSelectorDescription)) != LIT_NONE)
01702         WinSendMsg(hwndCBSiteSelector, LM_SELECTITEM, (WPARAM)iIndex, 0);
01703       else
01704         WinSendMsg(hwndCBSiteSelector, LM_SELECTITEM, 0, 0);
01705 
01706       if(diAdditionalOptions.bSaveInstaller)
01707         WinCheckButton(hDlg, IDC_CHECK_SAVE_INSTALLER_FILES, 1);
01708       else
01709         WinCheckButton(hDlg, IDC_CHECK_SAVE_INSTALLER_FILES, 0);
01710 
01711       if(diAdditionalOptions.bRecaptureHomepage)
01712         WinCheckButton(hDlg, IDC_CHECK_RECAPTURE_HOMEPAGE, 1);
01713       else
01714         WinCheckButton(hDlg, IDC_CHECK_RECAPTURE_HOMEPAGE, 0);
01715 
01716       break;
01717 
01718     case WM_CLOSE:
01719       AskCancelDlg(hDlg);
01720       return (MRESULT)TRUE;
01721       break;
01722 
01723     case WM_COMMAND:
01724       switch ( SHORT1FROMMP( mp1 ) )
01725       {
01726         case IDWIZNEXT:
01727           SaveAdditionalOptions(hDlg, hwndCBSiteSelector);
01728           WinDestroyWindow(hDlg);
01729           DlgSequence(NEXT_DLG);
01730           break;
01731 
01732         case IDWIZBACK:
01733           SaveAdditionalOptions(hDlg, hwndCBSiteSelector);
01734           WinDestroyWindow(hDlg);
01735           DlgSequence(PREV_DLG);
01736           break;
01737 
01738         case IDC_BUTTON_ADDITIONAL_SETTINGS:
01739           SaveAdditionalOptions(hDlg, hwndCBSiteSelector);
01740           WinDestroyWindow(hDlg);
01741           DlgSequence(OTHER_DLG_1);
01742           break;
01743 
01744         case IDCANCEL:
01745           AskCancelDlg(hDlg);
01746           return (MRESULT)TRUE;
01747           break;
01748 
01749         default:
01750           break;
01751       }
01752       break;
01753   }
01754   return(WinDefDlgProc(hDlg, msg, mp1, mp2));
01755 }
01756 
01757 void AppendStringWOTilde(LPSTR szInputString, DWORD dwInputStringSize, LPSTR szString)
01758 {
01759   DWORD i;
01760   DWORD iInputStringCounter;
01761   DWORD iInputStringLen;
01762   DWORD iStringLen;
01763 
01764 
01765   iInputStringLen = strlen(szInputString);
01766   iStringLen      = strlen(szString);
01767 
01768   if((iInputStringLen + iStringLen) >= dwInputStringSize)
01769     return;
01770 
01771   iInputStringCounter = iInputStringLen;
01772   for(i = 0; i < iStringLen; i++)
01773   {
01774     if(szString[i] != '~')
01775       szInputString[iInputStringCounter++] = szString[i];
01776     else
01777       if (szString[i-1] == '(') {
01778          szInputString[iInputStringCounter-1] = '\0';
01779          break;
01780       }
01781   }
01782 }
01783 
01784 LPSTR GetStartInstallMessage()
01785 {
01786   char  szBuf[MAX_BUF];
01787   char  szSTRRequired[MAX_BUF_TINY];
01788   siC   *siCObject   = NULL;
01789   LPSTR szMessageBuf = NULL;
01790   DWORD dwBufSize;
01791   DWORD dwIndex0;
01792 
01793   GetPrivateProfileString("Strings", "STR Force Upgrade Required", "", szSTRRequired, sizeof(szSTRRequired), szFileIniConfig);
01794 
01795   /* calculate the amount of memory to allocate for the buffer */
01796   dwBufSize = 0;
01797 
01798   /* setup type */
01799   if(GetPrivateProfileString("Messages", "STR_SETUP_TYPE", "", szBuf, sizeof(szBuf), szFileIniInstall))
01800     dwBufSize += strlen(szBuf) + 2; // the extra 2 bytes is for the \r\n characters
01801   dwBufSize += 4; // take into account 4 indentation spaces
01802 
01803   switch(ulSetupType)
01804   {
01805     case ST_RADIO3:
01806       dwBufSize += strlen(diSetupType.stSetupType3.szDescriptionShort) + 2; // the extra 2 bytes is for the \r\n characters
01807       break;
01808 
01809     case ST_RADIO2:
01810       dwBufSize += strlen(diSetupType.stSetupType2.szDescriptionShort) + 2; // the extra 2 bytes is for the \r\n characters
01811       break;
01812 
01813     case ST_RADIO1:
01814       dwBufSize += strlen(diSetupType.stSetupType1.szDescriptionShort) + 2; // the extra 2 bytes is for the \r\n characters
01815       break;
01816 
01817     default:
01818       dwBufSize += strlen(diSetupType.stSetupType0.szDescriptionShort) + 2; // the extra 2 bytes is for the \r\n characters
01819       break;
01820   }
01821   dwBufSize += 2; // the extra 2 bytes is for the \r\n characters
01822 
01823   /* selected components */
01824   if(GetPrivateProfileString("Messages", "STR_SELECTED_COMPONENTS", "", szBuf, sizeof(szBuf), szFileIniInstall))
01825     dwBufSize += strlen(szBuf) + 2; // the extra 2 bytes is for the \r\n characters
01826 
01827   dwIndex0 = 0;
01828   siCObject = SiCNodeGetObject(dwIndex0, FALSE, AC_ALL);
01829   while(siCObject)
01830   {
01831     if(siCObject->dwAttributes & SIC_SELECTED)
01832     {
01833       dwBufSize += 4; // take into account 4 indentation spaces
01834       dwBufSize += strlen(siCObject->szDescriptionShort);
01835     }
01836 
01837     if(siCObject->bForceUpgrade)
01838     {
01839       /* add the "(Required)" string (or something equivalent) after the component description */
01840       if(*szSTRRequired != '\0')
01841       {
01842         dwBufSize += 1; // space after the short description
01843         dwBufSize += strlen(szSTRRequired);
01844       }
01845     }
01846 
01847     if(siCObject->dwAttributes & SIC_SELECTED)
01848       dwBufSize += 2; // the extra 2 bytes is for the \r\n characters
01849 
01850     ++dwIndex0;
01851     siCObject = SiCNodeGetObject(dwIndex0, FALSE, AC_ALL);
01852   }
01853   dwBufSize += 2; // the extra 2 bytes is for the \r\n characters
01854 
01855   /* destination path */
01856   if(GetPrivateProfileString("Messages", "STR_DESTINATION_DIRECTORY", "", szBuf, sizeof(szBuf), szFileIniInstall))
01857     dwBufSize += strlen(szBuf) + 2; // the extra 2 bytes is for the \r\n characters
01858 
01859   dwBufSize += 4; // take into account 4 indentation spaces
01860   dwBufSize += strlen(sgProduct.szPath) + 2; // the extra 2 bytes is for the \r\n characters
01861   dwBufSize += 2; // the extra 2 bytes is for the \r\n characters
01862 
01863   if(GetTotalArchivesToDownload() > 0)
01864   {
01865     dwBufSize += 2; // the extra 2 bytes is for the \r\n characters
01866 
01867     /* site selector info */
01868     if(GetPrivateProfileString("Messages", "STR_DOWNLOAD_SITE", "", szBuf, sizeof(szBuf), szFileIniInstall))
01869       dwBufSize += strlen(szBuf) + 2; // the extra 2 bytes is for the \r\n characters
01870 
01871     dwBufSize += 4; // take into account 4 indentation spaces
01872     dwBufSize += strlen(szSiteSelectorDescription) + 2; // the extra 2 bytes is for the \r\n characters
01873 
01874     if(diAdditionalOptions.bSaveInstaller)
01875     {
01876       dwBufSize += 2; // the extra 2 bytes is for the \r\n characters
01877 
01878       /* site selector info */
01879       if(GetPrivateProfileString("Messages", "STR_SAVE_INSTALLER_FILES", "", szBuf, sizeof(szBuf), szFileIniInstall))
01880         dwBufSize += strlen(szBuf) + 2; // the extra 2 bytes is for the \r\n characters
01881 
01882       GetSaveInstallerPath(szBuf, sizeof(szBuf));
01883       dwBufSize += 4; // take into account 4 indentation spaces
01884       dwBufSize += strlen(szBuf) + 2; // the extra 2 bytes is for the \r\n characters
01885     }
01886   }
01887 
01888   dwBufSize += 1; // take into account the null character
01889 
01890 
01891   /* From here down, the buffer is created given the above calculated buffer size.  If the 
01892    * string concatenation (addition) is changed below, then the buffer size calculation above
01893    * needs to be changed accordingly! */
01894 
01895   /* allocate the memory */
01896   if((szMessageBuf = NS_GlobalAlloc(dwBufSize)) != NULL)
01897   {
01898     memset(szMessageBuf, 0, dwBufSize);
01899 
01900     /* Setup Type */
01901     if(GetPrivateProfileString("Messages", "STR_SETUP_TYPE", "", szBuf, sizeof(szBuf), szFileIniInstall))
01902     {
01903       strcat(szMessageBuf, szBuf);
01904       strcat(szMessageBuf, "\r\n");
01905     }
01906     strcat(szMessageBuf, "    "); // add 4 indentation spaces
01907       
01908     switch(ulSetupType)
01909     {
01910       case ST_RADIO3:
01911         AppendStringWOTilde(szMessageBuf, dwBufSize, diSetupType.stSetupType3.szDescriptionShort);
01912         break;
01913 
01914       case ST_RADIO2:
01915         AppendStringWOTilde(szMessageBuf, dwBufSize, diSetupType.stSetupType2.szDescriptionShort);
01916         break;
01917 
01918       case ST_RADIO1:
01919         AppendStringWOTilde(szMessageBuf, dwBufSize, diSetupType.stSetupType1.szDescriptionShort);
01920         break;
01921 
01922       default:
01923         AppendStringWOTilde(szMessageBuf, dwBufSize, diSetupType.stSetupType0.szDescriptionShort);
01924         break;
01925     }
01926     strcat(szMessageBuf, "\r\n\r\n");
01927 
01928     /* Selected Components */
01929     if(GetPrivateProfileString("Messages", "STR_SELECTED_COMPONENTS", "", szBuf, sizeof(szBuf), szFileIniInstall))
01930     {
01931       strcat(szMessageBuf, szBuf);
01932       strcat(szMessageBuf, "\r\n");
01933     }
01934 
01935     dwIndex0  = 0;
01936     siCObject = SiCNodeGetObject(dwIndex0, FALSE, AC_ALL);
01937     while(siCObject)
01938     {
01939       if(siCObject->dwAttributes & SIC_SELECTED)
01940       {
01941         strcat(szMessageBuf, "    "); // add 4 indentation spaces
01942         strcat(szMessageBuf, siCObject->szDescriptionShort);
01943       }
01944 
01945       if(siCObject->bForceUpgrade)
01946       {
01947         /* add the "(Required)" string (or something equivalent) after the component description */
01948         if(*szSTRRequired != '\0')
01949         {
01950           strcat(szMessageBuf, " "); // add 1 space
01951           strcat(szMessageBuf, szSTRRequired);
01952         }
01953       }
01954 
01955       if(siCObject->dwAttributes & SIC_SELECTED)
01956         strcat(szMessageBuf, "\r\n");
01957 
01958       ++dwIndex0;
01959       siCObject = SiCNodeGetObject(dwIndex0, FALSE, AC_ALL);
01960     }
01961     strcat(szMessageBuf, "\r\n");
01962 
01963     /* destination directory */
01964     if(GetPrivateProfileString("Messages", "STR_DESTINATION_DIRECTORY", "", szBuf, sizeof(szBuf), szFileIniInstall))
01965     {
01966       strcat(szMessageBuf, szBuf);
01967       strcat(szMessageBuf, "\r\n");
01968     }
01969     strcat(szMessageBuf, "    "); // add 4 indentation spaces
01970     strcat(szMessageBuf, sgProduct.szPath);
01971     strcat(szMessageBuf, "\r\n\r\n");
01972 
01973     if(GetTotalArchivesToDownload() > 0)
01974     {
01975       strcat(szMessageBuf, "\r\n");
01976 
01977       /* site selector info */
01978       if(GetPrivateProfileString("Messages", "STR_DOWNLOAD_SITE", "", szBuf, sizeof(szBuf), szFileIniInstall))
01979       {
01980         strcat(szMessageBuf, szBuf);
01981         strcat(szMessageBuf, "\r\n");
01982       }
01983 
01984       strcat(szMessageBuf, "    "); // add 4 indentation spaces
01985       strcat(szMessageBuf, szSiteSelectorDescription); // site selector description
01986       strcat(szMessageBuf, "\r\n");
01987 
01988       if(diAdditionalOptions.bSaveInstaller)
01989       {
01990         strcat(szMessageBuf, "\r\n");
01991 
01992         /* site selector info */
01993         if(GetPrivateProfileString("Messages", "STR_SAVE_INSTALLER_FILES", "", szBuf, sizeof(szBuf), szFileIniInstall))
01994         {
01995           strcat(szMessageBuf, szBuf);
01996           strcat(szMessageBuf, "\r\n");
01997         }
01998 
01999         GetSaveInstallerPath(szBuf, sizeof(szBuf));
02000         strcat(szMessageBuf, "    "); // add 4 indentation spaces
02001         strcat(szMessageBuf, szBuf);
02002         strcat(szMessageBuf, "\r\n");
02003       }
02004     }
02005   }
02006 
02007   return(szMessageBuf);
02008 }
02009 
02010 MRESULT EXPENTRY DlgProcStartInstall(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
02011 {
02012   SWP   swpDlg;
02013   LPSTR szMessage = NULL;
02014 
02015   switch(msg)
02016   {
02017     case WM_INITDLG:
02018       AdjustDialogSize(hDlg);
02019       WinSetPresParam(hDlg, PP_FONTNAMESIZE,
02020                       strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
02021       WinSetWindowText(hDlg, diStartInstall.szTitle);
02022 
02023       WinSetDlgItemText(hDlg, IDC_STATIC, sgInstallGui.szCurrentSettings);
02024       WinSetDlgItemText(hDlg, IDWIZBACK, sgInstallGui.szBack_);
02025       WinSetDlgItemText(hDlg, IDWIZNEXT, sgInstallGui.szInstall_);
02026       WinSetDlgItemText(hDlg, IDCANCEL, sgInstallGui.szCancel_);
02027  
02028       WinQueryWindowPos(hDlg, &swpDlg);
02029       WinSetWindowPos(hDlg,
02030                       HWND_TOP,
02031                       (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
02032                       (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
02033                       0,
02034                       0,
02035                       SWP_MOVE);
02036 
02037       if((diAdvancedSettings.bShowDialog == FALSE) || (GetTotalArchivesToDownload() == 0))
02038       {
02039         WinShowWindow(WinWindowFromID(hDlg, IDC_BUTTON_SITE_SELECTOR), FALSE);
02040         WinSetDlgItemText(hDlg, IDC_MESSAGE0, diStartInstall.szMessageInstall);
02041       }
02042       else
02043       {
02044         WinShowWindow(WinWindowFromID(hDlg, IDC_BUTTON_SITE_SELECTOR), TRUE);
02045         WinSetDlgItemText(hDlg, IDC_MESSAGE0, diStartInstall.szMessageDownload);
02046       }
02047 
02048       if((szMessage = GetStartInstallMessage()) != NULL)
02049       {
02050         WinSetDlgItemText(hDlg, IDC_CURRENT_SETTINGS, szMessage);
02051         FreeMemory(&szMessage);
02052       }
02053 
02054       break;
02055 
02056     case WM_CLOSE:
02057       AskCancelDlg(hDlg);
02058       return (MRESULT)TRUE;
02059       break;
02060 
02061     case WM_COMMAND:
02062       switch ( SHORT1FROMMP( mp1 ) )
02063       {
02064         case IDWIZNEXT:
02065           WinDestroyWindow(hDlg);
02066           DlgSequence(NEXT_DLG);
02067           break;
02068 
02069         case IDWIZBACK:
02070           WinDestroyWindow(hDlg);
02071           DlgSequence(PREV_DLG);
02072           break;
02073 
02074         case IDCANCEL:
02075           AskCancelDlg(hDlg);
02076           return (MRESULT)TRUE;
02077           break;
02078 
02079         default:
02080           break;
02081       }
02082       break;
02083   }
02084   return(WinDefDlgProc(hDlg, msg, mp1, mp2));
02085 }
02086 
02087 MRESULT EXPENTRY DlgProcReboot(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
02088 {
02089   HANDLE            hToken;
02090   HWND              hRadioYes;
02091   SWP               swpDlg;
02092 
02093   hRadioYes = WinWindowFromID(hDlg, IDC_RADIO_YES);
02094 
02095   switch(msg)
02096   {
02097     case WM_INITDLG:
02098       WinSetPresParam(hDlg, PP_FONTNAMESIZE,
02099                       strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
02100       WinCheckButton(hDlg, IDC_RADIO_YES, 1);
02101       WinSetFocus(HWND_DESKTOP, hRadioYes);
02102 
02103       WinQueryWindowPos(hDlg, &swpDlg);
02104       WinSetWindowPos(hDlg,
02105                       HWND_TOP,
02106                       (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
02107                       (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
02108                       0,
02109                       0,
02110                       SWP_MOVE);
02111 
02112       WinSetDlgItemText(hDlg, 202, sgInstallGui.szSetupMessage);
02113       WinSetDlgItemText(hDlg, IDC_RADIO_YES, sgInstallGui.szYesRestart);
02114       WinSetDlgItemText(hDlg, IDC_RADIO_NO, sgInstallGui.szNoRestart);
02115       WinSetDlgItemText(hDlg, DID_OK, sgInstallGui.szOk);
02116       break;
02117 
02118     case WM_CLOSE:
02119       AskCancelDlg(hDlg);
02120       return (MRESULT)TRUE;
02121       break;
02122 
02123     case WM_COMMAND:
02124       switch ( SHORT1FROMMP( mp1 ) )
02125       {
02126         case DID_OK:
02127           if(WinQueryButtonCheckstate(hDlg, IDC_RADIO_YES) == 1)
02128           {
02129             WinDestroyWindow(hDlg);
02130             WinPostQueueMsg(0, WM_QUIT, 0, 0);
02131             WinDestroyWindow(hWndMain);
02132 
02133             // Reboot the system and force all applications to close.
02134             WinShutdownSystem(0, 0);
02135           }
02136           else
02137           {
02138             WinDestroyWindow(hDlg);
02139             WinPostQueueMsg(0, WM_QUIT, 0, 0);
02140           }
02141           break;
02142 
02143         case IDCANCEL:
02144           WinDestroyWindow(hDlg);
02145           WinPostQueueMsg(0, WM_QUIT, 0, 0);
02146           break;
02147 
02148         default:
02149           break;
02150       }
02151       break;
02152   }
02153   return(WinDefDlgProc(hDlg, msg, mp1, mp2));
02154 }
02155 
02156 MRESULT EXPENTRY DlgProcMessage(HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
02157 {
02158   SWP       swpDlg;
02159   HWND      hSTMessage = WinWindowFromID(hDlg, IDC_MESSAGE); /* handle to the Static Text message window */
02160   HPS       hpsSTMessage;
02161   RECTL     rectlString;
02162   char      szBuf[MAX_BUF];
02163   char      szBuf2[MAX_BUF];
02164 
02165   memset(szBuf, 0, sizeof(szBuf));
02166   memset(szBuf2, 0, sizeof(szBuf2));
02167 
02168   switch(msg)
02169   {
02170     case WM_INITDLG:
02171       AdjustDialogSize(hDlg);
02172       WinSetPresParam(hDlg, PP_FONTNAMESIZE,
02173                       strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
02174       if(GetPrivateProfileString("Messages", "STR_MESSAGEBOX_TITLE", "", szBuf2, sizeof(szBuf2), szFileIniInstall))
02175       {
02176         if((sgProduct.szProductName != NULL) && (*sgProduct.szProductName != '\0'))
02177           sprintf(szBuf, szBuf2, sgProduct.szProductName);
02178         else
02179           sprintf(szBuf, szBuf2, "");
02180       }
02181       else if((sgProduct.szProductName != NULL) && (*sgProduct.szProductName != '\0'))
02182         strcpy(szBuf, sgProduct.szProductName);
02183 
02184       WinSetWindowText(hDlg, szBuf);
02185       WinQueryWindowPos(hDlg, &swpDlg);
02186       WinSetWindowPos(hDlg,
02187                       HWND_TOP,
02188                       (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
02189                       (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
02190                       0,
02191                       0,
02192                       SWP_MOVE);
02193 
02194       break;
02195 
02196     case WM_CLOSE:
02197       AskCancelDlg(hDlg);
02198       return (MRESULT)TRUE;
02199       break;
02200 
02201     case WM_COMMAND:
02202       switch ( SHORT1FROMMP( mp1 ) )
02203       {
02204         case IDC_MESSAGE:
02205           hpsSTMessage = WinGetPS(hSTMessage);
02206 
02207           rectlString.xLeft = 0;
02208           rectlString.xRight = 10000;
02209           rectlString.yTop = 10000;
02210           rectlString.yBottom = 0;
02211           WinDrawText(hpsSTMessage, strlen((char*)mp2), (char*)mp2,
02212                             &rectlString, 0, 0,
02213                             DT_BOTTOM | DT_QUERYEXTENT | DT_TEXTATTRS | DT_WORDBREAK);
02214           WinReleasePS(hpsSTMessage);
02215 
02216           WinSetWindowPos(hDlg, HWND_TOP,
02217                       (gSystemInfo.lScreenX/2)-((rectlString.xRight + 55)/2),
02218                       (gSystemInfo.lScreenY/2)-((rectlString.yTop + 50)/2),
02219                       rectlString.xRight + 55,
02220                       rectlString.yTop + 50,
02221                       SWP_SIZE | SWP_MOVE);
02222 
02223           WinQueryWindowPos(hDlg, &swpDlg);
02224 
02225           WinSetWindowPos(hSTMessage,
02226                          HWND_TOP,
02227                          gSystemInfo.lDlgFrameX,
02228                          gSystemInfo.lDlgFrameY,
02229                          swpDlg.cx-2*gSystemInfo.lDlgFrameX,
02230                          swpDlg.cy-2*gSystemInfo.lDlgFrameY-gSystemInfo.lTitleBarY,
02231                          SWP_SIZE | SWP_MOVE);
02232 
02233           WinSetDlgItemText(hDlg, IDC_MESSAGE, (PSZ)mp2);
02234           return (MRESULT)TRUE;
02235           break;
02236       }
02237       break;
02238   }
02239   return(WinDefDlgProc(hDlg, msg, mp1, mp2));
02240 }
02241 
02242 void ProcessWindowsMessages()
02243 {
02244   QMSG qmsg;
02245 
02246   while(WinPeekMsg((HAB)0, &qmsg, 0, 0, 0, PM_REMOVE))
02247   {
02248     WinDispatchMsg((HAB)0, &qmsg );
02249   }
02250 }
02251 
02252 void ShowMessage(PSZ szMessage, BOOL bShow)
02253 {
02254   char szBuf[MAX_BUF];
02255  
02256   if(sgProduct.ulMode != SILENT)
02257   {
02258     if((bShow) && (hDlgMessage == NULL))
02259     {
02260       memset(szBuf, 0, sizeof(szBuf));
02261       GetPrivateProfileString("Messages", "MB_MESSAGE_STR", "", szBuf, sizeof(szBuf), szFileIniInstall);
02262       hDlgMessage = InstantiateDialog(hWndMain, DLG_MESSAGE, szBuf, DlgProcMessage);
02263       WinSendMsg(hDlgMessage, WM_COMMAND, IDC_MESSAGE, (LPARAM)szMessage);
02264     }
02265     else if(!bShow && hDlgMessage)
02266     {
02267       WinDestroyWindow(hDlgMessage);
02268       hDlgMessage = NULL;
02269     }
02270   }
02271 }
02272 
02273 HWND InstantiateDialog(HWND hParent, ULONG ulDlgID, PSZ szTitle, PFNWP pfnwpDlgProc)
02274 {
02275   char szBuf[MAX_BUF];
02276   HWND hDlg = NULL;
02277   ATOM atom;
02278 
02279   hDlg = WinLoadDlg(HWND_DESKTOP, hParent, pfnwpDlgProc, hSetupRscInst, ulDlgID, NULL);
02280 
02281   if (hDlg == NULL)
02282   {
02283     char szEDialogCreate[MAX_BUF];
02284 
02285     if(GetPrivateProfileString("Messages", "ERROR_DIALOG_CREATE", "", szEDialogCreate, sizeof(szEDialogCreate), szFileIniInstall))
02286     {
02287       sprintf(szBuf, szEDialogCreate, szTitle);
02288       PrintError(szBuf, ERROR_CODE_SHOW);
02289     }
02290     WinPostQueueMsg(NULL, WM_QUIT, 1, 0);
02291   }
02292 
02293   atom = WinFindAtom(WinQuerySystemAtomTable(), CLASS_NAME_SETUP_DLG);
02294   WinSetWindowULong(hDlg, QWL_USER, atom);
02295 
02296   return(hDlg);
02297 }
02298 
02299 /*
02300  * Check to see if turbo is enabled.  If so, do the following:
02301  *   * Log the turbo status that use had chosen.
02302  *   * Set the appropriate Windows registry keys/values.
02303  */
02304 void SetTurboArgs(void)
02305 {
02306   char szData[MAX_BUF];
02307   char szBuf[MAX_BUF];
02308   char szApp[MAX_BUF];
02309 
02310   if(diQuickLaunch.bTurboModeEnabled)
02311   {
02312     /* log if the user selected the turbo mode or not */
02313     LogISTurboMode(diQuickLaunch.bTurboMode);
02314     LogMSTurboMode(diQuickLaunch.bTurboMode);
02315 
02316     if(diQuickLaunch.bTurboMode)
02317       strcpy( szData, "turbo=yes" );
02318     else
02319       strcpy( szData, "turbo=no" );
02320 
02321     sprintf(szApp, "%s %s",
02322              sgProduct.szProductNameInternal,
02323              sgProduct.szUserAgent);
02324     PrfQueryProfileString(HINI_USERPROFILE, szApp, "browserargs", "", szBuf, sizeof(szBuf));
02325 
02326     if ( szBuf[0] != '\0' )
02327        strcat(szBuf, " ");
02328     strcat(szBuf, szData);
02329   }
02330 }
02331 
02332 void DlgSequence(int iDirection)
02333 {
02334   HRESULT hrValue;
02335   BOOL    bDone = FALSE;
02336 
02337   do
02338   {
02339     gbProcessingXpnstallFiles = FALSE;
02340 
02341     if(iDirection == NEXT_DLG)
02342     {
02343       switch(ulWizardState)
02344       {
02345         case DLG_NONE:
02346           ulWizardState = DLG_WELCOME;
02347           break;
02348         case DLG_WELCOME:
02349           ulWizardState = DLG_LICENSE;
02350           break;
02351         case DLG_LICENSE:
02352           ulWizardState = DLG_SETUP_TYPE;
02353           break;
02354         case DLG_SETUP_TYPE:
02355           ulWizardState = DLG_SELECT_COMPONENTS;
02356           break;
02357         case DLG_SELECT_COMPONENTS:
02358           ulWizardState = DLG_SELECT_ADDITIONAL_COMPONENTS;
02359           break;
02360         case DLG_SELECT_ADDITIONAL_COMPONENTS:
02361           ulWizardState = DLG_OS2_INTEGRATION;
02362           break;
02363         case DLG_OS2_INTEGRATION:
02364           ulWizardState = DLG_ADDITIONAL_OPTIONS;
02365           break;
02366         case DLG_ADDITIONAL_OPTIONS:
02367           ulWizardState = DLG_START_INSTALL;
02368           break;
02369         case DLG_START_INSTALL:
02370           ulWizardState = DLG_COMMIT_INSTALL;
02371           break;
02372 
02373         case DLG_ADVANCED_SETTINGS:
02374           ulWizardState = DLG_ADDITIONAL_OPTIONS;
02375           break;
02376 
02377         default:
02378           ulWizardState = DLG_WELCOME;
02379           break;      }
02380     }
02381     else if(iDirection == PREV_DLG)
02382     {
02383       switch(ulWizardState)
02384       {
02385         case DLG_LICENSE:
02386           ulWizardState = DLG_WELCOME;
02387           break;
02388         case DLG_SETUP_TYPE:
02389           ulWizardState = DLG_LICENSE;
02390           break;
02391         case DLG_SELECT_COMPONENTS:
02392           ulWizardState = DLG_SETUP_TYPE;
02393           break;
02394         case DLG_SELECT_ADDITIONAL_COMPONENTS:
02395           ulWizardState = DLG_SELECT_COMPONENTS;
02396           break;
02397         case DLG_OS2_INTEGRATION:
02398           ulWizardState = DLG_SELECT_ADDITIONAL_COMPONENTS;
02399           break;
02400         case DLG_ADDITIONAL_OPTIONS:
02401           ulWizardState = DLG_OS2_INTEGRATION;
02402           break;
02403         case DLG_START_INSTALL:
02404           ulWizardState = DLG_ADDITIONAL_OPTIONS;
02405           break;
02406 
02407         case DLG_ADVANCED_SETTINGS:
02408           ulWizardState = DLG_ADDITIONAL_OPTIONS;
02409           break;
02410 
02411         default:
02412           ulWizardState = DLG_WELCOME;
02413           break;
02414       }
02415     }
02416     else if(iDirection == OTHER_DLG_1)
02417     {
02418       switch(ulWizardState)
02419       {
02420         case DLG_ADDITIONAL_OPTIONS:
02421           ulWizardState = DLG_ADVANCED_SETTINGS;
02422           break;
02423 
02424         // You'll get here only if DLG_ADVANCED_SETTINGS is not displayed, which really should
02425         //   should never be the case unless DLG_ADDITIONAL_OPTIONS is also not displayed, since this
02426         //   is a button off that dialog.  But if the user turns this off in error, handling the case
02427         //   will keep from dropping into an infinite loop.
02428         case DLG_ADVANCED_SETTINGS:
02429           ulWizardState = DLG_ADDITIONAL_OPTIONS;
02430           break;
02431       }
02432     }
02433 
02434     switch(ulWizardState)
02435     {
02436       case DLG_WELCOME:
02437         if(diWelcome.bShowDialog)
02438         {
02439           hDlgCurrent = InstantiateDialog(hWndMain, ulWizardState, diWelcome.szTitle, DlgProcWelcome);
02440           bDone = TRUE;
02441         }
02442         break;
02443 
02444       case DLG_LICENSE:
02445         if(diLicense.bShowDialog)
02446         {
02447           hDlgCurrent = InstantiateDialog(hWndMain, ulWizardState, diLicense.szTitle, DlgProcLicense);
02448           bDone = TRUE;
02449         }
02450         break;
02451 
02452       case DLG_SETUP_TYPE:
02453         if(diSetupType.bShowDialog)
02454         {
02455           hDlgCurrent = InstantiateDialog(hWndMain, ulWizardState, diSetupType.szTitle, DlgProcSetupType);
02456           bDone = TRUE;
02457         }
02458         break;
02459 
02460       case DLG_SELECT_COMPONENTS:
02461         if((diSelectComponents.bShowDialog) && (sgProduct.ulCustomType == ulSetupType))
02462         {
02463           hDlgCurrent = InstantiateDialog(hWndMain, ulWizardState, diSelectComponents.szTitle, DlgProcSelectComponents);
02464           bDone = TRUE;
02465         }
02466         break;
02467 
02468       case DLG_SELECT_ADDITIONAL_COMPONENTS:
02469         if((diSelectAdditionalComponents.bShowDialog) && (sgProduct.ulCustomType == ulSetupType))
02470         {
02471           hDlgCurrent = InstantiateDialog(hWndMain, ulWizardState, diSelectAdditionalComponents.szTitle, DlgProcSelectAdditionalComponents);
02472           bDone = TRUE;
02473         }
02474         break;
02475 
02476       case DLG_OS2_INTEGRATION:
02477         if(diOS2Integration.bShowDialog)
02478         {
02479           hDlgCurrent = InstantiateDialog(hWndMain, ulWizardState, diOS2Integration.szTitle, DlgProcOS2Integration);
02480           bDone = TRUE;
02481         }
02482         break;
02483 
02484       case DLG_ADVANCED_SETTINGS:
02485         if(diAdvancedSettings.bShowDialog)
02486         {
02487           hDlgCurrent = InstantiateDialog(hWndMain, ulWizardState, diAdvancedSettings.szTitle, DlgProcAdvancedSettings);
02488           bDone = TRUE;
02489         }
02490         break;
02491 
02492       case DLG_ADDITIONAL_OPTIONS:
02493         do
02494         {
02495           hrValue = VerifyDiskSpace();
02496           if(hrValue == DID_OK)
02497           {
02498             /* show previous visible window */
02499             iDirection = PREV_DLG;
02500           }
02501           else if(hrValue == IDCANCEL)
02502           {
02503             AskCancelDlg(hWndMain);
02504             hrValue = MBID_RETRY;
02505           }
02506         }while(hrValue == MBID_RETRY);
02507 
02508         if(hrValue != DID_OK)
02509         {
02510           if(ShowAdditionalOptionsDialog() == TRUE)
02511           {
02512             hDlgCurrent = InstantiateDialog(hWndMain, ulWizardState, diAdditionalOptions.szTitle, DlgProcAdditionalOptions);
02513             bDone = TRUE;
02514           }
02515         }
02516         break;
02517 
02518       case DLG_START_INSTALL:
02519         if(diStartInstall.bShowDialog)
02520         {
02521           hDlgCurrent = InstantiateDialog(hWndMain, ulWizardState, diStartInstall.szTitle, DlgProcStartInstall);
02522           bDone = TRUE;
02523         }
02524         break;
02525 
02526       case DLG_COMMIT_INSTALL:
02527         gbProcessingXpnstallFiles = TRUE;
02528         CommitInstall();
02529         bDone = TRUE;
02530         break;
02531     }
02532   } while(!bDone);
02533 }
02534 
02535 void CommitInstall(void)
02536 {
02537   HRESULT hrErr;
02538   char    szDestPath[MAX_BUF];
02539   char    szInstallLogFile[MAX_BUF];
02540 
02541         LogISDestinationPath();
02542         LogISSetupType();
02543         LogISComponentsSelected();
02544         LogISComponentsToDownload();
02545         LogISDiskSpace(gdsnComponentDSRequirement);
02546 
02547         strcpy(szDestPath, sgProduct.szPath);
02548         if(*sgProduct.szSubPath != '\0')
02549         {
02550           AppendBackSlash(szDestPath, sizeof(szDestPath));
02551           strcat(szDestPath, sgProduct.szSubPath);
02552         }
02553         AppendBackSlash(szDestPath, sizeof(szDestPath));
02554 
02555         /* Set global var, that determines where the log file is to update, to
02556          * not use the TEMP dir *before* the FileCopy() calls because we want
02557          * to log the FileCopy() calls to where the log files were copied to.
02558          * This is possible because the logging, that is done within the
02559          * FileCopy() function, is done after the actual copy
02560          */
02561         gbILUseTemp = FALSE;
02562 
02563         /* copy the install_wizard.log file from the temp\ns_temp dir to
02564          * the destination dir and use the new destination file to continue
02565          * logging.
02566          */
02567         strcpy(szInstallLogFile, szTempDir);
02568         AppendBackSlash(szInstallLogFile, sizeof(szInstallLogFile));
02569         strcat(szInstallLogFile, FILE_INSTALL_LOG);
02570         FileCopy(szInstallLogFile, szDestPath, FALSE, FALSE);
02571         DosDelete(szInstallLogFile);
02572 
02573         /* copy the install_status.log file from the temp\ns_temp dir to
02574          * the destination dir and use the new destination file to continue
02575          * logging.
02576          */
02577         strcpy(szInstallLogFile, szTempDir);
02578         AppendBackSlash(szInstallLogFile, sizeof(szInstallLogFile));
02579         strcat(szInstallLogFile, FILE_INSTALL_STATUS_LOG);
02580         FileCopy(szInstallLogFile, szDestPath, FALSE, FALSE);
02581         DosDelete(szInstallLogFile);
02582 
02583         /* PRE_DOWNLOAD process file manipulation functions */
02584         ProcessFileOpsForAll(T_PRE_DOWNLOAD);
02585 
02586         if(RetrieveArchives() == WIZ_OK)
02587         {
02588           /* Check to see if Turbo is required.  If so, set the
02589            * appropriate Windows registry keys */
02590           SetTurboArgs();
02591 
02592           if(gbDownloadTriggered || gbPreviousUnfinishedDownload)
02593             SetSetupState(SETUP_STATE_UNPACK_XPCOM);
02594 
02595           /* POST_DOWNLOAD process file manipulation functions */
02596           ProcessFileOpsForAll(T_POST_DOWNLOAD);
02597           /* PRE_XPCOM process file manipulation functions */
02598           ProcessFileOpsForAll(T_PRE_XPCOM);
02599 
02600           if(ProcessXpcomFile() != FO_SUCCESS)
02601           {
02602             bSDUserCanceled = TRUE;
02603             CleanupXpcomFile();
02604             WinPostQueueMsg(0, WM_QUIT, 0, 0);
02605 
02606             return;
02607           }
02608 
02609           if(gbDownloadTriggered || gbPreviousUnfinishedDownload)
02610             SetSetupState(SETUP_STATE_INSTALL_XPI); // clears and sets new setup state
02611 
02612           /* POST_XPCOM process file manipulation functions */
02613           ProcessFileOpsForAll(T_POST_XPCOM);
02614           /* PRE_SMARTUPDATE process file manipulation functions */
02615           ProcessFileOpsForAll(T_PRE_SMARTUPDATE);
02616 
02617           /* save the installer files in the local machine */
02618           if(diAdditionalOptions.bSaveInstaller)
02619             SaveInstallerFiles();
02620 
02621           if(CheckInstances())
02622           {
02623             bSDUserCanceled = TRUE;
02624             CleanupXpcomFile();
02625             WinPostQueueMsg(0, WM_QUIT, 0, 0);
02626 
02627             return;
02628           }
02629 
02630           strcat(szDestPath, "uninstall\\");
02631           CreateDirectoriesAll(szDestPath, TRUE);
02632 
02633           /* save the installer files in the local machine */
02634           if(diAdditionalOptions.bSaveInstaller)
02635             SaveInstallerFiles();
02636 
02637           hrErr = SmartUpdateJars();
02638           if((hrErr == WIZ_OK) || (hrErr == 999))
02639           {
02640             UpdateJSProxyInfo();
02641 
02642             /* POST_SMARTUPDATE process file manipulation functions */
02643             ProcessFileOpsForAll(T_POST_SMARTUPDATE);
02644             /* PRE_LAUNCHAPP process file manipulation functions */
02645             ProcessFileOpsForAll(T_PRE_LAUNCHAPP);
02646 
02647             LaunchApps();
02648 
02649             /* POST_LAUNCHAPP process file manipulation functions */
02650             ProcessFileOpsForAll(T_POST_LAUNCHAPP);
02651             /* DEPEND_REBOOT process file manipulation functions */
02652             ProcessFileOpsForAll(T_DEPEND_REBOOT);
02653 
02654             ProcessOS2Integration();
02655 
02656             UnsetSetupState(); // clear setup state
02657             if(!gbIgnoreProgramFolderX)
02658               ProcessProgramFolderShowCmd();
02659 
02660             CleanupArgsRegistry();
02661             CleanupPreviousVersionINIKeys();
02662             if(NeedReboot())
02663             {
02664               CleanupXpcomFile();
02665               hDlgCurrent = InstantiateDialog(hWndMain, DLG_RESTART, diReboot.szTitle, DlgProcReboot);
02666             }
02667             else
02668             {
02669               CleanupXpcomFile();
02670               WinPostQueueMsg(0, WM_QUIT, 0, 0);
02671             }
02672           }
02673           else
02674           {
02675             CleanupXpcomFile();
02676             WinPostQueueMsg(0, WM_QUIT, 0, 0);
02677           }
02678         }
02679         else
02680         {
02681           bSDUserCanceled = TRUE;
02682           CleanupXpcomFile();
02683           CleanupArgsRegistry();
02684           WinPostQueueMsg(0, WM_QUIT, 0, 0);
02685         }
02686         gbProcessingXpnstallFiles = FALSE;
02687 }