PRB: Crash in DllMain After FreeLibrary is Called on a Resource DLL (241856)
The information in this article applies to:
- Microsoft Visual C++ 4.0
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET (2002)
This article was previously published under Q241856 SYMPTOMS
You may receive an access violation in DllMain after unloading a DLL using the FreeLibrary() API call.
CAUSE
The DLL was a resource DLL with no entry point. The crash did not occur immediately after the FreeLibrary() call, but rather later on.
The resource DLL was loaded either by LoadLibrary() or with LoadLibraryEx() with the last parameter set to 0.
RESOLUTION
The resource DLL should be loaded with LoadLibraryEx() instead and with the last parameter set to LOAD_LIBRARY_AS_DATAFILE.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 12/11/2003 |
---|
Keywords: | kbDLL kbprb kbResource KB241856 |
---|
|