mirror of
https://github.com/reactos/reactos.git
synced 2025-01-13 01:22:03 +00:00
Correctly handle optional parameters
svn path=/trunk/; revision=23966
This commit is contained in:
parent
022504ad3c
commit
2417bf273f
1 changed files with 9 additions and 6 deletions
|
@ -727,7 +727,7 @@ LdrpMapDllImageFile(IN PWSTR SearchPath OPTIONAL,
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS NTAPI
|
||||||
LdrLoadDll (IN PWSTR SearchPath OPTIONAL,
|
LdrLoadDll (IN PWSTR SearchPath OPTIONAL,
|
||||||
IN PULONG LoadFlags,
|
IN PULONG LoadFlags OPTIONAL,
|
||||||
IN PUNICODE_STRING Name,
|
IN PUNICODE_STRING Name,
|
||||||
OUT PVOID *BaseAddress OPTIONAL)
|
OUT PVOID *BaseAddress OPTIONAL)
|
||||||
{
|
{
|
||||||
|
@ -741,19 +741,22 @@ LdrLoadDll (IN PWSTR SearchPath OPTIONAL,
|
||||||
|
|
||||||
if (Name == NULL)
|
if (Name == NULL)
|
||||||
{
|
{
|
||||||
*BaseAddress = NtCurrentPeb()->ImageBaseAddress;
|
if (BaseAddress)
|
||||||
|
*BaseAddress = NtCurrentPeb()->ImageBaseAddress;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
*BaseAddress = NULL;
|
if (BaseAddress)
|
||||||
|
*BaseAddress = NULL;
|
||||||
|
|
||||||
Status = LdrpLoadModule(SearchPath, *LoadFlags, Name, &Module, BaseAddress);
|
Status = LdrpLoadModule(SearchPath, LoadFlags ? *LoadFlags : 0, Name, &Module, BaseAddress);
|
||||||
if (NT_SUCCESS(Status) && 0 == (*LoadFlags & LOAD_LIBRARY_AS_DATAFILE))
|
if (NT_SUCCESS(Status)
|
||||||
|
&& (!LoadFlags || 0 == (*LoadFlags & LOAD_LIBRARY_AS_DATAFILE)))
|
||||||
{
|
{
|
||||||
RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock);
|
RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock);
|
||||||
Status = LdrpAttachProcess();
|
Status = LdrpAttachProcess();
|
||||||
RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock);
|
RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status) && BaseAddress)
|
||||||
{
|
{
|
||||||
*BaseAddress = Module->DllBase;
|
*BaseAddress = Module->DllBase;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue