File and Record Locking in Windows NT

Last reviewed: May 8, 1997
Article ID: Q102738

The information in this article applies to:
  • Microsoft Windows NT operating system, version 3.1
  • Microsoft Windows NT Advanced Server, version 3.1

SUMMARY

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.

MORE INFORMATION

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.

Reference(s):

  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 ntnetserv
Version : 3.1
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 8, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.