DtcGetTransactionManager

DtcGetTransactionManager is usually the first MS DTC procedure that you call when you use MS DTC. It establishes the initial connection and obtains an interface to MS DTC. It is not necessary to call CoInitialize or OleInitialize before calling DtcGetTransactionManager.

Calls to DtcGetTransactionManager can specify a host name in the pszHost parameter. This allows transactions to be started and coordinated on a specific computer on the network. If the pszHost parameter is NULL, these rules determine where transactions are started and coordinated:

  1. If the application that calls DtcGetTransactionManager is located on a system on which the complete MS DTC service has been installed, then the local MS DTC starts and coordinates the transactions.
  2. If the application that calls DtcGetTransactionManager is located on a Windows 95 system or on a Windows NT system on which only the MS DTC client utilities were installed, then the default MS DTC starts and coordinates the transactions. The default MS DTC is specified by using the MS DTC Client Configuration program in Control Panel and is recorded in the system registry. For information about the MS DTC Client Configuration program, see Configuring the MS DTC Client Utility in Chapter 2, "Setup."

Syntax

HRESULT DtcGetTransactionManager (
LPTSTR pszHost,
LPTSTR pszTmName,
REFIID riid,
DWORD dwReserved1,
WORD wcbVarLenReserved2,
void* pvVarDataReserved2,
void** ppv );

where

pszHost
[in] Is the name of the host system that will serve as the transaction commit coordinator.
pszTmName
[in] Is the string name of the transaction manager that will serve as the transaction commit coordinator. Must be NULL.
riid
[in] Is the IID of the requested interface. Usually this is IID_ITransactionDispenser.
dwReserved1
[in] Is reserved. Must be zero.
wcbVarLenReserved2
[in] Is reserved. Must be zero.
pvVarDataReserved2
[in] Is reserved. Must be NULL.
ppv
[out] Is the pointer to the pointer to the requested interface.

Returns

S_OK
Indicates succeeded.
E_NOINTERFACE
Indicates unable to provide the requested interface.
E_UNEXPECTED
Indicates an unexpected error has occurred.
E_INVALIDARG
Indicates one or more arguments are invalid.
E_FAIL
Indicates failed.