KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q59761: "Permission Denied" with > 20 LOCKs with SHARE Loaded

Article: Q59761
Product(s): See article
Version(s): 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | SR# S900221-77 B_GWBasicI B_BasicCom | mspl13_basic
Last Modified: 26-MAR-1990

With the DOS SHARE utility loaded, the error message, "Permission
Denied" occurs when a program attempts to LOCK more than the available
number of LOCKs. The number of LOCKs is specified with the /L:n option
for the SHARE command. The default number of LOCKs is 20.

This information applies to Microsoft GW-BASIC Versions 3.23, 3.22,
and 3.20, to Microsoft QuickBASIC Versions 4.00, 4.00b, and 4.50, to
Microsoft BASIC Compiler Versions 6.00 and 6.00b, and to Microsoft
BASIC Professional Development System (PDS) Version 7.00 for MS-DOS.

Without SHARE loaded, GW-BASIC gives "Permission Denied" on the first
LOCK statement. With QuickBASIC and the BASIC compilers (listed
above), 3120 LOCKs can be performed without SHARE loaded before the
"Permission Denied" error occurs.

For more information about the SHARE statement, please see the MS-DOS
reference manual.

Code Example
------------

The following code example tests the number of LOCKs available on a
system:

   10  ON ERROR GOTO 100
   20  REM Note: File does not need to exist before run to LOCK records.
   30  OPEN "xxxx.xxx" FOR RANDOM AS #1
   40  FOR i%=1 TO 32767
   50    LOCK #1,i%
   60  NEXT
   70  PRINT "More than 32767 LOCKs available!"
   80  END
   100 PRINT "Permission Denied (";ERR;")"
   110 PRINT "Number of locks = ";i%-1
   120 END

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.

Copyright Microsoft Corporation 1986-2002.