Share via


4.2 Calculate Shadow Copy Storage Space on a Volume

The following message sequence illustrates how a client can query the list of shadow copy storage associations where the storage is located on a specified volume and then calculate the total amount of storage space in use on that volume.

  1. The client requests an RPC binding handle to the IVssSnapshotMgmt interface by calling CoCreateInstanceEx with the class GUID that defines the COM class on the server that implements IVssSnapshotMgmt.

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

  3. The client calls IVssSnapshotMgmt::GetProviderMgmtInterface, passing in the required parameters as described in section 3.1.1.4.1.

  4. The server returns a reference to an IVssDifferentialSoftwareSnapshotMgmt interface.

  5. The client initializes a LONGLONG storage area byte-count variable to zero and calls IVssDifferentialSoftwareSnapshotMgmt::QueryDiffAreasOnVolume, passing in the drive letter, mount point, or volume mount name (with trailing backslash [\'] character) of a volume of interest.

  6. The server returns a reference to an IVssEnumMgmtObject interface that contains a collection of shadow copy storage associations on the server upon which the specified volume is in use for the shadow copy storage location. The server initializes an internal cursor in the collection to point to the first object.

  7. The client calls IVssEnumMgmtObject::Next, passing in 1 for the number of elements to retrieve.

  8. The server returns the cursor shadow copy storage association object in the collection as a VSS_MGMT_OBJECT_PROP structure, wrapping a VSS_DIFF_AREA_PROP structure, and increments the internal cursor in the collection to the next object.

  9. The client adds the value of the VSS_MGMT_OBJECT_PROP.Obj.DiffArea.m_llUsedDiffSpace member of the returned structure to the byte-count variable. The client then repeats steps 7 through 9 until the IVssEnumMgmtObject::Next call returns S_FALSE to signal the end of the enumeration.

  10. The server returns the value S_FALSE as the return value for the client's final call to IVssEnumMgmtObject::Next.

  11. The client calls IVssEnumMgmtObject::Release.

  12. The server decrements the reference count for the IVssEnumMgmtObject interface and returns the new reference count to the client.

  13. The client calls IVssDifferentialSoftwareSnapshotMgmt::Release.

  14. The server decrements the reference count for the IVssDifferentialSoftwareSnapshotMgmt interface and returns the new reference count to the client.

  15. The client calls IVssSnapshotMgmt::Release.

  16. The server decrements the reference count for the IVssSnapshotMgmt interface and returns the new reference count to the client.

Calculate Shadow Copy Storage Space on a Volume

Figure 2: Calculate Shadow Copy Storage Space on a Volume