+2003-04-28 Casper S. Hornstrup <chorns@users.sourceforge.net>
+
+ * Makefile (DLLS): Add epsapi, psapi and wsock32.
+ * lib/ntdll/ldr/utils.c (LdrPerformRelocations): Handle the case where a
+ relocation crosses a page boundary.
+ (LdrFixupImports): Use image load address in calculatation of import
+ address list.
+
2003-04-28 Casper S. Hornstrup <chorns@users.sourceforge.net>
* lib/fslib/vfatlib/vfatlib.h: New file.
# User mode libraries
# advapi32 crtdll fmifs gdi32 kernel32 libpcap packet msafd msvcrt ntdll ole32
-# oleaut32 psapi rpcrt4 secur32 shell32 user32 version ws2help ws2_32 wsock32 wshirda
+# oleaut32 epsapi psapi rpcrt4 secur32 shell32 user32 version ws2help ws2_32 wsock32 wshirda
DLLS = advapi32 crtdll fmifs freetype gdi32 kernel32 packet msafd msvcrt ntdll \
- secur32 user32 version winedbgc ws2help ws2_32 wshirda zlib epsapi #winmm
+ epsapi psapi secur32 user32 version winedbgc ws2help ws2_32 wsock32 wshirda zlib #winmm
SUBSYS = smss win32k csrss ntvdm
-/* $Id: utils.c,v 1.62 2003/04/26 10:05:38 gvg Exp $
+/* $Id: utils.c,v 1.63 2003/04/28 21:32:10 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
ULONG ExportDirSize;
DPRINT("LdrGetExportByName %x %s %hu\n", BaseAddress, SymbolName, Hint);
-
+
ExportDir = (PIMAGE_EXPORT_DIRECTORY)
RtlImageDirectoryEntryToData(BaseAddress,
TRUE,
int i;
PIMAGE_DATA_DIRECTORY RelocationDDir;
ULONG OldProtect;
+ ULONG OldProtect2;
NTSTATUS Status;
PIMAGE_SECTION_HEADER Sections;
ULONG MaxExtend;
DPRINT1("Failed to unprotect relocation target.\n");
return(Status);
}
+
+ if (RelocationDir->VirtualAddress + PAGE_SIZE < MaxExtend)
+ {
+ Status = NtProtectVirtualMemory(NtCurrentProcess(),
+ ImageBase +
+ RelocationDir->VirtualAddress + PAGE_SIZE,
+ PAGE_SIZE,
+ PAGE_READWRITE,
+ &OldProtect2);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to unprotect relocation target (2).\n");
+ NtProtectVirtualMemory(NtCurrentProcess(),
+ ImageBase +
+ RelocationDir->VirtualAddress,
+ PAGE_SIZE,
+ OldProtect,
+ &OldProtect);
+ return(Status);
+ }
+ }
for (i = 0; i < NumberOfEntries; i++)
{
return(Status);
}
+ if (RelocationDir->VirtualAddress + PAGE_SIZE < MaxExtend)
+ {
+ Status = NtProtectVirtualMemory(NtCurrentProcess(),
+ ImageBase +
+ RelocationDir->VirtualAddress + PAGE_SIZE,
+ PAGE_SIZE,
+ OldProtect2,
+ &OldProtect2);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to protect relocation target2.\n");
+ return(Status);
+ }
+ }
+
RelocationRVA += RelocationDir->SizeOfBlock;
RelocationDir =
(PRELOCATION_DIRECTORY) (ImageBase + RelocationRVA);
/*
* Get the import address list.
*/
- ImportAddressList = (PVOID *)(NTHeaders->OptionalHeader.ImageBase
+ ImportAddressList = (PVOID *)(ImageBase
+ ImportModuleDirectory->dwRVAFunctionAddressList);
/*