home *** CD-ROM | disk | FTP | other *** search
/ Mac Expert 1995 Winter / Mac Expert - Winter 95.iso / Les fichiers / Utilitaires divers / Cat & Compresseurs / StuffIt InstallerMaker™ ƒ / InstallerMaker Extensions / IBeg Extension / SendInCardIBeg.c < prev    next >
Encoding:
Text File  |  1994-08-10  |  2.8 KB  |  89 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.         5    94.08.10    rmt        Added information about the "password"
  34.                                 parameter.
  35.  
  36. ******************************************************************/
  37.  
  38. // Apple Include files
  39. #include <Types.h>
  40. #include <Sound.h>
  41. #include <Resources.h>
  42.  
  43. // A few handy definitions.  First, IBegs can return two possible values:
  44. #define kWasNotAborted 0
  45. #define kWasAborted 1
  46.  
  47. // The id and type of our 'snd ' resource:
  48. #define kSndID 128
  49. #define kSndOSType 'snd '
  50.  
  51. // Style of call for the Sound Manager
  52. #define kSynchronous false
  53.  
  54.  
  55. //** The call to the code resource.  The IBeg may derive or get from the user
  56. //** a password to the installer's archive; this is placed into "password", which
  57. //** is initially an empty string. This is a handy way to deal with simple 
  58. //** serialization schemes, since the password can be manipulated or calculated
  59. //** within the IBeg.
  60.  
  61. pascal short  main ( Str255  password )
  62. {
  63.     Handle    theSound ;
  64.     OSErr    error ;
  65.     
  66.     // First, we fetch the sound.  We can assume the current resource file is
  67.     // the Product Installer.
  68.     
  69.     theSound = GetResource ( kSndOSType, kSndID ) ;
  70.     
  71.     // This is unlikely to fail, unless the we (meaning the product developer)
  72.     // set the partition size for the installer too small for the size of our
  73.     // sound, or that the sound resource isn't in the installer as it should be
  74.     // If you test before you ship, your users will never have this fail.  But
  75.     // for safety, we check now:
  76.     
  77.     if ( !theSound )
  78.         return kWasAborted ;
  79.         
  80.     // Now play the sound.
  81.     error = SndPlay ( nil, theSound, kSynchronous ) ;
  82.     
  83.     // Fail or no, we need to clean up
  84.     ReleaseResource ( theSound ) ;
  85.  
  86.      // Return, indicating to the installer if trouble occured
  87.     return error == noErr ? kWasNotAborted : kWasAborted ;
  88.  
  89. }