The information in this article applies to:
SYMPTOMS
When WBEM service is stopped by the user (either explicitly or during
system shutdown), any providers (instance, class, event, and so on) that
are still loaded at that time will not be released. Also, an in-process
provider's DllCanUnloadNow entry point will not be called. Moreover, if an
in-process provider is in the middle of a method call at the time of the
shutdown, the executing thread can be terminated in the middle of the call.
If WBEM shuts down while a provider is loaded, some of the routines that
normally handle cleanup (the object's destructor and DllCanUnloadNow) are
not called. The only routine guaranteed to be called (except in exceptional
circumstances) is the DLL entry point ("DllMain"). This makes provider
cleanup more difficult.
Q148791 How to Provide Your Own DllMain in an MFC Regular DLLAn alternative approach is to put the cleanup code in the destructor of a global class. Global objects are not allocated on the heap, and are automatically destroyed during DLL unload. For example:
There are many restrictions as to what can be done in the cleanup code with
either approach. Neither threads, nor any DLLs that are not implicitly
linked, may be accessed in any way, and COM calls cannot be made under any
circumstances. See "Win32 Q & A" in Microsoft Systems Journal March 1996
Number 3 and September 1996 Number 9 for more information.
Note that out-of-process providers do not experience any of these problems, because they are not terminated when WBEM service shuts down. Providers for whom cleanup and termination robustness issues are more important than performance may want to consider making themselves out-of-process. STATUSThis problem is scheduled to be corrected in a future release. REFERENCESFor additional information, please see the following article in the Microsoft Knowledge Base: Q148791 How to Provide Your Own DllMain in an MFC Regular DLL Additional query words: kbDSupport
Keywords : kbweb kbDLL kbMFC kbWBEM100 |
Last Reviewed: January 10, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |