[This is preliminary documentation and subject to change.]
The AllocateNtmsMedia function allocates a piece of available media.
DWORD WINAPI AllocateNtmsMedia(
HANDLE hSession,
LPNTMS_GUID lpMediaPool,
LPNTMS_GUID lpPartition,
LPNTMS_GUID lpMediaId,
DWORD dwOptions,
DWORD dwTimeout
);
Value | Meaning |
---|---|
NTMS_ALLOCATE_ERROR_IF_UNAVAILABLE | Prevents the submission of an operator request for new media if none can be allocated with the specified constraints. |
NTMS_ALLOCATE_NEW | Allocates a partition of the specified medium that cannot be shared with another application's logical media. For example, this value reserves the second side of two-sided optical media. |
NTMS_ALLOCATE_NEXT | Allocate the next partition of the multipartitioned medium previously allocated with the NTMS_ALLOCATE_NEW value. This allows a single application to use both partitions of a piece of two-sided media and ensure that the application owns all the data on the piece of physical media. If all the partitions of the medium are already allocated, the allocation request fails. |
Only application pools may be specified for allocation using the AllocateNtmsMedia function.
The AllocateNtmsMedia function returns an LMID. Depending upon the media pool's policy, if the specified media pool does not contain any online Available media, AllocateNtmsMedia might search the scratch media pool for the specified medium to move to the specified media pool. Media from the designated media pool is allocated first, and then the scratch media is moved and allocated.
If the media pool contains any online Available media, a medium from the pool is allocated.
If the media pool is configured to allocate media from the scratch pool automatically, and the scratch pool contains online Available media, a medium is moved to the specified pool and allocated.
When the NTMS_ALLOCATE_NEXT value is specified, the lpMediaId parameter must point to a valid media ID at the time of invocation. In this case, lpMediaId is used as an IN and OUT parameter. The next partition of the multiple partitioned (sided) medium specified by lpMediaId is allocated, and the new partition ID is returned through lpMediaId (overwriting the original media ID passed in).
If NTMS_ALLOCATE_ERROR_IF_UNAVAILABLE is specified, ERROR_MEDIA_ UNAVAILABLE is returned if no media is available.
When necessary, RSM generates an operator request to insert new or Available media. If the time specified in the dwTimeout parameter elapses before the operator request is handled, RSM returns ERROR_TIMEOUT and deletes the operator request.
If the user cancels the allocation request, RSM returns ERROR_CANCELLED.
If a user indicates that the operator request has been satisfied, the request is deleted and RSM retries the process. The following steps describe how to allow media to be imported into RSM:
Note For two-sided media the flip side remains in the Import state and is not available for use until imported.
Windows NT: Requires version 5.0 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in ntmsapi.h.
Import Library: Use ntmsapi.lib.
Media Services Functions, DeallocateNtmsMedia