macOS 上的DiskArbitration
框架提供了一种简单的方法来拦截卷挂载并对其进行授权或不使用DARegisterDiskMountApprovalCallback
.
我正在为所有其他 USB 设备(如 HID 设备、网络接口以及一般每个 USB 外围设备)寻找类似的东西。
我正在朝着IOKit
:USB 设备接口指南简介的方向前进,我可以看到如何与 USB 设备通信,但我找不到任何类似于仲裁机制的东西。
任何想法?内核扩展不是一种选择。
macOS 11 更新
在 macOS 中,引入了一个名为的新 AUTH 事件ES_EVENT_TYPE_AUTH_IOKIT_OPEN
。该事件被正确调用,但在我资助的对象标题中挖掘:
/**
* @brief Open a connection to an I/O Kit IOService
*
* @field user_client_type A constant specifying the type of connection to be
* created, interpreted only by the IOService's family.
* This field corresponds to the type argument to IOServiceOpen().
* @field user_client_class Meta class name of the user client instance.
*
* This event is fired when a process calls IOServiceOpen() in order to open
* a communications channel with an I/O Kit driver. The event does not
* correspond to driver <-> device communication and is neither providing
* visibility nor access control into devices being attached.
*/
typedef struct {
uint32_t user_client_type;
es_string_token_t user_client_class;
uint8_t reserved[64];
} es_event_iokit_open_t;
:(
这破坏了我的计划:
The event does not correspond to driver <-> device communication and is neither providing visibility nor access control into devices being attached.
关于如何以另一种方式获取设备信息的任何想法?