I'm working in a sort of encapsulation of the windows filesystem.
When the user request to open a file, windows calls to my driver to provide the data. In normal operation the driver return the file contents which is cached, However, in some cases the real file is not cached and I need to download it from the network.
The question is if it's possible to keep Windows trying to read the file without blocking the entire drive operation neither the software which open the file, giving the user a chance to cancel the opening process.
At first, i tried to block the driver until data is available, this solution is the more straightforward to implement, but the user experiencie isn't the best. Moreover, relying in network transfer isn't a good idea, the transfer could last for many time and the driver will be block all that time.
The second way I have implemented, consist in return only data when the file is cached and when the file isn't available tell windows that the file is 0 size length, and download the file in a background proccess. With this, the driver don't block windows, and the user experience improve, but the user need to open N times the file until data is available.
I think that the best solution will be to return windows a message like "No data available, try again in 5 secs", i think that if the driver return the apropiate error code to windows this could be achieved, but the error list is too long and the names aren't always as descriptive as you want.
Do you have some advice implementing this? Thanks in advance.