Share via


GetXaSwitch

 

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

This function must be implemented and exported by the RM proxy. The DTC transaction manager calls this function to obtain the address of the XA switch data structure implemented by the RM Proxy. The MSDTC also functions as an RM Proxy and exposes the GetXaSwitch entry point so that other XA-based transaction managers or applications can communicate with the MSDTC by using the XA functions.

Implemented by: RM proxy
Object This is a helper function, not a method on an object.
Interface Source N/A
Called by: DTC transaction manager.

Syntax

  
HRESULT __cdecl GetXaSwitch (   DWORD XaSwitchFlags,  xa_switch_t ** ppXaSwitch);  

Parameters

XaSwitchFlags
[in] Flags that provide information about the transaction manager making the call. Currently XA_SWITCH_F_DTC is the only defined flag.

#define XA_SWITCH_F_DTC 0x00000001  

ppXaSwitch
[out] Pointer to the pointer to the xa_switch_t data structure implemented by the RM proxy. This structure is defined in txdtc.h as shown in the following example.

#define RMNAMESIZE   32  
struct xa_switch_t {  
  CHAR     name[RMNAMESIZE];  
  LONG     flags;  
  LONG     version; /* must be 0 */  
  INT (__cdecl *xa_open_entry)(char *, int, long);  
  INT (__cdecl *xa_close_entry)(char *, int, long);  
  INT (__cdecl *xa_start_entry)(XID *, int, long);  
  INT (__cdecl *xa_end_entry)(XID *, int, long);  
  INT (__cdecl *xa_rollback_entry)(XID *, int, long);  
  INT (__cdecl *xa_prepare_entry)(XID *, int, long);  
  INT (__cdecl *xa_commit_entry)(XID *, int, long);  
  INT (__cdecl *xa_recover_entry)(XID *, long, int, long);  
  INT (__cdecl *xa_forget_entry)(XID *, int, long);  
  INT (__cdecl *xa_complete_entry)(int *, int *, int, long);  
};  
  

Return Values

S_OK
Success.

E_FAIL
Unable to provide the address of the XA switch function.

Remarks

All XA compliant resource managers must provide an XA switch. This XA switch makes it possible for transaction managers to call the resource managers xa_ routines. The format of the XA switch is described in the X/Open specification xa_switch_t structure. The XA switch contains the resource manager’s name, non-null pointers to the resource manager’s xa_ entry points, a flag, and a version number.

When the DTC transaction manager loads the RM proxy DLL, it calls GetProcAddress to obtain the address of the GetXaSwitch function. The DTC transaction manager then calls the GetXaSwitch function to obtain the address of the resource manager’s xa_switch_t structure. The RM proxy must implement both the GetXaSwitch function and the XA Switch structure, and both must be implemented using the __cdecl calling convention.

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 oletx2xa.h

Library: Included as a resource in mtxoci.dll

See Also

xa_open
xa_close
xa_start
xa_end
xa_rollback
xa_prepare
xa_commit
xa_recover
xa_forget
xa_complete