Macos DriverKit驱动程序如何通知应用程序?
我知道如何将数据发送到DriverKit并获取一些值,即应用程序调用Macos DriverKit驱动程序如何通知应用程序?,macos,iokit,driverkit,Macos,Iokit,Driverkit,我知道如何将数据发送到DriverKit并获取一些值,即应用程序调用IOConnectCallStructMethod(),驱动程序在structureOutput中填充OSData 在我的应用程序中,它使用IOConnectCallAsyncScalarMethod()和kext使用sendAsyncResult64()让应用程序知道即将发生的事件。但是,方法sendAsyncResult64()在DriverKit中不可用 我看到了看起来像解决方案,但没有实现它的想法。有人知道怎么做吗? 如
IOConnectCallStructMethod()
,驱动程序在structureOutput
中填充OSData
在我的应用程序中,它使用IOConnectCallAsyncScalarMethod()
和kext使用sendAsyncResult64()
让应用程序知道即将发生的事件。但是,方法sendAsyncResult64()
在DriverKit中不可用
我看到了看起来像解决方案,但没有实现它的想法。有人知道怎么做吗?
如果您有任何建议,我们将不胜感激
iUserClient::AsyncCompletion
确实是sendAsyncResult64()
的替代品
要成功调用它,您需要保留ExternalMethod
分派函数中提供的IOUserClientMethodArguments
的completion
字段中提供的OSAction
对象。然后,当您准备好发送异步结果时,调用
userclient->AsyncCompletion(saved_osaction, result, async_arguments, num_async_arguments);
一旦不再需要OSAction
对象,不要忘记释放它。异步参数数组将传递给用户空间应用程序中的处理程序函数,与kext调用sendAsyncResult64()
相同
请注意,不能异步填充“small”
structureOutput
字段(4096字节或更少),因为这些字段必须在ExternalMethod
处理程序中返回。只有当缓冲区足够大,可以通过structureOutputDescriptor
传递时,才能保留该描述符,并在初始ExternalMethod
返回后用数据填充它。不过,这与kexts没有什么不同。顺便说一句,在我的应用程序中,我使用IOConnectCallStructMethod
为驱动程序准备缓冲区,在我的驱动程序中,使用IOMemoryScriptor::CreateMapping
填充相关数据,让应用程序获取它。但是我不知道如何成功地使用IOMemoryDescriptor::CreateMapping
。我们通过您的指示解决了这个问题,谢谢:)您是最棒的!