Author: tkreuzer Date: Mon Aug 23 01:16:42 2010 New Revision: 48601
URL: http://svn.reactos.org/svn/reactos?rev=48601&view=rev Log: [NTDLL] - Call LdrProcessRelocationBlockLongLong from LdrProcessRelocationBlock instead of duplicating the code
Modified: trunk/reactos/dll/ntdll/ldr/utils.c
Modified: trunk/reactos/dll/ntdll/ldr/utils.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/utils.c?rev=4... ============================================================================== --- trunk/reactos/dll/ntdll/ldr/utils.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/ldr/utils.c [iso-8859-1] Mon Aug 23 01:16:42 2010 @@ -88,10 +88,10 @@ RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock); } 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--; - } + } if (!Locked) { RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); @@ -107,10 +107,10 @@ RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock); } LoadCount = Module->LoadCount; - if (Module->LoadCount != LDRP_PROCESS_CREATION_TIME) - { + if (Module->LoadCount != LDRP_PROCESS_CREATION_TIME) + { Module->LoadCount++; - } + } if (!Locked) { RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); @@ -3464,54 +3464,15 @@ }
-PIMAGE_BASE_RELOCATION NTAPI -LdrProcessRelocationBlock(IN ULONG_PTR Address, - IN ULONG Count, - IN PUSHORT TypeOffset, - IN LONG_PTR Delta) -{ - SHORT Offset; - 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; +PIMAGE_BASE_RELOCATION +NTAPI +LdrProcessRelocationBlock( + IN ULONG_PTR Address, + IN ULONG Count, + IN PUSHORT TypeOffset, + IN LONG_PTR Delta) +{ + return LdrProcessRelocationBlockLongLong(Address, Count, TypeOffset, Delta); }
NTSTATUS