Microsoft KB Archive/102738

From BetaArchive Wiki
Knowledge Base

File and Record Locking in Windows NT

Article ID: 102738

Article Last Modified on 10/31/2006


  • Microsoft Windows NT Advanced Server 3.1
  • Microsoft Windows NT Workstation 3.1
  • Microsoft Windows NT Advanced Server 3.1

This article was previously published under Q102738


Microsoft Windows NT version 3.1 can support file and record locking using appropriate Win32 application programming interfaces (APIs). File sharing with these capabilities can be achieved via Windows NT server message block (SMB) file sharing protocol extensions.


File, record, and field locking are essential for applications that require sharing a file by multiple users who may be entering data concurrently. In Windows NT, this may be achieved by using Win32 APIs.

  • LockFile - Locks a region in an open file. Locking a region with this API denies all other processes read and write access to the specified region.
  • LockFileEx - Locks a byte range within an open file for shared or exclusive access. This API allows read access if shared lock is specified but denies write access.

If the specified file is at a remote location, the file and record locking can be handled by one of the SMB.

  • LOCKING_ANDX_SHARED_LOCK - Locks a byte range within the specified file for shared or exclusive access.


  1. NT LAN Manager SMB File Sharing Protocol Extensions by Chuck Lenzmeir and Manny Weiser.
  2. Microsoft Win32 Programmer's Reference, Volume 4 page 103.

Additional query words: prodnt file locking

Keywords: kbnetwork KB102738