mirror of https://github.com/tongzx/nt5src
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.
260 lines
10 KiB
260 lines
10 KiB
//.-------------------------------------------------------------------------
|
|
//.
|
|
//. Microsoft Windows
|
|
//. Copyright (C) 1995-2001 Microsoft Corporation
|
|
//.
|
|
//. File: transact.idl
|
|
//.
|
|
//. Contents: The basic transaction interfaces and types.
|
|
//.
|
|
//.--------------------------------------------------------------------------
|
|
|
|
import "unknwn.idl";
|
|
|
|
//
|
|
//--------------------------------------------------------------------------
|
|
//
|
|
|
|
interface ITransaction;
|
|
|
|
cpp_quote("#ifndef DECLSPEC_UUID")
|
|
cpp_quote("#if _MSC_VER >= 1100")
|
|
cpp_quote("#define DECLSPEC_UUID(x) __declspec(uuid(x))")
|
|
cpp_quote("#else")
|
|
cpp_quote("#define DECLSPEC_UUID(x)")
|
|
cpp_quote("#endif")
|
|
cpp_quote("#endif")
|
|
|
|
//==========================================================================
|
|
// Transaction related types
|
|
//==========================================================================
|
|
|
|
[local,pointer_default(unique)]
|
|
interface BasicTransactionTypes
|
|
{
|
|
|
|
typedef struct BOID {
|
|
byte rgb[16];
|
|
} BOID;
|
|
|
|
cpp_quote("#define BOID_NULL (*((BOID*)(&IID_NULL)))")
|
|
|
|
// change the following two line together
|
|
cpp_quote("#ifndef MAX_TRAN_DESC_DEFINED") // conflicts with uimsg.h. This is temporary work around
|
|
cpp_quote("#define MAX_TRAN_DESC_DEFINED")
|
|
typedef enum TX_MISC_CONSTANTS
|
|
{
|
|
MAX_TRAN_DESC = 40
|
|
} TX_MISC_CONSTANTS;
|
|
cpp_quote("#endif")
|
|
|
|
// Unit Of Work.
|
|
|
|
typedef BOID XACTUOW;
|
|
|
|
// Data type for isolation level values.
|
|
|
|
typedef LONG ISOLEVEL;
|
|
|
|
// Constants that specifiy isolation level of a transaction.
|
|
|
|
typedef enum ISOLATIONLEVEL {
|
|
ISOLATIONLEVEL_UNSPECIFIED = 0xFFFFFFFF, //
|
|
ISOLATIONLEVEL_CHAOS = 0x00000010, //
|
|
ISOLATIONLEVEL_READUNCOMMITTED = 0x00000100, //
|
|
ISOLATIONLEVEL_BROWSE = 0x00000100, // Synonym for _READUNCOMITTED
|
|
ISOLATIONLEVEL_CURSORSTABILITY = 0x00001000, //
|
|
ISOLATIONLEVEL_READCOMMITTED = 0x00001000, // Synonym for _CURSORSTABILITY
|
|
ISOLATIONLEVEL_REPEATABLEREAD = 0x00010000, //
|
|
ISOLATIONLEVEL_SERIALIZABLE = 0x00100000, //
|
|
ISOLATIONLEVEL_ISOLATED = 0x00100000, // Synonym for _SERIALIZABLE
|
|
} ISOLATIONLEVEL;
|
|
|
|
// Transaction information structure, used in ITransaction
|
|
|
|
typedef struct XACTTRANSINFO {
|
|
XACTUOW uow; // The current unit of work
|
|
ISOLEVEL isoLevel; // The isolation level for the current UOW
|
|
ULONG isoFlags; // Values from ISOFLAG enumeration
|
|
DWORD grfTCSupported; // Flags indicating capabilities
|
|
DWORD grfRMSupported; // ... of this transaction wrt
|
|
DWORD grfTCSupportedRetaining; // ... parameters to Commit
|
|
DWORD grfRMSupportedRetaining; // ...
|
|
} XACTTRANSINFO;
|
|
|
|
typedef struct XACTSTATS {
|
|
ULONG cOpen; // The number of currently extant transactions.
|
|
ULONG cCommitting; // The number of transactions which are proceding towards committing.
|
|
ULONG cCommitted; // The number of transactions that are have been committed.
|
|
ULONG cAborting; // The number of transactions which are in the process of aborting.
|
|
ULONG cAborted; // The number of transactions that are have been aborted.
|
|
ULONG cInDoubt; // The number of transactions which are presently in doubt.
|
|
ULONG cHeuristicDecision; // The number of transactions that have completed by heuristic decision.
|
|
FILETIME timeTransactionsUp; // The amount of time that this transaction service has been up.
|
|
} XACTSTATS;
|
|
|
|
// @enum ISOFLAG | Used in <t XACTTRANSINFO> and <i ITransactionDispenser>.
|
|
|
|
typedef enum ISOFLAG {
|
|
ISOFLAG_RETAIN_COMMIT_DC = 1, // Use just one of ISOFLAG_RETAIN_COMMIT values
|
|
ISOFLAG_RETAIN_COMMIT = 2, //
|
|
ISOFLAG_RETAIN_COMMIT_NO = 3, //
|
|
ISOFLAG_RETAIN_ABORT_DC = 4, // Use just one of ISOFLAG_RETAIN_ABORT values
|
|
ISOFLAG_RETAIN_ABORT = 8, //
|
|
ISOFLAG_RETAIN_ABORT_NO = 12, //
|
|
ISOFLAG_RETAIN_DONTCARE = ISOFLAG_RETAIN_COMMIT_DC | ISOFLAG_RETAIN_ABORT_DC, //
|
|
ISOFLAG_RETAIN_BOTH = ISOFLAG_RETAIN_COMMIT | ISOFLAG_RETAIN_ABORT, //
|
|
ISOFLAG_RETAIN_NONE = ISOFLAG_RETAIN_COMMIT_NO | ISOFLAG_RETAIN_ABORT_NO, //
|
|
ISOFLAG_OPTIMISTIC = 16, //
|
|
ISOFLAG_READONLY = 32 //
|
|
} ISOFLAG;
|
|
|
|
// Used in ITransactionDispenser
|
|
// A bit field of 32 bits; be sure to mask before comparing.
|
|
|
|
typedef enum XACTTC {
|
|
XACTTC_SYNC_PHASEONE = 1,
|
|
XACTTC_SYNC_PHASETWO = 2,
|
|
XACTTC_SYNC = 2, // nb alias for XACTTC_SYNC_PHASETWO
|
|
XACTTC_ASYNC_PHASEONE = 4,
|
|
XACTTC_ASYNC = 4 // nb alias for XACTTC_ASYNC_PHASEONE
|
|
} XACTTC;
|
|
|
|
// Used in ITransactionDispenser
|
|
// A bit field of 32 bits; be sure to mask before comparing.
|
|
|
|
typedef enum XACTRM {
|
|
XACTRM_OPTIMISTICLASTWINS = 1, //
|
|
XACTRM_NOREADONLYPREPARES = 2, //
|
|
} XACTRM;
|
|
|
|
typedef enum XACTCONST {
|
|
XACTCONST_TIMEOUTINFINITE = 0, //
|
|
} XACTCONST;
|
|
|
|
typedef enum XACTHEURISTIC {
|
|
XACTHEURISTIC_ABORT = 1,
|
|
XACTHEURISTIC_COMMIT = 2,
|
|
XACTHEURISTIC_DAMAGE = 3,
|
|
XACTHEURISTIC_DANGER = 4,
|
|
} XACTHEURISTIC;
|
|
|
|
typedef enum XACTSTAT {
|
|
XACTSTAT_NONE = 0x00000000,
|
|
XACTSTAT_OPENNORMAL = 0x00000001,
|
|
XACTSTAT_OPENREFUSED = 0x00000002,
|
|
XACTSTAT_PREPARING = 0x00000004,
|
|
XACTSTAT_PREPARED = 0x00000008,
|
|
XACTSTAT_PREPARERETAINING = 0x00000010,
|
|
XACTSTAT_PREPARERETAINED = 0x00000020,
|
|
XACTSTAT_COMMITTING = 0x00000040,
|
|
XACTSTAT_COMMITRETAINING = 0x00000080,
|
|
XACTSTAT_ABORTING = 0x00000100,
|
|
XACTSTAT_ABORTED = 0x00000200,
|
|
XACTSTAT_COMMITTED = 0x00000400,
|
|
XACTSTAT_HEURISTIC_ABORT = 0x00000800,
|
|
XACTSTAT_HEURISTIC_COMMIT = 0x00001000,
|
|
XACTSTAT_HEURISTIC_DAMAGE = 0x00002000,
|
|
XACTSTAT_HEURISTIC_DANGER = 0x00004000,
|
|
XACTSTAT_FORCED_ABORT = 0x00008000,
|
|
XACTSTAT_FORCED_COMMIT = 0x00010000,
|
|
XACTSTAT_INDOUBT = 0x00020000,
|
|
XACTSTAT_CLOSED = 0x00040000,
|
|
XACTSTAT_OPEN = 0x00000003,
|
|
XACTSTAT_NOTPREPARED = 0x0007FFC3,
|
|
XACTSTAT_ALL = 0x0007FFFF,
|
|
} XACTSTAT;
|
|
|
|
typedef struct XACTOPT { // Transaction configuration options
|
|
ULONG ulTimeout; // timeout in milliseconds
|
|
char szDescription[MAX_TRAN_DESC]; // description string for admin tools
|
|
} XACTOPT;
|
|
|
|
|
|
//
|
|
//==========================================================================
|
|
// Error code definitions for all transaction related functionality.
|
|
//==========================================================================
|
|
//
|
|
typedef enum XACT_E {
|
|
XACT_E_FIRST = 0x8004D000,
|
|
XACT_E_LAST = 0x8004D01E,
|
|
XACT_S_FIRST = 0x0004D000,
|
|
XACT_S_LAST = 0x0004D009,
|
|
|
|
XACT_E_ALREADYOTHERSINGLEPHASE = 0x8004D000,
|
|
XACT_E_CANTRETAIN = 0x8004D001,
|
|
XACT_E_COMMITFAILED = 0x8004D002,
|
|
XACT_E_COMMITPREVENTED = 0x8004D003,
|
|
XACT_E_HEURISTICABORT = 0x8004D004,
|
|
XACT_E_HEURISTICCOMMIT = 0x8004D005,
|
|
XACT_E_HEURISTICDAMAGE = 0x8004D006,
|
|
XACT_E_HEURISTICDANGER = 0x8004D007,
|
|
XACT_E_ISOLATIONLEVEL = 0x8004D008,
|
|
XACT_E_NOASYNC = 0x8004D009,
|
|
XACT_E_NOENLIST = 0x8004D00A,
|
|
XACT_E_NOISORETAIN = 0x8004D00B,
|
|
XACT_E_NORESOURCE = 0x8004D00C,
|
|
XACT_E_NOTCURRENT = 0x8004D00D,
|
|
XACT_E_NOTRANSACTION = 0x8004D00E,
|
|
XACT_E_NOTSUPPORTED = 0x8004D00F,
|
|
XACT_E_UNKNOWNRMGRID = 0x8004D010,
|
|
XACT_E_WRONGSTATE = 0x8004D011,
|
|
XACT_E_WRONGUOW = 0x8004D012,
|
|
XACT_E_XTIONEXISTS = 0x8004D013,
|
|
XACT_E_NOIMPORTOBJECT = 0x8004D014,
|
|
XACT_E_INVALIDCOOKIE = 0x8004D015,
|
|
XACT_E_INDOUBT = 0x8004D016,
|
|
XACT_E_NOTIMEOUT = 0x8004D017,
|
|
XACT_E_ALREADYINPROGRESS = 0x8004D018,
|
|
XACT_E_ABORTED = 0x8004D019,
|
|
XACT_E_LOGFULL = 0x8004D01A,
|
|
XACT_E_TMNOTAVAILABLE = 0x8004D01B,
|
|
XACT_E_CONNECTION_DOWN = 0x8004D01C,
|
|
XACT_E_CONNECTION_DENIED = 0x8004D01D,
|
|
XACT_E_REENLISTTIMEOUT = 0x8004D01E,
|
|
|
|
XACT_S_ASYNC = 0x0004D000,
|
|
XACT_S_DEFECT = 0x0004D001,
|
|
XACT_S_READONLY = 0x0004D002,
|
|
XACT_S_SOMENORETAIN = 0x0004D003,
|
|
XACT_S_OKINFORM = 0x0004D004,
|
|
XACT_S_MADECHANGESCONTENT = 0x0004D005,
|
|
XACT_S_MADECHANGESINFORM = 0x0004D006,
|
|
XACT_S_ALLNORETAIN = 0x0004D007,
|
|
XACT_S_ABORTING = 0x0004D008,
|
|
XACT_S_SINGLEPHASE = 0x0004D009,
|
|
} XACT_E;
|
|
|
|
}
|
|
|
|
|
|
//
|
|
//==========================================================================
|
|
// Basic transaction interfaces
|
|
//==========================================================================
|
|
//
|
|
|
|
// Transaction interface, single phase
|
|
|
|
[object,uuid(0fb15084-af41-11ce-bd2b-204c4f4f5020), pointer_default(unique)]
|
|
interface ITransaction : IUnknown {
|
|
|
|
HRESULT Commit
|
|
(
|
|
[in] BOOL fRetaining,
|
|
[in] DWORD grfTC,
|
|
[in] DWORD grfRM
|
|
);
|
|
HRESULT Abort
|
|
(
|
|
[in, unique] BOID* pboidReason,
|
|
[in] BOOL fRetaining,
|
|
[in] BOOL fAsync
|
|
);
|
|
HRESULT GetTransactionInfo
|
|
(
|
|
[out] XACTTRANSINFO* pinfo
|
|
);
|
|
}
|
|
|