Virtual drive implementation dictates special requirements to programmer. Please be aware of the following:
- Callback handlers must be small and efficient. Try to quit callback handler as soon as possible: do not waste system time. VDSDK kernel driver counts time spent in callback handler, so if it exceeds predefined timeout, all requests will be cancelled. At the moment default timeout is 10 seconds.
- While callback handler is executing, OS file caching subsystem must not be involved. Do not use file buffering. That means you should open storage files using FILE_FLAG_NO_BUFFERING. If you ignore this advise it may cause the system-wide deadlock. Please note that FILE_FLAG_NO_BUFFERING flag requires sector-size aligned offsets. (See MSDN documentation for more details).
- Do not use APC (asynchronous procedure calls) in callback handler. It can occur OS deadlock.
- To properly process all requests, VDSDK creates special thread. All callback handlers are called strictly one after another in that thread context.