网站首页  词典首页

请输入您要查询的函数:

 

术语 allocatentmsmedia
释义 AllocateNtmsMedia
语法:
C++
DWORD AllocateNtmsMedia(
__in HANDLE hSession,
__in LPNTMS_GUID lpMediaPool,
__in LPNTMS_GUID lpPartId,
__out LPNTMS_GUID lpMediaId,
__in DWORD dwOptions,
__in DWORD dwTimeout,
__out LPNTMS_ALLOCATION_INFORMATION lpAllocateInformation
);
AllocateNtmsMedia功能
[移动存储管理不再作为Windows 7和Windows服务器2008 R2提供。]
该AllocateNtmsMedia函数分配一个可用的媒体上。
参数
hSession [in]
处理由OpenNtmsSession函数返回的会议。
lpMediaPool [in]
唯一标识符媒体库,这个媒体分配。只有应用程序池可以指定分配。
lpPartId [in]
一部分方标识符用作逻辑媒体标识符(LMID)。该方必须在现有的或import 国。此功能可用于分配特定的import 方或媒体。此参数是可选的。
lpMediaId [out]
LMID的分配中。此参数为NULL,如果媒介不能分配。
dwOptions [in]
选项。此参数可以是一个或多个下列值。
ValueMeaning
NTMS_ALLOCATE_ERROR_IF_UNAVAILABLEPrevents的,如果没有一个可以与指定的限制,分配新媒体运营商提出请求。
NTMS_ALLOCATE_NEWAllocates一个指定的媒介,不能与其他应用程序的逻辑媒体共享的一面。例如,此值保留两个第二面双面光学媒体。
NTMS_ALLOCATE_NEXTAllocate的下侧的多面以前与NTMS_ALLOCATE_NEW价值的分配中。这使得一个应用程序同时使用了两片双方双面媒体,并确保应用程序拥有的所有的物理媒体上的数据。
如果所有的中期双方已分配,分配请求失败。
dwTimeout [in]
时间允许的最大分配指定的媒体,以毫秒为单位。如果此参数是无限的,该函数将不超时。如果此参数为0,它就会等待媒体。请注意,此函数不会队列更多媒体的要求,如果dwOptions参数指定NTMS_ALLOCATE_ERROR_IF_UNAVAILABLE。
lpAllocateInformation [out]
指针的NTMS_ALLOCATION_INFORMATION结构得到源媒体库,这个被媒介。此参数可以为NULL。
返回值
这个函数返回下列值之一。
ValueMeaning
ERROR_ACCESS_DENIEDNTMS_CONTROL_ACCESS媒体的媒体池被拒绝。其他安全的错误也是可能的,但它们都将意味着安全子系统的错误。
Windows XP/2000操作系统:媒体的媒体池NTMS_MODIFY_ACCESS被拒绝。
ERROR_CANCELLEDThe经营者取消了对新媒体的要求。
ERROR_DATABASE_FAILUREThe数据库无法访问或已损坏。
ERROR_DATABASE_FULLThe数据库已满。
ERROR_DEVICE_NOT_AVAILABLEAn中间资源不可用,例如,空闲媒体池中不可用。
ERROR_INVALID_HANDLEThe会话句柄丢失或无效。
ERROR_INVALID_MEDIAThe分区ID或LMID并不取决于输入有效时,使用NTMS_ALLOCATE_NEXT标志。
ERROR_INVALID_MEDIA_POOLThe媒体池ID是无效的。
ERROR_INVALID_PARAMETERThe媒体或媒体池中ID丢失。
ERROR_MEDIA_OFFLINEThe指定媒体离线,无法分配。
ERROR_MEDIA_UNAVAILABLENo媒体已分配在指定时间内的赛事。
ERROR_NOT_ENOUGH_MEMORYThere是在处理过程中分配失败。
ERROR_SUCCESSThe功能是成功的。
ERROR_TIMEOUTThe超时事件之前到期的媒体提供。
备注
该AllocateNtmsMedia函数返回一个LMID。取决于媒体池的政策,如果池指定的媒体不包含任何网络可用的媒体,AllocateNtmsMedia可以搜索指定的媒介自由的媒体池移动到指定的媒体池中。从指定的媒体池分配,首先是媒体,然后媒体自由移动和分配。
如果媒体池包含任何可用的媒体网络,从池中分配中。
如果媒体池配置分配从空闲池自动媒体和自由池包含线上可用的媒体,一辆中型移动到指定的池和分配。
Windows Server 2003的:如果媒体正在从空闲池,NTMS_USE_ACCESS的空闲池和NTMS_CONTROL_ACCESS到目的地池分配是必要的。如果不是免费的池源媒体池,NTMS_CONTROL_ACCESS是在来源国和目的地池需要。
当NTMS_ALLOCATE_NEXT指定值,该lpMediaId参数必须指向一个有效的介质ID在调用的时间。在这种情况下,lpMediaId是使用了IN和OUT参数的。的多重片面lpMediaId指定的媒介旁一边是分配,新的分区ID通过lpMediaId返回(覆盖的ID通过原始媒体)。
如果NTMS_ALLOCATE_ERROR_IF_UNAVAILABLE指定,ERROR_MEDIA_不可用状态,则返回,如果没有可用的媒体。
必要时,罗申生成的操作员请求插入新的或可用的媒体。如果在dwTimeout参数经过的指定经营者的要求之前,处理的时间,罗申返回ERROR_TIMEOUT和删除的操作员请求。
如果用户取消分配请求,罗申返回ERROR_CANCELLED。
如果用户表明,经营者的要求得到满足,该请求被删除,丹参试的过程。
当应用程序需要新的媒体控制数据,用户或管理员的地方在库或驱动器的媒体。丹参标识和地方媒体在import 的游泳池。搜索应用程序池的import ,移动媒体的应用程序池和分配它。此例程过程可以简化并通过单个原子调用AllocateNtmsMedia。搜索导入后池的应用程序可以调用AllocateNtmsMedia,通过分区的ID作为lpPartId参数值的一面。丹参然后:
移动到池中指定媒体媒介。
改变了媒体的状态分配。
返回LMID。
注意: For two-sided media, the flip side remains in the Import state and is not available for use until imported。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
客户端 支持 Windows Vista
服务器 支持 Windows Server 2008
HeaderNtmsapi.h
LibraryNtmsapi.lib
DLLNtmsapi.dll
参见
媒体服务函数
DeallocateNtmsMedia
NTMS_ALLOCATION_INFORMATION
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==AllocateNtmsMedia Function
[ Removable Storage Manager is no longer available as of Windows 7 and Windows Server 2008 R2.]
The AllocateNtmsMedia function allocates a piece of available media.
Syntax
C++
DWORD AllocateNtmsMedia(
__in HANDLE hSession,
__in LPNTMS_GUID lpMediaPool,
__in LPNTMS_GUID lpPartId,
__out LPNTMS_GUID lpMediaId,
__in DWORD dwOptions,
__in DWORD dwTimeout,
__out LPNTMS_ALLOCATION_INFORMATION lpAllocateInformation
);
Parameters
hSession [in]
Handle to the session returned by the OpenNtmsSession function.
lpMediaPool [in]
Unique identifier of the media pool from which the media is to be allocated. Only application pools may be specified for allocation.
lpPartId [in]
Part identifier of a side to use as a logical media identifier (LMID). The side must be in the Available or Import state. This feature can be used to allocate a particular side or to import media. This parameter is optional.
lpMediaId [out]
LMID of the allocated medium. This parameter is NULL if the medium cannot be allocated.
dwOptions [in]
Options. This parameter can be one or more of the following values.
ValueMeaning
NTMS_ALLOCATE_ERROR_IF_UNAVAILABLEPrevents the submission of an operator request for new media if none can be allocated with the specified constraints.
NTMS_ALLOCATE_NEWAllocates a side 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_NEXTAllocate the next side of the multi-sided medium previously allocated with the NTMS_ALLOCATE_NEW value. This allows a single application to use both sides 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 sides of the medium are already allocated, the allocation request fails.

dwTimeout [in]
Maximum time allowed to allocate the specified media, in milliseconds. If this parameter is INFINITE, the function will not time out. If this parameter is zero, it will wait for media. Note that this function does not queue a request for more media if the dwOptions parameter specifies NTMS_ALLOCATE_ERROR_IF_UNAVAILABLE.
lpAllocateInformation [out]
Pointer to an NTMS_ALLOCATION_INFORMATION structure that receives the source media pool from which the medium was taken. This parameter can be NULL.
Return Value
This function returns one of the following values.
ValueMeaning
ERROR_ACCESS_DENIEDNTMS_CONTROL_ACCESS to the media's media pool is denied. Other security error are also possible, but they would indicate a security subsystem error.
Windows XP/2000: NTMS_MODIFY_ACCESS to media's media pool is denied.
ERROR_CANCELLEDThe operator canceled the request for new media.
ERROR_DATABASE_FAILUREThe database is inaccessible or damaged.
ERROR_DATABASE_FULLThe database is full.
ERROR_DEVICE_NOT_AVAILABLEAn intermediate resource is not available; for example, the free media pool is not available.
ERROR_INVALID_HANDLEThe session handle is missing or is not valid.
ERROR_INVALID_MEDIAThe partition ID or LMID was not valid upon input when using the NTMS_ALLOCATE_NEXT flag.
ERROR_INVALID_MEDIA_POOLThe media pool ID is not valid.
ERROR_INVALID_PARAMETERThe media or media pool ID is missing.
ERROR_MEDIA_OFFLINEThe specified media is offline and cannot be allocated.
ERROR_MEDIA_UNAVAILABLENo media has been allocated within the specified time-out event.
ERROR_NOT_ENOUGH_MEMORYThere was an allocation failure during processing.
ERROR_SUCCESSThe function was successful.
ERROR_TIMEOUTThe time-out event expired before media was available.

Remarks
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 free 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 free 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 free pool automatically, and the free pool contains online Available media, a medium is moved to the specified pool and allocated.
Windows Server 2003: If media is being allocated from the free pool, NTMS_USE_ACCESS to the free pool and NTMS_CONTROL_ACCESS to the destination pool is required. If the free pool is not the source media pool, NTMS_CONTROL_ACCESS is required on both source and destination pools.
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 side of the multiple 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.
When an application requires new media containing data, a user or administrator places the media in a library or drive. RSM identifies the media and places it in the import pool. The application searches the import pool, moves the media to its application pool and allocates it. This routine process can be streamlined and made atomic through a single call to AllocateNtmsMedia. After searching the import pool the application can call AllocateNtmsMedia, passing the partition ID of the side as the value of the lpPartId parameter. RSM then:
moves the medium to the specified media pool.
changes the media's state to allocated.
returns an LMID.
Note For two-sided media, the flip side remains in the Import state and is not available for use until imported.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
End of client supportWindows Vista
End of server supportWindows Server 2008
HeaderNtmsapi.h
LibraryNtmsapi.lib
DLLNtmsapi.dll
See Also
Media Services Functions
DeallocateNtmsMedia
NTMS_ALLOCATION_INFORMATION
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/bb525472(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:32:28