http://bugs.winehq.org/show_bug.cgi?id=28913
Bug #: 28913 Summary: Wininet.dll violates DLL unloading requirements by calling Winsock functions from DLL_PROCESS_DETACH Product: Wine Version: 1.3.31 Platform: All OS/Version: All Status: UNCONFIRMED Severity: normal Priority: P2 Component: wininet AssignedTo: wine-bugs@winehq.org ReportedBy: aicommander@gmail.com Classification: Unclassified
Currently, Wininet has the following callchain in DllMain() handling DLL_PROCESS_DETACH: collect_connections() -> free_netconn() -> closesocket(). This is invalid because it calls into ws2_32.dll after it may have already received DLL_PROCESS_DETACH and freed instance variables (locks, lists, and things) it needs to handle API calls. This is in direct violation of MSDN's documentation regarding DllMain():
"Calling functions that require DLLs other than Kernel32.dll may result in problems that are difficult to diagnose. For example, calling User, Shell, and COM functions can cause access violation errors, because some functions load other system components. Conversely, calling functions such as these during termination can cause access violation errors because the corresponding component may already have been unloaded or uninitialized."
from: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682583(v=vs.85).as...
I'm not sure the right way to go about fixing this one. I see why it's necessary to cleanup those connections but I don't where the right place is to do it. Any suggestions/fixes would be greatly appreciated.