Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

790 lines
26 KiB

  1. /*
  2. File: Processes.h
  3. Contains: Process Manager Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1989-2001 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __PROCESSES__
  11. #define __PROCESSES__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __FILES__
  16. #include <Files.h>
  17. #endif
  18. #ifndef __TEXTCOMMON__
  19. #include <TextCommon.h>
  20. #endif
  21. #ifndef __CFSTRING__
  22. #include <CFString.h>
  23. #endif
  24. #if PRAGMA_ONCE
  25. #pragma once
  26. #endif
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #if PRAGMA_IMPORT
  31. #pragma import on
  32. #endif
  33. #if PRAGMA_STRUCT_ALIGN
  34. #pragma options align=mac68k
  35. #elif PRAGMA_STRUCT_PACKPUSH
  36. #pragma pack(push, 2)
  37. #elif PRAGMA_STRUCT_PACK
  38. #pragma pack(2)
  39. #endif
  40. /* type for unique process identifier */
  41. struct ProcessSerialNumber {
  42. unsigned long highLongOfPSN;
  43. unsigned long lowLongOfPSN;
  44. };
  45. typedef struct ProcessSerialNumber ProcessSerialNumber;
  46. typedef ProcessSerialNumber * ProcessSerialNumberPtr;
  47. enum {
  48. /* Process identifier - Various reserved process serial numbers */
  49. kNoProcess = 0,
  50. kSystemProcess = 1,
  51. kCurrentProcess = 2
  52. };
  53. /* Definition of the parameter block passed to _Launch */
  54. /* Typedef and flags for launchControlFlags field*/
  55. typedef unsigned short LaunchFlags;
  56. enum {
  57. launchContinue = 0x4000,
  58. launchNoFileFlags = 0x0800,
  59. launchUseMinimum = 0x0400,
  60. launchDontSwitch = 0x0200,
  61. launchAllow24Bit = 0x0100,
  62. launchInhibitDaemon = 0x0080
  63. };
  64. /* Format for first AppleEvent to pass to new process. The size of the overall
  65. buffer variable: the message body immediately follows the messageLength */
  66. struct AppParameters {
  67. struct {
  68. UInt16 what;
  69. UInt32 message;
  70. UInt32 when;
  71. Point where;
  72. UInt16 modifiers;
  73. } theMsgEvent;
  74. unsigned long eventRefCon;
  75. unsigned long messageLength;
  76. };
  77. typedef struct AppParameters AppParameters;
  78. typedef AppParameters * AppParametersPtr;
  79. /* Parameter block to _Launch */
  80. struct LaunchParamBlockRec {
  81. unsigned long reserved1;
  82. unsigned short reserved2;
  83. unsigned short launchBlockID;
  84. unsigned long launchEPBLength;
  85. unsigned short launchFileFlags;
  86. LaunchFlags launchControlFlags;
  87. FSSpecPtr launchAppSpec;
  88. ProcessSerialNumber launchProcessSN;
  89. unsigned long launchPreferredSize;
  90. unsigned long launchMinimumSize;
  91. unsigned long launchAvailableSize;
  92. AppParametersPtr launchAppParameters;
  93. };
  94. typedef struct LaunchParamBlockRec LaunchParamBlockRec;
  95. typedef LaunchParamBlockRec * LaunchPBPtr;
  96. /* Set launchBlockID to extendedBlock to specify that extensions exist.
  97. Set launchEPBLength to extendedBlockLen for compatibility.*/
  98. enum {
  99. extendedBlock = 0x4C43, /* 'LC' */
  100. extendedBlockLen = sizeof(LaunchParamBlockRec) - 12
  101. };
  102. enum {
  103. /* Definition of the information block returned by GetProcessInformation */
  104. modeReserved = 0x01000000,
  105. modeControlPanel = 0x00080000,
  106. modeLaunchDontSwitch = 0x00040000,
  107. modeDeskAccessory = 0x00020000,
  108. modeMultiLaunch = 0x00010000,
  109. modeNeedSuspendResume = 0x00004000,
  110. modeCanBackground = 0x00001000,
  111. modeDoesActivateOnFGSwitch = 0x00000800,
  112. modeOnlyBackground = 0x00000400,
  113. modeGetFrontClicks = 0x00000200,
  114. modeGetAppDiedMsg = 0x00000100,
  115. mode32BitCompatible = 0x00000080,
  116. modeHighLevelEventAware = 0x00000040,
  117. modeLocalAndRemoteHLEvents = 0x00000020,
  118. modeStationeryAware = 0x00000010,
  119. modeUseTextEditServices = 0x00000008,
  120. modeDisplayManagerAware = 0x00000004
  121. };
  122. /*
  123. Record returned by GetProcessInformation
  124. When calling GetProcessInformation(), the input ProcesInfoRec
  125. should have the processInfoLength set to sizeof(ProcessInfoRec),
  126. the processName field set to nil or a pointer to a Str255, and
  127. processAppSpec set to nil or a pointer to an FSSpec. If
  128. processName or processAppSpec are not specified, this routine
  129. will very likely write data to whatever random location in memory
  130. these happen to point to, which is not a good thing.
  131. Note: The processName field may not be what you expect, especially if
  132. an application has a localized name. The .processName field, if not NULL,
  133. on return will contain the filename part of the executable file of the
  134. application. If you want the localized, user-displayable name for an
  135. application, call CopyProcessName().
  136. */
  137. struct ProcessInfoRec {
  138. unsigned long processInfoLength;
  139. StringPtr processName;
  140. ProcessSerialNumber processNumber;
  141. unsigned long processType;
  142. OSType processSignature;
  143. unsigned long processMode;
  144. Ptr processLocation;
  145. unsigned long processSize;
  146. unsigned long processFreeMem;
  147. ProcessSerialNumber processLauncher;
  148. unsigned long processLaunchDate;
  149. unsigned long processActiveTime;
  150. FSSpecPtr processAppSpec;
  151. };
  152. typedef struct ProcessInfoRec ProcessInfoRec;
  153. typedef ProcessInfoRec * ProcessInfoRecPtr;
  154. /*
  155. Some applications assumed the size of a ProcessInfoRec would never change,
  156. which has caused problems trying to return additional information. In
  157. the future, we will add fields to ProcessInfoExtendedRec when necessary,
  158. and callers which wish to access 'more' data than originally was present
  159. in ProcessInfoRec should allocate space for a ProcessInfoExtendedRec,
  160. fill in the processInfoLength ( and processName and processAppSpec ptrs ),
  161. then coerce this to a ProcessInfoRecPtr in the call to
  162. GetProcessInformation().
  163. Note: The processName field may not be what you expect, especially if
  164. an application has a localized name. The .processName field, if not NULL,
  165. on return will contain the filename part of the executable file of the
  166. application. If you want the localized, user-displayable name for an
  167. application, call CopyProcessName().
  168. */
  169. struct ProcessInfoExtendedRec {
  170. unsigned long processInfoLength;
  171. StringPtr processName;
  172. ProcessSerialNumber processNumber;
  173. unsigned long processType;
  174. OSType processSignature;
  175. unsigned long processMode;
  176. Ptr processLocation;
  177. unsigned long processSize;
  178. unsigned long processFreeMem;
  179. ProcessSerialNumber processLauncher;
  180. unsigned long processLaunchDate;
  181. unsigned long processActiveTime;
  182. FSSpecPtr processAppSpec;
  183. unsigned long processTempMemTotal;
  184. unsigned long processPurgeableTempMemTotal;
  185. };
  186. typedef struct ProcessInfoExtendedRec ProcessInfoExtendedRec;
  187. typedef ProcessInfoExtendedRec * ProcessInfoExtendedRecPtr;
  188. /* Record corresponding to the SIZE resource definition */
  189. struct SizeResourceRec {
  190. unsigned short flags;
  191. unsigned long preferredHeapSize;
  192. unsigned long minimumHeapSize;
  193. };
  194. typedef struct SizeResourceRec SizeResourceRec;
  195. typedef SizeResourceRec * SizeResourceRecPtr;
  196. typedef SizeResourceRecPtr * SizeResourceRecHandle;
  197. /*
  198. * Summary:
  199. * Options for ProcessInformationCopyDictionary
  200. */
  201. enum {
  202. /*
  203. * Return all information known about the application in the
  204. * dictionary.
  205. */
  206. kProcessDictionaryIncludeAllInformationMask = (long)0xFFFFFFFF
  207. };
  208. /*
  209. Applications and background applications can control when they are asked to quit
  210. by the system at restart/shutdown by setting these bits in a 'quit' ( 0 ) resource
  211. in their application's resource fork. Applications without a 'quit' ( 0 ) will
  212. be quit at kQuitAtNormalTime mask.
  213. These options only function on Mac OS 9.x at this time.
  214. */
  215. enum {
  216. kQuitBeforeNormalTimeMask = 1,
  217. kQuitAtNormalTimeMask = 2,
  218. kQuitBeforeFBAsQuitMask = 4,
  219. kQuitBeforeShellQuitsMask = 8,
  220. kQuitBeforeTerminatorAppQuitsMask = 16,
  221. kQuitNeverMask = 32,
  222. kQuitOptionsMask = 0x7F,
  223. kQuitNotQuitDuringInstallMask = 0x0100,
  224. kQuitNotQuitDuringLogoutMask = 0x0200
  225. };
  226. /*
  227. * LaunchApplication()
  228. *
  229. * Availability:
  230. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  231. * CarbonLib: in CarbonLib 1.0 and later
  232. * Mac OS X: in version 10.0 and later
  233. */
  234. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  235. #pragma parameter __D0 LaunchApplication(__A0)
  236. #endif
  237. EXTERN_API( OSErr )
  238. LaunchApplication(LaunchPBPtr LaunchParams) ONEWORDINLINE(0xA9F2);
  239. #if CALL_NOT_IN_CARBON
  240. /*
  241. * LaunchDeskAccessory()
  242. *
  243. * Availability:
  244. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  245. * CarbonLib: not available
  246. * Mac OS X: not available
  247. */
  248. EXTERN_API( OSErr )
  249. LaunchDeskAccessory(
  250. const FSSpec * pFileSpec,
  251. ConstStr255Param pDAName) THREEWORDINLINE(0x3F3C, 0x0036, 0xA88F);
  252. #endif /* CALL_NOT_IN_CARBON */
  253. /*
  254. * [Mac]GetCurrentProcess()
  255. *
  256. * Discussion:
  257. * Return the canonical process serial number to the caller.
  258. *
  259. * All applications ( things which can appear in the Dock or which
  260. * are not documents and are launched by the Finder or Dock ) on Mac
  261. * OS 10 have a unique process serial number. This number is
  262. * created when the application launches, and remains until the
  263. * application quits. Other system services, like AppleEvents, use
  264. * the ProcessSerialNumber to specify an application.
  265. *
  266. * During launch, every application 'checks in' with the Process
  267. * Manager. Before this checkin, the application can not receive
  268. * events or draw to the screen. Prior to Mac OS 10.2, this 'check
  269. * in' happened before the applications's main() function was
  270. * entered. In Mac OS 10.2 and later, this 'check in' does not
  271. * happen until the first time the application calls a Process
  272. * Manager function, or until it enters CFRunLoopRun() for the main
  273. * runloop. This allows tools and other executables which do not
  274. * need to receive events to link against more of the higher level
  275. * toolbox frameworks, but may cause a problem if the application
  276. * expects to be able to retrieve events or use CoreGraphics
  277. * services before this checkin has occurred.
  278. *
  279. * An application can force the connection to the Process Manager to
  280. * be set up by calling any Process Manager routine, but the
  281. * recommended way to do this is to call GetCurrentProcess() to ask
  282. * for the current application's PSN. This will initialize the
  283. * connection to the Process Manager if it has not already been set
  284. * up and 'check in' the application with the system.
  285. *
  286. * This function is named MacGetCurrentProcess() on non Macintosh
  287. * platforms and GetCurrentProcess on the Macintosh. However, even
  288. * Macintosh code can use the MacGetCurrentProcess() name since
  289. * there is a macro which maps back to GetCurrentProcess().
  290. *
  291. * Lastly, it is usually not necessary to call GetCurrentProcess()
  292. * to get the 'current' process psn merely to pass it to another
  293. * Process Manager routine. Instead, just construct a
  294. * ProcessSerialNumber with 0 in highLongOfPSN and kCurrentProcess
  295. * in lowLongOfPSN and pass that. For example, to make the current
  296. * process the frontmost process, use ( C code follows )
  297. *
  298. * ProcessSerialNumber psn = { 0, kCurrentProcess };
  299. *
  300. * OSErr err = SetFrontProcess( & psn );
  301. *
  302. * If you need to pass a ProcessSerialNumber to another application
  303. * or use it in an AppleEvent, you do need to get the canonical PSN
  304. * with this routine.
  305. *
  306. * Parameters:
  307. *
  308. * PSN:
  309. * Pass in where the current application process serial number
  310. * should be returned.
  311. *
  312. * Result:
  313. * An operating system status code.
  314. *
  315. * Availability:
  316. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  317. * CarbonLib: in CarbonLib 1.0 and later
  318. * Mac OS X: in version 10.0 and later
  319. */
  320. #if TARGET_OS_MAC
  321. #define MacGetCurrentProcess GetCurrentProcess
  322. #endif
  323. EXTERN_API( OSErr )
  324. MacGetCurrentProcess(ProcessSerialNumber * PSN) THREEWORDINLINE(0x3F3C, 0x0037, 0xA88F);
  325. /*
  326. * GetFrontProcess()
  327. *
  328. * Availability:
  329. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  330. * CarbonLib: in CarbonLib 1.0 and later
  331. * Mac OS X: in version 10.0 and later
  332. */
  333. EXTERN_API( OSErr )
  334. GetFrontProcess(ProcessSerialNumber * PSN) FIVEWORDINLINE(0x70FF, 0x2F00, 0x3F3C, 0x0039, 0xA88F);
  335. /*
  336. * GetNextProcess()
  337. *
  338. * Availability:
  339. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  340. * CarbonLib: in CarbonLib 1.0 and later
  341. * Mac OS X: in version 10.0 and later
  342. */
  343. EXTERN_API( OSErr )
  344. GetNextProcess(ProcessSerialNumber * PSN) THREEWORDINLINE(0x3F3C, 0x0038, 0xA88F);
  345. /*
  346. * GetProcessInformation()
  347. *
  348. * Discussion:
  349. * Fill in the provided record with information about the process
  350. * with the provided process serial number.
  351. *
  352. * The caller must fill in the .processInfoLength field with the
  353. * value sizeof ( ProcessInformationRecord ) before making this
  354. * call. Also, the .processName field must point to either NULL or
  355. * to a Str31 structure in the caller's memory space, and the
  356. * .processAppSpec field must point to a FSSpec in the caller's
  357. * memory space.
  358. *
  359. * If the caller does not care about the process name or the process
  360. * application spec values, then setting those fields in the
  361. * structure to NULL before this call means less work must be done
  362. * to construct these values and so the call is more
  363. * efficient.
  364. *
  365. * The processName field may not be what you expect, especially if
  366. * an application has a localized name. The .processName field, if
  367. * not NULL, on return will contain the filename part of the
  368. * executable file of the application. If you want the localized,
  369. * user-displayable name for an application, call
  370. * CopyProcessName().
  371. *
  372. * On Mac OS X, the processSize and processFreeMem fields are
  373. * returned with the value 0.
  374. *
  375. * Parameters:
  376. *
  377. * PSN:
  378. * Pass in the process serial number of the process to return
  379. * information for.
  380. *
  381. * info:
  382. * Pass in a structure where the information will be returned.
  383. *
  384. * Availability:
  385. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  386. * CarbonLib: in CarbonLib 1.0 and later
  387. * Mac OS X: in version 10.0 and later
  388. */
  389. /*
  390. This function has the same name as a Windows function. Since both functions are
  391. extern "C" this is illegal. I'm not gonna comment out GetProcessInformation
  392. in winbase.h, so change has to happen here.
  393. EXTERN_API( OSErr )
  394. GetProcessInformation(
  395. const ProcessSerialNumber * PSN,
  396. ProcessInfoRec * info) THREEWORDINLINE(0x3F3C, 0x003A, 0xA88F);
  397. */
  398. /*
  399. * ProcessInformationCopyDictionary()
  400. *
  401. * Discussion:
  402. * Return a CFDictionary containing information about the given
  403. * process. This is intended to return a superset of the information
  404. * returned by GetProcessInformation(), in more modern datatypes.
  405. *
  406. * Parameters:
  407. *
  408. * PSN:
  409. * Pass in the process serial number of the process to return
  410. * information for.
  411. *
  412. * infoToReturn:
  413. * Pass in the value kProcessDictionaryIncludeAllInformationMask.
  414. *
  415. * Result:
  416. * An immutable CFDictionaryRef containing these keys and their
  417. * values. Keys marked with an '*' are optional. Over time more
  418. * keys may be added.
  419. *
  420. * Key Name Type
  421. * -------- ----
  422. * "PSN" CFNumber, kCFNumberLongLongType
  423. * "Flavor" CFNumber, kCFNumberSInt32
  424. * "Attributes" CFNumber, kCFNumberSInt32
  425. * "ParentPSN" * CFNumber, kCFNumberLongLong
  426. * "FileType" * CFString, file type
  427. * "FileCreator" * CFString, file creator
  428. * "pid" * CFNumber, kCFNumberLongType
  429. * "LSBackgroundOnly" CFBoolean
  430. * "LSUIElement" CFBoolean
  431. * "IsHiddenAttr" CFBoolean
  432. * "IsCheckedInAttr" CFBoolean
  433. * "RequiresClassic" CFBoolean
  434. * "RequiresCarbon" CFBoolean
  435. * "LSUserQuitOnly" CFBoolean
  436. * "LSUIPresentationMode" CFNumber, kCFNumberShortType
  437. * "BundlePath" * CFString
  438. * kIOBundleExecutableKey * CFString
  439. * kIOBundleNameKey * CFString
  440. * kIOBundleIdentifierKey * CFString
  441. *
  442. * Availability:
  443. * Non-Carbon CFM: not available
  444. * CarbonLib: not available
  445. * Mac OS X: in version 10.2 and later
  446. */
  447. EXTERN_API( CFDictionaryRef )
  448. ProcessInformationCopyDictionary(
  449. const ProcessSerialNumber * PSN,
  450. UInt32 infoToReturn);
  451. /*
  452. * SetFrontProcess()
  453. *
  454. * Availability:
  455. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  456. * CarbonLib: in CarbonLib 1.0 and later
  457. * Mac OS X: in version 10.0 and later
  458. */
  459. EXTERN_API( OSErr )
  460. SetFrontProcess(const ProcessSerialNumber * PSN) THREEWORDINLINE(0x3F3C, 0x003B, 0xA88F);
  461. /*
  462. * Summary:
  463. * Options for SetFrontProcessWithOptions
  464. */
  465. enum {
  466. /*
  467. * Activate the process, but bring only the frontmost non-floating
  468. * window forward. If this option is not set, all process windows are
  469. * brought forward.
  470. */
  471. kSetFrontProcessFrontWindowOnly = (1 << 0)
  472. };
  473. /*
  474. * SetFrontProcessWithOptions()
  475. *
  476. * Discussion:
  477. * Brings a process to the front of the process list and activates
  478. * it. This is much like the SetFrontProcess API, though we allow
  479. * more control here. Passing 0 for the options is equivalent to
  480. * calling SetFrontProcess. Alternatively, you can pass
  481. * kSetFrontProcessFrontWindowOnly, which will activate a process
  482. * without bringing all of the process's windows forward (just the
  483. * front window of the process will come forward).
  484. *
  485. * Parameters:
  486. *
  487. * inProcess:
  488. * The process to make frontmost.
  489. *
  490. * inOptions:
  491. * Any options you wish to specify.
  492. *
  493. * Result:
  494. * An operating system status code.
  495. *
  496. * Availability:
  497. * Non-Carbon CFM: not available
  498. * CarbonLib: not available in CarbonLib 1.x, is available on Mac OS X version 10.2 and later
  499. * Mac OS X: in version 10.2 and later
  500. */
  501. EXTERN_API_C( OSStatus )
  502. SetFrontProcessWithOptions(
  503. const ProcessSerialNumber * inProcess,
  504. OptionBits inOptions);
  505. /*
  506. * WakeUpProcess()
  507. *
  508. * Availability:
  509. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  510. * CarbonLib: in CarbonLib 1.0 and later
  511. * Mac OS X: in version 10.0 and later
  512. */
  513. EXTERN_API( OSErr )
  514. WakeUpProcess(const ProcessSerialNumber * PSN) THREEWORDINLINE(0x3F3C, 0x003C, 0xA88F);
  515. /*
  516. * SameProcess()
  517. *
  518. * Availability:
  519. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  520. * CarbonLib: in CarbonLib 1.0 and later
  521. * Mac OS X: in version 10.0 and later
  522. */
  523. EXTERN_API( OSErr )
  524. SameProcess(
  525. const ProcessSerialNumber * PSN1,
  526. const ProcessSerialNumber * PSN2,
  527. Boolean * result) THREEWORDINLINE(0x3F3C, 0x003D, 0xA88F);
  528. /* ExitToShell was previously in SegLoad.h*/
  529. /*
  530. * ExitToShell()
  531. *
  532. * Availability:
  533. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  534. * CarbonLib: in CarbonLib 1.0 and later
  535. * Mac OS X: in version 10.0 and later
  536. */
  537. EXTERN_API( void )
  538. ExitToShell(void) ONEWORDINLINE(0xA9F4);
  539. /*
  540. LaunchControlPanel is similar to LaunchDeskAccessory, but for Control Panel files instead.
  541. It launches a control panel in an application shell maintained by the Process Manager.
  542. */
  543. #if CALL_NOT_IN_CARBON
  544. /*
  545. * LaunchControlPanel()
  546. *
  547. * Availability:
  548. * Non-Carbon CFM: in InterfaceLib 9.0 and later
  549. * CarbonLib: not available
  550. * Mac OS X: not available
  551. */
  552. EXTERN_API( OSErr )
  553. LaunchControlPanel(const FSSpec * pFileSpec) THREEWORDINLINE(0x3F3C, 0x007B, 0xA88F);
  554. #endif /* CALL_NOT_IN_CARBON */
  555. /*
  556. * GetProcessBundleLocation()
  557. *
  558. * Summary:
  559. * Retrieve the filesystem location of the process bundle, or
  560. * executable if unbundled.
  561. *
  562. * Discussion:
  563. * Retrieves a reference to the filesystem location of the specified
  564. * application. For an application that is packaged as an app
  565. * bundle, this will be the app bundle directory; otherwise it will
  566. * be the location of the executable itself.
  567. *
  568. * Parameters:
  569. *
  570. * psn:
  571. * Serial number of the target process
  572. *
  573. * location:
  574. * Location of the bundle or executable, as an FSRef
  575. *
  576. * Availability:
  577. * Non-Carbon CFM: not available
  578. * CarbonLib: in CarbonLib 1.5 and later
  579. * Mac OS X: in version 10.0 and later
  580. */
  581. EXTERN_API_C( OSStatus )
  582. GetProcessBundleLocation(
  583. const ProcessSerialNumber * psn,
  584. FSRef * location);
  585. /*
  586. * CopyProcessName()
  587. *
  588. * Summary:
  589. * Get a copy of the name of a process.
  590. *
  591. * Discussion:
  592. * Use this call to get the name of a process as a CFString. The
  593. * name returned is a copy, so the caller must CFRelease the name
  594. * when finished with it. The difference between this call and the
  595. * processName field filled in by GetProcessInformation is that the
  596. * name here is a CFString, and thus is capable of representing a
  597. * multi-lingual name, whereas previously only a mac-encoded string
  598. * was possible.
  599. *
  600. * Parameters:
  601. *
  602. * psn:
  603. * Serial number of the target process
  604. *
  605. * name:
  606. * CFString representing the name of the process (must be released
  607. * by caller with CFRelease)
  608. *
  609. * Availability:
  610. * Non-Carbon CFM: not available
  611. * CarbonLib: in CarbonLib 1.5 and later
  612. * Mac OS X: in version 10.0 and later
  613. */
  614. EXTERN_API_C( OSStatus )
  615. CopyProcessName(
  616. const ProcessSerialNumber * psn,
  617. CFStringRef * name);
  618. /*************************************************************************
  619. * Process Visibility.
  620. *************************************************************************/
  621. /*
  622. * IsProcessVisible()
  623. *
  624. * Summary:
  625. * Determines whether a particular process is visible or not.
  626. *
  627. * Discussion:
  628. * Given a psn, this call will return true or false depending on
  629. * whether or not the process is currently visible.
  630. *
  631. * Parameters:
  632. *
  633. * psn:
  634. * Serial number of the process
  635. *
  636. * Availability:
  637. * Non-Carbon CFM: not available
  638. * CarbonLib: in CarbonLib 1.5 and later
  639. * Mac OS X: in version 10.1 and later
  640. */
  641. EXTERN_API( Boolean )
  642. IsProcessVisible(const ProcessSerialNumber * psn) THREEWORDINLINE(0x3F3C, 0x005F, 0xA88F);
  643. /*
  644. * ShowHideProcess()
  645. *
  646. * Summary:
  647. * Hides or shows a given process.
  648. *
  649. * Discussion:
  650. * Given a psn, this call will hide or show the process specified in
  651. * the psn parameter. You determine whether you would like to show
  652. * or hide the process with the visible parameter. True passed into
  653. * visible indicates you wish for the process to become visible.
  654. *
  655. * Parameters:
  656. *
  657. * psn:
  658. * Serial number of the process
  659. *
  660. * visible:
  661. * true = show process; false = hide process
  662. *
  663. * Availability:
  664. * Non-Carbon CFM: not available
  665. * CarbonLib: in CarbonLib 1.5 and later
  666. * Mac OS X: in version 10.1 and later
  667. */
  668. EXTERN_API( OSErr )
  669. ShowHideProcess(
  670. const ProcessSerialNumber * psn,
  671. Boolean visible) THREEWORDINLINE(0x3F3C, 0x0060, 0xA88F);
  672. /* Values of the 'message' parameter to a Control Panel 'cdev' */
  673. enum {
  674. initDev = 0, /*Time for cdev to initialize itself*/
  675. hitDev = 1, /*Hit on one of my items*/
  676. closeDev = 2, /*Close yourself*/
  677. nulDev = 3, /*Null event*/
  678. updateDev = 4, /*Update event*/
  679. activDev = 5, /*Activate event*/
  680. deactivDev = 6, /*Deactivate event*/
  681. keyEvtDev = 7, /*Key down/auto key*/
  682. macDev = 8, /*Decide whether or not to show up*/
  683. undoDev = 9,
  684. cutDev = 10,
  685. copyDev = 11,
  686. pasteDev = 12,
  687. clearDev = 13,
  688. cursorDev = 14
  689. };
  690. /* Special values a Control Panel 'cdev' can return */
  691. enum {
  692. cdevGenErr = -1, /*General error; gray cdev w/o alert*/
  693. cdevMemErr = 0, /*Memory shortfall; alert user please*/
  694. cdevResErr = 1, /*Couldn't get a needed resource; alert*/
  695. cdevUnset = 3 /* cdevValue is initialized to this*/
  696. };
  697. /* Control Panel Default Proc */
  698. #if PRAGMA_STRUCT_ALIGN
  699. #pragma options align=reset
  700. #elif PRAGMA_STRUCT_PACKPUSH
  701. #pragma pack(pop)
  702. #elif PRAGMA_STRUCT_PACK
  703. #pragma pack()
  704. #endif
  705. #ifdef PRAGMA_IMPORT_OFF
  706. #pragma import off
  707. #elif PRAGMA_IMPORT
  708. #pragma import reset
  709. #endif
  710. #ifdef __cplusplus
  711. }
  712. #endif
  713. #endif /* __PROCESSES__ */