3.4.5.2.34.8 IVdsVolumeMF::Dismount (Opnum 10)

The Dismount method dismounts a mounted volume.

 HRESULT Dismount(
   [in] long bForce,
   [in] long bPermanent
 );

bForce: A Boolean that determines whether the current volume is dismounted unconditionally, even if the volume is in use.

bPermanent: A Boolean that determines whether a volume MUST be dismounted permanently by taking the volume offline after dismounting it.

Return Values: The method MUST return zero or a non-error HRESULT (as specified in [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service Remote Protocol, see section 2.2.3.

When the server receives this message, it MUST validate the following:

  • Attempt to get exclusive access to the volume. If the server fails to get exclusive access to the volume, and the bForce parameter is not set to a non-zero value, then the server MUST return VDS_E_DEVICE_IN_USE.

  • Verify that the volume is not currently temporarily dismounted.

  • If bPermanent is set, verify that the volume supports permanent dismount by checking the volume flag VDS_VF_PERMANENT_DISMOUNT_SUPPORTED.

  • If bPermanent is set, verify that the volume does not have any access paths.

  • If bPermanent is not set, verify that the volume is not currently permanently dismounted.

The server MUST then perform the following in sequence:

  • Dismount the volume.

  • If bForce is set, force the dismount, even if the volume is in use.

  • If bPermanent is set, take the volume offline.<133>

  • Return an HRESULT indicating failure or success.