Remove double brackets, I missed. Add a DPRINT1 if kernel is not loaded.

svn path=/branches/ros-amd64-bringup/; revision=38951
This commit is contained in:
Timo Kreuzer
2009-01-19 18:50:19 +00:00
parent 74bcfdb123
commit da6a9dbfe5
10 changed files with 208 additions and 204 deletions
@@ -288,11 +288,11 @@ XboxDiskPolledRead(ULONG CommandPort,
}
StallExecutionProcessor(10);
}
DPRINTM((DPRINT_DISK, "status=0x%x\n", Status));
DPRINTM((DPRINT_DISK, "waited %d usecs for busy to clear\n", RetryCount * 10));
DPRINTM(DPRINT_DISK, "status=0x%x\n", Status);
DPRINTM(DPRINT_DISK, "waited %d usecs for busy to clear\n", RetryCount * 10);
if (RetryCount >= IDE_MAX_BUSY_RETRIES)
{
DPRINTM((DPRINT_DISK, "Drive is BUSY for too long\n"));
DPRINTM(DPRINT_DISK, "Drive is BUSY for too long\n");
return FALSE;
}
@@ -307,22 +307,22 @@ XboxDiskPolledRead(ULONG CommandPort,
/* Issue command to drive */
if (DrvHead & IDE_DH_LBA)
{
DPRINTM((DPRINT_DISK, "READ:DRV=%d:LBA=1:BLK=%d:SC=0x%x:CM=0x%x\n",
DPRINTM(DPRINT_DISK, "READ:DRV=%d:LBA=1:BLK=%d:SC=0x%x:CM=0x%x\n",
DrvHead & IDE_DH_DRV1 ? 1 : 0,
((DrvHead & 0x0f) << 24) + (CylinderHigh << 16) + (CylinderLow << 8) + SectorNum,
SectorCnt,
Command));
Command);
}
else
{
DPRINTM((DPRINT_DISK, "READ:DRV=%d:LBA=0:CH=0x%x:CL=0x%x:HD=0x%x:SN=0x%x:SC=0x%x:CM=0x%x\n",
DPRINTM(DPRINT_DISK, "READ:DRV=%d:LBA=0:CH=0x%x:CL=0x%x:HD=0x%x:SN=0x%x:SC=0x%x:CM=0x%x\n",
DrvHead & IDE_DH_DRV1 ? 1 : 0,
CylinderHigh,
CylinderLow,
DrvHead & 0x0f,
SectorNum,
SectorCnt,
Command));
Command);
}
/* Setup command parameters */
@@ -411,7 +411,7 @@ XboxDiskPolledRead(ULONG CommandPort,
{
if (SectorCount >= SectorCnt)
{
DPRINTM((DPRINT_DISK, "Buffer size exceeded!\n"));
DPRINTM(DPRINT_DISK, "Buffer size exceeded!\n");
Junk = TRUE;
}
break;
@@ -420,8 +420,8 @@ XboxDiskPolledRead(ULONG CommandPort,
{
if (SectorCount > SectorCnt)
{
DPRINTM((DPRINT_DISK, "Read %lu sectors of junk!\n",
SectorCount - SectorCnt));
DPRINTM(DPRINT_DISK, "Read %lu sectors of junk!\n",
SectorCount - SectorCnt);
}
IDEWriteDriveControl(ControlPort, 0);
StallExecutionProcessor(50);
@@ -443,13 +443,13 @@ XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG Sect
if (DriveNumber < 0x80 || 2 <= (DriveNumber & 0x0f))
{
/* Xbox has only 1 IDE controller and no floppy */
DPRINTM((DPRINT_DISK, "Invalid drive number\n"));
DPRINTM(DPRINT_DISK, "Invalid drive number\n");
return FALSE;
}
if (UINT64_C(0) != ((SectorNumber + SectorCount) & UINT64_C(0xfffffffff0000000)))
{
DPRINTM((DPRINT_DISK, "48bit LBA required but not implemented\n"));
DPRINTM(DPRINT_DISK, "48bit LBA required but not implemented\n");
return FALSE;
}
@@ -522,7 +522,7 @@ XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry)
(Atapi ? IDE_CMD_IDENT_ATAPI_DRV : IDE_CMD_IDENT_ATA_DRV),
(PUCHAR) &DrvParms))
{
DPRINTM((DPRINT_DISK, "XboxDiskPolledRead() failed\n"));
DPRINTM(DPRINT_DISK, "XboxDiskPolledRead() failed\n");
return FALSE;
}
@@ -537,7 +537,7 @@ XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry)
}
else
{
DPRINTM((DPRINT_DISK, "BytesPerSector %d\n", DrvParms.BytesPerSector));
DPRINTM(DPRINT_DISK, "BytesPerSector %d\n", DrvParms.BytesPerSector);
if (DrvParms.BytesPerSector == 0)
{
Geometry->BytesPerSector = 512;
@@ -554,10 +554,10 @@ XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry)
}
}
}
DPRINTM((DPRINT_DISK, "Cylinders %d\n", Geometry->Cylinders));
DPRINTM((DPRINT_DISK, "Heads %d\n", Geometry->Heads));
DPRINTM((DPRINT_DISK, "Sectors %d\n", Geometry->Sectors));
DPRINTM((DPRINT_DISK, "BytesPerSector %d\n", Geometry->BytesPerSector));
DPRINTM(DPRINT_DISK, "Cylinders %d\n", Geometry->Cylinders);
DPRINTM(DPRINT_DISK, "Heads %d\n", Geometry->Heads);
DPRINTM(DPRINT_DISK, "Sectors %d\n", Geometry->Sectors);
DPRINTM(DPRINT_DISK, "BytesPerSector %d\n", Geometry->BytesPerSector);
return TRUE;
}
+22 -22
View File
@@ -45,8 +45,8 @@ SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM((DPRINT_HWDETECT,
"Failed to allocate a full resource descriptor\n"));
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate a full resource descriptor\n");
return;
}
@@ -76,17 +76,17 @@ SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey,
}
else
{
DPRINTM((DPRINT_HWDETECT, "Reading disk geometry failed\n"));
DPRINTM(DPRINT_HWDETECT, "Reading disk geometry failed\n");
MmHeapFree(PartialResourceList);
return;
}
DPRINTM((DPRINT_HWDETECT,
DPRINTM(DPRINT_HWDETECT,
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
DriveNumber,
DiskGeometry->NumberOfCylinders,
DiskGeometry->NumberOfHeads,
DiskGeometry->SectorsPerTrack,
DiskGeometry->BytesPerSector));
DiskGeometry->BytesPerSector);
FldrSetConfigurationData(DiskKey, PartialResourceList, Size);
MmHeapFree(PartialResourceList);
@@ -108,7 +108,7 @@ SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey,
/* Read the MBR */
if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, (PVOID)DISKREADBUFFER))
{
DPRINTM((DPRINT_HWDETECT, "Reading MBR failed\n"));
DPRINTM(DPRINT_HWDETECT, "Reading MBR failed\n");
return;
}
@@ -116,7 +116,7 @@ SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey,
Mbr = (PMASTER_BOOT_RECORD)DISKREADBUFFER;
Signature = Mbr->Signature;
DPRINTM((DPRINT_HWDETECT, "Signature: %x\n", Signature));
DPRINTM(DPRINT_HWDETECT, "Signature: %x\n", Signature);
/* Calculate the MBR checksum */
Checksum = 0;
@@ -125,7 +125,7 @@ SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey,
Checksum += Buffer[i];
}
Checksum = ~Checksum + 1;
DPRINTM((DPRINT_HWDETECT, "Checksum: %x\n", Checksum));
DPRINTM(DPRINT_HWDETECT, "Checksum: %x\n", Checksum);
/* Fill out the ARC disk block */
reactos_arc_disk_info[reactos_disk_count].Signature = Signature;
@@ -157,7 +157,7 @@ SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey,
Identifier[17] = '-';
Identifier[18] = 'A';
Identifier[19] = 0;
DPRINTM((DPRINT_HWDETECT, "Identifier: %s\n", Identifier));
DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier);
/* Set identifier */
FldrSetIdentifier(DiskKey, Identifier);
@@ -195,16 +195,16 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
}
if (! Changed)
{
DPRINTM((DPRINT_HWDETECT, "BIOS reports success for disk %d but data didn't change\n",
(int)DiskCount));
DPRINTM(DPRINT_HWDETECT, "BIOS reports success for disk %d but data didn't change\n",
(int)DiskCount);
break;
}
DiskCount++;
memset((PVOID) DISKREADBUFFER, 0xcd, 512);
}
DiskReportError(TRUE);
DPRINTM((DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
(int)DiskCount, (DiskCount == 1) ? "": "s"));
DPRINTM(DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
(int)DiskCount, (DiskCount == 1) ? "": "s");
FldrCreateComponentKey(BusKey,
L"DiskController",
@@ -212,7 +212,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
ControllerClass,
DiskController,
&ControllerKey);
DPRINTM((DPRINT_HWDETECT, "Created key: DiskController\\0\n"));
DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
/* Set 'ComponentInformation' value */
FldrSetComponentInformation(ControllerKey,
@@ -228,8 +228,8 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM((DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n"));
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
return;
}
@@ -256,13 +256,13 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
Int13Drives[i].MaxHeads = Geometry.Heads - 1;
Int13Drives[i].NumberDrives = DiskCount;
DPRINTM((DPRINT_HWDETECT,
DPRINTM(DPRINT_HWDETECT,
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
0x80 + i,
Geometry.Cylinders - 1,
Geometry.Heads -1,
Geometry.Sectors,
Geometry.BytesPerSector));
Geometry.BytesPerSector);
}
}
@@ -326,8 +326,8 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM((DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n"));
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
return;
}
@@ -355,7 +355,7 @@ XboxHwDetect(VOID)
PCONFIGURATION_COMPONENT_DATA SystemKey;
ULONG BusNumber = 0;
DPRINTM((DPRINT_HWDETECT, "DetectHardware()\n"));
DPRINTM(DPRINT_HWDETECT, "DetectHardware()\n");
/* Create the 'System' key */
FldrCreateSystemKey(&SystemKey);
@@ -369,7 +369,7 @@ XboxHwDetect(VOID)
/* TODO: Build actual xbox's hardware configuration tree */
DetectIsaBios(SystemKey, &BusNumber);
DPRINTM((DPRINT_HWDETECT, "DetectHardware() Done\n"));
DPRINTM(DPRINT_HWDETECT, "DetectHardware() Done\n");
return SystemKey;
}
+3 -3
View File
@@ -96,19 +96,19 @@ VOID DriveMapMapDrivesInSection(PCSTR SectionName)
DriveMapList.DriveMap[(DriveMapList.DriveMapCount * 2)+1] = DriveMapGetBiosDriveNumber(Drive2);
DriveMapList.DriveMapCount++;
DPRINTM((DPRINT_WARNING, "Mapping BIOS drive 0x%x to drive 0x%x\n", DriveMapGetBiosDriveNumber(Drive1), DriveMapGetBiosDriveNumber(Drive2)));
DPRINTM(DPRINT_WARNING, "Mapping BIOS drive 0x%x to drive 0x%x\n", DriveMapGetBiosDriveNumber(Drive1), DriveMapGetBiosDriveNumber(Drive2));
}
}
}
if (DriveMapList.DriveMapCount)
{
DPRINTM((DPRINT_WARNING, "Installing Int13 drive map for %d drives.\n", DriveMapList.DriveMapCount));
DPRINTM(DPRINT_WARNING, "Installing Int13 drive map for %d drives.\n", DriveMapList.DriveMapCount);
DriveMapInstallInt13Handler(&DriveMapList);
}
else
{
DPRINTM((DPRINT_WARNING, "Removing any previously installed Int13 drive map.\n"));
DPRINTM(DPRINT_WARNING, "Removing any previously installed Int13 drive map.\n");
DriveMapRemoveInt13Handler();
}
}
+26 -26
View File
@@ -286,14 +286,14 @@ BOOLEAN LinuxReadBootSector(PFILE LinuxKernelFile)
DbgDumpBuffer(DPRINT_LINUX, LinuxBootSector, 512);
DPRINTM((DPRINT_LINUX, "SetupSectors: %d\n", LinuxBootSector->SetupSectors));
DPRINTM((DPRINT_LINUX, "RootFlags: 0x%x\n", LinuxBootSector->RootFlags));
DPRINTM((DPRINT_LINUX, "SystemSize: 0x%x\n", LinuxBootSector->SystemSize));
DPRINTM((DPRINT_LINUX, "SwapDevice: 0x%x\n", LinuxBootSector->SwapDevice));
DPRINTM((DPRINT_LINUX, "RamSize: 0x%x\n", LinuxBootSector->RamSize));
DPRINTM((DPRINT_LINUX, "VideoMode: 0x%x\n", LinuxBootSector->VideoMode));
DPRINTM((DPRINT_LINUX, "RootDevice: 0x%x\n", LinuxBootSector->RootDevice));
DPRINTM((DPRINT_LINUX, "BootFlag: 0x%x\n", LinuxBootSector->BootFlag));
DPRINTM(DPRINT_LINUX, "SetupSectors: %d\n", LinuxBootSector->SetupSectors);
DPRINTM(DPRINT_LINUX, "RootFlags: 0x%x\n", LinuxBootSector->RootFlags);
DPRINTM(DPRINT_LINUX, "SystemSize: 0x%x\n", LinuxBootSector->SystemSize);
DPRINTM(DPRINT_LINUX, "SwapDevice: 0x%x\n", LinuxBootSector->SwapDevice);
DPRINTM(DPRINT_LINUX, "RamSize: 0x%x\n", LinuxBootSector->RamSize);
DPRINTM(DPRINT_LINUX, "VideoMode: 0x%x\n", LinuxBootSector->VideoMode);
DPRINTM(DPRINT_LINUX, "RootDevice: 0x%x\n", LinuxBootSector->RootDevice);
DPRINTM(DPRINT_LINUX, "BootFlag: 0x%x\n", LinuxBootSector->BootFlag);
return TRUE;
}
@@ -345,21 +345,21 @@ BOOLEAN LinuxReadSetupSector(PFILE LinuxKernelFile)
DbgDumpBuffer(DPRINT_LINUX, LinuxSetupSector, SetupSectorSize);
DPRINTM((DPRINT_LINUX, "SetupHeaderSignature: 0x%x (HdrS)\n", LinuxSetupSector->SetupHeaderSignature));
DPRINTM((DPRINT_LINUX, "Version: 0x%x\n", LinuxSetupSector->Version));
DPRINTM((DPRINT_LINUX, "RealModeSwitch: 0x%x\n", LinuxSetupSector->RealModeSwitch));
DPRINTM((DPRINT_LINUX, "SetupSeg: 0x%x\n", LinuxSetupSector->SetupSeg));
DPRINTM((DPRINT_LINUX, "StartSystemSeg: 0x%x\n", LinuxSetupSector->StartSystemSeg));
DPRINTM((DPRINT_LINUX, "KernelVersion: 0x%x\n", LinuxSetupSector->KernelVersion));
DPRINTM((DPRINT_LINUX, "TypeOfLoader: 0x%x\n", LinuxSetupSector->TypeOfLoader));
DPRINTM((DPRINT_LINUX, "LoadFlags: 0x%x\n", LinuxSetupSector->LoadFlags));
DPRINTM((DPRINT_LINUX, "SetupMoveSize: 0x%x\n", LinuxSetupSector->SetupMoveSize));
DPRINTM((DPRINT_LINUX, "Code32Start: 0x%x\n", LinuxSetupSector->Code32Start));
DPRINTM((DPRINT_LINUX, "RamdiskAddress: 0x%x\n", LinuxSetupSector->RamdiskAddress));
DPRINTM((DPRINT_LINUX, "RamdiskSize: 0x%x\n", LinuxSetupSector->RamdiskSize));
DPRINTM((DPRINT_LINUX, "BootSectKludgeOffset: 0x%x\n", LinuxSetupSector->BootSectKludgeOffset));
DPRINTM((DPRINT_LINUX, "BootSectKludgeSegment: 0x%x\n", LinuxSetupSector->BootSectKludgeSegment));
DPRINTM((DPRINT_LINUX, "HeapEnd: 0x%x\n", LinuxSetupSector->HeapEnd));
DPRINTM(DPRINT_LINUX, "SetupHeaderSignature: 0x%x (HdrS)\n", LinuxSetupSector->SetupHeaderSignature);
DPRINTM(DPRINT_LINUX, "Version: 0x%x\n", LinuxSetupSector->Version);
DPRINTM(DPRINT_LINUX, "RealModeSwitch: 0x%x\n", LinuxSetupSector->RealModeSwitch);
DPRINTM(DPRINT_LINUX, "SetupSeg: 0x%x\n", LinuxSetupSector->SetupSeg);
DPRINTM(DPRINT_LINUX, "StartSystemSeg: 0x%x\n", LinuxSetupSector->StartSystemSeg);
DPRINTM(DPRINT_LINUX, "KernelVersion: 0x%x\n", LinuxSetupSector->KernelVersion);
DPRINTM(DPRINT_LINUX, "TypeOfLoader: 0x%x\n", LinuxSetupSector->TypeOfLoader);
DPRINTM(DPRINT_LINUX, "LoadFlags: 0x%x\n", LinuxSetupSector->LoadFlags);
DPRINTM(DPRINT_LINUX, "SetupMoveSize: 0x%x\n", LinuxSetupSector->SetupMoveSize);
DPRINTM(DPRINT_LINUX, "Code32Start: 0x%x\n", LinuxSetupSector->Code32Start);
DPRINTM(DPRINT_LINUX, "RamdiskAddress: 0x%x\n", LinuxSetupSector->RamdiskAddress);
DPRINTM(DPRINT_LINUX, "RamdiskSize: 0x%x\n", LinuxSetupSector->RamdiskSize);
DPRINTM(DPRINT_LINUX, "BootSectKludgeOffset: 0x%x\n", LinuxSetupSector->BootSectKludgeOffset);
DPRINTM(DPRINT_LINUX, "BootSectKludgeSegment: 0x%x\n", LinuxSetupSector->BootSectKludgeSegment);
DPRINTM(DPRINT_LINUX, "HeapEnd: 0x%x\n", LinuxSetupSector->HeapEnd);
return TRUE;
}
@@ -466,12 +466,12 @@ BOOLEAN LinuxReadInitrd(PFILE LinuxInitrdFile)
LinuxSetupSector->RamdiskAddress = (ULONG)LinuxInitrdLoadAddress;
LinuxSetupSector->RamdiskSize = LinuxInitrdSize;
DPRINTM((DPRINT_LINUX, "RamdiskAddress: 0x%x\n", LinuxSetupSector->RamdiskAddress));
DPRINTM((DPRINT_LINUX, "RamdiskSize: 0x%x\n", LinuxSetupSector->RamdiskSize));
DPRINTM(DPRINT_LINUX, "RamdiskAddress: 0x%x\n", LinuxSetupSector->RamdiskAddress);
DPRINTM(DPRINT_LINUX, "RamdiskSize: 0x%x\n", LinuxSetupSector->RamdiskSize);
if (LinuxSetupSector->Version >= 0x0203)
{
DPRINTM((DPRINT_LINUX, "InitrdAddressMax: 0x%x\n", LinuxSetupSector->InitrdAddressMax));
DPRINTM(DPRINT_LINUX, "InitrdAddressMax: 0x%x\n", LinuxSetupSector->InitrdAddressMax);
}
// Read in the ramdisk
@@ -185,7 +185,11 @@ VOID RunLoader(VOID)
/* Load the kernel */
LoadBase = FrLdrLoadImage(FileName, 5, 1);
if (!LoadBase) return;
if (!LoadBase)
{
DPRINT1("Loading the kernel failed!\n");
return;
}
/* Get the NT header, kernel base and kernel entry */
NtHeader = RtlImageNtHeader(LoadBase);
@@ -70,7 +70,7 @@ ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
PCONFIGURATION_COMPONENT_DATA Child;
PCONFIGURATION_COMPONENT_DATA Sibling;
DPRINTM((DPRINT_WINDOWS, "ConvertConfigToVA(Start 0x%X)\n", Start));
DPRINTM(DPRINT_WINDOWS, "ConvertConfigToVA(Start 0x%X)\n", Start);
Child = Start;
while (Child != NULL)
@@ -90,8 +90,8 @@ ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
if (Child->ComponentEntry.Identifier)
Child->ComponentEntry.Identifier = PaToVa(Child->ComponentEntry.Identifier);
DPRINTM((DPRINT_WINDOWS, "Device 0x%X class %d type %d id '%s', parent %p\n", Child,
Child->ComponentEntry.Class, Child->ComponentEntry.Type, VaToPa(Child->ComponentEntry.Identifier), Child->Parent));
DPRINTM(DPRINT_WINDOWS, "Device 0x%X class %d type %d id '%s', parent %p\n", Child,
Child->ComponentEntry.Class, Child->ComponentEntry.Type, VaToPa(Child->ComponentEntry.Identifier), Child->Parent);
// Go through siblings list
Sibling = VaToPa(Child->Sibling);
@@ -112,8 +112,8 @@ ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
if (Sibling->ComponentEntry.Identifier)
Sibling->ComponentEntry.Identifier = PaToVa(Sibling->ComponentEntry.Identifier);
DPRINTM((DPRINT_WINDOWS, "Device 0x%X class %d type %d id '%s', parent %p\n", Sibling,
Sibling->ComponentEntry.Class, Sibling->ComponentEntry.Type, VaToPa(Sibling->ComponentEntry.Identifier), Sibling->Parent));
DPRINTM(DPRINT_WINDOWS, "Device 0x%X class %d type %d id '%s', parent %p\n", Sibling,
Sibling->ComponentEntry.Class, Sibling->ComponentEntry.Type, VaToPa(Sibling->ComponentEntry.Identifier), Sibling->Parent);
// Recurse into the Child tree
if (VaToPa(Sibling->Child) != NULL)
+48 -48
View File
@@ -56,8 +56,8 @@ WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
PLDR_DATA_TABLE_ENTRY DataTableEntry;
LIST_ENTRY *ModuleEntry;
DPRINTM((DPRINT_WINDOWS, "WinLdrCheckForLoadedDll: DllName %X, LoadedEntry: %X\n",
DllName, LoadedEntry));
DPRINTM(DPRINT_WINDOWS, "WinLdrCheckForLoadedDll: DllName %X, LoadedEntry: %X\n",
DllName, LoadedEntry);
/* Just go through each entry in the LoadOrderList and compare loaded module's
name with a given name */
@@ -69,8 +69,8 @@ WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
LDR_DATA_TABLE_ENTRY,
InLoadOrderLinks);
DPRINTM((DPRINT_WINDOWS, "WinLdrCheckForLoadedDll: DTE %p, EP %p\n",
DataTableEntry, DataTableEntry->EntryPoint));
DPRINTM(DPRINT_WINDOWS, "WinLdrCheckForLoadedDll: DTE %p, EP %p\n",
DataTableEntry, DataTableEntry->EntryPoint);
/* Compare names */
if (WinLdrpCompareDllName(DllName, &DataTableEntry->BaseDllName))
@@ -79,7 +79,7 @@ WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
to the caller and increase load count for it */
*LoadedEntry = DataTableEntry;
DataTableEntry->LoadCount++;
DPRINTM((DPRINT_WINDOWS, "WinLdrCheckForLoadedDll: LoadedEntry %X\n", DataTableEntry));
DPRINTM(DPRINT_WINDOWS, "WinLdrCheckForLoadedDll: LoadedEntry %X\n", DataTableEntry);
return TRUE;
}
@@ -111,8 +111,8 @@ WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
BaseName.Buffer = VaToPa(ScanDTE->BaseDllName.Buffer);
BaseName.MaximumLength = ScanDTE->BaseDllName.MaximumLength;
BaseName.Length = ScanDTE->BaseDllName.Length;
DPRINTM((DPRINT_WINDOWS, "WinLdrScanImportDescriptorTable(): %wZ ImportTable = 0x%X\n",
&BaseName, ImportTable));
DPRINTM(DPRINT_WINDOWS, "WinLdrScanImportDescriptorTable(): %wZ ImportTable = 0x%X\n",
&BaseName, ImportTable);
}
/* If image doesn't have any import directory - just return success */
@@ -124,7 +124,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
{
/* Get pointer to the name */
ImportName = (PCH)VaToPa(RVA(ScanDTE->DllBase, ImportTable->Name));
DPRINTM((DPRINT_WINDOWS, "WinLdrScanImportDescriptorTable(): Looking at %s\n", ImportName));
DPRINTM(DPRINT_WINDOWS, "WinLdrScanImportDescriptorTable(): Looking at %s\n", ImportName);
/* In case we get a reference to ourselves - just skip it */
if (WinLdrpCompareDllName(ImportName, &ScanDTE->BaseDllName))
@@ -140,7 +140,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (!Status)
{
DPRINTM((DPRINT_WINDOWS, "WinLdrpLoadAndScanReferencedDll() failed\n"));
DPRINTM(DPRINT_WINDOWS, "WinLdrpLoadAndScanReferencedDll() failed\n");
return Status;
}
}
@@ -154,7 +154,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (!Status)
{
DPRINTM((DPRINT_WINDOWS, "WinLdrpScanImportAddressTable() failed\n"));
DPRINTM(DPRINT_WINDOWS, "WinLdrpScanImportAddressTable() failed\n");
return Status;
}
}
@@ -337,7 +337,7 @@ WinLdrLoadImage(IN PCHAR FileName,
/* This is the real image base - in form of a virtual address */
VirtualBase = PaToVa(PhysicalBase);
DPRINTM((DPRINT_WINDOWS, "Base PA: 0x%X, VA: 0x%X\n", PhysicalBase, VirtualBase));
DPRINTM(DPRINT_WINDOWS, "Base PA: 0x%X, VA: 0x%X\n", PhysicalBase, VirtualBase);
/* Set to 0 position and fully load the file image */
FsSetFilePointer(FileHandle, 0);
@@ -390,14 +390,14 @@ WinLdrLoadImage(IN PCHAR FileName,
/* Seek to the correct position */
FsSetFilePointer(FileHandle, SectionHeader->PointerToRawData);
DPRINTM((DPRINT_WINDOWS, "SH->VA: 0x%X\n", SectionHeader->VirtualAddress));
DPRINTM(DPRINT_WINDOWS, "SH->VA: 0x%X\n", SectionHeader->VirtualAddress);
/* Read this section from the file, size = SizeOfRawData */
Status = FsReadFile(FileHandle, SizeOfRawData, &BytesRead, (PUCHAR)PhysicalBase + SectionHeader->VirtualAddress);
if (!Status && (BytesRead == 0))
{
DPRINTM((DPRINT_WINDOWS, "WinLdrLoadImage(): Error reading section from file!\n"));
DPRINTM(DPRINT_WINDOWS, "WinLdrLoadImage(): Error reading section from file!\n");
break;
}
}
@@ -405,7 +405,7 @@ WinLdrLoadImage(IN PCHAR FileName,
/* Size of data is less than the virtual size - fill up the remainder with zeroes */
if (SizeOfRawData < VirtualSize)
{
DPRINTM((DPRINT_WINDOWS, "WinLdrLoadImage(): SORD %d < VS %d\n", SizeOfRawData, VirtualSize));
DPRINTM(DPRINT_WINDOWS, "WinLdrLoadImage(): SORD %d < VS %d\n", SizeOfRawData, VirtualSize);
RtlZeroMemory((PVOID)(SectionHeader->VirtualAddress + (ULONG)PhysicalBase + SizeOfRawData), VirtualSize - SizeOfRawData);
}
@@ -423,8 +423,8 @@ WinLdrLoadImage(IN PCHAR FileName,
/* Relocate the image, if it needs it */
if (NtHeaders->OptionalHeader.ImageBase != (ULONG)VirtualBase)
{
DPRINTM((DPRINT_WINDOWS, "Relocating %p -> %p\n",
NtHeaders->OptionalHeader.ImageBase, VirtualBase));
DPRINTM(DPRINT_WINDOWS, "Relocating %p -> %p\n",
NtHeaders->OptionalHeader.ImageBase, VirtualBase);
Status = (BOOLEAN)LdrRelocateImageWithBias(PhysicalBase,
(ULONG_PTR)VirtualBase - (ULONG_PTR)PhysicalBase,
"FreeLdr",
@@ -453,7 +453,7 @@ WinLdrpCompareDllName(IN PCH DllName,
UnicodeNamePA.Length = UnicodeName->Length;
UnicodeNamePA.MaximumLength = UnicodeName->MaximumLength;
UnicodeNamePA.Buffer = VaToPa(UnicodeName->Buffer);
DPRINTM((DPRINT_WINDOWS, "WinLdrpCompareDllName: %s and %wZ, Length = %d "
DPRINTM(DPRINT_WINDOWS, "WinLdrpCompareDllName: %s and %wZ, Length = %d "
"UN->Length %d\n", DllName, &UnicodeNamePA, Length, UnicodeName->Length));
if ((Length * sizeof(WCHAR)) > UnicodeName->Length)
@@ -500,13 +500,13 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
LONG High, Low, Middle, Result;
ULONG Hint;
//DPRINTM((DPRINT_WINDOWS, "WinLdrpBindImportName(): DllBase 0x%X, ImageBase 0x%X, ThunkData 0x%X, ExportDirectory 0x%X, ExportSize %d, ProcessForwards 0x%X\n",
// DllBase, ImageBase, ThunkData, ExportDirectory, ExportSize, ProcessForwards));
//DPRINTM(DPRINT_WINDOWS, "WinLdrpBindImportName(): DllBase 0x%X, ImageBase 0x%X, ThunkData 0x%X, ExportDirectory 0x%X, ExportSize %d, ProcessForwards 0x%X\n",
// DllBase, ImageBase, ThunkData, ExportDirectory, ExportSize, ProcessForwards);
/* Check passed DllBase param */
if(DllBase == NULL)
{
DPRINTM((DPRINT_WINDOWS, "WARNING: DllBase == NULL!\n"));
DPRINTM(DPRINT_WINDOWS, "WARNING: DllBase == NULL!\n");
return FALSE;
}
@@ -518,7 +518,7 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
{
/* Yes, calculate the ordinal */
Ordinal = (ULONG)(IMAGE_ORDINAL(ThunkData->u1.Ordinal) - (UINT32)ExportDirectory->Base);
//DPRINTM((DPRINT_WINDOWS, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal));
//DPRINTM(DPRINT_WINDOWS, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
}
else
{
@@ -526,22 +526,22 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (!ProcessForwards)
{
/* AddressOfData in thunk entry will become a virtual address (from relative) */
//DPRINTM((DPRINT_WINDOWS, "WinLdrpBindImportName(): ThunkData->u1.AOD was %p\n", ThunkData->u1.AddressOfData));
//DPRINTM(DPRINT_WINDOWS, "WinLdrpBindImportName(): ThunkData->u1.AOD was %p\n", ThunkData->u1.AddressOfData);
ThunkData->u1.AddressOfData =
(ULONG)RVA(ImageBase, ThunkData->u1.AddressOfData);
//DPRINTM((DPRINT_WINDOWS, "WinLdrpBindImportName(): ThunkData->u1.AOD became %p\n", ThunkData->u1.AddressOfData));
//DPRINTM(DPRINT_WINDOWS, "WinLdrpBindImportName(): ThunkData->u1.AOD became %p\n", ThunkData->u1.AddressOfData);
}
/* Get pointers to Name and Ordinal tables (RVA -> VA) */
NameTable = (PULONG)VaToPa(RVA(DllBase, ExportDirectory->AddressOfNames));
OrdinalTable = (PUSHORT)VaToPa(RVA(DllBase, ExportDirectory->AddressOfNameOrdinals));
//DPRINTM((DPRINT_WINDOWS, "NameTable 0x%X, OrdinalTable 0x%X, ED->AddressOfNames 0x%X, ED->AOFO 0x%X\n",
// NameTable, OrdinalTable, ExportDirectory->AddressOfNames, ExportDirectory->AddressOfNameOrdinals));
//DPRINTM(DPRINT_WINDOWS, "NameTable 0x%X, OrdinalTable 0x%X, ED->AddressOfNames 0x%X, ED->AOFO 0x%X\n",
// NameTable, OrdinalTable, ExportDirectory->AddressOfNames, ExportDirectory->AddressOfNameOrdinals);
/* Get the hint, convert it to a physical pointer */
Hint = ((PIMAGE_IMPORT_BY_NAME)VaToPa((PVOID)ThunkData->u1.AddressOfData))->Hint;
//DPRINTM((DPRINT_WINDOWS, "HintIndex %d\n", Hint));
//DPRINTM(DPRINT_WINDOWS, "HintIndex %d\n", Hint);
/* If Hint is less than total number of entries in the export directory,
and import name == export name, then we can just get it from the OrdinalTable */
@@ -554,14 +554,14 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
)
{
Ordinal = OrdinalTable[Hint];
//DPRINTM((DPRINT_WINDOWS, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal));
//DPRINTM(DPRINT_WINDOWS, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
}
else
{
/* It's not the easy way, we have to lookup import name in the name table.
Let's use a binary search for this task. */
//DPRINTM((DPRINT_WINDOWS, "WinLdrpBindImportName() looking up the import name using binary search...\n"));
//DPRINTM(DPRINT_WINDOWS, "WinLdrpBindImportName() looking up the import name using binary search...\n");
/* Low boundary is set to 0, and high boundary to the maximum index */
Low = 0;
@@ -577,13 +577,13 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
Result = strcmp(VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa((PVOID)ThunkData->u1.AddressOfData))->Name[0]),
(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])));
/*DPRINTM((DPRINT_WINDOWS, "Binary search: comparing Import '__', Export '%s'\n",*/
/*DPRINTM(DPRINT_WINDOWS, "Binary search: comparing Import '__', Export '%s'\n",*/
/*VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]),*/
/*(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle]))));*/
/*(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])));*/
/*DPRINTM((DPRINT_WINDOWS, "TE->u1.AOD %p, fulladdr %p\n",
/*DPRINTM(DPRINT_WINDOWS, "TE->u1.AOD %p, fulladdr %p\n",
ThunkData->u1.AddressOfData,
((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name ));*/
((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name );*/
/* Depending on result of strcmp, perform different actions */
@@ -608,21 +608,21 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (High < Low)
{
//Print(L"Error in binary search\n");
DPRINTM((DPRINT_WINDOWS, "Error in binary search!\n"));
DPRINTM(DPRINT_WINDOWS, "Error in binary search!\n");
return FALSE;
}
/* Everything allright, get the ordinal */
Ordinal = OrdinalTable[Middle];
//DPRINTM((DPRINT_WINDOWS, "WinLdrpBindImportName() found Ordinal %d\n", Ordinal));
//DPRINTM(DPRINT_WINDOWS, "WinLdrpBindImportName() found Ordinal %d\n", Ordinal);
}
}
/* Check ordinal number for validity! */
if (Ordinal >= ExportDirectory->NumberOfFunctions)
{
DPRINTM((DPRINT_WINDOWS, "Ordinal number is invalid!\n"));
DPRINTM(DPRINT_WINDOWS, "Ordinal number is invalid!\n");
return FALSE;
}
@@ -647,12 +647,12 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
/* Strip out its extension */
*strchr(ForwardDllName,'.') = '\0';
DPRINTM((DPRINT_WINDOWS, "WinLdrpBindImportName(): ForwardDllName %s\n", ForwardDllName));
DPRINTM(DPRINT_WINDOWS, "WinLdrpBindImportName(): ForwardDllName %s\n", ForwardDllName);
if (!WinLdrCheckForLoadedDll(WinLdrBlock, ForwardDllName, &DataTableEntry))
{
/* We can't continue if DLL couldn't be loaded, so bomb out with an error */
//Print(L"Error loading DLL!\n");
DPRINTM((DPRINT_WINDOWS, "Error loading DLL!\n"));
DPRINTM(DPRINT_WINDOWS, "Error loading DLL!\n");
return FALSE;
}
@@ -728,7 +728,7 @@ WinLdrpLoadAndScanReferencedDll(PLOADER_PARAMETER_BLOCK WinLdrBlock,
strcpy(FullDllName, DirectoryPath);
strcat(FullDllName, ImportName);
DPRINTM((DPRINT_WINDOWS, "Loading referenced DLL: %s\n", FullDllName));
DPRINTM(DPRINT_WINDOWS, "Loading referenced DLL: %s\n", FullDllName);
//Print(L"Loading referenced DLL: %s\n", FullDllName);
/* Load the image */
@@ -736,7 +736,7 @@ WinLdrpLoadAndScanReferencedDll(PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (!Status)
{
DPRINTM((DPRINT_WINDOWS, "WinLdrLoadImage() failed\n"));
DPRINTM(DPRINT_WINDOWS, "WinLdrLoadImage() failed\n");
return Status;
}
@@ -749,21 +749,21 @@ WinLdrpLoadAndScanReferencedDll(PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (!Status)
{
DPRINTM((DPRINT_WINDOWS,
"WinLdrAllocateDataTableEntry() failed with Status=0x%X\n", Status));
DPRINTM(DPRINT_WINDOWS,
"WinLdrAllocateDataTableEntry() failed with Status=0x%X\n", Status);
return Status;
}
/* Scan its dependencies too */
DPRINTM((DPRINT_WINDOWS,
DPRINTM(DPRINT_WINDOWS,
"WinLdrScanImportDescriptorTable() calling ourselves for %S\n",
VaToPa((*DataTableEntry)->BaseDllName.Buffer)));
VaToPa((*DataTableEntry)->BaseDllName.Buffer));
Status = WinLdrScanImportDescriptorTable(WinLdrBlock, DirectoryPath, *DataTableEntry);
if (!Status)
{
DPRINTM((DPRINT_WINDOWS,
"WinLdrScanImportDescriptorTable() failed with Status=0x%X\n", Status));
DPRINTM(DPRINT_WINDOWS,
"WinLdrScanImportDescriptorTable() failed with Status=0x%X\n", Status);
return Status;
}
@@ -780,8 +780,8 @@ WinLdrpScanImportAddressTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
BOOLEAN Status;
ULONG ExportSize;
DPRINTM((DPRINT_WINDOWS, "WinLdrpScanImportAddressTable(): DllBase 0x%X, "
"ImageBase 0x%X, ThunkData 0x%X\n", DllBase, ImageBase, ThunkData));
DPRINTM(DPRINT_WINDOWS, "WinLdrpScanImportAddressTable(): DllBase 0x%X, "
"ImageBase 0x%X, ThunkData 0x%X\n", DllBase, ImageBase, ThunkData);
/* Obtain the export table from the DLL's base */
if (DllBase == NULL)
@@ -798,7 +798,7 @@ WinLdrpScanImportAddressTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
&ExportSize);
}
DPRINTM((DPRINT_WINDOWS, "WinLdrpScanImportAddressTable(): ExportDirectory 0x%X\n", ExportDirectory));
DPRINTM(DPRINT_WINDOWS, "WinLdrpScanImportAddressTable(): ExportDirectory 0x%X\n", ExportDirectory);
/* If pointer to Export Directory is */
if (ExportDirectory == NULL)
+25 -25
View File
@@ -101,9 +101,9 @@ WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock,
strcpy(SystemRoot, &SystemPath[PathSeparator]);
strcat(SystemRoot, "\\");
DPRINTM((DPRINT_WINDOWS, "ArcBoot: %s\n", ArcBoot));
DPRINTM((DPRINT_WINDOWS, "SystemRoot: %s\n", SystemRoot));
DPRINTM((DPRINT_WINDOWS, "Options: %s\n", Options));
DPRINTM(DPRINT_WINDOWS, "ArcBoot: %s\n", ArcBoot);
DPRINTM(DPRINT_WINDOWS, "SystemRoot: %s\n", SystemRoot);
DPRINTM(DPRINT_WINDOWS, "Options: %s\n", Options);
/* Fill Arc BootDevice */
LoaderBlock->ArcBootDeviceName = MmHeapAlloc(strlen(ArcBoot)+1);
@@ -278,7 +278,7 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
*(DriverNamePos+1) = 0;
}
DPRINTM((DPRINT_WINDOWS, "DriverPath: %s, DllName: %s, LPB %p\n", DriverPath, DllName, LoaderBlock));
DPRINTM(DPRINT_WINDOWS, "DriverPath: %s, DllName: %s, LPB %p\n", DriverPath, DllName, LoaderBlock);
// Check if driver is already loaded
@@ -299,7 +299,7 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
Status = WinLdrAllocateDataTableEntry(LoaderBlock, DllName, DllName, DriverBase, DriverDTE);
if (!Status)
{
DPRINTM((DPRINT_WINDOWS, "WinLdrAllocateDataTableEntry() failed\n"));
DPRINTM(DPRINT_WINDOWS, "WinLdrAllocateDataTableEntry() failed\n");
return FALSE;
}
@@ -311,8 +311,8 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
Status = WinLdrScanImportDescriptorTable(LoaderBlock, FullPath, *DriverDTE);
if (!Status)
{
DPRINTM((DPRINT_WINDOWS, "WinLdrScanImportDescriptorTable() failed for %s\n",
FullPath));
DPRINTM(DPRINT_WINDOWS, "WinLdrScanImportDescriptorTable() failed for %s\n",
FullPath);
return FALSE;
}
@@ -334,8 +334,8 @@ WinLdrLoadBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock,
{
BootDriver = CONTAINING_RECORD(NextBd, BOOT_DRIVER_LIST_ENTRY, Link);
DPRINTM((DPRINT_WINDOWS, "BootDriver %wZ DTE %08X RegPath: %wZ\n", &BootDriver->FilePath,
BootDriver->LdrEntry, &BootDriver->RegistryPath));
DPRINTM(DPRINT_WINDOWS, "BootDriver %wZ DTE %08X RegPath: %wZ\n", &BootDriver->FilePath,
BootDriver->LdrEntry, &BootDriver->RegistryPath);
// Paths are relative (FIXME: Are they always relative?)
@@ -375,7 +375,7 @@ PVOID WinLdrLoadModule(PCSTR ModuleName, ULONG *Size,
//sprintf(ProgressString, "Loading %s...", FileName);
//UiDrawProgressBarCenter(1, 100, ProgressString);
DPRINTM((DPRINT_WINDOWS, "Loading module %s\n", ModuleName));
DPRINTM(DPRINT_WINDOWS, "Loading module %s\n", ModuleName);
*Size = 0;
/* Open the image file */
@@ -407,7 +407,7 @@ PVOID WinLdrLoadModule(PCSTR ModuleName, ULONG *Size,
return NULL;
}
DPRINTM((DPRINT_WINDOWS, "Loaded %s at 0x%x with size 0x%x\n", ModuleName, PhysicalBase, FileSize));
DPRINTM(DPRINT_WINDOWS, "Loaded %s at 0x%x with size 0x%x\n", ModuleName, PhysicalBase, FileSize);
/* We are done with the file - close it */
FsCloseFile(FileHandle);
@@ -489,7 +489,7 @@ LoadAndBootWindows(PCSTR OperatingSystemName, USHORT OperatingSystemVersion)
BootPath[strlen(BootPath)] != '\\')
strcat(BootPath, "\\");
DPRINTM((DPRINT_WINDOWS,"SystemRoot: '%s'\n", BootPath));
DPRINTM(DPRINT_WINDOWS,"SystemRoot: '%s'\n", BootPath);
/* Allocate and minimalistic-initialize LPB */
AllocateAndInitLPB(&LoaderBlock);
@@ -502,13 +502,13 @@ LoadAndBootWindows(PCSTR OperatingSystemName, USHORT OperatingSystemVersion)
strcpy(FileName, BootPath);
strcat(FileName, "SYSTEM32\\NTOSKRNL.EXE");
Status = WinLdrLoadImage(FileName, LoaderSystemCode, &NtosBase);
DPRINTM((DPRINT_WINDOWS, "Ntos loaded with status %d at %p\n", Status, NtosBase));
DPRINTM(DPRINT_WINDOWS, "Ntos loaded with status %d at %p\n", Status, NtosBase);
/* Load HAL */
strcpy(FileName, BootPath);
strcat(FileName, "SYSTEM32\\HAL.DLL");
Status = WinLdrLoadImage(FileName, LoaderHalCode, &HalBase);
DPRINTM((DPRINT_WINDOWS, "HAL loaded with status %d at %p\n", Status, HalBase));
DPRINTM(DPRINT_WINDOWS, "HAL loaded with status %d at %p\n", Status, HalBase);
/* Load kernel-debugger support dll */
if (OperatingSystemVersion > _WIN32_WINNT_WIN2K)
@@ -516,7 +516,7 @@ LoadAndBootWindows(PCSTR OperatingSystemName, USHORT OperatingSystemVersion)
strcpy(FileName, BootPath);
strcat(FileName, "SYSTEM32\\KDCOM.DLL");
Status = WinLdrLoadImage(FileName, LoaderBootDriver, &KdComBase);
DPRINTM((DPRINT_WINDOWS, "KdCom loaded with status %d at %p\n", Status, KdComBase));
DPRINTM(DPRINT_WINDOWS, "KdCom loaded with status %d at %p\n", Status, KdComBase);
}
/* Allocate data table entries for above-loaded modules */
@@ -540,11 +540,11 @@ LoadAndBootWindows(PCSTR OperatingSystemName, USHORT OperatingSystemVersion)
/* Load Hive, and then NLS data, OEM font, and prepare boot drivers list */
Status = WinLdrLoadAndScanSystemHive(LoaderBlock, BootPath);
DPRINTM((DPRINT_WINDOWS, "SYSTEM hive loaded and scanned with status %d\n", Status));
DPRINTM(DPRINT_WINDOWS, "SYSTEM hive loaded and scanned with status %d\n", Status);
/* Load boot drivers */
Status = WinLdrLoadBootDrivers(LoaderBlock, BootPath);
DPRINTM((DPRINT_WINDOWS, "Boot drivers loaded with status %d\n", Status));
DPRINTM(DPRINT_WINDOWS, "Boot drivers loaded with status %d\n", Status);
/* Alloc PCR, TSS, do magic things with the GDT/IDT */
WinLdrSetupForNt(LoaderBlock, &GdtIdt, &PcrBasePage, &TssBasePage);
@@ -571,8 +571,8 @@ LoadAndBootWindows(PCSTR OperatingSystemName, USHORT OperatingSystemVersion)
/* Save final value of LoaderPagesSpanned */
LoaderBlock->Extension->LoaderPagesSpanned = LoaderPagesSpanned;
DPRINTM((DPRINT_WINDOWS, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
KiSystemStartup, LoaderBlockVA));
DPRINTM(DPRINT_WINDOWS, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
KiSystemStartup, LoaderBlockVA);
WinLdrpDumpMemoryDescriptors(LoaderBlockVA);
WinLdrpDumpBootDriver(LoaderBlockVA);
@@ -603,8 +603,8 @@ WinLdrpDumpMemoryDescriptors(PLOADER_PARAMETER_BLOCK LoaderBlock)
{
MemoryDescriptor = CONTAINING_RECORD(NextMd, MEMORY_ALLOCATION_DESCRIPTOR, ListEntry);
DPRINTM((DPRINT_WINDOWS, "BP %08X PC %04X MT %d\n", MemoryDescriptor->BasePage,
MemoryDescriptor->PageCount, MemoryDescriptor->MemoryType));
DPRINTM(DPRINT_WINDOWS, "BP %08X PC %04X MT %d\n", MemoryDescriptor->BasePage,
MemoryDescriptor->PageCount, MemoryDescriptor->MemoryType);
NextMd = MemoryDescriptor->ListEntry.Flink;
}
@@ -622,8 +622,8 @@ WinLdrpDumpBootDriver(PLOADER_PARAMETER_BLOCK LoaderBlock)
{
BootDriver = CONTAINING_RECORD(NextBd, BOOT_DRIVER_LIST_ENTRY, Link);
DPRINTM((DPRINT_WINDOWS, "BootDriver %wZ DTE %08X RegPath: %wZ\n", &BootDriver->FilePath,
BootDriver->LdrEntry, &BootDriver->RegistryPath));
DPRINTM(DPRINT_WINDOWS, "BootDriver %wZ DTE %08X RegPath: %wZ\n", &BootDriver->FilePath,
BootDriver->LdrEntry, &BootDriver->RegistryPath);
NextBd = BootDriver->Link.Flink;
}
@@ -641,8 +641,8 @@ WinLdrpDumpArcDisks(PLOADER_PARAMETER_BLOCK LoaderBlock)
{
ArcDisk = CONTAINING_RECORD(NextBd, ARC_DISK_SIGNATURE, ListEntry);
DPRINTM((DPRINT_WINDOWS, "ArcDisk %s checksum: 0x%X, signature: 0x%X\n",
ArcDisk->ArcName, ArcDisk->CheckSum, ArcDisk->Signature));
DPRINTM(DPRINT_WINDOWS, "ArcDisk %s checksum: 0x%X, signature: 0x%X\n",
ArcDisk->ArcName, ArcDisk->CheckSum, ArcDisk->Signature);
NextBd = ArcDisk->ListEntry.Flink;
}
+22 -22
View File
@@ -126,7 +126,7 @@ MempAllocatePageTables()
// and windows doesn't expect ALL memory mapped...
NumPageTables = (GetSystemMemorySize() >> MM_PAGE_SHIFT) >> 10;
DPRINTM((DPRINT_WINDOWS, "NumPageTables = %d\n", NumPageTables));
DPRINTM(DPRINT_WINDOWS, "NumPageTables = %d\n", NumPageTables);
// Allocate memory block for all these things:
// PDE, HAL mapping page table, physical mapping, kernel mapping
@@ -145,7 +145,7 @@ MempAllocatePageTables()
if (Buffer + (TotalSize - NumPageTables*MM_PAGE_SIZE) !=
PhysicalPageTablesBuffer)
{
DPRINTM((DPRINT_WINDOWS, "There was a problem allocating two adjacent blocks of memory!"));
DPRINTM(DPRINT_WINDOWS, "There was a problem allocating two adjacent blocks of memory!");
}
if (Buffer == NULL || PhysicalPageTablesBuffer == NULL)
@@ -198,7 +198,7 @@ MempAllocatePTE(ULONG Entry, PHARDWARE_PTE *PhysicalPT, PHARDWARE_PTE *KernelPT)
if (Entry+(KSEG0_BASE >> 22) > 1023)
{
DPRINTM((DPRINT_WINDOWS, "WARNING! Entry: %X > 1023\n", Entry+(KSEG0_BASE >> 22)));
DPRINTM(DPRINT_WINDOWS, "WARNING! Entry: %X > 1023\n", Entry+(KSEG0_BASE >> 22));
}
// Kernel-mode mapping
@@ -368,8 +368,8 @@ MempAddMemoryBlock(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
Mad[MadCount].MemoryType != LoaderFirmwarePermanent &&
Mad[MadCount].MemoryType != LoaderFree)
{
DPRINTM((DPRINT_WINDOWS, "Setting page %x %x to Temporary from %d\n",
BasePage, PageCount, Mad[MadCount].MemoryType));
DPRINTM(DPRINT_WINDOWS, "Setting page %x %x to Temporary from %d\n",
BasePage, PageCount, Mad[MadCount].MemoryType);
Mad[MadCount].MemoryType = LoaderFirmwareTemporary;
}
@@ -394,7 +394,7 @@ MempAddMemoryBlock(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
Status = MempSetupPaging(BasePage, PageCount);
if (!Status)
{
DPRINTM((DPRINT_WINDOWS, "Error during MempSetupPaging\n"));
DPRINTM(DPRINT_WINDOWS, "Error during MempSetupPaging\n");
return;
}
}
@@ -429,8 +429,8 @@ WinLdrpMapApic()
asm("mov _APICAddress, edx");
asm(".att_syntax\n");
DPRINTM((DPRINT_WINDOWS, "Local APIC detected at address 0x%x\n",
APICAddress));
DPRINTM(DPRINT_WINDOWS, "Local APIC detected at address 0x%x\n",
APICAddress);
/* Map it */
HalPageTable[(APIC_BASE - 0xFFC00000) >> MM_PAGE_SHIFT].PageFrameNumber
@@ -503,13 +503,13 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
MemoryMapStartPage = (ULONG_PTR)MemoryMap >> MM_PAGE_SHIFT;
MemoryMapSizeInPages = NoEntries * sizeof(PAGE_LOOKUP_TABLE_ITEM);
DPRINTM((DPRINT_WINDOWS, "Got memory map with %d entries\n", NoEntries));
DPRINTM(DPRINT_WINDOWS, "Got memory map with %d entries\n", NoEntries);
// Always contigiously map low 1Mb of memory
Status = MempSetupPaging(0, 0x100);
if (!Status)
{
DPRINTM((DPRINT_WINDOWS, "Error during MempSetupPaging of low 1Mb\n"));
DPRINTM(DPRINT_WINDOWS, "Error during MempSetupPaging of low 1Mb\n");
return FALSE;
}
@@ -572,7 +572,7 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
}
#endif
DPRINTM((DPRINT_WINDOWS, "MadCount: %d\n", MadCount));
DPRINTM(DPRINT_WINDOWS, "MadCount: %d\n", MadCount);
WinLdrpDumpMemoryDescriptors(LoaderBlock); //FIXME: Delete!
@@ -585,7 +585,7 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
}*/
//VideoDisplayString(L"Hello from VGA, going into the kernel\n");
DPRINTM((DPRINT_WINDOWS, "HalPageTable: 0x%X\n", HalPageTable));
DPRINTM(DPRINT_WINDOWS, "HalPageTable: 0x%X\n", HalPageTable);
// Page Tables have been setup, make special handling for PCR and TSS
// (which is done in BlSetupFotNt in usual ntldr)
@@ -602,7 +602,7 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
// Map VGA memory
//VideoMemoryBase = MmMapIoSpace(0xb8000, 4000, MmNonCached);
//DPRINTM((DPRINT_WINDOWS, "VideoMemoryBase: 0x%X\n", VideoMemoryBase));
//DPRINTM(DPRINT_WINDOWS, "VideoMemoryBase: 0x%X\n", VideoMemoryBase);
Tss = (PKTSS)(KSEG0_BASE | (TssBasePage << MM_PAGE_SHIFT));
@@ -611,7 +611,7 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
// Fill the memory descriptor list and
//PrepareMemoryDescriptorList();
DPRINTM((DPRINT_WINDOWS, "Memory Descriptor List prepared, printing PDE\n"));
DPRINTM(DPRINT_WINDOWS, "Memory Descriptor List prepared, printing PDE\n");
List_PaToVa(&LoaderBlock->MemoryDescriptorListHead);
#ifdef DBG
@@ -619,18 +619,18 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ULONG *PDE_Addr=(ULONG *)PDE;//0xC0300000;
int j;
DPRINTM((DPRINT_WINDOWS, "\nPDE\n"));
DPRINTM(DPRINT_WINDOWS, "\nPDE\n");
for (i=0; i<128; i++)
{
DPRINTM((DPRINT_WINDOWS, "0x%04X | ", i*8));
DPRINTM(DPRINT_WINDOWS, "0x%04X | ", i*8);
for (j=0; j<8; j++)
{
DPRINTM((DPRINT_WINDOWS, "0x%08X ", PDE_Addr[i*8+j]));
DPRINTM(DPRINT_WINDOWS, "0x%08X ", PDE_Addr[i*8+j]);
}
DPRINTM((DPRINT_WINDOWS, "\n"));
DPRINTM(DPRINT_WINDOWS, "\n");
}
}
#endif
@@ -670,8 +670,8 @@ WinLdrInsertDescriptor(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
PLIST_ENTRY PreviousEntry, NextEntry;
PMEMORY_ALLOCATION_DESCRIPTOR PreviousDescriptor = NULL, NextDescriptor = NULL;
DPRINTM((DPRINT_WINDOWS, "BP=0x%X PC=0x%X %s\n", NewDescriptor->BasePage,
NewDescriptor->PageCount, MemTypeDesc[NewDescriptor->MemoryType]));
DPRINTM(DPRINT_WINDOWS, "BP=0x%X PC=0x%X %s\n", NewDescriptor->BasePage,
NewDescriptor->PageCount, MemTypeDesc[NewDescriptor->MemoryType]);
/* Find a place where to insert the new descriptor to */
PreviousEntry = ListHead;
@@ -735,8 +735,8 @@ WinLdrSetProcessorContext(PVOID GdtIdt, IN ULONG Pcr, IN ULONG Tss)
ULONG Ldt = 0;
//ULONG i;
DPRINTM((DPRINT_WINDOWS, "GDtIdt %p, Pcr %p, Tss 0x%08X\n",
GdtIdt, Pcr, Tss));
DPRINTM(DPRINT_WINDOWS, "GDtIdt %p, Pcr %p, Tss 0x%08X\n",
GdtIdt, Pcr, Tss);
// Kernel expects the PCR to be zero-filled on startup
// FIXME: Why zero it here when we can zero it right after allocation?
@@ -158,13 +158,13 @@ BOOLEAN WinLdrLoadAndScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
return FALSE;
}
DPRINTM((DPRINT_WINDOWS, "NLS data %s %s %s\n", AnsiName, OemName, LangName));
DPRINTM(DPRINT_WINDOWS, "NLS data %s %s %s\n", AnsiName, OemName, LangName);
// Load NLS data
strcpy(SearchPath, DirectoryPath);
strcat(SearchPath, "SYSTEM32\\");
Status = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
DPRINTM((DPRINT_WINDOWS, "NLS data loaded with status %d\n", Status));
DPRINTM(DPRINT_WINDOWS, "NLS data loaded with status %d\n", Status);
/* TODO: Load OEM HAL font */
@@ -295,7 +295,7 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
goto Failure;
AnsiFileSize = FsGetFileSize(AnsiFileHandle);
DPRINTM((DPRINT_WINDOWS, "AnsiFileSize: %d\n", AnsiFileSize));
DPRINTM(DPRINT_WINDOWS, "AnsiFileSize: %d\n", AnsiFileSize);
FsCloseFile(AnsiFileHandle);
/* Open OEM file and store its length */
@@ -316,7 +316,7 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
OemFileSize = FsGetFileSize(OemFileHandle);
FsCloseFile(OemFileHandle);
}
DPRINTM((DPRINT_WINDOWS, "OemFileSize: %d\n", OemFileSize));
DPRINTM(DPRINT_WINDOWS, "OemFileSize: %d\n", OemFileSize);
/* And finally open the language codepage file and store its length */
//Print(L"Loading %s...\n", Filename);
@@ -329,7 +329,7 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
LanguageFileSize = FsGetFileSize(LanguageFileHandle);
FsCloseFile(LanguageFileHandle);
DPRINTM((DPRINT_WINDOWS, "LanguageFileSize: %d\n", LanguageFileSize));
DPRINTM(DPRINT_WINDOWS, "LanguageFileSize: %d\n", LanguageFileSize);
/* Sum up all three length, having in mind that every one of them
must start at a page boundary => thus round up each file to a page */
@@ -455,7 +455,7 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
&hGroupKey);
if (rc != ERROR_SUCCESS) {
DPRINTM((DPRINT_REACTOS, "Failed to open the 'ServiceGroupOrder' key (rc %d)\n", (int)rc));
DPRINTM(DPRINT_REACTOS, "Failed to open the 'ServiceGroupOrder' key (rc %d)\n", (int)rc);
return;
}
@@ -465,7 +465,7 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
&hOrderKey);
if (rc != ERROR_SUCCESS) {
DPRINTM((DPRINT_REACTOS, "Failed to open the 'GroupOrderList' key (rc %d)\n", (int)rc));
DPRINTM(DPRINT_REACTOS, "Failed to open the 'GroupOrderList' key (rc %d)\n", (int)rc);
return;
}
@@ -475,7 +475,7 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
&hServiceKey);
if (rc != ERROR_SUCCESS) {
DPRINTM((DPRINT_REACTOS, "Failed to open the 'Services' key (rc %d)\n", (int)rc));
DPRINTM(DPRINT_REACTOS, "Failed to open the 'Services' key (rc %d)\n", (int)rc);
return;
}
@@ -483,17 +483,17 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
BufferSize = 4096;
GroupNameBuffer = MmHeapAlloc(BufferSize);
rc = RegQueryValue(hGroupKey, L"List", NULL, (PUCHAR)GroupNameBuffer, &BufferSize);
DPRINTM((DPRINT_REACTOS, "RegQueryValue(): rc %d\n", (int)rc));
DPRINTM(DPRINT_REACTOS, "RegQueryValue(): rc %d\n", (int)rc);
if (rc != ERROR_SUCCESS)
return;
DPRINTM((DPRINT_REACTOS, "BufferSize: %d \n", (int)BufferSize));
DPRINTM((DPRINT_REACTOS, "GroupNameBuffer: '%S' \n", GroupNameBuffer));
DPRINTM(DPRINT_REACTOS, "BufferSize: %d \n", (int)BufferSize);
DPRINTM(DPRINT_REACTOS, "GroupNameBuffer: '%S' \n", GroupNameBuffer);
/* Loop through each group */
GroupName = GroupNameBuffer;
while (*GroupName)
{
DPRINTM((DPRINT_WINDOWS, "Driver group: '%S'\n", GroupName));
DPRINTM(DPRINT_WINDOWS, "Driver group: '%S'\n", GroupName);
/* Query the Order */
BufferSize = sizeof(OrderList);
@@ -510,7 +510,7 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
/* Get the Driver's Name */
ValueSize = sizeof(ServiceName);
rc = RegEnumKey(hServiceKey, Index, ServiceName, &ValueSize);
//DPRINTM((DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc));
//DPRINTM(DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc);
/* Makre sure it's valid, and check if we're done */
if (rc == ERROR_NO_MORE_ITEMS)
@@ -520,7 +520,7 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
MmHeapFree(GroupNameBuffer);
return;
}
//DPRINTM((DPRINT_REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName));
//DPRINTM(DPRINT_REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName);
/* open driver Key */
rc = RegOpenKey(hServiceKey, ServiceName, &hDriverKey);
@@ -530,18 +530,18 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ValueSize = sizeof(ULONG);
rc = RegQueryValue(hDriverKey, L"Start", &ValueType, (PUCHAR)&StartValue, &ValueSize);
if (rc != ERROR_SUCCESS) StartValue = (ULONG)-1;
//DPRINTM((DPRINT_REACTOS, " Start: %x \n", (int)StartValue));
//DPRINTM(DPRINT_REACTOS, " Start: %x \n", (int)StartValue);
/* Read the Tag */
ValueSize = sizeof(ULONG);
rc = RegQueryValue(hDriverKey, L"Tag", &ValueType, (PUCHAR)&TagValue, &ValueSize);
if (rc != ERROR_SUCCESS) TagValue = (ULONG)-1;
//DPRINTM((DPRINT_REACTOS, " Tag: %x \n", (int)TagValue));
//DPRINTM(DPRINT_REACTOS, " Tag: %x \n", (int)TagValue);
/* Read the driver's group */
DriverGroupSize = sizeof(DriverGroup);
rc = RegQueryValue(hDriverKey, L"Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize);
//DPRINTM((DPRINT_REACTOS, " Group: '%S' \n", DriverGroup));
//DPRINTM(DPRINT_REACTOS, " Group: '%S' \n", DriverGroup);
/* Make sure it should be started */
if ((StartValue == 0) &&
@@ -554,17 +554,17 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
/* Write the whole path if it suceeded, else prepare to fail */
if (rc != ERROR_SUCCESS) {
DPRINTM((DPRINT_REACTOS, " ImagePath: not found\n"));
DPRINTM(DPRINT_REACTOS, " ImagePath: not found\n");
TempImagePath[0] = 0;
sprintf(ImagePath, "%s\\system32\\drivers\\%S.sys", DirectoryPath, ServiceName);
} else if (TempImagePath[0] != L'\\') {
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
} else {
sprintf(ImagePath, "%S", TempImagePath);
DPRINTM((DPRINT_REACTOS, " ImagePath: '%s'\n", ImagePath));
DPRINTM(DPRINT_REACTOS, " ImagePath: '%s'\n", ImagePath);
}
DPRINTM((DPRINT_WINDOWS, " Adding boot driver: '%s'\n", ImagePath));
DPRINTM(DPRINT_WINDOWS, " Adding boot driver: '%s'\n", ImagePath);
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
@@ -572,11 +572,11 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ServiceName);
if (!Status)
DPRINTM((DPRINT_WINDOWS, " Failed to add boot driver\n"));
DPRINTM(DPRINT_WINDOWS, " Failed to add boot driver\n");
} else
{
//DPRINTM((DPRINT_WINDOWS, " Skipping driver '%S' with Start %d, Tag %d and Group '%S' (Current Tag %d, current group '%S')\n",
// ServiceName, StartValue, TagValue, DriverGroup, OrderList[TagIndex], GroupName));
//DPRINTM(DPRINT_WINDOWS, " Skipping driver '%S' with Start %d, Tag %d and Group '%S' (Current Tag %d, current group '%S')\n",
// ServiceName, StartValue, TagValue, DriverGroup, OrderList[TagIndex], GroupName);
}
}
@@ -591,7 +591,7 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ValueSize = sizeof(ServiceName);
rc = RegEnumKey(hServiceKey, Index, ServiceName, &ValueSize);
//DPRINTM((DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc));
//DPRINTM(DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc);
if (rc == ERROR_NO_MORE_ITEMS)
break;
if (rc != ERROR_SUCCESS)
@@ -599,7 +599,7 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
MmHeapFree(GroupNameBuffer);
return;
}
//DPRINTM((DPRINT_REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName));
//DPRINTM(DPRINT_REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName);
/* open driver Key */
rc = RegOpenKey(hServiceKey, ServiceName, &hDriverKey);
@@ -609,18 +609,18 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ValueSize = sizeof(ULONG);
rc = RegQueryValue(hDriverKey, L"Start", &ValueType, (PUCHAR)&StartValue, &ValueSize);
if (rc != ERROR_SUCCESS) StartValue = (ULONG)-1;
//DPRINTM((DPRINT_REACTOS, " Start: %x \n", (int)StartValue));
//DPRINTM(DPRINT_REACTOS, " Start: %x \n", (int)StartValue);
/* Read the Tag */
ValueSize = sizeof(ULONG);
rc = RegQueryValue(hDriverKey, L"Tag", &ValueType, (PUCHAR)&TagValue, &ValueSize);
if (rc != ERROR_SUCCESS) TagValue = (ULONG)-1;
//DPRINTM((DPRINT_REACTOS, " Tag: %x \n", (int)TagValue));
//DPRINTM(DPRINT_REACTOS, " Tag: %x \n", (int)TagValue);
/* Read the driver's group */
DriverGroupSize = sizeof(DriverGroup);
rc = RegQueryValue(hDriverKey, L"Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize);
//DPRINTM((DPRINT_REACTOS, " Group: '%S' \n", DriverGroup));
//DPRINTM(DPRINT_REACTOS, " Group: '%S' \n", DriverGroup);
for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++) {
if (TagValue == OrderList[TagIndex]) break;
@@ -633,16 +633,16 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ValueSize = sizeof(TempImagePath);
rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize);
if (rc != ERROR_SUCCESS) {
DPRINTM((DPRINT_REACTOS, " ImagePath: not found\n"));
DPRINTM(DPRINT_REACTOS, " ImagePath: not found\n");
TempImagePath[0] = 0;
sprintf(ImagePath, "%ssystem32\\drivers\\%S.sys", DirectoryPath, ServiceName);
} else if (TempImagePath[0] != L'\\') {
sprintf(ImagePath, "%s%S", DirectoryPath, TempImagePath);
} else {
sprintf(ImagePath, "%S", TempImagePath);
DPRINTM((DPRINT_REACTOS, " ImagePath: '%s'\n", ImagePath));
DPRINTM(DPRINT_REACTOS, " ImagePath: '%s'\n", ImagePath);
}
DPRINTM((DPRINT_WINDOWS, " Adding boot driver: '%s'\n", ImagePath));
DPRINTM(DPRINT_WINDOWS, " Adding boot driver: '%s'\n", ImagePath);
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
@@ -650,11 +650,11 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ServiceName);
if (!Status)
DPRINTM((DPRINT_WINDOWS, " Failed to add boot driver\n"));
DPRINTM(DPRINT_WINDOWS, " Failed to add boot driver\n");
} else
{
//DPRINTM((DPRINT_WINDOWS, " Skipping driver '%S' with Start %d, Tag %d and Group '%S' (Current group '%S')\n",
// ServiceName, StartValue, TagValue, DriverGroup, GroupName));
//DPRINTM(DPRINT_WINDOWS, " Skipping driver '%S' with Start %d, Tag %d and Group '%S' (Current group '%S')\n",
// ServiceName, StartValue, TagValue, DriverGroup, GroupName);
}
}