Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

339 lines
12 KiB

  1. //.-------------------------------------------------------------------------
  2. //.
  3. //. Microsoft Windows
  4. // Copyright (C) 1995-1999 Microsoft Corporation. All rights reserved.
  5. //.
  6. //. File: transact.idl
  7. //.
  8. //. Contents: The basic transaction interfaces and types.
  9. //.
  10. //.--------------------------------------------------------------------------
  11. import "unknwn.idl";
  12. //
  13. //--------------------------------------------------------------------------
  14. //
  15. cpp_quote("#include \"winerror.h\"")
  16. interface ITransaction;
  17. interface ITransactionDispenser;
  18. interface ITransactionOptions;
  19. interface ITransactionOutcomeEvents;
  20. interface ITransactionCompletionEvents;
  21. cpp_quote("#ifndef DECLSPEC_UUID")
  22. cpp_quote("#if _MSC_VER >= 1100")
  23. cpp_quote("#define DECLSPEC_UUID(x) __declspec(uuid(x))")
  24. cpp_quote("#else")
  25. cpp_quote("#define DECLSPEC_UUID(x)")
  26. cpp_quote("#endif")
  27. cpp_quote("#endif")
  28. //==========================================================================
  29. // Transaction related types
  30. //==========================================================================
  31. [local,pointer_default(unique)]
  32. interface BasicTransactionTypes
  33. {
  34. typedef struct BOID {
  35. byte rgb[16];
  36. } BOID;
  37. cpp_quote("#define BOID_NULL (*((BOID*)(&IID_NULL)))")
  38. // change the following two line together
  39. cpp_quote("#ifndef MAX_TRAN_DESC_DEFINED") // conflicts with uimsg.h. This is temporary work around
  40. cpp_quote("#define MAX_TRAN_DESC_DEFINED")
  41. typedef enum TX_MISC_CONSTANTS
  42. {
  43. MAX_TRAN_DESC = 40
  44. } TX_MISC_CONSTANTS;
  45. cpp_quote("#endif")
  46. // Unit Of Work.
  47. typedef BOID XACTUOW;
  48. // Data type for isolation level values.
  49. typedef LONG ISOLEVEL;
  50. // Constants that specifiy isolation level of a transaction.
  51. typedef enum ISOLATIONLEVEL {
  52. ISOLATIONLEVEL_UNSPECIFIED = 0xFFFFFFFF, //
  53. ISOLATIONLEVEL_CHAOS = 0x00000010, //
  54. ISOLATIONLEVEL_READUNCOMMITTED = 0x00000100, //
  55. ISOLATIONLEVEL_BROWSE = 0x00000100, // Synonym for _READUNCOMITTED
  56. ISOLATIONLEVEL_CURSORSTABILITY = 0x00001000, //
  57. ISOLATIONLEVEL_READCOMMITTED = 0x00001000, // Synonym for _CURSORSTABILITY
  58. ISOLATIONLEVEL_REPEATABLEREAD = 0x00010000, //
  59. ISOLATIONLEVEL_SERIALIZABLE = 0x00100000, //
  60. ISOLATIONLEVEL_ISOLATED = 0x00100000, // Synonym for _SERIALIZABLE
  61. } ISOLATIONLEVEL;
  62. // Transaction information structure, used in ITransaction
  63. typedef struct XACTTRANSINFO {
  64. XACTUOW uow; // The current unit of work
  65. ISOLEVEL isoLevel; // The isolation level for the current UOW
  66. ULONG isoFlags; // Values from ISOFLAG enumeration
  67. DWORD grfTCSupported; // Flags indicating capabilities
  68. DWORD grfRMSupported; // ... of this transaction wrt
  69. DWORD grfTCSupportedRetaining; // ... parameters to Commit
  70. DWORD grfRMSupportedRetaining; // ...
  71. } XACTTRANSINFO;
  72. typedef struct XACTSTATS {
  73. ULONG cOpen; // The number of currently extant transactions.
  74. ULONG cCommitting; // The number of transactions which are proceding towards committing.
  75. ULONG cCommitted; // The number of transactions that are have been committed.
  76. ULONG cAborting; // The number of transactions which are in the process of aborting.
  77. ULONG cAborted; // The number of transactions that are have been aborted.
  78. ULONG cInDoubt; // The number of transactions which are presently in doubt.
  79. ULONG cHeuristicDecision; // The number of transactions that have completed by heuristic decision.
  80. FILETIME timeTransactionsUp; // The amount of time that this transaction service has been up.
  81. } XACTSTATS;
  82. // @enum ISOFLAG | Used in <t XACTTRANSINFO> and <i ITransactionDispenser>.
  83. typedef enum ISOFLAG {
  84. ISOFLAG_RETAIN_COMMIT_DC = 1, // Use just one of ISOFLAG_RETAIN_COMMIT values
  85. ISOFLAG_RETAIN_COMMIT = 2, //
  86. ISOFLAG_RETAIN_COMMIT_NO = 3, //
  87. ISOFLAG_RETAIN_ABORT_DC = 4, // Use just one of ISOFLAG_RETAIN_ABORT values
  88. ISOFLAG_RETAIN_ABORT = 8, //
  89. ISOFLAG_RETAIN_ABORT_NO = 12, //
  90. ISOFLAG_RETAIN_DONTCARE = ISOFLAG_RETAIN_COMMIT_DC | ISOFLAG_RETAIN_ABORT_DC, //
  91. ISOFLAG_RETAIN_BOTH = ISOFLAG_RETAIN_COMMIT | ISOFLAG_RETAIN_ABORT, //
  92. ISOFLAG_RETAIN_NONE = ISOFLAG_RETAIN_COMMIT_NO | ISOFLAG_RETAIN_ABORT_NO, //
  93. ISOFLAG_OPTIMISTIC = 16, //
  94. ISOFLAG_READONLY = 32 //
  95. } ISOFLAG;
  96. // Used in ITransactionDispenser
  97. // A bit field of 32 bits; be sure to mask before comparing.
  98. typedef enum XACTTC {
  99. XACTTC_NONE = 0, // use Provider's default.
  100. XACTTC_SYNC_PHASEONE = 1,
  101. XACTTC_SYNC_PHASETWO = 2,
  102. XACTTC_SYNC = 2, // nb alias for XACTTC_SYNC_PHASETWO
  103. XACTTC_ASYNC_PHASEONE = 4,
  104. XACTTC_ASYNC = 4 // nb alias for XACTTC_ASYNC_PHASEONE
  105. } XACTTC;
  106. // Used in ITransactionDispenser
  107. // A bit field of 32 bits; be sure to mask before comparing.
  108. typedef enum XACTRM {
  109. XACTRM_OPTIMISTICLASTWINS = 1, //
  110. XACTRM_NOREADONLYPREPARES = 2, //
  111. } XACTRM;
  112. typedef enum XACTCONST {
  113. XACTCONST_TIMEOUTINFINITE = 0, //
  114. } XACTCONST;
  115. typedef enum XACTHEURISTIC {
  116. XACTHEURISTIC_ABORT = 1,
  117. XACTHEURISTIC_COMMIT = 2,
  118. XACTHEURISTIC_DAMAGE = 3,
  119. XACTHEURISTIC_DANGER = 4,
  120. } XACTHEURISTIC;
  121. typedef enum XACTSTAT {
  122. XACTSTAT_NONE = 0x00000000,
  123. XACTSTAT_OPENNORMAL = 0x00000001,
  124. XACTSTAT_OPENREFUSED = 0x00000002,
  125. XACTSTAT_PREPARING = 0x00000004,
  126. XACTSTAT_PREPARED = 0x00000008,
  127. XACTSTAT_PREPARERETAINING = 0x00000010,
  128. XACTSTAT_PREPARERETAINED = 0x00000020,
  129. XACTSTAT_COMMITTING = 0x00000040,
  130. XACTSTAT_COMMITRETAINING = 0x00000080,
  131. XACTSTAT_ABORTING = 0x00000100,
  132. XACTSTAT_ABORTED = 0x00000200,
  133. XACTSTAT_COMMITTED = 0x00000400,
  134. XACTSTAT_HEURISTIC_ABORT = 0x00000800,
  135. XACTSTAT_HEURISTIC_COMMIT = 0x00001000,
  136. XACTSTAT_HEURISTIC_DAMAGE = 0x00002000,
  137. XACTSTAT_HEURISTIC_DANGER = 0x00004000,
  138. XACTSTAT_FORCED_ABORT = 0x00008000,
  139. XACTSTAT_FORCED_COMMIT = 0x00010000,
  140. XACTSTAT_INDOUBT = 0x00020000,
  141. XACTSTAT_CLOSED = 0x00040000,
  142. XACTSTAT_OPEN = 0x00000003,
  143. XACTSTAT_NOTPREPARED = 0x0007FFC3,
  144. XACTSTAT_ALL = 0x0007FFFF,
  145. } XACTSTAT;
  146. typedef struct XACTOPT { // Transaction configuration options
  147. ULONG ulTimeout; // timeout in milliseconds
  148. char szDescription[MAX_TRAN_DESC]; // description string for admin tools
  149. } XACTOPT;
  150. }
  151. //
  152. //==========================================================================
  153. // Basic transaction interfaces
  154. //==========================================================================
  155. //
  156. // Transaction interface, single phase
  157. [object,uuid(0fb15084-af41-11ce-bd2b-204c4f4f5020), pointer_default(unique)]
  158. interface ITransaction : IUnknown {
  159. HRESULT Commit
  160. (
  161. [in] BOOL fRetaining,
  162. [in] DWORD grfTC,
  163. [in] DWORD grfRM
  164. );
  165. HRESULT Abort
  166. (
  167. [in, unique] BOID* pboidReason,
  168. [in] BOOL fRetaining,
  169. [in] BOOL fAsync
  170. );
  171. HRESULT GetTransactionInfo
  172. (
  173. [out] XACTTRANSINFO* pinfo
  174. );
  175. }
  176. // ITransactionCloner
  177. [
  178. object,
  179. uuid(02656950-2152-11d0-944C-00A0C905416E),
  180. pointer_default(unique)
  181. ]
  182. interface ITransactionCloner : ITransaction
  183. {
  184. HRESULT CloneWithCommitDisabled
  185. (
  186. [out] ITransaction ** ppITransaction
  187. );
  188. };
  189. // New: Transaction interface, single phase
  190. [
  191. object,
  192. uuid(34021548-0065-11d3-bac1-00c04f797be2),
  193. pointer_default(unique)
  194. ]
  195. interface ITransaction2 : ITransactionCloner
  196. {
  197. HRESULT GetTransactionInfo2
  198. (
  199. [out] XACTTRANSINFO* pinfo
  200. );
  201. }
  202. //
  203. //--------------------------------------------------------------------------
  204. //
  205. // Interface by which new transactions are commonly created
  206. [object,uuid(3A6AD9E1-23B9-11cf-AD60-00AA00A74CCD),pointer_default(unique)]
  207. interface ITransactionDispenser : IUnknown {
  208. HRESULT GetOptionsObject
  209. (
  210. [out] ITransactionOptions** ppOptions
  211. );
  212. HRESULT BeginTransaction
  213. (
  214. [in, unique] IUnknown* punkOuter, // controlling unknown
  215. [in] ISOLEVEL isoLevel, // isolation level for xtion
  216. [in] ULONG isoFlags, // values from ISOFLAG enumeration
  217. [in, unique] ITransactionOptions* pOptions, // pointer retrieved from previous GetOptions
  218. [out] ITransaction** ppTransaction
  219. );
  220. }
  221. //
  222. //--------------------------------------------------------------------------
  223. //
  224. [object,uuid(3A6AD9E0-23B9-11cf-AD60-00AA00A74CCD),pointer_default(unique)]
  225. interface ITransactionOptions : IUnknown {
  226. HRESULT SetOptions
  227. (
  228. [in] XACTOPT* pOptions
  229. );
  230. HRESULT GetOptions
  231. (
  232. [in,out] XACTOPT* pOptions
  233. );
  234. }
  235. //
  236. //--------------------------------------------------------------------------
  237. //
  238. [object,uuid(3A6AD9E2-23B9-11cf-AD60-00AA00A74CCD),pointer_default(unique)]
  239. interface ITransactionOutcomeEvents : IUnknown {
  240. HRESULT Committed
  241. (
  242. [in] BOOL fRetaining,
  243. [in, unique] XACTUOW* pNewUOW,
  244. [in] HRESULT hr
  245. );
  246. HRESULT Aborted
  247. (
  248. [in, unique] BOID* pboidReason,
  249. [in] BOOL fRetaining,
  250. [in, unique] XACTUOW* pNewUOW,
  251. [in] HRESULT hr
  252. );
  253. HRESULT HeuristicDecision
  254. (
  255. [in] DWORD dwDecision,
  256. [in, unique] BOID* pboidReason,
  257. [in] HRESULT hr
  258. );
  259. HRESULT Indoubt
  260. (
  261. void
  262. );
  263. }
  264. cpp_quote("")
  265. cpp_quote("")
  266. cpp_quote("#if _MSC_VER < 1100 || !defined(__cplusplus)")
  267. cpp_quote("")
  268. cpp_quote("DEFINE_GUID(IID_ITransaction, 0x0fb15084, 0xaf41, 0x11ce, 0xbd, 0x2b, 0x20, 0x4c, 0x4f, 0x4f, 0x50, 0x20);")
  269. cpp_quote("DEFINE_GUID(IID_ITransactionCloner, 0x02656950, 0x2152, 0x11d0, 0x94, 0x4C, 0x00, 0xA0, 0xC9, 0x05, 0x41, 0x6E);")
  270. cpp_quote("DEFINE_GUID(IID_ITransaction2, 0x34021548, 0x0065, 0x11d3, 0xba, 0xc1, 0x00, 0xc0, 0x4f, 0x79, 0x7b, 0xe2);")
  271. cpp_quote("DEFINE_GUID(IID_ITransactionDispenser, 0x3A6AD9E1, 0x23B9, 0x11cf, 0xAD, 0x60, 0x00, 0xAA, 0x00, 0xA7, 0x4C, 0xCD);")
  272. cpp_quote("DEFINE_GUID(IID_ITransactionOptions, 0x3A6AD9E0, 0x23B9, 0x11cf, 0xAD, 0x60, 0x00, 0xAA, 0x00, 0xA7, 0x4C, 0xCD);")
  273. cpp_quote("DEFINE_GUID(IID_ITransactionOutcomeEvents, 0x3A6AD9E2, 0x23B9, 0x11cf, 0xAD, 0x60, 0x00, 0xAA, 0x00, 0xA7, 0x4C, 0xCD);")
  274. cpp_quote("")
  275. cpp_quote("#else // #if _MSC_VER < 1100 || !defined(__cplusplus)")
  276. cpp_quote("")
  277. cpp_quote("#define IID_ITransaction __uuidof(ITransaction)")
  278. cpp_quote("#define IID_ITransactionCloner __uuidof(ITransactionCloner)")
  279. cpp_quote("#define IID_ITransaction2 __uuidof(ITransaction2)")
  280. cpp_quote("#define IID_ITransactionDispenser __uuidof(ITransactionDispenser)")
  281. cpp_quote("#define IID_ITransactionOptions __uuidof(ITransactionOptions)")
  282. cpp_quote("#define IID_ITransactionOutcomeEvents __uuidof(ITransactionOutcomeEvents)")
  283. cpp_quote("")
  284. cpp_quote("#endif // #if _MSC_VER < 1100 || !defined(__cplusplus)")
  285. cpp_quote("")