Platform SDK: Removable Storage Manager

DismountNtmsMedia

The DismountNtmsMedia function queues a command to move the specified media in a drive to its storage. This function should be paired with the MountNtmsMedia function.

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 side.
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

Value Meaning
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.

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

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Ntmsapi.h.
  Library: Use Ntmsapi.lib.

See Also

Media Services Functions, MountNtmsMedia