<div class="content" name="CreateNtmsMediaPoolW" uuid="8fee4630-01e3-4961-8837-93ec17044a50"><p>The CreateNtmsMediaPoolW method creates a new application
media pool whose name is composed of a sequence of Unicode characters.</p><dl>
<dd>
<div><pre> HRESULT CreateNtmsMediaPoolW(
   [in, string] const wchar_t* lpPoolName,
   [in, unique] LPNTMS_GUID lpMediaType,
   [in] DWORD dwOptions,
   [in, unique] LPSECURITY_ATTRIBUTES_NTMS lpSecurityAttributes,
   [out] LPNTMS_GUID lpPoolId
 );
</pre></div>
</dd></dl><p><b>lpPoolName: </b>A null-terminated sequence of
Unicode characters, encoded using UTF-16, that constitute the name of the new
media pool; MUST be unique among all the media pools present in the server. </p><p><b>lpMediaType: </b>Pointer to a unique identifier
for the type of media in this media pool. <a href="f520a2b0-0881-48e6-b04a-cd0fb65673b1" data-linktype="relative-path">INtmsObjectManagement1::EnumerateNtmsObject</a>
produces a list of available media types and their attributes. Use of a NULL
pointer creates a media pool that contains only other media pools. </p><p><b>dwOptions: </b>A value from the <a href="0ec8abd1-13f8-418a-9e3f-ad952d3d2c60" data-linktype="relative-path">NtmsCreateOptions (section 2.2.3.2)</a>
enumeration specifying the type of creation to undertake.</p><p><b>lpSecurityAttributes: </b>A pointer to an optional
<a href="0fe90884-8ec6-4076-b8d3-831821fc094d" data-linktype="relative-path">SECURITY_ATTRIBUTES_NTMS (section 2.2.3.5)</a>
structure used to restrict access to the pool.</p><p><b>lpPoolId: </b>A pointer to the identifier of the
new media pool.</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>NTMS_MODIFY_ACCESS to the library is denied; other security errors are possible, but indicate a security subsystem error.</td>
 </tr><tr>
  <td>0x80070057 ERROR_INVALID_PARAMETER</td>
  <td>The media pool name or identifier is missing.</td>
 </tr><tr>
  <td>0x8007007B ERROR_INVALID_NAME</td>
  <td>The pool name syntax is invalid or the name is too long.</td>
 </tr><tr>
  <td>0x800700B7 ERROR_ALREADY_EXISTS</td>
  <td>A new media pool could not be created because one already exists with this name.</td>
 </tr><tr>
  <td>0x800710CC ERROR_INVALID_MEDIA</td>
  <td>The selected media type is not valid.</td>
 </tr><tr>
  <td>0x800710D8 ERROR_OBJECT_NOT_FOUND</td>
  <td>Unable to open an existing media pool.</td>
 </tr><tr>
  <td>0x800710D9 ERROR_DATABASE_FAILURE</td>
  <td>The database is inaccessible or damaged.</td>
 </tr><tr>
  <td>0x800710DA ERROR_DATABASE_FULL</td>
  <td>The database is full; other security errors are possible, but indicate a security subsystem error.</td>
 </tr></tbody></table>
</dd></dl><p>Upon receiving this message, the server MUST verify that <i>lpPoolName</i>,
<i>lpMediaType</i>, and <i>lpPoolId</i> are not NULL. If parameter validation
fails, the server MUST immediately fail the operation and return
ERROR_INVALID_PARAMETER (0x80070057).</p><p>If parameter validation succeeds, the server MUST verify
that the user has the required access rights, and check whether <i>lpPoolName</i>
is present. If the client does not have the required access rights, the server
MUST return ERROR_ACCESS_DENIED (0x80070005).</p><p>If the media pool specified by <i>lpPoolName</i> is present,
and <i>dwOptions</i> is not set to NTMS_CREATE_NEW, the server MUST open the
existing media pool and return success.</p><p>If the media pool specified by <i>lpPoolName</i> is present,
and <i>dwOptions</i> is set to NTMS_CREATE_NEW, the server MUST return
ERROR_ALREADY_EXISTS (0x800700B7).</p><p>If the media pool specified by <i>lpPoolName</i> is not present,
and the parent media pool of <i>lpPoolName</i> is also not present, the server
MUST return ERROR_OBJECT_NOT_FOUND (0x800710D8).</p><p>If the media Pool that is specified by <i>lpPoolName</i> is
not present, and the parent media pool of <i>lpPoolName</i> is present, the
server MUST create a new pool under the parent pool, open the newly created
media pool, and return success.</p><p>Application-specific media pools are created by
applications. Applications create media pools for their own use under the root <a href="8d988f06-72be-47cf-9e09-9060aa8ed897#gt_15b985cc-5c71-4573-873a-275218a37a3d" data-linktype="relative-path">application pool</a>. These
media pools have names like those of file systems. Only the <a href="8d988f06-72be-47cf-9e09-9060aa8ed897#gt_b91c1e27-e8e0-499b-8c65-738006af72ee" data-linktype="relative-path">endpoint</a> of the name
contains media and policy. An application can define pools such as \MyApp\Pool1
and \MyApp\Pool2. This conveys the hierarchy to the user interface and avoids
duplicate names. Each pool level MUST be created individually; for example,
first MyApp and then Pool1 and Pool2, in much the same way as folders and files.</p><p>Strings sent to this method as parameters MUST be
Unicode-encoded.</p></div>