Remove RtlImageNtHeader, RtlImageDirectoryEntryToData, RtlImageRvaToSection and RtlIm...
authorEric Kohl <eric.kohl@reactos.org>
Wed, 26 Jan 2005 14:00:41 +0000 (14:00 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Wed, 26 Jan 2005 14:00:41 +0000 (14:00 +0000)
svn path=/trunk/; revision=13312

reactos/ntoskrnl/ldr/rtl.c

index c54db5f..dd345fc 100644 (file)
 
 /* 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