DismountNtmsMedia

[This is preliminary documentation and subject to change.]

The DismountNtmsMedia function releases the specified medium from a drive.

DWORD WINAPI DismountNtmsMedia(
  HANDLE hSession,
  LPNTMS_GUID lpMediaId, 
  DWORD dwCount,
  DWORD dwOptions
);
 

Parameters

hSession
Handle to the session returned by the OpenNtmsSession function.
lpMediaId
Specifies an array of at least one logical medium or partition.
dwCount
Specifies the number of media identifiers in the lpMediaId parameter.
dwOptions
This parameter can be the following value.
Value Meaning
NTMS_DISMOUNT_DEFERRED Marks media state as Dismountable, and keeps the medium in the drive. Subsequent mount requests are satisfied using dismounted or dismountable drives. The default is to dismount immediately.

Return Values

ERROR_ACCESS_DENIED
NTMS_USE_ACCESS to the media pool or library that contains the media is denied. Other security errors are also possible, but they would indicate a security subsystem error.
ERROR_DATABASE_FAILURE
The database is inaccessible or damaged.
ERROR_DATABASE_FULL
The database is full.
ERROR_DEVICE_NOT_AVAILABLE
One or more resources required to perform the dismount are not currently available (probably disabled).
ERROR_INVALID_LIBRARY
The library that contains the media is not valid.
ERROR_INVALID_MEDIA
At least one of the specified media is not valid.
ERROR_INVALID_STATE
An unexpected media or device state occurred during dismount.
ERROR_MEDIA_OFFLINE
The specified media is offline.
ERROR_MEDIA_NOT_AVAILABLE
One or more media resources required to perform the mount are not currently available (probably disabled).
ERROR_NOT_ENOUGH_MEMORY
A memory allocation failure occurred during processing.
ERROR_SUCCESS
The media dismount has been queued.
ERROR_TIMEOUT
The time-out event expired while the application attempted to acquire one or more resources.

Remarks

An application must use the DismountNtmsMedia function to release the drive resource after the application has used the specified medium. Unreleased media cannot be used by other RSM sessions.

If the session closes, RSM eventually dismounts the media.

The DismountNtmsMedia function returns as soon as the operation is queued with RSM. The application can wait for the partition state to become idle.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in ntmsapi.h.
  Import Library: Use ntmsapi.lib.

See Also

Media Services Functions, MountNtmsMedia