mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
GetModuleFileName[A/W] must cope with NULL module handles
svn path=/trunk/; revision=1615
This commit is contained in:
parent
af68ad91d4
commit
6922d2a9e5
1 changed files with 7 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: ldr.c,v 1.10 2001/01/24 04:41:58 phreak Exp $
|
/* $Id: ldr.c,v 1.11 2001/02/10 22:29:35 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT : ReactOS user mode libraries
|
* PROJECT : ReactOS user mode libraries
|
||||||
|
@ -194,6 +194,9 @@ GetModuleFileNameA (
|
||||||
Peb = NtCurrentPeb ();
|
Peb = NtCurrentPeb ();
|
||||||
RtlEnterCriticalSection (Peb->LoaderLock);
|
RtlEnterCriticalSection (Peb->LoaderLock);
|
||||||
|
|
||||||
|
if (hModule == NULL)
|
||||||
|
hModule = Peb->ImageBaseAddress;
|
||||||
|
|
||||||
ModuleListHead = &Peb->Ldr->InLoadOrderModuleList;
|
ModuleListHead = &Peb->Ldr->InLoadOrderModuleList;
|
||||||
Entry = ModuleListHead->Flink;
|
Entry = ModuleListHead->Flink;
|
||||||
|
|
||||||
|
@ -234,7 +237,6 @@ GetModuleFileNameA (
|
||||||
SetLastErrorByStatus (STATUS_DLL_NOT_FOUND);
|
SetLastErrorByStatus (STATUS_DLL_NOT_FOUND);
|
||||||
RtlLeaveCriticalSection (Peb->LoaderLock);
|
RtlLeaveCriticalSection (Peb->LoaderLock);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,6 +259,9 @@ GetModuleFileNameW (
|
||||||
Peb = NtCurrentPeb ();
|
Peb = NtCurrentPeb ();
|
||||||
RtlEnterCriticalSection (Peb->LoaderLock);
|
RtlEnterCriticalSection (Peb->LoaderLock);
|
||||||
|
|
||||||
|
if (hModule == NULL)
|
||||||
|
hModule = Peb->ImageBaseAddress;
|
||||||
|
|
||||||
ModuleListHead = &Peb->Ldr->InLoadOrderModuleList;
|
ModuleListHead = &Peb->Ldr->InLoadOrderModuleList;
|
||||||
Entry = ModuleListHead->Flink;
|
Entry = ModuleListHead->Flink;
|
||||||
while (Entry != ModuleListHead)
|
while (Entry != ModuleListHead)
|
||||||
|
|
Loading…
Reference in a new issue