IHolder::AllocResource method (comsvcs.h)

Allocates a resource from the inventory.

Syntax

HRESULT AllocResource(
  [in]  const RESTYPID __MIDL__IHolder0000,
  [out] RESID          *__MIDL__IHolder0001
);

Parameters

[in] __MIDL__IHolder0000

The type of resource to be allocated.

[out] __MIDL__IHolder0001

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

Return value

This method can return the following values.

Return code Description
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

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header comsvcs.h

See also

IDispenserDriver

IDispenserManager

IHolder