I want to make an IOCTL call between 2 avstream drivers that support
property sets.
I am using IoGetDeviceInterfaces to get the interfaces and then I do a
IoGetDeviceObjectPointer to get the device object.
Following that when I need to make the IOCTL, I use
IoBuildDeviceIoControlRequest to set the IRP and then I am trying to
use IoCallDriver but it returns back with an error.
Here is how I am setting the StackLocation...
What I need to send is 1>KSPROPERTY and 2>ULONG(which contains data)
pIrp = IoBuildDeviceIoControlRequest(
ulIoctl,
pFilter->pDevObject,
pData,
ulpData,
pcbData,
ulcbData,
TRUE,
NULL,
&IoStatusBlock);
//ulpdata points to a KSPROPERTY structure...pcbdata is size of
//KSPROPERTY... pcbdata points to a ULONG, ulcbdata is SIZE of ULONG.
if (pIrp != NULL)
{
PIO_STACK_LOCATION pNextStackLocation;
pNextStackLocation = IoGetNextIrpStackLocation(pIrp);
if (pNextStackLocation)
{
pNextStackLocation->FileObject = pFilter->pFiObject;
pNextStackLocation->MajorFunction = IRP_MJ_DEVICE_CONTROL;
pNextStackLocation->Parameters.DeviceIoControl.IoControlCode =
IOCTL_KS_PROPERTY;
IoStatusBlock.Status = STATUS_SUCCESS;
ntStatus = IoCallDriver( pFilter->pDevObject, pIrp);
Is there anything wrong in what I am doing ? Do I need to set
additional parameters in PIO_STACK_LOCATION ? as to what data needs to
go through ( like size of KSPROPERTY or ULONG) ?
Thanks.