6f668f65e5a8ca3a39f4d469b2c5425b8cba150c
[reactos.git] / reactos / boot / freeldr / freeldr / windows / winldr.c
1 /*
2 * FreeLoader
3 *
4 * Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
5 * Copyright (C) 2006 Aleksey Bragin <aleksey@reactos.org>
6 *
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.
11 *
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.
16 *
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.
20 */
21
22 #include <freeldr.h>
23
24 #include <ndk/ldrtypes.h>
25
26 //#define NDEBUG
27 #include <debug.h>
28
29 VOID DumpMemoryAllocMap(VOID);
30 VOID WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock);
31
32 BOOLEAN
33 WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
34 IN LPCSTR DirectoryPath,
35 IN LPCSTR AnsiFileName,
36 IN LPCSTR OemFileName,
37 IN LPCSTR LanguageFileName)
38 {
39 CHAR FileName[255];
40 PFILE AnsiFileHandle;
41 PFILE OemFileHandle;
42 PFILE LanguageFileHandle;
43 ULONG AnsiFileSize, OemFileSize, LanguageFileSize;
44 ULONG TotalSize;
45 ULONG_PTR NlsDataBase;
46 PVOID NlsVirtual;
47 BOOLEAN Status, AnsiEqualsOem = FALSE;
48
49 /* There may be a case, when OEM and ANSI page coincide */
50 if (!strcmp(AnsiFileName, OemFileName))
51 AnsiEqualsOem = TRUE;
52
53 /* Open file with ANSI and store its size */
54 //Print(L"Loading %s...\n", Filename);
55 strcpy(FileName, DirectoryPath);
56 strcat(FileName, AnsiFileName);
57 AnsiFileHandle = FsOpenFile(FileName);
58
59 if (AnsiFileHandle == NULL)
60 goto Failure;
61
62 AnsiFileSize = FsGetFileSize(AnsiFileHandle);
63 DbgPrint((DPRINT_WINDOWS, "AnsiFileSize: %d\n", AnsiFileSize));
64 FsCloseFile(AnsiFileHandle);
65
66 /* Open OEM file and store its length */
67 if (AnsiEqualsOem)
68 {
69 OemFileSize = 0;
70 }
71 else
72 {
73 //Print(L"Loading %s...\n", Filename);
74 strcpy(FileName, DirectoryPath);
75 strcat(FileName, OemFileName);
76 OemFileHandle = FsOpenFile(FileName);
77
78 if (OemFileHandle == NULL)
79 goto Failure;
80
81 OemFileSize = FsGetFileSize(OemFileHandle);
82 FsCloseFile(OemFileHandle);
83 }
84 DbgPrint((DPRINT_WINDOWS, "OemFileSize: %d\n", OemFileSize));
85
86 /* And finally open the language codepage file and store its length */
87 //Print(L"Loading %s...\n", Filename);
88 strcpy(FileName, DirectoryPath);
89 strcat(FileName, LanguageFileName);
90 LanguageFileHandle = FsOpenFile(FileName);
91
92 if (LanguageFileHandle == NULL)
93 goto Failure;
94
95 LanguageFileSize = FsGetFileSize(LanguageFileHandle);
96 FsCloseFile(LanguageFileHandle);
97 DbgPrint((DPRINT_WINDOWS, "LanguageFileSize: %d\n", LanguageFileSize));
98
99 /* Sum up all three length, having in mind that every one of them
100 must start at a page boundary => thus round up each file to a page */
101 TotalSize = MM_SIZE_TO_PAGES(AnsiFileSize) +
102 MM_SIZE_TO_PAGES(OemFileSize) +
103 MM_SIZE_TO_PAGES(LanguageFileSize);
104
105 NlsDataBase = (ULONG_PTR)MmAllocateMemory(TotalSize*MM_PAGE_SIZE);
106
107 if (NlsDataBase == 0)
108 goto Failure;
109
110 NlsVirtual = (PVOID)(KSEG0_BASE | NlsDataBase);
111 LoaderBlock->NlsData->AnsiCodePageData = NlsVirtual;
112 LoaderBlock->NlsData->OemCodePageData = (PVOID)((PUCHAR)NlsVirtual +
113 (MM_SIZE_TO_PAGES(AnsiFileSize) << MM_PAGE_SHIFT));
114 LoaderBlock->NlsData->UnicodeCodePageData = (PVOID)((PUCHAR)NlsVirtual +
115 (MM_SIZE_TO_PAGES(AnsiFileSize) << MM_PAGE_SHIFT) +
116 (MM_SIZE_TO_PAGES(OemFileSize) << MM_PAGE_SHIFT));
117
118 /* Ansi and OEM data are the same - just set pointers to the same area */
119 if (AnsiEqualsOem)
120 LoaderBlock->NlsData->OemCodePageData = LoaderBlock->NlsData->AnsiCodePageData;
121
122
123 /* Now actually read the data into memory, starting with Ansi file */
124 strcpy(FileName, DirectoryPath);
125 strcat(FileName, AnsiFileName);
126 AnsiFileHandle = FsOpenFile(FileName);
127
128 if (AnsiFileHandle == NULL)
129 goto Failure;
130
131 Status = FsReadFile(AnsiFileHandle, AnsiFileSize, NULL, VaToPa(LoaderBlock->NlsData->AnsiCodePageData));
132
133 if (!Status)
134 goto Failure;
135
136 FsCloseFile(AnsiFileHandle);
137
138 /* OEM now, if it doesn't equal Ansi of course */
139 if (!AnsiEqualsOem)
140 {
141 strcpy(FileName, DirectoryPath);
142 strcat(FileName, OemFileName);
143 OemFileHandle = FsOpenFile(FileName);
144
145 if (OemFileHandle == NULL)
146 goto Failure;
147
148 Status = FsReadFile(OemFileHandle, OemFileSize, NULL, VaToPa(LoaderBlock->NlsData->OemCodePageData));
149
150 if (!Status)
151 goto Failure;
152
153 FsCloseFile(AnsiFileHandle);
154 }
155
156 /* finally the language file */
157 strcpy(FileName, DirectoryPath);
158 strcat(FileName, LanguageFileName);
159 LanguageFileHandle = FsOpenFile(FileName);
160
161 if (LanguageFileHandle == NULL)
162 goto Failure;
163
164 Status = FsReadFile(LanguageFileHandle, LanguageFileSize, NULL, VaToPa(LoaderBlock->NlsData->UnicodeCodePageData));
165
166 if (!Status)
167 goto Failure;
168
169 FsCloseFile(LanguageFileHandle);
170
171 //
172 // THIS IS HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACK
173 // Should go to WinLdrLoadOemHalFont(), when it will be implemented
174 //
175 LoaderBlock->OemFontFile = VaToPa(LoaderBlock->NlsData->UnicodeCodePageData);
176
177 /* Convert NlsTables address to VA */
178 LoaderBlock->NlsData = PaToVa(LoaderBlock->NlsData);
179
180 return TRUE;
181
182 Failure:
183 //UiMessageBox("Error reading NLS file %s\n", Filename);
184 UiMessageBox("Error reading NLS file!");
185 return FALSE;
186 }
187
188 void InitializeHWConfig(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
189 {
190 PCONFIGURATION_COMPONENT_DATA ConfigurationRoot;
191 PCONFIGURATION_COMPONENT Component;
192 PCONFIGURATION_COMPONENT_DATA /*CurrentEntry,*/ PreviousEntry, AdapterEntry;
193 BOOLEAN IsNextEntryChild;
194
195 DbgPrint((DPRINT_WINDOWS, "InitializeHWConfig()\n"));
196
197 LoaderBlock->ConfigurationRoot = MmAllocateMemory(sizeof(CONFIGURATION_COMPONENT_DATA));
198 RtlZeroMemory(LoaderBlock->ConfigurationRoot, sizeof(CONFIGURATION_COMPONENT_DATA));
199
200 /* Fill root == SystemClass */
201 ConfigurationRoot = LoaderBlock->ConfigurationRoot;
202 Component = &LoaderBlock->ConfigurationRoot->ComponentEntry;
203
204 Component->Class = SystemClass;
205 Component->Type = MaximumType;
206 Component->Version = 0; // FIXME: ?
207 Component->Key = 0;
208 Component->AffinityMask = 0;
209
210 IsNextEntryChild = TRUE;
211 PreviousEntry = ConfigurationRoot;
212
213 /* Enumerate all PCI buses */
214 AdapterEntry = ConfigurationRoot;
215
216 /* TODO: Disk Geometry */
217 /* TODO: Keyboard */
218
219 /* TODO: Serial port */
220
221 //Config->ConfigurationData = alloc(sizeof(CONFIGURATION_COMPONENT_DATA), EfiLoaderData);
222
223 /* Convert everything to VA */
224 ConvertConfigToVA(LoaderBlock->ConfigurationRoot);
225 LoaderBlock->ConfigurationRoot = PaToVa(LoaderBlock->ConfigurationRoot);
226 }
227
228
229 // Init "phase 0"
230 VOID
231 AllocateAndInitLPB(PLOADER_PARAMETER_BLOCK *OutLoaderBlock)
232 {
233 PLOADER_PARAMETER_BLOCK LoaderBlock;
234
235 /* Allocate and zero-init the LPB */
236 LoaderBlock = MmAllocateMemory(sizeof(LOADER_PARAMETER_BLOCK));
237 RtlZeroMemory(LoaderBlock, sizeof(LOADER_PARAMETER_BLOCK));
238
239 /* Init three critical lists, used right away */
240 InitializeListHead(&LoaderBlock->LoadOrderListHead);
241 InitializeListHead(&LoaderBlock->MemoryDescriptorListHead);
242 InitializeListHead(&LoaderBlock->BootDriverListHead);
243
244
245 *OutLoaderBlock = LoaderBlock;
246 }
247
248 // Init "phase 1"
249 VOID
250 WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock)
251 {
252 //CHAR Options[] = "/CRASHDEBUG /DEBUGPORT=COM1 /BAUDRATE=115200";
253 CHAR Options[] = "/NODEBUG";
254 CHAR SystemRoot[] = "\\WINNT";
255 CHAR HalPath[] = "\\";
256 CHAR ArcBoot[] = "multi(0)disk(0)rdisk(1)partition(1)";
257 CHAR ArcHal[] = "multi(0)disk(0)rdisk(1)partition(1)";
258
259 PLOADER_PARAMETER_EXTENSION Extension;
260
261 LoaderBlock->u.I386.CommonDataArea = NULL; // Force No ABIOS support
262
263 /* Fill Arc BootDevice */
264 LoaderBlock->ArcBootDeviceName = MmAllocateMemory(strlen(ArcBoot)+1);
265 strcpy(LoaderBlock->ArcBootDeviceName, ArcBoot);
266 LoaderBlock->ArcBootDeviceName = PaToVa(LoaderBlock->ArcBootDeviceName);
267
268 /* Fill Arc HalDevice */
269 LoaderBlock->ArcHalDeviceName = MmAllocateMemory(strlen(ArcHal)+1);
270 strcpy(LoaderBlock->ArcHalDeviceName, ArcHal);
271 LoaderBlock->ArcHalDeviceName = PaToVa(LoaderBlock->ArcHalDeviceName);
272
273 /* Fill SystemRoot */
274 LoaderBlock->NtBootPathName = MmAllocateMemory(strlen(SystemRoot)+1);
275 strcpy(LoaderBlock->NtBootPathName, SystemRoot);
276 LoaderBlock->NtBootPathName = PaToVa(LoaderBlock->NtBootPathName);
277
278 /* Fill NtHalPathName */
279 LoaderBlock->NtHalPathName = MmAllocateMemory(strlen(HalPath)+1);
280 strcpy(LoaderBlock->NtHalPathName, HalPath);
281 LoaderBlock->NtHalPathName = PaToVa(LoaderBlock->NtHalPathName);
282
283 /* Fill load options */
284 LoaderBlock->LoadOptions = MmAllocateMemory(strlen(Options)+1);
285 strcpy(LoaderBlock->LoadOptions, Options);
286 LoaderBlock->LoadOptions = PaToVa(LoaderBlock->LoadOptions);
287
288 /* Arc devices */
289 LoaderBlock->ArcDiskInformation = (PARC_DISK_INFORMATION)MmAllocateMemory(sizeof(ARC_DISK_INFORMATION));
290 InitializeListHead(&LoaderBlock->ArcDiskInformation->DiskSignatureListHead);
291 List_PaToVa(&LoaderBlock->ArcDiskInformation->DiskSignatureListHead);
292 LoaderBlock->ArcDiskInformation = PaToVa(LoaderBlock->ArcDiskInformation);
293
294 /* Alloc space for NLS (it will be converted to VA in WinLdrLoadNLS) */
295 LoaderBlock->NlsData = MmAllocateMemory(sizeof(NLS_DATA_BLOCK));
296 if (LoaderBlock->NlsData == NULL)
297 {
298 UiMessageBox("Failed to allocate memory for NLS table data!");
299 return;
300 }
301 RtlZeroMemory(LoaderBlock->NlsData, sizeof(NLS_DATA_BLOCK));
302
303 /* Create configuration entries */
304 InitializeHWConfig(LoaderBlock);
305
306 /* Convert all DTE into virtual addresses */
307 //TODO: !!!
308
309 /* Convert all list's to Virtual address */
310 List_PaToVa(&LoaderBlock->LoadOrderListHead);
311
312 /* this one will be converted right before switching to
313 virtual paging mode */
314 //List_PaToVa(&LoaderBlock->MemoryDescriptorListHead);
315
316 List_PaToVa(&LoaderBlock->BootDriverListHead);
317
318 /* Initialize Extension now */
319 Extension = MmAllocateMemory(sizeof(LOADER_PARAMETER_EXTENSION));
320 if (Extension == NULL)
321 {
322 UiMessageBox("Failed to allocate LPB Extension!");
323 return;
324 }
325 RtlZeroMemory(Extension, sizeof(LOADER_PARAMETER_EXTENSION));
326
327 Extension->Size = sizeof(LOADER_PARAMETER_EXTENSION);
328 Extension->MajorVersion = 4;
329 Extension->MinorVersion = 0;
330
331
332 LoaderBlock->Extension = PaToVa(Extension);
333 }
334
335 // Last step before going virtual
336 void WinLdrSetupForNt(PLOADER_PARAMETER_BLOCK LoaderBlock,
337 PVOID *GdtIdt,
338 ULONG *PcrBasePage,
339 ULONG *TssBasePage)
340 {
341 ULONG TssSize;
342 ULONG TssPages;
343 ULONG_PTR Pcr = 0;
344 ULONG_PTR Tss = 0;
345 ULONG BlockSize, NumPages;
346
347 LoaderBlock->u.I386.CommonDataArea = NULL;//CommonDataArea;
348 //LoaderBlock->u.I386.MachineType = MachineType; //FIXME: MachineType?
349
350 /* Allocate 2 pages for PCR */
351 Pcr = (ULONG_PTR)MmAllocateMemory(2 * MM_PAGE_SIZE);
352 *PcrBasePage = Pcr >> MM_PAGE_SHIFT;
353
354 if (Pcr == 0)
355 {
356 UiMessageBox("Can't allocate PCR\n");
357 return;
358 }
359
360 /* Allocate TSS */
361 TssSize = (sizeof(KTSS) + MM_PAGE_SIZE) & ~(MM_PAGE_SIZE - 1);
362 TssPages = TssSize / MM_PAGE_SIZE;
363
364 Tss = (ULONG_PTR)MmAllocateMemory(TssSize);
365
366 *TssBasePage = Tss >> MM_PAGE_SHIFT;
367
368 /* Allocate space for new GDT + IDT */
369 BlockSize = NUM_GDT*sizeof(KGDTENTRY) + NUM_IDT*sizeof(KIDTENTRY);//FIXME: Use GDT/IDT limits here?
370 NumPages = (BlockSize + MM_PAGE_SIZE - 1) >> MM_PAGE_SHIFT;
371 *GdtIdt = (PKGDTENTRY)MmAllocateMemory(NumPages * MM_PAGE_SIZE);
372
373 if (*GdtIdt == NULL)
374 {
375 UiMessageBox("Can't allocate pages for GDT+IDT!\n");
376 return;
377 }
378
379 /* Zero newly prepared GDT+IDT */
380 RtlZeroMemory(*GdtIdt, NumPages << MM_PAGE_SHIFT);
381 }
382
383 VOID
384 LoadAndBootWindows(PCSTR OperatingSystemName, WORD OperatingSystemVersion)
385 {
386 CHAR MsgBuffer[256];
387 CHAR SystemPath[1024], SearchPath[1024];
388 CHAR FileName[1024];
389 CHAR BootPath[256];
390 PVOID NtosBase = NULL, HalBase = NULL, KdComBase = NULL;
391 BOOLEAN Status;
392 ULONG SectionId;
393 ULONG BootDevice;
394 PLOADER_PARAMETER_BLOCK LoaderBlock, LoaderBlockVA;
395 KERNEL_ENTRY_POINT KiSystemStartup;
396 PLDR_DATA_TABLE_ENTRY KernelDTE, HalDTE, KdComDTE;
397 // Mm-related things
398 PVOID GdtIdt;
399 ULONG PcrBasePage=0;
400 ULONG TssBasePage=0;
401
402
403
404 //sprintf(MsgBuffer,"Booting Microsoft(R) Windows(R) OS version '%04x' is not implemented yet", OperatingSystemVersion);
405 //UiMessageBox(MsgBuffer);
406
407 // Open the operating system section
408 // specified in the .ini file
409 if (!IniOpenSection(OperatingSystemName, &SectionId))
410 {
411 sprintf(MsgBuffer,"Operating System section '%s' not found in freeldr.ini", OperatingSystemName);
412 UiMessageBox(MsgBuffer);
413 return;
414 }
415
416 /* Make sure the system path is set in the .ini file */
417 if (!IniReadSettingByName(SectionId, "SystemPath", SystemPath, sizeof(SystemPath)))
418 {
419 UiMessageBox("System path not specified for selected operating system.");
420 return;
421 }
422
423 if (!MachDiskNormalizeSystemPath(SystemPath,
424 sizeof(SystemPath)))
425 {
426 UiMessageBox("Invalid system path");
427 return;
428 }
429
430 UiDrawStatusText("Loading...");
431
432 /* Try to open system drive */
433 BootDevice = 0xffffffff;
434 if (!FsOpenSystemVolume(SystemPath, BootPath, &BootDevice))
435 {
436 UiMessageBox("Failed to open boot drive.");
437 return;
438 }
439
440 /* append a backslash */
441 if ((strlen(BootPath)==0) ||
442 BootPath[strlen(BootPath)] != '\\')
443 strcat(BootPath, "\\");
444
445 DbgPrint((DPRINT_WINDOWS,"SystemRoot: '%s'\n", BootPath));
446
447 // Allocate and minimalistic-initialize LPB
448 AllocateAndInitLPB(&LoaderBlock);
449
450 // Load kernel
451 strcpy(FileName, BootPath);
452 strcat(FileName, "SYSTEM32\\NTOSKRNL.EXE");
453 Status = WinLdrLoadImage(FileName, &NtosBase);
454 DbgPrint((DPRINT_WINDOWS, "Ntos loaded with status %d at %p\n", Status, NtosBase));
455
456 // Load HAL
457 strcpy(FileName, BootPath);
458 strcat(FileName, "SYSTEM32\\HAL.DLL");
459 Status = WinLdrLoadImage(FileName, &HalBase);
460 DbgPrint((DPRINT_WINDOWS, "HAL loaded with status %d at %p\n", Status, HalBase));
461
462 // Load kernel-debugger support dll
463 if (OperatingSystemVersion > _WIN32_WINNT_NT4)
464 {
465 strcpy(FileName, BootPath);
466 strcat(FileName, "SYSTEM32\\KDCOM.DLL");
467 Status = WinLdrLoadImage(FileName, &KdComBase);
468 DbgPrint((DPRINT_WINDOWS, "KdCom loaded with status %d at %p\n", Status, KdComBase));
469 }
470
471 // Allocate data table entries for above-loaded modules
472 WinLdrAllocateDataTableEntry(LoaderBlock, "ntoskrnl.exe",
473 "WINNT\\SYSTEM32\\NTOSKRNL.EXE", NtosBase, &KernelDTE);
474 WinLdrAllocateDataTableEntry(LoaderBlock, "hal.dll",
475 "WINNT\\SYSTEM32\\HAL.DLL", HalBase, &HalDTE);
476 if (OperatingSystemVersion > _WIN32_WINNT_NT4)
477 {
478 WinLdrAllocateDataTableEntry(LoaderBlock, "kdcom.dll",
479 "WINNT\\SYSTEM32\\KDCOM.DLL", KdComBase, &KdComDTE);
480 }
481
482 /* Load all referenced DLLs for kernel, HAL and kdcom.dll */
483 strcpy(SearchPath, BootPath);
484 strcat(SearchPath, "SYSTEM32\\");
485 WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, KernelDTE);
486 WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, HalDTE);
487 if (KdComDTE)
488 WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, KdComDTE);
489
490 /* Initialize Phase 1 - before NLS */
491 WinLdrInitializePhase1(LoaderBlock);
492
493 /* Load Hive, and then NLS data, OEM font, and prepare boot drivers list */
494 Status = WinLdrLoadAndScanSystemHive(LoaderBlock, BootPath);
495 DbgPrint((DPRINT_WINDOWS, "SYSTEM hive loaded and scanned with status %d\n", Status));
496
497 /* FIXME: Load NLS data, should be moved to WinLdrLoadAndScanSystemHive() */
498 strcpy(SearchPath, BootPath);
499 strcat(SearchPath, "SYSTEM32\\");
500 Status = WinLdrLoadNLSData(LoaderBlock, SearchPath,
501 "c_1252.nls", "c_437.nls", "l_intl.nls");
502 DbgPrint((DPRINT_WINDOWS, "NLS data loaded with status %d\n", Status));
503
504 /* FIXME: Load OEM HAL font, should be moved to WinLdrLoadAndScanSystemHive() */
505
506 /* Load boot drivers */
507 //WinLdrLoadBootDrivers();
508
509 /* Alloc PCR, TSS, do magic things with the GDT/IDT */
510 WinLdrSetupForNt(LoaderBlock, &GdtIdt, &PcrBasePage, &TssBasePage);
511
512 /* Save entry-point pointer (VA) */
513 KiSystemStartup = (KERNEL_ENTRY_POINT)KernelDTE->EntryPoint;
514
515 LoaderBlockVA = PaToVa(LoaderBlock);
516
517 /* Debugging... */
518 //DumpMemoryAllocMap();
519
520 /* Turn on paging mode of CPU*/
521 WinLdrTurnOnPaging(LoaderBlock, PcrBasePage, TssBasePage, GdtIdt);
522
523 DbgPrint((DPRINT_WINDOWS, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
524 KiSystemStartup, LoaderBlockVA));
525
526 WinLdrpDumpMemoryDescriptors(LoaderBlockVA);
527
528 //FIXME: If I substitute this debugging checkpoint, GCC will "optimize away" the code below
529 //while (1) {};
530 /*asm(".intel_syntax noprefix\n");
531 asm("test1:\n");
532 asm("jmp test1\n");
533 asm(".att_syntax\n");*/
534
535
536 (*KiSystemStartup)(LoaderBlockVA);
537
538 return;
539 }
540
541 VOID
542 WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock)
543 {
544 PLIST_ENTRY NextMd;
545 PMEMORY_ALLOCATION_DESCRIPTOR MemoryDescriptor;
546
547 NextMd = LoaderBlock->MemoryDescriptorListHead.Flink;
548
549 while (NextMd != &LoaderBlock->MemoryDescriptorListHead)
550 {
551 MemoryDescriptor = CONTAINING_RECORD(NextMd, MEMORY_ALLOCATION_DESCRIPTOR, ListEntry);
552
553
554 DbgPrint((DPRINT_WINDOWS, "BP %08X PC %04X MT %d\n", MemoryDescriptor->BasePage,
555 MemoryDescriptor->PageCount, MemoryDescriptor->MemoryType));
556
557 NextMd = MemoryDescriptor->ListEntry.Flink;
558 }
559 }