home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of Windows 95.com 1996 September
/
WIN95_09962.iso
/
vrml
/
scout110.exe
/
disk1
/
_setup.lib
/
setup.rul
< prev
next >
Wrap
Text File
|
1995-08-04
|
18KB
|
571 lines
/*----------------------------------------------------------------------------
.###. ### ### ,#, .###. ,#######,
,####"" ### .### ,##'##, ,####"" .##' `##.
### ########### ,##' `##, ### #### ####
###.. ###' ### ,###########, ####.. `###, ,##'
`###### ### ### `##' `##' `###### `########'
Copyright 1995, Chaco Communications, Inc. All rights reserved.
Unpublished -- Rights reserved under the copyright laws of the United
States. Use of a copyright notice is precautionary only and does no
imply publication or disclosure.
This software contains confidential information and trade secrets of
Chaco Communications, Inc. Use, disclosure, or reproduction is
prohibited without the prior express written permission of Chaco
Communications, Inc.
RESTRICTED RIGHTS LEGEND
Use, duplication, or disclosure by the Government is subject to
restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
Technical Data and Computer Software clause at DFARS 252.227-7013.
Chaco Communications, Inc.
10164 Parkwood Drive, Suite 8, Cupertino, CA, 95014-1533
------------------------------------------------------------------------------
InstallSHIELD 32-bit Pueblo32 install script.
----------------------------------------------------------------------------*/
// $Header: /home/cvs/chaco/modules/client/msw/ChGraphx/ChMaze.cpp,v 2.42 1995/08/03 16:00:46 jimd Exp $
/*----------------------------------------------------------------------------
Constants
----------------------------------------------------------------------------*/
#define APP_NAME "Pueblo"
#define PROGRAM_FOLDER_NAME "Pueblo"
#define APPBASE_PATH "\\Program Files\\Chaco\\Pueblo\\"
#define APPBASE_PATH_WIN32S "\\Programf\\Chaco\\Pueblo\\"
#define SPACE_REQUIRED 100000 // Disk space in bytes.
#define COMPANY_NAME "Chaco Communications, Inc."
#define PRODUCT_NAME "Pueblo"
#define PRODUCT_VERSION "0.9"
// Deinstall keys
#define PRODUCT_KEY "pueblo.exe"
#define DEINSTALL_KEY "Pueblo32DeinstallKey"
#define UNINSTALL_NAME "Pueblo32 version 0.9"
#define INSTALL_BACKGROUND RGB( 128, 0, 0 )
#define STR_DEFTAB " "
#define CH_CONNECTION_GROUP "Connection"
#define CH_CONNECTION_HOST "Host"
#define CH_CONNECTION_HOST_DEF "zuni.chaco.com"
#define CH_CONNECTION_PORT "Port"
#define CH_CONNECTION_PORT_DEF "3141"
/*----------------------------------------------------------------------------
Declaration block
----------------------------------------------------------------------------*/
declare
#include "sddialog.h" // Include script dialog definitions.
/*----------------------------------------------------------------------------
Global variables
----------------------------------------------------------------------------*/
STRING svFolder, szMsg, szFileSet, szTitle;
STRING svTarget, szProgram, szTemp, svName, svCompany, szComponentList;
STRING svUninstLogFile, szAppPath, szRegKey, szAppSharedDir;
BOOL bSpaceOk;
NUMBER nResult, nType, nOSVersion;
LIST listInfo;
/*----------------------------------------------------------------------------
Function declarations
----------------------------------------------------------------------------*/
prototype SetupScreen();
prototype CheckRequirements();
prototype ConstructInfoList( LIST );
prototype CreateRegDBEntries();
prototype SetupFileTransfer( STRING, STRING );
prototype Install3DR();
prototype PerformFileTransfer( STRING );
prototype SetupFinish();
/*----------------------------------------------------------------------------
Program block
----------------------------------------------------------------------------*/
program
/*----------------------------------------------------------------------------
Script entrypoint
----------------------------------------------------------------------------*/
StartHere:
Disable( BACKGROUND );
/* Set installation info, which is
required for registry
entries */
InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION,
PRODUCT_KEY );
// Set up the installation screen
SetupScreen();
Enable( DIALOGCACHE );
// Create a Welcome dialog
WelcomeDlg:
Disable( BACKBUTTON );
SdProductName( PRODUCT_NAME );
SdWelcome( "", "" );
Enable( BACKBUTTON );
/* Test target system for proper
configuration */
CheckRequirements();
if ((IS_WINDOWSNT = nOSVersion) || (IS_WINDOWS95 = nOSVersion)) then
svTarget = TARGETDISK ^ APPBASE_PATH;
else
svTarget = TARGETDISK ^ APPBASE_PATH_WIN32S;
endif;
szAppSharedDir = svTarget ^ "System";
GetTargetDirectory:
// Get the destination directory
szMsg = "";
nType = AskDestPath( "", szMsg, svTarget, 0 );
szAppSharedDir = svTarget ^ "System";
/* Perform space check of target
drive */
bSpaceOk = TRUE;
if (GetDiskSpace( svTarget ) < SPACE_REQUIRED) then
szMsg = "There is not enough space available on the disk\n" +
"'" + svTarget + "' \n" +
"Please free up some space or change the target location\n" +
"to a different disk";
MessageBox( szMsg, WARNING );
bSpaceOk = FALSE;
endif;
/* If not enough space, ask user
to try again */
if (bSpaceOk = FALSE) goto GetTargetDirectory;
GetProgramFolderInfo:
svFolder = PROGRAM_FOLDER_NAME;
nResult = SdSelectFolder( "", "", svFolder );
if ( nResult = BACK ) then
goto GetTargetDirectory;
endif;
ConfirmCopy:
/* Show SdStartCopy dialog to
confirm file transfer
operation */
listInfo = ListCreate( STRINGLIST );
ConstructInfoList( listInfo );
szMsg = "Setup has enough information to start copying Pueblo " +
"files. If you want to review or change any settings, " +
"click Back. If you are satisfied with the settings, " +
"click Next to begin copying files.";
if (SdStartCopy( "", szMsg, listInfo ) = BACK) then
ListDestroy( listInfo );
goto GetProgramFolderInfo;
endif;
ListDestroy( listInfo );
SetupRegAndUninstall:
/* Prepare InstallSHIELD to record
deinstallation information */
DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
RegDBSetItem( REGDB_UNINSTALL_NAME, UNINSTALL_NAME );
/* Set the App Paths key for the
main program */
szAppPath = svTarget ^ "PROGRAM" + ";" + szAppSharedDir;
RegDBSetItem( REGDB_APPPATH, szAppPath );
szProgram = svTarget ^ "PROGRAM\\designer.exe";
RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
SetupAndDecompFiles:
szFileSet = "Pueblo";
SetupFileTransfer( szComponentList, szFileSet );
/* Set up progress indicator and
information gauge */
Enable( STATUS );
Disable( DIALOGCACHE );
/* Transfer files to the target
system */
PerformFileTransfer( szFileSet );
DoInstall3DR:
if (BACK = SdShowAnyDialog( "3DR Installation", "3dr", 0, 0 ))
goto ConfirmCopy;
Install3DR();
SetRegistryEntries:
CreateRegDBEntries( );
/* Set up progress indicator and
information gauge */
Delay( 2 );
Disable( FEEDBACK_FULL );
Disable( STATUS );
// Create program folder and icons
CreateProgramIcons:
SetStatusWindow( 95, "Creating Program Folder and Icons...." );
if (IS_WIN32S = nOSVersion) then
AppCommand( PROGMAN, CMD_RESTORE );
CreateProgramFolder( svFolder );
ShowProgramFolder( svFolder, 0 );
LongPathToShortPath( svTarget );
Delay( 1 );
endif;
TARGETDIR = svTarget;
szProgram = TARGETDIR ^ "Pueblo.exe";
if ((IS_WINDOWSNT = nOSVersion) || (IS_WINDOWS95 = nOSVersion)) then
AddFolderIcon( svFolder, APP_NAME, szProgram,
TARGETDIR, "", 0, "", REPLACE );
else
LongPathToQuote( szProgram, TRUE );
AddFolderIcon( "", APP_NAME, szProgram, TARGETDIR,
"", 0, "", REPLACE );
endif;
Delay( 1 );
if ((IS_WINDOWSNT = nOSVersion) || (IS_WINDOWS95 = nOSVersion)) then
AddFolderIcon( svFolder, "Pueblo Help",
"WinHelp.exe " + TARGETDIR ^ "Pueblo.hlp",
TARGETDIR, "", 0, "", REPLACE );
Delay( 1 );
AddFolderIcon( svFolder, "Pueblo release notes",
"NotePad.exe " + TARGETDIR ^ "ReadMe.txt",
TARGETDIR, "", 0, "", REPLACE );
Delay( 1 );
szProgram = WINDIR ^ "UnInst.exe";
LongPathToShortPath( szProgram );
LongPathToShortPath( svUninstLogFile );
szProgram = szProgram + " -f" + svUninstLogFile;
AddFolderIcon( svFolder, "Uninstall Pueblo", szProgram,
WINDIR, "", 0, "", REPLACE );
Delay( 1 );
endif;
/* Announce setup complete and
offer to read README file */
CloseOfInstall:
SetStatusWindow( 100, "Installation complete." );
SetupFinish();
exit;
/*----------------------------------------------------------------------------
SetupScreen
This function will set up the screen look. This includes colors, fonts,
text to be displayed, etc.
----------------------------------------------------------------------------*/
function SetupScreen()
string szBitmap;
number nvDx, nvDy, nDxBillboard, nDyBillboard;
begin
GetExtents( nvDx, nvDy );
Enable( FULLWINDOWMODE );
Enable( INDVFILESTATUS );
Enable( BITMAP256COLORS );
SetColor( BACKGROUND, INSTALL_BACKGROUND ); // Dark red background
SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text
Enable( BACKGROUND );
// Show the bitmap.
Enable( BITMAPFADE );
PlaceBitmap( SUPPORTDIR ^ "TITLE.BMP;128,0,0",
1, 10, 10, UPPER_LEFT | BITMAPICON );
Disable( BITMAPFADE );
end;
/*----------------------------------------------------------------------------
CheckRequirements
This function will check all minimum requirements for the application
being installed. If any fail, then the user is informed and the
installation is terminated.
----------------------------------------------------------------------------*/
function CheckRequirements()
number nvDx, nvDy;
number nvResult;
string svResult;
begin
/* Determine target system's
operating system */
GetSystemInfo( OS, nOSVersion, svResult );
if (nOSVersion = IS_WINDOWS) then
MessageBox( "This version of Pueblo must be installed on either " +
"Windows NT or Windows95. You can get a separate " +
"installer for Windows 3.", WARNING );
exit;
endif;
if (nOSVersion = IS_WIN32S) then
MessageBox( "This version of Pueblo must be installed on either " +
"Windows NT or Windows95. We are currently not Win32s " +
"compatible. You can get a separate installer for " +
"Windows 3.", WARNING );
exit;
endif;
// Check screen resolution
GetExtents( nvDx, nvDy );
if (nvDy < 480) then
MessageBox( "This program requires VGA or better resolution.",
WARNING );
exit;
endif;
end;
/*----------------------------------------------------------------------------
SetupFileTransfer
This function defines the file set based on the user's choices of
components, then it performs the file set.
----------------------------------------------------------------------------*/
function SetupFileTransfer( szComponentList, szFileSet )
begin
// Define the file set
TARGETDIR = svTarget;
FileSetBeginDefine( szFileSet );
/* Always include README files,
located at the root of the
DATA.Z library file */
SetStatusWindow( -1, "Copying readme files..." );
TARGETDIR = svTarget;
CompressGet( "data.z", "*.*", COMP_NORMAL );
SetStatusWindow( -1, "Copying program files..." );
CompressGet( "data.z", "program\\*.*", INCLUDE_SUBDIR );
SetStatusWindow( -1, "Copying help files..." );
CompressGet( "data.z", "help\\*.*", INCLUDE_SUBDIR );
// Copy 3DR install to support dir
SetStatusWindow( -1, "Copying 3DR files..." );
TARGETDIR = SUPPORTDIR;
CompressGet( "data.z", "3dr\\*.*", COMP_NORMAL );
/* Copy shared file to shared
directory */
SetStatusWindow( -1, "Copying shared files..." );
TARGETDIR = WINSYSDIR;
CompressGet( "data.z", "shared\\*.*", COMP_UPDATE_DATE | SHAREDFILE );
if (nOSVersion = IS_WINDOWSNT) then
CompressGet( "data.z", "shared\\winnt\\*.*",
COMP_UPDATE_DATE | SHAREDFILE );
elseif (nOSVersion = IS_WINDOWSNT) then
CompressGet( "data.z", "shared\\win95\\*.*",
COMP_UPDATE_DATE | SHAREDFILE );
endif;
FileSetEndDefine( szFileSet );
end;
/*----------------------------------------------------------------------------
ConstructInfoList
This function will construct a info list for showing the SdStartCopy
dialog to confirm the file transfer operation.
----------------------------------------------------------------------------*/
function ConstructInfoList( listInfo )
STRING szItem;
begin
ListAddString( listInfo, "Target Directory", AFTER );
ListAddString( listInfo, STR_DEFTAB + svTarget, AFTER );
ListAddString( listInfo, "", AFTER );
ListAddString( listInfo, "Program Folder", AFTER );
ListAddString( listInfo, STR_DEFTAB + svFolder, AFTER );
end;
/*----------------------------------------------------------------------------
CreateRegDBEntries
This function will create necessary keys and values for the sample
program.
----------------------------------------------------------------------------*/
function CreateRegDBEntries()
string szKey[255], szValue, szDemo, szProgram;
begin
RegDBSetDefaultRoot( HKEY_CURRENT_USER );
// Create CH_CONNECTION_GROUP key
szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME +
CH_CONNECTION_GROUP;
RegDBCreateKeyEx( szKey, "" );
RegDBSetKeyValueEx( szKey, CH_CONNECTION_HOST, REGDB_STRING,
CH_CONNECTION_HOST_DEF, -1 );
RegDBSetKeyValueEx( szKey, CH_CONNECTION_PORT, REGDB_NUMBER,
CH_CONNECTION_PORT_DEF, -1 );
end;
/*----------------------------------------------------------------------------
Install3DR
This function will install 3DR.
----------------------------------------------------------------------------*/
function Install3DR()
begin
end;
/*----------------------------------------------------------------------------
PerformFileTransfer
This function will perform the file transfer and handle any error that
may occur during the file transfer.
----------------------------------------------------------------------------*/
function PerformFileTransfer( szFileSet )
begin
StatusUpdate( ON, 90 );
// Perform the file set
nResult = FileSetPerformEz( szFileSet, 0 );
switch (nResult)
case FS_DONE: // Successful completion
case FS_CREATEDIR: // Create directory error
MessageBox( "Unable to create a directory under " +
TARGETDIR + ".\n" +
"Please check write access to this directory.",
SEVERE );
exit;
default: /* Group all other errors under
default label */
NumToStr( szTemp, nResult );
MessageBox( "General file transfer error. Please check " +
"your target location and try again.\n\n" +
"Error Number: " + szTemp, SEVERE );
exit;
endswitch;
end;
/*----------------------------------------------------------------------------
SetupFinish
This function will construct messages and info for showing SdFinish
----------------------------------------------------------------------------*/
function SetupFinish()
string szMsg1, szMsg2;
string szReadme, szApp, szProgram, szParam;
BOOL bReadme, bApp;
begin
if (BATCH_INSTALL = TRUE) then
szMsg = "Some files could not be installed because they are " +
"currently in use by other programs in the system. " +
"To allow for proper operation of the new program you " +
"should restart your system at this time.";
CommitSharedFiles( 0 );
RebootDialog( "Restart Windows", szMsg, SYS_BOOTMACHINE );
else
bReadme = FALSE;
bApp = FALSE;
szMsg1 = "Setup is complete. You may run the installed program " +
"by double-clicking on the program icon installed.\n\n" +
"Please view the contents of the README icon before " +
"starting the program";
szMsg2 = "Click Finish to complete Setup.";
bReadme = TRUE;
szReadme = "Yes, I want to view the ReadMe file now.";
szApp = "Yes, I want to run Pueblo now.";
MessageBeep( 0 );
SdFinish( "", szMsg1, szMsg2, szReadme, szApp, bReadme, bApp );
if ( bReadme ) then
szProgram = "NotePad.exe";
szParam = svTarget ^ "ReadMe.txt";
LongPathToShortPath( szParam );
LaunchAppAndWait( szProgram + " " + szParam, "", NOWAIT );
Delay(2);
endif;
if ( bApp ) then
szProgram = TARGETDIR ^ "Pueblo.exe";
LaunchAppAndWait( szProgram, "", NOWAIT );
endif;
endif;
end;
/*----------------------------------------------------------------------------
Standard dialogs include
----------------------------------------------------------------------------*/
#include "sddialog.rul"