4.1.1 Starting Sessions

The following is an example of a client starting a VDS session by retrieving an instance of the VDS service object.

Client starting a VDS session by retrieving an instance of the VDS service object

Figure 2: Client starting a VDS session by retrieving an instance of the VDS service object

  1. The client requests the creation of a VDS session by calling CoCreateInstanceEx (see [MSDN-CoCreateInstanceEx]) with the class UUID of the VDS service in order to create an instance of the VDS object on the server.

  2. The server returns a reference to the IVdsService interface.

  3. The client invokes the interface's IUnknown::QueryInterface method to request for the IVdsServiceInitialization interface.

  4. The server returns a reference to the IVdsServiceInitialization interface.

  5. The client calls the IVdsServiceInitialization::Initialize method.

  6. The server begins initializing the service and returns control back to the client.

  7. The client calls the IVdsService::WaitForServiceReady method.

  8. The server replies to the client with an HRESULT indicating whether the service initialization was successful. If the VDS service initialization is successful (HRESULT of 0x00000000), the client can request virtual disk management operations to the server through the methods in the IVdsService interface.

  9. The client initiates the enumeration of providers by calling the IVdsService::QueryProviders method.

  10. Upon successful execution of the IVdsService::QueryProviders method, the server creates an enumeration object and returns a reference to an IEnumVdsObject interface.

  11. The client can call IEnumVdsObject::Next to retrieve the next provider in the enumeration.

  12. Upon receiving the IEnumVdsObject::Next request, the server looks for the next provider object in the enumeration. If there is a provider object in the enumeration, the server returns an HRESULT of 0x00000000 and a reference to the IUnknown interface to the client. If the server reaches the end of the enumeration, the server returns a HRESULT of 0x00000001.

  13. If the server returns a zero disk, the client invokes the interface's IUnknown::QueryInterface method to request for the object's IVdsProvider interface.

  14. The server returns a HRESULT of 0x00000000 and a reference to the IVdsProvider interface to the client. The client can access the provider information through the IVdsProvider interface.

  15. If the client wants to query the objects in the provider, the client invokes the interface's IUnknown::QueryInterface method to request for the object's IVdsSwProvider interface.

  16. The server returns a HRESULT of 0x00000000 and a reference to the IVdsSwProvider interface to the client. The client can enumerate the objects in the provider through the IVdsProvider interface.

  17. When a client no longer needs the IVdsProvider interface, the client releases the reference to the interface by calling IVdsProvider::Release.

  18. The server returns a new reference count for IVdsProvider::Release.

  19. The client also needs to release the reference to the IUnknown interface by calling IUnknown::Release.

  20. The server returns a new reference count for IUnknown::Release.

  21. The client can call IEnumVdsObject::Next again for the next provider in the enumeration.

  22. If the server reaches the end of the enumeration, the server returns a HRESULT of 0x00000001.

  23. The client no longer needs the IEnumVdsObject interface; therefore, it calls IEnumVdsObject::Release to release the reference.

  24. The server returns a new reference count for IEnumVdsObject.