1 use winapi::shared::basetsd::ULONG_PTR;
2 use winapi::shared::guiddef::LPGUID;
3 use winapi::shared::ktmtypes::{NOTIFICATION_MASK, PCRM_PROTOCOL_ID, PTRANSACTION_NOTIFICATION};
4 use winapi::shared::ntdef::{
5     BOOLEAN, HANDLE, NTSTATUS, PHANDLE, PLARGE_INTEGER, POBJECT_ATTRIBUTES, PULONG,
6     PUNICODE_STRING, PVOID, ULONG,
7 };
8 use winapi::um::winnt::{
9     ACCESS_MASK, ENLISTMENT_INFORMATION_CLASS, KTMOBJECT_TYPE, PKTMOBJECT_CURSOR,
10     RESOURCEMANAGER_INFORMATION_CLASS, TRANSACTIONMANAGER_INFORMATION_CLASS,
11     TRANSACTION_INFORMATION_CLASS,
12 };
13 EXTERN!{extern "system" {
14     fn NtCreateTransactionManager(
15         TmHandle: PHANDLE,
16         DesiredAccess: ACCESS_MASK,
17         ObjectAttributes: POBJECT_ATTRIBUTES,
18         LogFileName: PUNICODE_STRING,
19         CreateOptions: ULONG,
20         CommitStrength: ULONG,
21     ) -> NTSTATUS;
22     fn NtOpenTransactionManager(
23         TmHandle: PHANDLE,
24         DesiredAccess: ACCESS_MASK,
25         ObjectAttributes: POBJECT_ATTRIBUTES,
26         LogFileName: PUNICODE_STRING,
27         TmIdentity: LPGUID,
28         OpenOptions: ULONG,
29     ) -> NTSTATUS;
30     fn NtRenameTransactionManager(
31         LogFileName: PUNICODE_STRING,
32         ExistingTransactionManagerGuid: LPGUID,
33     ) -> NTSTATUS;
34     fn NtRollforwardTransactionManager(
35         TransactionManagerHandle: HANDLE,
36         TmVirtualClock: PLARGE_INTEGER,
37     ) -> NTSTATUS;
38     fn NtRecoverTransactionManager(
39         TransactionManagerHandle: HANDLE,
40     ) -> NTSTATUS;
41     fn NtQueryInformationTransactionManager(
42         TransactionManagerHandle: HANDLE,
43         TransactionManagerInformationClass: TRANSACTIONMANAGER_INFORMATION_CLASS,
44         TransactionManagerInformation: PVOID,
45         TransactionManagerInformationLength: ULONG,
46         ReturnLength: PULONG,
47     ) -> NTSTATUS;
48     fn NtSetInformationTransactionManager(
49         TmHandle: HANDLE,
50         TransactionManagerInformationClass: TRANSACTIONMANAGER_INFORMATION_CLASS,
51         TransactionManagerInformation: PVOID,
52         TransactionManagerInformationLength: ULONG,
53     ) -> NTSTATUS;
54     fn NtEnumerateTransactionObject(
55         RootObjectHandle: HANDLE,
56         QueryType: KTMOBJECT_TYPE,
57         ObjectCursor: PKTMOBJECT_CURSOR,
58         ObjectCursorLength: ULONG,
59         ReturnLength: PULONG,
60     ) -> NTSTATUS;
61     fn NtCreateTransaction(
62         TransactionHandle: PHANDLE,
63         DesiredAccess: ACCESS_MASK,
64         ObjectAttributes: POBJECT_ATTRIBUTES,
65         Uow: LPGUID,
66         TmHandle: HANDLE,
67         CreateOptions: ULONG,
68         IsolationLevel: ULONG,
69         IsolationFlags: ULONG,
70         Timeout: PLARGE_INTEGER,
71         Description: PUNICODE_STRING,
72     ) -> NTSTATUS;
73     fn NtOpenTransaction(
74         TransactionHandle: PHANDLE,
75         DesiredAccess: ACCESS_MASK,
76         ObjectAttributes: POBJECT_ATTRIBUTES,
77         Uow: LPGUID,
78         TmHandle: HANDLE,
79     ) -> NTSTATUS;
80     fn NtQueryInformationTransaction(
81         TransactionHandle: HANDLE,
82         TransactionInformationClass: TRANSACTION_INFORMATION_CLASS,
83         TransactionInformation: PVOID,
84         TransactionInformationLength: ULONG,
85         ReturnLength: PULONG,
86     ) -> NTSTATUS;
87     fn NtSetInformationTransaction(
88         TransactionHandle: HANDLE,
89         TransactionInformationClass: TRANSACTION_INFORMATION_CLASS,
90         TransactionInformation: PVOID,
91         TransactionInformationLength: ULONG,
92     ) -> NTSTATUS;
93     fn NtCommitTransaction(
94         TransactionHandle: HANDLE,
95         Wait: BOOLEAN,
96     ) -> NTSTATUS;
97     fn NtRollbackTransaction(
98         TransactionHandle: HANDLE,
99         Wait: BOOLEAN,
100     ) -> NTSTATUS;
101     fn NtCreateEnlistment(
102         EnlistmentHandle: PHANDLE,
103         DesiredAccess: ACCESS_MASK,
104         ResourceManagerHandle: HANDLE,
105         TransactionHandle: HANDLE,
106         ObjectAttributes: POBJECT_ATTRIBUTES,
107         CreateOptions: ULONG,
108         NotificationMask: NOTIFICATION_MASK,
109         EnlistmentKey: PVOID,
110     ) -> NTSTATUS;
111     fn NtOpenEnlistment(
112         EnlistmentHandle: PHANDLE,
113         DesiredAccess: ACCESS_MASK,
114         ResourceManagerHandle: HANDLE,
115         EnlistmentGuid: LPGUID,
116         ObjectAttributes: POBJECT_ATTRIBUTES,
117     ) -> NTSTATUS;
118     fn NtQueryInformationEnlistment(
119         EnlistmentHandle: HANDLE,
120         EnlistmentInformationClass: ENLISTMENT_INFORMATION_CLASS,
121         EnlistmentInformation: PVOID,
122         EnlistmentInformationLength: ULONG,
123         ReturnLength: PULONG,
124     ) -> NTSTATUS;
125     fn NtSetInformationEnlistment(
126         EnlistmentHandle: HANDLE,
127         EnlistmentInformationClass: ENLISTMENT_INFORMATION_CLASS,
128         EnlistmentInformation: PVOID,
129         EnlistmentInformationLength: ULONG,
130     ) -> NTSTATUS;
131     fn NtRecoverEnlistment(
132         EnlistmentHandle: HANDLE,
133         EnlistmentKey: PVOID,
134     ) -> NTSTATUS;
135     fn NtPrePrepareEnlistment(
136         EnlistmentHandle: HANDLE,
137         TmVirtualClock: PLARGE_INTEGER,
138     ) -> NTSTATUS;
139     fn NtPrepareEnlistment(
140         EnlistmentHandle: HANDLE,
141         TmVirtualClock: PLARGE_INTEGER,
142     ) -> NTSTATUS;
143     fn NtCommitEnlistment(
144         EnlistmentHandle: HANDLE,
145         TmVirtualClock: PLARGE_INTEGER,
146     ) -> NTSTATUS;
147     fn NtRollbackEnlistment(
148         EnlistmentHandle: HANDLE,
149         TmVirtualClock: PLARGE_INTEGER,
150     ) -> NTSTATUS;
151     fn NtPrePrepareComplete(
152         EnlistmentHandle: HANDLE,
153         TmVirtualClock: PLARGE_INTEGER,
154     ) -> NTSTATUS;
155     fn NtPrepareComplete(
156         EnlistmentHandle: HANDLE,
157         TmVirtualClock: PLARGE_INTEGER,
158     ) -> NTSTATUS;
159     fn NtCommitComplete(
160         EnlistmentHandle: HANDLE,
161         TmVirtualClock: PLARGE_INTEGER,
162     ) -> NTSTATUS;
163     fn NtReadOnlyEnlistment(
164         EnlistmentHandle: HANDLE,
165         TmVirtualClock: PLARGE_INTEGER,
166     ) -> NTSTATUS;
167     fn NtRollbackComplete(
168         EnlistmentHandle: HANDLE,
169         TmVirtualClock: PLARGE_INTEGER,
170     ) -> NTSTATUS;
171     fn NtSinglePhaseReject(
172         EnlistmentHandle: HANDLE,
173         TmVirtualClock: PLARGE_INTEGER,
174     ) -> NTSTATUS;
175     fn NtCreateResourceManager(
176         ResourceManagerHandle: PHANDLE,
177         DesiredAccess: ACCESS_MASK,
178         TmHandle: HANDLE,
179         RmGuid: LPGUID,
180         ObjectAttributes: POBJECT_ATTRIBUTES,
181         CreateOptions: ULONG,
182         Description: PUNICODE_STRING,
183     ) -> NTSTATUS;
184     fn NtOpenResourceManager(
185         ResourceManagerHandle: PHANDLE,
186         DesiredAccess: ACCESS_MASK,
187         TmHandle: HANDLE,
188         ResourceManagerGuid: LPGUID,
189         ObjectAttributes: POBJECT_ATTRIBUTES,
190     ) -> NTSTATUS;
191     fn NtRecoverResourceManager(
192         ResourceManagerHandle: HANDLE,
193     ) -> NTSTATUS;
194     fn NtGetNotificationResourceManager(
195         ResourceManagerHandle: HANDLE,
196         TransactionNotification: PTRANSACTION_NOTIFICATION,
197         NotificationLength: ULONG,
198         Timeout: PLARGE_INTEGER,
199         ReturnLength: PULONG,
200         Asynchronous: ULONG,
201         AsynchronousContext: ULONG_PTR,
202     ) -> NTSTATUS;
203     fn NtQueryInformationResourceManager(
204         ResourceManagerHandle: HANDLE,
205         ResourceManagerInformationClass: RESOURCEMANAGER_INFORMATION_CLASS,
206         ResourceManagerInformation: PVOID,
207         ResourceManagerInformationLength: ULONG,
208         ReturnLength: PULONG,
209     ) -> NTSTATUS;
210     fn NtSetInformationResourceManager(
211         ResourceManagerHandle: HANDLE,
212         ResourceManagerInformationClass: RESOURCEMANAGER_INFORMATION_CLASS,
213         ResourceManagerInformation: PVOID,
214         ResourceManagerInformationLength: ULONG,
215     ) -> NTSTATUS;
216     fn NtRegisterProtocolAddressInformation(
217         ResourceManager: HANDLE,
218         ProtocolId: PCRM_PROTOCOL_ID,
219         ProtocolInformationSize: ULONG,
220         ProtocolInformation: PVOID,
221         CreateOptions: ULONG,
222     ) -> NTSTATUS;
223     fn NtPropagationComplete(
224         ResourceManagerHandle: HANDLE,
225         RequestCookie: ULONG,
226         BufferLength: ULONG,
227         Buffer: PVOID,
228     ) -> NTSTATUS;
229     fn NtPropagationFailed(
230         ResourceManagerHandle: HANDLE,
231         RequestCookie: ULONG,
232         PropStatus: NTSTATUS,
233     ) -> NTSTATUS;
234     fn NtFreezeTransactions(
235         FreezeTimeout: PLARGE_INTEGER,
236         ThawTimeout: PLARGE_INTEGER,
237     ) -> NTSTATUS;
238     fn NtThawTransactions() -> NTSTATUS;
239 }}
240