mirror of
https://github.com/reactos/reactos.git
synced 2025-07-05 03:41:21 +00:00
[NTDLL/LDR]
- Fix CMake build - Don't override failure status in LdrGetDllHandleEx - Minor improvements Fixes loading of mshtml.tlb in 2nd stage. Patch by Thomas Faber svn path=/trunk/; revision=52591
This commit is contained in:
parent
03c817cabf
commit
2bd7185260
2 changed files with 31 additions and 49 deletions
|
@ -20,8 +20,6 @@ list(APPEND SOURCE
|
||||||
ldr/ldrinit.c
|
ldr/ldrinit.c
|
||||||
ldr/ldrpe.c
|
ldr/ldrpe.c
|
||||||
ldr/ldrutils.c
|
ldr/ldrutils.c
|
||||||
ldr/startup.c
|
|
||||||
ldr/utils.c
|
|
||||||
rtl/libsupp.c
|
rtl/libsupp.c
|
||||||
rtl/version.c
|
rtl/version.c
|
||||||
def/ntdll.rc
|
def/ntdll.rc
|
||||||
|
|
|
@ -522,6 +522,10 @@ LdrGetDllHandleEx(IN ULONG Flags,
|
||||||
/* Unrecoverable SxS failure; */
|
/* Unrecoverable SxS failure; */
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ASSERT(pRedirectName == &RedirectName);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set default failure code */
|
/* Set default failure code */
|
||||||
Status = STATUS_DLL_NOT_FOUND;
|
Status = STATUS_DLL_NOT_FOUND;
|
||||||
|
@ -533,29 +537,25 @@ LdrGetDllHandleEx(IN ULONG Flags,
|
||||||
if (RedirectedDll)
|
if (RedirectedDll)
|
||||||
{
|
{
|
||||||
/* Check the flag */
|
/* Check the flag */
|
||||||
if (LdrpGetModuleHandleCache->Flags & LDRP_REDIRECTED)
|
if (!(LdrpGetModuleHandleCache->Flags & LDRP_REDIRECTED))
|
||||||
{
|
{
|
||||||
|
goto DontCompare;
|
||||||
|
}
|
||||||
|
|
||||||
/* Use the right name */
|
/* Use the right name */
|
||||||
CompareName = &LdrpGetModuleHandleCache->FullDllName;
|
CompareName = &LdrpGetModuleHandleCache->FullDllName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
/* Check the flag */
|
||||||
|
if (LdrpGetModuleHandleCache->Flags & LDRP_REDIRECTED)
|
||||||
{
|
{
|
||||||
goto DontCompare;
|
goto DontCompare;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Check the flag */
|
|
||||||
if (!(LdrpGetModuleHandleCache->Flags & LDRP_REDIRECTED))
|
|
||||||
{
|
|
||||||
/* Use the right name */
|
/* Use the right name */
|
||||||
CompareName = &LdrpGetModuleHandleCache->BaseDllName;
|
CompareName = &LdrpGetModuleHandleCache->BaseDllName;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
goto DontCompare;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if the name matches */
|
/* Check if the name matches */
|
||||||
if (RtlEqualUnicodeString(pRedirectName,
|
if (RtlEqualUnicodeString(pRedirectName,
|
||||||
|
@ -604,7 +604,6 @@ DontCompare:
|
||||||
/* Setup the string */
|
/* Setup the string */
|
||||||
RawDllName.MaximumLength = Length;
|
RawDllName.MaximumLength = Length;
|
||||||
ASSERT(Length >= sizeof(UNICODE_NULL));
|
ASSERT(Length >= sizeof(UNICODE_NULL));
|
||||||
RawDllName.Length = RawDllName.MaximumLength - sizeof(UNICODE_NULL);
|
|
||||||
RawDllName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
|
RawDllName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
RawDllName.MaximumLength);
|
RawDllName.MaximumLength);
|
||||||
|
@ -614,18 +613,9 @@ DontCompare:
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the buffer */
|
/* Copy the string and add extension */
|
||||||
RtlMoveMemory(RawDllName.Buffer,
|
RtlCopyUnicodeString(&RawDllName, pRedirectName);
|
||||||
pRedirectName->Buffer,
|
RtlAppendUnicodeStringToString(&RawDllName, &LdrApiDefaultExtension);
|
||||||
pRedirectName->Length);
|
|
||||||
|
|
||||||
/* Add extension */
|
|
||||||
RtlMoveMemory((PVOID)((ULONG_PTR)RawDllName.Buffer + pRedirectName->Length),
|
|
||||||
LdrApiDefaultExtension.Buffer,
|
|
||||||
LdrApiDefaultExtension.Length);
|
|
||||||
|
|
||||||
/* Null terminate */
|
|
||||||
RawDllName.Buffer[RawDllName.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -643,7 +633,6 @@ DontCompare:
|
||||||
|
|
||||||
/* Setup the string */
|
/* Setup the string */
|
||||||
RawDllName.MaximumLength = pRedirectName->Length + sizeof(WCHAR);
|
RawDllName.MaximumLength = pRedirectName->Length + sizeof(WCHAR);
|
||||||
RawDllName.Length = pRedirectName->Length;
|
|
||||||
RawDllName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
|
RawDllName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
RawDllName.MaximumLength);
|
RawDllName.MaximumLength);
|
||||||
|
@ -653,19 +642,14 @@ DontCompare:
|
||||||
goto Quickie;
|
goto Quickie;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the buffer */
|
/* Copy the string */
|
||||||
RtlMoveMemory(RawDllName.Buffer,
|
RtlCopyUnicodeString(&RawDllName, pRedirectName);
|
||||||
pRedirectName->Buffer,
|
|
||||||
pRedirectName->Length);
|
|
||||||
|
|
||||||
/* Null terminate */
|
|
||||||
RawDllName.Buffer[RawDllName.Length / sizeof(WCHAR)] = UNICODE_NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display debug string */
|
/* Display debug string */
|
||||||
if (ShowSnaps)
|
if (ShowSnaps)
|
||||||
{
|
{
|
||||||
DPRINT1("LDR: LdrGetDllHandle, searching for %wZ from %ws\n",
|
DPRINT1("LDR: LdrGetDllHandleEx, searching for %wZ from %ws\n",
|
||||||
&RawDllName,
|
&RawDllName,
|
||||||
DllPath ? ((ULONG_PTR)DllPath == 1 ? L"" : DllPath) : L"");
|
DllPath ? ((ULONG_PTR)DllPath == 1 ? L"" : DllPath) : L"");
|
||||||
}
|
}
|
||||||
|
@ -730,14 +714,14 @@ Quickie:
|
||||||
if (RawDllName.Buffer)
|
if (RawDllName.Buffer)
|
||||||
{
|
{
|
||||||
/* Free the heap-allocated buffer */
|
/* Free the heap-allocated buffer */
|
||||||
Status = RtlFreeHeap(RtlGetProcessHeap(), 0, RawDllName.Buffer);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, RawDllName.Buffer);
|
||||||
RawDllName.Buffer = NULL;
|
RawDllName.Buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release lock */
|
/* Release lock */
|
||||||
if (Locked)
|
if (Locked)
|
||||||
{
|
{
|
||||||
Status = LdrUnlockLoaderLock(LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS,
|
LdrUnlockLoaderLock(LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS,
|
||||||
Cookie);
|
Cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,7 +740,7 @@ LdrGetDllHandle(IN PWSTR DllPath OPTIONAL,
|
||||||
OUT PVOID *DllHandle)
|
OUT PVOID *DllHandle)
|
||||||
{
|
{
|
||||||
/* Call the newer API */
|
/* Call the newer API */
|
||||||
return LdrGetDllHandleEx(TRUE,
|
return LdrGetDllHandleEx(LDR_GET_DLL_HANDLE_EX_UNCHANGED_REFCOUNT,
|
||||||
DllPath,
|
DllPath,
|
||||||
DllCharacteristics,
|
DllCharacteristics,
|
||||||
DllName,
|
DllName,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue