IHolder::AllocResource method

Allocates a resource from the inventory.

Syntax


HRESULT AllocResource(
  [in]  const RESTYPID ResTypId,
  [out]       RESID    *pResId
);

Parameters

ResTypId [in]

The type of resource to be allocated.

pResId [out]

A pointer to the location where the handle of the allocated resource is returned.

Return value

This method can return the following values.

Return codeDescription
S_OK

The method completed successfully.

E_INVALIDARG

ResTypId is NULL or an empty string, or the Resource Dispenser's IDispenserDriver::CreateResource method generated an empty or duplicate RESID.

E_FAIL

The method failed. The pResId parameter has not been set. The likely cause is that the caller's transaction is aborting.

 

Remarks

The Dispenser Manager takes the following steps to locate a resource:

  1. Searches the pool for a free resource of this RESTYPID, which is already enlisted in the caller's current transaction.
  2. Searches the pool for a free unenlisted resource of this RESTYPID, and then enlists it in the caller's current transaction.
  3. Creates the resource by calling back to the Resource Dispenser's IDispenserDriver::CreateResource method, and then enlists it.

If the caller does not have a current transaction, the enlistment is skipped. Or if the Resource Dispenser rejects the enlistment (meaning the resource is not transaction capable), the enlistment is skipped.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

ComSvcs.h

See also

IDispenserDriver
IDispenserManager
IHolder

 

 

Community Additions

ADD
Show: