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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       Start.h
  3.  
  4.      Contains:   Start Manager Interfaces.
  5.  
  6.      Version:    Technology: Mac OS 8.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 __START__
  18. #define __START__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __FILES__
  23. #include "Files.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. /*
  42.     Important: When the major version number of kExtensionTableVersion and the value
  43.     returned by gestaltExtensionTableVersion change, it indicates that the Extension
  44.     Table startup mechanism has radically changed and code that doesn't know about
  45.     the new major version must not attempt to use the Extension Table startup
  46.     mechanism.
  47.     
  48.     Changes to the minor version number of kExtensionTableVersion indicate that the
  49.     definition of the ExtensionElement structure has been extended, but the fields
  50.     defined for previous minor versions of kExtensionTableVersion have not changed.
  51. */
  52. enum {
  53.     kExtensionTableVersion      = 0x00000100                    /* current ExtensionTable version (1.0.0) */
  54. };
  55. /* ExtensionNotification message codes */
  56. enum {
  57.     extNotificationBeforeFirst  = 0,                            /* Before any extensions have loaded */
  58.     extNotificationAfterLast    = 1,                            /* After all extensions have loaded */
  59.     extNotificationBeforeCurrent = 2,                           /* Before extension at extElementIndex is loaded */
  60.     extNotificationAfterCurrent = 3                             /* After extension at extElementIndex is loaded */
  61. };
  62. struct ExtensionElement {
  63.     Str31                           fileName;                   /* The file name */
  64.     long                            parentDirID;                /* the file's parent directory ID */
  65.                                                                 /* and everything after ioNamePtr in the HParamBlockRec.fileParam variant */
  66.     short                           ioVRefNum;                  /* always the real volume reference number (not a drive, default, or working dirID) */
  67.     short                           ioFRefNum;
  68.     SInt8                           ioFVersNum;
  69.     SInt8                           filler1;
  70.     short                           ioFDirIndex;                /* always 0 in table */
  71.     SInt8                           ioFlAttrib;
  72.     SInt8                           ioFlVersNum;
  73.     FInfo                           ioFlFndrInfo;
  74.     long                            ioDirID;
  75.     unsigned short                  ioFlStBlk;
  76.     long                            ioFlLgLen;
  77.     long                            ioFlPyLen;
  78.     unsigned short                  ioFlRStBlk;
  79.     long                            ioFlRLgLen;
  80.     long                            ioFlRPyLen;
  81.     unsigned long                   ioFlCrDat;
  82.     unsigned long                   ioFlMdDat;
  83. };
  84. typedef struct ExtensionElement         ExtensionElement;
  85. typedef ExtensionElement *              ExtensionElementPtr;
  86. struct ExtensionTableHeader {
  87.     UInt32                          extTableHeaderSize;         /* size of ExtensionTable header ( equal to offsetof(ExtensionTable, extElements[0]) ) */
  88.     UInt32                          extTableVersion;            /* current ExtensionTable version (same as returned by gestaltExtTableVersion Gestalt selector) */
  89.     UInt32                          extElementIndex;            /* current index into ExtensionElement records (zero-based) */
  90.     UInt32                          extElementSize;             /* size of ExtensionElement */
  91.     UInt32                          extElementCount;            /* number of ExtensionElement records in table (1-based) */
  92. };
  93. typedef struct ExtensionTableHeader     ExtensionTableHeader;
  94. struct ExtensionTable {
  95.     ExtensionTableHeader            extTableHeader;             /* the ExtensionTableHeader */
  96.     ExtensionElement                extElements[1];             /* one element for each extension to load */
  97. };
  98. typedef struct ExtensionTable           ExtensionTable;
  99. typedef ExtensionTable *                ExtensionTablePtr;
  100. typedef ExtensionTablePtr *             ExtensionTableHandle;
  101. typedef CALLBACK_API( void , ExtensionNotificationProcPtr )(UInt32 message, void *param, ExtensionElementPtr extElement);
  102. typedef CALLBACK_API( void , ExtensionTableHandlerProcPtr )(UInt32 message, void *param, ExtensionTableHandle extTableHandle);
  103. typedef STACK_UPP_TYPE(ExtensionNotificationProcPtr)            ExtensionNotificationUPP;
  104. typedef STACK_UPP_TYPE(ExtensionTableHandlerProcPtr)            ExtensionTableHandlerUPP;
  105. #if OPAQUE_UPP_TYPES
  106. #if CALL_NOT_IN_CARBON
  107.     EXTERN_API(ExtensionNotificationUPP)
  108.     NewExtensionNotificationUPP    (ExtensionNotificationProcPtr userRoutine);
  109.     EXTERN_API(ExtensionTableHandlerUPP)
  110.     NewExtensionTableHandlerUPP    (ExtensionTableHandlerProcPtr userRoutine);
  111.     EXTERN_API(void)
  112.     DisposeExtensionNotificationUPP    (ExtensionNotificationUPP userUPP);
  113.     EXTERN_API(void)
  114.     DisposeExtensionTableHandlerUPP    (ExtensionTableHandlerUPP userUPP);
  115.     EXTERN_API(void)
  116.     InvokeExtensionNotificationUPP    (UInt32               message,
  117.                                     void *                  param,
  118.                                     ExtensionElementPtr     extElement,
  119.                                     ExtensionNotificationUPP userUPP);
  120.     EXTERN_API(void)
  121.     InvokeExtensionTableHandlerUPP    (UInt32               message,
  122.                                     void *                  param,
  123.                                     ExtensionTableHandle    extTableHandle,
  124.                                     ExtensionTableHandlerUPP userUPP);
  125. #endif  /* CALL_NOT_IN_CARBON */
  126. #else
  127.     enum { uppExtensionNotificationProcInfo = 0x00000FC0 };         /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  128.     enum { uppExtensionTableHandlerProcInfo = 0x00000FC0 };         /* pascal no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  129.     #define NewExtensionNotificationUPP(userRoutine)                (ExtensionNotificationUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppExtensionNotificationProcInfo, GetCurrentArchitecture())
  130.     #define NewExtensionTableHandlerUPP(userRoutine)                (ExtensionTableHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppExtensionTableHandlerProcInfo, GetCurrentArchitecture())
  131.     #define DisposeExtensionNotificationUPP(userUPP)                DisposeRoutineDescriptor(userUPP)
  132.     #define DisposeExtensionTableHandlerUPP(userUPP)                DisposeRoutineDescriptor(userUPP)
  133.     #define InvokeExtensionNotificationUPP(message, param, extElement, userUPP)  CALL_THREE_PARAMETER_UPP((userUPP), uppExtensionNotificationProcInfo, (message), (param), (extElement))
  134.     #define InvokeExtensionTableHandlerUPP(message, param, extTableHandle, userUPP)  CALL_THREE_PARAMETER_UPP((userUPP), uppExtensionTableHandlerProcInfo, (message), (param), (extTableHandle))
  135. #endif
  136. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  137. #define NewExtensionNotificationProc(userRoutine)               NewExtensionNotificationUPP(userRoutine)
  138. #define NewExtensionTableHandlerProc(userRoutine)               NewExtensionTableHandlerUPP(userRoutine)
  139. #define CallExtensionNotificationProc(userRoutine, message, param, extElement) InvokeExtensionNotificationUPP(message, param, extElement, userRoutine)
  140. #define CallExtensionTableHandlerProc(userRoutine, message, param, extTableHandle) InvokeExtensionTableHandlerUPP(message, param, extTableHandle, userRoutine)
  141. union DefStartRec {
  142.     struct {
  143.         SignedByte                      sdExtDevID;
  144.         SignedByte                      sdPartition;
  145.         SignedByte                      sdSlotNum;
  146.         SignedByte                      sdSRsrcID;
  147.     }                                 slotDev;
  148.     struct {
  149.         SignedByte                      sdReserved1;
  150.         SignedByte                      sdReserved2;
  151.         short                           sdRefNum;
  152.     }                                 scsiDev;
  153. };
  154. typedef union DefStartRec               DefStartRec;
  155. typedef DefStartRec *                   DefStartPtr;
  156. struct DefVideoRec {
  157.     SignedByte                      sdSlot;
  158.     SignedByte                      sdsResource;
  159. };
  160. typedef struct DefVideoRec              DefVideoRec;
  161. typedef DefVideoRec *                   DefVideoPtr;
  162. struct DefOSRec {
  163.     SignedByte                      sdReserved;
  164.     SignedByte                      sdOSType;
  165. };
  166. typedef struct DefOSRec                 DefOSRec;
  167. typedef DefOSRec *                      DefOSPtr;
  168. #if CALL_NOT_IN_CARBON
  169.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  170.                                                                                             #pragma parameter GetDefaultStartup(__A0)
  171.                                                                                             #endif
  172. EXTERN_API( void )
  173. GetDefaultStartup               (DefStartPtr            paramBlock)                         ONEWORDINLINE(0xA07D);
  174.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  175.                                                                                             #pragma parameter SetDefaultStartup(__A0)
  176.                                                                                             #endif
  177. EXTERN_API( void )
  178. SetDefaultStartup               (DefStartPtr            paramBlock)                         ONEWORDINLINE(0xA07E);
  179.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  180.                                                                                             #pragma parameter GetVideoDefault(__A0)
  181.                                                                                             #endif
  182. EXTERN_API( void )
  183. GetVideoDefault                 (DefVideoPtr            paramBlock)                         ONEWORDINLINE(0xA080);
  184.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  185.                                                                                             #pragma parameter SetVideoDefault(__A0)
  186.                                                                                             #endif
  187. EXTERN_API( void )
  188. SetVideoDefault                 (DefVideoPtr            paramBlock)                         ONEWORDINLINE(0xA081);
  189.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  190.                                                                                             #pragma parameter GetOSDefault(__A0)
  191.                                                                                             #endif
  192. EXTERN_API( void )
  193. GetOSDefault                    (DefOSPtr               paramBlock)                         ONEWORDINLINE(0xA084);
  194.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  195.                                                                                             #pragma parameter SetOSDefault(__A0)
  196.                                                                                             #endif
  197. EXTERN_API( void )
  198. SetOSDefault                    (DefOSPtr               paramBlock)                         ONEWORDINLINE(0xA083);
  199. #endif  /* CALL_NOT_IN_CARBON */
  200. #if CALL_NOT_IN_CARBON
  201. EXTERN_API( void )
  202. SetTimeout                      (short                  count);
  203. EXTERN_API( void )
  204. GetTimeout                      (short *                count);
  205. #endif  /* CALL_NOT_IN_CARBON */
  206. /*
  207.     InstallExtensionNotificationProc
  208.     Installs an ExtensionNotificationUPP.
  209.     Parameters:
  210.         extNotificationProc The ExtensionNotificationUPP to install.
  211.     Results:
  212.         noErr       0       The ExtensionNotificationUPP was installed.
  213.         paramErr    -50     This ExtensionNotificationUPP has already been installed.
  214.         memFullErr  -108    Not enough memory to install the ExtensionNotificationUPP.
  215. */
  216. #if CALL_NOT_IN_CARBON
  217. EXTERN_API( OSErr )
  218. InstallExtensionNotificationProc (ExtensionNotificationUPP  extNotificationProc)            TWOWORDINLINE(0x7000, 0xAA7D);
  219. /*
  220.     RemoveExtensionNotificationProc
  221.     Removes an ExtensionNotificationUPP.
  222.     
  223.     Note:   ExtensionNotificationUPPs can't call RemoveExtensionNotificationProc.
  224.     Parameters:
  225.         extNotificationProc The ExtensionNotificationUPP to remove.
  226.     Results:
  227.         noErr       0       The ExtensionNotificationUPP was removed.
  228.         paramErr    -50     The ExtensionNotificationUPP was not found, or
  229.                             RemoveExtensionNotificationProc was called from within
  230.                             a ExtensionNotificationUPP (ExtensionNotificationUPPs can't
  231.                             call RemoveExtensionNotificationProc).
  232. */
  233. EXTERN_API( OSErr )
  234. RemoveExtensionNotificationProc (ExtensionNotificationUPP  extNotificationProc)             TWOWORDINLINE(0x7001, 0xAA7D);
  235. /*
  236.     InstallExtensionTableHandlerProc
  237.     Installs an ExtensionTableHandlerUPP. Control is taken away from the system's default
  238.     handler and the ExtensionTableHandlerUPP is responsible for all changes to the
  239.     ExtensionTable (except for incrementing extElementIndex between extensions). This is
  240.     always the first handler called with extNotificationBeforeFirst and
  241.     extNotificationBeforeCurrent messages and the last handler called with
  242.     extNotificationAfterLast and extNotificationAfterCurrent messages. extElementIndex
  243.     is always incremented immediately after the ExtensionTableHandlerUPP is called with
  244.     the extNotificationAfterCurrent message.
  245.     
  246.     There can only be one ExtensionTableHandler installed.
  247.     
  248.     Warning:    The only safe time to change what ExtensionElement is at
  249.                 ExtensionTable.extElements[extElementIndex] is when your
  250.                 ExtensionTableHandlerUPP is called with the extNotificationAfterCurrent
  251.                 message. You may change the ExtensionTable or the extElementIndex at other
  252.                 times, but you must ensure that the ExtensionElement at
  253.                 ExtensionTable.extElements[extElementIndex] stays the same.
  254.                 
  255.     Note:       If the ExtensionTable or the contents of the folders included in the
  256.                 ExtensionTable are changed after installing an ExtensionTableHandler,
  257.                 RemoveExtensionTableHandlerProc cannot be called.
  258.     Parameters:
  259.         extMgrProc          The ExtensionTableHandlerUPP to install.
  260.         extTable            A pointer to an ExtensionTableHandle where
  261.                             InstallExtensionTableHandlerProc will return the current
  262.                             ExtensionTableHandle. You don't own the handle itself and
  263.                             must not dispose of it, but you can change the extElementIndex.
  264.                             the extElementCount, and the ExtensionElements in the table.
  265.     Results:
  266.         noErr       0       The ExtensionTableHandlerUPP was installed.
  267.         paramErr    -50     Another ExtensionTableHandlerUPP has already been installed.
  268.         memFullErr  -108    Not enough memory to install the ExtensionTableHandlerUPP.
  269. */
  270. EXTERN_API( OSErr )
  271. InstallExtensionTableHandlerProc (ExtensionTableHandlerUPP  extMgrProc,
  272.                                  ExtensionTableHandle * extTable)                           TWOWORDINLINE(0x7002, 0xAA7D);
  273. /*
  274.     RemoveExtensionTableHandlerProc
  275.     Remove an ExtensionTableUPP. Control is passed back to the default handler.
  276.     Parameters:
  277.         extMgrProc          The ExtensionTableUPP to remove.
  278.     Results:
  279.         noErr       0       The ExtensionTableUPP was removed.
  280.         paramErr    -50     This ExtensionTableUPP was not installed,
  281.                             or the ExtensionTable no longer matches the
  282.                             original boot ExtensionTable.
  283. */
  284. EXTERN_API( OSErr )
  285. RemoveExtensionTableHandlerProc (ExtensionTableHandlerUPP  extMgrProc)                      TWOWORDINLINE(0x7003, 0xAA7D);
  286. #endif  /* CALL_NOT_IN_CARBON */
  287. #if PRAGMA_STRUCT_ALIGN
  288.     #pragma options align=reset
  289. #elif PRAGMA_STRUCT_PACKPUSH
  290.     #pragma pack(pop)
  291. #elif PRAGMA_STRUCT_PACK
  292.     #pragma pack()
  293. #endif
  294. #ifdef PRAGMA_IMPORT_OFF
  295. #pragma import off
  296. #elif PRAGMA_IMPORT
  297. #pragma import reset
  298. #endif
  299. #ifdef __cplusplus
  300. }
  301. #endif
  302. #endif /* __START__ */