Platform SDK: Removable Storage Manager

CreateNtmsMediaPool

The CreateNtmsMediaPool function creates a new application media pool.

DWORD WINAPI CreateNtmsMediaPool(
  HANDLE hSession, 
  LPCTSTR lpPoolName,
  LPNTMS_GUID lpMediaType,
  DWORD dwAction,
  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  LPNTMS_GUID lpPoolId
);

Parameters

hSession
Handle to the session returned by the OpenNtmsSession function.
lpPoolName
Specifies the name of the new media pool. Media pool names must be unique within the scope of a single RSM database.
lpMediaType
Specifies the type of media in this media pool. Use the EnumerateNtmsObject function to get a list of available media types and their attributes. The application can pass a NULL pointer to create a media pool that only contains other media pools.
dwAction
This parameter must be one of the following values.
Value Meaning
NTMS_OPEN_EXISTING Opens an existing media pool by name. Returns ERROR_INVALID_PARAMETER if the pool does not exist.
NTMS_OPEN_ALWAYS Opens an existing media pool or creates the pool if it does not exist.
NTMS_CREATE_NEW Creates a new media pool. Returns ERROR_ALREADY_EXISTS if the pool exists.

lpSecurityAttributes
Optional. Specifies the security descriptor used to restrict access to the pool.
lpPoolId
Pointer to the unique identifier where the media pool ID is returned after the media pool is successfully created or opened.

Return Values

Value Meaning
ERROR_ACCESS_DENIED NTMS_MODIFY_ACCESS to the parent media pool is denied while trying to create a new media pool.
ERROR_ALREADY_EXISTS Unable to create a new media pool because one already exists with this name.
ERROR_DATABASE_FAILURE The database is inaccessible or damaged.
ERROR_DATABASE_FULL The database is full. Other security errors are also possible, but they would indicate a security subsystem error.
ERROR_INVALID_HANDLE The session handle is invalid or missing.
ERROR_INVALID_MEDIA The selected media type is not valid.
ERROR_INVALID_NAME The pool name syntax is invalid. (The name is too long.)
ERROR_INVALID_PARAMETER The media pool name or media pool ID pointer is missing.
ERROR_OBJECT_NOT_FOUND Unable to open existing media pool.
ERROR_SUCCESS The function was successful.

Remarks

Free, Unrecognized, and Import media pools are created by RSM and cannot be created with the CreateNtmsMediaPool function.

RSM media pools are organized as a hierarchy separated by the "\" character. Application, Free, Unrecognized, and Import media pools exist at the root of the hierarchy. RSM creates and manages the Free, Unrecognized, and Import pools. RSM creates a Free media pool for each media type available.

Application-specific media pools are created by applications. Applications create media pools for their own use under the root application pool. These media pools have file system-like names. Only the end-point 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; first MyApp and then Pool1 and Pool2, much like folders and files.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Ntmsapi.h.
  Library: Use Ntmsapi.lib.

See Also

Media Services Functions, AllocateNtmsMedia, DeleteNtmsMediaPool, GetNtmsObjectSecurity, SetNtmsObjectSecurity