ShutDown.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:4k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       ShutDown.h
  3.  
  4.      Contains:   Shutdown Manager Interfaces.
  5.  
  6.      Version:    Technology: System 7.5
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1987-2001 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __SHUTDOWN__
  18. #define __SHUTDOWN__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __MIXEDMODE__
  23. #include "MixedMode.h"
  24. #endif
  25. #if PRAGMA_ONCE
  26. #pragma once
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #if PRAGMA_IMPORT
  32. #pragma import on
  33. #endif
  34. #if PRAGMA_STRUCT_ALIGN
  35.     #pragma options align=mac68k
  36. #elif PRAGMA_STRUCT_PACKPUSH
  37.     #pragma pack(push, 2)
  38. #elif PRAGMA_STRUCT_PACK
  39.     #pragma pack(2)
  40. #endif
  41. enum {
  42.     sdOnPowerOff                = 1,                            /*call procedure before power off.*/
  43.     sdOnRestart                 = 2,                            /*call procedure before restart.*/
  44.     sdOnUnmount                 = 4,                            /*call procedure before unmounting.*/
  45.     sdOnDrivers                 = 8,                            /*call procedure before closing drivers.*/
  46.     sdOnBootVolUnmount          = 16,                           /*call procedure before unmounting boot volume and VM volume but after unmounting all other volumes*/
  47.     sdRestartOrPower            = 3                             /*call before either power off or restart.*/
  48. };
  49. #if CALL_NOT_IN_CARBON
  50. typedef CALLBACK_API( void , ShutDwnProcPtr )(short shutDownStage);
  51. /*
  52.     WARNING: ShutDwnProcPtr uses register based parameters under classic 68k
  53.              and cannot be written in a high-level language without 
  54.              the help of mixed mode or assembly glue.
  55. */
  56. typedef REGISTER_UPP_TYPE(ShutDwnProcPtr)                       ShutDwnUPP;
  57. #if OPAQUE_UPP_TYPES
  58. #if CALL_NOT_IN_CARBON
  59.     EXTERN_API(ShutDwnUPP)
  60.     NewShutDwnUPP                  (ShutDwnProcPtr          userRoutine);
  61.     EXTERN_API(void)
  62.     DisposeShutDwnUPP              (ShutDwnUPP              userUPP);
  63.     EXTERN_API(void)
  64.     InvokeShutDwnUPP               (short                   shutDownStage,
  65.                                     ShutDwnUPP              userUPP);
  66. #endif  /* CALL_NOT_IN_CARBON */
  67. #else
  68.     enum { uppShutDwnProcInfo = 0x00001002 };                       /* register no_return_value Func(2_bytes:D0) */
  69.     #define NewShutDwnUPP(userRoutine)                              (ShutDwnUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppShutDwnProcInfo, GetCurrentArchitecture())
  70.     #define DisposeShutDwnUPP(userUPP)                              DisposeRoutineDescriptor(userUPP)
  71.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  72.     #pragma parameter InvokeShutDwnUPP(__D0, __A0)
  73.     void InvokeShutDwnUPP(short shutDownStage, ShutDwnUPP userUPP) = 0x4E90;
  74.     #else
  75.         #define InvokeShutDwnUPP(shutDownStage, userUPP)                CALL_ONE_PARAMETER_UPP((userUPP), uppShutDwnProcInfo, (shutDownStage))
  76.     #endif
  77. #endif
  78. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  79. #define NewShutDwnProc(userRoutine)                             NewShutDwnUPP(userRoutine)
  80. #define CallShutDwnProc(userRoutine, shutDownStage)             InvokeShutDwnUPP(shutDownStage, userRoutine)
  81. #if CALL_NOT_IN_CARBON
  82. EXTERN_API( void )
  83. ShutDwnPower                    (void)                                                      THREEWORDINLINE(0x3F3C, 0x0001, 0xA895);
  84. EXTERN_API( void )
  85. ShutDwnStart                    (void)                                                      THREEWORDINLINE(0x3F3C, 0x0002, 0xA895);
  86. EXTERN_API( void )
  87. ShutDwnInstall                  (ShutDwnUPP             shutDownProc,
  88.                                  short                  flags)                              THREEWORDINLINE(0x3F3C, 0x0003, 0xA895);
  89. EXTERN_API( void )
  90. ShutDwnRemove                   (ShutDwnUPP             shutDownProc)                       THREEWORDINLINE(0x3F3C, 0x0004, 0xA895);
  91. #endif  /* CALL_NOT_IN_CARBON */
  92. #endif  /* CALL_NOT_IN_CARBON */
  93. #if PRAGMA_STRUCT_ALIGN
  94.     #pragma options align=reset
  95. #elif PRAGMA_STRUCT_PACKPUSH
  96.     #pragma pack(pop)
  97. #elif PRAGMA_STRUCT_PACK
  98.     #pragma pack()
  99. #endif
  100. #ifdef PRAGMA_IMPORT_OFF
  101. #pragma import off
  102. #elif PRAGMA_IMPORT
  103. #pragma import reset
  104. #endif
  105. #ifdef __cplusplus
  106. }
  107. #endif
  108. #endif /* __SHUTDOWN__ */