4.3 Querying Enumerations of VDS Objects
Most VDS objects are retrievable only through an enumeration via the IVdsPack interface. The following figure shows an example of a client enumerating volume objects belonging to a disk pack.

Figure 7: Client enumerating volume objects belonging to a disk pack
The client initiates the enumeration of volumes by calling the IVdsPack::QueryVolumes method.
Upon successful execution of the IVdspack::QueryVolumes method, the server creates an enumeration object and returns a reference to an IEnumVdsObject interface.
The client can call IEnumVdsObject::Next for the next object in the enumeration that it wants to retrieve.
Upon receiving the IEnumVdsObject::Next request, the server looks for the next volume object in the enumeration. If one exists, then 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 an HRESULT of 0x00000001.
Assuming the server returned a zero HRESULT, the client invokes the interface's IUnknown::QueryInterface method to request for the object's IVdsVolume interface.
The server returns an HRESULT of 0x00000000 and a reference to the IVdsVolume interface to the client. The client can access the volume information through the IVdsVolume interface.
When a client no longer needs the IVdsVolume interface, the client releases the reference to the interface by calling IVdsVolume::Release.
The server returns a new reference count for IVdsVolume::Release.
The client also needs to release the reference to the IUnknown interface by calling IUnknown::Release.
The server returns a new reference count for IUnknown::Release.
The client can call IEnumVDsObject::Next again for the next object in the enumeration.
When the server reaches the end of the enumeration, the server returns an HRESULT of 0x00000001.
The client no longer needs the IEnumVdsObject interface, so it calls IEnumVdsObject::Release to release the reference.
The server returns a new reference count for IEnumVdsObject.
All other VDS objects that are retrievable via enumeration can be retrieved using similar steps.