' ########################################################################################
' Microsoft Windows
' File: xolehlp.inc
' Contents: DTC helper APIs used by RM's and application clients to obtain the
' transaction manager.
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_xolehlp_PBI)
#DEFINE PBX_xolehlp_PBI
%EQUATE `XOLEHLP_INC = 1
'/*----------------------------------------
'// Constants
'//--------------------------------------*/
%EQUATE `OLE_TM_CONFIG_VERSION_1 = 1
%EQUATE `OLE_TM_CONFIG_VERSION_2 = 2
' enum APPLICATIONTYPE
%EQUATE `LOCAL_APPLICATIONTYPE = 0
%EQUATE `CLUSTERRESOURCE_APPLICATIONTYPE = 1
%EQUATE `OLE_TM_FLAG_NONE = &H00000000
%EQUATE `OLE_TM_FLAG_NODEMANDSTART = &H00000001
'// If this flag is set, the application specifies that it does not wish
'// to take advantage of any features that need agile recovery
'// support.
'// As a consequence, the application will be restricted to
'// using the default transaction manager on a cluster.
%EQUATE `OLE_TM_FLAG_NOAGILERECOVERY = &H00000002
'// The following are flags used specifically for MSDTC.
%EQUATE `OLE_TM_FLAG_QUERY_SERVICE_LOCKSTATUS = &H80000000
%EQUATE `OLE_TM_FLAG_INTERNAL_TO_TM = &H40000000
'/*----------------------------------------
'// Structure definitions
'//--------------------------------------*/
' // Size = 8 bytes
TYPE OLE_TM_CONFIG_PARAMS_V1 DWORD
 dwVersion AS DWORD
 dwcConcurrencyHint AS DWORD
END TYPE
' // Size = 28 bytes
TYPE OLE_TM_CONFIG_PARAMS_V2 DWORD
 dwVersion AS DWORD
 dwcConcurrencyHint AS DWORD
 applicationType AS LONG ' APPLICATIONTYPE
 clusterResourceId AS GUID ' GUID
END TYPE
'/*----------------------------------------
'// Function Prototypes
'//--------------------------------------*/
'/*----------------------------------------
'//This API should be used to obtain an IUnknown or a ITransactionDispenser
'//interface from the Microsoft Distributed Transaction Coordinator's proxy.
'//Typically, a NULL is passed for the host name and the TM Name. In which
'//case the MS DTC on the same host is contacted and the interface provided
'//for it.
'//--------------------------------------*/
DECLARE FUNCTION DtcGetTransactionManager CDECL LIB "xolehlp.dll" ALIAS "DtcGetTransactionManager" ( BYREF i_pszHost AS ASCIIZ , BYREF i_pszTmName AS ASCIIZ , BYREF i_riid AS GUID , BYVAL i_dwReserved1 AS QUAD , BYVAL i_wcbReserved2 AS WORD , BYVAL i_pvReserved2 AS QUAD , BYREF o_ppvObject AS IUnknown ) AS LONG
DECLARE FUNCTION DtcGetTransactionManagerC CDECL LIB "xolehlp.dll" ALIAS "DtcGetTransactionManagerC" ( BYREF i_pszHost AS ASCIIZ
 , BYREF i_pszTmName AS ASCIIZ
 , BYREF i_riid AS GUID
 , BYVAL i_dwReserved1 AS DWORD
 , BYVAL i_wcbReserved2 AS WORD
 , BYVAL i_pvReserved2 AS DWORD
 , BYREF o_ppvObject AS IUnknown
 ) AS LONG
DECLARE FUNCTION DtcGetTransactionManagerExA CDECL LIB "xolehlp.dll" ALIAS "DtcGetTransactionManagerExA" ( BYREF i_pszHost AS ASCIIZ
 , BYREF i_pszTmName AS ASCIIZ
 , BYREF i_riid AS GUID
 , BYVAL i_grfOptions AS DWORD
 , BYVAL i_pvConfigParams AS DWORD
 , BYREF o_ppvObject AS IUnknown
 ) AS LONG
DECLARE FUNCTION DtcGetTransactionManagerExW CDECL LIB "xolehlp.dll" ALIAS "DtcGetTransactionManagerExW" ( BYREF i_pwszHost AS WSTRINGZ
 , BYREF i_pwszTmName AS WSTRINGZ
 , BYREF i_riid AS GUID
 , BYVAL i_grfOptions AS DWORD
 , BYVAL i_pvConfigParams AS DWORD
 , BYREF o_ppvObject AS IUnknown
 ) AS LONG
#IF %DEF(%UNICODE)
 MACRO DtcGetTransactionManagerEx = DtcGetTransactionManagerExW
#ELSE
 MACRO DtcGetTransactionManagerEx = DtcGetTransactionManagerExA
#ENDIF
'/*----------------------------------------
'// Define a CLSID that can be used to obtain a transaction manager instance via CoCreateInstance;
'// this is an alternate to using DtcGetTransactionManager.
'//
'// CLSID_MSDtcTransactionManager = {5B18AB61-091D-11D1-97DF-00C04FB9618A}
'//--------------------------------------*/
$CLSID_MSDtcTransactionManager = GUID$("{5B18AB61-091D-11D1-97DF-00C04FB9618A}")
'/*----------------------------------------
'// Define a CLSID that can be used with CoCreateInstance to instantiate a vanilla transaction
'// object with the local transaction manager. It's equivalent to doing
'//
'// pTransactionDispenser->BeginTransaction(NULL, ISOLATIONLEVEL_UNSPECIFIED, ISOFLAG_RETAIN_DONTCARE, NULL, &ptx);
'//
'// CLSID_MSDtcTransaction = {39F8D76B-0928-11d1-97DF-00C04FB9618A}
'//--------------------------------------*/
$CLSID_MSDtcTransaction = GUID$("{39F8D76B-0928-11d1-97DF-00C04FB9618A}")
#ENDIF
