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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include <ndk/ldrtypes.h>
27 //FIXME: Do a better way to retrieve Arc disk information
28 extern ULONG reactos_disk_count
;
29 extern ARC_DISK_SIGNATURE reactos_arc_disk_info
[];
30 extern char reactos_arc_strings
[32][256];
32 extern BOOLEAN UseRealHeap
;
33 extern ULONG LoaderPagesSpanned
;
36 WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock
,
38 OUT PLDR_DATA_TABLE_ENTRY
*LoadedEntry
);
41 VOID
DumpMemoryAllocMap(VOID
);
42 VOID
WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock
);
43 VOID
WinLdrpDumpBootDriver(PLOADER_PARAMETER_BLOCK LoaderBlock
);
44 VOID
WinLdrpDumpArcDisks(PLOADER_PARAMETER_BLOCK LoaderBlock
);
49 AllocateAndInitLPB(PLOADER_PARAMETER_BLOCK
*OutLoaderBlock
)
51 PLOADER_PARAMETER_BLOCK LoaderBlock
;
53 /* Allocate and zero-init the LPB */
54 LoaderBlock
= MmHeapAlloc(sizeof(LOADER_PARAMETER_BLOCK
));
55 RtlZeroMemory(LoaderBlock
, sizeof(LOADER_PARAMETER_BLOCK
));
57 /* Init three critical lists, used right away */
58 InitializeListHead(&LoaderBlock
->LoadOrderListHead
);
59 InitializeListHead(&LoaderBlock
->MemoryDescriptorListHead
);
60 InitializeListHead(&LoaderBlock
->BootDriverListHead
);
62 /* Alloc space for NLS (it will be converted to VA in WinLdrLoadNLS) */
63 LoaderBlock
->NlsData
= MmHeapAlloc(sizeof(NLS_DATA_BLOCK
));
64 if (LoaderBlock
->NlsData
== NULL
)
66 UiMessageBox("Failed to allocate memory for NLS table data!");
69 RtlZeroMemory(LoaderBlock
->NlsData
, sizeof(NLS_DATA_BLOCK
));
71 *OutLoaderBlock
= LoaderBlock
;
76 WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock
,
82 /* Examples of correct options and paths */
83 //CHAR Options[] = "/DEBUGPORT=COM1 /BAUDRATE=115200";
84 //CHAR Options[] = "/NODEBUG";
85 //CHAR SystemRoot[] = "\\WINNT\\";
86 //CHAR ArcBoot[] = "multi(0)disk(0)rdisk(0)partition(1)";
88 CHAR HalPath
[] = "\\";
91 ULONG i
, PathSeparator
;
92 PLOADER_PARAMETER_EXTENSION Extension
;
94 LoaderBlock
->u
.I386
.CommonDataArea
= NULL
; // Force No ABIOS support
96 /* Construct SystemRoot and ArcBoot from SystemPath */
97 PathSeparator
= strstr(BootPath
, "\\") - BootPath
;
98 strncpy(ArcBoot
, BootPath
, PathSeparator
);
99 ArcBoot
[PathSeparator
] = 0;
101 DPRINTM(DPRINT_WINDOWS
, "ArcBoot: %s\n", ArcBoot
);
102 DPRINTM(DPRINT_WINDOWS
, "SystemRoot: %s\n", SystemRoot
);
103 DPRINTM(DPRINT_WINDOWS
, "Options: %s\n", Options
);
105 /* Fill Arc BootDevice */
106 LoaderBlock
->ArcBootDeviceName
= MmHeapAlloc(strlen(ArcBoot
)+1);
107 strcpy(LoaderBlock
->ArcBootDeviceName
, ArcBoot
);
108 LoaderBlock
->ArcBootDeviceName
= PaToVa(LoaderBlock
->ArcBootDeviceName
);
110 /* Fill Arc HalDevice, it matches ArcBoot path */
111 LoaderBlock
->ArcHalDeviceName
= MmHeapAlloc(strlen(ArcBoot
)+1);
112 strcpy(LoaderBlock
->ArcHalDeviceName
, ArcBoot
);
113 LoaderBlock
->ArcHalDeviceName
= PaToVa(LoaderBlock
->ArcHalDeviceName
);
115 /* Fill SystemRoot */
116 LoaderBlock
->NtBootPathName
= MmHeapAlloc(strlen(SystemRoot
)+1);
117 strcpy(LoaderBlock
->NtBootPathName
, SystemRoot
);
118 LoaderBlock
->NtBootPathName
= PaToVa(LoaderBlock
->NtBootPathName
);
120 /* Fill NtHalPathName */
121 LoaderBlock
->NtHalPathName
= MmHeapAlloc(strlen(HalPath
)+1);
122 strcpy(LoaderBlock
->NtHalPathName
, HalPath
);
123 LoaderBlock
->NtHalPathName
= PaToVa(LoaderBlock
->NtHalPathName
);
125 /* Fill load options */
126 LoaderBlock
->LoadOptions
= MmHeapAlloc(strlen(Options
)+1);
127 strcpy(LoaderBlock
->LoadOptions
, Options
);
128 LoaderBlock
->LoadOptions
= PaToVa(LoaderBlock
->LoadOptions
);
131 LoaderBlock
->ArcDiskInformation
= (PARC_DISK_INFORMATION
)MmHeapAlloc(sizeof(ARC_DISK_INFORMATION
));
132 InitializeListHead(&LoaderBlock
->ArcDiskInformation
->DiskSignatureListHead
);
134 /* Convert ARC disk information from freeldr to a correct format */
135 for (i
= 0; i
< reactos_disk_count
; i
++)
137 PARC_DISK_SIGNATURE ArcDiskInfo
;
139 /* Get the ARC structure */
140 ArcDiskInfo
= (PARC_DISK_SIGNATURE
)MmHeapAlloc(sizeof(ARC_DISK_SIGNATURE
));
141 RtlZeroMemory(ArcDiskInfo
, sizeof(ARC_DISK_SIGNATURE
));
143 /* Copy the data over */
144 ArcDiskInfo
->Signature
= reactos_arc_disk_info
[i
].Signature
;
145 ArcDiskInfo
->CheckSum
= reactos_arc_disk_info
[i
].CheckSum
;
147 /* Copy the ARC Name */
148 ArcDiskInfo
->ArcName
= (PCHAR
)MmHeapAlloc(sizeof(CHAR
)*256);
149 strcpy(ArcDiskInfo
->ArcName
, reactos_arc_disk_info
[i
].ArcName
);
150 ArcDiskInfo
->ArcName
= (PCHAR
)PaToVa(ArcDiskInfo
->ArcName
);
152 /* Mark partition table as valid */
153 ArcDiskInfo
->ValidPartitionTable
= TRUE
;
155 /* Insert into the list */
156 InsertTailList(&LoaderBlock
->ArcDiskInformation
->DiskSignatureListHead
,
157 &ArcDiskInfo
->ListEntry
);
160 /* Convert all list's to Virtual address */
162 /* Convert the ArcDisks list to virtual address */
163 List_PaToVa(&LoaderBlock
->ArcDiskInformation
->DiskSignatureListHead
);
164 LoaderBlock
->ArcDiskInformation
= PaToVa(LoaderBlock
->ArcDiskInformation
);
166 /* Convert configuration entries to VA */
167 ConvertConfigToVA(LoaderBlock
->ConfigurationRoot
);
168 LoaderBlock
->ConfigurationRoot
= PaToVa(LoaderBlock
->ConfigurationRoot
);
170 /* Convert all DTE into virtual addresses */
171 List_PaToVa(&LoaderBlock
->LoadOrderListHead
);
173 /* this one will be converted right before switching to
174 virtual paging mode */
175 //List_PaToVa(&LoaderBlock->MemoryDescriptorListHead);
177 /* Convert list of boot drivers */
178 List_PaToVa(&LoaderBlock
->BootDriverListHead
);
180 /* Initialize Extension now */
181 Extension
= MmHeapAlloc(sizeof(LOADER_PARAMETER_EXTENSION
));
182 if (Extension
== NULL
)
184 UiMessageBox("Failed to allocate LPB Extension!");
187 RtlZeroMemory(Extension
, sizeof(LOADER_PARAMETER_EXTENSION
));
189 /* Fill LPB extension */
190 Extension
->Size
= sizeof(LOADER_PARAMETER_EXTENSION
);
191 Extension
->MajorVersion
= (VersionToBoot
& 0xFF00) >> 8;
192 Extension
->MinorVersion
= VersionToBoot
& 0xFF;
193 Extension
->Profile
.Status
= 2;
195 /* Load drivers database */
196 strcpy(MiscFiles
, BootPath
);
197 strcat(MiscFiles
, "AppPatch\\drvmain.sdb");
198 Extension
->DrvDBImage
= PaToVa(WinLdrLoadModule(MiscFiles
,
199 &Extension
->DrvDBSize
, LoaderRegistryData
));
201 /* Convert extension and setup block pointers */
202 LoaderBlock
->Extension
= PaToVa(Extension
);
204 if (LoaderBlock
->SetupLdrBlock
)
205 LoaderBlock
->SetupLdrBlock
= PaToVa(LoaderBlock
->SetupLdrBlock
);
208 // Last step before going virtual
209 void WinLdrSetupForNt(PLOADER_PARAMETER_BLOCK LoaderBlock
,
218 ULONG BlockSize
, NumPages
;
220 LoaderBlock
->u
.I386
.CommonDataArea
= NULL
; //CommonDataArea;
221 LoaderBlock
->u
.I386
.MachineType
= 0; // ntldr sets this to 0
223 /* Allocate 2 pages for PCR */
224 Pcr
= (ULONG_PTR
)MmAllocateMemoryWithType(2 * MM_PAGE_SIZE
, LoaderStartupPcrPage
);
225 *PcrBasePage
= Pcr
>> MM_PAGE_SHIFT
;
229 UiMessageBox("Can't allocate PCR\n");
234 TssSize
= (sizeof(KTSS
) + MM_PAGE_SIZE
) & ~(MM_PAGE_SIZE
- 1);
235 TssPages
= TssSize
/ MM_PAGE_SIZE
;
237 Tss
= (ULONG_PTR
)MmAllocateMemoryWithType(TssSize
, LoaderMemoryData
);
239 *TssBasePage
= Tss
>> MM_PAGE_SHIFT
;
241 /* Allocate space for new GDT + IDT */
242 BlockSize
= NUM_GDT
*sizeof(KGDTENTRY
) + NUM_IDT
*sizeof(KIDTENTRY
);//FIXME: Use GDT/IDT limits here?
243 NumPages
= (BlockSize
+ MM_PAGE_SIZE
- 1) >> MM_PAGE_SHIFT
;
244 *GdtIdt
= (PKGDTENTRY
)MmAllocateMemoryWithType(NumPages
* MM_PAGE_SIZE
, LoaderMemoryData
);
248 UiMessageBox("Can't allocate pages for GDT+IDT!\n");
252 /* Zero newly prepared GDT+IDT */
253 RtlZeroMemory(*GdtIdt
, NumPages
<< MM_PAGE_SHIFT
);
257 WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock
,
259 PUNICODE_STRING FilePath
,
261 PLDR_DATA_TABLE_ENTRY
*DriverDTE
)
264 CHAR DriverPath
[1024];
270 // Separate the path to file name and directory path
271 sprintf(DriverPath
, "%S", FilePath
->Buffer
);
272 DriverNamePos
= strrchr(DriverPath
, '\\');
273 if (DriverNamePos
!= NULL
)
276 strcpy(DllName
, DriverNamePos
+1);
278 // Cut out the name from the path
279 *(DriverNamePos
+1) = 0;
283 // There is no directory in the path
284 strcpy(DllName
, DriverPath
);
288 DPRINTM(DPRINT_WINDOWS
, "DriverPath: %s, DllName: %s, LPB %p\n", DriverPath
, DllName
, LoaderBlock
);
291 // Check if driver is already loaded
292 Status
= WinLdrCheckForLoadedDll(LoaderBlock
, DllName
, DriverDTE
);
295 // We've got the pointer to its DTE, just return success
299 // It's not loaded, we have to load it
300 sprintf(FullPath
,"%s%S", BootPath
, FilePath
->Buffer
);
301 Status
= WinLdrLoadImage(FullPath
, LoaderBootDriver
, &DriverBase
);
305 // Allocate a DTE for it
306 Status
= WinLdrAllocateDataTableEntry(LoaderBlock
, DllName
, DllName
, DriverBase
, DriverDTE
);
309 DPRINTM(DPRINT_WINDOWS
, "WinLdrAllocateDataTableEntry() failed\n");
313 // Modify any flags, if needed
314 (*DriverDTE
)->Flags
|= Flags
;
316 // Look for any dependencies it may have, and load them too
317 sprintf(FullPath
,"%s%s", BootPath
, DriverPath
);
318 Status
= WinLdrScanImportDescriptorTable(LoaderBlock
, FullPath
, *DriverDTE
);
321 DPRINTM(DPRINT_WINDOWS
, "WinLdrScanImportDescriptorTable() failed for %s\n",
330 WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock
,
334 PBOOT_DRIVER_LIST_ENTRY BootDriver
;
337 // Walk through the boot drivers list
338 NextBd
= LoaderBlock
->BootDriverListHead
.Flink
;
340 while (NextBd
!= &LoaderBlock
->BootDriverListHead
)
342 BootDriver
= CONTAINING_RECORD(NextBd
, BOOT_DRIVER_LIST_ENTRY
, Link
);
344 DPRINTM(DPRINT_WINDOWS
, "BootDriver %wZ DTE %08X RegPath: %wZ\n", &BootDriver
->FilePath
,
345 BootDriver
->LdrEntry
, &BootDriver
->RegistryPath
);
347 // Paths are relative (FIXME: Are they always relative?)
350 Status
= WinLdrLoadDeviceDriver(LoaderBlock
, BootPath
, &BootDriver
->FilePath
,
351 0, &BootDriver
->LdrEntry
);
353 // If loading failed - cry loudly
354 //FIXME: Maybe remove it from the list and try to continue?
357 UiMessageBox("Can't load boot driver!");
361 // Convert the RegistryPath and DTE addresses to VA since we are not going to use it anymore
362 BootDriver
->RegistryPath
.Buffer
= PaToVa(BootDriver
->RegistryPath
.Buffer
);
363 BootDriver
->LdrEntry
= PaToVa(BootDriver
->LdrEntry
);
365 NextBd
= BootDriver
->Link
.Flink
;
371 PVOID
WinLdrLoadModule(PCSTR ModuleName
, ULONG
*Size
,
372 TYPE_OF_MEMORY MemoryType
)
376 FILEINFORMATION FileInfo
;
381 //CHAR ProgressString[256];
383 /* Inform user we are loading files */
384 //sprintf(ProgressString, "Loading %s...", FileName);
385 //UiDrawProgressBarCenter(1, 100, ProgressString);
387 DPRINTM(DPRINT_WINDOWS
, "Loading module %s\n", ModuleName
);
390 /* Open the image file */
391 Status
= ArcOpen((PCHAR
)ModuleName
, OpenReadOnly
, &FileId
);
392 if (Status
!= ESUCCESS
)
394 /* In case of errors, we just return, without complaining to the user */
398 /* Get this file's size */
399 Status
= ArcGetFileInformation(FileId
, &FileInfo
);
400 if (Status
!= ESUCCESS
)
405 FileSize
= FileInfo
.EndingAddress
.LowPart
;
408 /* Allocate memory */
409 PhysicalBase
= MmAllocateMemoryWithType(FileSize
, MemoryType
);
410 if (PhysicalBase
== NULL
)
416 /* Load whole file */
417 Status
= ArcRead(FileId
, PhysicalBase
, FileSize
, &BytesRead
);
419 if (Status
!= ESUCCESS
)
424 DPRINTM(DPRINT_WINDOWS
, "Loaded %s at 0x%x with size 0x%x\n", ModuleName
, PhysicalBase
, FileSize
);
431 LoadAndBootWindows(PCSTR OperatingSystemName
, USHORT OperatingSystemVersion
)
434 CHAR FullPath
[MAX_PATH
], SystemRoot
[MAX_PATH
], BootPath
[MAX_PATH
];
435 CHAR FileName
[MAX_PATH
];
436 CHAR BootOptions
[256];
438 PVOID NtosBase
= NULL
, HalBase
= NULL
, KdComBase
= NULL
;
441 PLOADER_PARAMETER_BLOCK LoaderBlock
, LoaderBlockVA
;
442 KERNEL_ENTRY_POINT KiSystemStartup
;
443 PLDR_DATA_TABLE_ENTRY KernelDTE
, HalDTE
, KdComDTE
= NULL
;
449 //sprintf(MsgBuffer,"Booting Microsoft(R) Windows(R) OS version '%04x' is not implemented yet", OperatingSystemVersion);
450 //UiMessageBox(MsgBuffer);
452 // Open the operating system section
453 // specified in the .ini file
454 if (!IniOpenSection(OperatingSystemName
, &SectionId
))
456 sprintf(MsgBuffer
,"Operating System section '%s' not found in freeldr.ini", OperatingSystemName
);
457 UiMessageBox(MsgBuffer
);
462 UiDrawStatusText("Detecting Hardware...");
463 UiDrawProgressBarCenter(1, 100, "Loading Windows...");
465 /* Make sure the system path is set in the .ini file */
466 if (!IniReadSettingByName(SectionId
, "SystemPath", FullPath
, sizeof(FullPath
)))
468 UiMessageBox("System path not specified for selected operating system.");
472 /* Special case for LiveCD */
473 if (!_strnicmp(FullPath
, "LiveCD", strlen("LiveCD")))
475 strcpy(BootPath
, FullPath
+ strlen("LiveCD"));
476 MachDiskGetBootPath(FullPath
, sizeof(FullPath
));
477 strcat(FullPath
, BootPath
);
480 /* Convert FullPath to SystemRoot */
481 PathSeparator
= strstr(FullPath
, "\\");
482 strcpy(SystemRoot
, PathSeparator
);
483 strcat(SystemRoot
, "\\");
485 /* Read booting options */
486 if (!IniReadSettingByName(SectionId
, "Options", BootOptions
, sizeof(BootOptions
)))
488 /* Nothing read, make the string empty */
489 strcpy(BootOptions
, "");
492 /* Let user know we started loading */
493 UiDrawStatusText("Loading...");
495 /* append a backslash */
496 strcpy(BootPath
, FullPath
);
497 if ((strlen(BootPath
)==0) ||
498 BootPath
[strlen(BootPath
)] != '\\')
499 strcat(BootPath
, "\\");
501 DPRINTM(DPRINT_WINDOWS
,"BootPath: '%s'\n", BootPath
);
503 /* Allocate and minimalistic-initialize LPB */
504 AllocateAndInitLPB(&LoaderBlock
);
506 /* Detect hardware */
508 LoaderBlock
->ConfigurationRoot
= MachHwDetect();
511 strcpy(FileName
, BootPath
);
512 strcat(FileName
, "SYSTEM32\\NTOSKRNL.EXE");
513 Status
= WinLdrLoadImage(FileName
, LoaderSystemCode
, &NtosBase
);
514 DPRINTM(DPRINT_WINDOWS
, "Ntos loaded with status %d at %p\n", Status
, NtosBase
);
517 strcpy(FileName
, BootPath
);
518 strcat(FileName
, "SYSTEM32\\HAL.DLL");
519 Status
= WinLdrLoadImage(FileName
, LoaderHalCode
, &HalBase
);
520 DPRINTM(DPRINT_WINDOWS
, "HAL loaded with status %d at %p\n", Status
, HalBase
);
522 /* Load kernel-debugger support dll */
523 if (OperatingSystemVersion
> _WIN32_WINNT_WIN2K
)
525 strcpy(FileName
, BootPath
);
526 strcat(FileName
, "SYSTEM32\\KDCOM.DLL");
527 Status
= WinLdrLoadImage(FileName
, LoaderBootDriver
, &KdComBase
);
528 DPRINTM(DPRINT_WINDOWS
, "KdCom loaded with status %d at %p\n", Status
, KdComBase
);
531 /* Allocate data table entries for above-loaded modules */
532 WinLdrAllocateDataTableEntry(LoaderBlock
, "ntoskrnl.exe",
533 "WINDOWS\\SYSTEM32\\NTOSKRNL.EXE", NtosBase
, &KernelDTE
);
534 WinLdrAllocateDataTableEntry(LoaderBlock
, "hal.dll",
535 "WINDOWS\\SYSTEM32\\HAL.DLL", HalBase
, &HalDTE
);
536 if (OperatingSystemVersion
> _WIN32_WINNT_WIN2K
)
538 WinLdrAllocateDataTableEntry(LoaderBlock
, "kdcom.dll",
539 "WINDOWS\\SYSTEM32\\KDCOM.DLL", KdComBase
, &KdComDTE
);
542 /* Load all referenced DLLs for kernel, HAL and kdcom.dll */
543 strcpy(FileName
, BootPath
);
544 strcat(FileName
, "SYSTEM32\\");
545 WinLdrScanImportDescriptorTable(LoaderBlock
, FileName
, KernelDTE
);
546 WinLdrScanImportDescriptorTable(LoaderBlock
, FileName
, HalDTE
);
548 WinLdrScanImportDescriptorTable(LoaderBlock
, FileName
, KdComDTE
);
550 /* Load Hive, and then NLS data, OEM font, and prepare boot drivers list */
551 Status
= WinLdrLoadAndScanSystemHive(LoaderBlock
, BootPath
);
552 DPRINTM(DPRINT_WINDOWS
, "SYSTEM hive loaded and scanned with status %d\n", Status
);
554 /* Load boot drivers */
555 Status
= WinLdrLoadBootDrivers(LoaderBlock
, BootPath
);
556 DPRINTM(DPRINT_WINDOWS
, "Boot drivers loaded with status %d\n", Status
);
558 /* Alloc PCR, TSS, do magic things with the GDT/IDT */
559 WinLdrSetupForNt(LoaderBlock
, &GdtIdt
, &PcrBasePage
, &TssBasePage
);
561 /* Initialize Phase 1 - no drivers loading anymore */
562 WinLdrInitializePhase1(LoaderBlock
, BootOptions
, SystemRoot
, BootPath
, OperatingSystemVersion
);
564 /* Save entry-point pointer and Loader block VAs */
565 KiSystemStartup
= (KERNEL_ENTRY_POINT
)KernelDTE
->EntryPoint
;
566 LoaderBlockVA
= PaToVa(LoaderBlock
);
568 /* "Stop all motors", change videomode */
569 if (OperatingSystemVersion
< _WIN32_WINNT_WIN2K
)
570 MachPrepareForReactOS(TRUE
);
572 MachPrepareForReactOS(FALSE
);
575 //DumpMemoryAllocMap();
577 /* Turn on paging mode of CPU*/
578 WinLdrTurnOnPaging(LoaderBlock
, PcrBasePage
, TssBasePage
, GdtIdt
);
580 /* Save final value of LoaderPagesSpanned */
581 LoaderBlock
->Extension
->LoaderPagesSpanned
= LoaderPagesSpanned
;
583 DPRINTM(DPRINT_WINDOWS
, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
584 KiSystemStartup
, LoaderBlockVA
);
586 WinLdrpDumpMemoryDescriptors(LoaderBlockVA
);
587 WinLdrpDumpBootDriver(LoaderBlockVA
);
588 WinLdrpDumpArcDisks(LoaderBlockVA
);
590 //FIXME: If I substitute this debugging checkpoint, GCC will "optimize away" the code below
592 /*asm(".intel_syntax noprefix\n");
595 asm(".att_syntax\n");*/
598 (*KiSystemStartup
)(LoaderBlockVA
);
604 WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock
)
607 PMEMORY_ALLOCATION_DESCRIPTOR MemoryDescriptor
;
609 NextMd
= LoaderBlock
->MemoryDescriptorListHead
.Flink
;
611 while (NextMd
!= &LoaderBlock
->MemoryDescriptorListHead
)
613 MemoryDescriptor
= CONTAINING_RECORD(NextMd
, MEMORY_ALLOCATION_DESCRIPTOR
, ListEntry
);
615 DPRINTM(DPRINT_WINDOWS
, "BP %08X PC %04X MT %d\n", MemoryDescriptor
->BasePage
,
616 MemoryDescriptor
->PageCount
, MemoryDescriptor
->MemoryType
);
618 NextMd
= MemoryDescriptor
->ListEntry
.Flink
;
623 WinLdrpDumpBootDriver(PLOADER_PARAMETER_BLOCK LoaderBlock
)
626 PBOOT_DRIVER_LIST_ENTRY BootDriver
;
628 NextBd
= LoaderBlock
->BootDriverListHead
.Flink
;
630 while (NextBd
!= &LoaderBlock
->BootDriverListHead
)
632 BootDriver
= CONTAINING_RECORD(NextBd
, BOOT_DRIVER_LIST_ENTRY
, Link
);
634 DPRINTM(DPRINT_WINDOWS
, "BootDriver %wZ DTE %08X RegPath: %wZ\n", &BootDriver
->FilePath
,
635 BootDriver
->LdrEntry
, &BootDriver
->RegistryPath
);
637 NextBd
= BootDriver
->Link
.Flink
;
642 WinLdrpDumpArcDisks(PLOADER_PARAMETER_BLOCK LoaderBlock
)
645 PARC_DISK_SIGNATURE ArcDisk
;
647 NextBd
= LoaderBlock
->ArcDiskInformation
->DiskSignatureListHead
.Flink
;
649 while (NextBd
!= &LoaderBlock
->ArcDiskInformation
->DiskSignatureListHead
)
651 ArcDisk
= CONTAINING_RECORD(NextBd
, ARC_DISK_SIGNATURE
, ListEntry
);
653 DPRINTM(DPRINT_WINDOWS
, "ArcDisk %s checksum: 0x%X, signature: 0x%X\n",
654 ArcDisk
->ArcName
, ArcDisk
->CheckSum
, ArcDisk
->Signature
);
656 NextBd
= ArcDisk
->ListEntry
.Flink
;