home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Compression / StuffIt InstallerMaker™ Folder / InstallerMaker Extensions / IBeg Extension / SendInCardIBeg.c < prev    next >
Encoding:
Text File  |  1994-03-04  |  2.7 KB  |  86 lines  |  [TEXT/KAHL]

  1. /* ****************************************************************
  2.  
  3.         SendInCardIBeg.c
  4.                     Originally written in MPW Pascal by Darryl Lovato (dgl).
  5.                     Rendered into Think C by Robert Thorne (rmt).
  6.                     
  7.         Copyright © 1994 Aladdin Systems, Inc.
  8.         All Rights Reserved.
  9.         
  10.         This source text produces an IBeg installer extension, which
  11.         can be called by a Product Installer at the start of the 
  12.         installation process.  Specifications for IBeg, IMid, ICnd, 
  13.         and IEnd installer extensions are given in the documentation 
  14.         for StuffIt InstallerMaker™.
  15.         
  16.         This subroutine performs the following functions:
  17.            
  18.         • Loads and plays the snd=128 resource in the Product
  19.           Installer's resource fork, using the SndPlay call.
  20.         • Returns status code from SndPlay.
  21.         
  22.         CHANGE HISTORY:
  23.         
  24.         VER    DATE        ENGR    DESCRIPTION
  25.         1    93.06.21    dgl        Initial version.
  26.         2    93.06.22    jam        Added commentary and modified style to
  27.                                 match other source files in the
  28.                                 InstallerMaker suite.
  29.         3    93.06.28    jam        Changed DoBeforeInstalling declaration
  30.                                 to conform to new pw parameter spec.
  31.         4    94.03.04    rmt        Converted to Symantec Think C 6.0,
  32.                                 and added comments.
  33.  
  34. ******************************************************************/
  35.  
  36. // Apple Include files
  37. #include <Types.h>
  38. #include <Sound.h>
  39. #include <Resources.h>
  40.  
  41. // A few handy definitions.  First, IBegs can return two possible values:
  42. #define kWasNotAborted 0
  43. #define kWasAborted 1
  44.  
  45. // The id and type of our 'snd ' resource:
  46. #define kSndID 128
  47. #define kSndOSType 'snd '
  48.  
  49. // Style of call for the Sound Manager
  50. #define kSynchronous false
  51.  
  52.  
  53. //** The call to the code resource.  The IBeg may derive or get from the user
  54. //** a password to the installer's archive; this is placed into "password", which
  55. //** is initially an empty string. In addition, note that the function is declared
  56. //** "pascal". 
  57.  
  58. pascal short  main ( Str255  *password )
  59. {
  60.     Handle    theSound ;
  61.     OSErr    error ;
  62.     
  63.     // First, we fetch the sound.  We can assume the current resource file is
  64.     // the Product Installer.
  65.     
  66.     theSound = GetResource ( kSndOSType, kSndID ) ;
  67.     
  68.     // This is unlikely to fail, unless the we (meaning the product developer)
  69.     // set the partition size for the installer too small for the size of our
  70.     // sound, or that the sound resource isn't in the installer as it should be
  71.     // If you test before you ship, your users will never have this fail.  But
  72.     // for safety, we check now:
  73.     
  74.     if ( !theSound )
  75.         return kWasAborted ;
  76.         
  77.     // Now play the sound.
  78.     error = SndPlay ( nil, theSound, kSynchronous ) ;
  79.     
  80.     // Fail or no, we need to clean up
  81.     ReleaseResource ( theSound ) ;
  82.  
  83.      // Return, indicating to the installer if trouble occured
  84.     return error == noErr ? kWasNotAborted : kWasAborted ;
  85.  
  86. }