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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       Processes.h
  3.  
  4.      Contains:   Process Manager Interfaces.
  5.  
  6.      Version:    Technology: Mac OS 8
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1989-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 __PROCESSES__
  18. #define __PROCESSES__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __EVENTS__
  23. #include "Events.h"
  24. #endif
  25. #ifndef __FILES__
  26. #include "Files.h"
  27. #endif
  28. #if PRAGMA_ONCE
  29. #pragma once
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37. #if PRAGMA_STRUCT_ALIGN
  38.     #pragma options align=mac68k
  39. #elif PRAGMA_STRUCT_PACKPUSH
  40.     #pragma pack(push, 2)
  41. #elif PRAGMA_STRUCT_PACK
  42.     #pragma pack(2)
  43. #endif
  44. /* type for unique process identifier */
  45. struct ProcessSerialNumber {
  46.     unsigned long                   highLongOfPSN;
  47.     unsigned long                   lowLongOfPSN;
  48. };
  49. typedef struct ProcessSerialNumber      ProcessSerialNumber;
  50. typedef ProcessSerialNumber *           ProcessSerialNumberPtr;
  51. enum {
  52.                                                                 /* Process identifier - Various reserved process serial numbers */
  53.     kNoProcess                  = 0,
  54.     kSystemProcess              = 1,
  55.     kCurrentProcess             = 2
  56. };
  57. /* Definition of the parameter block passed to _Launch */
  58. /* Typedef and flags for launchControlFlags field*/
  59. typedef unsigned short                  LaunchFlags;
  60. enum {
  61.     launchContinue              = 0x4000,
  62.     launchNoFileFlags           = 0x0800,
  63.     launchUseMinimum            = 0x0400,
  64.     launchDontSwitch            = 0x0200,
  65.     launchAllow24Bit            = 0x0100,
  66.     launchInhibitDaemon         = 0x0080
  67. };
  68. /* Format for first AppleEvent to pass to new process.  The size of the overall
  69.   buffer variable: the message body immediately follows the messageLength */
  70. struct AppParameters {
  71.     EventRecord                     theMsgEvent;
  72.     unsigned long                   eventRefCon;
  73.     unsigned long                   messageLength;
  74. };
  75. typedef struct AppParameters            AppParameters;
  76. typedef AppParameters *                 AppParametersPtr;
  77. /* Parameter block to _Launch */
  78. struct LaunchParamBlockRec {
  79.     unsigned long                   reserved1;
  80.     unsigned short                  reserved2;
  81.     unsigned short                  launchBlockID;
  82.     unsigned long                   launchEPBLength;
  83.     unsigned short                  launchFileFlags;
  84.     LaunchFlags                     launchControlFlags;
  85.     FSSpecPtr                       launchAppSpec;
  86.     ProcessSerialNumber             launchProcessSN;
  87.     unsigned long                   launchPreferredSize;
  88.     unsigned long                   launchMinimumSize;
  89.     unsigned long                   launchAvailableSize;
  90.     AppParametersPtr                launchAppParameters;
  91. };
  92. typedef struct LaunchParamBlockRec      LaunchParamBlockRec;
  93. typedef LaunchParamBlockRec *           LaunchPBPtr;
  94. /* Set launchBlockID to extendedBlock to specify that extensions exist.
  95.  Set launchEPBLength to extendedBlockLen for compatibility.*/
  96. enum {
  97.     extendedBlock               = 0x4C43,                       /* 'LC' */
  98.     extendedBlockLen            = sizeof(LaunchParamBlockRec) - 12
  99. };
  100. enum {
  101.                                                                 /* Definition of the information block returned by GetProcessInformation */
  102.     modeReserved                = 0x01000000,
  103.     modeControlPanel            = 0x00080000,
  104.     modeLaunchDontSwitch        = 0x00040000,
  105.     modeDeskAccessory           = 0x00020000,
  106.     modeMultiLaunch             = 0x00010000,
  107.     modeNeedSuspendResume       = 0x00004000,
  108.     modeCanBackground           = 0x00001000,
  109.     modeDoesActivateOnFGSwitch  = 0x00000800,
  110.     modeOnlyBackground          = 0x00000400,
  111.     modeGetFrontClicks          = 0x00000200,
  112.     modeGetAppDiedMsg           = 0x00000100,
  113.     mode32BitCompatible         = 0x00000080,
  114.     modeHighLevelEventAware     = 0x00000040,
  115.     modeLocalAndRemoteHLEvents  = 0x00000020,
  116.     modeStationeryAware         = 0x00000010,
  117.     modeUseTextEditServices     = 0x00000008,
  118.     modeDisplayManagerAware     = 0x00000004
  119. };
  120. /* Record returned by GetProcessInformation */
  121. struct ProcessInfoRec {
  122.     unsigned long                   processInfoLength;
  123.     StringPtr                       processName;
  124.     ProcessSerialNumber             processNumber;
  125.     unsigned long                   processType;
  126.     OSType                          processSignature;
  127.     unsigned long                   processMode;
  128.     Ptr                             processLocation;
  129.     unsigned long                   processSize;
  130.     unsigned long                   processFreeMem;
  131.     ProcessSerialNumber             processLauncher;
  132.     unsigned long                   processLaunchDate;
  133.     unsigned long                   processActiveTime;
  134.     FSSpecPtr                       processAppSpec;
  135. };
  136. typedef struct ProcessInfoRec           ProcessInfoRec;
  137. typedef ProcessInfoRec *                ProcessInfoRecPtr;
  138. /* Record corresponding to the SIZE resource definition */
  139. struct SizeResourceRec {
  140.     unsigned short                  flags;
  141.     unsigned long                   preferredHeapSize;
  142.     unsigned long                   minimumHeapSize;
  143. };
  144. typedef struct SizeResourceRec          SizeResourceRec;
  145. typedef SizeResourceRec *               SizeResourceRecPtr;
  146. typedef SizeResourceRecPtr *            SizeResourceRecHandle;
  147.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  148.                                                                                             #pragma parameter __D0 LaunchApplication(__A0)
  149.                                                                                             #endif
  150. EXTERN_API( OSErr )
  151. LaunchApplication               (LaunchPBPtr            LaunchParams)                       ONEWORDINLINE(0xA9F2);
  152. #if CALL_NOT_IN_CARBON
  153. EXTERN_API( OSErr )
  154. LaunchDeskAccessory             (const FSSpec *         pFileSpec,
  155.                                  ConstStr255Param       pDAName)                            THREEWORDINLINE(0x3F3C, 0x0036, 0xA88F);
  156. #endif  /* CALL_NOT_IN_CARBON */
  157. #if TARGET_OS_MAC
  158.     #define MacGetCurrentProcess GetCurrentProcess
  159. #endif
  160. EXTERN_API( OSErr )
  161. MacGetCurrentProcess            (ProcessSerialNumber *  PSN)                                THREEWORDINLINE(0x3F3C, 0x0037, 0xA88F);
  162. EXTERN_API( OSErr )
  163. GetFrontProcess                 (ProcessSerialNumber *  PSN)                                FIVEWORDINLINE(0x70FF, 0x2F00, 0x3F3C, 0x0039, 0xA88F);
  164. EXTERN_API( OSErr )
  165. GetNextProcess                  (ProcessSerialNumber *  PSN)                                THREEWORDINLINE(0x3F3C, 0x0038, 0xA88F);
  166. EXTERN_API( OSErr )
  167. GetProcessInformation           (const ProcessSerialNumber * PSN,
  168.                                  ProcessInfoRec *       info)                               THREEWORDINLINE(0x3F3C, 0x003A, 0xA88F);
  169. EXTERN_API( OSErr )
  170. SetFrontProcess                 (const ProcessSerialNumber * PSN)                           THREEWORDINLINE(0x3F3C, 0x003B, 0xA88F);
  171. EXTERN_API( OSErr )
  172. WakeUpProcess                   (const ProcessSerialNumber * PSN)                           THREEWORDINLINE(0x3F3C, 0x003C, 0xA88F);
  173. EXTERN_API( OSErr )
  174. SameProcess                     (const ProcessSerialNumber * PSN1,
  175.                                  const ProcessSerialNumber * PSN2,
  176.                                  Boolean *              result)                             THREEWORDINLINE(0x3F3C, 0x003D, 0xA88F);
  177. /*  ExitToShell was previously in SegLoad.h*/
  178. EXTERN_API( void )
  179. ExitToShell                     (void)                                                      ONEWORDINLINE(0xA9F4);
  180. /*
  181.    LaunchControlPanel is similar to LaunchDeskAccessory, but for Control Panel files instead.
  182.    It launches a control panel in an application shell maintained by the Process Manager.
  183. */
  184. #if CALL_NOT_IN_CARBON
  185. EXTERN_API( OSErr )
  186. LaunchControlPanel              (const FSSpec *         pFileSpec)                          THREEWORDINLINE(0x3F3C, 0x007B, 0xA88F);
  187. #endif  /* CALL_NOT_IN_CARBON */
  188. /* Values of the 'message' parameter to a Control Panel 'cdev' */
  189. enum {
  190.     initDev                     = 0,                            /*Time for cdev to initialize itself*/
  191.     hitDev                      = 1,                            /*Hit on one of my items*/
  192.     closeDev                    = 2,                            /*Close yourself*/
  193.     nulDev                      = 3,                            /*Null event*/
  194.     updateDev                   = 4,                            /*Update event*/
  195.     activDev                    = 5,                            /*Activate event*/
  196.     deactivDev                  = 6,                            /*Deactivate event*/
  197.     keyEvtDev                   = 7,                            /*Key down/auto key*/
  198.     macDev                      = 8,                            /*Decide whether or not to show up*/
  199.     undoDev                     = 9,
  200.     cutDev                      = 10,
  201.     copyDev                     = 11,
  202.     pasteDev                    = 12,
  203.     clearDev                    = 13,
  204.     cursorDev                   = 14
  205. };
  206. /* Special values a Control Panel 'cdev' can return */
  207. enum {
  208.     cdevGenErr                  = -1,                           /*General error; gray cdev w/o alert*/
  209.     cdevMemErr                  = 0,                            /*Memory shortfall; alert user please*/
  210.     cdevResErr                  = 1,                            /*Couldn't get a needed resource; alert*/
  211.     cdevUnset                   = 3                             /* cdevValue is initialized to this*/
  212. };
  213. /* Control Panel Default Proc */
  214. typedef CALLBACK_API( long , ControlPanelDefProcPtr )(short message, short item, short numItems, short cPanelID, EventRecord *theEvent, long cdevValue, DialogPtr cpDialog);
  215. typedef STACK_UPP_TYPE(ControlPanelDefProcPtr)                  ControlPanelDefUPP;
  216. #if OPAQUE_UPP_TYPES
  217. #if CALL_NOT_IN_CARBON
  218.     EXTERN_API(ControlPanelDefUPP)
  219.     NewControlPanelDefUPP          (ControlPanelDefProcPtr  userRoutine);
  220.     EXTERN_API(void)
  221.     DisposeControlPanelDefUPP      (ControlPanelDefUPP      userUPP);
  222.     EXTERN_API(long)
  223.     InvokeControlPanelDefUPP       (short                   message,
  224.                                     short                   item,
  225.                                     short                   numItems,
  226.                                     short                   cPanelID,
  227.                                     EventRecord *           theEvent,
  228.                                     long                    cdevValue,
  229.                                     DialogPtr               cpDialog,
  230.                                     ControlPanelDefUPP      userUPP);
  231. #endif  /* CALL_NOT_IN_CARBON */
  232. #else
  233.     enum { uppControlPanelDefProcInfo = 0x000FEAB0 };               /* pascal 4_bytes Func(2_bytes, 2_bytes, 2_bytes, 2_bytes, 4_bytes, 4_bytes, 4_bytes) */
  234.     #define NewControlPanelDefUPP(userRoutine)                      (ControlPanelDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlPanelDefProcInfo, GetCurrentArchitecture())
  235.     #define DisposeControlPanelDefUPP(userUPP)                      DisposeRoutineDescriptor(userUPP)
  236.     #define InvokeControlPanelDefUPP(message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog, userUPP)  (long)CALL_SEVEN_PARAMETER_UPP((userUPP), uppControlPanelDefProcInfo, (message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
  237. #endif
  238. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  239. #define NewControlPanelDefProc(userRoutine)                     NewControlPanelDefUPP(userRoutine)
  240. #define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog) InvokeControlPanelDefUPP(message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog, userRoutine)
  241. #if PRAGMA_STRUCT_ALIGN
  242.     #pragma options align=reset
  243. #elif PRAGMA_STRUCT_PACKPUSH
  244.     #pragma pack(pop)
  245. #elif PRAGMA_STRUCT_PACK
  246.     #pragma pack()
  247. #endif
  248. #ifdef PRAGMA_IMPORT_OFF
  249. #pragma import off
  250. #elif PRAGMA_IMPORT
  251. #pragma import reset
  252. #endif
  253. #ifdef __cplusplus
  254. }
  255. #endif
  256. #endif /* __PROCESSES__ */