4 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
5 * Copyright (C) 2006 Aleksey Bragin <aleksey@reactos.org>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include <ndk/ldrtypes.h>
28 void WinLdrSetupForNt(PLOADER_PARAMETER_BLOCK LoaderBlock
,
33 //FIXME: Do a better way to retrieve Arc disk information
34 extern ULONG reactos_disk_count
;
35 extern ARC_DISK_SIGNATURE reactos_arc_disk_info
[];
36 extern char reactos_arc_strings
[32][256];
38 extern BOOLEAN UseRealHeap
;
39 extern ULONG LoaderPagesSpanned
;
40 extern BOOLEAN AcpiPresent
;
43 WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock
,
45 OUT PLDR_DATA_TABLE_ENTRY
*LoadedEntry
);
48 VOID
DumpMemoryAllocMap(VOID
);
49 VOID
WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock
);
50 VOID
WinLdrpDumpBootDriver(PLOADER_PARAMETER_BLOCK LoaderBlock
);
51 VOID
WinLdrpDumpArcDisks(PLOADER_PARAMETER_BLOCK LoaderBlock
);
56 AllocateAndInitLPB(PLOADER_PARAMETER_BLOCK
*OutLoaderBlock
)
58 PLOADER_PARAMETER_BLOCK LoaderBlock
;
60 /* Allocate and zero-init the LPB */
61 LoaderBlock
= MmHeapAlloc(sizeof(LOADER_PARAMETER_BLOCK
));
62 RtlZeroMemory(LoaderBlock
, sizeof(LOADER_PARAMETER_BLOCK
));
64 /* Init three critical lists, used right away */
65 InitializeListHead(&LoaderBlock
->LoadOrderListHead
);
66 InitializeListHead(&LoaderBlock
->MemoryDescriptorListHead
);
67 InitializeListHead(&LoaderBlock
->BootDriverListHead
);
69 /* Alloc space for NLS (it will be converted to VA in WinLdrLoadNLS) */
70 LoaderBlock
->NlsData
= MmHeapAlloc(sizeof(NLS_DATA_BLOCK
));
71 if (LoaderBlock
->NlsData
== NULL
)
73 UiMessageBox("Failed to allocate memory for NLS table data!");
76 RtlZeroMemory(LoaderBlock
->NlsData
, sizeof(NLS_DATA_BLOCK
));
78 *OutLoaderBlock
= LoaderBlock
;
83 WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock
,
89 /* Examples of correct options and paths */
90 //CHAR Options[] = "/DEBUGPORT=COM1 /BAUDRATE=115200";
91 //CHAR Options[] = "/NODEBUG";
92 //CHAR SystemRoot[] = "\\WINNT\\";
93 //CHAR ArcBoot[] = "multi(0)disk(0)rdisk(0)partition(1)";
95 CHAR HalPath
[] = "\\";
98 ULONG i
, PathSeparator
;
99 PLOADER_PARAMETER_EXTENSION Extension
;
101 /* Construct SystemRoot and ArcBoot from SystemPath */
102 PathSeparator
= strstr(BootPath
, "\\") - BootPath
;
103 strncpy(ArcBoot
, BootPath
, PathSeparator
);
104 ArcBoot
[PathSeparator
] = 0;
106 DPRINTM(DPRINT_WINDOWS
, "ArcBoot: %s\n", ArcBoot
);
107 DPRINTM(DPRINT_WINDOWS
, "SystemRoot: %s\n", SystemRoot
);
108 DPRINTM(DPRINT_WINDOWS
, "Options: %s\n", Options
);
110 /* Fill Arc BootDevice */
111 LoaderBlock
->ArcBootDeviceName
= MmHeapAlloc(strlen(ArcBoot
)+1);
112 strcpy(LoaderBlock
->ArcBootDeviceName
, ArcBoot
);
113 LoaderBlock
->ArcBootDeviceName
= PaToVa(LoaderBlock
->ArcBootDeviceName
);
115 /* Fill Arc HalDevice, it matches ArcBoot path */
116 LoaderBlock
->ArcHalDeviceName
= MmHeapAlloc(strlen(ArcBoot
)+1);
117 strcpy(LoaderBlock
->ArcHalDeviceName
, ArcBoot
);
118 LoaderBlock
->ArcHalDeviceName
= PaToVa(LoaderBlock
->ArcHalDeviceName
);
120 /* Fill SystemRoot */
121 LoaderBlock
->NtBootPathName
= MmHeapAlloc(strlen(SystemRoot
)+1);
122 strcpy(LoaderBlock
->NtBootPathName
, SystemRoot
);
123 LoaderBlock
->NtBootPathName
= PaToVa(LoaderBlock
->NtBootPathName
);
125 /* Fill NtHalPathName */
126 LoaderBlock
->NtHalPathName
= MmHeapAlloc(strlen(HalPath
)+1);
127 strcpy(LoaderBlock
->NtHalPathName
, HalPath
);
128 LoaderBlock
->NtHalPathName
= PaToVa(LoaderBlock
->NtHalPathName
);
130 /* Fill load options */
131 LoaderBlock
->LoadOptions
= MmHeapAlloc(strlen(Options
)+1);
132 strcpy(LoaderBlock
->LoadOptions
, Options
);
133 LoaderBlock
->LoadOptions
= PaToVa(LoaderBlock
->LoadOptions
);
136 LoaderBlock
->ArcDiskInformation
= (PARC_DISK_INFORMATION
)MmHeapAlloc(sizeof(ARC_DISK_INFORMATION
));
137 InitializeListHead(&LoaderBlock
->ArcDiskInformation
->DiskSignatureListHead
);
139 /* Convert ARC disk information from freeldr to a correct format */
140 for (i
= 0; i
< reactos_disk_count
; i
++)
142 PARC_DISK_SIGNATURE ArcDiskInfo
;
144 /* Get the ARC structure */
145 ArcDiskInfo
= (PARC_DISK_SIGNATURE
)MmHeapAlloc(sizeof(ARC_DISK_SIGNATURE
));
146 RtlZeroMemory(ArcDiskInfo
, sizeof(ARC_DISK_SIGNATURE
));
148 /* Copy the data over */
149 ArcDiskInfo
->Signature
= reactos_arc_disk_info
[i
].Signature
;
150 ArcDiskInfo
->CheckSum
= reactos_arc_disk_info
[i
].CheckSum
;
152 /* Copy the ARC Name */
153 ArcDiskInfo
->ArcName
= (PCHAR
)MmHeapAlloc(sizeof(CHAR
)*256);
154 strcpy(ArcDiskInfo
->ArcName
, reactos_arc_disk_info
[i
].ArcName
);
155 ArcDiskInfo
->ArcName
= (PCHAR
)PaToVa(ArcDiskInfo
->ArcName
);
157 /* Mark partition table as valid */
158 ArcDiskInfo
->ValidPartitionTable
= TRUE
;
160 /* Insert into the list */
161 InsertTailList(&LoaderBlock
->ArcDiskInformation
->DiskSignatureListHead
,
162 &ArcDiskInfo
->ListEntry
);
165 /* Convert all list's to Virtual address */
167 /* Convert the ArcDisks list to virtual address */
168 List_PaToVa(&LoaderBlock
->ArcDiskInformation
->DiskSignatureListHead
);
169 LoaderBlock
->ArcDiskInformation
= PaToVa(LoaderBlock
->ArcDiskInformation
);
171 /* Convert configuration entries to VA */
172 ConvertConfigToVA(LoaderBlock
->ConfigurationRoot
);
173 LoaderBlock
->ConfigurationRoot
= PaToVa(LoaderBlock
->ConfigurationRoot
);
175 /* Convert all DTE into virtual addresses */
176 List_PaToVa(&LoaderBlock
->LoadOrderListHead
);
178 /* this one will be converted right before switching to
179 virtual paging mode */
180 //List_PaToVa(&LoaderBlock->MemoryDescriptorListHead);
182 /* Convert list of boot drivers */
183 List_PaToVa(&LoaderBlock
->BootDriverListHead
);
185 /* Initialize Extension now */
186 Extension
= MmHeapAlloc(sizeof(LOADER_PARAMETER_EXTENSION
));
187 if (Extension
== NULL
)
189 UiMessageBox("Failed to allocate LPB Extension!");
192 RtlZeroMemory(Extension
, sizeof(LOADER_PARAMETER_EXTENSION
));
194 /* Fill LPB extension */
195 Extension
->Size
= sizeof(LOADER_PARAMETER_EXTENSION
);
196 Extension
->MajorVersion
= (VersionToBoot
& 0xFF00) >> 8;
197 Extension
->MinorVersion
= VersionToBoot
& 0xFF;
198 Extension
->Profile
.Status
= 2;
200 /* Check if ACPI is present */
203 /* See KiRosFrldrLpbToNtLpb for details */
204 Extension
->AcpiTable
= (PVOID
)1;
207 /* Load drivers database */
208 strcpy(MiscFiles
, BootPath
);
209 strcat(MiscFiles
, "AppPatch\\drvmain.sdb");
210 Extension
->DrvDBImage
= PaToVa(WinLdrLoadModule(MiscFiles
,
211 &Extension
->DrvDBSize
, LoaderRegistryData
));
213 /* Convert extension and setup block pointers */
214 LoaderBlock
->Extension
= PaToVa(Extension
);
216 if (LoaderBlock
->SetupLdrBlock
)
217 LoaderBlock
->SetupLdrBlock
= PaToVa(LoaderBlock
->SetupLdrBlock
);
221 WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock
,
223 PUNICODE_STRING FilePath
,
225 PLDR_DATA_TABLE_ENTRY
*DriverDTE
)
228 CHAR DriverPath
[1024];
234 // Separate the path to file name and directory path
235 _snprintf(DriverPath
, sizeof(DriverPath
), "%wZ", FilePath
);
236 DriverNamePos
= strrchr(DriverPath
, '\\');
237 if (DriverNamePos
!= NULL
)
240 strcpy(DllName
, DriverNamePos
+1);
242 // Cut out the name from the path
243 *(DriverNamePos
+1) = 0;
247 // There is no directory in the path
248 strcpy(DllName
, DriverPath
);
252 DPRINTM(DPRINT_WINDOWS
, "DriverPath: %s, DllName: %s, LPB %p\n", DriverPath
, DllName
, LoaderBlock
);
255 // Check if driver is already loaded
256 Status
= WinLdrCheckForLoadedDll(LoaderBlock
, DllName
, DriverDTE
);
259 // We've got the pointer to its DTE, just return success
263 // It's not loaded, we have to load it
264 _snprintf(FullPath
, sizeof(FullPath
), "%s%wZ", BootPath
, FilePath
);
265 Status
= WinLdrLoadImage(FullPath
, LoaderBootDriver
, &DriverBase
);
268 DPRINTM(DPRINT_WINDOWS
, "WinLdrLoadImage() failed\n");
272 // Allocate a DTE for it
273 Status
= WinLdrAllocateDataTableEntry(LoaderBlock
, DllName
, DllName
, DriverBase
, DriverDTE
);
276 DPRINTM(DPRINT_WINDOWS
, "WinLdrAllocateDataTableEntry() failed\n");
280 // Modify any flags, if needed
281 (*DriverDTE
)->Flags
|= Flags
;
283 // Look for any dependencies it may have, and load them too
284 sprintf(FullPath
,"%s%s", BootPath
, DriverPath
);
285 Status
= WinLdrScanImportDescriptorTable(LoaderBlock
, FullPath
, *DriverDTE
);
288 DPRINTM(DPRINT_WINDOWS
, "WinLdrScanImportDescriptorTable() failed for %s\n",
297 WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock
,
301 PBOOT_DRIVER_LIST_ENTRY BootDriver
;
304 // Walk through the boot drivers list
305 NextBd
= LoaderBlock
->BootDriverListHead
.Flink
;
307 while (NextBd
!= &LoaderBlock
->BootDriverListHead
)
309 BootDriver
= CONTAINING_RECORD(NextBd
, BOOT_DRIVER_LIST_ENTRY
, Link
);
311 DPRINTM(DPRINT_WINDOWS
, "BootDriver %wZ DTE %08X RegPath: %wZ\n", &BootDriver
->FilePath
,
312 BootDriver
->LdrEntry
, &BootDriver
->RegistryPath
);
314 // Paths are relative (FIXME: Are they always relative?)
317 Status
= WinLdrLoadDeviceDriver(LoaderBlock
, BootPath
, &BootDriver
->FilePath
,
318 0, &BootDriver
->LdrEntry
);
320 // If loading failed - cry loudly
321 //FIXME: Maybe remove it from the list and try to continue?
324 DPRINTM(DPRINT_WARNING
, "Can't load boot driver: %wZ\n", &BootDriver
->FilePath
);
325 UiMessageBox("Can't load boot driver!");
329 // Convert the RegistryPath and DTE addresses to VA since we are not going to use it anymore
330 BootDriver
->RegistryPath
.Buffer
= PaToVa(BootDriver
->RegistryPath
.Buffer
);
331 BootDriver
->FilePath
.Buffer
= PaToVa(BootDriver
->FilePath
.Buffer
);
332 BootDriver
->LdrEntry
= PaToVa(BootDriver
->LdrEntry
);
334 NextBd
= BootDriver
->Link
.Flink
;
340 PVOID
WinLdrLoadModule(PCSTR ModuleName
, ULONG
*Size
,
341 TYPE_OF_MEMORY MemoryType
)
345 FILEINFORMATION FileInfo
;
350 //CHAR ProgressString[256];
352 /* Inform user we are loading files */
353 //sprintf(ProgressString, "Loading %s...", FileName);
354 //UiDrawProgressBarCenter(1, 100, ProgressString);
356 DPRINTM(DPRINT_WINDOWS
, "Loading module %s\n", ModuleName
);
359 /* Open the image file */
360 Status
= ArcOpen((PCHAR
)ModuleName
, OpenReadOnly
, &FileId
);
361 if (Status
!= ESUCCESS
)
363 /* In case of errors, we just return, without complaining to the user */
367 /* Get this file's size */
368 Status
= ArcGetFileInformation(FileId
, &FileInfo
);
369 if (Status
!= ESUCCESS
)
374 FileSize
= FileInfo
.EndingAddress
.LowPart
;
377 /* Allocate memory */
378 PhysicalBase
= MmAllocateMemoryWithType(FileSize
, MemoryType
);
379 if (PhysicalBase
== NULL
)
385 /* Load whole file */
386 Status
= ArcRead(FileId
, PhysicalBase
, FileSize
, &BytesRead
);
388 if (Status
!= ESUCCESS
)
393 DPRINTM(DPRINT_WINDOWS
, "Loaded %s at 0x%x with size 0x%x\n", ModuleName
, PhysicalBase
, FileSize
);
400 WinLdrDetectVersion()
407 L
"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server",
409 if (rc
!= ERROR_SUCCESS
)
411 // Key doesn't exist; assume NT 4.0
412 return _WIN32_WINNT_NT4
;
415 // We may here want to read the value of ProductVersion
416 return _WIN32_WINNT_WS03
;
421 LoadAndBootWindows(PCSTR OperatingSystemName
,
423 USHORT OperatingSystemVersion
)
426 char FullPath
[MAX_PATH
], SystemRoot
[MAX_PATH
], BootPath
[MAX_PATH
];
427 CHAR FileName
[MAX_PATH
];
428 CHAR BootOptions
[256];
431 PVOID NtosBase
= NULL
, HalBase
= NULL
, KdComBase
= NULL
;
434 PLOADER_PARAMETER_BLOCK LoaderBlock
, LoaderBlockVA
;
435 KERNEL_ENTRY_POINT KiSystemStartup
;
436 PLDR_DATA_TABLE_ENTRY KernelDTE
, HalDTE
, KdComDTE
= NULL
;
442 // Open the operating system section
443 // specified in the .ini file
444 HasSection
= IniOpenSection(OperatingSystemName
, &SectionId
);
447 UiDrawStatusText("Detecting Hardware...");
448 UiDrawProgressBarCenter(1, 100, "Loading NT...");
450 /* Read the system path is set in the .ini file */
451 if (!HasSection
|| !IniReadSettingByName(SectionId
, "SystemPath", FullPath
, sizeof(FullPath
)))
453 strcpy(FullPath
, OperatingSystemName
);
456 /* Special case for LiveCD */
457 if (!_strnicmp(FullPath
, "LiveCD", strlen("LiveCD")))
459 strcpy(BootPath
, FullPath
+ strlen("LiveCD"));
460 MachDiskGetBootPath(FullPath
, sizeof(FullPath
));
461 strcat(FullPath
, BootPath
);
464 /* Convert FullPath to SystemRoot */
465 PathSeparator
= strstr(FullPath
, "\\");
466 strcpy(SystemRoot
, PathSeparator
);
467 strcat(SystemRoot
, "\\");
469 /* Read booting options */
470 if (!HasSection
|| !IniReadSettingByName(SectionId
, "Options", BootOptions
, sizeof(BootOptions
)))
472 /* Get options after the title */
473 const CHAR
*p
= SettingsValue
;
474 while (*p
== ' ' || *p
== '"')
476 while (*p
!= '\0' && *p
!= '"')
478 strcpy(BootOptions
, p
);
479 DPRINTM(DPRINT_WINDOWS
,"BootOptions: '%s'\n", BootOptions
);
483 // Check if a ramdisk file was given
485 File
= strstr(BootOptions
, "/RDPATH=");
489 // Copy the file name and everything else after it
491 strcpy(FileName
, File
+ 8);
496 *strstr(FileName
, " ") = ANSI_NULL
;
501 RamDiskLoadVirtualFile(FileName
);
504 /* Let user know we started loading */
505 UiDrawStatusText("Loading...");
507 /* append a backslash */
508 strcpy(BootPath
, FullPath
);
509 if ((strlen(BootPath
)==0) ||
510 BootPath
[strlen(BootPath
)] != '\\')
511 strcat(BootPath
, "\\");
513 DPRINTM(DPRINT_WINDOWS
,"BootPath: '%s'\n", BootPath
);
515 /* Allocate and minimalistic-initialize LPB */
516 AllocateAndInitLPB(&LoaderBlock
);
518 /* Detect hardware */
520 LoaderBlock
->ConfigurationRoot
= MachHwDetect();
523 Status
= WinLdrInitSystemHive(LoaderBlock
, BootPath
);
524 DPRINTM(DPRINT_WINDOWS
, "SYSTEM hive loaded with status %d\n", Status
);
526 if (OperatingSystemVersion
== 0)
527 OperatingSystemVersion
= WinLdrDetectVersion();
530 strcpy(FileName
, BootPath
);
531 strcat(FileName
, "SYSTEM32\\NTOSKRNL.EXE");
532 Status
= WinLdrLoadImage(FileName
, LoaderSystemCode
, &NtosBase
);
533 DPRINTM(DPRINT_WINDOWS
, "Ntos loaded with status %d at %p\n", Status
, NtosBase
);
536 strcpy(FileName
, BootPath
);
537 strcat(FileName
, "SYSTEM32\\HAL.DLL");
538 Status
= WinLdrLoadImage(FileName
, LoaderHalCode
, &HalBase
);
539 DPRINTM(DPRINT_WINDOWS
, "HAL loaded with status %d at %p\n", Status
, HalBase
);
541 /* Load kernel-debugger support dll */
542 if (OperatingSystemVersion
> _WIN32_WINNT_WIN2K
)
544 strcpy(FileName
, BootPath
);
545 strcat(FileName
, "SYSTEM32\\KDCOM.DLL");
546 Status
= WinLdrLoadImage(FileName
, LoaderBootDriver
, &KdComBase
);
547 DPRINTM(DPRINT_WINDOWS
, "KdCom loaded with status %d at %p\n", Status
, KdComBase
);
550 /* Allocate data table entries for above-loaded modules */
551 WinLdrAllocateDataTableEntry(LoaderBlock
, "ntoskrnl.exe",
552 "WINDOWS\\SYSTEM32\\NTOSKRNL.EXE", NtosBase
, &KernelDTE
);
553 WinLdrAllocateDataTableEntry(LoaderBlock
, "hal.dll",
554 "WINDOWS\\SYSTEM32\\HAL.DLL", HalBase
, &HalDTE
);
555 if (OperatingSystemVersion
> _WIN32_WINNT_WIN2K
)
557 WinLdrAllocateDataTableEntry(LoaderBlock
, "kdcom.dll",
558 "WINDOWS\\SYSTEM32\\KDCOM.DLL", KdComBase
, &KdComDTE
);
561 /* Load all referenced DLLs for kernel, HAL and kdcom.dll */
562 strcpy(FileName
, BootPath
);
563 strcat(FileName
, "SYSTEM32\\");
564 WinLdrScanImportDescriptorTable(LoaderBlock
, FileName
, KernelDTE
);
565 WinLdrScanImportDescriptorTable(LoaderBlock
, FileName
, HalDTE
);
567 WinLdrScanImportDescriptorTable(LoaderBlock
, FileName
, KdComDTE
);
569 /* Load NLS data, OEM font, and prepare boot drivers list */
570 Status
= WinLdrScanSystemHive(LoaderBlock
, BootPath
);
571 DPRINTM(DPRINT_WINDOWS
, "SYSTEM hive scanned with status %d\n", Status
);
573 /* Load boot drivers */
574 Status
= WinLdrLoadBootDrivers(LoaderBlock
, BootPath
);
575 DPRINTM(DPRINT_WINDOWS
, "Boot drivers loaded with status %d\n", Status
);
577 /* Alloc PCR, TSS, do magic things with the GDT/IDT */
578 WinLdrSetupForNt(LoaderBlock
, &GdtIdt
, &PcrBasePage
, &TssBasePage
);
580 /* Initialize Phase 1 - no drivers loading anymore */
581 WinLdrInitializePhase1(LoaderBlock
, BootOptions
, SystemRoot
, BootPath
, OperatingSystemVersion
);
583 /* Save entry-point pointer and Loader block VAs */
584 KiSystemStartup
= (KERNEL_ENTRY_POINT
)KernelDTE
->EntryPoint
;
585 LoaderBlockVA
= PaToVa(LoaderBlock
);
587 /* "Stop all motors", change videomode */
588 if (OperatingSystemVersion
< _WIN32_WINNT_WIN2K
)
589 MachPrepareForReactOS(TRUE
);
591 MachPrepareForReactOS(FALSE
);
594 //DumpMemoryAllocMap();
596 /* Turn on paging mode of CPU*/
597 WinLdrTurnOnPaging(LoaderBlock
, PcrBasePage
, TssBasePage
, GdtIdt
);
599 DbgPrint("Heeelooo\n");
601 /* Save final value of LoaderPagesSpanned */
602 LoaderBlockVA
->Extension
->LoaderPagesSpanned
= LoaderPagesSpanned
;
604 DPRINTM(DPRINT_WINDOWS
, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
605 KiSystemStartup
, LoaderBlockVA
);
607 DbgPrint("Heeelooo\n");
609 WinLdrpDumpMemoryDescriptors(LoaderBlockVA
);
610 WinLdrpDumpBootDriver(LoaderBlockVA
);
611 WinLdrpDumpArcDisks(LoaderBlockVA
);
613 //FIXME: If I substitute this debugging checkpoint, GCC will "optimize away" the code below
615 /*asm(".intel_syntax noprefix\n");
618 asm(".att_syntax\n");*/
621 (*KiSystemStartup
)(LoaderBlockVA
);
627 WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock
)
630 PMEMORY_ALLOCATION_DESCRIPTOR MemoryDescriptor
;
632 NextMd
= LoaderBlock
->MemoryDescriptorListHead
.Flink
;
634 while (NextMd
!= &LoaderBlock
->MemoryDescriptorListHead
)
636 MemoryDescriptor
= CONTAINING_RECORD(NextMd
, MEMORY_ALLOCATION_DESCRIPTOR
, ListEntry
);
638 DPRINTM(DPRINT_WINDOWS
, "BP %08X PC %04X MT %d\n", MemoryDescriptor
->BasePage
,
639 MemoryDescriptor
->PageCount
, MemoryDescriptor
->MemoryType
);
641 NextMd
= MemoryDescriptor
->ListEntry
.Flink
;
646 WinLdrpDumpBootDriver(PLOADER_PARAMETER_BLOCK LoaderBlock
)
649 PBOOT_DRIVER_LIST_ENTRY BootDriver
;
651 NextBd
= LoaderBlock
->BootDriverListHead
.Flink
;
653 while (NextBd
!= &LoaderBlock
->BootDriverListHead
)
655 BootDriver
= CONTAINING_RECORD(NextBd
, BOOT_DRIVER_LIST_ENTRY
, Link
);
657 DPRINTM(DPRINT_WINDOWS
, "BootDriver %wZ DTE %08X RegPath: %wZ\n", &BootDriver
->FilePath
,
658 BootDriver
->LdrEntry
, &BootDriver
->RegistryPath
);
660 NextBd
= BootDriver
->Link
.Flink
;
665 WinLdrpDumpArcDisks(PLOADER_PARAMETER_BLOCK LoaderBlock
)
668 PARC_DISK_SIGNATURE ArcDisk
;
670 NextBd
= LoaderBlock
->ArcDiskInformation
->DiskSignatureListHead
.Flink
;
672 while (NextBd
!= &LoaderBlock
->ArcDiskInformation
->DiskSignatureListHead
)
674 ArcDisk
= CONTAINING_RECORD(NextBd
, ARC_DISK_SIGNATURE
, ListEntry
);
676 DPRINTM(DPRINT_WINDOWS
, "ArcDisk %s checksum: 0x%X, signature: 0x%X\n",
677 ArcDisk
->ArcName
, ArcDisk
->CheckSum
, ArcDisk
->Signature
);
679 NextBd
= ArcDisk
->ListEntry
.Flink
;