mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 02:05:50 +00:00
[NTDLL]
- Call LdrProcessRelocationBlockLongLong from LdrProcessRelocationBlock instead of duplicating the code svn path=/trunk/; revision=48601
This commit is contained in:
parent
3957ae1572
commit
ca6ff51038
1 changed files with 14 additions and 53 deletions
|
@ -88,10 +88,10 @@ static __inline LONG LdrpDecrementLoadCount(PLDR_DATA_TABLE_ENTRY Module, BOOLEA
|
||||||
RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock);
|
RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock);
|
||||||
}
|
}
|
||||||
LoadCount = Module->LoadCount;
|
LoadCount = Module->LoadCount;
|
||||||
if (Module->LoadCount > 0 && Module->LoadCount != LDRP_PROCESS_CREATION_TIME)
|
if (Module->LoadCount > 0 && Module->LoadCount != LDRP_PROCESS_CREATION_TIME)
|
||||||
{
|
{
|
||||||
Module->LoadCount--;
|
Module->LoadCount--;
|
||||||
}
|
}
|
||||||
if (!Locked)
|
if (!Locked)
|
||||||
{
|
{
|
||||||
RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock);
|
RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock);
|
||||||
|
@ -107,10 +107,10 @@ static __inline LONG LdrpIncrementLoadCount(PLDR_DATA_TABLE_ENTRY Module, BOOLEA
|
||||||
RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock);
|
RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock);
|
||||||
}
|
}
|
||||||
LoadCount = Module->LoadCount;
|
LoadCount = Module->LoadCount;
|
||||||
if (Module->LoadCount != LDRP_PROCESS_CREATION_TIME)
|
if (Module->LoadCount != LDRP_PROCESS_CREATION_TIME)
|
||||||
{
|
{
|
||||||
Module->LoadCount++;
|
Module->LoadCount++;
|
||||||
}
|
}
|
||||||
if (!Locked)
|
if (!Locked)
|
||||||
{
|
{
|
||||||
RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock);
|
RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock);
|
||||||
|
@ -3464,54 +3464,15 @@ LdrQueryImageFileExecutionOptions (IN PUNICODE_STRING SubKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PIMAGE_BASE_RELOCATION NTAPI
|
PIMAGE_BASE_RELOCATION
|
||||||
LdrProcessRelocationBlock(IN ULONG_PTR Address,
|
NTAPI
|
||||||
IN ULONG Count,
|
LdrProcessRelocationBlock(
|
||||||
IN PUSHORT TypeOffset,
|
IN ULONG_PTR Address,
|
||||||
IN LONG_PTR Delta)
|
IN ULONG Count,
|
||||||
|
IN PUSHORT TypeOffset,
|
||||||
|
IN LONG_PTR Delta)
|
||||||
{
|
{
|
||||||
SHORT Offset;
|
return LdrProcessRelocationBlockLongLong(Address, Count, TypeOffset, Delta);
|
||||||
USHORT Type;
|
|
||||||
USHORT i;
|
|
||||||
PUSHORT ShortPtr;
|
|
||||||
PULONG LongPtr;
|
|
||||||
|
|
||||||
for (i = 0; i < Count; i++)
|
|
||||||
{
|
|
||||||
Offset = *TypeOffset & 0xFFF;
|
|
||||||
Type = *TypeOffset >> 12;
|
|
||||||
|
|
||||||
switch (Type)
|
|
||||||
{
|
|
||||||
case IMAGE_REL_BASED_ABSOLUTE:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IMAGE_REL_BASED_HIGH:
|
|
||||||
ShortPtr = (PUSHORT)((ULONG_PTR)Address + Offset);
|
|
||||||
*ShortPtr += HIWORD(Delta);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IMAGE_REL_BASED_LOW:
|
|
||||||
ShortPtr = (PUSHORT)((ULONG_PTR)Address + Offset);
|
|
||||||
*ShortPtr += LOWORD(Delta);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IMAGE_REL_BASED_HIGHLOW:
|
|
||||||
LongPtr = (PULONG)((ULONG_PTR)Address + Offset);
|
|
||||||
*LongPtr += Delta;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IMAGE_REL_BASED_HIGHADJ:
|
|
||||||
case IMAGE_REL_BASED_MIPS_JMPADDR:
|
|
||||||
default:
|
|
||||||
DPRINT1("Unknown/unsupported fixup type %hu.\n", Type);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
TypeOffset++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (PIMAGE_BASE_RELOCATION)TypeOffset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue