home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703B.ISO / driver / hp / win31 / lj5l_n / setup.mst < prev    next >
Text File  |  1996-01-30  |  39KB  |  1,093 lines

  1. '**************************************************************************
  2. '*                       MSSetup Toolkit Sample 1
  3. '**************************************************************************
  4.  
  5. '''$DEFINE   ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9. '$INCLUDE 'strings.inc'
  10.  
  11. ''Dialog ID's (mine)
  12. '$INCLUDE 'dialogid.inc'
  13. '$INCLUDE 'symbols.inc'
  14.  
  15. ''Const integers
  16. CONST c_iCOMPLETE =     1501
  17. CONST c_iCUSTOM =       1502
  18. CONST c_iNETADMIN =     1503
  19. CONST c_iRETRY =        1504
  20. CONST c_iPORT =         1505
  21. CONST c_iSKIP =         1506
  22. CONST c_iCHANGE_OPTION =    1507
  23. CONST c_iPATH =         1508
  24. CONST c_iSELECT_COMPONENTS =    1509
  25. CONST c_iSELECT_PORT =      1510
  26. CONST c_iSELECT_PRINTER =   1511
  27. CONST c_iRUN_FILE_MANAGER = 1512
  28. CONST c_iREADME =       1513
  29. CONST c_iOVERVIEW =     1514
  30. CONST c_iREBOOT =       1515
  31. CONST c_iRESUME =       1516
  32. CONST c_iBACK =         1517
  33. CONST c_iCONTINUE =     1518
  34. CONST c_iEXIT =         1519
  35. CONST c_iOK =         1520
  36. CONST c_iCANCEL =         1521
  37. CONST c_iYES =         1522
  38. CONST c_iNO =         1523
  39. CONST c_iINVALID =      -999
  40. CONST c_iGO_BACK =    3001
  41.  
  42. CONST EW_REBOOTSYSTEM = 67
  43. CONST EW_RESTARTWINDOWS = 66
  44.  
  45. '' This needs to be the same number as in resource.h
  46. const  IDS_STATWIN_TITLE% = 200
  47.  
  48. CONST c_iPROGRESS_WIDTH = 220           '' Width of the progress indicator
  49. CONST c_iPROGRESS_HEIGHT = 100          '' Height of the progress indicator
  50.  
  51. ''Const DLL dialog functions
  52. CONST c_szWELCOME_DLG_PROC$ = "WelcomeDlgProc"
  53. CONST c_szMETHOD_DLG_PROC$ = "MethodDlgProc"
  54. CONST c_szNETADMIN_DLG_PROC$ = "NetAdminInfoDlgProc"
  55. CONST c_szPORT_DLG_PROC$ = "PortDlgProc"
  56. CONST c_szBIDI_PROBLEM_DLG_PROC$ = "BidiProbDlgProc"
  57. CONST c_szBIDI_SKIP_DLG_PROC$ = "BidiSkipDlgProc"
  58. CONST c_szUNSUPPORTED_DLG_PROC$ = "UnsupportedDlgProc"
  59. CONST c_szPRINTER_DLG_PROC$ = "PrinterDlgProc"
  60. CONST c_szCOMPONENT_DLG_PROC$ = "ComponentDlgProc"
  61. CONST c_szPATH_DLG_PROC$ = "EnterPathDlgProc"
  62. CONST c_szNOSPACE_DLG_PROC$ = "NoSpaceDlgProc"
  63. CONST c_szVERIFY_DLG_PROC$ = "VerifyDlgProc"
  64. CONST c_szVERIFY_FAIL_DLG_PROC$ = "VerifyFailDlgProc"
  65. CONST c_szFINAL_DLG_PROC$ = "FinalDlgProc"
  66. CONST c_szFINAL_ADMIN_DLG_PROC$ = "FinalDlgProc"
  67. CONST c_szREBOOT_DLG_PROC$ = "RebootDlgProc"
  68. CONST c_szEXIT_DLG_PROC$ =  "ExitDlgProc"
  69. CONST c_szBILLBOARD_DLG_PROC$ = "BillboardDlgProc"
  70. CONST c_szINVISIBLE_DLG_PROC$ = "InvisibleDlgProc"
  71. CONST c_szASK_SOUND_DLG_PROC$ = "AskSoundDlgProc"
  72. CONST c_szHPLOGO_DLG_PROC$ = "HPLogoDlgProc"
  73. CONST c_szEXECUTE_DLG_PROC$ = "ExecuteDlgProc"
  74. CONST c_szALADDIN_DLG_PROC$ = "AladdinDlgProc"
  75. CONST c_szCOPYRIGHT_DLG_PROC$ = "CopyRightDlgProc"
  76.  
  77.  
  78.  
  79. ''Const strings
  80. ''CONST c_szRESTART_DIR$ = ":\HPRESDIR"
  81. CONST c_szEMPTY$ = ""
  82. CONST c_szLOG_FILE$ = "HPLJPS.TXT"
  83. CONST c_szDRIVER_SECTION$ = "DriverFiles"
  84. CONST c_szINFO_FILE$ = "SETUP.INF"
  85. CONST c_szLOG_FILE_LIST$ = "logfile"
  86. CONST c_szFAILURE$ = "fail"
  87. CONST c_szSUCCESS$ = "success"
  88. CONST c_szALADDIN$ = "fontsmart.comp"
  89. CONST c_szALADDIN_SECTION$ = "fontsmart.win31.files"
  90. CONST c_szALADDIN_CUSTOM$ = "fontsmart.custom.fonts"
  91. const c_szALL_FONTS$ = "fontsmart.all.fonts"
  92. CONST c_szALADDIN_CMD_LINE$ = "fontsmrt /b "
  93. const c_szFONTLIST_FILE$ = "fontlist.txt"
  94. const c_szALLFONTS_FILE$ = "allfonts.txt"
  95. const c_szALADDIN_EXIT_MSG$ = "FontSmartExiting"
  96.  
  97. CONST c_lpszSECTION_LIST$ = "ComponentSectionList"
  98. CONST c_lpszCOMPONENT_LIST$ = "ComponentList"
  99.  
  100.  
  101. CONST c_szCTRL3DFILE$ = "ctl3dv2.dll"
  102. CONST c_szCTRL3DFILE_COMPRESSED$ = "ctl3dv2.dl_"
  103.  
  104. ''Support DLL
  105. '$INCLUDE 'support.inc'
  106.  
  107. ''Bitmap ID
  108. CONST LOGO = IDB_HP_LOGO
  109.  
  110. ''Message IDs
  111. CONST WM_USER = 1024        '' 0x0400
  112. CONST WM_CLEANUP = WM_USER + 200
  113.  
  114.  
  115. GLOBAL g_iReturn as integer
  116. GLOBAL g_iSound as integer
  117. GLOBAL g_dwBidiReady as long
  118. GLOBAL g_hWndFrame as integer
  119. GLOBAL g_iMethod as integer
  120. GLOBAL g_iInstallOk as integer
  121. GLOBAL g_szClose as string
  122. GLOBAL g_pEnvironment as pointer to ENVIRONMENT
  123. GLOBAL g_szDest as string
  124.  
  125.  
  126. DECLARE FUNCTION Install() as INTEGER
  127. DECLARE FUNCTION MakePath( szDir$, szFile$ ) AS STRING
  128.  
  129. DECLARE FUNCTION LogUserOptions() as integer
  130. DECLARE FUNCTION LogEnvironment() as integer
  131. DECLARE FUNCTION LogInstallation() as integer
  132. DECLARE FUNCTION CopyFiles() as integer
  133. DECLARE FUNCTION SetupUIDlg(szDll$, idDlg%, szDlgProc$,idHelpDlg%, szHelpProc$) as integer
  134. DECLARE FUNCTION GetButtonId(szString$) as integer
  135. DECLARE function MergeStrings(szStr1$, szStr2$) as string
  136. declare function Check3D() as integer
  137. declare function CheckLZExpand(iValue%, szFile1$, szFile2$) as integer
  138. declare sub Clean()
  139.  
  140. declare function GetGaugeDlgUnitsX  lib "mscuistf.dll" () as integer
  141. declare function GetGaugeDlgUnitsY  lib "mscuistf.dll" () as integer
  142. declare function EnoughSpace  lib "mscuistf.dll" () as integer
  143. declare function SetExecBlock  lib "mscuistf.dll" (lpszCmdLine$, lpszExitMsg$) as integer
  144. declare function GetExecBlockReturn  lib "mscuistf.dll" () as integer
  145.  
  146. '' Windows API functions
  147. declare function GetModuleHandle   lib "Kernel" (lpstr$) as integer
  148. declare function WinExec lib "Kernel" (szCommand$, uiShow%) as integer
  149. declare function lstrcat lib "Kernel" (g_szDest$, szSource$) as long
  150. declare function lstrlen lib "Kernel" (szSource$) as integer
  151. declare function GetFreeSpace lib "Kernel" (iFlags%) as long
  152. declare function LoadString lib "user" (hHandle, iIdResource%, szBuffer$, iBufferSize%) as integer
  153. '$IFNDEF MSTEST_20
  154. declare function ExitWindows lib "user" (dwRestart&, iReserved%) as integer
  155. '$ENDIF
  156.  
  157. '$IFDEF DEBUG
  158. declare sub OutputDebugString lib "Kernel" ( szStr$)
  159. '$ENDIF
  160.  
  161. INIT:
  162.     dim iModule as integer
  163.     dim iReturn as integer
  164.     dim szDialogProc as string
  165.     dim iIdDialog as integer
  166.     dim iSuccess as integer
  167.     dim ipSuccess as pointer to integer
  168.  
  169.     ipSuccess = VARPTR( iSuccess )
  170.  
  171.     RESDLL$ = "resource.dll"
  172.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  173.     SetTitle c_szTITLE
  174.  
  175.  
  176.     g_iSound = FALSE
  177.  
  178.     g_hWndFrame = HwndFrame()
  179.  
  180.     '' Initialize empty lists
  181.     SetSymbolValue c_szLOG_FILE_LIST ,  c_szEMPTY
  182.     SetSymbolValue c_szFAILURE , c_szEMPTY
  183.     SetSymbolValue c_szSUCCESS , c_szEMPTY
  184.  
  185.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  186.     IF szInf$ = c_szEMPTY THEN
  187.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  188.     END IF
  189.     ReadInfFile szInf$
  190.  
  191.  
  192.     g_iReturn = Initialize()
  193.     g_pEnvironment = GetInstallEnvironment()
  194.  
  195.     Installed3D% = Check3D
  196.     if  Installed3D = TRUE then
  197.  
  198.         '' Test 3D dialogs
  199.         iModule = GetModuleHandle( "DSHELL" )
  200.         g_iReturn = Begin3d( iModule )
  201.  
  202.     endif
  203.  
  204.    iReturn = FixMainWindow( g_hWndFrame )
  205.  
  206.     g_szDest = UIStartDlg(CUIDLL$, IDD_HPLOGO, c_szHPLOGO_DLG_PROC,0,c_szEMPTY)
  207.  
  208.     g_szDest = UIStartDlg(CUIDLL$, IDD_COPYRIGHT, c_szCOPYRIGHT_DLG_PROC,0,c_szEMPTY)
  209.     '' Have the script send a beep when requesting new diskettes.
  210.     iReturn = SetBeepingMode(1)
  211.  
  212.     iReturn = LogEnvironment()
  213.     szDialogProc =  c_szWELCOME_DLG_PROC
  214.     iIdDialog = IDD_WELCOME
  215.     g_pEnvironment = GetInstallEnvironment
  216. GOBACK:
  217.  
  218.     WHILE szDialogProc <> c_szEMPTY
  219.         iReturn = SetupUIDlg(CUIDLL$, iIdDialog, szDialogProc, 0, c_szEMPTY)
  220.  
  221.         if (iReturn = c_iEXIT) then
  222.             GOSUB ASKQUIT
  223.         else
  224.             UIPop 1
  225.             SELECT CASE iIdDialog
  226.                 CASE IDD_WELCOME
  227.                     g_szDest = g_pEnvironment[0].szSystemDir[0]
  228.                     if (g_pEnvironment[0].iInstallType = IT_STANDALONE) or (0 = IsDirWritable(g_szDest) ) then
  229.                         iIdDialog = IDD_METHOD_NONET
  230.                         szDialogProc = c_szMETHOD_DLG_PROC
  231.                     else
  232.                         iIdDialog = IDD_METHOD
  233.                         szDialogProc = c_szMETHOD_DLG_PROC
  234.                     endif
  235.  
  236.  
  237.                 CASE IDD_METHOD
  238.                     g_iMethod =  iReturn
  239.  
  240.                     if iReturn = c_iNETADMIN then
  241.                         iIdDialog = IDD_ADMIN_INFO
  242.                         szDialogProc = c_szNETADMIN_DLG_PROC
  243.                     else
  244.                         iIdDialog = IDD_SELECT_PORT
  245.                         szDialogProc = c_szPORT_DLG_PROC
  246.                     endif
  247.                     iReturn = ReadInfoFile()
  248.                     if iReturn <> 0 then
  249.                         if iReturn <> c_iDO_NET_ADMIN then
  250.                            iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  251.                         else
  252.                             g_szDest =   c_szDO_NET_ADMIN1 + c_szDO_NET_ADMIN2
  253.                             iReturn = DoMsgBox( g_szDest, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  254.                         endif
  255.                         goto QUIT
  256.                     elseif iIdDialog <> IDD_ADMIN_INFO then
  257.                         iReturn = IsSupportedPrinterAttached( ipSuccess )
  258.                         if iReturn AND iSuccess = 1 then
  259.                             if 0 = ReadAllFileGroups() then
  260.                                 if g_iMethod  <> c_iCOMPLETE then
  261.                                     iIdDialog = IDD_SELECT_COMPONENTS
  262.                                     szDialogProc =c_szCOMPONENT_DLG_PROC
  263.                                 else
  264.                                     szDialogProc = c_szEMPTY
  265.                                 endif
  266.                             else
  267.                                 iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  268.                                 goto QUIT
  269.                             endif
  270.                         else
  271.                             iIdDialog = IDD_SELECT_PORT
  272.                             szDialogProc = c_szPORT_DLG_PROC
  273.                         endif
  274.                     endif
  275.  
  276.                  CASE IDD_METHOD_NONET
  277.                     g_iMethod =  iReturn
  278.  
  279.                     iIdDialog = IDD_SELECT_PORT
  280.                     szDialogProc = c_szPORT_DLG_PROC
  281.  
  282.                     iReturn = ReadInfoFile()
  283.                     if iReturn <> 0 then
  284.                         if iReturn <> c_iDO_NET_ADMIN then
  285.                            iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  286.                         else
  287.                             g_szDest =   c_szDO_NET_ADMIN1 + c_szDO_NET_ADMIN2
  288.                             iReturn = DoMsgBox( g_szDest, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  289.                         endif
  290.                         goto QUIT
  291.                     else
  292.                         iReturn = IsSupportedPrinterAttached( ipSuccess )
  293.                         if iReturn AND iSuccess = 1 then
  294.                             if 0 = ReadAllFileGroups() then
  295.                                 if g_iMethod  <> c_iCOMPLETE then
  296.                                     iIdDialog = IDD_SELECT_COMPONENTS
  297.                                     szDialogProc =c_szCOMPONENT_DLG_PROC
  298.                                 else
  299.                                     iReturn = EnoughSpace()
  300.                                     if iReturn = 0 then
  301.                                         iIdDialog = IDD_NO_SPACE
  302.                                         szDialogProc = c_szNOSPACE_DLG_PROC
  303.                                     else
  304.                                         szDialogProc = c_szEMPTY
  305.                                     endif
  306.                                 endif
  307.                             else
  308.                                 iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  309.                                 goto QUIT
  310.                             endif
  311.                         else
  312.                             iIdDialog = IDD_SELECT_PORT
  313.                             szDialogProc = c_szPORT_DLG_PROC
  314.                         endif
  315.                     endif
  316.  
  317.  
  318.  
  319.                 CASE IDD_ADMIN_INFO
  320.  
  321.                     if iReturn = c_iBACK then
  322.                         iIdDialog = IDD_METHOD
  323.                         szDialogProc = c_szMETHOD_DLG_PROC
  324.                     else
  325.                         if 0 = ReadAllFileGroups() then
  326.                             iIdDialog = IDD_SELECT_COMPONENTS
  327.                             szDialogProc =c_szCOMPONENT_DLG_PROC
  328.                             iCheckSound = 1
  329.                         else
  330.                             iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  331.                             goto QUIT
  332.                         endif
  333.  
  334.                     endif
  335.  
  336.                 CASE IDD_SELECT_PORT
  337.  
  338.                     if iReturn = c_iBACK then
  339.                         if g_pEnvironment[0].iInstallType = IT_STANDALONE then
  340.                             iIdDialog = IDD_METHOD_NONET
  341.                             szDialogProc = c_szMETHOD_DLG_PROC
  342.                         else
  343.                             iIdDialog = IDD_METHOD
  344.                             szDialogProc = c_szMETHOD_DLG_PROC
  345.                         endif
  346.  
  347.                     else
  348.                         iReturn = TestBidi(g_pEnvironment[0].runTime.lpszPort[0])
  349.                         '' The return value could be true and have no bidi
  350.                         if iReturn <> 0 AND g_pEnvironment[0].runTime.bHasBidi = 0 then
  351.                             '' If we get here bidi could not be established, so the port type
  352.                             '' is something other than LPT
  353.                             iIdDialog = IDD_SELECT_PRINTER
  354.                             szDialogProc =c_szPRINTER_DLG_PROC
  355.                         elseif g_pEnvironment[0].runTime.bHasBidi = 0 then
  356.                             iIdDialog = IDD_BIDI_PROBLEM
  357.                             szDialogProc =c_szBIDI_PROBLEM_DLG_PROC
  358.                         elseif 0 < lstrlen(g_pEnvironment[0].runTime.lpszDeviceID[0]) then
  359.  
  360.                             iReturn = IsPrinterSupported( g_pEnvironment[0].runTime.lpszDeviceID[0])
  361.                             if iReturn = 0 then
  362.                                 iIdDialog = IDD_UNSUPPORTED_PRINTER
  363.                                 szDialogProc =c_szUNSUPPORTED_DLG_PROC
  364.                             else
  365.                                 iIdDialog = IDD_SELECT_PRINTER
  366.                                 szDialogProc =c_szPRINTER_DLG_PROC
  367.                             endif
  368.                         else
  369.                             iIdDialog = IDD_SELECT_PRINTER
  370.                             szDialogProc =c_szPRINTER_DLG_PROC
  371.                         endif
  372.                     endif
  373.                 CASE IDD_BIDI_PROBLEM
  374.  
  375.                     if iReturn = c_iSKIP then
  376.                             iIdDialog = IDD_BIDI_SKIP
  377.                             szDialogProc = c_szBIDI_SKIP_DLG_PROC
  378.                     elseif iReturn = c_iRETRY then
  379.                         iReturn = TestBidi(g_pEnvironment[0].runTime.lpszPort[0])
  380.  
  381.                         if iReturn <> 0 AND g_pEnvironment[0].runTime.bHasBidi = 0 then
  382.                             '' If we get here bidi could not be established, so the port type
  383.                             '' is something other than LPT
  384.                             iIdDialog = IDD_SELECT_PRINTER
  385.                             szDialogProc =c_szPRINTER_DLG_PROC
  386.                         elseif g_pEnvironment[0].runTime.bHasBidi <> 0 then
  387.                             if 0 < lstrlen(g_pEnvironment[0].runTime.lpszDeviceID[0]) then
  388.  
  389.                                 iReturn = IsPrinterSupported( g_pEnvironment[0].runTime.lpszDeviceID[0])
  390.                                 if iReturn = 0 then
  391.                                     iIdDialog = IDD_UNSUPPORTED_PRINTER
  392.                                     szDialogProc =c_szUNSUPPORTED_DLG_PROC
  393.                                 else
  394.                                     iIdDialog = IDD_SELECT_PRINTER
  395.                                     szDialogProc =c_szPRINTER_DLG_PROC
  396.                                 endif
  397.                             else
  398.                                 iIdDialog = IDD_SELECT_PRINTER
  399.                                 szDialogProc =c_szPRINTER_DLG_PROC
  400.                             endif
  401.                         endif
  402.                     elseif iReturn = c_iPORT then
  403.                         iIdDialog = IDD_SELECT_PORT
  404.                         szDialogProc = c_szPORT_DLG_PROC
  405.                     endif
  406.                 CASE IDD_BIDI_SKIP
  407.  
  408.                     if iReturn = c_iCONTINUE then
  409.  
  410.                         if 0 < lstrlen(g_pEnvironment[0].runTime.lpszDeviceID[0]) then
  411.  
  412.                             iReturn = IsPrinterSupported( g_pEnvironment[0].runTime.lpszDeviceID[0])
  413.                             if iReturn = 0 then
  414.                                 iIdDialog = IDD_UNSUPPORTED_PRINTER
  415.                                 szDialogProc =c_szUNSUPPORTED_DLG_PROC
  416.                             else
  417.                                 iIdDialog = IDD_SELECT_PRINTER
  418.                                 szDialogProc =c_szPRINTER_DLG_PROC
  419.                             endif
  420.                         else
  421.                             iIdDialog = IDD_SELECT_PRINTER
  422.                             szDialogProc =c_szPRINTER_DLG_PROC
  423.                         endif
  424.                     else
  425.                         iIdDialog = IDD_BIDI_PROBLEM
  426.                         szDialogProc =c_szBIDI_PROBLEM_DLG_PROC
  427.                     endif
  428.                 CASE IDD_SELECT_PRINTER
  429.                     if iReturn = c_iBACK then
  430.                         iIdDialog = IDD_SELECT_PORT
  431.                         szDialogProc =c_szPORT_DLG_PROC
  432.                     else
  433.                         if 0 = ReadAllFileGroups() then
  434.                             if g_iMethod  <> c_iCOMPLETE then
  435.                                 iIdDialog = IDD_SELECT_COMPONENTS
  436.                                 szDialogProc =c_szCOMPONENT_DLG_PROC
  437.                             else
  438.                                 iReturn = EnoughSpace()
  439.                                 if iReturn = 0 then
  440.                                     iIdDialog = IDD_NO_SPACE
  441.                                     szDialogProc = c_szNOSPACE_DLG_PROC
  442.                                 else
  443.                                     szDialogProc = c_szEMPTY
  444.                                 endif
  445.                             endif
  446.                         else
  447.                             iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  448.                             goto QUIT
  449.                         endif
  450.                     endif
  451.  
  452.                 CASE IDD_UNSUPPORTED_PRINTER
  453.                     if iReturn = c_iSELECT_PORT then
  454.                         iIdDialog = IDD_SELECT_PORT
  455.                         szDialogProc =c_szPORT_DLG_PROC
  456.                     else
  457.                         iIdDialog = IDD_SELECT_PRINTER
  458.                         szDialogProc =c_szPRINTER_DLG_PROC
  459.                     endif
  460.  
  461.                 CASE IDD_SELECT_COMPONENTS
  462.                     if iReturn = c_iBACK then
  463.                         if g_iMethod = c_iNETADMIN then
  464.                             iIdDialog = IDD_ADMIN_INFO
  465.                             szDialogProc = c_szNETADMIN_DLG_PROC
  466.                         else
  467.                 if iSuccess = 1 then
  468.                                 iIdDialog = IDD_METHOD_NONET
  469.                                 szDialogProc =c_szMETHOD_DLG_PROC
  470.                 else
  471.                                 iIdDialog = IDD_SELECT_PRINTER
  472.                                 szDialogProc =c_szPRINTER_DLG_PROC
  473.                 endif
  474.                         endif
  475.                     else
  476.                         iReturn = EnoughSpace()
  477.                         if iReturn = 0 then
  478.                             iIdDialog = IDD_NO_SPACE
  479.                             szDialogProc = c_szNOSPACE_DLG_PROC
  480.                         else
  481.                             szDialogProc = c_szEMPTY
  482.                         endif
  483.                     endif
  484.  
  485.  
  486.                 CASE IDD_NO_SPACE
  487.                     if iReturn = c_iSELECT_COMPONENTS then
  488.                         iIdDialog = IDD_SELECT_COMPONENTS
  489.                         szDialogProc =c_szCOMPONENT_DLG_PROC
  490.                     else
  491.                         GOTO QUIT
  492.                     endif
  493.             END SELECT
  494.         end if
  495.  
  496.     wend
  497.  
  498.  
  499.     '' Is sound already on???
  500.     '' CheckSound will return number not equal to zero if sound is not on and
  501.     '' sound component is enabled.
  502.     if  CheckSound = 0 then
  503.  RESUME_SOUND:
  504.         iReturn = SetupUIDlg(CUIDLL$, IDD_SOUND, c_szASK_SOUND_DLG_PROC, 0, c_szEMPTY )
  505.         if  iReturn = c_iYES then
  506.             g_iSound = TRUE     '' We want to turn sound on if TRUE
  507.         elseif iReturn = c_iEXIT then
  508.             GOSUB ASKQUIT
  509.             goto RESUME_SOUND
  510.         endif
  511.         UIpop 1
  512.     endif
  513.  
  514.     iReturn = FSetSymbolValue( c_lpszSECTION_LIST, c_szEMPTY)
  515.     iReturn =FSetSymbolValue( c_lpszCOMPONENT_LIST, c_szEMPTY)
  516.  
  517.     SetRestartDir g_pEnvironment[0].szTempDir[0]
  518.     '$IFDEF DEBUG
  519.     WriteToLogFile "Restart Directory: "+ g_szDest
  520.     OutputDebugString("Restarting at "+g_szDest+" ..." + chr$(10))
  521.     '$ENDIF
  522.  
  523.  
  524.     g_szDest = UIStartDlg( CUIDLL$, IDD_INVISIBLE, c_szINVISIBLE_DLG_PROC, 0, c_szEMPTY)
  525.     iReturn = Install()
  526.     UIPop 1
  527.     if iReturn = c_iINVALID then
  528.          goto QUIT
  529.     elseif iReturn = c_iGO_BACK then
  530.         iReturn = DoMsgBox( c_szNO_SELECTIONS,c_szINSTALL_ABORT, 36)
  531.         if iReturn = 6 then
  532.             iIdDialog = IDD_SELECT_COMPONENTS
  533.             szDialogProc =c_szCOMPONENT_DLG_PROC
  534.             goto GOBACK
  535.         endif
  536.         goto QUIT
  537.     endif
  538.     if 0 = GetListLength(c_szFAILURE) then
  539.         iReturn = SetupUIDlg(CUIDLL$, IDD_VERIFICATION,c_szVERIFY_DLG_PROC , 0, c_szEMPTY )
  540.     else
  541.         iReturn = SetupUIDlg(CUIDLL$, IDD_VERIFICATION_W_FAIL, c_szVERIFY_FAIL_DLG_PROC, 0, c_szEMPTY)
  542.     endif
  543.     UIPop 1
  544.     if g_iMethod = c_iNETADMIN then
  545.         iReturn = SetupUIDlg(CUIDLL$, IDD_FINAL_ADMIN, c_szFINAL_ADMIN_DLG_PROC, 0, c_szEMPTY)
  546.     else
  547.         iReturn = SetupUIDlg(CUIDLL$, IDD_FINAL, c_szFINAL_DLG_PROC, 0, c_szEMPTY )
  548.     endif
  549.  
  550.     UIPop 1
  551.     if RestartListEmpty = 0 then
  552.  
  553.         WriteToLogFile "[RestartList]"
  554.  
  555.  
  556. RESTART:
  557.         iReturn = SetupUIDlg(CUIDLL$, IDD_ASK_REBOOT, c_szREBOOT_DLG_PROC, 0, c_szEMPTY)
  558.         if iReturn = c_iREBOOT then
  559.  
  560.             Clean
  561.             if ExitExecRestart = 0 then
  562.         '$IFDEF DEBUG
  563.         WriteToLogFile "Error restarting windows!"
  564.         OutputDebugString("Error Restarting windows")
  565.         '$ENDIF
  566.  
  567.                 goto RESTART
  568.             endif
  569.         endif
  570.     elseif iReturn = c_iCONTINUE AND g_pEnvironment[0].runTime.bReboot then
  571.         iReturn = SetupUIDlg(CUIDLL$, IDD_ASK_REBOOT, c_szREBOOT_DLG_PROC, 0, c_szEMPTY)
  572.         if iReturn = c_iREBOOT then
  573.  
  574.             if CleanTempDir(g_pEnvironment[0].szTempDir[0]) = 0 then
  575.             '$IFDEF DEBUG
  576.             OutputDebugString("error deleting temp dir: "+ g_pEnvironment[0].szTempDir[0] + chr$(10))
  577.             '$ENDIF
  578.             endif
  579.             Clean
  580.  
  581.             '$IFNDEF MSTEST_20
  582.             iReturn = ExitWindows(EW_RESTARTWINDOWS, 0)
  583.             '$ENDIF
  584.     else
  585.         if CleanTempDir( g_pEnvironment[0].szTempDir[0] ) = 0 then
  586.             '$IFDEF DEBUG
  587.             OutputDebugString("error deleting temp dir:"+g_szDest+ chr$(10))
  588.             '$ENDIF
  589.         endif
  590.     endif
  591.  
  592.     endif
  593.  
  594.     GOTO QUIT
  595.  
  596.  
  597. QUIT:
  598.     Clean
  599.     UIPop 1
  600.  
  601.     END
  602.  
  603. ASKQUIT:
  604.     iReturn = SetupUIDlg(CUIDLL$, IDD_EXIT_INCOMPLETE, c_szEXIT_DLG_PROC, 0, c_szEMPTY)
  605.     if iReturn = c_iExit then
  606.         UIPopAll
  607.         ERROR STFQUIT
  608.     else
  609.         UIPop 1
  610.     endif
  611.  
  612.     RETURN
  613.  
  614. static sub Clean
  615.  
  616. '$IFDEF DEBUG
  617.         OutputDebugString "Cleaning up, CloseLogFile" + chr$(10)
  618. '$ENDIF
  619.  
  620.     CloseLogFile
  621.  
  622. '$IFDEF DEBUG
  623.         OutputDebugString "ending 3d module..."+ chr$(10)
  624. '$ENDIF
  625.     if Installed3D then
  626.         qg_iReturn = End3d( iModule )
  627.     endif
  628.  
  629.  
  630. '$IFDEF DEBUG
  631.         OutputDebugString "Releaseing info file..." +chr$(10)
  632. '$ENDIF
  633.  
  634.     iReturn = ReleaseInfoFile()
  635.  
  636.  
  637. '$IFDEF DEBUG
  638.         OutputDebugString "calling support cleanup..." + chr$(10)
  639. '$ENDIF
  640.  
  641.     g_iReturn% = Cleanup()
  642.  
  643.  
  644.  
  645. '$IFDEF DEBUG
  646.         OutputDebugString "End of Clean up..." +chr$(10)
  647. '$ENDIF
  648.  
  649. end sub
  650.  
  651. function CheckLZExpand( iValue%, szFile1$, szFile2$ ) statiC as integer
  652.     dim iPerformExpand as integer
  653.     dim iExpanded as integer
  654.     dim szDate1 as string
  655.     dim szDate2 as string
  656.  
  657.     iPerformExpand = FALSE
  658.     iExpanded = FALSE
  659. '$IFDEF DEBUG
  660.         OutputDebugString " Checked version for 1: "+szFile1+ "; 2: "+szFile2+ chr$(10)
  661. '$ENDIF
  662.  
  663.     SELECT CASE iValue
  664.  
  665.         CASE    c_iVERSION_1_NEWER
  666. '$IFDEF DEBUG
  667.         OutputDebugString " Version 1 newer " +chr$(10)
  668. '$ENDIF
  669.             iPerformExpand = TRUE
  670.         CASE    c_iVERSION_1_NOT_FOUND
  671. '$IFDEF DEBUG
  672.         OutputDebugString " version 1 not found" +chr$(10)
  673. '$ENDIF
  674.             '' Problem, but will still run without 3D
  675.         CASE    c_iVERSION_1_2_SAME
  676. '$IFDEF DEBUG
  677.         OutputDebugString "versions are the same " +chr$(10)
  678. '$ENDIF
  679.             iExpanded = TRUE
  680.         CASE    c_iVERSION_1_2_NOT_FOUND
  681. '$IFDEF DEBUG
  682.         OutputDebugString " versions 1 and 2 were not found" +chr$(10)
  683. '$ENDIF
  684.             '' Problem, but will still run without 3D
  685.         CASE    c_iVERSION_1_2_NO_VERSION
  686. '$IFDEF DEBUG
  687.         OutputDebugString "no version info in either file " +chr$(10)
  688. '$ENDIF
  689.             '' No version info found, voth files exist,  compare dates??
  690.             szDate1 = GetDateOfFile( szFile1 )
  691.             szDate2 = GetDateOfFile( szFile2 )
  692. '$IFDEF DEBUG
  693.         OutputDebugString "szDate1: "+szDate1+ "szDate2: "+szDate2 +chr$(10)
  694. '$ENDIF
  695.             if szDate1 > szDate2 then
  696.               iPerformExpand = TRUE
  697.             else
  698.               iExpanded = TRUE
  699.             endif
  700.         CASE    c_iVERSION_2_NEWER
  701. '$IFDEF DEBUG
  702.         OutputDebugString " version 2 is newer" +chr$(10)
  703. '$ENDIF
  704.             iExpanded = TRUE
  705.         CASE    c_iVERSION_2_NOT_FOUND
  706. '$IFDEF DEBUG
  707.         OutputDebugString " version 2 is not found" +chr$(10)
  708. '$ENDIF
  709.             iPerformExpand = TRUE
  710.     END SELECT
  711.  
  712.     if iPerformExpand AND ExpandFile(szFile1, szFile2) then
  713. '$IFDEF DEBUG
  714.         OutputDebugString " Expand Succeeded" +chr$(10)
  715. '$ENDIF
  716.        iExpanded = TRUE
  717.     endif
  718.  
  719.     CheckLZExpand = iExpanded
  720. end function
  721.  
  722. static function Check3D  as integer
  723.     szDest$ = g_pEnvironment[0].szSystemDir[0]
  724.     szDest$ = MakePath(szDest, c_szCTRL3DFILE)
  725.  
  726.     szTempFile$ = GetSymbolValue("STF_SRCDIR")
  727.     szSrcFile$ = MakePath( szTempFile, c_szCTRL3DFILE_COMPRESSED)
  728.  
  729.     dim iCopy as integer
  730.     dim pCopy as pointer to integer
  731.     dim iExpanded as integer
  732.  
  733.     iExpanded = FALSE
  734.     pCopy = VARPTR( iCopy )
  735.  
  736.     '' First We do a compare on the WINDOWS\SYSTEM direcotry
  737.     iReturn = FileVersionCompare(szSrcFile, szDest, pCopy)
  738.     iExpanded = CheckLZExpand( iCopy, szSrcFile, szDest )
  739.  
  740.     if iExpanded = FALSE AND IsWindowShared then
  741.         '$IFDEF DEBUG
  742.             OutputDebugString "running Shared windows..." +chr$(10)
  743.         '$ENDIF
  744.         szDest$ = g_pEnvironment[0].szWindowsDir[0]
  745.         szDest$ = MakePath(szDest, c_szCTRL3DFILE)
  746.         iReturn = FileVersionCompare(szSrcFile, szDest, pCopy)
  747.         iExpanded = CheckLZExpand( iCopy, szSrcFile, szDest)
  748.     endif
  749.  
  750.     Check3D = iExpanded
  751. END function
  752.  
  753.  
  754. STATIC Function MergeStrings (szStr1$, szStr2$) as string
  755.     g_szDest = STRING$(len(szStr1) + len(szStr2) + 10, 0)
  756.     lTemp& = lstrcat(g_szDest,szStr1)
  757.     lTemp& = lstrcat(g_szDest,szStr2)
  758.     MergeStrings = g_szDest
  759. END FUNCTION
  760.  
  761. '**
  762. '** Purpose:
  763. '**     Builds the copy list and performs all installation operations.
  764. '** Arguments:
  765. '**     none.
  766. '** Returns:
  767. '**     0 on success, nonzero on error.
  768. '*************************************************************************
  769. FUNCTION Install() STATIC    AS INTEGER
  770.     dim iReturn as integer
  771.  
  772.     '' Save user's options to log file
  773.     iReturn = LogUserOptions()
  774.     ''handle iReturn <> 0
  775.  
  776.     iReturn = PutComponentsInCopyList( c_lpszSECTION_LIST, c_lpszCOMPONENT_LIST )
  777.  
  778.     '' if iReturn is true then the setup.hp file is corrupt.
  779.     if iReturn then
  780.  
  781.         iReturn = DoMsgBox( c_szCORRUPT_SETUP_FILE, c_szINSTALL_ABORT, MB_OK or MB_APPLMODAL or MB_ICONSTOP )
  782.         iReturn = c_iINVALID
  783.  
  784.     elseif 0 = GetListLength(c_lpszSECTION_LIST) OR  0 = GetListLength(c_lpszCOMPONENT_LIST ) then
  785.         iReturn = c_iGO_BACK
  786.     else
  787.         '' Create copy list and copy files
  788.         iReturn = CopyFiles()
  789.         ''handle iReturn <> 0
  790.  
  791. '$IFDEF DEBUG
  792.         OutputDebugString( "======" + chr$(10))
  793.         OutputDebugString( "CopyFiles return: " + STR$(iReturn) + chr$(10))
  794. '$ENDIF
  795.  
  796.         if (iReturn = 0) then
  797.  
  798.             iCursor% = ShowWaitCursor
  799.             '' Update .ini files
  800.             iReturn = IniActionUpdate()
  801.             ''handle iReturn <> 0
  802. '$IFDEF DEBUG
  803.             OutputDebugString( "IniActionUpdate return: " + STR$(iReturn) + chr$(10))
  804. '$ENDIF
  805.             RestoreCursor iCursor%
  806.         endif
  807. '$IFDEF DEBUG
  808.         OutputDebugString( "======" + chr$(10))
  809. '$ENDIF
  810.    endif
  811.  
  812.     iRet%  = LogInstallation
  813.     Install = iReturn
  814. END FUNCTION
  815.  
  816.  
  817. FUNCTION LogEnvironment() STATIC as integer
  818.  
  819.     g_pEnvironment = GetInstallEnvironment()
  820.     szTemp$ = g_pEnvironment[0].szWindowsDir[0]
  821.     OpenLogFile MakePath(szTemp$, c_szLOG_FILE), 0
  822.     WriteToLogFile "[System Environment]"
  823.     lFree& =  GetFreeSpaceForDrive("C")
  824.     if lFree > 1000 then
  825.         lFree = lFree /1000
  826.     endif
  827.     lTotal& = GetTotalSpaceForDrive("C")
  828.     if lTotal > 1000 then
  829.         lTotal = lTotal / 1000
  830.     endif
  831.     WriteToLogFile "Disk Space: " + str$(lFree) + "K bytes free out of " + str$(lTotal) + "K bytes total space"
  832.     lFreeMem = GetFreeSpace(0)
  833.     if lFreeMem > 1000  then
  834.         lFreeMem = lFreeMem / 1000
  835.     endif
  836.     WriteToLogFile "Memory: " + str$(lFreeMem) + "K bytes free"
  837.     WriteToLogFile "Windows Version: " + str$(g_pEnvironment[0].iOSMajor) + " ." + str$(g_pEnvironment[0].iOSMinor)
  838.     WriteToLogFile "Path: " + GetEnvVariableValue("PATH")
  839.     ''szTemp$ = g_pEnvironment[0].szWindowsDir[0]
  840.     WriteToLogFile MergeStrings("Windows Directory: ", g_pEnvironment[0].szWindowsDir[0])
  841.     WriteToLogFile MergeStrings("System Directory: ", g_pEnvironment[0].szSystemDir[0])
  842.     WriteToLogFile ""
  843.     WriteToLogFile ""
  844.  
  845.     LogEnvironment = 0
  846. END FUNCTION
  847.  
  848. FUNCTION LogInstallation() STATIC as integer
  849.     iLen% = GetListLength(c_szLOG_FILE_LIST)
  850.     if 0 <> iLen then
  851.         WriteToLogFile ""
  852.         WriteToLogFile "[InstallTimeModificationsAdditions]"
  853.           iStart% = 1
  854.         while iLen >= iStart
  855.             WriteToLogFile GetListItem(c_szLOG_FILE_LIST, iStart)
  856.             iStart = iStart + 1
  857.         wend
  858.     endif
  859.     LogInstallation = 0
  860. END FUNCTION
  861.  
  862.  
  863. FUNCTION LogUserOptions() STATIC as integer
  864.  
  865.     DIM szTemp$
  866.     WriteToLogFile "[User Selected Options]"
  867.     g_pEnvironment = GetInstallEnvironment()
  868.     SELECT CASE g_pEnvironment[0].runTime.iInstallMethod
  869.  
  870.         CASE IM_COMPLETE
  871.             szTemp = "Complete"
  872.         CASE IM_CUSTOM
  873.             szTemp = "Custom"
  874.         CASE IM_NETADMIN
  875.             szTemp = "Net Admin"
  876.  
  877.     END SELECT
  878.     WriteToLogFile "Method of Installation : " + szTemp
  879.    '' szTemp$ = g_pEnvironment[0].runtime.lpszPort[0]
  880.     WriteToLogFile MergeStrings("Select Port: ", g_pEnvironment[0].runtime.lpszPort[0])
  881.     ''szTemp$ = g_pEnvironment[0].runtime.lpszDeviceID[0]
  882.     WriteToLogFile MergeStrings("Select Printer: ",g_pEnvironment[0].runtime.lpszDeviceID[0] )
  883.     WriteToLogFile ""
  884.     WriteToLogFile ""
  885.  
  886.     LogUserOptions = 0
  887. END FUNCTION
  888.  
  889. FUNCTION CopyFiles() STATIC as integer
  890.     dim szSection as string
  891.     dim szDest as string
  892.     iReturn% = 0
  893.  
  894.     ClearCopyList
  895.     ClearBillboardList
  896.  
  897.     iGaugeX% = GetGaugeDlgUnitsX()
  898.     iGaugeY% = GetGaugeDlgUnitsY()
  899.  
  900.         iX% = ((g_pEnvironment[0].iDisplayX  )/2 / iGaugeX) * 4
  901.         iX = iX -  (c_iPROGRESS_WIDTH)/8   ''+ ((c_iPROGRESS_WIDTH * iGaugeX)/4) /2
  902.         iY = 2
  903.         SetCopyGaugePosition iX,iY
  904.  
  905.     AddToBillBoardList  "mscuistf.dll", IDD_BILLBOARD_1,c_szBILLBOARD_DLG_PROC,3
  906.     ''AddToBillBoardList  "mscuistf.dll", IDD_BILLBOARD_2,c_szBILLBOARD_DLG_PROC,1
  907.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  908.     TempDir$ = g_pEnvironment[0].szTempDir[0]
  909.     ReadInfFile MakePath(TempDir$, c_szINFO_FILE)
  910.  
  911.  
  912.  
  913.     iListLen% = GetListLength( c_lpszSECTION_LIST )
  914.  
  915.     while iListLen > 0
  916.  
  917.         szDest = GetListItem( c_lpszSECTION_LIST, iListLen )
  918.         iListLen = iListLen - 1
  919.         szSection = GetListItem( c_lpszSECTION_LIST, iListLen )
  920.         iListLen = iListLen - 1
  921.         '' If this is true then setup file is corrupted
  922.         if lstrlen(szSection) = 0 OR lstrlen(szDest) = 0 then
  923. '$IFDEF DEBUG
  924.             OutputDebugString( "Error Adding section: " + szSection + ", to dest: " + szDest + chr$(10) )
  925. '$ENDIF
  926.             iReturn = c_iINVALID
  927.             goto ABORT2
  928.         endif
  929. '$IFDEF DEBUG
  930.         OutputDebugString( "Adding section: " + szSection + ", to dest: " + szDest + chr$(10) )
  931. '$ENDIF
  932.         AddSectionFilesToCopyList szSection, srcDir,  szDest  '' MergeStrings(g_pEnvironment[0].szWindowsDir[0],c_szEMPTY)
  933.     wend
  934.     CopyFilesInCopyList
  935.  
  936.     ClearCopyList
  937.     ClearBillboardList
  938.     ''UIPop 1
  939.     ''g_szDest = UIStartDlg( "mscuistf.dll", IDD_BILLBOARD_2, c_szBILLBOARD_DLG_PROC, 0, c_szEMPTY)
  940. ALDN:
  941.  
  942.     if IsComponentSelected(c_szALADDIN) then
  943.  
  944.  
  945.         if IsComponentSelected( c_szALADDIN_CUSTOM) then
  946.             g_szDest = UIStartDlg( "mscuistf.dll", IDD_ALADDIN, c_szALADDIN_DLG_PROC, 0, c_szEMPTY)
  947.             UIPop 1
  948.         else
  949.  
  950.             szDir$ = STRING$(MAX_PATH, 0)
  951.             if GetComponentDir(c_szALADDIN, szDir) = 0  then
  952.                 '' handle this later
  953.             endif
  954.  
  955.             szAladdin$ = c_szEMPTY
  956.  
  957.             if lstrlen(szDir) <> 0 then
  958.                 szAladdin = MakePath(szDir ,c_szALADDIN_CMD_LINE)
  959.             else
  960.                 szAladdin = c_szALADDIN_CMD_LINE
  961.             endif
  962.  
  963.             if IsComponentSelected( c_szALL_FONTS ) then
  964.                 szAladdin = szAladdin + MakePath(g_pEnvironment[0].szTempDir[0], c_szALLFONTS_FILE)
  965.             else
  966.                 szAladdin = szAladdin + MakePath(g_pEnvironment[0].szTempDir[0], c_szFONTLIST_FILE)
  967.             endif
  968. '$IFDEF DEBUG
  969.         OutputDebugString " Aladdin CommandLine: " +szAladdin+chr$(10)
  970. '$ENDIF
  971.  
  972.             if SetExecBlock(szAladdin, c_szALADDIN_EXIT_MSG) then
  973.                 g_szDest = UIStartDlg( "mscuistf.dll", IDD_INVISIBLE, c_szEXECUTE_DLG_PROC, 0, c_szEMPTY)
  974.  
  975.                 UIPop 1
  976.                 iReturn = GetExecBlockReturn()
  977.  
  978.                 if iReturn < 32 then
  979.                     g_szDest = c_szUNABLE_ALADDIN1 +" "+ c_szUNABLE_ALADDIN2+c_szUNABLE_ALADDIN3
  980.                     iRet% = DoMsgBox(g_szDest,c_szUNABLE_ALADDIN_CAP , MB_TASKMODAL+MB_ICONHAND+MB_OK)
  981.                     UIPop 1
  982.                 else
  983.                     '' Since it worked, set iReturn to 0 so that we return success bdg 10/14/94
  984.                     iReturn = 0
  985.                 endif
  986.  
  987.             else
  988.                '' There was a problem so tell the user how to run aladdin from the icon.
  989.                g_szDest = UIStartDlg( "mscuistf.dll", IDD_ALADDIN, c_szALADDIN_DLG_PROC, 0, c_szEMPTY)
  990.                UIPop 1
  991.             endif
  992.  
  993.         endif
  994.     endif
  995. ABORT:
  996.  
  997. ABORT2:
  998.     RemoveSymbol c_lpszSECTION_LIST
  999.     RemoveSymbol c_lpszCOMPONENT_LIST
  1000.       CopyFiles = iReturn
  1001. END FUNCTION
  1002.  
  1003.  
  1004.  
  1005. '**
  1006. '** Purpose:
  1007. '**     Appends a file name to the end of a directory path,
  1008. '**     inserting a backslash character as needed.
  1009. '** Arguments:
  1010. '**     szDir$  - full directory path (with optional ending "\")
  1011. '**     szFile$ - filename to append to directory
  1012. '** Returns:
  1013. '**     Resulting fully qualified path name.
  1014. '*************************************************************************
  1015. FUNCTION MakePath( szDir$, szFile$ ) STATIC AS STRING
  1016.     IF szDir$ = c_szEMPTY THEN
  1017.         MakePath = szFile$
  1018.     ELSE
  1019.         IF szFile$ <> c_szEMPTY THEN
  1020.             IF MID$(szDir$, lstrlen(szDir$), 1) <> "\" THEN
  1021.                 szDir = MergeStrings(szDir, "\")
  1022.             ENDIF
  1023.             szDir = MergeStrings(szDir, szFile)
  1024.         ENDIF
  1025.         MakePath = szDir$
  1026.     END IF
  1027. END FUNCTION
  1028.  
  1029. STATIC FUNCTION SetupUIDlg(szDll$, idDlg%, szDlgProc$, idHelpDlg%, szHelpProc$) as integer
  1030.  
  1031.  
  1032.     sz$ = UIStartDlg( szDll, idDlg, szDlgProc, idHelpDlg, szHelpProc)
  1033.     iReturn% = GetButtonId(sz)
  1034.     SetupUIDlg = iReturn
  1035.  
  1036. END FUNCTION
  1037.  
  1038. STATIC FUNCTION GetButtonId(szString$) as integer
  1039.  
  1040.     SELECT CASE szString
  1041.         CASE IDC_COMPLETE_SYMBOL
  1042.             GetButtonId =  c_iCOMPLETE
  1043.         CASE IDC_CUSTOM_SYMBOL
  1044.             GetButtonId =  c_iCUSTOM
  1045.         CASE IDC_NETADMIN_SYMBOL
  1046.             GetButtonId =  c_iNETADMIN
  1047.         CASE IDC_RETRY_SYMBOL
  1048.             GetButtonId =  c_iRETRY
  1049.         CASE IDC_PORT_SYMBOL
  1050.             GetButtonId =  c_iPORT
  1051.         CASE IDC_SKIP_SYMBOL
  1052.             GetButtonId =  c_iSKIP
  1053.         CASE IDC_CHANGE_OPTION_SYMBOL
  1054.             GetButtonId =  c_iCHANGE_OPTION
  1055.         CASE IDC_PATH_SYMBOL
  1056.             GetButtonId =  c_iPATH
  1057.         CASE IDC_SELECT_COMPONENTS_SYMBOL
  1058.             GetButtonId =  c_iSELECT_COMPONENTS
  1059.         CASE IDC_SELECT_PORT_SYMBOL
  1060.             GetButtonId =  c_iSELECT_PORT
  1061.         CASE IDC_SELECT_PRINTER_SYMBOL
  1062.             GetButtonId =  c_iSELECT_PRINTER
  1063.         CASE IDC_RUN_FILE_MANAGER_SYMBOL
  1064.             GetButtonId =  c_iRUN_FILE_MANAGER
  1065.         CASE IDC_README_SYMBOL
  1066.             GetButtonId =  c_iREADME
  1067.         CASE IDC_OVERVIEW_SYMBOL
  1068.             GetButtonId =  c_iOVERVIEW
  1069.         CASE IDC_REBOOT_SYMBOL
  1070.             GetButtonId =  c_iREBOOT
  1071.         CASE IDC_RESUME_SYMBOL
  1072.             GetButtonId =  c_iRESUME
  1073.         CASE IDC_BACK_SYMBOL
  1074.             GetButtonId =  c_iBACK
  1075.         CASE IDC_CONTINUE_SYMBOL
  1076.             GetButtonId =  c_iCONTINUE
  1077.         CASE IDC_EXIT_SYMBOL
  1078.             GetButtonId =  c_iEXIT
  1079.         CASE IDOK_SYMBOL
  1080.             GetButtonId =  c_iOK
  1081.         CASE IDCANCEL_SYMBOL
  1082.             GetButtonId =  c_iCANCEL
  1083.         CASE IDYES_SYMBOL
  1084.             GetButtonId =  c_iYES
  1085.         CASE IDNO_SYMBOL
  1086.             GetButtonId =  c_iNO
  1087.         CASE ELSE
  1088.             GetButtonId = c_iINVALID
  1089.  
  1090.     END SELECT
  1091. END FUNCTION
  1092.  
  1093.