Author: ion
Date: Sat Feb 4 19:45:38 2017
New Revision: 73684
URL:
http://svn.reactos.org/svn/reactos?rev=73684&view=rev
Log:
[BOOTMGR]: ThFabba making me jealous. Fix a logic bug that Coverity *didn't* find. Ha.
I'm better.
[BOOTLIB]: Apply the "Fuck You Binutils" hack only for ld-generated files, to
unbreak MSVC UEFI boot.
Modified:
trunk/reactos/boot/environ/app/bootmgr/bootmgr.c
trunk/reactos/boot/environ/lib/misc/image.c
Modified: trunk/reactos/boot/environ/app/bootmgr/bootmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/app/bootmgr/b…
==============================================================================
--- trunk/reactos/boot/environ/app/bootmgr/bootmgr.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/app/bootmgr/bootmgr.c [iso-8859-1] Sat Feb 4 19:45:38
2017
@@ -2276,7 +2276,7 @@
BcdLibraryDevice_ApplicationDevice,
&AppDevice,
NULL);
- if (NT_SUCCESS(Status))
+ if (!NT_SUCCESS(Status))
{
/* Force re-enumeration */
Status = BlFwEnumerateDevice(AppDevice);
Modified: trunk/reactos/boot/environ/lib/misc/image.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/imag…
==============================================================================
--- trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/misc/image.c [iso-8859-1] Sat Feb 4 19:45:38 2017
@@ -883,7 +883,6 @@
/* Record our current position (right after the headers) */
EndOfHeaders = (ULONG_PTR)VirtualAddress + HeaderSize;
- EfiPrintf(L"here\r\n");
/* Get the first section and iterate through each one */
Section = IMAGE_FIRST_SECTION(NtHeaders);
@@ -981,17 +980,20 @@
if (!First)
{
/* FUCK YOU BINUTILS */
- if ((*(PULONG)&Section->Name == 'ler.') &&
(RawSize < AlignSize))
+ if (NtHeaders->OptionalHeader.MajorLinkerVersion < 7)
{
- /* Piece of shit won't build relocations when you tell it to,
- * either by using --emit-relocs or --dynamicbase. People online
- * have found out that by using -pie-executable you can get this
- * to happen, but then it turns out that the .reloc section is
- * incorrectly sized, and results in a corrupt PE. However, they
- * still compute the checksum using the correct value. What idiots.
- */
- WorkaroundForBinutils = AlignSize - RawSize;
- AlignSize -= WorkaroundForBinutils;
+ if ((*(PULONG)&Section->Name == 'ler.') &&
(RawSize < AlignSize))
+ {
+ /* Piece of shit won't build relocations when you tell it
to,
+ * either by using --emit-relocs or --dynamicbase. People online
+ * have found out that by using -pie-executable you can get this
+ * to happen, but then it turns out that the .reloc section is
+ * incorrectly sized, and results in a corrupt PE. However, they
+ * still compute the checksum using the correct value. What
idiots.
+ */
+ WorkaroundForBinutils = AlignSize - RawSize;
+ AlignSize -= WorkaroundForBinutils;
+ }
}
/* Yes, read the section data */