<div class="content" name="InjectNtmsCleaner" uuid="a494b127-3aa5-4b49-9cf3-1254f81da079"><p>The InjectNtmsCleaner method allows a <a href="8d988f06-72be-47cf-9e09-9060aa8ed897#gt_95e53eb6-39e3-43ed-905e-ff1f427446d2" data-linktype="relative-path">cleaner</a> <a href="8d988f06-72be-47cf-9e09-9060aa8ed897#gt_a71cfd0c-a569-4544-8127-7ae496bca92b" data-linktype="relative-path">cartridge</a> to be inserted
into an online library unit.</p><dl>
<dd>
<div><pre> HRESULT InjectNtmsCleaner(
   [in] LPNTMS_GUID lpLibrary,
   [in, out] LPNTMS_GUID lpInjectOperation,
   [in] DWORD dwNumberOfCleansLeft,
   [in] DWORD dwAction
 );
</pre></div>
</dd></dl><p><b>lpLibrary: </b>A pointer to the identifier of the
media library into which the cleaner will be inserted.</p><p><b>lpInjectOperation: </b>A pointer to the GUID of
the insert process library operation. If the value of <b>dwAction</b> is
NTMS_INJECT_START, this parameter receives the GUID for the operation from
server; if the value of <b>dwAction</b> is NTMS_INJECT_STOP, this parameter
must be set to the GUID of the operation to be stopped.</p><p><b>dwNumberOfCleansLeft: </b>The number of cleaning
cycles remaining on the cleaning media.</p><p><b>dwAction: </b>One of the NTMS_INJECT_START or
NTMS_INJECT_STOP values from the <a href="ae6eb3ea-8929-4ba6-870f-7f118c7301cc" data-linktype="relative-path">NtmsInjectOperation</a>
enumeration, specifying the operation to perform.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000 S_OK</td>
  <td>The call was successful.</td>
 </tr><tr>
  <td>0x80070005 ERROR_ACCESS_DENIED</td>
  <td>Access to at least one object is denied.</td>
 </tr><tr>
  <td>0x80070006 ERROR_INVALID_HANDLE</td>
  <td>The session handle is invalid.</td>
 </tr><tr>
  <td>0x80070008 ERROR_NOT_ENOUGH_MEMORY</td>
  <td>Not enough storage is available to process this command.</td>
 </tr><tr>
  <td>0x80070057 ERROR_INVALID_PARAMETER</td>
  <td>The parameter is incorrect.</td>
 </tr><tr>
  <td>0x800710CD ERROR_INVALID_LIBRARY</td>
  <td>The library is not found in the database.</td>
 </tr><tr>
  <td>0x800710D1 ERROR_LIBRARY_OFFLINE</td>
  <td>The library must be online for a cleaner cartridge to be inserted.</td>
 </tr><tr>
  <td>0x800710D5 ERROR_RESOURCE_DISABLED</td>
  <td>A resource required for this operation is disabled.</td>
 </tr><tr>
  <td>0x800710DF ERROR_DEVICE_NOT_AVAILABLE</td>
  <td>The library is not connected.</td>
 </tr><tr>
  <td>0x800710EC ERROR_CLEANER_SLOT_NOT_SET</td>
  <td>A cleaner slot is not reserved.</td>
 </tr><tr>
  <td>0x8007138E ERROR_RESOURCE_NOT_AVAILABLE</td>
  <td>The reserved slot is not empty.</td>
 </tr><tr>
  <td>0x80070032 ERROR_NOT_SUPPORTED</td>
  <td>The dwaction field is set to NTMS_INJECT_STOP, but there are no library ports.</td>
 </tr></tbody></table>
</dd></dl><p>Upon receiving this message, the server MUST verify that
both <i>lpLibrary</i> and <i>lpInjectOperation</i> are not NULL. If parameter
validation fails, the server MUST fail the operation immediately and return
ERROR_INVALID_PARAMETER (0x80070057).</p><p>If parameter validation succeeds, the server MUST check
access rights to the library and verify that the library is enabled and online
before processing further. If the client does not have the required access
rights, the server MUST return ERROR_ACCESS_DENIED (0x80070005). If the library
or drive is disabled, the server MUST return ERROR_RESOURCE_DISABLED (0x800710D5).
If the library is offline, the server MUST return ERROR_LIBRARY_OFFLINE
(0x800710D1).</p><p>The action taken by the server depends on the value of <i>dwAction</i>.
The following table lists all possible values for <i>dwAction</i>.</p><table><thead>
  <tr>
   <th>
   <p> Value </p>
   </th>
   <th>
   <p> Meaning </p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>NTMS_INJECT_START</td>
  <td>Start the insertion with either the NTMS_IEPORT or the NTMS_IEDOOR object. A single cleaner cartridge MUST be inserted. If the NTMS_IEDOOR object is used, no inventory is performed on the library.</td>
 </tr><tr>
  <td>NTMS_INJECT_STOP</td>
  <td>For libraries with NTMS_IEPORT objects, terminates the insertion process that is specified by lpEjectOperation prior to the time-out event lapsing. For libraries without NTMS_IEPORT objects, the server MUST return ERROR_INVALID_OPERATION.</td>
 </tr></tbody></table><p>The InjectNtmsCleaner method inserts the cleaner cartridge
in the reserved library slot. To use the InjectNtmsCleaner method, the number
of cleaning cycles that remain on the cleaner cartridge MUST be specified so
that the server can keep track of it.</p><p>On completion of an asynchronous operation, notification
will be sent with the identifier lpInjectOperation.</p></div>