BUG: GetModuleFileName() Returns Relative File Path (85330)



The information in this article applies to:

  • Microsoft Windows Software Development Kit (SDK) 3.1

This article was previously published under Q85330

SYMPTOMS

When the GetModuleFileName() function returns a reference to a dynamic-link library (DLL) file, the reference is relative (not fully qualified) under the following circumstances:

  • One of the directory references in the MS-DOS PATH environment variable is relative. Assume that the relative directory reference refers to drive X.
  • An application is implicitly linked to a DLL. The DLL is installed in the current (default) directory of drive X.
  • The application is installed in a directory other than the one in which the DLL is installed.

STATUS

Microsoft has confirmed this to be a bug in Windows version 3.1. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The following describes the situations under which this problem occurs:

  • The PATH statement in the AUTOEXEC.BAT file resembles the following:
          PATH=C:\DOS;C:\WINDOWS;D:.;C:\APPS
    						
    The relative reference in this path refers to drive D.
  • Run an application from the C:\WINDOWS directory that implicitly links to a DLL that is stored in the current (default) directory of the D drive.
  • If any application calls the GetModuleFileName() to retrieve the file name for the DLL, the function returns a relative reference to the file (for example, D:.\DLL.DLL).

Modification Type:MajorLast Reviewed:11/6/1999
Keywords:KB85330