- added Ldr* information to include/winternl.h
- exported a few functions/global vars from module.h while we move
code from loader/module.c to dlls/ntdll/loader.c
- implemented LdrShutdownProcess, LdrShutdownThread and
LdrDisableThreadCalloutsForDll (and made use of them)
diff --git a/loader/module.c b/loader/module.c
index 771b098..ecab5fe 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -49,9 +49,9 @@
static WINE_MODREF *exe_modref;
static int free_lib_count; /* recursion depth of FreeLibrary calls */
-static int process_detaching; /* set on process detach to avoid deadlocks with thread detach */
+int process_detaching = 0; /* set on process detach to avoid deadlocks with thread detach */
-static CRITICAL_SECTION loader_section = CRITICAL_SECTION_INIT( "loader_section" );
+CRITICAL_SECTION loader_section = CRITICAL_SECTION_INIT( "loader_section" );
/***********************************************************************
* wait_input_idle
@@ -77,7 +77,7 @@
* looks for the referenced HMODULE in the current process
* NOTE: Assumes that the process critical section is held!
*/
-static WINE_MODREF *MODULE32_LookupHMODULE( HMODULE hmod )
+WINE_MODREF *MODULE32_LookupHMODULE( HMODULE hmod )
{
WINE_MODREF *wm;
@@ -141,7 +141,7 @@
/*************************************************************************
* MODULE_InitDLL
*/
-static BOOL MODULE_InitDLL( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
+BOOL MODULE_InitDLL( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
{
BOOL retv = TRUE;
@@ -362,20 +362,11 @@
*/
BOOL WINAPI DisableThreadLibraryCalls( HMODULE hModule )
{
- WINE_MODREF *wm;
- BOOL retval = TRUE;
+ NTSTATUS nts = LdrDisableThreadCalloutsForDll( hModule );
+ if (nts == STATUS_SUCCESS) return TRUE;
- RtlEnterCriticalSection( &loader_section );
-
- wm = MODULE32_LookupHMODULE( hModule );
- if ( !wm )
- retval = FALSE;
- else
- wm->flags |= WINE_MODREF_NO_DLL_CALLS;
-
- RtlLeaveCriticalSection( &loader_section );
-
- return retval;
+ SetLastError( RtlNtStatusToDosError( nts ) );
+ return FALSE;
}