IServerVirtualDeviceSet2::Close

Microsoft SQL Server Virtual Backup

Microsoft SQL Server Virtual Backup Device Specification

IServerVirtualDeviceSet2::Close

Purpose This function closes a virtual device set opened by IServerVirtualDeviceSet2::Open. It results in releasing all resources associated with the virtual device. The IServerVirtualDeviceSet2 handle is not useful after this function returns and it should be returned to COM.
Syntax HRESULT IServerVirtualDeviceSet2::Close ();
Parameters Argument Explanation
  None Not applicable
Return Values Argument Explanation
  VD_E_PROTOCOL The devices were still open.
Remarks Closing the virtual device set before closing the devices should not be performed. If this situation occurs, VD_E_PROTOCOL is returned. This action results in Close immediately releasing its mapping of shared memory. The server is subject to access violations if it continues to expect ownership of resources returned from the virtual device interface. The interface performs SignalAbort processing.

The completion agent, if running, completes any outstanding commands before returning to its caller. Any outstanding commands are completed with ERROR_OPERATION_ABORTED. That is, the callback function is invoked for each such command.

In all cases including when errors are returned, Close releases all resources for the virtual device interface. Any buffers and other interface pointers returned from the VDI become invalid.

It is important to ensure that the completion agent has been terminated before the COM library is unloaded. If the library is unloaded before the completion agent returns to its caller, then the process could cause an instruction violation.