home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-08-10 | 2.8 KB | 89 lines | [TEXT/KAHL] |
- /* ****************************************************************
-
- SendInCardIBeg.c
- Originally written in MPW Pascal by Darryl Lovato (dgl).
- Rendered into Think C by Robert Thorne (rmt).
-
- Copyright © 1994 Aladdin Systems, Inc.
- All Rights Reserved.
-
- This source text produces an IBeg installer extension, which
- can be called by a Product Installer at the start of the
- installation process. Specifications for IBeg, IMid, ICnd,
- and IEnd installer extensions are given in the documentation
- for StuffIt InstallerMaker™.
-
- This subroutine performs the following functions:
-
- • Loads and plays the snd=128 resource in the Product
- Installer's resource fork, using the SndPlay call.
- • Returns status code from SndPlay.
-
- CHANGE HISTORY:
-
- VER DATE ENGR DESCRIPTION
- 1 93.06.21 dgl Initial version.
- 2 93.06.22 jam Added commentary and modified style to
- match other source files in the
- InstallerMaker suite.
- 3 93.06.28 jam Changed DoBeforeInstalling declaration
- to conform to new pw parameter spec.
- 4 94.03.04 rmt Converted to Symantec Think C 6.0,
- and added comments.
- 5 94.08.10 rmt Added information about the "password"
- parameter.
-
- ******************************************************************/
-
- // Apple Include files
- #include <Types.h>
- #include <Sound.h>
- #include <Resources.h>
-
- // A few handy definitions. First, IBegs can return two possible values:
- #define kWasNotAborted 0
- #define kWasAborted 1
-
- // The id and type of our 'snd ' resource:
- #define kSndID 128
- #define kSndOSType 'snd '
-
- // Style of call for the Sound Manager
- #define kSynchronous false
-
-
- //** The call to the code resource. The IBeg may derive or get from the user
- //** a password to the installer's archive; this is placed into "password", which
- //** is initially an empty string. This is a handy way to deal with simple
- //** serialization schemes, since the password can be manipulated or calculated
- //** within the IBeg.
-
- pascal short main ( Str255 password )
- {
- Handle theSound ;
- OSErr error ;
-
- // First, we fetch the sound. We can assume the current resource file is
- // the Product Installer.
-
- theSound = GetResource ( kSndOSType, kSndID ) ;
-
- // This is unlikely to fail, unless the we (meaning the product developer)
- // set the partition size for the installer too small for the size of our
- // sound, or that the sound resource isn't in the installer as it should be
- // If you test before you ship, your users will never have this fail. But
- // for safety, we check now:
-
- if ( !theSound )
- return kWasAborted ;
-
- // Now play the sound.
- error = SndPlay ( nil, theSound, kSynchronous ) ;
-
- // Fail or no, we need to clean up
- ReleaseResource ( theSound ) ;
-
- // Return, indicating to the installer if trouble occured
- return error == noErr ? kWasNotAborted : kWasAborted ;
-
- }