TBLT_RETC TBLT_ENTRY BltUnlockEx(TBLT_LOCKEX *lockExPtr, ULONG *slotPtr); lockExPtr I:lock control structure slotPtr O:slot that failedThis routine unlocks all the items in the lock pack as a single transaction.
The following TBLT_LOCKEX structure must be filled, one for each operation in the list to perform, and must exactly match the corresponding BltLockEx() call made:
typedef struct _BLTLOCKEX { VOID *khdhPtr; // I:KH or DH of file ULONG mode; // set to 0 (not used for unlock) ULONG recNoStart; // I:for DH locks ULONG recCount; // I:for DH locks ULONG action; // O:action performed (I:set to 0) ULONG flags; // I:operation flags VOID *rsvPtr; // set to 0 (used internally) VOID *nextPtr; // I:next TBLT_IUEX, or 0 if no more } TBLT_LOCKEX;
khdhPtr
may be either a TBLT_KH or TBLT_DH structure.
This routine performs a transaction of BltUnlockDataRecord()
and/or
BltUnlockIx4File()
calls, depending on khdhPtr.
If khdhPtr refers to a data file, the BltUnlockDataRecord()
routine is
called for the operation (for recNoStart
, and recCount
see BltUnlockDataRecord()
).
If khdhPtr refers to an index file, the BltUnlockIx4File()
routine is
called for the operation (recNoStart
and recCount
are not
used unless FLAGSEX_LOCK_DUAL
is specified (see flags below)).
action
is the action performed on this list item. Action is set to
one of the following values for each operation in the list:
0 = nothing done (error encountered) 1 = unlocked index okay 2 = unlocked data okay 3 = unlocked index and data okay (possible if flags.bit7=1, 0x80)
flags
modifies the operation performed on this item:
FLAGSEX_LOCK_DUAL: if khdhPtr is an index file, then khPtr->xbLinkPtr is also unlocked using the information in .recNoStart and .recNoCount (flags.bit7=1)
rsvPtr
is used internally, and should be initialized to 0.
nextPtr
is used to link to the next operation in the list. Each
operation uses a separate TBLT_LOCKEX structure. When linked together via this
nextPtr, the list becomes the transaction list: each operation (each LOCKEX) is
executed in order; if all operations succeed, the transaction is successful.
Set .nextPtr to 0 in the last list operation.
If any unlock operation failed, for whatever reason, all following list items are not processed. This means that the programmer must correct the cause of the error and restart the unlock, this time starting not at the first list item, but at the item that failed (ie, the item at number *slotPtr), and have the rest of the unlocks processed.
Note: *slotPtr is a pointer to a ULONG. This is the number of the list item the failed, starting at 1 (the first slot is slot 1).
Return: Non-zero indicates an error, with *slotPtr set to the list item that failed (slot 1 is the first item in the list); otherwise all operations in the list completed successfully.