Re: Critical section leak in advapi32.dll

Tech-Archive recommends: Speed Up your PC by fixing your registry



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.



.



Relevant Pages

  • RE: AppVerifier CoUninitialize Error with Shell Folder Trees
    ... The other issue is that a dll is being unloaded ... ships with AppVerifier has information on how to debug each verifier stop. ... drives, etc. and expand one of the drives, I get errors in AppVerifer. ... found a MFC sample app that exhibits the exact same problem. ...
    (microsoft.public.win32.programmer.tools)
  • Re: Critical section leak in advapi32.dll
    ... windows using a WndProc in the DLL would need to do that). ... the exactly same section reported by AppVerifier. ... does not report such errors when dll is detached on process ... detach as well, causing AppVerifier to panic. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Critical section leak in advapi32.dll
    ... quite a few its functions imported, making this problem non-existent. ... windows using a WndProc in the DLL would need to do that). ... the exactly same section reported by AppVerifier. ... detach as well, causing AppVerifier to panic. ...
    (microsoft.public.win32.programmer.kernel)
  • RE: AppVerifier CoUninitialize Error with Shell Folder Trees
    ... The other issue is that a dll is being unloaded ... ships with AppVerifier has information on how to debug each verifier stop. ... found a MFC sample app that exhibits the exact same problem. ...
    (microsoft.public.win32.programmer.tools)
  • Re: DLL - entry point
    ... E.g., to print a report "emp_list" report, I pass the parameter from the ... > DLLs created with VFP are not function libraries as you can create them ... This means that when you create a DLL with VFP you'll ... > DEFINE CLASS SayHello AS Custom OLEPUBLIC ...
    (microsoft.public.fox.vfp.dbc)