NTSTATUS
IoAttachDevice(
IN PDEVICE_OBJECT SourceDevice,
IN PUNICODE_STRING TargetDevice,
OUT PDEVICE_OBJECT *AttachedDevice
);
SourceDevice是要挂上的设备,TargetDevice是目标设备
执行结果:SourceDevice将挂载TargetDevice设备栈的最上层
AttachedDevice:On return, contains a pointer to the target device object if the attachment succeeds
IoAttachDeviceToDeviceStack
PDEVICE_OBJECT
IoAttachDeviceToDeviceStack(
IN PDEVICE_OBJECT SourceDevice,
IN PDEVICE_OBJECT TargetDevice
);
执行结果:SourceDevice将挂载TargetDevice设备栈的最上层
返回值:是这个设备栈SourceDevice的下层,也就是不一定是TargetDevice,除非TargetDevice原本是最上层的。