Re: Critical section leak in advapi32.dll
- From: "Alexander Grigoriev" <alegr@xxxxxxxxxxxxx>
- Date: Mon, 11 Feb 2008 19:11:29 -0800
I think advapi32 was never designed for loading on demand, that's why it
probably wasn't tested for that. Most real world applications have quite a
few its functions imported, making this problem non-existent.
"Arkady Paronian" <ArkadyParonian@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:57EADE16-212E-437B-ADAD-F6CD31C0C9B6@xxxxxxxxxxxxxxxx
"Alexander Grigoriev" wrote:
I'm not sure if it's real issue or just AppVerifier bug.I've hacked together some debugging code to walk down a list of critical
section allocated by the process, and it appears that AppVerifier is
correct
on this one. Double linked list of critical sections
(RtlCriticalSectionListis) is located in ntdll.dll. Comparing the number
of
entries in the list before calling LoadLibrary and after a call to
FreeLibrary shows a difference of one critical section. And this is the
exactly same section reported by AppVerifier.
Most likely, advapi32 is always loaded into a Win32 process. If it's not,
you can always import a name from it to force that. If you just need its
handle for GetProcAddress(), use GetModuleHandle() which doesn't have
side
effects. You don't need to call FreeLibrary then.
This would be the most simple solution, since AppVerifier apparently does
not report such errors when dll is detached on process shutdown. The
problem
is my dll can be loaded by a third-party app as a plug-in. The application
itself does not link with advapi32.dll while my dll does. As soon as
application unloads my dll, advapi32.dll would detach as well, causing
AppVerifier to panic.
.
- Follow-Ups:
- Re: Critical section leak in advapi32.dll
- From: Ben Voigt [C++ MVP]
- Re: Critical section leak in advapi32.dll
- From: Volodymyr M. Shcherbyna
- Re: Critical section leak in advapi32.dll
- References:
- Re: Critical section leak in advapi32.dll
- From: Alexander Grigoriev
- Re: Critical section leak in advapi32.dll
- Prev by Date: How to allocate memory for a linked list of pointers in a kernel process
- Next by Date: Re: How to allocate memory for a linked list of pointers in a kernel process
- Previous by thread: Re: Critical section leak in advapi32.dll
- Next by thread: Re: Critical section leak in advapi32.dll
- Index(es):
Relevant Pages
|