Microsoft KB Archive/178883

{|
 * width="100%"|

BUG: App Paths Registry Not Fully Effective For 16-bit Apps

 * }

Q178883

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * Microsoft Windows 95
 * Microsoft Windows 98

-

SYMPTOMS
When you start a 16-bit Windows application the system, the following error message might appear:

Cannot find . Windows needs this file to run 

CAUSE
The DLL that is implicitly linked to the .exe resides in a directory registered in the App Paths registry entry, and not in the same directory as the .exe.

RESOLUTION
Place the DLLs for an application in the same directory as the .exe.

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION
Applications use the App Paths registry entry so that an application's PATH environment variable will be added to the beginning of some application-specific directories that are set globally. This applies to both 16-bit and 32-bit applications.

The App Paths registry entry is found in the following:

HKEY_LOCAL_MACHINE

\SOFTWARE

\Microsoft

\Windows

\CurrentVersion

\App Paths Each particular application that uses App Paths will have a key name that is the base name and extension of the application. For example, NotePad.exe. The application key contains two REG_SZ values. The default string is the full path to the application name. The other string is a value named "Path" with one or more directory path names separated by a semicolon, similar to the format of the PATH= statement in the AutoExec.bat file.

This entry is effective for most general uses of the PATH environment in an application. However, it will not be effective for any implicitly linked DLLs that reside in a directory listed in the App Paths registry. Implicitly linked DLLs are loaded before the task is fully created and receives the modified PATH environment variable. At that time the system uses the Kernel's environment. The DLL will not be found by the system if it does not reside in the usual places where it may find DLLs. See the comments for LoadLibrary in the Windows 3.1 SDK Function Reference for more information.

However, once the application is fully loaded, it can call LoadLibrary to load DLLs that reside in a directory listed in the App Paths registry. Any functions that use the PATH environment variable will then be able to take advantage of the modified PATH supplied by the App Paths registry.

Additional query words:

Keywords : kbDLL kbKernBase kbThread kbOSWin95bug kbOSWin98bug kbGrpDSKernBase

Issue type : kbbug

Technology : kbAudDeveloper kbWin32sSearch kbWin32API