To make your code fast, don't perform lengthy operations (especially network operations) from the callback. Create a worker thread, that will do the job. When you need to write the data, pass this data to the worker thread and return. The worker thread will send the data to the remote side. When the file is opened, cache some of it's data with help of the worker thread and return this data from reading callback.

In your OnOpenFile callback handler spawn a worker thread which will read some data and store it in the temporary cache. On OnRead callback read the data from the cache or wait until the data appears there.

But if I open a Folder every file inside this folder is opened one times.
And while OnOpenFile appears with another access and share mode it is too late because it is immediately called before the OnReadFile.

I'm not able to cache every file on an OpenFile just because one person is opening a folder.

We use cookies to help provide you with the best possible online experience. By using this site, you agree that we may store and access cookies on your device. You can find out more about and set your own preferences here.