home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PhotoFinish 4.0 (French)
/
Photofinish-v4-FrenchVersion-Win31.iso
/
setup.rul
< prev
next >
Wrap
Text File
|
1996-11-28
|
12KB
|
384 lines
/*----------------------------------------------------------------------------*\
*
* Softkey International
* Strategic Products Group
* Cross Platform Team
*
* File Name: SETUP.RUL
*
* Description: Main script file for the 32-bit Cross-platform Installation
*
*
*
* Author: Thomas Quinn, Install Engineer Date: 10 July, 1996
*
* Comments: Based on IS xplatform, for generic installer FirstDraft
*
* Modified: 10 July, 1996
*
\*----------------------------------------------------------------------------*/
declare
#include "sddialog.h"
#include "instw32s.h"
#include "StrFmPrf.h"
#include "FileSet.h"
#include "init.h"
#include "ids.h"
#include "registry.h"
#include "AddIcons.h"
#include "ErrMsg.h"
#include "AppSpec.h"
#include "Sysfile.h"
#include "strings.h"
string szDestTitle, szDestMsg1, szDestMsg2, szDestMsg3, szLicenseStr;
string szFinTitle, szFinMsg1, szFinMsg2, szFinMsgBottom;
string szCmdLine, svDir, svFolder, szTemp, svResult, svTypeResult, szLicenseFile;
string szWin32sVer, szFileSetName, szProgram, szCommand, szMessage, szMsgTitle;
string szDefLogPath, szLogPath, szDefAppPath, szFullKey, szLaunchApp;
STRING szOpt1,szOpt2,szReadMeFileName, svQuit32sMsg;
number nResult, nvResult, nvTypeResult;
NUMBER nPlatform, nWin32sBuild, ISVersion;
NUMBER nExtx, nExty, nAddExtx, nAddExty;
BOOL bvOpt1, bvOpt2, bSpaceOk, bExplorer;
BOOL bNeed32s, bNo32s;
HWND hWindow;
prototype ConfirmShortPath( STRING );
prototype EarlyCancel();
prototype BOOL user.BringWindowToTop( HWND );
program
start:
Disable( BACKGROUND );
// See Init.rul, Init Sets up Screen, Initializes app variables,
// Sets Global OS system variables, and checks requirements.
// Contains some functionality previously in Instw32s.rul
Init();
//SetHandler to remove reg entry made in init, if canceled, q.v.
Handler( EXIT, OnEarlyCancel );
if (( nPlatform = IS_WINDOWSNT ) || ( nPlatform = IS_WINDOWS95 )) then
goto ProceedFurther;
endif;
/*---------------------------------------------------------------------*\
* If the target system operating system is neither Windows NT nor
* Windows 95, and if the Win32s version number less than 1.25, call
* _InstallWin32s to install or upgrade Win32s on the target system.
\*---------------------------------------------------------------------*/
Need32s:
if ( bNo32s ) then
MsgStrFromProfile ( "NeedWin32s", NEEDWIN32S_MSG );
if ( AskYesNo(NEEDWIN32S_MSG, YES ) = NO ) then
goto OnQuit32s;
else
goto Install32s;
endif;
endif;
if (( nPlatform != IS_WINDOWSNT ) && ( nPlatform != IS_WINDOWS95 )) then
// Get the version number of Win32s, if installed.
// MyGetWin32sVerInfo also retrieves the Win32s build number.
//bNeedWin32s = _MyGetWin32sVerInfo();
if ( bNeed32s ) then
MsgStrFromProfile ( "OldWin32s", NEEDWIN32S_MSG );
if ( AskYesNo(NEEDWIN32S_MSG, YES ) = NO ) then
// If the user does not want to install Win32s, bypass the Win32s
// installation section of SETUP.RUL.
goto ProceedFurther;
else
goto Install32s;
endif;
endif;
endif;
goto Install32s;
OnQuit32s:
MsgStrFromProfile ( "Quit32s", svQuit32sMsg );
if ( AskYesNo( svQuit32sMsg, NO ) = YES ) then
exit;
else
goto Need32s;
endif;
//could be the second time through, after installing win32s
//need to reset win.ini by calling these functions again so even if we
// don't need win32s we still need to call this
Install32s:
//GetSystemInfo( OS, nvResult, svResult );
if (( nPlatform != IS_WINDOWSNT ) && ( nPlatform != IS_WINDOWS95 )) then
// Specify the Win32s version you are installing (1.30c here).
// If Win32s installation fails, exit.
if !( _InstallWin32s( CURRENT_WIN32S_VERSION ) ) then
_ErrMsg( "ERR_WIN32SFAIL", TRUE );
exit;
endif;
// _RestartAfterInstall() restarts Windows and modifies WIN.INI
// so the 32-bit Cross-platform Installation setup starts again,
// allowing installation to continue.
_RestartAfterInstall();
else
//Set nInstallCompleted to TRUE, as we don't need 32s
nInstallCompleted = TRUE;
endif;
// If Win32s is installed correctly, install the 32-bit application.
ProceedFurther:
Enable( LOGGING );
SdWelcome( "", "" );
ConfirmLicense:
DlgStrFromProfile( "LicenseStr", szLicenseStr );
szLicenseFile = SUPPORTDIR ^ "Agree.txt";
if( SdLicense( "", szLicenseStr, "", szLicenseFile ) = BACK ) then
goto ProceedFurther;
endif;
//set the destination location.
svDir = WINDISK ^ DEFAULT_PATH;
DlgStrFromProfile( "DestinationTitle", szDestTitle );
DlgStrFromProfile( "DestinationMsg1", szDestMsg1 );
DlgStrFromProfile( "DestinationMsg2", szDestMsg2 );
DlgStrFromProfile( "DestinationMsg3", szDestMsg3 );
GetDestPath:
if ( SdAskDestPath( szDestTitle, szDestMsg1 + szDestMsg2 + szDestMsg3, svDir, 0 ) = BACK ) then
goto ConfirmLicense;
else
//Make sure we have a valid path
if( ( ( nPlatform != IS_WINDOWSNT ) && ( nPlatform != IS_WINDOWS95 ) ) ) then
if( !ConfirmShortPath( svDir ) ) then
_ErrMsg( "NoLongNames", FALSE );
goto GetDestPath;
endif;
endif;
//Confirm directory creation
if( ExistsDir( svDir ) = NOTEXISTS ) then
nResult = SdConfirmNewDir( "", svDir, 0 );
if( nResult = NO ) then
goto GetDestPath;
elseif( nResult < 0 ) then
_ErrMsg( "CantCreatePath", FALSE );
goto GetDestPath;
endif;
endif;
//Confirm file space is adequate
bSpaceOk = TRUE;
if( GetDiskSpace( svDir ) < SPACE_REQUIRED ) then
MsgStrFromProfile( "NotEnoughSpaceTitle", szMsgTitle );
SetDialogTitle( DLG_ASK_YESNO, szMsgTitle );
if( _AskYesNoFmt( "NotEnoughSpace", svDir ) = NO ) then
SetDialogTitle( DLG_ASK_YESNO, "" );
goto GetDestPath;
else
SetDialogTitle( DLG_ASK_YESNO, "" );
endif;
endif;
endif;
//Reset Handler, as deinstall start will take care of exit cleanup.
Handler( EXIT, -1 );
StrRemoveLastSlash( svDir );
//Get Program Folder.
svFolder = DEFAULT_FOLDER;
if ( SdSelectFolder( "","",svFolder ) = BACK ) then
goto GetDestPath;
endif;
// Define the file set, which is used to transfer application files
// to the target system.
RegDBSetItem( REGDB_APPPATH, svDir );
szDefAppPath = svDir ^ PRODUCT_KEY;
RegDBSetItem( REGDB_APPPATH_DEFAULT, szDefAppPath );
CreateUncompFileSet( nPlatform, svDir, szFileSetName );
szDefLogPath = WINDIR;
DeinstallStart( szDefLogPath, szLogPath, UNINSTALL_KEY, 0 );
RegDBSetItem( REGDB_UNINSTALL_NAME, UNINSTALL_NAME );
//Place the stuff
GetExtents( nExtx, nExty );
nAddExtx = nExtx / 15;
nAddExty = nExty / 15;
PlaceWindow( STATUS, nAddExtx, nAddExty, LOWER_RIGHT );
PlaceWindow( FEEDBACK, nAddExtx, nAddExty, LOWER_LEFT );
nAddExtx = nAddExtx / 2;
nAddExty = nAddExty + (nAddExty/2);
PlaceWindow( BILLBOARD, CENTERED, nAddExty, UPPER_RIGHT );
Disable( DIALOGCACHE );
Enable( STATUS );
Enable( INDVFILESTATUS );
Enable( FEEDBACK_FULL );
SetColor( STATUSBAR, BLUE ); // Bright blue.
PerformUncompFileSet( szFileSetName );
InstallSystemFiles();
Disable( STATUS );
Disable( INDVFILESTATUS );
Disable( FEEDBACK_FULL );
//Font Install uses 32-bit function calls, so need to load
//separate .ins file if we're still running 16 bit installshield.
//Pass in SRCDIR so it knows where fonts live
if( ISVersion = 16 ) then
DoInstall( SUPPORTDIR ^ "InstFt16.ins", SRCDIR, WAIT );
goto RegistryEntries;
endif;
AppSpec:
Handler( EXIT, OnCancel );
DoAppSpecificStuff();
AfterAppSpec:
Handler( EXIT, -1 );
RegistryEntries:
CreateRegistryEntries();
AddFolderIcons( bExplorer, svFolder, svDir, szLogPath );
//App specific, need to make Plugins Directory
CreateDir( svDir ^ "Plugins" );
if( BATCH_INSTALL ) then
SdFinishReboot( "", "", SYS_BOOTWIN, "", 0 );
hWindow = CmdGetHwndDlg( SD_DLG_FINISHREBOOT );
BringWindowToTop( hWindow );
else
// Announce the end of the installation and allow the user to run.
szProgram = "notepad.exe";
AppStrFromProfile( "ReadMeFileName", szReadMeFileName );
szCommand = svDir ^ szReadMeFileName;
LongPathToShortPath( szCommand );
szProgram = szProgram + " " + szCommand;
//nInstallCompleted is true if Win32s was installed completely
//or we're on 95 or NT. if its false we know that there is an old version of
//Win32s present, so we'll give 'em a different message
if( nInstallCompleted ) then
DlgStrFromProfile( "FinishBoxMsg1", szFinMsg1 );
DlgStrFromProfile( "FinishBoxMsg2", szFinMsg2 );
else
DlgStrFromProfile( "FinishWin32Msg1", szFinMsg1 );
DlgStrFromProfile( "FinishWin32Msg2", szFinMsg2 );
endif;
DlgStrFromProfile( "FinishBox1", szOpt1 );
DlgStrFromProfile( "FinishBox2", szOpt2 );
DlgStrFromProfile( "FinishTitle", szFinTitle );
DlgStrFromProfile( "FinishBoxMsgBottom", szFinMsgBottom );
szLaunchApp = svDir ^ PRODUCT_KEY;
if( nPlatform = IS_WINDOWS95 || nPlatform = IS_WINDOWSNT ) then
LongPathToQuote( szLaunchApp, TRUE );
endif;
SdFinish(szFinTitle, szFinMsg1 + szFinMsg2 ,
szFinMsgBottom, szOpt1,
szOpt2, bvOpt1, bvOpt2 );
hWindow = CmdGetHwndDlg( SD_DLG_FINISH );
BringWindowToTop( hWindow );
if ( bvOpt1 ) then
LaunchAppAndWait( szLaunchApp, "", NOWAIT );
endif;
if( bvOpt2 ) then
LaunchAppAndWait( szProgram, "", NOWAIT );
endif;
endif;
exit;
OnEarlyCancel:
if( _AskYesNoFmt( "ExitMsg", "" ) = NO ) then
return;
else
szFullKey = "Software\\" + COMPANY_NAME + "\\" + PRODUCT_NAME;
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
RegDBDeleteKey( szFullKey );
exit;
endif;
OnCancel:
EndDialog( SD_DLG_DISPLAYTOPICS );
goto AfterAppSpec;
return;
/*---------------------------------------------------------------------------*\
*
* Function: EarlyCancel
*
* Purpose: Perform some registry cleanup if the user quits, or gets kicked out
*
* Input:
*
* Returns:
*
* Comments: Exit routine, calle in _ErrMsg funcs
*
\*---------------------------------------------------------------------------*/
function EarlyCancel()
STRING szFullKey;
begin
szFullKey = "Software\\" + COMPANY_NAME + "\\" + PRODUCT_NAME;
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
RegDBDeleteKey( szFullKey );
exit;
end;
/*---------------------------------------------------------------------------*\
*
* Function: ConfirmShortPath
*
* Purpose: This is a utility function for Win32s
*
* Input: Path
*
* Returns: True if its a valid short path, false otherwise.
*
* Comments: 32-bit install shield allows long filenames no matter what,
* so we must make sure it's short in 32s
\*---------------------------------------------------------------------------*/
function ConfirmShortPath( szPath )
STRING svPath, svCurDir;
LIST listDirs;
NUMBER nCheck, nLength;
begin
//Get Parts
ParsePath( svPath, szPath, DIRECTORY );
listDirs = ListCreate( STRINGLIST );
StrGetTokens( listDirs, svPath, "\\" );
nCheck = ListGetFirstString( listDirs, svCurDir );
while( nCheck = 0 )
nLength = StrLength( svCurDir );
if( nLength > 8 ) then
return FALSE;
endif;
if( svCurDir % " " ) then
return FALSE;
endif;
nCheck = ListGetNextString( listDirs, svCurDir );
endwhile;
return TRUE;
end;
#include "Sysfile.rul"
#include "ErrMsg.rul"
#include "instw32s.rul"
#include "StrFmPrf.rul"
#include "sddialog.rul"
#include "init.rul"
#include "FileSet.rul"
#include "registry.rul"
#include "AddIcons.rul"
#include "AppSpec.rul"