1 | // CPS.h
|
---|
2 |
|
---|
3 | #pragma once
|
---|
4 |
|
---|
5 | #include <ApplicationServices/ApplicationServices.h>
|
---|
6 |
|
---|
7 |
|
---|
8 | #ifdef __cplusplus
|
---|
9 | extern "C" {
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | #if PRAGMA_STRUCT_ALIGN
|
---|
13 | #pragma options align=mac68k
|
---|
14 | #elif PRAGMA_STRUCT_PACKPUSH
|
---|
15 | #pragma pack(push, 2)
|
---|
16 | #elif PRAGMA_STRUCT_PACK
|
---|
17 | #pragma pack(2)
|
---|
18 | #endif
|
---|
19 |
|
---|
20 |
|
---|
21 | struct CPSProcessSerNum
|
---|
22 | {
|
---|
23 | UInt32 lo;
|
---|
24 | UInt32 hi;
|
---|
25 | };
|
---|
26 |
|
---|
27 | typedef struct CPSProcessSerNum CPSProcessSerNum;
|
---|
28 |
|
---|
29 | enum
|
---|
30 | {
|
---|
31 | kCPSNoProcess = 0,
|
---|
32 | kCPSSystemProcess = 1,
|
---|
33 | kCPSCurrentProcess = 2
|
---|
34 | };
|
---|
35 |
|
---|
36 |
|
---|
37 | enum
|
---|
38 | {
|
---|
39 | bfCPSIntraProcessSwitch = 1,
|
---|
40 | bfCPSDeathBySignal = 2
|
---|
41 | };
|
---|
42 |
|
---|
43 | typedef UInt16 CPSEventFlags;
|
---|
44 |
|
---|
45 |
|
---|
46 | enum
|
---|
47 | {
|
---|
48 | kCPSBlueApp = 0,
|
---|
49 | kCPSBlueBox = 1,
|
---|
50 | kCPSCarbonApp = 2,
|
---|
51 | kCPSYellowApp = 3,
|
---|
52 | kCPSUnknownApp = 4
|
---|
53 | };
|
---|
54 |
|
---|
55 | typedef UInt32 CPSAppFlavour;
|
---|
56 |
|
---|
57 |
|
---|
58 | enum
|
---|
59 | {
|
---|
60 | kCPSBGOnlyAttr = 1024,
|
---|
61 | kCPSUIElementAttr = 65536,
|
---|
62 | kCPSHiddenAttr = 131072,
|
---|
63 | kCPSNoConnectAttr = 262144,
|
---|
64 | kCPSFullScreenAttr = 524288,
|
---|
65 | kCPSClassicReqAttr = 1048576,
|
---|
66 | kCPSNativeReqAttr = 2097152
|
---|
67 | };
|
---|
68 |
|
---|
69 | typedef UInt32 CPSProcAttributes;
|
---|
70 |
|
---|
71 |
|
---|
72 | struct CPSProcessInfoRec
|
---|
73 | {
|
---|
74 | CPSProcessSerNum Parent;
|
---|
75 | UInt64 LaunchDate;
|
---|
76 | CPSAppFlavour Flavour;
|
---|
77 | CPSProcAttributes Attributes;
|
---|
78 | UInt32 ExecFileType;
|
---|
79 | UInt32 ExecFileCreator;
|
---|
80 | SInt32 UnixPID; // njr changed from UInt32
|
---|
81 | };
|
---|
82 |
|
---|
83 | typedef struct CPSProcessInfoRec CPSProcessInfoRec;
|
---|
84 |
|
---|
85 |
|
---|
86 | enum
|
---|
87 | {
|
---|
88 | kCPSNotifyChildDeath = 1,
|
---|
89 | kCPSNotifyNewFront = 2,
|
---|
90 | kCPSNotifyAppBirth = 4,
|
---|
91 | kCPSNotifyAppDeath = 8,
|
---|
92 | kCPSNotifyLaunch = 9,
|
---|
93 | kCPSNotifyServiceReq = 16,
|
---|
94 | kCPSNotifyAppHidden = 32,
|
---|
95 | kCPSNotifyAppRevealed = 64,
|
---|
96 | kCPSNotifyFGEnabled = 128,
|
---|
97 | kCPSNotifyLaunchStart = 256,
|
---|
98 | kCPSNotifyAppReady = 512,
|
---|
99 | kCPSNotifyLaunchFail = 1024,
|
---|
100 | kCPSNotifyAppDeathExt = 2048,
|
---|
101 | kCPSNotifyLostKeyFocus = 4096
|
---|
102 | };
|
---|
103 |
|
---|
104 | typedef UInt32 CPSNotificationCodes;
|
---|
105 |
|
---|
106 |
|
---|
107 | enum
|
---|
108 | {
|
---|
109 | bfCPSLaunchInhibitDaemon = 128,
|
---|
110 | bfCPSLaunchDontSwitch = 512,
|
---|
111 | bfCPSLaunchNoProcAttr = 2048,
|
---|
112 | bfCPSLaunchAsync = 65536,
|
---|
113 | bfCPSLaunchStartClassic = 131072,
|
---|
114 | bfCPSLaunchInClassic = 262144,
|
---|
115 | bfCPSLaunchInstance = 524288,
|
---|
116 | bfCPSLaunchAndHide = 1048576,
|
---|
117 | bfCPSLaunchAndHideOthers = 2097152
|
---|
118 | };
|
---|
119 |
|
---|
120 | typedef UInt32 CPSLaunchOptions;
|
---|
121 |
|
---|
122 |
|
---|
123 | typedef UInt8 *CPSLaunchRefcon;
|
---|
124 |
|
---|
125 |
|
---|
126 | typedef UInt8 *CPSLaunchData;
|
---|
127 |
|
---|
128 |
|
---|
129 | enum
|
---|
130 | {
|
---|
131 | bfCPSExtLaunchWithData = 2,
|
---|
132 | bfCPSExtLaunchByParent = 4,
|
---|
133 | bfCPSExtLaunchAsUidGid = 8
|
---|
134 | };
|
---|
135 |
|
---|
136 | typedef UInt32 CPSLaunchPBFields;
|
---|
137 |
|
---|
138 |
|
---|
139 | struct CPSLaunchPB
|
---|
140 | {
|
---|
141 | CPSLaunchPBFields Contents;
|
---|
142 | CPSLaunchData pData;
|
---|
143 | UInt32 DataLen;
|
---|
144 | UInt32 DataTag;
|
---|
145 | UInt32 RefCon;
|
---|
146 | CPSProcessSerNum Parent;
|
---|
147 | UInt32 ChildUID;
|
---|
148 | UInt32 ChildGID;
|
---|
149 | };
|
---|
150 |
|
---|
151 | typedef struct CPSLaunchPB CPSLaunchPB;
|
---|
152 |
|
---|
153 |
|
---|
154 | enum
|
---|
155 | {
|
---|
156 | bfCPSKillHard = 1,
|
---|
157 | bfCPSKillAllClassicApps = 2
|
---|
158 | };
|
---|
159 |
|
---|
160 | typedef UInt32 CPSKillOptions;
|
---|
161 |
|
---|
162 |
|
---|
163 | enum
|
---|
164 | {
|
---|
165 | kCPSLaunchService = 0,
|
---|
166 | kCPSKillService = 1,
|
---|
167 | kCPSHideService = 2,
|
---|
168 | kCPSShowService = 3,
|
---|
169 | kCPSPrivService = 4,
|
---|
170 | kCPSExtDeathNoteService = 5
|
---|
171 | };
|
---|
172 |
|
---|
173 | typedef UInt32 CPSServiceReqType;
|
---|
174 |
|
---|
175 |
|
---|
176 | struct CPSLaunchRequest
|
---|
177 | {
|
---|
178 | CPSProcessSerNum TargetPSN;
|
---|
179 | CPSLaunchOptions Options;
|
---|
180 | CPSProcAttributes ProcAttributes;
|
---|
181 | UInt8 *pUTF8TargetPath;
|
---|
182 | UInt32 PathLen;
|
---|
183 | };
|
---|
184 |
|
---|
185 | typedef struct CPSLaunchRequest CPSLaunchRequest;
|
---|
186 |
|
---|
187 |
|
---|
188 | struct CPSKillRequest
|
---|
189 | {
|
---|
190 | CPSProcessSerNum TargetPSN;
|
---|
191 | CPSKillOptions Options;
|
---|
192 | };
|
---|
193 |
|
---|
194 | typedef struct CPSKillRequest CPSKillRequest;
|
---|
195 |
|
---|
196 |
|
---|
197 | struct CPSHideRequest
|
---|
198 | {
|
---|
199 | CPSProcessSerNum TargetPSN;
|
---|
200 | };
|
---|
201 |
|
---|
202 | typedef struct CPSHideRequest CPSHideRequest;
|
---|
203 |
|
---|
204 |
|
---|
205 | struct CPSShowRequest
|
---|
206 | {
|
---|
207 | CPSProcessSerNum TargetPSN;
|
---|
208 | };
|
---|
209 |
|
---|
210 | typedef struct CPSShowRequest CPSShowRequest;
|
---|
211 |
|
---|
212 |
|
---|
213 | struct CPSExtDeathNotice
|
---|
214 | {
|
---|
215 | CPSProcessSerNum DeadPSN;
|
---|
216 | UInt32 Flags;
|
---|
217 | UInt8 *pUTF8AppPath;
|
---|
218 | UInt32 PathLen;
|
---|
219 | };
|
---|
220 |
|
---|
221 | typedef struct CPSExtDeathNotice CPSExtDeathNotice;
|
---|
222 |
|
---|
223 |
|
---|
224 | union CPSRequestDetails
|
---|
225 | {
|
---|
226 | CPSLaunchRequest LaunchReq;
|
---|
227 | CPSKillRequest KillReq;
|
---|
228 | CPSHideRequest HideReq;
|
---|
229 | CPSShowRequest ShowReq;
|
---|
230 | CPSExtDeathNotice DeathNotice;
|
---|
231 | };
|
---|
232 |
|
---|
233 | typedef union CPSRequestDetails CPSRequestDetails;
|
---|
234 |
|
---|
235 |
|
---|
236 | struct CPSServiceRequest
|
---|
237 | {
|
---|
238 | CPSServiceReqType Type;
|
---|
239 | SInt32 ID;
|
---|
240 | CPSRequestDetails Details;
|
---|
241 | };
|
---|
242 |
|
---|
243 | typedef struct CPSServiceRequest CPSServiceRequest;
|
---|
244 |
|
---|
245 |
|
---|
246 | enum
|
---|
247 | {
|
---|
248 | kCPSProcessInterruptKey = 0,
|
---|
249 | kCPSAppSwitchFwdKey = 1,
|
---|
250 | kCPSAppSwitchBackKey = 2,
|
---|
251 | kCPSSessionInterruptKey = 3,
|
---|
252 | kCPSScreenSaverKey = 4,
|
---|
253 | kCPSDiskEjectKey = 5,
|
---|
254 | kCPSSpecialKeyCount = 6
|
---|
255 | };
|
---|
256 |
|
---|
257 | typedef SInt32 CPSSpecialKeyID;
|
---|
258 |
|
---|
259 |
|
---|
260 | extern Boolean CPSEqualProcess( CPSProcessSerNum *psn1, CPSProcessSerNum *psn2);
|
---|
261 |
|
---|
262 | extern OSErr CPSGetCurrentProcess( CPSProcessSerNum *psn);
|
---|
263 |
|
---|
264 | extern OSErr CPSGetFrontProcess( CPSProcessSerNum *psn);
|
---|
265 |
|
---|
266 | extern OSErr CPSGetNextProcess( CPSProcessSerNum *psn);
|
---|
267 |
|
---|
268 | extern OSErr CPSGetNextToFrontProcess( CPSProcessSerNum *psn);
|
---|
269 |
|
---|
270 | extern OSErr CPSGetProcessInfo( CPSProcessSerNum *psn, CPSProcessInfoRec *info, char *path, int maxPathLen, int *len, char *name, int maxNameLen);
|
---|
271 |
|
---|
272 | extern OSErr CPSPostHideMostReq( CPSProcessSerNum *psn);
|
---|
273 |
|
---|
274 | extern OSErr CPSPostHideReq( CPSProcessSerNum *psn);
|
---|
275 |
|
---|
276 | extern OSErr CPSPostKillRequest( CPSProcessSerNum *psn, CPSKillOptions options);
|
---|
277 |
|
---|
278 | extern OSErr CPSPostShowAllReq( CPSProcessSerNum *psn);
|
---|
279 |
|
---|
280 | extern OSErr CPSPostShowReq( CPSProcessSerNum *psn);
|
---|
281 |
|
---|
282 | extern OSErr CPSSetFrontProcess( CPSProcessSerNum *psn);
|
---|
283 |
|
---|
284 | extern OSErr CPSReleaseKeyFocus( CPSProcessSerNum *psn);
|
---|
285 |
|
---|
286 | extern OSErr CPSStealKeyFocus( CPSProcessSerNum *psn);
|
---|
287 |
|
---|
288 |
|
---|
289 | #if PRAGMA_STRUCT_ALIGN
|
---|
290 | #pragma options align=reset
|
---|
291 | #elif PRAGMA_STRUCT_PACKPUSH
|
---|
292 | #pragma pack(pop)
|
---|
293 | #elif PRAGMA_STRUCT_PACK
|
---|
294 | #pragma pack()
|
---|
295 | #endif
|
---|
296 |
|
---|
297 | #ifdef __cplusplus
|
---|
298 | }
|
---|
299 | #endif
|
---|