1 | /* iig(DriverKit-286 Mar 29 2024 10:27:09) generated from OSAction.iig */ |
2 | |
3 | #undef IIG_IMPLEMENTATION |
4 | #define IIG_IMPLEMENTATION OSAction.iig |
5 | |
6 | #if KERNEL |
7 | #include <libkern/c++/OSString.h> |
8 | #else |
9 | #include <DriverKit/DriverKit.h> |
10 | #endif /* KERNEL */ |
11 | #include <DriverKit/IOReturn.h> |
12 | #include <DriverKit/OSAction.h> |
13 | |
14 | |
15 | #if __has_builtin(__builtin_load_member_function_pointer) |
16 | #define SimpleMemberFunctionCast(cfnty, self, func) (cfnty)__builtin_load_member_function_pointer(self, func) |
17 | #else |
18 | #define SimpleMemberFunctionCast(cfnty, self, func) ({ union { typeof(func) memfun; cfnty cfun; } pair; pair.memfun = func; pair.cfun; }) |
19 | #endif |
20 | |
21 | |
22 | struct OSAction_Create_Msg_Content |
23 | { |
24 | IORPCMessage __hdr; |
25 | OSObjectRef __object; |
26 | OSObjectRef target; |
27 | uint64_t targetmsgid; |
28 | uint64_t msgid; |
29 | size_t referenceSize; |
30 | }; |
31 | #pragma pack(4) |
32 | struct OSAction_Create_Msg |
33 | { |
34 | IORPCMessageMach mach; |
35 | mach_msg_port_descriptor_t __object__descriptor; |
36 | mach_msg_port_descriptor_t target__descriptor; |
37 | OSAction_Create_Msg_Content content; |
38 | }; |
39 | #pragma pack() |
40 | #define OSAction_Create_Msg_ObjRefs (2) |
41 | |
42 | struct OSAction_Create_Rpl_Content |
43 | { |
44 | IORPCMessage __hdr; |
45 | OSObjectRef action; |
46 | }; |
47 | #pragma pack(4) |
48 | struct OSAction_Create_Rpl |
49 | { |
50 | IORPCMessageMach mach; |
51 | mach_msg_port_descriptor_t action__descriptor; |
52 | OSAction_Create_Rpl_Content content; |
53 | }; |
54 | #pragma pack() |
55 | #define OSAction_Create_Rpl_ObjRefs (1) |
56 | |
57 | |
58 | typedef union |
59 | { |
60 | const IORPC rpc; |
61 | struct |
62 | { |
63 | const struct OSAction_Create_Msg * message; |
64 | struct OSAction_Create_Rpl * reply; |
65 | uint32_t sendSize; |
66 | uint32_t replySize; |
67 | }; |
68 | } |
69 | OSAction_Create_Invocation; |
70 | struct OSAction_CreateWithTypeName_Msg_Content |
71 | { |
72 | IORPCMessage __hdr; |
73 | OSObjectRef __object; |
74 | OSObjectRef target; |
75 | OSString * typeName; |
76 | #if !defined(__LP64__) |
77 | uint32_t __typeNamePad; |
78 | #endif /* !defined(__LP64__) */ |
79 | uint64_t targetmsgid; |
80 | uint64_t msgid; |
81 | size_t referenceSize; |
82 | }; |
83 | #pragma pack(4) |
84 | struct OSAction_CreateWithTypeName_Msg |
85 | { |
86 | IORPCMessageMach mach; |
87 | mach_msg_port_descriptor_t __object__descriptor; |
88 | mach_msg_port_descriptor_t target__descriptor; |
89 | mach_msg_ool_descriptor_t typeName__descriptor; |
90 | OSAction_CreateWithTypeName_Msg_Content content; |
91 | }; |
92 | #pragma pack() |
93 | #define OSAction_CreateWithTypeName_Msg_ObjRefs (3) |
94 | |
95 | struct OSAction_CreateWithTypeName_Rpl_Content |
96 | { |
97 | IORPCMessage __hdr; |
98 | OSObjectRef action; |
99 | }; |
100 | #pragma pack(4) |
101 | struct OSAction_CreateWithTypeName_Rpl |
102 | { |
103 | IORPCMessageMach mach; |
104 | mach_msg_port_descriptor_t action__descriptor; |
105 | OSAction_CreateWithTypeName_Rpl_Content content; |
106 | }; |
107 | #pragma pack() |
108 | #define OSAction_CreateWithTypeName_Rpl_ObjRefs (1) |
109 | |
110 | |
111 | typedef union |
112 | { |
113 | const IORPC rpc; |
114 | struct |
115 | { |
116 | const struct OSAction_CreateWithTypeName_Msg * message; |
117 | struct OSAction_CreateWithTypeName_Rpl * reply; |
118 | uint32_t sendSize; |
119 | uint32_t replySize; |
120 | }; |
121 | } |
122 | OSAction_CreateWithTypeName_Invocation; |
123 | struct OSAction_Aborted_Msg_Content |
124 | { |
125 | IORPCMessage __hdr; |
126 | OSObjectRef __object; |
127 | }; |
128 | #pragma pack(4) |
129 | struct OSAction_Aborted_Msg |
130 | { |
131 | IORPCMessageMach mach; |
132 | mach_msg_port_descriptor_t __object__descriptor; |
133 | OSAction_Aborted_Msg_Content content; |
134 | }; |
135 | #pragma pack() |
136 | #define OSAction_Aborted_Msg_ObjRefs (1) |
137 | |
138 | struct OSAction_Aborted_Rpl_Content |
139 | { |
140 | IORPCMessage __hdr; |
141 | }; |
142 | #pragma pack(4) |
143 | struct OSAction_Aborted_Rpl |
144 | { |
145 | IORPCMessageMach mach; |
146 | OSAction_Aborted_Rpl_Content content; |
147 | }; |
148 | #pragma pack() |
149 | #define OSAction_Aborted_Rpl_ObjRefs (0) |
150 | |
151 | |
152 | typedef union |
153 | { |
154 | const IORPC rpc; |
155 | struct |
156 | { |
157 | const struct OSAction_Aborted_Msg * message; |
158 | struct OSAction_Aborted_Rpl * reply; |
159 | uint32_t sendSize; |
160 | uint32_t replySize; |
161 | }; |
162 | } |
163 | OSAction_Aborted_Invocation; |
164 | #if !KERNEL |
165 | extern OSMetaClass * gOSContainerMetaClass; |
166 | extern OSMetaClass * gOSDataMetaClass; |
167 | extern OSMetaClass * gOSNumberMetaClass; |
168 | extern OSMetaClass * gOSBooleanMetaClass; |
169 | extern OSMetaClass * gOSDictionaryMetaClass; |
170 | extern OSMetaClass * gOSArrayMetaClass; |
171 | extern OSMetaClass * gOSSetMetaClass; |
172 | extern OSMetaClass * gOSOrderedSetMetaClass; |
173 | extern OSMetaClass * gIODispatchQueueMetaClass; |
174 | extern OSMetaClass * gOSStringMetaClass; |
175 | #endif /* !KERNEL */ |
176 | |
177 | #if KERNEL |
178 | OSDefineMetaClassAndStructors(OSAction, OSObject); |
179 | #endif /* KERNEL */ |
180 | |
181 | #if !KERNEL |
182 | |
183 | #define OSAction_QueueNames "" |
184 | |
185 | #define OSAction_MethodNames "" |
186 | |
187 | #define OSActionMetaClass_MethodNames "" |
188 | |
189 | struct OSClassDescription_OSAction_t |
190 | { |
191 | OSClassDescription base; |
192 | uint64_t methodOptions[2 * 0]; |
193 | uint64_t metaMethodOptions[2 * 0]; |
194 | char queueNames[sizeof(OSAction_QueueNames)]; |
195 | char methodNames[sizeof(OSAction_MethodNames)]; |
196 | char metaMethodNames[sizeof(OSActionMetaClass_MethodNames)]; |
197 | }; |
198 | |
199 | const struct OSClassDescription_OSAction_t |
200 | OSClassDescription_OSAction = |
201 | { |
202 | .base = |
203 | { |
204 | .descriptionSize = sizeof(OSClassDescription_OSAction_t), |
205 | .name = "OSAction" , |
206 | .superName = "OSObject" , |
207 | .methodOptionsSize = 2 * sizeof(uint64_t) * 0, |
208 | .methodOptionsOffset = __builtin_offsetof(struct OSClassDescription_OSAction_t, methodOptions), |
209 | .metaMethodOptionsSize = 2 * sizeof(uint64_t) * 0, |
210 | .metaMethodOptionsOffset = __builtin_offsetof(struct OSClassDescription_OSAction_t, metaMethodOptions), |
211 | .queueNamesSize = sizeof(OSAction_QueueNames), |
212 | .queueNamesOffset = __builtin_offsetof(struct OSClassDescription_OSAction_t, queueNames), |
213 | .methodNamesSize = sizeof(OSAction_MethodNames), |
214 | .methodNamesOffset = __builtin_offsetof(struct OSClassDescription_OSAction_t, methodNames), |
215 | .metaMethodNamesSize = sizeof(OSActionMetaClass_MethodNames), |
216 | .metaMethodNamesOffset = __builtin_offsetof(struct OSClassDescription_OSAction_t, metaMethodNames), |
217 | .flags = 1*kOSClassCanRemote, |
218 | }, |
219 | .methodOptions = |
220 | { |
221 | }, |
222 | .metaMethodOptions = |
223 | { |
224 | }, |
225 | .queueNames = OSAction_QueueNames, |
226 | .methodNames = OSAction_MethodNames, |
227 | .metaMethodNames = OSActionMetaClass_MethodNames, |
228 | }; |
229 | |
230 | OSMetaClass * gOSActionMetaClass; |
231 | |
232 | static kern_return_t |
233 | OSAction_New(OSMetaClass * instance); |
234 | |
235 | const OSClassLoadInformation |
236 | OSAction_Class = |
237 | { |
238 | .description = &OSClassDescription_OSAction.base, |
239 | .metaPointer = &gOSActionMetaClass, |
240 | .version = 1, |
241 | .instanceSize = sizeof(OSAction), |
242 | |
243 | .New = &OSAction_New, |
244 | }; |
245 | |
246 | extern const void * const |
247 | gOSAction_Declaration; |
248 | const void * const |
249 | gOSAction_Declaration |
250 | __attribute__((visibility("hidden" ),section("__DATA_CONST,__osclassinfo,regular,no_dead_strip" ),no_sanitize("address" ))) |
251 | = &OSAction_Class; |
252 | |
253 | static kern_return_t |
254 | OSAction_New(OSMetaClass * instance) |
255 | { |
256 | if (!new(instance) OSActionMetaClass) return (kIOReturnNoMemory); |
257 | return (kIOReturnSuccess); |
258 | } |
259 | |
260 | kern_return_t |
261 | OSActionMetaClass::New(OSObject * instance) |
262 | { |
263 | if (!new(instance) OSAction) return (kIOReturnNoMemory); |
264 | return (kIOReturnSuccess); |
265 | } |
266 | |
267 | #endif /* !KERNEL */ |
268 | |
269 | kern_return_t |
270 | OSAction::Dispatch(const IORPC rpc) |
271 | { |
272 | return _Dispatch(self: this, rpc); |
273 | } |
274 | |
275 | kern_return_t |
276 | OSAction::_Dispatch(OSAction * self, const IORPC rpc) |
277 | { |
278 | kern_return_t ret = kIOReturnUnsupported; |
279 | IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false); |
280 | |
281 | switch (msg->msgid) |
282 | { |
283 | case OSAction_Aborted_ID: |
284 | { |
285 | ret = OSAction::Aborted_Invoke(rpc, target: self, SimpleMemberFunctionCast(OSAction::Aborted_Handler, *self, &OSAction::Aborted_Impl)); |
286 | break; |
287 | } |
288 | |
289 | default: |
290 | ret = OSObject::_Dispatch(self, rpc); |
291 | break; |
292 | } |
293 | |
294 | return (ret); |
295 | } |
296 | |
297 | #if KERNEL |
298 | kern_return_t |
299 | OSAction::MetaClass::Dispatch(const IORPC rpc) |
300 | { |
301 | #else /* KERNEL */ |
302 | kern_return_t |
303 | OSActionMetaClass::Dispatch(const IORPC rpc) |
304 | { |
305 | #endif /* !KERNEL */ |
306 | |
307 | kern_return_t ret = kIOReturnUnsupported; |
308 | IORPCMessage * msg = IORPCMessageFromMach(msg: rpc.message, reply: false); |
309 | |
310 | switch (msg->msgid) |
311 | { |
312 | #if KERNEL |
313 | case OSAction_Create_ID: |
314 | ret = OSAction::Create_Invoke(rpc, func: &OSAction::Create_Impl); |
315 | break; |
316 | #endif /* !KERNEL */ |
317 | #if KERNEL |
318 | case OSAction_CreateWithTypeName_ID: |
319 | ret = OSAction::CreateWithTypeName_Invoke(rpc, func: &OSAction::CreateWithTypeName_Impl); |
320 | break; |
321 | #endif /* !KERNEL */ |
322 | |
323 | default: |
324 | ret = OSMetaClassBase::Dispatch(rpc); |
325 | break; |
326 | } |
327 | |
328 | return (ret); |
329 | } |
330 | |
331 | kern_return_t |
332 | OSAction::Create_Call( |
333 | OSObject * target, |
334 | uint64_t targetmsgid, |
335 | uint64_t msgid, |
336 | size_t referenceSize, |
337 | OSAction ** action) |
338 | { |
339 | kern_return_t ret; |
340 | union |
341 | { |
342 | OSAction_Create_Msg msg; |
343 | struct |
344 | { |
345 | OSAction_Create_Rpl rpl; |
346 | mach_msg_max_trailer_t trailer; |
347 | } rpl; |
348 | } buf; |
349 | struct OSAction_Create_Msg * msg = &buf.msg; |
350 | struct OSAction_Create_Rpl * rpl = &buf.rpl.rpl; |
351 | |
352 | memset(s: msg, c: 0, n: sizeof(struct OSAction_Create_Msg)); |
353 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
354 | msg->mach.msgh.msgh_size = sizeof(*msg); |
355 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
356 | | 0*kIORPCMessageSimpleReply |
357 | | 0*kIORPCMessageLocalHost |
358 | | 0*kIORPCMessageOnqueue; |
359 | msg->content.__hdr.msgid = OSAction_Create_ID; |
360 | msg->content.__object = (OSObjectRef) OSTypeID(OSAction); |
361 | msg->content.__hdr.objectRefs = OSAction_Create_Msg_ObjRefs; |
362 | msg->mach.msgh_body.msgh_descriptor_count = 2; |
363 | |
364 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
365 | |
366 | msg->target__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
367 | msg->content.target = (OSObjectRef) target; |
368 | |
369 | msg->content.targetmsgid = targetmsgid; |
370 | |
371 | msg->content.msgid = msgid; |
372 | |
373 | msg->content.referenceSize = referenceSize; |
374 | |
375 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
376 | ret = OSMTypeID(OSAction)->Invoke(rpc); |
377 | |
378 | if (kIOReturnSuccess == ret) |
379 | do { |
380 | { |
381 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
382 | if (rpl->content.__hdr.msgid != OSAction_Create_ID) { ret = kIOReturnIPCError; break; }; |
383 | if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; }; |
384 | if (OSAction_Create_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
385 | } |
386 | } |
387 | while (false); |
388 | if (kIOReturnSuccess == ret) |
389 | { |
390 | *action = OSDynamicCast(OSAction, (OSObject *) rpl->content.action); |
391 | if (rpl->content.action && !*action) ret = kIOReturnBadArgument; |
392 | } |
393 | |
394 | |
395 | return (ret); |
396 | } |
397 | |
398 | kern_return_t |
399 | OSAction::CreateWithTypeName_Call( |
400 | OSObject * target, |
401 | uint64_t targetmsgid, |
402 | uint64_t msgid, |
403 | size_t referenceSize, |
404 | OSString * typeName, |
405 | OSAction ** action) |
406 | { |
407 | kern_return_t ret; |
408 | union |
409 | { |
410 | OSAction_CreateWithTypeName_Msg msg; |
411 | struct |
412 | { |
413 | OSAction_CreateWithTypeName_Rpl rpl; |
414 | mach_msg_max_trailer_t trailer; |
415 | } rpl; |
416 | } buf; |
417 | struct OSAction_CreateWithTypeName_Msg * msg = &buf.msg; |
418 | struct OSAction_CreateWithTypeName_Rpl * rpl = &buf.rpl.rpl; |
419 | |
420 | memset(s: msg, c: 0, n: sizeof(struct OSAction_CreateWithTypeName_Msg)); |
421 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
422 | msg->mach.msgh.msgh_size = sizeof(*msg); |
423 | msg->content.__hdr.flags = 0*kIORPCMessageOneway |
424 | | 0*kIORPCMessageSimpleReply |
425 | | 0*kIORPCMessageLocalHost |
426 | | 0*kIORPCMessageOnqueue; |
427 | msg->content.__hdr.msgid = OSAction_CreateWithTypeName_ID; |
428 | msg->content.__object = (OSObjectRef) OSTypeID(OSAction); |
429 | msg->content.__hdr.objectRefs = OSAction_CreateWithTypeName_Msg_ObjRefs; |
430 | msg->mach.msgh_body.msgh_descriptor_count = 3; |
431 | |
432 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
433 | |
434 | msg->target__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
435 | msg->content.target = (OSObjectRef) target; |
436 | |
437 | msg->content.targetmsgid = targetmsgid; |
438 | |
439 | msg->content.msgid = msgid; |
440 | |
441 | msg->content.referenceSize = referenceSize; |
442 | |
443 | msg->typeName__descriptor.type = MACH_MSG_OOL_DESCRIPTOR; |
444 | msg->typeName__descriptor.copy = MACH_MSG_VIRTUAL_COPY; |
445 | msg->typeName__descriptor.address = (void *) __builtin_offsetof(OSAction_CreateWithTypeName_Msg_Content, typeName); |
446 | msg->content.typeName = typeName; |
447 | |
448 | IORPC rpc = { .message = &buf.msg.mach, .reply = &buf.rpl.rpl.mach, .sendSize = sizeof(buf.msg), .replySize = sizeof(buf.rpl) }; |
449 | ret = OSMTypeID(OSAction)->Invoke(rpc); |
450 | |
451 | if (kIOReturnSuccess == ret) |
452 | do { |
453 | { |
454 | if (rpl->mach.msgh.msgh_size != sizeof(*rpl)) { ret = kIOReturnIPCError; break; }; |
455 | if (rpl->content.__hdr.msgid != OSAction_CreateWithTypeName_ID) { ret = kIOReturnIPCError; break; }; |
456 | if (rpl->mach.msgh_body.msgh_descriptor_count != 1) { ret = kIOReturnIPCError; break; }; |
457 | if (OSAction_CreateWithTypeName_Rpl_ObjRefs != rpl->content.__hdr.objectRefs) { ret = kIOReturnIPCError; break; }; |
458 | } |
459 | } |
460 | while (false); |
461 | if (kIOReturnSuccess == ret) |
462 | { |
463 | *action = OSDynamicCast(OSAction, (OSObject *) rpl->content.action); |
464 | if (rpl->content.action && !*action) ret = kIOReturnBadArgument; |
465 | } |
466 | |
467 | |
468 | return (ret); |
469 | } |
470 | |
471 | void |
472 | OSAction::Aborted( OSDispatchMethod supermethod) |
473 | { |
474 | kern_return_t ret; |
475 | union |
476 | { |
477 | OSAction_Aborted_Msg msg; |
478 | } buf; |
479 | struct OSAction_Aborted_Msg * msg = &buf.msg; |
480 | |
481 | memset(s: msg, c: 0, n: sizeof(struct OSAction_Aborted_Msg)); |
482 | msg->mach.msgh.msgh_id = kIORPCVersion190615; |
483 | msg->mach.msgh.msgh_size = sizeof(*msg); |
484 | msg->content.__hdr.flags = 1*kIORPCMessageOneway |
485 | | 1*kIORPCMessageSimpleReply |
486 | | 1*kIORPCMessageLocalHost |
487 | | 0*kIORPCMessageOnqueue; |
488 | msg->content.__hdr.msgid = OSAction_Aborted_ID; |
489 | msg->content.__object = (OSObjectRef) this; |
490 | msg->content.__hdr.objectRefs = OSAction_Aborted_Msg_ObjRefs; |
491 | msg->mach.msgh_body.msgh_descriptor_count = 1; |
492 | |
493 | msg->__object__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
494 | |
495 | IORPC rpc = { .message = &buf.msg.mach, .reply = NULL, .sendSize = sizeof(*msg), .replySize = 0 }; |
496 | if (supermethod) ret = supermethod((OSObject *)this, rpc); |
497 | else ret = ((OSObject *)this)->Invoke(rpc); |
498 | |
499 | } |
500 | |
501 | kern_return_t |
502 | OSAction::Create_Invoke(const IORPC _rpc, |
503 | Create_Handler func) |
504 | { |
505 | OSAction_Create_Invocation rpc = { .rpc: _rpc }; |
506 | kern_return_t ret; |
507 | OSObject * target; |
508 | |
509 | if (2 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
510 | if (OSAction_Create_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
511 | if (rpc.message != NULL && rpc.sendSize < sizeof(OSAction_Create_Msg)) return (kIOReturnIPCError); |
512 | if (rpc.reply != NULL && rpc.replySize < sizeof(OSAction_Create_Rpl)) return (kIOReturnIPCError); |
513 | target = OSDynamicCast(OSObject, (OSObject *) rpc.message->content.target); |
514 | if (!target && rpc.message->content.target) return (kIOReturnBadArgument); |
515 | |
516 | ret = (*func)( target, |
517 | rpc.message->content.targetmsgid, |
518 | rpc.message->content.msgid, |
519 | rpc.message->content.referenceSize, |
520 | (OSAction **)&rpc.reply->content.action); |
521 | |
522 | if (kIOReturnSuccess != ret) return (ret); |
523 | |
524 | rpc.reply->content.__hdr.msgid = OSAction_Create_ID; |
525 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
526 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
527 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
528 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 1; |
529 | rpc.reply->content.__hdr.objectRefs = OSAction_Create_Rpl_ObjRefs; |
530 | rpc.reply->action__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
531 | |
532 | return (ret); |
533 | } |
534 | |
535 | kern_return_t |
536 | OSAction::CreateWithTypeName_Invoke(const IORPC _rpc, |
537 | CreateWithTypeName_Handler func) |
538 | { |
539 | OSAction_CreateWithTypeName_Invocation rpc = { .rpc: _rpc }; |
540 | kern_return_t ret; |
541 | OSObject * target; |
542 | |
543 | if (3 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
544 | if (OSAction_CreateWithTypeName_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
545 | if (rpc.message != NULL && rpc.sendSize < sizeof(OSAction_CreateWithTypeName_Msg)) return (kIOReturnIPCError); |
546 | if (rpc.reply != NULL && rpc.replySize < sizeof(OSAction_CreateWithTypeName_Rpl)) return (kIOReturnIPCError); |
547 | if (((OSObject *) rpc.message->content.typeName) != NULL && OSDynamicCast(OSString, (OSObject *) rpc.message->content.typeName) == NULL) { return kIOReturnBadArgument; } |
548 | target = OSDynamicCast(OSObject, (OSObject *) rpc.message->content.target); |
549 | if (!target && rpc.message->content.target) return (kIOReturnBadArgument); |
550 | |
551 | ret = (*func)( target, |
552 | rpc.message->content.targetmsgid, |
553 | rpc.message->content.msgid, |
554 | rpc.message->content.referenceSize, |
555 | rpc.message->content.typeName, |
556 | (OSAction **)&rpc.reply->content.action); |
557 | |
558 | if (kIOReturnSuccess != ret) return (ret); |
559 | |
560 | rpc.reply->content.__hdr.msgid = OSAction_CreateWithTypeName_ID; |
561 | rpc.reply->content.__hdr.flags = kIORPCMessageOneway; |
562 | rpc.reply->mach.msgh.msgh_id = kIORPCVersion190615Reply; |
563 | rpc.reply->mach.msgh.msgh_size = sizeof(*rpc.reply); |
564 | rpc.reply->mach.msgh_body.msgh_descriptor_count = 1; |
565 | rpc.reply->content.__hdr.objectRefs = OSAction_CreateWithTypeName_Rpl_ObjRefs; |
566 | rpc.reply->action__descriptor.type = MACH_MSG_PORT_DESCRIPTOR; |
567 | |
568 | return (ret); |
569 | } |
570 | |
571 | kern_return_t |
572 | OSAction::Aborted_Invoke(const IORPC _rpc, |
573 | OSMetaClassBase * target, |
574 | Aborted_Handler func) |
575 | { |
576 | OSAction_Aborted_Invocation rpc = { .rpc: _rpc }; |
577 | |
578 | if (1 != rpc.message->mach.msgh_body.msgh_descriptor_count) return (kIOReturnIPCError); |
579 | if (OSAction_Aborted_Msg_ObjRefs != rpc.message->content.__hdr.objectRefs) return (kIOReturnIPCError); |
580 | if (rpc.message != NULL && rpc.sendSize < sizeof(OSAction_Aborted_Msg)) return (kIOReturnIPCError); |
581 | if (rpc.reply != NULL && rpc.replySize < sizeof(OSAction_Aborted_Rpl)) return (kIOReturnIPCError); |
582 | |
583 | (*func)(target); |
584 | |
585 | |
586 | return (kIOReturnSuccess); |
587 | } |
588 | |
589 | |
590 | |
591 | |