RtmLockDestination function (rtmv2.h)

The RtmLockDestination function locks or unlocks a destination in the routing table. Use this function to protect a destination while changing opaque pointers.


DWORD RtmLockDestination(
  [in] RTM_ENTITY_HANDLE RtmRegHandle,
  [in] RTM_DEST_HANDLE   DestHandle,
  [in] BOOL              Exclusive,
  [in] BOOL              LockDest


[in] RtmRegHandle

Handle to the client obtained from a previous call to RtmRegisterEntity.

[in] DestHandle

Handle to the destination to lock.

[in] Exclusive

Specifies whether to lock or unlock the destination in an exclusive (TRUE) or shared (FALSE) mode.

[in] LockDest

Specifies whether to lock or unlock the destination. Specify TRUE to lock the destination; specify FALSE to unlock it.

Return value

If the function succeeds, the return value is NO_ERROR.

If the function fails, the return value is one of the following error codes.

Value Meaning
The calling client does not own this destination.
The handle is invalid.


This function also locks the associated routes. Avoid locking destinations for long periods of time, because no other client can access the destination and associated routes until the lock is released.

A client can also use this function when reading information for a destination, while preventing changes during the client's read operation. In this case, consider using RtmGetDestInfo instead.

For sample code using this function, see Update a Route In Place Using RtmUpdateAndUnlockRoute.


Minimum supported client None supported
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header rtmv2.h
Library Rtm.lib
DLL Rtm.dll

See also