Platform SDK: Removable Storage Manager

DisableNtmsObject

The DisableNtmsObject function disables the specified RSM object.

DWORD WINAPI DisableNtmsObject(
  HANDLE hSession,
  DWORD dwType,
  LPNTMS_GUID lpObjectId
);

Parameters

hSession
Handle to the session returned by the OpenNtmsSession function.
dwType
Specifies the RSM object type. This parameter can be one of the following values.
Value Meaning
NTMS_DRIVE An RSM drive.
NTMS_LIBRARY An RSM library unit.
NTMS_PHYSICAL_MEDIA A physical media object (a tape, optical disk, CD, or magnetic cartridge).

lpObjectId
Specifies the unique identifier of the RSM object.

Return Values

Value Meaning
ERROR_ACCESS_DENIED NTMS_CONTROL_ACCESS to the library containing the object is denied.
ERROR_DATABASE_FAILURE The database is inaccessible or damaged.
ERROR_INVALID_HANDLE The session handle is invalid or missing.
ERROR_INVALID_PARAMETER An object ID is missing or the object type is invalid. (The object type is invalid if it is not NTMS_LIBRARY, NTMS_DRIVE, or NTMS_PHYSICAL_MEDIA.)
ERROR_INVALID_STATE The object is already disabled.
ERROR_OBJECT_NOT_FOUND The object is not valid.
ERROR_SUCCESS The disable is queued.

Remarks

The DisableNtmsObject function queues a disable command for the specified object. The function returns successfully when the command is queued. If RSM is busy, the command can take some time to complete. When the medium is disabled, RSM renders all of the media's sides and associated logical media unavailable. All requests to disabled media return errors.

To remove a drive or media changer from service the drive or media changer must first be disabled.

All objects contained by a disabled object are also disabled. For example, disabling a piece of physical media disables all sides. Whenever possible, when a drive is disabled, the medium in the drive is removed and placed in its slot.

Requirements

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

See Also

Object Management Functions, EnableNtmsObject