Author: dgorbachev
Date: Mon Mar 12 03:29:56 2007
New Revision: 26066
URL:
http://svn.reactos.org/svn/reactos?rev=26066&view=rev
Log:
Fix BSS bugs (#2068, #2072)
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c Mon Mar 12 03:29:56 2007
@@ -556,19 +556,29 @@
/* Copy image sections into virtual section */
for (i = 0; i < NtHeader->FileHeader.NumberOfSections; i++)
{
- /* Get the size of this section and check if it's valid and on-disk */
+ /* Get the size of this section and check if it's valid */
Size = Section[i].VirtualAddress + Section[i].Misc.VirtualSize;
- if ((Size <= DriverSize) && (Section[i].SizeOfRawData))
- {
- /* Copy the data from the disk to the image */
- RtlCopyMemory((PVOID)((ULONG_PTR)LoadBase +
- Section[i].VirtualAddress),
- (PVOID)((ULONG_PTR)Base +
- Section[i].PointerToRawData),
- Section[i].Misc.VirtualSize >
- Section[i].SizeOfRawData ?
- Section[i].SizeOfRawData :
- Section[i].Misc.VirtualSize);
+ if (Size <= DriverSize)
+ {
+ if (Section[i].SizeOfRawData)
+ {
+ /* Copy the data from the disk to the image */
+ RtlCopyMemory((PVOID)((ULONG_PTR)LoadBase +
+ Section[i].VirtualAddress),
+ (PVOID)((ULONG_PTR)Base +
+ Section[i].PointerToRawData),
+ Section[i].Misc.VirtualSize >
+ Section[i].SizeOfRawData ?
+ Section[i].SizeOfRawData :
+ Section[i].Misc.VirtualSize);
+ }
+ else
+ {
+ /* BSS */
+ RtlZeroMemory((PVOID)((ULONG_PTR)LoadBase +
+ Section[i].VirtualAddress),
+ Section[i].Misc.VirtualSize);
+ }
}
}