home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / sdk / mapi / winntrt / setup.mst < prev    next >
Encoding:
Text File  |  1995-07-11  |  17.1 KB  |  542 lines

  1. '**************************************************************************
  2. '*                       MAPI 1.0 PDK/NT RunTime Setup
  3. '**************************************************************************
  4.  
  5. '$INCLUDE 'setupapi.inc'
  6. '$INCLUDE 'mscpydis.inc'    ''System
  7. '$INCLUDE 'msdetect.inc'    ''Detects Avalilable Disk Space
  8.  
  9. CONST MB_YESNO        = 4
  10. CONST MB_ICONQUESTION = 32
  11. CONST IDNO            = 7
  12.  
  13. ''Dialog ID's
  14. CONST WELCOME       = 100
  15. CONST WELCOME32     = 102
  16. CONST ASKQUIT       = 200
  17. CONST ASKQUIT32     = 202
  18. CONST DESTPATH      = 300
  19. CONST DESTPATH32    = 302
  20. CONST EXITFAILURE   = 400
  21. CONST MAPIRUNNING    = 500
  22. CONST EXITQUIT      = 600
  23. CONST EXITSUCCESS   = 700
  24. CONST OPTIONS       = 800
  25. CONST APPHELP       = 900
  26. CONST APPHELP2      = 1500
  27. CONST APPHELP3      = 1700
  28. CONST APPHELP4      = 1800
  29. CONST MAPIRENAME16  = 2000
  30. CONST MAPIRENAME32  = 2100
  31. CONST CHECK         = 2500
  32. CONST BADPATH       = 6400
  33. CONST DEVSPACE      = 25000000
  34. CONST SYSSPACE      = 15000000
  35.  
  36. ''From MSKB: Q88414
  37. CONST WS_VISIBLE         = &H10000000
  38. CONST WS_BORDER            = &H00800000
  39. CONST WS_CLIPCHILDREN    = &H02000000
  40. CONST GWL_STYLE            = -16
  41. CONST SW_SHOWMAXIMIZED  = 3
  42.  
  43.  
  44. ''Bitmap ID
  45. CONST LOGO = 1
  46.  
  47. '' Win NT = 32, Win 3.x = 16
  48. GLOBAL INSTALLING%
  49.  
  50. GLOBAL File1
  51.  
  52. ''File Types
  53. GLOBAL DEST$        ''Default destination directory.
  54. GLOBAL WINDRIVE$    ''Windows Drive Letter.
  55. GLOBAL OPTCUR$      ''Option selection from option dialog.
  56. GLOBAL CHECKSTATES$
  57. GLOBAL WinSysDir$
  58. GLOBAL EXESuffix$
  59. GLOBAL SrcDir$
  60. GLOBAL CUIDLL$
  61.  
  62. DECLARE SUB Install
  63. DECLARE SUB RenameMAPI
  64. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  65. DECLARE FUNCTION FIsSpoolerRunning LIB "mscuistf.dll" () AS INTEGER
  66. DECLARE FUNCTION WorkingWinExec LIB "mscuistf.dll" (szDir$, szFile$, szCmdLine$) AS INTEGER
  67.  
  68. DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%, iShow%) AS INTEGER
  69. DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, ffset%, style%) AS LONG
  70.  
  71.  
  72. INIT:
  73.     INSTALLING% = 32
  74.     
  75.     '' Maximize the Window - MSKB: Q88414 - piece of cakey
  76.     hWnd% = HwndFrame()
  77.     i1& = SetWindowLong(hWnd%, GWL_STYLE, WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
  78.     j1% = ShowWindow(hWnd%, SW_SHOWMAXIMIZED)
  79.     
  80.     
  81.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  82.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  83.  
  84.     MajorVer% = GetWindowsMajorVersion()
  85.     MinorVer% = GetWindowsMinorVersion()
  86.  
  87.     IF MajorVer% = 3 AND MinorVer% = 95 THEN
  88.         i% = DoMsgBox("The MAPI PDK run time install does not support Windows 95.  Please use the MAPI components supplied with Windows 95.", "Incorrect Operating System", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  89.         END
  90.     ELSE
  91.         IF  MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN
  92.             IF INSTALLING% = 32 THEN
  93.                 i% = DoMsgBox("Microsoft Windows NT version 3.51 is required for this software.  Please upgrade your version of Windows NT.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  94.                 END
  95.             ELSE
  96.                 i% = DoMsgBox("Microsoft Windows version 3.10 or greater is required for this software.  Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  97.                 END
  98.             END IF
  99.         END IF
  100.     END IF
  101.  
  102.     SetBitmap CUIDLL$, LOGO
  103.     IF INSTALLING% = 32 THEN
  104.         SetTitle "Windows Messaging System Run Time Setup"
  105.     ELSE
  106.         SetTitle "Windows Messaging System PDK Setup"
  107.     END IF
  108.  
  109.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  110.     IF szInf$ = "" THEN
  111.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  112.     END IF
  113.     ReadInfFile szInf$
  114.  
  115.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  116.     DEST$ = WINDRIVE$ + ":\MAPI.PDK"
  117.  
  118.     OPTCUR$ = "2"
  119.  
  120. WELCOME:
  121.     IF INSTALLING% = 32 THEN
  122.         sz$ = UIStartDlg(CUIDLL$, WELCOME32, "FInfoDlgProc", APPHELP, HELPPROC$)
  123.     ELSE
  124.         sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  125.     END IF
  126.     IF sz$ = "CONTINUE" THEN
  127.         UIPop 1
  128.     ELSE
  129.         GOSUB ASKQUIT
  130.         GOTO WELCOME
  131.     END IF
  132.  
  133.  
  134.     InNT% = GetWOWMode()
  135.  
  136.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  137.     IF INSTALLING% = 32 THEN
  138.         WinSysDir$ = GetWindowsDir() + "SYSTEM32\"
  139.         EXESuffix$ = "32"
  140.     ELSE
  141.         WinSysDir$ = GetWindowsDir() + "SYSTEM\"
  142.         EXESuffix$ = ""
  143.     ENDIF
  144.  
  145. MAPIRUNNING:
  146.     IF FIsSpoolerRunning() = 1 THEN
  147.         sz$ = UIStartDlg(CUIDLL$, MAPIRUNNING, "FInfoDlgProc", APPHELP4, HELPPROC$)
  148.         IF sz$ = "EXIT" THEN
  149.             UIPopAll
  150.             END
  151.         END IF
  152.  
  153. '' Old stuff from when MAPIRUNNING had a "CONTINUE" button
  154. ''        IF sz$ = "CONTINUE" THEN
  155. ''            IF FIsSpoolerRunning() = 0 THEN
  156. ''                UIPop 1
  157. ''            ELSE
  158. ''                GOTO MAPIRUNNING
  159. ''            ENDIF
  160. ''        ELSE
  161. ''            GOSUB ASKQUIT
  162. ''            GOTO MAPIRUNNING
  163. ''        END IF
  164.  
  165.     END IF
  166.  
  167. ''    Back up Mail 3.x MAPI files if necessary
  168.     RenameMAPI
  169.  
  170. '' Set the default value for the Sample Files RADIO Button.
  171.     AddListItem "CheckItemsIn", "ON"
  172.  
  173.     IF INSTALLING% = 16 THEN
  174. OPTION:
  175.         SetSymbolValue "RadioDefault", OPTCUR$
  176. OPTL1:
  177.         sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", APPHELP2, HELPPROC$)
  178.         OPTCUR$ = GetSymbolValue("ButtonChecked")
  179.  
  180.         IF sz$ = "CONTINUE" THEN
  181.             UIPop(1)
  182.         ELSEIF sz$ = "REACTIVATE" THEN
  183.             GOTO OPTL1
  184.         ELSE
  185.             GOSUB ASKQUIT
  186.             GOTO OPTION
  187.         END IF
  188.     ELSE
  189.         OPTCUR$ = "1"
  190.     END IF
  191.  
  192. GETPATH:
  193.     SetSymbolValue "EditTextIn", DEST$
  194.     SetSymbolValue "EditFocus", "END"
  195. GETPATHL1:
  196.     IF INSTALLING% = 32 THEN
  197.         sz$ = UIStartDlg(CUIDLL$, DESTPATH32, "FEditDlgProc", APPHELP3, HELPPROC$)
  198.     ELSE
  199.         sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP3, HELPPROC$)
  200.     END IF
  201.     DEST$ = GetSymbolValue("EditTextOut")
  202.  
  203.     IF sz$ = "CONTINUE" THEN
  204.         IF IsDirWritable(DEST$) = 0 THEN
  205.             GOSUB BADPATH
  206.             GOTO GETPATHL1
  207.         END IF
  208.         UIPop 1
  209.     ELSEIF sz$ = "REACTIVATE" THEN
  210.         GOTO GETPATHL1
  211.     ELSEIF sz$ = "BACK" THEN
  212.         UIPop 1
  213.         IF INSTALLING% = 16 THEN
  214.             GOTO OPTION
  215.         ELSE
  216.             GOTO WELCOME
  217.         END IF
  218.     ELSE
  219.         GOSUB ASKQUIT
  220.         GOTO GETPATH
  221.     END IF
  222.  
  223. '' Check disk space
  224.     free& = GetFreeSpaceForDrive(MID$(DEST$, 1, 1))
  225.     IF OPTCUR$ = "1" THEN
  226.         need& = SYSSPACE
  227.     ELSE
  228.         need& = DEVSPACE
  229.     END IF
  230.     IF free& < need& THEN
  231.         retval% = DoMsgBox("There is not enough space on the selected drive to install the MAPI PDK.  Please select another location.", "Install Problem", IDOK)
  232.         GOTO GETPATH
  233.     END IF
  234.  
  235. ClearCopyList
  236.  
  237. Install
  238.  
  239. QUIT:
  240.     ON ERROR GOTO ERRQUIT
  241.  
  242.     IF ERR = 0 THEN
  243.         dlg% = EXITSUCCESS
  244.     ELSEIF ERR = STFQUIT THEN
  245.         dlg% = EXITQUIT
  246.     ELSE
  247.         dlg% = EXITFAILURE
  248.     END IF
  249. QUITL1:
  250.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  251.     IF sz$ = "REACTIVATE" THEN
  252.         GOTO QUITL1
  253.     END IF
  254.         UIPop 1
  255.     END
  256.  
  257. ERRQUIT:
  258.     i% = DoMsgBox("Setup sources were corrupted, call the included support number", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  259.     END
  260.  
  261. BADPATH:
  262.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  263.     IF sz$ = "REACTIVATE" THEN
  264.         GOTO BADPATH
  265.     END IF
  266.     
  267.     UIPop 1
  268.     RETURN
  269.  
  270. ASKQUIT:
  271.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  272.  
  273.     IF sz$ = "EXIT" THEN
  274.         UIPopAll
  275. ''      ERROR STFQUIT
  276.         END
  277.     ELSEIF sz$ = "REACTIVATE" THEN
  278.         GOTO ASKQUIT
  279.     ELSE
  280.         UIPop 1
  281.     END IF
  282.     RETURN
  283.  
  284. '**
  285. '** Purpose:
  286. '**     Builds the copy list and performs all installation operations.
  287. '** Arguments:
  288. '**     none.
  289. '** Returns:
  290. '**     none.
  291. '*************************************************************************
  292. SUB Install STATIC
  293.  
  294. '' this keeps it from checking sizes so that I don't have to rebuild the
  295. '' inf file all the time by hand
  296. '' Junk = SetSizeCheckMode(scmOff)
  297.  
  298. '' Setting up OLD files that need to be removed from the users computer
  299. ''        AddSectionFilesToCopyList "Remove Files", SrcDir$, DEST$
  300.  
  301. '' Setting files to be copied
  302.     IF INSTALLING% = 32 THEN
  303.       CreateDir DEST$, cmoNone
  304.       AddSectionFilesToCopyList "mapi", SrcDir$, DEST$
  305.       AddSectionFilesToCopyList "sysfiles", SrcDir$, WinSysDir$
  306.       CreateDir DEST$ + "\IN", cmoNone
  307.       CreateDir DEST$ + "\OUT", cmoNone
  308.     ELSE
  309.       CreateDir DEST$, cmoNone
  310.       AddSectionFilesToCopyList "stuff", SrcDir$, DEST$
  311.       AddSectionFilesToCopyList "mapi", SrcDir$, DEST$
  312.       AddSectionFilesToCopyList "sysfiles", SrcDir$, WinSysDir$
  313.       IF INSTALLING% <> 16 THEN
  314.           AddSectionFilesToCopyList "isv", SrcDir$, DEST$
  315.       ENDIF
  316.       CreateDir DEST$ + "\IN", cmoNone
  317.       CreateDir DEST$ + "\OUT", cmoNone
  318.     END IF
  319.  
  320.    IF OPTCUR$ = "2" THEN   
  321.       CreateDir DEST$ + "\H", cmoNone
  322.       AddSectionFilesToCopyList "inc", SrcDir$, DEST$
  323.       CreateDir DEST$ + "\LIB", cmoNone
  324.       AddSectionFilesToCopyList "lib", SrcDir$, DEST$
  325.       AddSectionFilesToCopyList "dev", SrcDir$, DEST$
  326.    END IF
  327.  
  328. ''i% = DoMsgBox("Skip file copy?", "PDK Setup", MB_YESNO+MB_TASKMODAL+MB_ICONQUESTION)
  329. ''IF i% = IDNO THEN
  330.     CopyFilesInCopyList
  331. ''END IF
  332.  
  333. ''    Do what is necessary to set up the MSDN browser for our help files
  334.     IF INSTALLING% = 16 THEN
  335.         IF NOT Exists(GetWindowsDir() + "MSIN.INI") THEN
  336.             RegCmdLine$ = DEST$ + "\mergeini -c -q " + DEST$ + "\MSDN.INI -i " + GetWindowsDir() + "MSIN.INI"
  337.             Run RegCmdLine$
  338.         END IF
  339.         
  340.         RegCmdLine$ = DEST$ + "\mergeini -m -q " + DEST$ + "\MAPISDK.INI -i " + GetWindowsDir() + "MSIN.INI"
  341.         Run RegCmdLine$
  342.         
  343.         CreateIniKeyValue GetWindowsDir() + "MSIN.INI", "series", "MAPISDK", DEST$ + "\MAPISDK.MVB", cmoOverwrite
  344.         CreateIniKeyValue GetWindowsDir() + "MSIN.INI", "all titles", "MAPISDK.MVB", DEST$ + "\MAPISDK.MVB", cmoOverwrite
  345.         
  346.         CreateIniKeyValue GetWindowsDir() + "MSIN.INI", "MAPISDK.MVB", "LocalDir", DEST$, cmoOverwrite
  347.         CreateIniKeyValue GetWindowsDir() + "MSIN.INI", "MAPISDK.MVB", "Path", DEST$, cmoOverwrite
  348.     END IF
  349.  
  350. ''    Merge our MAPIPDK.INF with the MAPISVC.INF in the SYSTEM directory.
  351. ''    On Windows 95, we use a smaller .INF file.
  352.     RegCmdLine$ = DEST$ + "\mergeini -m -q " + DEST$ + "\mapipdk.inf"
  353.     Run RegCmdLine$
  354.  
  355. ''    Indicate where the installation went    
  356.     CreateIniKeyValue WinSysDir$ + "MAPISVC.INF", "MAPI", "MAPIROOT", DEST$, cmoOverwrite
  357.     
  358. ''  Register classes for OLE 2.0 and MAPI interface remoting
  359.     IF INSTALLING% = 16 THEN
  360.         RegCmdLine$ = "regedit /s " + WinSysDir$ + "ole2.reg " + SrcDir$ + "..\cfg\mapirpc.reg "
  361.         Run RegCmdLine$
  362.         RegCmdLine$ = "regedit /s " + SrcDir$ + "..\cfg\mdisp.reg"
  363.         Run RegCmdLine$
  364.     ELSE
  365.         RegCmdLine$ = "regedit /s " + SrcDir$ + "..\cfg\mapirpc.reg "
  366.         Run RegCmdLine$
  367.         RegCmdLine$ = "regedit /s " + SrcDir$ + "..\cfg\mdisp32.reg"
  368.         Run RegCmdLine$
  369.     ENDIF
  370.     
  371.     IF INSTALLING% = 32 THEN
  372.         PdkIn$ = MakePath(SrcDir$, "..\..\bin\winnt\i386\pdkin" + EXESuffix$ + ".exe")
  373.     ELSE
  374.         PdkIn$ = MakePath(DEST$, "pdkin" + EXESuffix$ + ".exe")
  375.     END IF
  376.     
  377. ''    Register standard Capone forms
  378.     InCmdLine$ = PdkIn$ + " -f " + SrcDir$ + "..\cfg\mapif0.cfg"
  379.     Run InCmdLine$
  380.     InCmdLine$ = PdkIn$ + " -f " + SrcDir$ + "..\cfg\mapif1.cfg"
  381.     Run InCmdLine$
  382.     InCmdLine$ = PdkIn$ + " -f " + SrcDir$ + "..\cfg\mapif2.cfg"
  383.     Run InCmdLine$
  384.     InCmdLine$ = PdkIn$ + " -f " + SrcDir$ + "..\cfg\mapif3.cfg"
  385.     Run InCmdLine$
  386.     InCmdLine$ = PdkIn$ + " -f " + SrcDir$ + "..\cfg\mapif4.cfg"
  387.     Run InCmdLine$
  388.     InCmdLine$ = PdkIn$ + " -f " + SrcDir$ + "..\cfg\mapif5.cfg"
  389.     Run InCmdLine$
  390.     
  391. ''    Record the install point in MAPISVC.INF.
  392. ''    pdkin -r also cleans up the old MLCFG= line in CONTROL.INI.
  393. ''  Also, create a default profile.
  394.  
  395.     InCmdLine$ = PdkIn$ + " -r " + DEST$ + " -m -p User"
  396.     Run InCmdLine$
  397.  
  398. ''    Register PDK sample form
  399.     InCmdLine$ = PdkIn$ + " -f " + SrcDir$ + "..\cfg\chkrform.cfg"
  400.     Run InCmdLine$
  401.  
  402. ''    Register OLE servers for forms stuff (including sample)
  403.     RegCmdLine$ = "regedit /s " + SrcDir$ + "..\cfg\mapif.reg"
  404.     Run RegCmdLine$
  405.     
  406. ''  Update Progman Groups
  407.  
  408.     CreateProgmanGroup "MAPI 1.0 PDK", "", cmoNone
  409.     ShowProgmanGroup  "MAPI 1.0 PDK", 1, cmoNone
  410.     CreateProgmanItem "MAPI 1.0 PDK", "Release Notes", MakePath(DEST$, "readme.wri"), "", cmoOverwrite
  411.     CreateProgmanItem "MAPI 1.0 PDK", "Kill Debug Spooler", MakePath(WinSysDir$, "mapisp" + EXESuffix$ + ".exe -k"), "", cmoOverwrite
  412.     CreateProgmanItem "MAPI 1.0 PDK", "Microsoft Exchange", "exchng" + EXESuffix$ + ".exe", "", cmoOverwrite
  413.     
  414.     IF INSTALLING% = 16 THEN
  415.         CreateProgmanItem "MAPI 1.0 PDK", "Simple MAPI Client", MakePath(DEST$, "smpcli" + EXESuffix$ + ".exe"), "", cmoOverwrite
  416.         CreateProgmanItem "MAPI 1.0 PDK", "Inbox Repair Tool", MakePath(DEST$, "scanpst" + ".exe"), "", cmoOverwrite
  417.     END IF
  418.  
  419. ''  SDK stuff
  420.     IF OPTCUR$ = "2" THEN
  421.         CreateProgmanItem "MAPI 1.0 PDK", "MAPI Help File", MakePath(DEST$, "msin.exe"), "", cmoOverwrite
  422.         CreateProgmanItem "MAPI 1.0 PDK", "OLE Messaging", MakePath(DEST$, "dev\olemsg\olemsg.hlp"), "", cmoOverwrite
  423.         CreateProgmanItem "MAPI 1.0 PDK", "Sample Address Viewer", MakePath(DEST$, "abview" + EXESuffix$ + ".exe"), "", cmoOverwrite
  424.         CreateProgmanItem "MAPI 1.0 PDK", "Sample Store Viewer", MakePath(DEST$, "mdbvu" + EXESuffix$ + ".exe"), "", cmoOverwrite
  425.         CreateProgmanItem "MAPI 1.0 PDK", "Sample Stress Mailer", MakePath(DEST$, "send" + EXESuffix$ + ".exe"), "", cmoOverwrite
  426.         CreateProgmanItem "MAPI 1.0 PDK", "Sample CMC Client", MakePath(DEST$, "cmccli" + EXESuffix$ + ".exe"), "", cmoOverwrite
  427.         CreateProgmanItem "MAPI 1.0 PDK", "Sample Form Readme", MakePath(DEST$, "dev\chkrform\formsmpl.txt"), "", cmoOverwrite
  428.     END IF
  429.  
  430.  
  431. ''    Indicate that simple MAPI, extended MAPI, and CMC are enabled
  432. ''  Point to mapi.dll as the home of CMC, unless one already exists
  433.     CreateIniKeyValue "WIN.INI", "Mail", "MAPI", "1", cmoOverwrite
  434.     CreateIniKeyValue "WIN.INI", "Mail", "MAPIX", "1", cmoOverwrite
  435.     CreateIniKeyValue "WIN.INI", "Mail", "OLEMessaging", "1", cmoOverwrite
  436.     CreateIniKeyValue "WIN.INI", "Mail", "CMC", "1", cmoOverwrite
  437.     IF FDoesIniKeyExist("WIN.INI", "Mail", "CMCDLLNAME") = 0 THEN
  438.         CreateIniKeyValue "WIN.INI", "Mail", "CMCDLLNAME", "mapi" + EXESuffix$ + ".dll", cmoOverwrite
  439.     END IF
  440.     IF INSTALLING% <> 16 THEN
  441.         IF FDoesIniKeyExist("WIN.INI", "Mail", "CMCDLLNAME32") = 0 THEN
  442.             CreateIniKeyValue "WIN.INI", "Mail", "CMCDLLNAME32", "mapi" + EXESuffix$ + ".dll", cmoOverwrite
  443.         END IF
  444.     END IF
  445.  
  446.  
  447. ''    Remove or rename obsolete files from earlier Beta and Test Release versions
  448.     IF FDoesFileExist(WinSysDir$ + "services.ini", femExists) THEN
  449.         CopyFile WinSysDir$ + "services.ini", WinSysDir$ + "mapisvc.old", cmoNone, FALSE
  450.         RemoveFile WinSysDir$ + "services.ini", cmoNone
  451.         TextLine$ = "Your old SERVICES.INI has been backed up as MAPISVC.OLD."
  452.         i% = DoMsgBox(TextLine$, "MAPI 1.0 PDK", MB_OK+MB_TASKMODAL+MB_ICONINFORMATION)
  453.     ENDIF
  454.     IF FDoesFileExist(WinSysDir$ + "mapiwz" + EXESuffix$ + ".dll", femExists) THEN
  455.         RemoveFile WinSysDir$ + "mapiwz" + EXESuffix$ + ".dll", cmoNone
  456.     ENDIF
  457.     IF FDoesFileExist(WinSysDir$ + "mapif" + EXESuffix$ + ".dll", femExists) THEN
  458.         RemoveFile WinSysDir$ + "mapif" + EXESuffix$ + ".dll", cmoNone
  459.     ENDIF
  460.     IF FDoesFileExist(WinSysDir$ + "imsg" + EXESuffix$ + ".dll", femExists) THEN
  461.         RemoveFile WinSysDir$ + "imsg" + EXESuffix$ + ".dll", cmoNone
  462.     ENDIF
  463.     IF FDoesFileExist(WinSysDir$ + "mrpc" + EXESuffix$ + ".dll", femExists) THEN
  464.         RemoveFile WinSysDir$ + "mrpc" + EXESuffix$ + ".dll", cmoNone
  465.     ENDIF
  466.     IF FDoesFileExist(WinSysDir$ + "mrpc.dll", femExists) THEN
  467.         RemoveFile WinSysDir$ + "mrpc.dll", cmoNone
  468.     ENDIF
  469.     IF FDoesFileExist(WinSysDir$ + "mlcfg" + EXESuffix$ + ".dll", femExists) THEN
  470.         RemoveFile WinSysDir$ + "mlcfg" + EXESuffix$ + ".dll", cmoNone
  471.     ENDIF
  472.     
  473. END SUB
  474.  
  475. '**
  476. '** Purpose:
  477. '**     Appends a file name to the end of a directory path,
  478. '**     inserting a backslash character as needed.
  479. '** Arguments:
  480. '**     szDir$  - full directory path (with optional ending "\")
  481. '**     szFile$ - filename to append to directory
  482. '** Returns:
  483. '**     Resulting fully qualified path name.
  484. '*************************************************************************
  485. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  486.     IF szDir$ = "" THEN
  487.     MakePath = szFile$
  488.     ELSEIF szFile$ = "" THEN
  489.     MakePath = szDir$
  490.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  491.     MakePath = szDir$ + szFile$
  492.     ELSE
  493.     MakePath = szDir$ + "\" + szFile$
  494.     END IF
  495. END FUNCTION
  496.  
  497. SUB RenameMAPI STATIC
  498.  
  499. '' If Mail 3.x MAPI DLLs exist, rename them.
  500. '' On Windows 95 we do not expect to find them.
  501.     FoundMapi3x% = 0
  502.     ver3& = 3
  503.  
  504.     '' Check for 16-bit MAPI.DLL.
  505.     ''   NT has NO version ID.
  506.     ''   Mail 3.x/WfW has major version 3.
  507.     ''   Ours has major version 4.
  508.     '' Do not bother checking for 32-bit DLL; we cannot
  509.     '' read its resources anyway. It should match the 16-bit one.
  510.     mapidll$ = WinSysDir$ + "MAPI.DLL"
  511.     IF FDoesFileExist(mapidll$, 1) THEN
  512.         mapiver$ = GetVersionOfFile(mapidll$)
  513.         IF LEN(mapiver$) = 0 THEN
  514.             FoundMapi3x% = 1
  515.         ELSE
  516.             mapivermajor& = GetVersionNthField(mapiver$, 1)
  517.             IF mapivermajor& = ver3& THEN
  518.                 FoundMapi3x% = 1
  519.             END IF
  520.         END IF
  521.     END IF
  522.  
  523.     IF FoundMapi3x% = 1 THEN
  524.         RenameFile mapidll$, "MAPI.BAK"
  525.         IF INSTALLING% = 32 THEN
  526.             mapidll$ = WinSysDir$ + "MAPI32.DLL"
  527.             IF FDoesFileExist(mapidll$, 1) THEN
  528.                 RenameFile mapidll$, "MAPI32.BAK"
  529.             END IF
  530.         END IF
  531.  
  532.         '' Tell the user what we just did.
  533.         IF INSTALLING% = 32 THEN
  534.             sz$ = UIStartDlg(CUIDLL$, MAPIRENAME32, "FInfo0DlgProc", 0, "")
  535.         ELSE
  536.             sz$ = UIStartDlg(CUIDLL$, MAPIRENAME16, "FInfo0DlgProc", 0, "")
  537.         END IF        
  538.         UIPop 1
  539.     END IF
  540.  
  541. END SUB
  542.