Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results
The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.
Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/
I was reading about file system stack and found a source code and i am trying to understand what it is actually doing
it is finding the device object of \device\harddisk0\partition0 and then it sends a IRP_MJ_PNP request to it and builds the IRP using IoBuildSynchronousFsdRequest, sets the minorfunc to IRP_MN_QUERY_DEVICE_RELATIONS and QueryDeviceRelations.Type to TargetDeviceRelation
now can someone explain what does this actually do? whats the purpose of IRP_MN_QUERY_DEVICE_RELATIONS regarding the partition0 device object and whats the deal with this TargetDeviceRelation? where can i read more about this?
KeInitializeEvent( &event, NotificationEvent, FALSE ); irp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP, DeviceObject, NULL, 0, NULL, &event, &ioStatusBlock ); if (irp == NULL) { status = STATUS_INSUFFICIENT_RESOURCES; goto End; } irpStack = IoGetNextIrpStackLocation( irp ); irpStack->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS; irpStack->Parameters.QueryDeviceRelations.Type = TargetDeviceRelation; irp->IoStatus.Status = STATUS_NOT_SUPPORTED ; status = IoCallDriver( DeviceObject, irp ); if (status == STATUS_PENDING) { KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL ); status = ioStatusBlock.Status;}
Upcoming OSR Seminars | ||
---|---|---|
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead! | ||
Writing WDF Drivers | 7 Dec 2020 | LIVE ONLINE |
Internals & Software Drivers | 25 Jan 2021 | LIVE ONLINE |
Developing Minifilters | 8 March 2021 | LIVE ONLINE |
Comments
How can you ask that question with a straight face? I Googled for IRP_MN_QUERY_DEVICE_RELATIONS, and the top hit was the MSDN page that describes these option. TargetDeviceRelations returns the device object associated with a particular file object.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.