CreateNtmsMediaPoolW function (ntmsapi.h)
[Removable Storage Manager is no longer available as of Windows 7 and Windows Server 2008 R2.]
The CreateNtmsMediaPool function creates a new application media pool.
Syntax
DWORD CreateNtmsMediaPoolW(
[in] HANDLE hSession,
[in] LPCWSTR lpPoolName,
[in] LPNTMS_GUID lpMediaType,
[in] DWORD dwAction,
[in] LPSECURITY_ATTRIBUTES lpSecurityAttributes,
[out] LPNTMS_GUID lpPoolId
);
Parameters
[in] hSession
Handle to the session returned by the OpenNtmsSession function.
[in] lpPoolName
Name of the new media pool. Media pool names must be unique within the scope of a single RSM database.
[in] lpMediaType
Identifier for 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 contains only other media pools.
[in] dwAction
Action to perform. This parameter must be one of the following values.
[in] lpSecurityAttributes
Optional security descriptor used to restrict access to the pool.
[out] lpPoolId
Pointer to a variable that receives the unique identifier of the media pool after the media pool is successfully created or opened.
Return value
This function returns one of the following values.
Value | Meaning |
---|---|
|
NTMS_CONTROL_ACCESS to the root pool or the parent media pool is denied while trying to create a new media pool. Other security errors are also possible, but they would indicate a security subsystem error.
Windows XP: NTMS_MODIFY_ACCESS to the parent media pool is denied while trying to create a new media pool. Other security errors are also possible, but they would indicate a security subsystem error. |
|
Unable to create a new media pool because one already exists with this name. |
|
The database is inaccessible or damaged. |
|
The database is full. Other security errors are also possible, but they would indicate a security subsystem error. |
|
The session handle is missing or is not valid. |
|
The selected media type is not valid. |
|
The pool name syntax is not valid. (The name is too long.) |
|
The media pool name or media pool ID pointer is missing. |
|
Unable to open existing media pool. |
|
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.
Windows Server 2003: To create a media pool, you must have NTMS_CONTROL_ACCESS to the root pool and parent pool. If a security descriptor is not provided, the pool inherits the ACEs of its parent pool (if the parent pool is not the root pool). In addition, the creator and local system accounts have full access to the pool. If the parent pool is the root pool, its ACEs are not inherited; the only ACEs in the DACL are full access for the creator and local system accounts.
Note
The ntmsapi.h header defines CreateNtmsMediaPool as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
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 |