home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 16 / 16.iso / w / w005 / 2.ddi / SETUP.MS_ / SETUP.MS
Encoding:
Text File  |  1994-03-09  |  23.9 KB  |  780 lines

  1.  
  2.  
  3. '**************************************************************************
  4. '*                      Non-Locked Rolex install script
  5. '**************************************************************************
  6.  
  7. '*      Mark Young
  8. '*      This install script hacked from Max's Locked MaxFaster Install Script
  9. '*      05/15/93
  10. '*
  11. '*  11/02/93 - add modifications to address installing
  12. '*             over previous versions ( 2.x, etc. )
  13. '*             1) move *.ZCN, *.TRN, *.UD to \OmniPro\DATA directory
  14. '*             2) rename *.MD to *.NDX
  15. '*             3) delete *.DLL, *.PLX, *.EXE from \OmniPro directory
  16. '*
  17. '*
  18. '*  11/08/93 - changed minimum disk space requirement to 10mg from 8mg
  19. '*
  20. '*  11/14/93 - changed procedure for reading disk from serial
  21. '*             added call to the registration dialog
  22. '*             added new dialog after registration
  23. '*
  24. '*  11/19/93 - added new file section WINFILES that installs to \WINDOWS
  25. '*
  26. '*  11/19/93 - added preliminary implementation of new dialog that
  27. '*             will appear after a cancelled registration
  28. '*
  29. '*  12/17/93 - added a whole bunch of comments - stripped out useless code
  30. '*
  31. '*  12/20/93 - added code to remove OP30 line from WIN.INI if user specifies
  32. '*             the path designated in [OmniPage] - OP30 - as installation
  33. '*             directory for OmniPage Professional 5.0
  34. '*
  35.  
  36.  
  37. '$INCLUDE 'setupapi.inc'
  38. '$INCLUDE 'msdetect.inc'
  39.  
  40. '// product name used to set installer main dialog title
  41. CONST INSTALLNAME = "OmniPage Professional"
  42.  
  43. '// minimum disk space required for installation of product
  44. '// user will not be able to install unless this figure
  45. '// is less than the available disk space on specified drive
  46. '// - value is in bytes, NOT kilobytes or megabytes
  47. CONST DISKSPACEREQ = 10000000
  48.  
  49. '// for maximizing installer screen
  50. CONST WS_VISIBLE       = &H10000000
  51. CONST WS_BORDER        = &H00800000
  52. CONST WS_CLIPCHILDREN  = &H02000000
  53. CONST GWL_STYLE        = -16
  54. CONST SW_SHOWMAXIMIZED = 3
  55. CONST SW_RESTORE       = 9
  56.  
  57.  
  58. ''Dialog ID's
  59. CONST ASKQUIT           = 200   '// ask user if they really want to quit
  60. CONST DESTPATH          = 300   '// get installation directory from user
  61. CONST EXITFAILURE       = 400
  62. CONST EXITQUIT          = 600
  63. CONST EXITSUCCESS       = 700   '// tell user installation was successful
  64. CONST OPTIONS           = 800   '// not used in Rolex install
  65. CONST APPHELP           = 900
  66. CONST NOTENH            = 1000  '// tell user enhanced mode is required
  67. CONST WARN_OVERWRITE    = 1100
  68. CONST BADPATH           = 6400  '// tell user why install path is unusable
  69. CONST REGISTER          = 2000
  70. CONST BADDISKSERIAL     = 2001
  71. CONST BADUSERSERIAL     = 2002
  72. CONST POSTREGINSTRUCT   = 3001
  73. CONST OMNIRUN            = 6500
  74.  
  75. '// for registration cancelled dialog
  76. CONST  REGCANCELDLG  = 4000
  77. GLOBAL REGCANCELERR%
  78.  
  79. 'string constants
  80. CONST INSTALLSTR    = 1
  81. CONST ABOUTSTR      = 2
  82. CONST NOINSTALLSTR  = 3
  83.  
  84. GLOBAL DEST$            '// user specified installation directory.
  85. GLOBAL DISK_SERIAL$     '// to store serial # read from disk
  86.  
  87. '// functions and procedures defined within this file ( SETUP.MST )
  88. DECLARE SUB Install
  89. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  90. DECLARE FUNCTION GetString (id%) AS STRING
  91.  
  92. '// this function returns zero if there is MinSpace& available
  93. '// in directory NewPath$, otherwise returns (-1)
  94. DECLARE FUNCTION NotEnoughDiskSpace( NewPath$, MinSpace& ) as INTEGER
  95.  
  96.  
  97. '// end of functions and procedures defined within this file ( SETUP.MST )
  98.  
  99. 'declare functions used to get strings from the custom ui dll
  100. DECLARE FUNCTION LoadString LIB "user" (iInst%, iRes%, lpStr$, iSize%) AS INTEGER
  101. DECLARE FUNCTION LoadLibrary LIB "kernel" (lpFile$) AS INTEGER
  102. DECLARE FUNCTION FindWindow LIB "user" (lpClassStr$, lpWinStr$) AS INTEGER 
  103. DECLARE SUB FreeLibrary LIB "kernel" (iInst%)
  104.  
  105.  
  106.  
  107. '// for maximizing installer screen
  108. DECLARE FUNCTION ShowWindow LIB "user" (hWnd%, iShow% ) as INTEGER
  109. DECLARE FUNCTION SetWindowLong LIB "user" (hWnd%, offset%, style& ) as LONG
  110.  
  111.  
  112. 'declare the installation functions used in the library deinst.dll
  113. DECLARE FUNCTION CaereDeinstall LIB "deinst.dll" (lpMode$, lpDir$) As INTEGER
  114. DECLARE FUNCTION CaereGetSerial LIB "deinst.dll" (lpDrive$, lpSerial$) AS INTEGER
  115. DECLARE SUB CaereCancelInstall LIB "deinst.dll"
  116.  
  117.  
  118. '// for installing over existing application ( Max wrote these !! )
  119. DECLARE FUNCTION CopyFiles   LIB "FUTIL.dll" ( target$, dest$ ) AS INTEGER
  120. DECLARE FUNCTION RenameFiles LIB "FUTIL.dll" ( target$, dest$ ) AS INTEGER
  121. DECLARE FUNCTION DeleteFiles LIB "FUTIL.dll" ( target$ ) AS INTEGER
  122.  
  123.  
  124. '// for handling serial number and registration
  125. DECLARE FUNCTION GetSerialFromFloppy LIB "MSCUISTF.DLL" ( theDrive$, theSerial$ ) as INTEGER
  126. DECLARE FUNCTION GetRegistration     LIB "MSCUISTF.DLL" ( theINIFile$, theSerial$ ) as INTEGER
  127. DECLARE SUB      GetWarrantyInfo     LIB "MSCUISTF.DLL" ( theUserName$, theCompName$, isIEVersion$ )
  128.  
  129.  
  130. INIT:
  131.  
  132.     '// global flag to communicate that registration was cancelled
  133.     REGCANCELERR% = 0
  134.  
  135.     CUIDLL$ = "mscuistf.dll"            '// Custom user interface dll
  136.     HELPPROC$ = "FHelpDlgProc"          '// Help dialog procedure
  137.  
  138.     '// set the main window title, this will differ for each app
  139.     '// get the string from the ui dll
  140.     SetTitle GetString(INSTALLSTR)
  141.  
  142.     'set the about box with some caere stuff
  143.     SetAbout GetString(INSTALLSTR), GetString(ABOUTSTR)
  144.  
  145.     '// specify the bitmap to add to install splash - bmp is in MSCUISTF.DLL
  146.     SetBitmap CUIDLL$, 1
  147.  
  148.     '// to maximize install screen
  149.     hWnd% = HwndFrame()
  150.     k& = SetWindowLong( hWnd%, GWL_STYLE, WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN )
  151.     j% = ShowWindow( hWnd%, SW_SHOWMAXIMIZED )
  152.  
  153.     '// turn on beeping
  154.     i% = SetBeepingMode(1)
  155.  
  156.     '// get the source directory for installation
  157.     INSTALL_DISK_DRIVE$ = GetSymbolValue("STF_SRCDIR")
  158.  
  159.     '// get the source drive for installation
  160.     INSTALL_DISK_DRIVE$ = MID$( INSTALL_DISK_DRIVE$, 1, 1 )
  161.  
  162.  
  163. '// check whether user is running in enhanced mode
  164. NOTENHANCED:
  165.  
  166.     'make sure we are in enhanced mode or don't install
  167.     IF GetWindowsMode() <> 2 THEN
  168.  
  169.        '// tell user they must be running in enhanced mode
  170.        sz$ = UIStartDlg(CUIDLL$, NOTENH, "FInfo0DlgProc", 0, "")
  171.  
  172.        '// put away frontmost dialog
  173.         UIPop 1
  174.  
  175.        ' exit the install script
  176.         END
  177.  
  178.     ENDIF
  179.  
  180. OMNIPAGERUNNING:
  181.  
  182.     '// check to see if omnipage is already running on their target machine
  183.     IF (FindWindow("OmniPagePro", NULL)) THEN
  184.  
  185.          '// tell user they must exit omnipage before they can install
  186.         sz$ = UIStartDlg(CUIDLL$, OMNIRUN, "FInfo0DlgProc", 0, "")
  187.  
  188.        '// handle installation termination
  189.         GOTO ERRQUIT
  190.  
  191.     ENDIF
  192.  
  193.  
  194. '// get serial number from install diskette
  195. GETSERIAL:
  196.  
  197.     '// get serial # from diskette     
  198.     DISK_SERIAL$ = "2804b-c00-003289   "
  199.  
  200.     '// this function will look for serial number on current diskette
  201.     '// - if not found or not valid, prompts user to insert proper diskette
  202.     serial_result% = 0
  203.     'GetSerialFromFloppy( INSTALL_DISK_DRIVE$, DISK_SERIAL$ )
  204.  
  205.     '// if there was a problem getting serial number
  206.     '// or user pressed CANCEL within dialog prompting user
  207.     '// to "insert floppy with serial number",
  208.     '// then abort installation
  209.     IF ( serial_result% = -1 ) THEN
  210.  
  211.        '// specify this was a user cancelled installation
  212.        ERROR STFERR
  213.  
  214.        '// handle installation termination
  215.         GOTO QUIT
  216.  
  217.     ENDIF
  218.  
  219.     '// close frontmost dialog
  220.     UIPop 1
  221.  
  222. '// construct default installation path
  223. INSTALLDIR:
  224.  
  225.     '// get previous installation path of OmniPage from WIN.INI
  226.     DEST$ = GetIniKeyString("WIN.INI", "OmniPage", "OP30" )
  227.  
  228.     '// create previous full path to OmniPage application
  229.     TDEST$ = MakePath( DEST$, "OP.EXE" )
  230.  
  231.     '// if previous OmniPage application exists in directory specified
  232.     '// in WIN.INI then use that directory as default install directory
  233.     IF ( DoesFileExist( TDEST$, femExists )) THEN
  234.  
  235.        '// leave path DEST$ alone !!
  236.  
  237.     ELSE
  238.  
  239.        '// use OMNIPRO\ as default install directory
  240.        DEST$ = "C:\OMNIPRO"
  241.  
  242.     ENDIF
  243.  
  244.     '// read in the SETUP information file
  245.     '// this contains application file list from LAYOUT files
  246.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  247.     IF szInf$ = "" THEN
  248.        szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  249.     END IF
  250.     ReadInfFile szInf$
  251.  
  252. '// set default path for dialog where user specifies install directory
  253. GETPATH:
  254.  
  255.     '// stuff default installation directory into dialog
  256.     SetSymbolValue "EditTextIn", DEST$
  257.  
  258.     '// make sure the edit text cell is selected
  259.     SetSymbolValue "EditFocus", "END"
  260.  
  261. '// get the directory from user to install the application
  262. GETPATHL1:
  263.  
  264.     '// display dialog for user to specify installation directory
  265.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  266.  
  267.     '// get the specified installation directory from edit text cell
  268.     DEST$ = GetSymbolValue("EditTextOut")
  269.  
  270.     '// if user pressed CONTINUE button in dialog to specify install directory
  271.     IF sz$ = "CONTINUE" THEN
  272.  
  273.        '// if specified install directory is invalid
  274.        '// or user does not have write privileges
  275.        '// display bath path dialog and redisplay the dialog
  276.        '// where user specifies installation directory
  277.        IF IsDirWritable(DEST$) = 0 THEN
  278.  
  279.           '// tell user why this directory cannot be used for installation
  280.           GOSUB BADPATH
  281.  
  282.           '// let user reenter installation directory
  283.           GOTO GETPATHL1
  284.  
  285.        END IF
  286.  
  287.        '// put away frontmost dialog
  288.        UIPop 1
  289.  
  290.     '// user pressed EXIT button in dialog to specify install directory
  291.     ELSE
  292.  
  293.        '// ask user if they really want to quit
  294.        GOSUB ASKQUIT
  295.  
  296.        '// return to dialog where user specifies installation directory
  297.        GOTO GETPATH
  298.  
  299.     ENDIF
  300.  
  301.     '// PROCEED WITH INSTALLATION - INSTALL PATH CAN BE CREATED
  302.  
  303.     '// strip trailing backslash from specified install directory
  304.     IF ( MID$( DEST$,LEN(DEST$),1 ) = "\" ) THEN
  305.        DEST$ = MID$( DEST$,1,LEN(DEST$)-1 )
  306.     ENDIF
  307.  
  308.     '// if there is insufficient disk space available in
  309.     '// specified installation directory give an error dialog
  310.     '// and redisplay diealog where user specifies installation directory
  311.     IF ( NotEnoughDiskSpace( DEST$, DISKSPACEREQ )) THEN
  312.  
  313.        '// return to dialog where user specifies installation directory
  314.        GOTO GETPATH
  315.  
  316.     ENDIF
  317.  
  318.     '// if installation directory already exists warn user that
  319.     '// many files will be deleted and others will be moved
  320.     IF ( DoesDirExist( DEST$ )) THEN
  321.  
  322.         '// warn the user that existing directory will be mungged
  323.         sz$ = UIStartDlg(CUIDLL$, WARN_OVERWRITE, "FEditDlgProc", APPHELP, HELPPROC$ )
  324.  
  325.         '// if user pressed other than CONTINUE button in the DIALOG
  326.        '// redisplay dialog to specify installation directory
  327.        IF sz$ <> "CONTINUE" THEN
  328.  
  329.           '// put away frontmost dialog
  330.           UIPop 1
  331.  
  332.           '// redisplay dialog to specify installation directory
  333.           GOTO INSTALLDIR
  334.  
  335.         ENDIF
  336.  
  337.        '// put away frontmost dialog
  338.         UIPop 1
  339.  
  340.     ENDIF
  341.  
  342.     'call the function defined below which installs the application files
  343.     Install
  344.  
  345. '// determine which QUIT state is appropriate
  346. QUIT:
  347.  
  348.     ON ERROR GOTO ERRQUIT
  349.  
  350.     '// select proper dialog to display when installation is terminated
  351.  
  352.     '// successful install completed
  353.     IF ERR = 0 THEN
  354.  
  355.        dlg% = EXITSUCCESS
  356.  
  357.     '// user terminated install process
  358.     ELSEIF ERR = STFQUIT THEN
  359.  
  360.        '// user terminated install process during registration
  361.        IF ( REGCANCELERR% = 1 ) THEN
  362.  
  363.           dlg% = REGCANCELDLG
  364.  
  365.        '// user cancelled install process before registration
  366.        ELSE
  367.  
  368.           dlg% = EXITQUIT
  369.  
  370.        ENDIF
  371.  
  372.     '// there was a fatal error during installation
  373.     ELSE
  374.  
  375.        dlg% = EXITFAILURE
  376.  
  377.     ENDIF
  378.  
  379.     '// drop through, now that proper dialog has been selected
  380.  
  381. '// terminate installation process
  382. QUITL1:
  383.  
  384.     '// display dialog selected above in QUIT: section
  385.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  386.  
  387.     '// put away frontmost dialog
  388.     UIPop 1
  389.  
  390.     '// if installation was successful
  391.     IF ( dlg% = EXITSUCCESS ) THEN
  392.  
  393.        '// exit the install script
  394.        END
  395.  
  396.     ENDIF
  397.  
  398.  
  399.     '// drop through and display install termination dialog
  400.  
  401. '// code to handle a cancelled installation
  402. ERRQUIT:
  403.  
  404.     '// cancel the install process
  405.     CaereCancelInstall
  406.  
  407.     '// exit the install script
  408.     END
  409.  
  410. '// code to handle an invalid specified installation directory
  411. BADPATH:
  412.  
  413.     '// display dialog explaining why installation directory cannot be used
  414.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  415.  
  416.     '// put away frontmost dialog
  417.     UIPop 1
  418.  
  419.     '// resume script execution from GOSUB call
  420.     RETURN
  421.  
  422. '// code to handle asking user if they want to quit
  423. ASKQUIT:
  424.  
  425.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  426.  
  427.     '// user pressed EXIT button in dialog
  428.     IF sz$ = "EXIT" THEN
  429.  
  430.        '// close all dialogs
  431.        UIPopAll
  432.  
  433.        '// specify that user cancelled installation
  434.        ERROR STFQUIT
  435.  
  436.     '// user did not press EXIT button in dialog
  437.     ELSE
  438.  
  439.        '// put away frontmost dialog and proceed with installation
  440.        UIPop 1
  441.  
  442.     ENDIF
  443.  
  444.     '// resume script execution from GOSUB call
  445.     RETURN
  446.  
  447. '// termination of MAIN() body of code in installation script
  448. RETURN
  449.  
  450.  
  451. '**
  452. '** Purpose:
  453. '**     Builds the copy list and performs all installation operations.
  454. '** Arguments:
  455. '**     none.
  456. '** Returns:
  457. '**     none.
  458. '*************************************************************************
  459. SUB Install STATIC
  460.  
  461.     '// if we are installing over directory specified
  462.     '// in WIN.INI - [OmniPage] - OP30=PreviousInstallPath$
  463.     '// then remove line OP30=PreviousInstallPath$
  464.     OldOP30Path$ = GetIniKeyString("WIN.INI", "OmniPage", "OP30" )
  465.     IF ( UCASE$( OldOP30Path$ ) = UCASE$( DEST$ ) ) THEN
  466.        RemoveIniKey "WIN.INI", "OmniPage", "OP30", cmoNone
  467.     ENDIF
  468.  
  469.     '// get path to files waiting to be installed
  470.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  471.  
  472.     '// create primary installation directory
  473.     CreateDir DEST$, cmoNone
  474.  
  475.     '// create subdirectory within primary installation directory
  476.     ScanDEST$ = MakePath( DEST$, "SCANNERS" )
  477.     CreateDir ScanDEST$, cmoNone
  478.  
  479.     '// add files from "files" group ( in SETUP.LYT ) to copy list
  480.     AddSectionFilesToCopyList "FILES", SrcDir$, DEST$
  481.  
  482.     '// add files from "scanners" group ( in SETUP.LYT ) to copy list
  483.     AddSectionFilesToCopyList "SCANNERS", SrcDir$, ScanDEST$
  484.  
  485.     '// add files from "win_sys" group ( in SETUP.LYT ) to copy list
  486.     WINSYS_DEST$ = GetWindowsDir()
  487.     WINSYS_DEST$ = WINSYS_DEST$ + "SYSTEM"
  488.     AddSectionFilesToCopyList "SYSTEM", SrcDir$, WINSYS_DEST$
  489.  
  490.     '// add files from "winfiles" group ( in SETUP.LYT ) to copy list
  491.     WIN_DEST$ = GetWindowsDir()
  492.     AddSectionFilesToCopyList "WINFILES", SrcDir$, WIN_DEST$
  493.  
  494.     '// create DATA subdirectory within primary installation directory
  495.     '// add path designation to WIN.INI
  496.     DataPATH$ = MakePath( DEST$, "DATA" )
  497.     CreateDir DataPATH$, cmoNone
  498.     CreateIniKeyValue "WIN.INI", "OmniPage", "DataPath", DataPATH$, cmoOverwrite
  499.  
  500.     '// create OLD_META subdirectory with primary installation directory
  501.     '// move existing metafiles to there
  502.     MetaPATH$ = MakePath( DEST$, "OLD_META" )
  503.     CreateDir MetaPATH$, cmoNone
  504.  
  505.     '// add files from "data" group ( in SETUP.LYT ) to the copy list
  506.     AddSectionFilesToCopyList "DATA", SrcDir$, DATAPATH$
  507.  
  508.  
  509.     '// NEW STUFF for installing over existing directory
  510.  
  511.     '// copy old metafiles to backup directory
  512.     i% = CopyFiles( DEST$ + "\*.MET", MetaPATH$ )
  513.     i% = DeleteFiles( DEST$ + "\*.MET" )
  514.  
  515.     '// preserve existing dictionaries for use with Pro 5.0
  516.     i% = RenameFiles( DEST$ + "\*.MD", DEST$ + "\*.NDX" )
  517.     i% = DeleteFiles( DEST$ + "\*.MD" )
  518.  
  519.     '// move training files into subdir
  520.     i% = CopyFiles( DEST$ + "\*.TRN", DATAPATH$ )
  521.     i% = DeleteFiles( DEST$ + "\*.TRN" )
  522.  
  523.  
  524.     '// move user dictionary files into subdir
  525.     i% = CopyFiles( DEST$ + "\*.UD", DATAPATH$ )
  526.     i% = DeleteFiles( DEST$ + "\*.UD" )
  527.  
  528.  
  529.     '// move zone content files into subdir
  530.     i% = CopyFiles( DEST$ + "\*.ZCN", DATAPATH$ )
  531.     i% = DeleteFiles( DEST$ + "\*.ZCN" )
  532.  
  533.  
  534.     '// zap most of the non-metafile stuff from previous installs
  535.     i% = DeleteFiles( DEST$ + "\*.DLL" )
  536.     i% = DeleteFiles( DEST$ + "\*.PLX" )
  537.     i% = DeleteFiles( DEST$ + "\*.EXE" )
  538.  
  539.     '// copy files from install disks to specified installation directory
  540.     CopyFilesInCopyList
  541.  
  542.     '// setup the program manager group with new progman items
  543.     CreateProgmanGroup "Caere Applications", "", cmoNone
  544.     ShowProgmanGroup  "Caere Applications", 1, cmoNone
  545.     CreateProgmanItem "Caere Applications", "OmniPage Professional", MakePath(DEST$, "omnipage.exe"), "", cmoOverwrite
  546.     CreateProgmanItem "Caere Applications", "Image Assistant", MakePath(DEST$, "photop.exe"), "", cmoOverwrite
  547.  
  548.     '// write stuff out to INI file
  549.     '// create path for INI file
  550.     INI_PATH$ = MakePath( DataPATH$, "OMNIPAGE.INI" )
  551.  
  552.  
  553.     '// perform registration process and write some info to OmniPage.INI
  554.  
  555.     '// create path for REG INFO file
  556.     RegPATH$ = MakePath( DEST$, "WARRANTY.TXT" )
  557.  
  558.     '// perform the registration process
  559.     '// this returns zero if cancelled, otherwise returns 1
  560.     '// - if "print" is first argument, registration info is printed
  561.     '// - if <filename> is first argument, registration info is sent to file
  562.     reg_result% = GetRegistration( "print", DISK_SERIAL$ )
  563.  
  564.  
  565.     '// initialize temporary flag for analyzing registration result
  566.     REGCANCELERR% = 0
  567.  
  568.     '//  exit this subroutine ::: IF ( reg_result% <> [success code] )
  569.     IF ( reg_result% = 0 ) THEN
  570.  
  571.        '// make sure that we put up the proper dialog when quitting
  572.        REGCANCELERR% = 1
  573.  
  574.        '// set error to normal termination
  575.        ERROR STFQUIT
  576.  
  577.        '// no gotos allowed outside local scope !!!
  578.  
  579.     ELSE
  580.  
  581.        '// proceed with registration process
  582.  
  583.        '// initialize strings to be passed back by GetWarrantyInfo()
  584.        user_name$ = "                                             "
  585.        comp_name$ = "                                                  "
  586.        is_IEVersion$ = "  "
  587.  
  588.        '// collect information from completed registration process
  589.         GetWarrantyInfo user_name$, comp_name$, is_IEVersion$
  590.  
  591.         '// write info to win.ini file for associations to extensions
  592.         ExtDEST$ = MakePath( DEST$, "omnipage.exe ^.met" )
  593.         CreateIniKeyValue "WIN.INI", "Extensions", "met", ExtDEST$, cmoOverwrite
  594.  
  595.        '// write registration info out to OMNIPAGE.INI
  596.        CreateIniKeyValue INI_PATH$, "Registration", "serial", DISK_SERIAL$, cmoOverwrite
  597.        CreateIniKeyValue INI_PATH$, "Registration", "name", user_name$, cmoOverwrite
  598.        CreateIniKeyValue INI_PATH$, "Registration", "company", comp_name$, cmoOverwrite
  599.  
  600.        '// if user registered as NON-US version set alternate ( NON-US )
  601.        '// default dictionary and default page size within OMNIPAGE.INI
  602.        IF ( MID$( is_IEVersion$,1,1 ) = "1" ) THEN
  603.           CreateIniKeyValue INI_PATH$, "LOCALIZATIONSET", "MainDictionary", "ukeng.ndx", cmoOverwrite
  604.           CreateIniKeyValue INI_PATH$, "LOCALIZATIONSET", "PageSize", "2", cmoOverwrite
  605.        ENDIF
  606.  
  607.     ENDIF
  608.  
  609. END SUB
  610.  
  611.  
  612.  
  613. '**
  614. '** Purpose:
  615. '**     Appends a file name to the end of a directory path,
  616. '**     inserting a backslash character as needed.
  617. '** Arguments:
  618. '**     szDir$  - full directory path (with optional ending "\")
  619. '**     szFile$ - filename to append to directory
  620. '** Returns:
  621. '**     Resulting fully qualified path name.
  622. '*************************************************************************
  623. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  624.      IF szDir$ = "" THEN
  625.             MakePath = szFile$
  626.     ELSEIF szFile$ = "" THEN
  627.             MakePath = szDir$
  628.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  629.         MakePath = szDir$ + szFile$
  630.     ELSE
  631.             MakePath = szDir$ + "\" + szFile$
  632.     END IF
  633. END FUNCTION
  634.  
  635.  
  636.  
  637. '**
  638. '** Purpose:
  639. '**     Returns string resource with given ID# from MSCUISTF.DLL.
  640. '**
  641. '** Arguments:
  642. '**     String resource ID#
  643. '**
  644. '** Returns:
  645. '**     String associated with given resource ID#
  646. '**
  647. '*************************************************************************
  648. FUNCTION GetString (id%) STATIC AS STRING
  649.     'load up the library
  650.     iInst% = LoadLibrary("MSCUISTF.DLL")
  651.     IF iInst% < 22 THEN
  652.         GOTO ENDGETSTRING
  653.     ENDIF
  654.  
  655.     'allocate space for the string
  656.     TheString$ = STRING$(256, 32)
  657.  
  658.     'get the string
  659.     i% = LoadString(iInst%, id%, TheString$, 256)
  660.  
  661.     'free the library
  662.     FreeLibrary iInst%
  663.  
  664. ENDGETSTRING:
  665.     GetString = TheString$
  666. END FUNCTION
  667.  
  668.  
  669. '**
  670. '** Purpose:
  671. '**     Check for necessary disk space required for installation of product.
  672. '**
  673. '**     If overwriting existing installation,
  674. '**     do nothing and return success code of ( 0 ).
  675. '**
  676. '**     Otherwise, give an error dialog if there is insufficient free disk
  677. '**     and return error of (-1).
  678. '**
  679. '** Arguments:
  680. '**     NewPath$ : full path to user specified installation directory
  681. '**
  682. '**     MinSpace& : minimum bytes necessary for installation of product
  683. '**
  684. '** Returns:
  685. '**     0 : if overwriting previous installation
  686. '**         or there is MinSpace& free on drive specified in NewPath$
  687. '**
  688. '**     (-1) : not overwriting previous installation and there is not
  689. '**            MinSpace& free on drive specified in NewPath$
  690. '**
  691. '*************************************************************************
  692. FUNCTION NotEnoughDiskSpace( NewPath$, MinSpace& ) STATIC as INTEGER
  693.  
  694.     Result% = 0
  695.  
  696.     '// find previous install path, if any
  697.     '// note: this line is specific to FaxMaster product
  698.     OldPath$ = GetIniKeyString( "WIN.INI","BitFax","BitFaxPath" )
  699.  
  700.     '// remove ending slash from path if necessary
  701.     if ( LEN( OldPath$ ) > 0 ) then
  702.         if ( MID$( OldPath$, LEN( OldPath$ ),1 ) = "\" ) then
  703.         OldPath$ = MID$( OldPath$,1,LEN( OldPath$ ) - 1 )
  704.         endif
  705.     endif
  706.  
  707.     '// remove ending slash from path if necessary
  708.     if ( LEN( NewPath$ ) > 0 ) then
  709.         if ( MID$( NewPath$, LEN( NewPath$ ),1 ) = "\" ) then
  710.         NewPath$ = MID$( NewPath$,1,LEN( NewPath$ ) - 1 )
  711.         endif
  712.     endif
  713.  
  714.     '// if the install is NOT overwriting previous install
  715.     '// of FaxMaster or OmniScan perform check for disk space
  716.     if ( OldPath$ <> NewPath$ ) then
  717.  
  718.         '// grab the drive letter out of the install destination path
  719.         install_drive$ = UCASE$( MID$( NewPath$,1,1 ))
  720.         if ( install_drive$ < "A" ) or ( install_drive$ > "Z" ) then
  721.         install_drive$ = "C"
  722.         endif
  723.  
  724.         '// determine the amount of free space on install drive
  725.         free_space& = GetFreeSpaceForDrive( install_drive$ )
  726.  
  727.         '// check to see if there is not sufficient
  728.         '// available space to complete install
  729.         if ( free_space& < MinSpace& ) then
  730.  
  731.           '// prepare messages for error dialog
  732.           '// by grabbing strings out of MSCUISTF.DLL
  733.  
  734.           str1$ = GetString( 9000 )
  735.           str1$ = str1$ + str$( MinSpace& /1000 )
  736.           str1$ = str1$ + GetString( 9001 )
  737.           str1$ = str1$ + INSTALLNAME
  738.  
  739.           str2$ = GetString( 9002 )
  740.           str2$ = str2$ + STR$( free_space& / 1000 )
  741.           str2$ = str2$ + GetString( 9003 )
  742.           str2$ = str2$ + install_drive
  743.           str2$ = str2$ + GetString( 9004 )
  744.  
  745.           str3$ = STR$( ( MinSpace& - free_space& ) / 1000 )
  746.           str3$ = str3$ + GetString( 9005 )
  747.           str3$ = str3$ + install_drive$
  748.           str3$ = str3$ + GetString( 9006 )
  749.  
  750.           '// put up the dialog that tells user
  751.           '// how to deal with not enough disk space
  752.           i% = DoMsgBox( str1$ + str2$ + str3$, GetString( INSTALLSTR ), MB_OK )
  753.  
  754.           '// make sure that an error is returned by this function
  755.           Result% = (-1)
  756.  
  757.        else
  758.  
  759.           '// make sure that NO error is returned by this function
  760.           Result% = 0
  761.  
  762.         endif
  763.         '// end check for sufficient disk space for install
  764.  
  765.     else
  766.  
  767.         '// make sure that NO error is returned by this function
  768.         Result% = 0
  769.  
  770.     endif
  771.     '// end check for installing to new directory ( not overwriting )
  772.  
  773. ENDNotEnoughDiskSpace:
  774.  
  775.     NotEnoughDiskSpace = Result%
  776.  
  777. END FUNCTION
  778.  
  779.  
  780.