(see http://www.smidgeonsoft.com/ for the details)
A+ -- Eric Pouech
Common subdirectories: dlls/ntdll8/CVS and dlls/ntdll/CVS diff -u -x '*~' -x '.#*' dlls/ntdll8/loader.c dlls/ntdll/loader.c --- dlls/ntdll8/loader.c 2003-03-20 20:21:54.000000000 +0100 +++ dlls/ntdll/loader.c 2003-03-20 20:28:09.000000000 +0100 @@ -134,6 +134,7 @@ if (!exe_modref) exe_modref = wm; else FIXME( "Trying to load second .EXE file: %s\n", filename ); } + else wm->ldr.Flags |= LDR_IMAGE_IS_DLL; } return wm; } @@ -149,7 +150,7 @@ /* Skip calls for modules loaded with special load flags */ - if (wm->flags & WINE_MODREF_DONT_RESOLVE_REFS) return TRUE; + if (wm->ldr.Flags & LDR_DONT_RESOLVE_REFS) return TRUE; TRACE("(%s,%s,%p) - CALL\n", wm->modname, typeName[type], lpReserved ); @@ -209,14 +210,14 @@ assert( wm ); /* prevent infinite recursion in case of cyclical dependencies */ - if ( ( wm->flags & WINE_MODREF_MARKER ) - || ( wm->flags & WINE_MODREF_PROCESS_ATTACHED ) ) + if ( ( wm->ldr.Flags & LDR_LOAD_IN_PROGRESS ) + || ( wm->ldr.Flags & LDR_PROCESS_ATTACHED ) ) goto done; TRACE("(%s,%p) - START\n", wm->modname, lpReserved ); /* Tag current MODREF to prevent recursive loop */ - wm->flags |= WINE_MODREF_MARKER; + wm->ldr.Flags |= LDR_LOAD_IN_PROGRESS; /* Recursively attach all DLLs this one depends on */ for ( i = 0; retv && i < wm->nDeps; i++ ) @@ -228,7 +229,7 @@ { retv = MODULE_InitDLL( wm, DLL_PROCESS_ATTACH, lpReserved ); if ( retv ) - wm->flags |= WINE_MODREF_PROCESS_ATTACHED; + wm->ldr.Flags |= LDR_PROCESS_ATTACHED; } /* Re-insert MODREF at head of list */ @@ -243,10 +244,11 @@ } /* Remove recursion flag */ - wm->flags &= ~WINE_MODREF_MARKER; + wm->ldr.Flags &= ~LDR_LOAD_IN_PROGRESS; TRACE("(%s,%p) - END\n", wm->modname, lpReserved ); + done: RtlLeaveCriticalSection( &loader_section ); return retv; @@ -270,13 +272,13 @@ for ( wm = MODULE_modref_list; wm; wm = wm->next ) { /* Check whether to detach this DLL */ - if ( !(wm->flags & WINE_MODREF_PROCESS_ATTACHED) ) + if ( !(wm->ldr.Flags & LDR_PROCESS_ATTACHED) ) continue; if ( wm->ldr.LoadCount > 0 && !bForceDetach ) continue; /* Call detach notification */ - wm->flags &= ~WINE_MODREF_PROCESS_ATTACHED; + wm->ldr.Flags &= ~LDR_PROCESS_ATTACHED; MODULE_InitDLL( wm, DLL_PROCESS_DETACH, lpReserved ); /* Restart at head of WINE_MODREF list, as entries might have @@ -313,9 +315,9 @@ for ( ; wm; wm = wm->prev ) { - if ( !(wm->flags & WINE_MODREF_PROCESS_ATTACHED) ) + if ( !(wm->ldr.Flags & LDR_PROCESS_ATTACHED) ) continue; - if ( wm->flags & WINE_MODREF_NO_DLL_CALLS ) + if ( wm->ldr.Flags & LDR_NO_DLL_CALLS ) continue; MODULE_InitDLL( wm, DLL_THREAD_ATTACH, lpReserved ); @@ -339,7 +341,7 @@ if ( !wm ) ret = STATUS_DLL_NOT_FOUND; else - wm->flags |= WINE_MODREF_NO_DLL_CALLS; + wm->ldr.Flags |= LDR_NO_DLL_CALLS; RtlLeaveCriticalSection( &loader_section ); @@ -634,10 +636,10 @@ { (*pwm)->ldr.LoadCount++; - if (((*pwm)->flags & WINE_MODREF_DONT_RESOLVE_REFS) && + if (((*pwm)->ldr.Flags & LDR_DONT_RESOLVE_REFS) && !(flags & DONT_RESOLVE_DLL_REFERENCES)) { - (*pwm)->flags &= ~WINE_MODREF_DONT_RESOLVE_REFS; + (*pwm)->ldr.Flags &= ~LDR_DONT_RESOLVE_REFS; PE_fixup_imports( *pwm ); } TRACE("Already loaded module '%s' at %p, count=%d\n", filename, (*pwm)->ldr.BaseAddress, (*pwm)->ldr.LoadCount); @@ -784,9 +786,9 @@ for ( wm = MODULE_modref_list; wm; wm = wm->next ) { - if ( !(wm->flags & WINE_MODREF_PROCESS_ATTACHED) ) + if ( !(wm->ldr.Flags & LDR_PROCESS_ATTACHED) ) continue; - if ( wm->flags & WINE_MODREF_NO_DLL_CALLS ) + if ( wm->ldr.Flags & LDR_NO_DLL_CALLS ) continue; MODULE_InitDLL( wm, DLL_THREAD_DETACH, NULL ); @@ -852,7 +854,7 @@ { int i; - if ( wm->flags & WINE_MODREF_MARKER ) + if ( wm->ldr.Flags & LDR_UNLOAD_IN_PROGRESS ) return; if ( wm->ldr.LoadCount <= 0 ) @@ -863,13 +865,13 @@ if ( wm->ldr.LoadCount == 0 ) { - wm->flags |= WINE_MODREF_MARKER; + wm->ldr.Flags |= LDR_UNLOAD_IN_PROGRESS; for ( i = 0; i < wm->nDeps; i++ ) if ( wm->deps[i] ) MODULE_DecRefCount( wm->deps[i] ); - wm->flags &= ~WINE_MODREF_MARKER; + wm->ldr.Flags &= ~LDR_UNLOAD_IN_PROGRESS; } } diff -u -x '*~' -x '.#*' include8/module.h include/module.h --- include8/module.h 2003-03-20 20:20:15.000000000 +0100 +++ include/module.h 2003-03-20 20:28:09.000000000 +0100 @@ -139,8 +139,6 @@ int nDeps; struct _wine_modref **deps; - int flags; - char *filename; char *modname; char *short_filename; @@ -149,12 +147,6 @@ char data[1]; /* space for storing filename and short_filename */ } WINE_MODREF; -#define WINE_MODREF_INTERNAL 0x00000001 -#define WINE_MODREF_NO_DLL_CALLS 0x00000002 -#define WINE_MODREF_PROCESS_ATTACHED 0x00000004 -#define WINE_MODREF_DONT_RESOLVE_REFS 0x00000020 -#define WINE_MODREF_MARKER 0x80000000 - extern WINE_MODREF *MODULE_modref_list; /* Resource types */ Common subdirectories: include8/msvcrt and include/msvcrt Common subdirectories: include8/wine and include/wine diff -u -x '*~' -x '.#*' include8/winternl.h include/winternl.h --- include8/winternl.h 2003-03-20 19:34:00.000000000 +0100 +++ include/winternl.h 2003-03-20 20:28:09.000000000 +0100 @@ -1174,6 +1174,18 @@ ULONG TimeDateStamp; } LDR_MODULE, *PLDR_MODULE; +/* those defines are (some of the) regular LDR_MODULE.Flags values */ +#define LDR_IMAGE_IS_DLL 0x00000004 +#define LDR_LOAD_IN_PROGRESS 0x00001000 +#define LDR_UNLOAD_IN_PROGRESS 0x00002000 +#define LDR_NO_DLL_CALLS 0x00040000 +#define LDR_PROCESS_ATTACHED 0x00080000 +#define LDR_MODULE_REBASED 0x00200000 + +/* these ones is Wine specific */ +#define LDR_DONT_RESOLVE_REFS 0x40000000 +#define LDR_WINE_INTERNAL 0x80000000 + /* FIXME: to be checked */ #define MAXIMUM_FILENAME_LENGTH 256 Only in include: winternl.h.orig Common subdirectories: loader8/CVS and loader/CVS Common subdirectories: loader8/ne and loader/ne diff -u -x '*~' -x '.#*' loader8/pe_image.c loader/pe_image.c --- loader8/pe_image.c 2003-03-20 20:20:15.000000000 +0100 +++ loader/pe_image.c 2003-03-20 20:28:09.000000000 +0100 @@ -508,10 +508,10 @@ { NE_MODULE *pModule = (NE_MODULE *)GlobalLock16( hModule16 ); pModule->flags |= NE_FFLAGS_BUILTIN; - wm->flags |= WINE_MODREF_INTERNAL; + wm->ldr.Flags |= LDR_WINE_INTERNAL; } else if ( flags & DONT_RESOLVE_DLL_REFERENCES ) - wm->flags |= WINE_MODREF_DONT_RESOLVE_REFS; + wm->ldr.Flags |= LDR_DONT_RESOLVE_REFS; wm->find_export = PE_FindExportedFunction; @@ -522,7 +522,7 @@ /* Fixup Imports */ - if (!(wm->flags & WINE_MODREF_DONT_RESOLVE_REFS) && + if (!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS) && PE_fixup_imports( wm )) { /* remove entry from modref chain */ Common subdirectories: misc8/CVS and misc/CVS diff -u -x '*~' -x '.#*' misc8/version.c misc/version.c --- misc8/version.c 2003-03-20 20:20:15.000000000 +0100 +++ misc/version.c 2003-03-20 20:28:09.000000000 +0100 @@ -464,7 +464,7 @@ ophd->MajorSubsystemVersion, ophd->MinorSubsystemVersion); /* test if it is an external (native) dll */ - if (!(wm->flags & WINE_MODREF_INTERNAL)) + if (!(wm->ldr.Flags & LDR_WINE_INTERNAL)) { int i; for (i = 0; special_dlls[i]; i++) Common subdirectories: relay328/CVS and relay32/CVS diff -u -x '*~' -x '.#*' relay328/relay386.c relay32/relay386.c --- relay328/relay386.c 2003-03-20 20:20:15.000000000 +0100 +++ relay32/relay386.c 2003-03-20 20:28:09.000000000 +0100 @@ -238,7 +238,7 @@ for (wm = MODULE_modref_list; wm; wm = wm->next) { - if (!(wm->flags & WINE_MODREF_INTERNAL)) continue; + if (!(wm->ldr.Flags & LDR_WINE_INTERNAL)) continue; exp = RtlImageDirectoryEntryToData( wm->ldr.BaseAddress, TRUE, IMAGE_DIRECTORY_ENTRY_EXPORT, &size ); if (!exp) continue; debug = (DEBUG_ENTRY_POINT *)((char *)exp + size); Common subdirectories: scheduler8/CVS and scheduler/CVS