PRB: If Network Drive is not Available DLL Can't be Loaded

Last reviewed: January 11, 1997
Article ID: Q155793
The information in this article applies to:
  • Microsoft Win32 Software Development Kit for

        - Microsoft Windows NT, versions 3.51 and 4.0
    

SYMPTOMS

The location of a dynamic-link library (DLL) is specified in the Path environment variable. In the Path environment variable, if a network path is defined before the path that contains the DLL, the following problem can occur.

For example, if you use the following path command, where S: is a network drive:

Path=S:\;D:\Mydll or Path=\\franki\public;d:\Mydll

The process which loads the DLL does not have security access to the network drive specified in the Path environment variable. When the operating system searches for the DLL and comes across the inaccessible network drive, the search ends instead of moving on to the next specified path in the Path environment variable.

If the application is implicitly loading the DLL, you get the following error message:

   The application failed to initialize properly (0xc0000022). Click on
   OK to terminate the application.

If the DLL is being explicitly loaded via the LoadLibrary or LoadLibraryEx API call, the call fails with an error code 5 or Access denied.

CAUSE

When the operating system reaches the path environment variable, it concatenates the DLL name to the path. For example, if the path is

 D:\Mydll  and the name of the DLL is Mydll.dll, the operating system tries
to open up the file D:\Mydll\Mydll.dll. The CreateFile API call which is used to open the file cannot distinguish between an Access denied error caused by a process which cannot access a file versus a process which cannot access the network drive that contains the file. Because this distinction cannot be made, the operating system assumes that the file exists but cannot be accessed by the process. This error causes the operating system to discontinue the search for the DLL and assume that the DLL cannot be accessed even though the DLL is located in one of paths defined after the network drive.


KBCategory: kbenv kbprb
KBSubcategory: BseDll BseSecurity
Additional reference words: 3.51 4.00 kbdss



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: January 11, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.