KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q85330: BUG: GetModuleFileName() Returns Relative File Path

Article: Q85330
Product(s): Microsoft Windows Software Development Kit
Version(s): WINDOWS:3.1
Operating System(s): 
Keyword(s): 
Last Modified: 06-NOV-1999

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Windows Software Development Kit (SDK) 3.1 
-------------------------------------------------------------------------------

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).

Additional query words: buglist3.10 3.10

======================================================================
Keywords          :  
Technology        : kbAudDeveloper kbWin3xSearch kbSDKSearch kbWinSDKSearch kbWinSDK310
Version           : WINDOWS:3.1

=============================================================================

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.