Поделиться через


IResourceManagerFactory::Create

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The Create method is used to create a resource manager object.

Syntax

  
HRESULT Create(   GUID * pguidRM,  CHAR * pszRMName,  IResourceManagerSink * pIResMgrSink,  IResourceManager ** ppResMgr);  

Parameters

pguidRM
[in] A UUID that uniquely identifies this resource manager.

pszRMName
[in] A string name that identifies this resource manager.

pIResMgrSink
[in] Pointer to the resource manager's IResourceManagerSink interface. The resource manager developer must implement the TMDown method on this interface.

ppResMgr
[out] Pointer to the pointer to the IResourceManager interface on the resource manager object.

Return Values

S_OK
Success.

E_NOINTERFACE
Requested interface is not available.

E_OUTOFMEMORY
Unable to allocate memory.

XACT_E_TMNOTAVAILABLE
Unable to connect to the transaction manager.

XACT_E_CONNECTION_DOWN
Connection with the transaction manager was lost.

XACT_E_CONNECTION_DENIED
The transaction manager refused to accept a connection.

XACT_E_DUPLICATE_GUID
There is already a resource manager connected to the transaction manager with the same GUID as was passed in pguidRM.

E_UNEXPECTED
An unexpected error has occurred.

Remarks

The resource manager object represents the connection between the resource manager and the transaction manager. The resource manager object supports the IResourceManager interface that the resource manager uses to enlist in transactions and to perform transaction recovery.

A resource manager typically invokes the IResourceManagerFactory::Create method when the resource manager first starts. By doing this, the resource manager registers itself with the transaction manager. The resource manager retains the resource manager object until it no longer needs the services of the transaction manager. It then releases the IResourceManager interface. This ends the connection with the transaction manager. A resource manager typically retains the transaction manager connection until the resource manager stops.

If the connection between the transaction manager and the resource manager fails, the DTC proxy invokes the resource manager's TMDown method. This callback informs the resource manager that its transaction manager connection has failed. The resource manager must invoke the Create method again to reregister with the transaction manager and perform recovery.

Requirements

For an explanation of the requirement values, see Requirements (Component Services).

Platforms: Windows Server 2016, Windows 10, Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista

Header: Declared in txdtc.h