Author: ion
Date: Mon Jan 18 04:18:12 2016
New Revision: 70610
URL:
http://svn.reactos.org/svn/reactos?rev=70610&view=rev
Log:
[HIVEBCD]: Implement an entire wholeseome BCD boot hive, including multiple levels of
inheritance (globalsettings, dbgsettings, emssettings, bootloadersettings), plus entries
for {memdiag}, {bootmgr} and {winload}.
[BOOTLIB]: Fix a bug in BCD parsing which was causing massive heap corruption. Became
evident with the increased complexity of the new BCD hive.
Modified:
trunk/reactos/boot/bootdata/hivebcd.inf
trunk/reactos/boot/environ/lib/misc/bcd.c
Modified: trunk/reactos/boot/bootdata/hivebcd.inf
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivebcd.inf?…
==============================================================================
--- trunk/reactos/boot/bootdata/hivebcd.inf [iso-8859-1] (original)
+++ trunk/reactos/boot/bootdata/hivebcd.inf [iso-8859-1] Mon Jan 18 04:18:12 2016
@@ -2,15 +2,89 @@
Signature = "$ReactOS$"
[AddReg]
+BCD,"BCD00000000\Description\Control","System",0x00010001,1
+BCD,"BCD00000000\Description\Control","TreatAtSystem",0x00010001,1
+BCD,"BCD00000000\Description\Control","KeyName",,"BCD00000000"
-BCD,"BCD00000000\Description\Control","System",0x00010003,1
-BCD,"BCD00000000\Description\Control","TreatAtSystem",0x00010003,1
-BCD,"BCD00000000\Description\Control","KeyName",2,"BCD00000000"
+;
+; ReactOS Boot Manager
+;
+BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Description","Type",0x00010001,0x10100002
; identifier={bootmgr}
+BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\12000004","Element",,"ReactOS
Boot Manager" ; description
+BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\12000005","Element",,"en-US"
; locale="en-US"
+BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\14000006","Element",0x10000,"{7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}"
; inherit={globalsettings}
+BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\23000003","Element",,"{7619dcc9-fafe-11d9-b411-000476eba25f}"
; default={winload}
+BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\24000001","Element",0x10000,"{7619dcc9-fafe-11d9-b411-000476eba25f}"
; displayorder={winload}
+BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\24000010","Element",0x10000,"{b2721d73-1db4-4c62-bf78-c548a880142d}"
; toolsdisplayorder={memdiag}
+BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\25000004","Element",0x1,0x1e
; timeout=30
-BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Description","Type",0x00010003,0x10100002
+;
+; ReactOS Boot Loader
+;
+BCD,"BCD00000000\Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Description","Type",0x00010001,0x10200003
; identifier={winload}
+BCD,"BCD00000000\Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\11000011","Element",0x1,\
; device=boot
+ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
+ 05,00,00,00,\
+ 00,00,00,00,\
+ 48,00,00,00,\
+ 00,00,00,00,\
+ 00,00,00,00,\
+
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
+ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
+BCD,"BCD00000000\Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\12000002","Element",,"\windows\system32\boot\winload.efi"
; path
+BCD,"BCD00000000\Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\12000004","Element",,"ReactOS
Setup" ; description
+BCD,"BCD00000000\Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\12000005","Element",,"en-US"
; locale="en-US"
+BCD,"BCD00000000\Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\14000006","Element",0x10000,"{6efb52bf-1766-41db-a6b3-0ee5eff72bd7}"
; inherit={bootloadersettings}
+BCD,"BCD00000000\Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\16000060","Element",0x1,0x01
; isolatedcontext=Yes
+BCD,"BCD00000000\Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\22000002","Element",,"\windows"
; systemroot=\Windows
+BCD,"BCD00000000\Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\26000010","Element",0x1,0x01
; detecthal=Yes
+BCD,"BCD00000000\Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\26000022","Element",0x1,0x01
; winpe=Yes
+BCD,"BCD00000000\Objects\{7619dcc9-fafe-11d9-b411-000476eba25f}\Elements\260000b0","Element",0x1,0x01
; ems=Yes
-BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\12000002","Element",2,"\EFI\BOOT\BOOTIA32.EFI"
-BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\12000004","Element",2,"ReactOS
Boot Manager"
-BCD,"BCD00000000\Objects\{9dea862c-5cdd-4e70-acc1-f32b344d4795}\Elements\12000005","Element",2,"en-US"
+;
+; ReactOS Memory Tester
+;
+BCD,"BCD00000000\Objects\{b2721d73-1db4-4c62-bf78-c548a880142d}\Description","Type",0x00010001,0x10200005
; identifier={memdiag}
+BCD,"BCD00000000\Objects\{b2721d73-1db4-4c62-bf78-c548a880142d}\Elements\11000011","Element",0x1,\
; device=boot
+ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
+ 05,00,00,00,\
+ 00,00,00,00,\
+ 48,00,00,00,\
+ 00,00,00,00,\
+ 00,00,00,00,\
+
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
+ 00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
+BCD,"BCD00000000\Objects\{b2721d73-1db4-4c62-bf78-c548a880142d}\Elements\12000002","Element",,"\EFI\BOOT\MEMTEST.EFI"
; path
+BCD,"BCD00000000\Objects\{b2721d73-1db4-4c62-bf78-c548a880142d}\Elements\12000004","Element",,"ReactOS
Memory Diagnostics" ; description
+BCD,"BCD00000000\Objects\{b2721d73-1db4-4c62-bf78-c548a880142d}\Elements\12000005","Element",,"en-US"
; locale="en-US"
+BCD,"BCD00000000\Objects\{b2721d73-1db4-4c62-bf78-c548a880142d}\Elements\14000006","Element",0x10000,"{7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}"
; inherit={globalsettings}
+BCD,"BCD00000000\Objects\{b2721d73-1db4-4c62-bf78-c548a880142d}\Elements\1600000b","Element",0x1,0x01
; allowbadmemoryaccess=Yes
+
+;
+; Global Settings
+;
+BCD,"BCD00000000\Objects\{7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}\Description","Type",0x00010001,0x20100000
; identifier={globalsettings}
+BCD,"BCD00000000\Objects\{7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}\Elements\14000006","Element",0x10000,"{4636856e-540f-4170-a130-a84776f4c654}",
\
+
"{0ce4991b-e6b3-4b16-b23c-5e0d9250e5d9}" ;
inherit={dbgsettings,emssettings}
+
+;
+; Boot Loader Settings
+;
+BCD,"BCD00000000\Objects\{6efb52bf-1766-41db-a6b3-0ee5eff72bd7}\Description","Type",0x00010001,0x20200003
; identifier={bootloadersettings}
+BCD,"BCD00000000\Objects\{6efb52bf-1766-41db-a6b3-0ee5eff72bd7}\Elements\14000006","Element",0x10000,"{7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}"
; inherit={globalsettings}
+
+;
+; EMS Settings
+;
+BCD,"BCD00000000\Objects\{0ce4991b-e6b3-4b16-b23c-5e0d9250e5d9}\Description","Type",0x00010001,0x20100000
; identifier={dbgsettings}
+BCD,"BCD00000000\Objects\{0ce4991b-e6b3-4b16-b23c-5e0d9250e5d9}\Elements\16000020","Element",0x1,0x01
; bootems=Yes
+
+;
+; Debugger Settings
+;
+BCD,"BCD00000000\Objects\{4636856e-540f-4170-a130-a84776f4c654}\Description","Type",0x00010001,0x20100000
; identifier={dbgsettings}
+BCD,"BCD00000000\Objects\{4636856e-540f-4170-a130-a84776f4c654}\Elements\15000011","Element",0x1,0x00
; debugtype=Serial
+BCD,"BCD00000000\Objects\{4636856e-540f-4170-a130-a84776f4c654}\Elements\15000013","Element",0x1,0x01
; debugport=1
+BCD,"BCD00000000\Objects\{4636856e-540f-4170-a130-a84776f4c654}\Elements\15000014","Element",0x1,0x00,0xc2,0x01
; baudrate=115200
; EOF
Modified: trunk/reactos/boot/environ/lib/misc/bcd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/misc/bcd.…
==============================================================================
--- trunk/reactos/boot/environ/lib/misc/bcd.c [iso-8859-1] (original)
+++ trunk/reactos/boot/environ/lib/misc/bcd.c [iso-8859-1] Mon Jan 18 04:18:12 2016
@@ -24,7 +24,7 @@
UNREFERENCED_PARAMETER(ObjectHandle);
UNREFERENCED_PARAMETER(ElementName);
UNREFERENCED_PARAMETER(Status);
- EfiPrintf(L"Error in BiNotify\r\n");
+ EfiPrintf(L"Error in BiNotify: %lx for element %s\r\n", Status,
ElementName);
}
ULONG
@@ -818,7 +818,7 @@
ULONG i;
PVOID ElementData, SubObjectList, RegistryElementData;
BcdElementType ElementType;
- PBCD_PACKED_ELEMENT PreviousElement;
+ PBCD_PACKED_ELEMENT PreviousElement, ElementsStart;
ULONG SubElementCount, SubKeyCount, SubObjectCount, ElementDataLength;
PWCHAR ElementName;
PWCHAR* SubKeys;
@@ -839,6 +839,7 @@
ElementDataLength = 0;
SubObjectCount = 0;
RemainingLength = 0;
+ ElementsStart = Elements;
/* Open the root object key's elements */
Status = BiOpenKey(ObjectHandle, L"Elements", &ElementsHandle);
@@ -862,6 +863,8 @@
Status = BiOpenKey(ElementsHandle, ElementName, &ElementHandle);
if (!NT_SUCCESS(Status))
{
+ EfiPrintf(L"ELEMENT ERROR: %lx\r\n", Status);
+ EfiStall(100000);
break;
}
@@ -869,7 +872,7 @@
ElementType.PackedValue = wcstoul(SubKeys[i], NULL, 16);
if (!(ElementType.PackedValue) || (ElementType.PackedValue == -1))
{
- EfiPrintf(L"Value invald\r\n");
+ EfiPrintf(L"Value invalid\r\n");
BiCloseKey(ElementHandle);
ElementHandle = 0;
continue;
@@ -885,6 +888,7 @@
&RegistryElementDataLength);
if (!NT_SUCCESS(Status))
{
+ EfiPrintf(L"Element invalid\r\n");
break;
}
@@ -945,7 +949,7 @@
if (RemainingLength >= TotalLength)
{
/* Set the next pointer */
- Elements->NextEntry = (PBCD_PACKED_ELEMENT)((ULONG_PTR)Elements +
TotalLength);
+ Elements->NextEntry = (PBCD_PACKED_ELEMENT)((ULONG_PTR)ElementsStart +
TotalLength);
/* Fill this one out */
Elements->RootType.PackedValue = RootElementType;
@@ -1005,7 +1009,7 @@
/* Link the subelements into the chain */
PreviousElement = Elements;
PreviousElement->NextEntry =
- (PBCD_PACKED_ELEMENT)((ULONG_PTR)Elements +
+ (PBCD_PACKED_ELEMENT)((ULONG_PTR)ElementsStart +
TotalLength);
Elements = PreviousElement->NextEntry;
}