Set the lpvReserved parameter of DllMain according to whether the DLL was

loaded using LoadLibrary or at start time by the system loader.  DLLs use
this mechanism to determine how they were loaded.

svn path=/trunk/; revision=6466
This commit is contained in:
Art Yerkes
2003-10-30 15:52:29 +00:00
parent 39dca294c5
commit f382315b71
2 changed files with 14 additions and 6 deletions
+6 -1
View File
@@ -1,4 +1,4 @@
/* $Id: ldr.c,v 1.16 2003/07/10 18:50:51 chorns Exp $
/* $Id: ldr.c,v 1.17 2003/10/30 15:52:29 arty Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT : ReactOS user mode libraries
@@ -130,6 +130,11 @@ LoadLibraryExW (
if ( lpLibFileName == NULL )
return NULL;
dwFlags &=
DONT_RESOLVE_DLL_REFERENCES |
LOAD_LIBRARY_AS_DATAFILE |
LOAD_WITH_ALTERED_SEARCH_PATH;
RtlInitUnicodeString (&DllName, (LPWSTR)lpLibFileName);
Status = LdrLoadDll(NULL, dwFlags, &DllName, (PVOID*)&hInst);
if ( !NT_SUCCESS(Status))
+8 -5
View File
@@ -1,4 +1,4 @@
/* $Id: utils.c,v 1.71 2003/09/12 17:51:47 vizzini Exp $
/* $Id: utils.c,v 1.72 2003/10/30 15:52:29 arty Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -25,6 +25,7 @@
#include <ntdll/ldr.h>
#include <ntos/minmax.h>
#define LDRP_PROCESS_CREATION_TIME 0x8000000
#ifdef DBG_NTDLL_LDR_UTILS
#define NDEBUG
@@ -613,7 +614,9 @@ LdrLoadDll (IN PWSTR SearchPath OPTIONAL,
DPRINT("Calling entry point at 0x%08x\n", Entrypoint);
if (FALSE == Entrypoint(Module->BaseAddress,
DLL_PROCESS_ATTACH,
NULL))
(void *)
((LoadFlags & LDRP_PROCESS_CREATION_TIME) ?
1 : 0)))
{
/* Do this as a DPRINT1 for now, until clean up and fail implemented */
DPRINT1("NTDLL.LDR: DLL \"%wZ\" failed to initialize\n",
@@ -820,7 +823,7 @@ LdrFixupForward(PCHAR ForwardName)
if (!NT_SUCCESS(Status))
{
Status = LdrLoadDll(NULL,
0,
LDRP_PROCESS_CREATION_TIME,
&DllName,
&BaseAddress);
if (!NT_SUCCESS(Status))
@@ -1293,7 +1296,7 @@ static NTSTATUS LdrFixupImports(PIMAGE_NT_HEADERS NTHeaders,
if (!NT_SUCCESS(Status))
{
Status = LdrLoadDll(NULL,
0,
LDRP_PROCESS_CREATION_TIME,
&DllName,
&BaseAddress);
RtlFreeUnicodeString (&DllName);
@@ -1775,7 +1778,7 @@ LdrShutdownProcess (VOID)
DPRINT("Calling entry point at 0x%08x\n", Entrypoint);
Entrypoint (Module->BaseAddress,
DLL_PROCESS_DETACH,
NULL);
(void *)TRUE);
}
Entry = Entry->Blink;