InjectNtmsMedia function (ntmsapi.h)
[Removable Storage Manager is no longer available as of Windows 7 and Windows Server 2008 R2.]
The InjectNtmsMedia function allows media to be inserted into the port of the specified library. If the library is busy, RSM queues InjectNtmsMedia and returns success.
Syntax
DWORD InjectNtmsMedia(
[in] HANDLE hSession,
[in] LPNTMS_GUID lpLibraryId,
[out] LPNTMS_GUID lpInjectOperation,
[in] DWORD dwAction
);
Parameters
[in] hSession
Handle to the session returned by the OpenNtmsSession function.
[in] lpLibraryId
Unique identifier of a library object.
[out] lpInjectOperation
GUID of the insert library operation. If dwAction is NTMS_INJECT_START, this parameter receives the GUID for the operation. If dwAction is NTMS_INJECT_STOP, this parameter must be set to the GUID for the operation to be stopped.
[in] dwAction
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 action was performed on an operation ID that was not valid. |
|
The library ID or operation ID pointer is missing. |
|
The library ID refers to an offline library that cannot eject media. |
|
There was an allocation failure during processing. |
|
The insert is queued. |
Remarks
This function returns to the application as soon as the insert request is queued.
If the library specified by the InjectNtmsMedia function does not have a port, use the AccessNtmsLibraryDoor function to insert and eject media.
This function cannot be used with the offline library.
Insert begins the process of inserting media into a library. Because libraries vary on the functionality of the NTMS_IEPORT object, each device may operate slightly differently. The following steps describe how RSM generally handles an inject:
To insert media into a library
- Allow/unlock/extend the NTMS_IEPORT.
- Poll for a full NTMS_IEPORT, a retracted NTMS_IEPORT, a Stop Inject command, or a time-out value. If none of these have occurred, continue to wait. (Multi-cartridge insert/eject ports are not scanned for full status.)
- When one of the preceding events occurs, the NTMS_IEPORT is locked, each medium in the NTMS_IEPORT is moved to a slot, and an identify medium command is queued for each medium.
If there are no free slots, the InjectNtmsMedia function receives an error.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | ntmsapi.h |
Library | Ntmsapi.lib |
DLL | Ntmsapi.dll |