Continuing the question in:
http://stackoverflow.com/questions/1587521/keep-windows-trying-to-read-a-file
Thanks to accepted answer in that question I realized that keeping windows waiting for data is a driver responsability.
As i'm using Dokan, I am be able to look into the driver code. Dokan complete the IRP request with a STATUS_END_OF_FILE when you return no data, that obvioulsy forces windows to stop waiting for data and close the file.
What i want to do is to hold the application that request file data until data is available and as i said in the original question, the user must be able to cancel the process at any time.
The code that completes the request is:
PIRP irp
irp->IoStatus.Status = STATUS_END_OF_FILE
IoCompleteRequest(irp, IO_NO_INCREMENT);
Actually, i can return any error code, and i wanted to know if some STATUS code ( one of NTSTATUS values ), force windows to wait for data, and if returning that status code is enough to hold windows in reading operation.
I already tried to return STATUS_WAIT_0, but it doesn't seem to work.
Thanks again :)