Remove RtlImageNtHeader, RtlImageDirectoryEntryToData,
RtlImageRvaToSection and RtlImageRvaToVa because these function have
been moved to lib/rtl/image.c.
Modified: trunk/reactos/ntoskrnl/ldr/rtl.c
_____
Modified: trunk/reactos/ntoskrnl/ldr/rtl.c
--- trunk/reactos/ntoskrnl/ldr/rtl.c 2005-01-26 13:58:37 UTC (rev
13311)
+++ trunk/reactos/ntoskrnl/ldr/rtl.c 2005-01-26 14:00:41 UTC (rev
13312)
@@ -17,132 +17,6 @@
/* FUNCTIONS
****************************************************************/
-
-/*
- * @implemented
- */
-PIMAGE_NT_HEADERS STDCALL
-RtlImageNtHeader (IN PVOID BaseAddress)
-{
- PIMAGE_DOS_HEADER DosHeader;
- PIMAGE_NT_HEADERS NTHeaders;
-
- DosHeader = (PIMAGE_DOS_HEADER)BaseAddress;
- NTHeaders = (PIMAGE_NT_HEADERS)((char*)BaseAddress +
DosHeader->e_lfanew);
- if ((DosHeader->e_magic != IMAGE_DOS_SIGNATURE)
- || (DosHeader->e_lfanew == 0L)
- || (*(PULONG) NTHeaders != IMAGE_NT_SIGNATURE))
- {
- return(NULL);
- }
- return(NTHeaders);
-}
-
-
-/*
- * @implemented
- */
-PVOID STDCALL
-RtlImageDirectoryEntryToData (IN PVOID BaseAddress,
- IN BOOLEAN ImageLoaded,
- IN ULONG Directory,
- OUT PULONG Size)
-{
- PIMAGE_NT_HEADERS NtHeader;
- PIMAGE_SECTION_HEADER SectionHeader;
- ULONG Va;
- ULONG Count;
-
- NtHeader = RtlImageNtHeader (BaseAddress);
- if (NtHeader == NULL)
- return NULL;
-
- if (Directory >= NtHeader->OptionalHeader.NumberOfRvaAndSizes)
- return NULL;
-
- Va =
NtHeader->OptionalHeader.DataDirectory[Directory].VirtualAddress;
- if (Va == 0)
- return NULL;
-
- if (Size)
- *Size =
NtHeader->OptionalHeader.DataDirectory[Directory].Size;
-
- if (ImageLoaded)
- return (PVOID)((char*)BaseAddress + Va);
-
- /* image mapped as ordinary file, we must find raw pointer */
- SectionHeader = (PIMAGE_SECTION_HEADER)(NtHeader + 1);
- Count = NtHeader->FileHeader.NumberOfSections;
- while (Count--)
- {
- if (SectionHeader->VirtualAddress == Va)
- return (PVOID)((char*)BaseAddress +
SectionHeader->PointerToRawData);
- SectionHeader++;
- }
-
- return NULL;
-}
-
-
-PIMAGE_SECTION_HEADER
-STDCALL
-RtlImageRvaToSection (
- PIMAGE_NT_HEADERS NtHeader,
- PVOID BaseAddress,
- ULONG Rva
- )
-{
- PIMAGE_SECTION_HEADER Section;
- ULONG Va;
- ULONG Count;
-
- Count = NtHeader->FileHeader.NumberOfSections;
- Section =
(PIMAGE_SECTION_HEADER)((ULONG)&NtHeader->OptionalHeader +
-
NtHeader->FileHeader.SizeOfOptionalHeader);
- while (Count)
- {
- Va = Section->VirtualAddress;
- if ((Va <= Rva) &&
- (Rva < Va + Section->SizeOfRawData))
- return Section;
- Section++;
- }
- return NULL;
-}
-
-
-ULONG
-STDCALL
-RtlImageRvaToVa (
- PIMAGE_NT_HEADERS NtHeader,
- PVOID BaseAddress,
- ULONG Rva,
- PIMAGE_SECTION_HEADER *SectionHeader
- )
-{
- PIMAGE_SECTION_HEADER Section = NULL;
-
- if (SectionHeader)
- Section = *SectionHeader;
-
- if (Section == NULL ||
- Rva < Section->VirtualAddress ||
- Rva >= Section->VirtualAddress + Section->SizeOfRawData)
- {
- Section = RtlImageRvaToSection (NtHeader, BaseAddress,
Rva);
- if (Section == NULL)
- return 0;
-
- if (SectionHeader)
- *SectionHeader = Section;
- }
-
- return (ULONG)((char*)BaseAddress +
- Rva +
- Section->PointerToRawData -
- Section->VirtualAddress);
-}
-
#define RVA(m, b) ((ULONG)b + m)
NTSTATUS STDCALL