xref: /reactos/sdk/include/psdk/transact.idl (revision f04935d8)
1/*
2 * Copyright (C) 2013 Daniel Jeliński
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19import "unknwn.idl";
20
21cpp_quote("#include <winerror.h>")
22
23interface ITransaction;
24interface ITransactionCloner;
25interface ITransaction2;
26interface ITransactionDispenser;
27interface ITransactionOptions;
28interface ITransactionOutcomeEvents;
29interface ITmNodeName;
30
31typedef struct BOID {
32    byte rgb[16];
33} BOID;
34
35cpp_quote("#ifndef MAX_TRAN_DESC_DEFINED")
36cpp_quote("#define MAX_TRAN_DESC_DEFINED")
37typedef enum TX_MISC_CONSTANTS {
38    MAX_TRAN_DESC = 40
39} TX_MISC_CONSTANTS;
40cpp_quote("#endif")
41
42typedef BOID XACTUOW;
43typedef LONG ISOLEVEL;
44
45typedef enum ISOLATIONLEVEL {
46    ISOLATIONLEVEL_UNSPECIFIED = 0xffffffff,
47    ISOLATIONLEVEL_CHAOS = 0x10,
48    ISOLATIONLEVEL_READUNCOMMITTED = 0x100,
49    ISOLATIONLEVEL_BROWSE = 0x100,
50    ISOLATIONLEVEL_CURSORSTABILITY = 0x1000,
51    ISOLATIONLEVEL_READCOMMITTED = 0x1000,
52    ISOLATIONLEVEL_REPEATABLEREAD = 0x10000,
53    ISOLATIONLEVEL_SERIALIZABLE = 0x100000,
54    ISOLATIONLEVEL_ISOLATED = 0x100000
55} ISOLATIONLEVEL;
56
57typedef struct XACTTRANSINFO {
58    XACTUOW uow;
59    ISOLEVEL isoLevel;
60    ULONG isoFlags;
61    DWORD grfTCSupported;
62    DWORD grfRMSupported;
63    DWORD grfTCSupportedRetaining;
64    DWORD grfRMSupportedRetaining;
65} XACTTRANSINFO;
66
67typedef struct XACTSTATS {
68    ULONG cOpen;
69    ULONG cCommitting;
70    ULONG cCommitted;
71    ULONG cAborting;
72    ULONG cAborted;
73    ULONG cInDoubt;
74    ULONG cHeuristicDecision;
75    FILETIME timeTransactionsUp;
76} XACTSTATS;
77
78typedef enum ISOFLAG {
79    ISOFLAG_RETAIN_COMMIT_DC = 1,
80    ISOFLAG_RETAIN_COMMIT = 2,
81    ISOFLAG_RETAIN_COMMIT_NO = 3,
82    ISOFLAG_RETAIN_ABORT_DC = 4,
83    ISOFLAG_RETAIN_ABORT = 8,
84    ISOFLAG_RETAIN_ABORT_NO = 12,
85    ISOFLAG_RETAIN_DONTCARE = ISOFLAG_RETAIN_COMMIT_DC | ISOFLAG_RETAIN_ABORT_DC,
86    ISOFLAG_RETAIN_BOTH = ISOFLAG_RETAIN_COMMIT | ISOFLAG_RETAIN_ABORT,
87    ISOFLAG_RETAIN_NONE = ISOFLAG_RETAIN_COMMIT_NO | ISOFLAG_RETAIN_ABORT_NO,
88    ISOFLAG_OPTIMISTIC = 16,
89    ISOFLAG_READONLY = 32
90} ISOFLAG;
91
92typedef enum XACTTC {
93    XACTTC_NONE = 0,
94    XACTTC_SYNC_PHASEONE = 1,
95    XACTTC_SYNC_PHASETWO = 2,
96    XACTTC_SYNC = 2,
97    XACTTC_ASYNC_PHASEONE = 4,
98    XACTTC_ASYNC = 4
99} XACTTC;
100
101typedef enum XACTRM {
102    XACTRM_OPTIMISTICLASTWINS = 1,
103    XACTRM_NOREADONLYPREPARES
104} XACTRM;
105
106typedef enum XACTCONST {
107    XACTCONST_TIMEOUTINFINITE
108} XACTCONST;
109
110typedef enum XACTHEURISTIC {
111    XACTHEURISTIC_ABORT = 1,
112    XACTHEURISTIC_COMMIT,
113    XACTHEURISTIC_DAMAGE,
114    XACTHEURISTIC_DANGER
115} XACTHEURISTIC;
116
117typedef enum XACTSTAT {
118    XACTSTAT_NONE = 0,
119    XACTSTAT_OPENNORMAL = 0x1,
120    XACTSTAT_OPENREFUSED = 0x2,
121    XACTSTAT_PREPARING = 0x4,
122    XACTSTAT_PREPARED = 0x8,
123    XACTSTAT_PREPARERETAINING = 0x10,
124    XACTSTAT_PREPARERETAINED = 0x20,
125    XACTSTAT_COMMITTING = 0x40,
126    XACTSTAT_COMMITRETAINING = 0x80,
127    XACTSTAT_ABORTING = 0x100,
128    XACTSTAT_ABORTED = 0x200,
129    XACTSTAT_COMMITTED = 0x400,
130    XACTSTAT_HEURISTIC_ABORT = 0x800,
131    XACTSTAT_HEURISTIC_COMMIT = 0x1000,
132    XACTSTAT_HEURISTIC_DAMAGE = 0x2000,
133    XACTSTAT_HEURISTIC_DANGER = 0x4000,
134    XACTSTAT_FORCED_ABORT = 0x8000,
135    XACTSTAT_FORCED_COMMIT = 0x10000,
136    XACTSTAT_INDOUBT = 0x20000,
137    XACTSTAT_CLOSED = 0x40000,
138    XACTSTAT_OPEN = 0x3,
139    XACTSTAT_NOTPREPARED = 0x7ffc3,
140    XACTSTAT_ALL = 0x7ffff
141} XACTSTAT;
142
143typedef struct XACTOPT {
144    ULONG ulTimeout;
145    char szDescription[40 ];
146} XACTOPT;
147
148[
149    object,
150    uuid(0fb15084-af41-11ce-bd2b-204c4f4f5020)
151]
152interface ITransaction : IUnknown {
153    HRESULT Commit([in] BOOL fRetaining,
154                   [in] DWORD grfTC,
155                   [in] DWORD grfRM);
156    HRESULT Abort([in, unique] BOID *pboidReason,
157                  [in] BOOL fRetaining,
158                  [in] BOOL fAsync);
159    HRESULT GetTransactionInfo([out] XACTTRANSINFO *pinfo);
160}
161
162[
163    object,
164    uuid(02656950-2152-11d0-944C-00A0C905416E)
165]
166interface ITransactionCloner : ITransaction {
167    HRESULT CloneWithCommitDisabled([out] ITransaction **ppITransaction);
168}
169
170[
171    object,
172    uuid(34021548-0065-11d3-bac1-00c04f797be2)
173]
174interface ITransaction2 : ITransactionCloner {
175    HRESULT GetTransactionInfo2([out] XACTTRANSINFO *pinfo);
176}
177
178[
179    object,
180    uuid(3A6AD9E1-23B9-11cf-AD60-00AA00A74CCD)
181]
182interface ITransactionDispenser : IUnknown {
183    HRESULT GetOptionsObject([out] ITransactionOptions **ppOptions);
184    HRESULT BeginTransaction([in, unique] IUnknown *punkOuter,
185                             [in] ISOLEVEL isoLevel,
186                             [in] ULONG isoFlags,
187                             [in, unique] ITransactionOptions *pOptions,
188                             [out] ITransaction **ppTransaction);
189}
190
191[
192    object,
193    uuid(3A6AD9E0-23B9-11cf-AD60-00AA00A74CCD)
194]
195interface ITransactionOptions : IUnknown {
196    HRESULT SetOptions([in] XACTOPT *pOptions);
197    HRESULT GetOptions([in, out] XACTOPT *pOptions);
198}
199
200[
201    object,
202    uuid(3A6AD9E2-23B9-11cf-AD60-00AA00A74CCD)
203]
204interface ITransactionOutcomeEvents : IUnknown {
205    HRESULT Committed([in] BOOL fRetaining,
206                      [in, unique] XACTUOW *pNewUOW,
207                      [in] HRESULT hr);
208    HRESULT Aborted([in, unique] BOID *pboidReason,
209                    [in] BOOL fRetaining,
210                    [in, unique] XACTUOW *pNewUOW,
211                    [in] HRESULT hr);
212    HRESULT HeuristicDecision([in] DWORD dwDecision,
213                              [in, unique] BOID *pboidReason,
214                              [in] HRESULT hr);
215    HRESULT Indoubt(void);
216}
217
218[
219    object,
220    uuid(30274F88-6EE4-474e-9B95-7807BC9EF8CF)
221]
222interface ITmNodeName : IUnknown {
223    HRESULT GetNodeNameSize([out] ULONG *pcbNodeNameSize);
224    HRESULT GetNodeName([in] ULONG cbNodeNameBufferSize,
225                        [in, out] LPWSTR pNodeNameBuffer);
226}
227