Microsoft KB Archive/324468

= BUG: LoadLibrary and LoadLibraryEx Functions Fail If Directory Name Contains a Period =

Article ID: 324468

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Win32 Application Programming Interface, when used with:  Microsoft Windows XP Professional

 Microsoft Windows 2000 Standard Edition

 Microsoft Windows NT 4.0 

-

<div class="notice_section">

This article was previously published under Q324468

<div class="symptoms_section">

SYMPTOMS
The LoadLibrary or the LoadLibraryEx function may fail with error 126 (ERROR_MOD_NOT_FOUND) if a directory name in the path contains a period.

<div class="cause_section">

CAUSE
This error occurs under the following circumstances:
 * You call LoadLibrary or LoadLibraryEx with a qualifying path does not specify an extension. -and-


 * One or more of the directories on the path that you specify contains a period (.).

For example: hDLL = LoadLibrary(&quot;C:\\MY.DLLs\\ABC&quot;);

<div class="resolution_section">

RESOLUTION
To work around this problem, specify a fully qualified file name that includes the file name extension when you call LoadLibrary or LoadLibraryEx. For example: hDll = LoadLibrary(&quot;C:\\MY.DLLs\\ABC.DLL&quot;);

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

MORE INFORMATION
According to the Microsoft Platform Software Development Kit (SDK) documentation for LoadLibrary and LoadLibraryEx, if you do not include the file name extension with the file name, the system tries to load a file with no extension. If such a file does not exist, the .dll extension is appended to the file name, and the system tries to load the file again. The error that is listed in the &quot;Symptoms&quot; section occurs only if the directory in the path that is passed to LoadLibrary or LoadLibraryEx contains a period (.) and if no extension is appended to the .dll file name.

Keywords: kbapi kbbug kbdll kbkernbase kbpending KB324468

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.