[MPlayer-cygwin] [patch] small hddraw_dll cleanup
Sascha Sommer
saschasommer at freenet.de
Thu Jan 6 19:51:02 CET 2005
> > Yes, but FreeLibrary frees the dll. It does not change the handles. Just
> > like when you do free() on a block of memory and use it afterwards. It
> > may still work, but most of the time it simply crashes.
>
> all I can say is acording to M$ it has a reference count.
>
> have a look:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/ba
>se/freelibrary.asp
>
"Each process maintains a reference count for each loaded library module. This
reference count is incremented each time LoadLibrary is called and is
decremented each time FreeLibrary is called. A DLL module loaded at process
initialization due to load-time dynamic linking has a reference count of one.
This count is incremented if the same module is loaded by a call to
LoadLibrary."
We don't do load-time dynamic linking and LoadLibrary is called only once, no?
If no other apps using directdraw dll are running the reference count will be
0 and the dll gets unmapped. The pointers to the functions stay the same as
before and are therefore invalid.
The reasons it might work for you are maybe that ddraw.dll gets already loaded
at sytem start or some other app like ATI Display monitor keeps accessing it.
Sascha
More information about the MPlayer-cygwin
mailing list