mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-05 16:19:40 +00:00
Fix swapped FreeLibary return values. Handle FreeLibrary( 0 ) better.
Fix DLL_PROCESS_DETACH call sequence bugs resulting from nested FreeLibrary calls.
This commit is contained in:
parent
1d58651149
commit
6315a7f334
|
@ -57,7 +57,7 @@ typedef struct _PDB
|
|||
WORD module; /* 2a IMTE for the process module */
|
||||
WORD threads; /* 2c Number of threads */
|
||||
WORD running_threads; /* 2e Number of running threads */
|
||||
WORD unknown3; /* 30 Unknown */
|
||||
WORD free_lib_count; /* 30 Recursion depth of FreeLibrary calls */
|
||||
WORD ring0_threads; /* 32 Number of ring 0 threads */
|
||||
HANDLE system_heap; /* 34 System heap to allocate handles */
|
||||
HTASK task; /* 38 Win16 task */
|
||||
|
@ -96,6 +96,7 @@ typedef struct _PDB
|
|||
} PDB;
|
||||
|
||||
/* Process flags */
|
||||
#define PDB32_DEBUGGED 0x0001 /* Process is being debugged */
|
||||
#define PDB32_WIN16_PROC 0x0008 /* Win16 process */
|
||||
#define PDB32_DOS_PROC 0x0010 /* Dos process */
|
||||
#define PDB32_CONSOLE_PROC 0x0020 /* Console process */
|
||||
|
|
|
@ -1529,17 +1529,19 @@ static void MODULE_FlushModrefs(void)
|
|||
*/
|
||||
BOOL WINAPI FreeLibrary(HINSTANCE hLibModule)
|
||||
{
|
||||
BOOL retv = TRUE;
|
||||
BOOL retv = FALSE;
|
||||
WINE_MODREF *wm;
|
||||
|
||||
EnterCriticalSection( &PROCESS_Current()->crit_section );
|
||||
PROCESS_Current()->free_lib_count++;
|
||||
|
||||
wm = MODULE32_LookupHMODULE( hLibModule );
|
||||
if ( !wm )
|
||||
if ( !wm || !hLibModule )
|
||||
SetLastError( ERROR_INVALID_HANDLE );
|
||||
else
|
||||
retv = MODULE_FreeLibrary( wm );
|
||||
|
||||
PROCESS_Current()->free_lib_count--;
|
||||
LeaveCriticalSection( &PROCESS_Current()->crit_section );
|
||||
|
||||
return retv;
|
||||
|
@ -1588,13 +1590,14 @@ BOOL MODULE_FreeLibrary( WINE_MODREF *wm )
|
|||
MODULE_DecRefCount( wm );
|
||||
|
||||
/* Call process detach notifications */
|
||||
MODULE_DllProcessDetach( FALSE, NULL );
|
||||
if ( PROCESS_Current()->free_lib_count <= 1 )
|
||||
MODULE_DllProcessDetach( FALSE, NULL );
|
||||
|
||||
MODULE_FlushModrefs();
|
||||
|
||||
TRACE_(module)("(%s) - END\n", wm->modname );
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue