DtcHelp.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:9k
源码类别:

模拟服务器

开发平台:

C/C++

  1. /* ----------------------------------------------------------------------------
  2. Microsoft D.T.C (Distributed Transaction Coordinator)
  3. Copyright (C) 1995-1999 Microsoft Corporation.  All rights reserved.
  4. @doc
  5. @module DTCHelp.h |
  6. contains helper API for loading the DTCHelper DLL
  7. -------------------------------------------------------------------------------
  8. @rev  0  | 8th -Sep-1995 | GaganC | Created
  9. ----------------------------------------------------------------------------- */
  10. #ifndef __DTCHELP_H__
  11. #define __DTCHELP_H__
  12. //---------------------------------------------------------
  13. // ALL INCLUDE FILES GO HERE
  14. //---------------------------------------------------------
  15. #include <windows.h>
  16. //---------------------------------------------------------
  17. // constants / enums / typedefs / defines
  18. //---------------------------------------------------------
  19. #ifndef DEFINED_DTC_STATUS
  20. typedef enum DTC_STATUS_
  21. {
  22. DTC_STATUS_UNKNOWN = 0, // Status not known
  23. DTC_STATUS_STARTING = 1, // DTC is starting
  24. DTC_STATUS_STARTED = 2, // DTC has started
  25. DTC_STATUS_PAUSING = 3, // DTC is being paused
  26. DTC_STATUS_PAUSED = 4, // DTC has been paused
  27. DTC_STATUS_CONTINUING = 5, // DTC is being continued
  28. DTC_STATUS_STOPPING = 6, // DTC is stopping
  29. DTC_STATUS_STOPPED = 7, // DTC has stopped
  30. DTC_STATUS_E_CANTCONTROL = 8, // DTC cannot be controlled in its present state
  31. DTC_STATUS_FAILED = 9 // DTC has failed.
  32. } DTC_STATUS;
  33. #define DEFINED_DTC_STATUS
  34. #endif
  35. typedef HRESULT  (__cdecl * DTC_GET_TRANSACTION_MANAGER)(
  36. /* in */ char * pszHost,
  37. /* in */ char * pszTmName,
  38. /* in */ REFIID rid,
  39. /* in */ DWORD dwReserved1,
  40. /* in */ WORD wcbReserved2,
  41. /* in */ void FAR * pvReserved2,
  42. /*out */ void** ppvObject ) ;
  43. typedef HRESULT  (__cdecl * DTC_GET_TRANSACTION_MANAGER_EX_A)(
  44. /* in */ char * i_pszHost,
  45. /* in */ char * i_pszTmName,
  46. /* in */ REFIID i_riid,
  47. /* in */ DWORD i_grfOptions,
  48. /* in */ void * i_pvConfigParams,
  49. /* out */ void ** o_ppvObject
  50. );
  51. typedef HRESULT  (__cdecl * DTC_GET_TRANSACTION_MANAGER_EX_W)(
  52. /* in */ WCHAR * i_pwszHost,
  53. /* in */ WCHAR * i_pwszTmName,
  54. /* in */ REFIID i_riid,
  55. /* in */ DWORD i_grfOptions,
  56. /* in */ void * i_pvConfigParams,
  57. /* out */ void ** o_ppvObject
  58. );
  59. typedef HRESULT ( * DTC_INSTALL_CLIENT ) ( 
  60.    LPTSTR i_pszRemoteTmHostName, 
  61.    DWORD i_dwProtocol,
  62.    DWORD i_dwOverwrite );
  63. #ifndef UNICODE 
  64. #define DTC_GET_TRANSACTION_MANAGER_EX DTC_GET_TRANSACTION_MANAGER_EX_A
  65. #define LoadDtcHelperEx LoadDtcHelperExA
  66. #define GetDTCStatus GetDTCStatusA
  67. #define StartDTC StartDTCA
  68. #define StopDTC StopDTCA
  69. #else
  70. #define DTC_GET_TRANSACTION_MANAGER_EX DTC_GET_TRANSACTION_MANAGER_EX_W
  71. #define LoadDtcHelperEx LoadDtcHelperExW
  72. #define GetDTCStatus GetDTCStatusW
  73. #define StartDTC StartDTCW
  74. #define StopDTC StopDTCW
  75. #endif 
  76. #define DTCINSTALL_E_CLIENT_ALREADY_INSTALLED 0x0000180L
  77. #define DTCINSTALL_E_SERVER_ALREADY_INSTALLED 0x0000181L
  78. //***** Install overwrite options
  79. const DWORD DTC_INSTALL_OVERWRITE_CLIENT = 0x00000001;
  80. // first bit from right, controls client overwrite
  81. // 1=Overwrite existing client install
  82. // 0=dont overwrite existing client install
  83. const DWORD DTC_INSTALL_OVERWRITE_SERVER = 0x00000002;
  84. //  second bit from right, controls server overwrite
  85. // 1=Overwrite existing server install
  86. // 0=dont overwrite existing server install
  87. //---------------------------------------------------------
  88. // Function Prototypes
  89. //---------------------------------------------------------
  90. EXTERN_C
  91. {
  92. DTC_GET_TRANSACTION_MANAGER __cdecl LoadDtcHelper (void);
  93. DTC_GET_TRANSACTION_MANAGER_EX_A __cdecl LoadDtcHelperExA (void);
  94. DTC_GET_TRANSACTION_MANAGER_EX_W __cdecl LoadDtcHelperExW (void);
  95. void __cdecl FreeDtcHelper (void);
  96. HMODULE __cdecl GetDtcLocaleResourceHandle(void);
  97. // Function: Initialize
  98. // This function initialized all the function pointers needed to 
  99. // carry out other operations supported by this static library.
  100. // It is optional to make this call.
  101. // Returns - S_OK if all is fine, E_FAIL other wise.
  102. // Note: this function is not thread safe
  103. HRESULT __cdecl Initialize (void);
  104. // Function: Uninitialize
  105. // This function unloads the dynamically loaded dlls.
  106. // Returns - S_OK if all is fine, E_FAIL other wise.
  107. // Note: this function is not thread safe
  108. HRESULT __cdecl Uninitialize (void);
  109. // Function: GetDTCStatusW
  110. // Unicode version of GetDTCStatus - used to get the status of the DTC service.
  111. // The wszHostName parameter specifies the node on which to perform the 
  112. // operation.  On Windows 9x this parameter must be either NULL or the local
  113. // machine name.
  114. // Returns - the appropriate status from the enum DTC_STATUS
  115. DTC_STATUS __cdecl GetDTCStatusW (WCHAR * wszHostName);
  116. // Function: GetDTCStatusA
  117. // Ansi version of GetDTCStatus - used to get the status of the DTC service
  118. // The szHostName parameter specifies the node on which to perform the 
  119. // operation.  On Windows 9x this parameter must be either NULL or the local
  120. // machine name.
  121. // Returns - the appropriate status from the enum DTC_STATUS
  122. DTC_STATUS __cdecl GetDTCStatusA (LPSTR szHostName);
  123. // Function: StartDTCW
  124. // Unicode version of StartDTC - used to start the DTC service.
  125. // If the service is already started then the following is a no-op
  126. // The wszHostName parameter specifies the node on which to perform the 
  127. // operation.  On Windows 9x this parameter must be either NULL or the local
  128. // machine name.
  129. // Returns - S_OK if all is ok
  130. //  E_FAIL if the operation failed for some reason.
  131. //  E_UNEXPECTED if an unexpected error occured.
  132. HRESULT __cdecl StartDTCW (WCHAR * wszHostName);
  133. // Function: StartDTCA
  134. // Ansi version of StartDTC - used to start the DTC service.
  135. // If the service is already started then the following is a no-op
  136. // The szHostName parameter specifies the node on which to perform the 
  137. // operation.  On Windows 9x this parameter must be either NULL or the local
  138. // machine name.
  139. // Returns - S_OK if all is ok
  140. //  E_FAIL if the operation failed for some reason.
  141. //  E_UNEXPECTED if an unexpected error occured.
  142. HRESULT __cdecl StartDTCA (LPSTR szHostName);
  143. // Function: StopDTCW
  144. // Unicode version of StopDTC - used to stop the DTC service.
  145. // If the service is already stopped then the following is a no-op
  146. // The wszHostName parameter specifies the node on which to perform the 
  147. // operation.  On Windows 9x this parameter must be either NULL or the local
  148. // machine name.
  149. // Returns - S_OK if all is ok
  150. //  E_FAIL if the operation failed for some reason.
  151. //  E_UNEXPECTED if an unexpected error occured.
  152. HRESULT __cdecl StopDTCW (WCHAR * wszHostName);
  153. // Function: StopDTCA
  154. // Ansi version of StopDTC - used to stop the DTC service.
  155. // If the service is already stopped then the following is a no-op
  156. // The szHostName parameter specifies the node on which to perform the 
  157. // operation.  On Windows 9x this parameter must be either NULL or the local
  158. // machine name.
  159. // Returns - S_OK if all is ok
  160. //  E_FAIL if the operation failed for some reason.
  161. //  E_UNEXPECTED if an unexpected error occured.
  162. HRESULT __cdecl StopDTCA (LPSTR szHostName);
  163. //  Function: DtcInstallClient
  164. //  Installs the client version of DTC.
  165. //  Parameters: i_pszRemoteTmHostName - the name of the host tm,
  166. // i_szProt - the protocol to use in string format
  167. // 0x00000001 TCP/IP  (1)
  168. // 0x00000002 SPX (2)
  169. // 0x00000004 NetBEUI (4)
  170. //
  171. // i_dwOverwrite - overwrite previous install or not?
  172. // DTC_INSTALL_OVERWRITE_CLIENT = 0x00000001;
  173. // 0=Overwrite existing client install
  174. // 1=dont overwrite existing client install
  175. // DTC_INSTALL_OVERWRITE_SERVER = 0x00000002;
  176. // 0=Overwrite existing server install
  177. // 1=dont overwrite existing server install
  178. //  Returns - S_OK if all is ok
  179. // E_FAIL if the operation failed for some reason
  180. //  E_UNEXPECTED if an unexpected error occured
  181. HRESULT __cdecl DtcInstallClient(LPTSTR i_pszRemoteTmHostName, DWORD i_dwProtocol, DWORD i_dwOverwrite);
  182. }
  183. //---------------------------------------------------------
  184. // ALL ERRORS GO HERE
  185. //---------------------------------------------------------
  186. #endif __DTCHELP_H__