IByteBuffer::UnlockRegion method

[The UnlockRegion method is available for use in the operating systems specified in the Requirements section. It is not available for use in Windows Server 2003 with Service Pack 1 (SP1) and later, Windows Vista, Windows Server 2008, and subsequent versions of the operating system. The IStream interface provides similar functionality.]

The UnlockRegion method removes the access restriction on a range of bytes previously restricted by using IByteBuffer::LockRegion.

Syntax

HRESULT UnlockRegion(
  [in] LONG libOffset,
  [in] LONG cb,
  [in] LONG dwLockType
);

Parameters

libOffset [in]

Byte offset for the beginning of the range.

cb [in]

Length, in bytes, of the range to be restricted.

dwLockType [in]

Access restrictions previously placed on the range.

Return value

The return value is an HRESULT. A value of S_OK indicates the call was successful.

Remarks

The IByteBuffer::UnlockRegion method unlocks a region previously locked by using the IByteBuffer::LockRegion method. Locked regions must later be explicitly unlocked by calling IByteBuffer::UnlockRegion with exactly the same values for the libOffset, cb, and dwLockType parameters. The region must be unlocked before the stream is released. Two adjacent regions cannot be locked separately and then unlocked with a single unlock call.

Examples

The following example shows unlocking a range of bytes.

HRESULT  hr;

// Unlock a region.
hr = pIByteBuff->UnlockRegion(0, 10, LOCK_EXCLUSIVE);
if (FAILED(hr))
  printf("Failed IByteBuffer::UnlockRegion\n");

Requirements

Requirement Value
Minimum supported client
Windows XP [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
End of client support
Windows XP
End of server support
Windows Server 2003
Header
Scardssp.h
Type library
Scardssp.tlb
DLL
Scardssp.dll
IID
IID_IByteBuffer is defined as E126F8FE-A7AF-11D0-B88A-00C04FD424B9