<div class="content"><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>
  <p>0x00000000</p>
  <p>S_OK</p>
  </td>
  <td>
  <p>The call was successful.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070005</p>
  <p>ERROR_ACCESS_DENIED</p>
  </td>
  <td>
  <p>Access to at least one object is denied.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070006</p>
  <p>ERROR_INVALID_HANDLE</p>
  </td>
  <td>
  <p>The session handle is invalid.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070008</p>
  <p>ERROR_NOT_ENOUGH_MEMORY</p>
  </td>
  <td>
  <p>Not enough storage is available to process this
  command.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070057</p>
  <p>ERROR_INVALID_PARAMETER</p>
  </td>
  <td>
  <p>The parameter is incorrect.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x800710CD</p>
  <p>ERROR_INVALID_LIBRARY</p>
  </td>
  <td>
  <p>The library is not found in the database.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x800710D1</p>
  <p>ERROR_LIBRARY_OFFLINE</p>
  </td>
  <td>
  <p>The library must be online for a cleaner cartridge to
  be inserted.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x800710D5</p>
  <p>ERROR_RESOURCE_DISABLED</p>
  </td>
  <td>
  <p>A resource required for this operation is disabled.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x800710DF</p>
  <p>ERROR_DEVICE_NOT_AVAILABLE</p>
  </td>
  <td>
  <p>The library is not connected.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x800710EC</p>
  <p>ERROR_CLEANER_SLOT_NOT_SET</p>
  </td>
  <td>
  <p>A cleaner <a href="8d988f06-72be-47cf-9e09-9060aa8ed897#gt_a1f0ab90-f3c0-46b8-9c77-d0d7508ede94" data-linktype="relative-path">slot</a> is not reserved.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x8007138E</p>
  <p>ERROR_RESOURCE_NOT_AVAILABLE</p>
  </td>
  <td>
  <p>The reserved slot is not empty.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070032</p>
  <p>ERROR_NOT_SUPPORTED</p>
  </td>
  <td>
  <p>The <b>dwaction</b> field is set to NTMS_INJECT_STOP,
  but there are no library ports.</p>
  </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>
  <p>NTMS_INJECT_START</p>
  </td>
  <td>
  <p>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 <a href="8d988f06-72be-47cf-9e09-9060aa8ed897#gt_38cb8216-53ff-4936-a5c4-4d8d7672950a" data-linktype="relative-path">inventory</a> is performed on
  the library.</p>
  </td>
 </tr><tr>
  <td>
  <p>NTMS_INJECT_STOP</p>
  </td>
  <td>
  <p>For libraries with NTMS_IEPORT objects, terminates the
  insertion process that is specified by <i>lpEjectOperation</i> prior to the
  time-out event lapsing. For libraries without NTMS_IEPORT objects, the server
  MUST return ERROR_INVALID_OPERATION.</p>
  </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>