Microsoft KB Archive/155793

{|
 * width="100%"|

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

 * }

Q155793

-

The information in this article applies to:


 * Microsoft Win32 Software Development Kit (SDK), used with:
 * the operating system: Microsoft Windows NT, versions 3.51, 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.

Additional query words: kbdss

Keywords : kbenv kbAPI kbDLL kbFileIO kbKernBase kbDSupport kbGrpDSKernBase

Issue type : kbprb

Technology : kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWin32sSearch