MinYoung Lee
MinYoung Lee

Reputation: 79

Sending a data resulted by device driver to user mode application

I've been looking for a way to send the data which my device driver makes as a result to user mode application. For instance, I send a specific process id in user mode to my device driver and my device driver sends it back to in user mode after some calculation or something. My device driver operates with IOCTL. So once I thought there was a space/buffer as structure in PIRP structure for sending to user mode application. Following a lot of searching about this, I've got no useful reference, information for use. Does anybody give me any clues on this matter? I would appreciate even if it's a little of help. Thanks in advance.

Upvotes: 2

Views: 823

Answers (1)

EWD-0-
EWD-0-

Reputation: 133

When you call DeviceIoControl API your specified routine for MajorFunction[IRP_MJ_DEVICE_CONTROL] is called.

As you've mentioned you receive a pointer to IRP. Based on the type of IOCTL you've defined you can send your data to the callee, which is the user-mode application in this case.

According to MSDN : https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/buffer-descriptions-for-i-o-control-codes

METHOD_BUFFERED For this transfer type, IRPs supply a pointer to a buffer at Irp->AssociatedIrp.SystemBuffer. This buffer represents both the input buffer and the output buffer that are specified in calls to DeviceIoControl and IoBuildDeviceIoControlRequest. The driver transfers data out of, and then into, this buffer.

Upvotes: 2

Related Questions