home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Installers / Smaller Installer 1.1 / Hook Proc Examples / Sys6Or7Hook / Sys6Or7Hook.c next >
Encoding:
C/C++ Source or Header  |  1993-07-03  |  3.0 KB  |  86 lines  |  [TEXT/KAHL]

  1. /******************************************************************************
  2.     Smaller Installer © 1993 Bill Goodman, All Rights Reserved
  3. *******************************************************************************
  4.  
  5. System 6/7 Select Example
  6.  
  7. This installer hook procedure checks the version of the System that is running
  8. and enables group "Q" if System 7 is running or group "R" if System 6 is
  9. running.
  10.  
  11. To use this hook procedure, you must compile this code and create a code
  12. resource with type 'SICR' and an ID of 500.  This resource should be
  13. non-preloaded, nonpurgeable, unlocked, unprotected and non-sysheap. Copy this
  14. resource to your installer's resource file.
  15.  
  16. ******************************************************************************/
  17.  
  18. #include <SetUpA4.h>
  19. #include <GestaltEqu.h>
  20. #include "SIHookProc.h"
  21.  
  22.  
  23. /******************************************************************************
  24.     Module Internal Function Prototypes
  25. ******************************************************************************/
  26. void SetTargetVolFunction(void);
  27.  
  28.  
  29. /******************************************************************************
  30.     Constant Declarations
  31. ******************************************************************************/
  32. #define groupQ                        0        /* Group Q select value */
  33. #define groupR                        1        /* Group R select value */
  34.  
  35.  
  36. /******************************************************************************
  37.     Module Variables Declarations
  38. ******************************************************************************/
  39. SIHookParmBlk *parms;                    /* Global pointer to parameter block */
  40.  
  41.  
  42. /*****************************************************************************/
  43. pascal void main(
  44.         SIHookParmBlk *parmBlk    /* Pointer to parameter block */
  45.         )
  46. /******************************************************************************
  47.     This is the main entry point for the installer hook procedure.
  48. ******************************************************************************/
  49. {
  50. RememberA0();    /* This is necessary to access any global variables */
  51. SetUpA4();
  52. parms = parmBlk;
  53.  
  54. switch (parms->function)
  55.     {
  56.     case siHookSetTargetVol:
  57.         SetTargetVolFunction();
  58.         break;
  59.     }
  60. RestoreA4();
  61. }
  62.  
  63.  
  64. /*****************************************************************************/
  65. void SetTargetVolFunction(void)
  66. /******************************************************************************
  67.     Input parameters:
  68.         "targetVRefNum" - Volume reference number of target volume
  69.         "groupAPFlags", "groupQUSel", "groupVZSel" - Groups currently selected
  70.                                                                     for installation
  71.     Returns:
  72.         "groupAPFlags", "groupQUSel", "groupVZSel" - New installation groups
  73.  
  74.     This function is called at startup and whenever the target volume is
  75.     changed.
  76. ******************************************************************************/
  77. {
  78. long feature;
  79.  
  80. /* Use Gestalt to obtain system version. Assume System 6 if Gestalt fails */
  81. parms->groupQUSel = groupR;
  82. if (Gestalt(gestaltSystemVersion, &feature) == noErr)
  83.     if (feature >= 0x0700)
  84.         parms->groupQUSel = groupQ;
  85. }
  86.