home *** CD-ROM | disk | FTP | other *** search
/ Program Metropolis - Software Boutique 95 / SOFTWARECD.iso / omnipage / disk1 / setup.ms_ < prev    next >
Encoding:
Text File  |  1994-03-27  |  23.6 KB  |  779 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$ = "1111-2222-3333-4444"
  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.  
  204.     '// if there was a problem getting serial number
  205.     '// or user pressed CANCEL within dialog prompting user
  206.     '// to "insert floppy with serial number",
  207.     '// then abort installation
  208.     IF ( serial_result% = -1 ) THEN
  209.  
  210.     '// specify this was a user cancelled installation
  211.     ERROR STFERR
  212.  
  213.     '// handle installation termination
  214.         GOTO QUIT
  215.  
  216.     ENDIF
  217.  
  218.     '// close frontmost dialog
  219.     UIPop 1
  220.  
  221. '// construct default installation path
  222. INSTALLDIR:
  223.  
  224.     '// get previous installation path of OmniPage from WIN.INI
  225.     DEST$ = GetIniKeyString("WIN.INI", "OmniPage", "OP30" )
  226.  
  227.     '// create previous full path to OmniPage application
  228.     TDEST$ = MakePath( DEST$, "OP.EXE" )
  229.  
  230.     '// if previous OmniPage application exists in directory specified
  231.     '// in WIN.INI then use that directory as default install directory
  232.     IF ( DoesFileExist( TDEST$, femExists )) THEN
  233.  
  234.     '// leave path DEST$ alone !!
  235.  
  236.     ELSE
  237.  
  238.     '// use OMNIPRO\ as default install directory
  239.     DEST$ = "C:\OMNIPRO"
  240.  
  241.     ENDIF
  242.  
  243.     '// read in the SETUP information file
  244.     '// this contains application file list from LAYOUT files
  245.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  246.     IF szInf$ = "" THEN
  247.     szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  248.     END IF
  249.     ReadInfFile szInf$
  250.  
  251. '// set default path for dialog where user specifies install directory
  252. GETPATH:
  253.  
  254.     '// stuff default installation directory into dialog
  255.     SetSymbolValue "EditTextIn", DEST$
  256.  
  257.     '// make sure the edit text cell is selected
  258.     SetSymbolValue "EditFocus", "END"
  259.  
  260. '// get the directory from user to install the application
  261. GETPATHL1:
  262.  
  263.     '// display dialog for user to specify installation directory
  264.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  265.  
  266.     '// get the specified installation directory from edit text cell
  267.     DEST$ = GetSymbolValue("EditTextOut")
  268.  
  269.     '// if user pressed CONTINUE button in dialog to specify install directory
  270.     IF sz$ = "CONTINUE" THEN
  271.  
  272.     '// if specified install directory is invalid
  273.     '// or user does not have write privileges
  274.     '// display bath path dialog and redisplay the dialog
  275.     '// where user specifies installation directory
  276.     IF IsDirWritable(DEST$) = 0 THEN
  277.  
  278.         '// tell user why this directory cannot be used for installation
  279.         GOSUB BADPATH
  280.  
  281.         '// let user reenter installation directory
  282.         GOTO GETPATHL1
  283.  
  284.     END IF
  285.  
  286.     '// put away frontmost dialog
  287.     UIPop 1
  288.  
  289.     '// user pressed EXIT button in dialog to specify install directory
  290.     ELSE
  291.  
  292.     '// ask user if they really want to quit
  293.     GOSUB ASKQUIT
  294.  
  295.     '// return to dialog where user specifies installation directory
  296.     GOTO GETPATH
  297.  
  298.     ENDIF
  299.  
  300.     '// PROCEED WITH INSTALLATION - INSTALL PATH CAN BE CREATED
  301.  
  302.     '// strip trailing backslash from specified install directory
  303.     IF ( MID$( DEST$,LEN(DEST$),1 ) = "\" ) THEN
  304.     DEST$ = MID$( DEST$,1,LEN(DEST$)-1 )
  305.     ENDIF
  306.  
  307.     '// if there is insufficient disk space available in
  308.     '// specified installation directory give an error dialog
  309.     '// and redisplay diealog where user specifies installation directory
  310.     IF ( NotEnoughDiskSpace( DEST$, DISKSPACEREQ )) THEN
  311.  
  312.     '// return to dialog where user specifies installation directory
  313.     GOTO GETPATH
  314.  
  315.     ENDIF
  316.  
  317.     '// if installation directory already exists warn user that
  318.     '// many files will be deleted and others will be moved
  319.     IF ( DoesDirExist( DEST$ )) THEN
  320.  
  321.         '// warn the user that existing directory will be mungged
  322.         sz$ = UIStartDlg(CUIDLL$, WARN_OVERWRITE, "FEditDlgProc", APPHELP, HELPPROC$ )
  323.  
  324.         '// if user pressed other than CONTINUE button in the DIALOG
  325.     '// redisplay dialog to specify installation directory
  326.     IF sz$ <> "CONTINUE" THEN
  327.  
  328.         '// put away frontmost dialog
  329.         UIPop 1
  330.  
  331.         '// redisplay dialog to specify installation directory
  332.         GOTO INSTALLDIR
  333.  
  334.         ENDIF
  335.  
  336.     '// put away frontmost dialog
  337.         UIPop 1
  338.  
  339.     ENDIF
  340.  
  341.     'call the function defined below which installs the application files
  342.     Install
  343.  
  344. '// determine which QUIT state is appropriate
  345. QUIT:
  346.  
  347.     ON ERROR GOTO ERRQUIT
  348.  
  349.     '// select proper dialog to display when installation is terminated
  350.  
  351.     '// successful install completed
  352.     IF ERR = 0 THEN
  353.  
  354.     dlg% = EXITSUCCESS
  355.  
  356.     '// user terminated install process
  357.     ELSEIF ERR = STFQUIT THEN
  358.  
  359.     '// user terminated install process during registration
  360.     IF ( REGCANCELERR% = 1 ) THEN
  361.  
  362.         dlg% = REGCANCELDLG
  363.  
  364.     '// user cancelled install process before registration
  365.     ELSE
  366.  
  367.         dlg% = EXITQUIT
  368.  
  369.     ENDIF
  370.  
  371.     '// there was a fatal error during installation
  372.     ELSE
  373.  
  374.     dlg% = EXITFAILURE
  375.  
  376.     ENDIF
  377.  
  378.     '// drop through, now that proper dialog has been selected
  379.  
  380. '// terminate installation process
  381. QUITL1:
  382.  
  383.     '// display dialog selected above in QUIT: section
  384.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  385.  
  386.     '// put away frontmost dialog
  387.     UIPop 1
  388.  
  389.     '// if installation was successful
  390.     IF ( dlg% = EXITSUCCESS ) THEN
  391.  
  392.     '// exit the install script
  393.     END
  394.  
  395.     ENDIF
  396.  
  397.  
  398.     '// drop through and display install termination dialog
  399.  
  400. '// code to handle a cancelled installation
  401. ERRQUIT:
  402.  
  403.     '// cancel the install process
  404.     CaereCancelInstall
  405.  
  406.     '// exit the install script
  407.     END
  408.  
  409. '// code to handle an invalid specified installation directory
  410. BADPATH:
  411.  
  412.     '// display dialog explaining why installation directory cannot be used
  413.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  414.  
  415.     '// put away frontmost dialog
  416.     UIPop 1
  417.  
  418.     '// resume script execution from GOSUB call
  419.     RETURN
  420.  
  421. '// code to handle asking user if they want to quit
  422. ASKQUIT:
  423.  
  424.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  425.  
  426.     '// user pressed EXIT button in dialog
  427.     IF sz$ = "EXIT" THEN
  428.  
  429.     '// close all dialogs
  430.     UIPopAll
  431.  
  432.     '// specify that user cancelled installation
  433.     ERROR STFQUIT
  434.  
  435.     '// user did not press EXIT button in dialog
  436.     ELSE
  437.  
  438.     '// put away frontmost dialog and proceed with installation
  439.     UIPop 1
  440.  
  441.     ENDIF
  442.  
  443.     '// resume script execution from GOSUB call
  444.     RETURN
  445.  
  446. '// termination of MAIN() body of code in installation script
  447. RETURN
  448.  
  449.  
  450. '**
  451. '** Purpose:
  452. '**     Builds the copy list and performs all installation operations.
  453. '** Arguments:
  454. '**     none.
  455. '** Returns:
  456. '**     none.
  457. '*************************************************************************
  458. SUB Install STATIC
  459.  
  460.     '// if we are installing over directory specified
  461.     '// in WIN.INI - [OmniPage] - OP30=PreviousInstallPath$
  462.     '// then remove line OP30=PreviousInstallPath$
  463.     OldOP30Path$ = GetIniKeyString("WIN.INI", "OmniPage", "OP30" )
  464.     IF ( UCASE$( OldOP30Path$ ) = UCASE$( DEST$ ) ) THEN
  465.     RemoveIniKey "WIN.INI", "OmniPage", "OP30", cmoNone
  466.     ENDIF
  467.  
  468.     '// get path to files waiting to be installed
  469.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  470.  
  471.     '// create primary installation directory
  472.     CreateDir DEST$, cmoNone
  473.  
  474.     '// create subdirectory within primary installation directory
  475.     ScanDEST$ = MakePath( DEST$, "SCANNERS" )
  476.     CreateDir ScanDEST$, cmoNone
  477.  
  478.     '// add files from "files" group ( in SETUP.LYT ) to copy list
  479.     AddSectionFilesToCopyList "FILES", SrcDir$, DEST$
  480.  
  481.     '// add files from "scanners" group ( in SETUP.LYT ) to copy list
  482.     AddSectionFilesToCopyList "SCANNERS", SrcDir$, ScanDEST$
  483.  
  484.     '// add files from "win_sys" group ( in SETUP.LYT ) to copy list
  485.     WINSYS_DEST$ = GetWindowsDir()
  486.     WINSYS_DEST$ = WINSYS_DEST$ + "SYSTEM"
  487.     AddSectionFilesToCopyList "SYSTEM", SrcDir$, WINSYS_DEST$
  488.  
  489.     '// add files from "winfiles" group ( in SETUP.LYT ) to copy list
  490.     WIN_DEST$ = GetWindowsDir()
  491.     AddSectionFilesToCopyList "WINFILES", SrcDir$, WIN_DEST$
  492.  
  493.     '// create DATA subdirectory within primary installation directory
  494.     '// add path designation to WIN.INI
  495.     DataPATH$ = MakePath( DEST$, "DATA" )
  496.     CreateDir DataPATH$, cmoNone
  497.     CreateIniKeyValue "WIN.INI", "OmniPage", "DataPath", DataPATH$, cmoOverwrite
  498.  
  499.     '// create OLD_META subdirectory with primary installation directory
  500.     '// move existing metafiles to there
  501.     MetaPATH$ = MakePath( DEST$, "OLD_META" )
  502.     CreateDir MetaPATH$, cmoNone
  503.  
  504.     '// add files from "data" group ( in SETUP.LYT ) to the copy list
  505.     AddSectionFilesToCopyList "DATA", SrcDir$, DATAPATH$
  506.  
  507.  
  508.     '// NEW STUFF for installing over existing directory
  509.  
  510.     '// copy old metafiles to backup directory
  511.     i% = CopyFiles( DEST$ + "\*.MET", MetaPATH$ )
  512.     i% = DeleteFiles( DEST$ + "\*.MET" )
  513.  
  514.     '// preserve existing dictionaries for use with Pro 5.0
  515.     i% = RenameFiles( DEST$ + "\*.MD", DEST$ + "\*.NDX" )
  516.     i% = DeleteFiles( DEST$ + "\*.MD" )
  517.  
  518.     '// move training files into subdir
  519.     i% = CopyFiles( DEST$ + "\*.TRN", DATAPATH$ )
  520.     i% = DeleteFiles( DEST$ + "\*.TRN" )
  521.  
  522.  
  523.     '// move user dictionary files into subdir
  524.     i% = CopyFiles( DEST$ + "\*.UD", DATAPATH$ )
  525.     i% = DeleteFiles( DEST$ + "\*.UD" )
  526.  
  527.  
  528.     '// move zone content files into subdir
  529.     i% = CopyFiles( DEST$ + "\*.ZCN", DATAPATH$ )
  530.     i% = DeleteFiles( DEST$ + "\*.ZCN" )
  531.  
  532.  
  533.     '// zap most of the non-metafile stuff from previous installs
  534.     i% = DeleteFiles( DEST$ + "\*.DLL" )
  535.     i% = DeleteFiles( DEST$ + "\*.PLX" )
  536.     i% = DeleteFiles( DEST$ + "\*.EXE" )
  537.  
  538.     '// copy files from install disks to specified installation directory
  539.     CopyFilesInCopyList
  540.  
  541.     '// setup the program manager group with new progman items
  542.     CreateProgmanGroup "Caere Applications", "", cmoNone
  543.     ShowProgmanGroup  "Caere Applications", 1, cmoNone
  544.     CreateProgmanItem "Caere Applications", "OmniPage Professional", MakePath(DEST$, "omnipage.exe"), "", cmoOverwrite
  545.     CreateProgmanItem "Caere Applications", "Image Assistant", MakePath(DEST$, "photop.exe"), "", cmoOverwrite
  546.  
  547.     '// write stuff out to INI file
  548.     '// create path for INI file
  549.     INI_PATH$ = MakePath( DataPATH$, "OMNIPAGE.INI" )
  550.  
  551.  
  552.     '// perform registration process and write some info to OmniPage.INI
  553.  
  554.     '// create path for REG INFO file
  555.     RegPATH$ = MakePath( DEST$, "WARRANTY.TXT" )
  556.  
  557.     '// perform the registration process
  558.     '// this returns zero if cancelled, otherwise returns 1
  559.     '// - if "print" is first argument, registration info is printed
  560.     '// - if <filename> is first argument, registration info is sent to file
  561.     reg_result% = GetRegistration( "print", DISK_SERIAL$ )
  562.  
  563.  
  564.     '// initialize temporary flag for analyzing registration result
  565.     REGCANCELERR% = 0
  566.  
  567.     '//  exit this subroutine ::: IF ( reg_result% <> [success code] )
  568.     IF ( reg_result% = 0 ) THEN
  569.  
  570.     '// make sure that we put up the proper dialog when quitting
  571.     REGCANCELERR% = 1
  572.  
  573.     '// set error to normal termination
  574.     ERROR STFQUIT
  575.  
  576.     '// no gotos allowed outside local scope !!!
  577.  
  578.     ELSE
  579.  
  580.     '// proceed with registration process
  581.  
  582.     '// initialize strings to be passed back by GetWarrantyInfo()
  583.     user_name$ = "                                             "
  584.     comp_name$ = "                                                  "
  585.     is_IEVersion$ = "  "
  586.  
  587.     '// collect information from completed registration process
  588.         GetWarrantyInfo user_name$, comp_name$, is_IEVersion$
  589.  
  590.         '// write info to win.ini file for associations to extensions
  591.         ExtDEST$ = MakePath( DEST$, "omnipage.exe ^.met" )
  592.         CreateIniKeyValue "WIN.INI", "Extensions", "met", ExtDEST$, cmoOverwrite
  593.  
  594.     '// write registration info out to OMNIPAGE.INI
  595.     CreateIniKeyValue INI_PATH$, "Registration", "serial", DISK_SERIAL$, cmoOverwrite
  596.     CreateIniKeyValue INI_PATH$, "Registration", "name", user_name$, cmoOverwrite
  597.     CreateIniKeyValue INI_PATH$, "Registration", "company", comp_name$, cmoOverwrite
  598.  
  599.     '// if user registered as NON-US version set alternate ( NON-US )
  600.     '// default dictionary and default page size within OMNIPAGE.INI
  601.     IF ( MID$( is_IEVersion$,1,1 ) = "1" ) THEN
  602.         CreateIniKeyValue INI_PATH$, "LOCALIZATIONSET", "MainDictionary", "ukeng.ndx", cmoOverwrite
  603.         CreateIniKeyValue INI_PATH$, "LOCALIZATIONSET", "PageSize", "2", cmoOverwrite
  604.     ENDIF
  605.  
  606.     ENDIF
  607.  
  608. END SUB
  609.  
  610.  
  611.  
  612. '**
  613. '** Purpose:
  614. '**     Appends a file name to the end of a directory path,
  615. '**     inserting a backslash character as needed.
  616. '** Arguments:
  617. '**     szDir$  - full directory path (with optional ending "\")
  618. '**     szFile$ - filename to append to directory
  619. '** Returns:
  620. '**     Resulting fully qualified path name.
  621. '*************************************************************************
  622. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  623.      IF szDir$ = "" THEN
  624.             MakePath = szFile$
  625.     ELSEIF szFile$ = "" THEN
  626.             MakePath = szDir$
  627.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  628.         MakePath = szDir$ + szFile$
  629.     ELSE
  630.             MakePath = szDir$ + "\" + szFile$
  631.     END IF
  632. END FUNCTION
  633.  
  634.  
  635.  
  636. '**
  637. '** Purpose:
  638. '**     Returns string resource with given ID# from MSCUISTF.DLL.
  639. '**
  640. '** Arguments:
  641. '**     String resource ID#
  642. '**
  643. '** Returns:
  644. '**     String associated with given resource ID#
  645. '**
  646. '*************************************************************************
  647. FUNCTION GetString (id%) STATIC AS STRING
  648.     'load up the library
  649.     iInst% = LoadLibrary("MSCUISTF.DLL")
  650.     IF iInst% < 22 THEN
  651.         GOTO ENDGETSTRING
  652.     ENDIF
  653.  
  654.     'allocate space for the string
  655.     TheString$ = STRING$(256, 32)
  656.  
  657.     'get the string
  658.     i% = LoadString(iInst%, id%, TheString$, 256)
  659.  
  660.     'free the library
  661.     FreeLibrary iInst%
  662.  
  663. ENDGETSTRING:
  664.     GetString = TheString$
  665. END FUNCTION
  666.  
  667.  
  668. '**
  669. '** Purpose:
  670. '**     Check for necessary disk space required for installation of product.
  671. '**
  672. '**     If overwriting existing installation,
  673. '**     do nothing and return success code of ( 0 ).
  674. '**
  675. '**     Otherwise, give an error dialog if there is insufficient free disk
  676. '**     and return error of (-1).
  677. '**
  678. '** Arguments:
  679. '**     NewPath$ : full path to user specified installation directory
  680. '**
  681. '**     MinSpace& : minimum bytes necessary for installation of product
  682. '**
  683. '** Returns:
  684. '**     0 : if overwriting previous installation
  685. '**         or there is MinSpace& free on drive specified in NewPath$
  686. '**
  687. '**     (-1) : not overwriting previous installation and there is not
  688. '**            MinSpace& free on drive specified in NewPath$
  689. '**
  690. '*************************************************************************
  691. FUNCTION NotEnoughDiskSpace( NewPath$, MinSpace& ) STATIC as INTEGER
  692.  
  693.     Result% = 0
  694.  
  695.     '// find previous install path, if any
  696.     '// note: this line is specific to FaxMaster product
  697.     OldPath$ = GetIniKeyString( "WIN.INI","BitFax","BitFaxPath" )
  698.  
  699.     '// remove ending slash from path if necessary
  700.     if ( LEN( OldPath$ ) > 0 ) then
  701.         if ( MID$( OldPath$, LEN( OldPath$ ),1 ) = "\" ) then
  702.         OldPath$ = MID$( OldPath$,1,LEN( OldPath$ ) - 1 )
  703.         endif
  704.     endif
  705.  
  706.     '// remove ending slash from path if necessary
  707.     if ( LEN( NewPath$ ) > 0 ) then
  708.         if ( MID$( NewPath$, LEN( NewPath$ ),1 ) = "\" ) then
  709.         NewPath$ = MID$( NewPath$,1,LEN( NewPath$ ) - 1 )
  710.         endif
  711.     endif
  712.  
  713.     '// if the install is NOT overwriting previous install
  714.     '// of FaxMaster or OmniScan perform check for disk space
  715.     if ( OldPath$ <> NewPath$ ) then
  716.  
  717.         '// grab the drive letter out of the install destination path
  718.         install_drive$ = UCASE$( MID$( NewPath$,1,1 ))
  719.         if ( install_drive$ < "A" ) or ( install_drive$ > "Z" ) then
  720.         install_drive$ = "C"
  721.         endif
  722.  
  723.         '// determine the amount of free space on install drive
  724.         free_space& = GetFreeSpaceForDrive( install_drive$ )
  725.  
  726.         '// check to see if there is not sufficient
  727.         '// available space to complete install
  728.         if ( free_space& < MinSpace& ) then
  729.  
  730.         '// prepare messages for error dialog
  731.         '// by grabbing strings out of MSCUISTF.DLL
  732.  
  733.         str1$ = GetString( 9000 )
  734.         str1$ = str1$ + str$( MinSpace& /1000 )
  735.         str1$ = str1$ + GetString( 9001 )
  736.         str1$ = str1$ + INSTALLNAME
  737.  
  738.         str2$ = GetString( 9002 )
  739.         str2$ = str2$ + STR$( free_space& / 1000 )
  740.         str2$ = str2$ + GetString( 9003 )
  741.         str2$ = str2$ + install_drive
  742.         str2$ = str2$ + GetString( 9004 )
  743.  
  744.         str3$ = STR$( ( MinSpace& - free_space& ) / 1000 )
  745.         str3$ = str3$ + GetString( 9005 )
  746.         str3$ = str3$ + install_drive$
  747.         str3$ = str3$ + GetString( 9006 )
  748.  
  749.         '// put up the dialog that tells user
  750.         '// how to deal with not enough disk space
  751.         i% = DoMsgBox( str1$ + str2$ + str3$, GetString( INSTALLSTR ), MB_OK )
  752.  
  753.         '// make sure that an error is returned by this function
  754.         Result% = (-1)
  755.  
  756.     else
  757.  
  758.         '// make sure that NO error is returned by this function
  759.         Result% = 0
  760.  
  761.         endif
  762.         '// end check for sufficient disk space for install
  763.  
  764.     else
  765.  
  766.         '// make sure that NO error is returned by this function
  767.         Result% = 0
  768.  
  769.     endif
  770.     '// end check for installing to new directory ( not overwriting )
  771.  
  772. ENDNotEnoughDiskSpace:
  773.  
  774.     NotEnoughDiskSpace = Result%
  775.  
  776. END FUNCTION
  777.  
  778.  
  779.