Vidhya Vasudevan wrote:
I want to implement IOCTL, which returns immediately from the Dispatch
control and sends data and complete the IRP whenever data has been
received from lower layer.
I’m returning STATUS_PENDING and calling IoMarkIrpPending for the IOCTL.
But it is still working as synchronous call only.
Application side my code looks like this
>
OVERLAPPED stOverStruct;
memset(&stOverStruct,0,sizeof(OVERLAPPED));
stOverStruct.hEvent = hKernelHandle;
if(!DeviceIoControl(hDriverHandle,IOCTL_QUERY_DATA,
NULL,0, &ucBuffer[0],1024,
&dwBytesReturn,&stOverStruct))
{
dwError = GetLastError();
if(ERROR_IO_PENDING != dwError)
{
return
}
}
dwResult = WaitForSingleObjects(stOverStruct.hEvent,INFINITE);
Did you pass FILE_FLAG_OVERLAPPED to CreateFile() when
you opened hDriverHandle?
Thanks,
Joseph
What is the error code at GetLastError? Is the IO system rejecting the IO
request before it even gets to the driver with a bad parameter or other
error? You need to set a completion or cancel routine when pending an IRP
though that will not prevent asunc IO from working. Do you return from your
dispatch routine with STATUS_SUCCESS after pending the IRP?
–
The personal opinion of
Gary G. Little
“Vidhya Vasudevan” wrote in message
news:xxxxx@ntdev…
I’m new to the driver development. Please suggest!
Can I get some pointer on How to implement async IOCTL?
I want to implement IOCTL, which returns immediately from the Dispatch
control and sends data and complete the IRP whenever data has been received
from lower layer.
I’m returning STATUS_PENDING and calling IoMarkIrpPending for the IOCTL. But
it is still working as synchronous call only.
Application side my code looks like this
OVERLAPPED stOverStruct;
memset(&stOverStruct,0,sizeof(OVERLAPPED));
stOverStruct.hEvent = hKernelHandle;
if(!DeviceIoControl(hDriverHandle,IOCTL_QUERY_DATA,
NULL,0, &ucBuffer[0],1024,
&dwBytesReturn,&stOverStruct))
{
dwError = GetLastError();
if(ERROR_IO_PENDING != dwError)
{
return
}
}
dwResult = WaitForSingleObjects(stOverStruct.hEvent,INFINITE);
TIA.
Regards,
V Vidhya