EjectDiskFromSADriveA function (ntmsapi.h)
[Removable Storage Manager is no longer available as of Windows 7 and Windows Server 2008 R2.]
The EjectDiskFromSADrive function ejects the media that is in a standalone removable drive.
Syntax
DWORD EjectDiskFromSADriveA(
[in] LPCSTR lpComputerName,
[in] LPCSTR lpAppName,
[in] LPCSTR lpDeviceName,
[in] HWND hWnd,
[in] LPCSTR lpTitle,
[in] LPCSTR lpMessage,
[in] DWORD dwOptions
);
Parameters
[in] lpComputerName
Removable Storage Manager (RSM) server name. If this parameter is NULL, the current computer name is used.
[in] lpAppName
Unique character string that identifies the application. This name identifies resources and operator requests. This parameter is optional and may be NULL.
[in] lpDeviceName
Name of the device to eject. For example, \.\Cdrom0 or \.\PhysicalDriveX (where X is the number of the drive being accessed).
[in] hWnd
Handle to a dialog box window for user confirmation.
[in] lpTitle
Title displayed in a dialog box to get user input.
[in] lpMessage
Message displayed in a dialog box to get user input.
[in] dwOptions
Action to perform. This parameter can be one of the following values.
Return value
This function returns one of the following values.
Value | Meaning |
---|---|
|
NTMS_CONTROL_ACCESS to the library is denied. Other security errors are also possible, but they would indicate a security subsystem error. |
|
The database is inaccessible or damaged. |
|
The database is full. |
|
The library is disabled. |
|
The session ID is missing or is not valid. |
|
A stop was performed on an operation ID that was not valid. |
|
A library ID or operation ID pointer is missing. |
|
The library ID refers to an offline library that cannot eject media. |
|
The media is disabled. |
|
There was an allocation failure during processing. |
|
The eject operation was successful. |
Remarks
Although EjectNtmsMedia can, in some cases, be used to accomplish the same functionality, EjectDiskFromSADrive provides a convenient way to eject media from a standalone device, by specifying its drive name instead of its RSM name. In some cases it is the only way to overcome file system locks on the media in order to eject that media.
The EjectDiskFromSADrive function returns to the application as soon as the eject request is queued, unless NTMS_EJECT_IMMEDIATE option is specified.
Media ejected using the EjectDiskFromSADrive function is moved to the offline library or deleted from the database. Import media, unrecognized media, and incompatible media are deleted when ejected.
The EjectDiskFromSADrive function does not work with the offline library.
Note
The ntmsapi.h header defines EjectDiskFromSADrive as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | ntmsapi.h |
Library | Ntmsapi.lib |
DLL | Ntmsapi.dll |