xref: /reactos/sdk/include/psdk/ktmtypes.h (revision c2c66aff)
1 /*
2  * ktmtypes.h
3  *
4  * This file is part of the ReactOS PSDK package.
5  *
6  * Contributors:
7  *   Created by Timo Kreuzer <timo.kreuzer@reactos.org>
8  *
9  * THIS SOFTWARE IS NOT COPYRIGHTED
10  *
11  * This source code is offered for use in the public domain. You may
12  * use, modify or distribute it freely.
13  *
14  * This code is distributed in the hope that it will be useful but
15  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
16  * DISCLAIMED. This includes but is not limited to warranties of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18  *
19  */
20 
21 #ifndef _KTMTYPES_
22 #define _KTMTYPES_
23 
24 #define TRANSACTION_MANAGER_VOLATILE             0x00000001
25 #define TRANSACTION_MANAGER_COMMIT_DEFAULT       0x00000000
26 #define TRANSACTION_MANAGER_COMMIT_SYSTEM_VOLUME 0x00000002
27 #define TRANSACTION_MANAGER_COMMIT_SYSTEM_HIVES  0x00000004
28 #define TRANSACTION_MANAGER_COMMIT_LOWEST        0x00000008
29 #define TRANSACTION_MANAGER_CORRUPT_FOR_RECOVERY 0x00000010
30 #define TRANSACTION_MANAGER_CORRUPT_FOR_PROGRESS 0x00000020
31 #define TRANSACTION_MANAGER_MAXIMUM_OPTION       0x0000003F
32 
33 #define TRANSACTION_DO_NOT_PROMOTE               0x00000001
34 #define TRANSACTION_MAXIMUM_OPTION               0x00000001
35 
36 #define RESOURCE_MANAGER_VOLATILE                0x00000001
37 #define RESOURCE_MANAGER_COMMUNICATION           0x00000002
38 #define RESOURCE_MANAGER_MAXIMUM_OPTION          0x00000003
39 
40 #define CRM_PROTOCOL_EXPLICIT_MARSHAL_ONLY       0x00000001
41 #define CRM_PROTOCOL_DYNAMIC_MARSHAL_INFO        0x00000002
42 #define CRM_PROTOCOL_MAXIMUM_OPTION              0x00000003
43 
44 #define ENLISTMENT_SUPERIOR                      0x00000001
45 #define ENLISTMENT_MAXIMUM_OPTION                0x00000001
46 
47 #define TRANSACTION_NOTIFY_MASK                  0x3FFFFFFF
48 #define TRANSACTION_NOTIFY_PREPREPARE            0x00000001
49 #define TRANSACTION_NOTIFY_PREPARE               0x00000002
50 #define TRANSACTION_NOTIFY_COMMIT                0x00000004
51 #define TRANSACTION_NOTIFY_ROLLBACK              0x00000008
52 #define TRANSACTION_NOTIFY_PREPREPARE_COMPLETE   0x00000010
53 #define TRANSACTION_NOTIFY_PREPARE_COMPLETE      0x00000020
54 #define TRANSACTION_NOTIFY_COMMIT_COMPLETE       0x00000040
55 #define TRANSACTION_NOTIFY_ROLLBACK_COMPLETE     0x00000080
56 #define TRANSACTION_NOTIFY_RECOVER               0x00000100
57 #define TRANSACTION_NOTIFY_SINGLE_PHASE_COMMIT   0x00000200
58 #define TRANSACTION_NOTIFY_DELEGATE_COMMIT       0x00000400
59 #define TRANSACTION_NOTIFY_RECOVER_QUERY         0x00000800
60 #define TRANSACTION_NOTIFY_ENLIST_PREPREPARE     0x00001000
61 #define TRANSACTION_NOTIFY_LAST_RECOVER          0x00002000
62 #define TRANSACTION_NOTIFY_INDOUBT               0x00004000
63 #define TRANSACTION_NOTIFY_PROPAGATE_PULL        0x00008000
64 #define TRANSACTION_NOTIFY_PROPAGATE_PUSH        0x00010000
65 #define TRANSACTION_NOTIFY_MARSHAL               0x00020000
66 #define TRANSACTION_NOTIFY_ENLIST_MASK           0x00040000
67 #define TRANSACTION_NOTIFY_RM_DISCONNECTED       0x01000000
68 #define TRANSACTION_NOTIFY_TM_ONLINE             0x02000000
69 #define TRANSACTION_NOTIFY_COMMIT_REQUEST        0x04000000
70 #define TRANSACTION_NOTIFY_PROMOTE               0x08000000
71 #define TRANSACTION_NOTIFY_PROMOTE_NEW           0x10000000
72 #define TRANSACTION_NOTIFY_REQUEST_OUTCOME       0x20000000
73 
74 #define TRANSACTION_NOTIFY_COMMIT_FINALIZE       0x40000000
75 
76 #define TRANSACTIONMANAGER_OBJECT_PATH L"\\TransactionManager\\"
77 #define TRANSACTION_OBJECT_PATH        L"\\Transaction\\"
78 #define ENLISTMENT_OBJECT_PATH         L"\\Enlistment\\"
79 #define RESOURCE_MANAGER_OBJECT_PATH   L"\\ResourceManager\\"
80 
81 #define TRANSACTIONMANAGER_OBJECT_NAME_LENGTH_IN_BYTES (sizeof(TRANSACTIONMANAGER_OBJECT_PATH)+(38*sizeof(WCHAR)))
82 #define TRANSACTION_OBJECT_NAME_LENGTH_IN_BYTES        (sizeof(TRANSACTION_OBJECT_PATH)+(38*sizeof(WCHAR)))
83 #define ENLISTMENT_OBJECT_NAME_LENGTH_IN_BYTES         (sizeof(ENLISTMENT_OBJECT_PATH)+(38*sizeof(WCHAR)))
84 #define RESOURCE_MANAGER_OBJECT_NAME_LENGTH_IN_BYTES   (sizeof(RESOURCE_MANAGER_OBJECT_PATH)+(38*sizeof(WCHAR)))
85 
86 #define TRANSACTION_NOTIFICATION_TM_ONLINE_FLAG_IS_CLUSTERED 0x1
87 
88 #define KTM_MARSHAL_BLOB_VERSION_MAJOR 1
89 #define KTM_MARSHAL_BLOB_VERSION_MINOR 1
90 
91 #define MAX_TRANSACTION_DESCRIPTION_LENGTH  64
92 #define MAX_RESOURCEMANAGER_DESCRIPTION_LENGTH  64
93 
94 #ifndef _WDMDDK_
95 typedef GUID UOW, *PUOW;
96 #endif
97 
98 typedef GUID CRM_PROTOCOL_ID, *PCRM_PROTOCOL_ID;
99 typedef ULONG NOTIFICATION_MASK;
100 typedef ULONG SAVEPOINT_ID, *PSAVEPOINT_ID;
101 
102 typedef struct _TRANSACTION_NOTIFICATION {
103   PVOID TransactionKey;
104   ULONG TransactionNotification;
105   LARGE_INTEGER TmVirtualClock;
106   ULONG ArgumentLength;
107 } TRANSACTION_NOTIFICATION, *PTRANSACTION_NOTIFICATION;
108 
109 typedef struct _TRANSACTION_NOTIFICATION_RECOVERY_ARGUMENT {
110   GUID EnlistmentId;
111 #if defined(__cplusplus)
112   ::UOW UOW;
113 #else
114   UOW UOW;
115 #endif
116 } TRANSACTION_NOTIFICATION_RECOVERY_ARGUMENT, *PTRANSACTION_NOTIFICATION_RECOVERY_ARGUMENT;
117 
118 typedef struct _TRANSACTION_NOTIFICATION_TM_ONLINE_ARGUMENT {
119   GUID TmIdentity;
120   ULONG Flags;
121 } TRANSACTION_NOTIFICATION_TM_ONLINE_ARGUMENT, *PTRANSACTION_NOTIFICATION_TM_ONLINE_ARGUMENT;
122 
123 typedef struct _TRANSACTION_NOTIFICATION_SAVEPOINT_ARGUMENT {
124   SAVEPOINT_ID SavepointId;
125 } TRANSACTION_NOTIFICATION_SAVEPOINT_ARGUMENT, *PTRANSACTION_NOTIFICATION_SAVEPOINT_ARGUMENT;
126 
127 typedef struct _TRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT {
128   ULONG PropagationCookie;
129   GUID UOW;
130   GUID TmIdentity;
131   ULONG BufferLength;
132 } TRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT, *PTRANSACTION_NOTIFICATION_PROPAGATE_ARGUMENT,
133   TRANSACTION_NOTIFICATION_PROMOTE_ARGUMENT, *PTRANSACTION_NOTIFICATION_PROMOTE_ARGUMENT;
134 
135 typedef struct _TRANSACTION_NOTIFICATION_MARSHAL_ARGUMENT {
136   ULONG MarshalCookie;
137   GUID UOW;
138 } TRANSACTION_NOTIFICATION_MARSHAL_ARGUMENT, *PTRANSACTION_NOTIFICATION_MARSHAL_ARGUMENT;
139 
140 typedef struct _KCRM_MARSHAL_HEADER {
141   ULONG VersionMajor;
142   ULONG VersionMinor;
143   ULONG NumProtocols;
144   ULONG Unused;
145 } KCRM_MARSHAL_HEADER, *PKCRM_MARSHAL_HEADER, *RESTRICTED_POINTER PRKCRM_MARSHAL_HEADER;
146 
147 typedef struct _KCRM_TRANSACTION_BLOB {
148 #if defined(__cplusplus)
149   ::UOW UOW;
150 #else
151   UOW UOW;
152 #endif
153   GUID TmIdentity;
154   ULONG IsolationLevel;
155   ULONG IsolationFlags;
156   ULONG Timeout;
157   WCHAR Description[MAX_TRANSACTION_DESCRIPTION_LENGTH];
158 } KCRM_TRANSACTION_BLOB, *PKCRM_TRANSACTION_BLOB, *RESTRICTED_POINTER PRKCRM_TRANSACTION_BLOB;
159 
160 typedef struct _KCRM_PROTOCOL_BLOB {
161   CRM_PROTOCOL_ID ProtocolId;
162   ULONG StaticInfoLength;
163   ULONG TransactionIdInfoLength;
164   ULONG Unused1;
165   ULONG Unused2;
166 } KCRM_PROTOCOL_BLOB, *PKCRM_PROTOCOL_BLOB, *RESTRICTED_POINTER PRKCRM_PROTOCOL_BLOB;
167 
168 #endif /* _KTMTYPES_ */
169 
170