[FREELDR]

- Introduce WINE-like debug macros ERR, FIXME, WARN and TRACE
- Always show ERR and FIXME information
- WARN and TRACE are enabled by DebugPrintMask in debug.c as before
- Thanks to new macros find bug in CMake livecd creation and fix it

svn path=/trunk/; revision=53542
This commit is contained in:
Rafal Harabien 2011-09-03 10:56:36 +00:00
parent 108b181a84
commit 104f6aa19c
43 changed files with 1078 additions and 1092 deletions

View file

@ -190,7 +190,9 @@ concatenate_files(
add_custom_target(freeldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys)
add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB FOR all)
# rename freeldr on livecd to setupldr.sys because isoboot.bin search for setupldr.sys
add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB FOR bootcd regtest)
add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB FOR livecd NAME_ON_CD setupldr.sys)
list(APPEND SETUPLDR_SOURCE
inffile/inffile.c)
@ -236,5 +238,5 @@ concatenate_files(
add_custom_target(setupldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys)
add_cd_file(TARGET setupldr FILE ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys DESTINATION loader NO_CAB FOR all)
add_cd_file(TARGET setupldr FILE ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys DESTINATION loader NO_CAB FOR bootcd regtest)

View file

@ -17,6 +17,8 @@
#define HYPER_SPACE_ENTRY 0x1EE
DBG_DEFAULT_CHANNEL(WINDOWS);
/* GLOBALS ***************************************************************/
PHARDWARE_PTE PxeBase;
@ -31,13 +33,13 @@ ULONG_PTR TssBasePage;
BOOLEAN
MempAllocatePageTables()
{
DPRINTM(DPRINT_WINDOWS,">>> MempAllocatePageTables\n");
TRACE(">>> MempAllocatePageTables\n");
/* Allocate a page for the PML4 */
PxeBase = MmAllocateMemoryWithType(PAGE_SIZE, LoaderMemoryData);
if (!PxeBase)
{
DPRINTM(DPRINT_WINDOWS,"failed to allocate PML4\n");
ERR("failed to allocate PML4\n");
return FALSE;
}
@ -55,7 +57,7 @@ MempAllocatePageTables()
// FIXME: map PDE's for hals memory mapping
DPRINTM(DPRINT_WINDOWS,">>> leave MempAllocatePageTables\n");
TRACE(">>> leave MempAllocatePageTables\n");
return TRUE;
}
@ -97,14 +99,14 @@ MempMapSinglePage(ULONG64 VirtualAddress, ULONG64 PhysicalAddress)
if (!PteBase)
{
DPRINTM(DPRINT_WINDOWS,"!!!No Dir %p, %p, %p, %p\n", PxeBase, PpeBase, PdeBase, PteBase);
ERR("!!!No Dir %p, %p, %p, %p\n", PxeBase, PpeBase, PdeBase, PteBase);
return FALSE;
}
Index = VAtoPTI(VirtualAddress);
if (PteBase[Index].Valid)
{
DPRINTM(DPRINT_WINDOWS,"!!!Already mapped %ld\n", Index);
ERR("!!!Already mapped %ld\n", Index);
return FALSE;
}
@ -152,7 +154,7 @@ MempMapRangeOfPages(ULONG64 VirtualAddress, ULONG64 PhysicalAddress, ULONG cPage
{
if (!MempMapSinglePage(VirtualAddress, PhysicalAddress))
{
DPRINTM(DPRINT_WINDOWS, "Failed to map page %ld from %p to %p\n",
ERR("Failed to map page %ld from %p to %p\n",
i, (PVOID)VirtualAddress, (PVOID)PhysicalAddress);
return i;
}
@ -166,7 +168,7 @@ BOOLEAN
MempSetupPaging(IN ULONG StartPage,
IN ULONG NumberOfPages)
{
DPRINTM(DPRINT_WINDOWS,">>> MempSetupPaging(0x%lx, %ld, %p)\n",
TRACE(">>> MempSetupPaging(0x%lx, %ld, %p)\n",
StartPage, NumberOfPages, StartPage * PAGE_SIZE + KSEG0_BASE);
/* Identity mapping */
@ -174,7 +176,7 @@ MempSetupPaging(IN ULONG StartPage,
StartPage * PAGE_SIZE,
NumberOfPages) != NumberOfPages)
{
DPRINTM(DPRINT_WINDOWS,"Failed to map pages %ld, %ld\n",
ERR("Failed to map pages %ld, %ld\n",
StartPage, NumberOfPages);
return FALSE;
}
@ -184,7 +186,7 @@ MempSetupPaging(IN ULONG StartPage,
StartPage * PAGE_SIZE,
NumberOfPages) != NumberOfPages)
{
DPRINTM(DPRINT_WINDOWS,"Failed to map pages %ld, %ld\n",
ERR("Failed to map pages %ld, %ld\n",
StartPage, NumberOfPages);
return FALSE;
}
@ -195,7 +197,7 @@ MempSetupPaging(IN ULONG StartPage,
VOID
MempUnmapPage(ULONG Page)
{
// DPRINTM(DPRINT_WINDOWS,">>> MempUnmapPage\n");
// TRACE(">>> MempUnmapPage\n");
}
VOID
@ -206,7 +208,7 @@ WinLdrpMapApic()
ULONG CpuInfo[4];
ULONG64 APICAddress;
DPRINTM(DPRINT_WINDOWS,">>> WinLdrpMapApic\n");
TRACE(">>> WinLdrpMapApic\n");
/* Check if we have a local APIC */
__cpuid((int*)CpuInfo, 1);
@ -215,7 +217,7 @@ WinLdrpMapApic()
/* If there is no APIC, just return */
if (!LocalAPIC)
{
DPRINTM(DPRINT_WINDOWS,"No APIC found.\n");
WARN("No APIC found.\n");
return;
}
@ -223,7 +225,7 @@ WinLdrpMapApic()
MsrValue.QuadPart = __readmsr(0x1B);
APICAddress = (MsrValue.LowPart & 0xFFFFF000);
DPRINTM(DPRINT_WINDOWS, "Local APIC detected at address 0x%x\n",
TRACE("Local APIC detected at address 0x%x\n",
APICAddress);
/* Map it */
@ -236,14 +238,14 @@ WinLdrMapSpecialPages()
/* Map the PCR page */
if (!MempMapSinglePage(KIP0PCRADDRESS, PcrBasePage * PAGE_SIZE))
{
DPRINTM(DPRINT_WINDOWS, "Could not map PCR @ %lx\n", PcrBasePage);
ERR("Could not map PCR @ %lx\n", PcrBasePage);
return FALSE;
}
/* Map KI_USER_SHARED_DATA */
if (!MempMapSinglePage(KI_USER_SHARED_DATA, (PcrBasePage+1) * PAGE_SIZE))
{
DPRINTM(DPRINT_WINDOWS, "Could not map KI_USER_SHARED_DATA\n");
ERR("Could not map KI_USER_SHARED_DATA\n");
return FALSE;
}
@ -325,7 +327,7 @@ Amd64SetupIdt(PVOID IdtBase)
VOID
WinLdrSetProcessorContext(void)
{
DPRINTM(DPRINT_WINDOWS, "WinLdrSetProcessorContext\n");
TRACE("WinLdrSetProcessorContext\n");
/* Disable Interrupts */
_disable();
@ -351,7 +353,7 @@ WinLdrSetProcessorContext(void)
/* Load TSR */
__ltr(KGDT64_SYS_TSS);
DPRINTM(DPRINT_WINDOWS, "leave WinLdrSetProcessorContext\n");
TRACE("leave WinLdrSetProcessorContext\n");
}
void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)

View file

@ -20,6 +20,8 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(WARNING);
BOOLEAN DriveMapInstalled = FALSE; // Tells us if we have already installed our drive map int 13h handler code
ULONG OldInt13HandlerAddress = 0; // Address of BIOS int 13h handler
ULONG DriveMapHandlerAddress = 0; // Linear address of our drive map handler
@ -96,19 +98,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));
TRACE("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);
TRACE("Installing Int13 drive map for %d drives.\n", DriveMapList.DriveMapCount);
DriveMapInstallInt13Handler(&DriveMapList);
}
else
{
DPRINTM(DPRINT_WARNING, "Removing any previously installed Int13 drive map.\n");
TRACE("Removing any previously installed Int13 drive map.\n");
DriveMapRemoveInt13Handler();
}
}

View file

@ -80,6 +80,8 @@
/* Timeout in ms for sending to keyboard controller. */
#define CONTROLLER_TIMEOUT 250
DBG_DEFAULT_CHANNEL(HWDETECT);
static CHAR Hex[] = "0123456789abcdef";
static unsigned int delay_count = 1;
@ -216,10 +218,10 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
InstData = (PCM_PNP_BIOS_INSTALLATION_CHECK)PnpBiosSupported();
if (InstData == NULL || strncmp((CHAR*)InstData->Signature, "$PnP", 4))
{
DPRINTM(DPRINT_HWDETECT, "PnP-BIOS not supported\n");
TRACE("PnP-BIOS not supported\n");
return;
}
DPRINTM(DPRINT_HWDETECT, "Signature '%c%c%c%c'\n",
TRACE("Signature '%c%c%c%c'\n",
InstData->Signature[0], InstData->Signature[1],
InstData->Signature[2], InstData->Signature[3]);
@ -230,20 +232,19 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
// e.g. look: http://my.execpc.com/~geezer/osd/pnp/pnp16.c
if (x != 0 || NodeSize == 0 || NodeCount == 0)
{
DPRINTM(DPRINT_HWDETECT, "PnP-BIOS failed to enumerate device nodes\n");
ERR("PnP-BIOS failed to enumerate device nodes\n");
return;
}
DPRINTM(DPRINT_HWDETECT, "PnP-BIOS supported\n");
DPRINTM(DPRINT_HWDETECT, "MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
DPRINTM(DPRINT_HWDETECT, "Estimated buffer size %u\n", NodeSize * NodeCount);
TRACE("PnP-BIOS supported\n");
TRACE("MaxNodeSize %u NodeCount %u\n", NodeSize, NodeCount);
TRACE("Estimated buffer size %u\n", NodeSize * NodeCount);
/* Set 'Configuration Data' value */
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + (NodeSize * NodeCount);
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}
memset(PartialResourceList, 0, Size);
@ -276,8 +277,7 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
{
DeviceNode = (PCM_PNP_BIOS_DEVICE_NODE)DISKREADBUFFER;
DPRINTM(DPRINT_HWDETECT,
"Node: %u Size %u (0x%x)\n",
TRACE("Node: %u Size %u (0x%x)\n",
DeviceNode->Node,
DeviceNode->Size,
DeviceNode->Size);
@ -300,8 +300,8 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
PnpBufferSize;
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + PnpBufferSize;
DPRINTM(DPRINT_HWDETECT, "Real buffer size: %u\n", PnpBufferSize);
DPRINTM(DPRINT_HWDETECT, "Resource size: %u\n", Size);
TRACE("Real buffer size: %u\n", PnpBufferSize);
TRACE("Resource size: %u\n", Size);
/* Create component key */
FldrCreateComponentKey(SystemKey,
@ -342,8 +342,7 @@ GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate a full resource descriptor\n");
ERR("Failed to allocate a full resource descriptor\n");
return NULL;
}
@ -379,17 +378,16 @@ GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
}
else
{
DPRINTM(DPRINT_HWDETECT, "Reading disk geometry failed\n");
TRACE("Reading disk geometry failed\n");
MmHeapFree(PartialResourceList);
return NULL;
}
DPRINTM(DPRINT_HWDETECT,
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
DriveNumber,
DiskGeometry->NumberOfCylinders,
DiskGeometry->NumberOfHeads,
DiskGeometry->SectorsPerTrack,
DiskGeometry->BytesPerSector);
TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
DriveNumber,
DiskGeometry->NumberOfCylinders,
DiskGeometry->NumberOfHeads,
DiskGeometry->SectorsPerTrack,
DiskGeometry->BytesPerSector);
//
// Return configuration data
@ -541,7 +539,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
/* Read the MBR */
if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, (PVOID)DISKREADBUFFER))
{
DPRINTM(DPRINT_HWDETECT, "Reading MBR failed\n");
ERR("Reading MBR failed\n");
return;
}
@ -549,7 +547,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
Mbr = (PMASTER_BOOT_RECORD)DISKREADBUFFER;
Signature = Mbr->Signature;
DPRINTM(DPRINT_HWDETECT, "Signature: %x\n", Signature);
TRACE("Signature: %x\n", Signature);
/* Calculate the MBR checksum */
Checksum = 0;
@ -558,7 +556,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
Checksum += Buffer[i];
}
Checksum = ~Checksum + 1;
DPRINTM(DPRINT_HWDETECT, "Checksum: %x\n", Checksum);
TRACE("Checksum: %x\n", Checksum);
/* Fill out the ARC disk block */
reactos_arc_disk_info[reactos_disk_count].Signature = Signature;
@ -607,7 +605,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
Identifier[17] = '-';
Identifier[18] = 'A';
Identifier[19] = 0;
DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier);
TRACE("Identifier: %s\n", Identifier);
}
static UCHAR
@ -683,8 +681,7 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}
@ -735,8 +732,7 @@ DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
ULONG FloppyCount;
FloppyCount = GetFloppyCount();
DPRINTM(DPRINT_HWDETECT,
"Floppy count: %u\n",
TRACE("Floppy count: %u\n",
FloppyCount);
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
@ -744,8 +740,7 @@ DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}
memset(PartialResourceList, 0, Size);
@ -792,7 +787,7 @@ DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey)
PartialResourceList,
Size,
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
TRACE("Created key: DiskController\\0\n");
MmHeapFree(PartialResourceList);
@ -829,7 +824,7 @@ DetectSystem(VOID)
}
if (! Changed)
{
DPRINTM(DPRINT_HWDETECT, "BIOS reports success for disk %d but data didn't change\n",
TRACE("BIOS reports success for disk %d but data didn't change\n",
(int)DiskCount);
break;
}
@ -837,8 +832,8 @@ DetectSystem(VOID)
memset((PVOID) DISKREADBUFFER, 0xcd, 512);
}
DiskReportError(TRUE);
DPRINTM(DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n",
(int)DiskCount, (DiskCount == 1) ? "": "s");
TRACE("BIOS reports %d harddisk%s\n",
(int)DiskCount, (DiskCount == 1) ? "": "s");
/* Allocate resource descriptor */
Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
@ -846,8 +841,7 @@ DetectSystem(VOID)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return NULL;
}
@ -874,13 +868,12 @@ DetectSystem(VOID)
Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1;
Int13Drives[i].NumberDrives = DiskCount;
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);
TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
0x80 + i,
Geometry.Cylinders - 1,
Geometry.Heads -1,
Geometry.Sectors,
Geometry.BytesPerSector);
}
}
@ -931,7 +924,7 @@ GetDiskCount(PCONFIGURATION_COMPONENT_DATA BusKey)
//
// Return number of disks
//
DPRINTM(DPRINT_HWDETECT, "Retrieving %lu INT13 disks\\0\n", DiskCount);
TRACE("Retrieving %lu INT13 disks\\0\n", DiskCount);
return DiskCount;
};
@ -954,7 +947,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey)
NULL,
0,
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
TRACE("Created key: DiskController\\0\n");
/* Create and fill subkey for each harddisk */
for (i = 0; i < DiskCount; i++)
@ -998,7 +991,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey)
/* Read the MBR */
if (!MachDiskReadLogicalSectors(FrldrBootDrive, 16ULL, 1, (PVOID)DISKREADBUFFER))
{
DPRINTM(DPRINT_HWDETECT, "Reading MBR failed\n");
ERR("Reading MBR failed\n");
return;
}
@ -1007,7 +1000,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey)
/* Calculate the MBR checksum */
for (i = 0; i < 2048 / sizeof(ULONG); i++) Checksum += Buffer[i];
Checksum = ~Checksum + 1;
DPRINTM(DPRINT_HWDETECT, "Checksum: %x\n", Checksum);
TRACE("Checksum: %x\n", Checksum);
/* Fill out the ARC disk block */
reactos_arc_disk_info[reactos_disk_count].CheckSum = Checksum;
@ -1084,8 +1077,7 @@ DetectSerialMouse(PUCHAR Port)
Buffer[i] = READ_PORT_UCHAR(Port);
}
DPRINTM(DPRINT_HWDETECT,
"Mouse data: %x %x %x %x\n",
TRACE("Mouse data: %x %x %x %x\n",
Buffer[0],Buffer[1],Buffer[2],Buffer[3]);
/* Check that four bytes for signs */
@ -1110,19 +1102,16 @@ DetectSerialMouse(PUCHAR Port)
switch (Buffer[i + 1])
{
case '3':
DPRINTM(DPRINT_HWDETECT,
"Microsoft Mouse with 3-buttons detected\n");
TRACE("Microsoft Mouse with 3-buttons detected\n");
return MOUSE_TYPE_LOGITECH;
case 'Z':
DPRINTM(DPRINT_HWDETECT,
"Microsoft Wheel Mouse detected\n");
TRACE("Microsoft Wheel Mouse detected\n");
return MOUSE_TYPE_WHEELZ;
/* case '2': */
default:
DPRINTM(DPRINT_HWDETECT,
"Microsoft Mouse with 2-buttons detected\n");
TRACE("Microsoft Mouse with 2-buttons detected\n");
return MOUSE_TYPE_MICROSOFT;
}
}
@ -1206,8 +1195,7 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
ULONG j;
ULONG k;
DPRINTM(DPRINT_HWDETECT,
"DetectSerialPointerPeripheral()\n");
TRACE("DetectSerialPointerPeripheral()\n");
Identifier[0] = 0;
@ -1217,9 +1205,7 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
if (MouseType != MOUSE_TYPE_NONE)
{
Length = GetSerialMousePnpId(Base, Buffer);
DPRINTM(DPRINT_HWDETECT,
"PnP ID length: %u\n",
Length);
TRACE( "PnP ID length: %u\n", Length);
if (Length != 0)
{
@ -1231,9 +1217,7 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
}
Buffer[Length] = 0;
DPRINTM(DPRINT_HWDETECT,
"PnP ID string: %s\n",
Buffer);
TRACE("PnP ID string: %s\n", Buffer);
/* Copy PnpId string */
for (i = 0; i < 7; i++)
@ -1304,9 +1288,7 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
}
}
DPRINTM(DPRINT_HWDETECT,
"Identifier string: %s\n",
Identifier);
TRACE("Identifier string: %s\n", Identifier);
}
if (Length == 0 || strlen(Identifier) < 11)
@ -1314,19 +1296,16 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
switch (MouseType)
{
case MOUSE_TYPE_LOGITECH:
strcpy (Identifier,
"LOGITECH SERIAL MOUSE");
strcpy(Identifier, "LOGITECH SERIAL MOUSE");
break;
case MOUSE_TYPE_WHEELZ:
strcpy (Identifier,
"MICROSOFT SERIAL MOUSE WITH WHEEL");
strcpy(Identifier, "MICROSOFT SERIAL MOUSE WITH WHEEL");
break;
case MOUSE_TYPE_MICROSOFT:
default:
strcpy (Identifier,
"MICROSOFT SERIAL MOUSE");
strcpy(Identifier, "MICROSOFT SERIAL MOUSE");
break;
}
}
@ -1350,8 +1329,7 @@ DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey,
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR),
&PeripheralKey);
DPRINTM(DPRINT_HWDETECT,
"Created key: PointerPeripheral\\0\n");
TRACE("Created key: PointerPeripheral\\0\n");
}
}
@ -1371,7 +1349,7 @@ DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
ULONG i;
ULONG Size;
DPRINTM(DPRINT_HWDETECT, "DetectSerialPorts()\n");
TRACE("DetectSerialPorts()\n");
ControllerNumber = 0;
BasePtr = (PUSHORT)0x400;
@ -1381,10 +1359,7 @@ DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
if (Base == 0)
continue;
DPRINTM(DPRINT_HWDETECT,
"Found COM%u port at 0x%x\n",
i + 1,
Base);
TRACE("Found COM%u port at 0x%x\n", i + 1, Base);
/* Set 'Identifier' value */
sprintf(Buffer, "COM%ld", i + 1);
@ -1396,8 +1371,7 @@ DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
continue;
}
memset(PartialResourceList, 0, Size);
@ -1475,7 +1449,7 @@ DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
ULONG i;
ULONG Size;
DPRINTM(DPRINT_HWDETECT, "DetectParallelPorts() called\n");
TRACE("DetectParallelPorts() called\n");
ControllerNumber = 0;
BasePtr = (PUSHORT)0x408;
@ -1485,10 +1459,7 @@ DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
if (Base == 0)
continue;
DPRINTM(DPRINT_HWDETECT,
"Parallel port %u: %x\n",
ControllerNumber,
Base);
TRACE("Parallel port %u: %x\n", ControllerNumber, Base);
/* Set 'Identifier' value */
sprintf(Buffer, "PARALLEL%ld", i + 1);
@ -1501,8 +1472,7 @@ DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
continue;
}
memset(PartialResourceList, 0, Size);
@ -1550,7 +1520,7 @@ DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey)
ControllerNumber++;
}
DPRINTM(DPRINT_HWDETECT, "DetectParallelPorts() done\n");
TRACE("DetectParallelPorts() done\n");
}
@ -1643,8 +1613,7 @@ DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}
@ -1677,7 +1646,7 @@ DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey)
PartialResourceList,
Size,
&PeripheralKey);
DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardPeripheral\\0\n");
TRACE("Created key: KeyboardPeripheral\\0\n");
MmHeapFree(PartialResourceList);
}
@ -1698,8 +1667,7 @@ DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}
@ -1747,7 +1715,7 @@ DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
PartialResourceList,
Size,
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardController\\0\n");
TRACE("Created key: KeyboardController\\0\n");
MmHeapFree(PartialResourceList);
@ -1873,7 +1841,7 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
if (DetectPS2AuxPort())
{
DPRINTM(DPRINT_HWDETECT, "Detected PS2 port\n");
TRACE("Detected PS2 port\n");
memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
@ -1901,11 +1869,11 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
&PartialResourceList,
sizeof(CM_PARTIAL_RESOURCE_LIST),
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: PointerController\\0\n");
TRACE("Created key: PointerController\\0\n");
if (DetectPS2AuxDevice())
{
DPRINTM(DPRINT_HWDETECT, "Detected PS2 mouse\n");
TRACE("Detected PS2 mouse\n");
/* Initialize resource descriptor */
memset(&PartialResourceList, 0, sizeof(CM_PARTIAL_RESOURCE_LIST));
@ -1925,7 +1893,7 @@ DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey)
sizeof(CM_PARTIAL_RESOURCE_LIST) -
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR),
&PeripheralKey);
DPRINTM(DPRINT_HWDETECT, "Created key: PointerPeripheral\\0\n");
TRACE("Created key: PointerPeripheral\\0\n");
}
}
}
@ -1943,26 +1911,22 @@ DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
VesaVersion = BiosIsVesaSupported();
if (VesaVersion != 0)
{
DPRINTM(DPRINT_HWDETECT,
"VESA version %c.%c\n",
(VesaVersion >> 8) + '0',
(VesaVersion & 0xFF) + '0');
TRACE("VESA version %c.%c\n",
(VesaVersion >> 8) + '0',
(VesaVersion & 0xFF) + '0');
}
else
{
DPRINTM(DPRINT_HWDETECT,
"VESA not supported\n");
TRACE("VESA not supported\n");
}
if (VesaVersion >= 0x0200)
{
strcpy(Buffer,
"VBE Display");
strcpy(Buffer, "VBE Display");
}
else
{
strcpy(Buffer,
"VGA Display");
strcpy(Buffer, "VGA Display");
}
FldrCreateComponentKey(BusKey,
@ -1975,7 +1939,7 @@ DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
NULL,
0,
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: DisplayController\\0\n");
TRACE("Created key: DisplayController\\0\n");
/* FIXME: Add display peripheral (monitor) data */
}
@ -1997,8 +1961,7 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}
@ -2047,7 +2010,7 @@ PcHwDetect(VOID)
PCONFIGURATION_COMPONENT_DATA SystemKey;
ULONG BusNumber = 0;
DPRINTM(DPRINT_HWDETECT, "DetectHardware()\n");
TRACE("DetectHardware()\n");
/* Create the 'System' key */
SystemKey = DetectSystem();
@ -2059,7 +2022,7 @@ PcHwDetect(VOID)
DetectIsaBios(SystemKey, &BusNumber);
DetectAcpiBios(SystemKey, &BusNumber);
DPRINTM(DPRINT_HWDETECT, "DetectHardware() Done\n");
TRACE("DetectHardware() Done\n");
return SystemKey;
}

View file

@ -21,6 +21,8 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(HWDETECT);
BOOLEAN AcpiPresent = FALSE;
static PRSDP_DESCRIPTOR
@ -34,7 +36,7 @@ FindAcpiBios(VOID)
{
if (!memcmp(Ptr, "RSD PTR ", 8))
{
DPRINTM(DPRINT_HWDETECT, "ACPI supported\n");
TRACE("ACPI supported\n");
return (PRSDP_DESCRIPTOR)Ptr;
}
@ -42,7 +44,7 @@ FindAcpiBios(VOID)
Ptr = (PUCHAR)((ULONG_PTR)Ptr + 0x10);
}
DPRINTM(DPRINT_HWDETECT, "ACPI not supported\n");
TRACE("ACPI not supported\n");
return NULL;
}
@ -81,8 +83,7 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}
@ -103,7 +104,7 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
memcpy(AcpiBiosData->MemoryMap, BiosMemoryMap,
BiosMemoryMapEntryCount * sizeof(BIOS_MEMORY_MAP));
DPRINTM(DPRINT_HWDETECT, "RSDT %p, data size %x\n", Rsdp->rsdt_physical_address,
TRACE("RSDT %p, data size %x\n", Rsdp->rsdt_physical_address,
TableSize);
/* Create new bus key */

View file

@ -23,6 +23,8 @@
#define NDEBUG
#include <debug.h>
DBG_DEFAULT_CHANNEL(HWDETECT);
static BOOLEAN
FindApmBios(VOID)
{
@ -37,17 +39,17 @@ FindApmBios(VOID)
if (INT386_SUCCESS(RegsOut))
{
DPRINTM(DPRINT_HWDETECT, "Found APM BIOS\n");
DPRINTM(DPRINT_HWDETECT, "AH: %x\n", RegsOut.b.ah);
DPRINTM(DPRINT_HWDETECT, "AL: %x\n", RegsOut.b.al);
DPRINTM(DPRINT_HWDETECT, "BH: %x\n", RegsOut.b.bh);
DPRINTM(DPRINT_HWDETECT, "BL: %x\n", RegsOut.b.bl);
DPRINTM(DPRINT_HWDETECT, "CX: %x\n", RegsOut.w.cx);
TRACE("Found APM BIOS\n");
TRACE("AH: %x\n", RegsOut.b.ah);
TRACE("AL: %x\n", RegsOut.b.al);
TRACE("BH: %x\n", RegsOut.b.bh);
TRACE("BL: %x\n", RegsOut.b.bl);
TRACE("CX: %x\n", RegsOut.w.cx);
return TRUE;
}
DPRINTM(DPRINT_HWDETECT, "No APM BIOS found\n");
TRACE("No APM BIOS found\n");
return FALSE;
}

View file

@ -23,6 +23,8 @@
#define NDEBUG
#include <debug.h>
DBG_DEFAULT_CHANNEL(HWDETECT);
static PPCI_IRQ_ROUTING_TABLE
GetPciIrqRoutingTable(VOID)
{
@ -36,8 +38,7 @@ GetPciIrqRoutingTable(VOID)
{
if (Table->Signature == 'RIP$')
{
DPRINTM(DPRINT_HWDETECT,
"Found signature\n");
TRACE("Found signature\n");
Ptr = (PUCHAR)Table;
Sum = 0;
@ -48,13 +49,11 @@ GetPciIrqRoutingTable(VOID)
if ((Sum & 0xFF) != 0)
{
DPRINTM(DPRINT_HWDETECT,
"Invalid routing table\n");
ERR("Invalid routing table\n");
return NULL;
}
DPRINTM(DPRINT_HWDETECT,
"Valid checksum\n");
TRACE("Valid checksum\n");
return Table;
}
@ -79,12 +78,12 @@ FindPciBios(PPCI_REGISTRY_INFO BusData)
if (INT386_SUCCESS(RegsOut) && RegsOut.d.edx == 0x20494350 && RegsOut.b.ah == 0)
{
DPRINTM(DPRINT_HWDETECT, "Found PCI bios\n");
TRACE("Found PCI bios\n");
DPRINTM(DPRINT_HWDETECT, "AL: %x\n", RegsOut.b.al);
DPRINTM(DPRINT_HWDETECT, "BH: %x\n", RegsOut.b.bh);
DPRINTM(DPRINT_HWDETECT, "BL: %x\n", RegsOut.b.bl);
DPRINTM(DPRINT_HWDETECT, "CL: %x\n", RegsOut.b.cl);
TRACE("AL: %x\n", RegsOut.b.al);
TRACE("BH: %x\n", RegsOut.b.bh);
TRACE("BL: %x\n", RegsOut.b.bl);
TRACE("CL: %x\n", RegsOut.b.cl);
BusData->NoBuses = RegsOut.b.cl + 1;
BusData->MajorRevision = RegsOut.b.bh;
@ -95,7 +94,7 @@ FindPciBios(PPCI_REGISTRY_INFO BusData)
}
DPRINTM(DPRINT_HWDETECT, "No PCI bios found\n");
TRACE("No PCI bios found\n");
return FALSE;
}
@ -113,7 +112,7 @@ DetectPciIrqRoutingTable(PCONFIGURATION_COMPONENT_DATA BusKey)
Table = GetPciIrqRoutingTable();
if (Table != NULL)
{
DPRINTM(DPRINT_HWDETECT, "Table size: %u\n", Table->TableSize);
TRACE("Table size: %u\n", Table->TableSize);
/* Set 'Configuration Data' value */
Size = FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors) +
@ -121,8 +120,7 @@ DetectPciIrqRoutingTable(PCONFIGURATION_COMPONENT_DATA BusKey)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}
@ -182,8 +180,7 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}
@ -223,8 +220,7 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
PartialResourceList = MmHeapAlloc(Size);
if (!PartialResourceList)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}
@ -249,8 +245,7 @@ DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
PartialResourceList = MmHeapAlloc(Size);
if (!PartialResourceList)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}

View file

@ -22,6 +22,8 @@
#define NDEBUG
#include <debug.h>
DBG_DEFAULT_CHANNEL(DISK);
/////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
/////////////////////////////////////////////////////////////////////////////////////////////
@ -31,7 +33,7 @@ BOOLEAN DiskResetController(UCHAR DriveNumber)
REGS RegsIn;
REGS RegsOut;
DPRINTM(DPRINT_DISK, "DiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber);
WARN("DiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber);
// BIOS Int 13h, function 0 - Reset disk system
// AH = 00h
@ -56,11 +58,11 @@ BOOLEAN DiskInt13ExtensionsSupported(UCHAR DriveNumber)
REGS RegsIn;
REGS RegsOut;
DPRINTM(DPRINT_DISK, "PcDiskInt13ExtensionsSupported()\n");
TRACE("PcDiskInt13ExtensionsSupported()\n");
if (DriveNumber == LastDriveNumber)
{
DPRINTM(DPRINT_DISK, "Using cached value %s for drive 0x%x\n", LastSupported ? "TRUE" : "FALSE", DriveNumber);
TRACE("Using cached value %s for drive 0x%x\n", LastSupported ? "TRUE" : "FALSE", DriveNumber);
return LastSupported;
}
@ -147,7 +149,7 @@ BOOLEAN DiskGetExtendedDriveParameters(UCHAR DriveNumber, PVOID Buffer, USHORT B
REGS RegsOut;
PUSHORT Ptr = (PUSHORT)(BIOSCALLBUFFER);
DPRINTM(DPRINT_DISK, "DiskGetExtendedDriveParameters()\n");
TRACE("DiskGetExtendedDriveParameters()\n");
if (!DiskInt13ExtensionsSupported(DriveNumber))
return FALSE;
@ -181,34 +183,34 @@ BOOLEAN DiskGetExtendedDriveParameters(UCHAR DriveNumber, PVOID Buffer, USHORT B
memcpy(Buffer, Ptr, BufferSize);
#if DBG
DPRINTM(DPRINT_DISK, "size of buffer: %x\n", Ptr[0]);
DPRINTM(DPRINT_DISK, "information flags: %x\n", Ptr[1]);
DPRINTM(DPRINT_DISK, "number of physical cylinders on drive: %u\n", *(PULONG)&Ptr[2]);
DPRINTM(DPRINT_DISK, "number of physical heads on drive: %u\n", *(PULONG)&Ptr[4]);
DPRINTM(DPRINT_DISK, "number of physical sectors per track: %u\n", *(PULONG)&Ptr[6]);
DPRINTM(DPRINT_DISK, "total number of sectors on drive: %I64u\n", *(unsigned long long*)&Ptr[8]);
DPRINTM(DPRINT_DISK, "bytes per sector: %u\n", Ptr[12]);
TRACE("size of buffer: %x\n", Ptr[0]);
TRACE("information flags: %x\n", Ptr[1]);
TRACE("number of physical cylinders on drive: %u\n", *(PULONG)&Ptr[2]);
TRACE("number of physical heads on drive: %u\n", *(PULONG)&Ptr[4]);
TRACE("number of physical sectors per track: %u\n", *(PULONG)&Ptr[6]);
TRACE("total number of sectors on drive: %I64u\n", *(unsigned long long*)&Ptr[8]);
TRACE("bytes per sector: %u\n", Ptr[12]);
if (Ptr[0] >= 0x1e)
{
DPRINTM(DPRINT_DISK, "EED configuration parameters: %x:%x\n", Ptr[13], Ptr[14]);
TRACE("EED configuration parameters: %x:%x\n", Ptr[13], Ptr[14]);
if (Ptr[13] != 0xffff && Ptr[14] != 0xffff)
{
PUCHAR SpecPtr = (PUCHAR)(ULONG_PTR)((Ptr[13] << 4) + Ptr[14]);
DPRINTM(DPRINT_DISK, "SpecPtr: %x\n", SpecPtr);
DPRINTM(DPRINT_DISK, "physical I/O port base address: %x\n", *(PUSHORT)&SpecPtr[0]);
DPRINTM(DPRINT_DISK, "disk-drive control port address: %x\n", *(PUSHORT)&SpecPtr[2]);
DPRINTM(DPRINT_DISK, "drive flags: %x\n", SpecPtr[4]);
DPRINTM(DPRINT_DISK, "proprietary information: %x\n", SpecPtr[5]);
DPRINTM(DPRINT_DISK, "IRQ for drive: %u\n", SpecPtr[6]);
DPRINTM(DPRINT_DISK, "sector count for multi-sector transfers: %u\n", SpecPtr[7]);
DPRINTM(DPRINT_DISK, "DMA control: %x\n", SpecPtr[8]);
DPRINTM(DPRINT_DISK, "programmed I/O control: %x\n", SpecPtr[9]);
DPRINTM(DPRINT_DISK, "drive options: %x\n", *(PUSHORT)&SpecPtr[10]);
TRACE("SpecPtr: %x\n", SpecPtr);
TRACE("physical I/O port base address: %x\n", *(PUSHORT)&SpecPtr[0]);
TRACE("disk-drive control port address: %x\n", *(PUSHORT)&SpecPtr[2]);
TRACE("drive flags: %x\n", SpecPtr[4]);
TRACE("proprietary information: %x\n", SpecPtr[5]);
TRACE("IRQ for drive: %u\n", SpecPtr[6]);
TRACE("sector count for multi-sector transfers: %u\n", SpecPtr[7]);
TRACE("DMA control: %x\n", SpecPtr[8]);
TRACE("programmed I/O control: %x\n", SpecPtr[9]);
TRACE("drive options: %x\n", *(PUSHORT)&SpecPtr[10]);
}
}
if (Ptr[0] >= 0x42)
{
DPRINTM(DPRINT_DISK, "signature: %x\n", Ptr[15]);
TRACE("signature: %x\n", Ptr[15]);
}
#endif

View file

@ -22,6 +22,8 @@
#define NDEBUG
#include <debug.h>
DBG_DEFAULT_CHANNEL(UI);
#include <pshpack2.h>
typedef struct
{
@ -164,7 +166,7 @@ USHORT BiosIsVesaSupported(VOID)
//USHORT* VideoModes;
//USHORT Index;
DPRINTM(DPRINT_UI, "BiosIsVesaSupported()\n");
TRACE("BiosIsVesaSupported()\n");
RtlZeroMemory(SvgaInfo, sizeof(VESA_SVGA_INFO));
@ -198,42 +200,42 @@ USHORT BiosIsVesaSupported(VOID)
Regs.w.di = BIOSCALLBUFOFFSET;
Int386(0x10, &Regs, &Regs);
DPRINTM(DPRINT_UI, "AL = 0x%x\n", Regs.b.al);
DPRINTM(DPRINT_UI, "AH = 0x%x\n", Regs.b.ah);
TRACE("AL = 0x%x\n", Regs.b.al);
TRACE("AH = 0x%x\n", Regs.b.ah);
if (Regs.w.ax != 0x004F)
{
DPRINTM(DPRINT_UI, "Failed.\n");
TRACE("Failed.\n");
return 0x0000;
}
DPRINTM(DPRINT_UI, "Supported.\n");
DPRINTM(DPRINT_UI, "SvgaInfo->Signature[4] = %c%c%c%c\n", SvgaInfo->Signature[0], SvgaInfo->Signature[1], SvgaInfo->Signature[2], SvgaInfo->Signature[3]);
DPRINTM(DPRINT_UI, "SvgaInfo->VesaVersion = v%d.%d\n", ((SvgaInfo->VesaVersion >> 8) & 0xFF), (SvgaInfo->VesaVersion & 0xFF));
DPRINTM(DPRINT_UI, "SvgaInfo->OemNamePtr = 0x%x\n", SvgaInfo->OemNamePtr);
DPRINTM(DPRINT_UI, "SvgaInfo->Capabilities = 0x%x\n", SvgaInfo->Capabilities);
DPRINTM(DPRINT_UI, "SvgaInfo->VideoMemory = %dK\n", SvgaInfo->TotalVideoMemory * 64);
DPRINTM(DPRINT_UI, "---VBE v2.0 ---\n");
DPRINTM(DPRINT_UI, "SvgaInfo->OemSoftwareVersion = v%d.%d\n", ((SvgaInfo->OemSoftwareVersion >> 8) & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 12) & 0x0F) * 10), (SvgaInfo->OemSoftwareVersion & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 4) & 0x0F) * 10));
DPRINTM(DPRINT_UI, "SvgaInfo->VendorNamePtr = 0x%x\n", SvgaInfo->VendorNamePtr);
DPRINTM(DPRINT_UI, "SvgaInfo->ProductNamePtr = 0x%x\n", SvgaInfo->ProductNamePtr);
DPRINTM(DPRINT_UI, "SvgaInfo->ProductRevisionStringPtr = 0x%x\n", SvgaInfo->ProductRevisionStringPtr);
DPRINTM(DPRINT_UI, "SvgaInfo->VBE/AF Version = 0x%x (BCD WORD)\n", SvgaInfo->VBE_AF_Version);
TRACE("Supported.\n");
TRACE("SvgaInfo->Signature[4] = %c%c%c%c\n", SvgaInfo->Signature[0], SvgaInfo->Signature[1], SvgaInfo->Signature[2], SvgaInfo->Signature[3]);
TRACE("SvgaInfo->VesaVersion = v%d.%d\n", ((SvgaInfo->VesaVersion >> 8) & 0xFF), (SvgaInfo->VesaVersion & 0xFF));
TRACE("SvgaInfo->OemNamePtr = 0x%x\n", SvgaInfo->OemNamePtr);
TRACE("SvgaInfo->Capabilities = 0x%x\n", SvgaInfo->Capabilities);
TRACE("SvgaInfo->VideoMemory = %dK\n", SvgaInfo->TotalVideoMemory * 64);
TRACE("---VBE v2.0 ---\n");
TRACE("SvgaInfo->OemSoftwareVersion = v%d.%d\n", ((SvgaInfo->OemSoftwareVersion >> 8) & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 12) & 0x0F) * 10), (SvgaInfo->OemSoftwareVersion & 0x0F) + (((SvgaInfo->OemSoftwareVersion >> 4) & 0x0F) * 10));
TRACE("SvgaInfo->VendorNamePtr = 0x%x\n", SvgaInfo->VendorNamePtr);
TRACE("SvgaInfo->ProductNamePtr = 0x%x\n", SvgaInfo->ProductNamePtr);
TRACE("SvgaInfo->ProductRevisionStringPtr = 0x%x\n", SvgaInfo->ProductRevisionStringPtr);
TRACE("SvgaInfo->VBE/AF Version = 0x%x (BCD WORD)\n", SvgaInfo->VBE_AF_Version);
//DPRINTM(DPRINT_UI, "\nSupported VESA and OEM video modes:\n");
//TRACE("\nSupported VESA and OEM video modes:\n");
//VideoModes = (USHORT*)SvgaInfo->SupportedModeListPtr;
//for (Index=0; VideoModes[Index]!=0xFFFF; Index++)
//{
// DPRINTM(DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]);
// TRACE("Mode %d: 0x%x\n", Index, VideoModes[Index]);
//}
//if (SvgaInfo->VesaVersion >= 0x0200)
//{
// DPRINTM(DPRINT_UI, "\nSupported accelerated video modes (VESA v2.0):\n");
// TRACE("\nSupported accelerated video modes (VESA v2.0):\n");
// VideoModes = (USHORT*)SvgaInfo->AcceleratedModeListPtr;
// for (Index=0; VideoModes[Index]!=0xFFFF; Index++)
// {
// DPRINTM(DPRINT_UI, "Mode %d: 0x%x\n", Index, VideoModes[Index]);
// TRACE("Mode %d: 0x%x\n", Index, VideoModes[Index]);
// }
//}

View file

@ -22,6 +22,8 @@
#define NDEBUG
#include <debug.h>
DBG_DEFAULT_CHANNEL(DISK);
#include <pshpack2.h>
typedef struct
{
@ -47,7 +49,7 @@ static BOOLEAN PcDiskResetController(UCHAR DriveNumber)
REGS RegsIn;
REGS RegsOut;
DPRINTM(DPRINT_DISK, "PcDiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber);
WARN("PcDiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber);
// BIOS Int 13h, function 0 - Reset disk system
// AH = 00h
@ -72,7 +74,7 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(UCHAR DriveNumber, ULONGLONG SectorNu
ULONG RetryCount;
PI386_DISK_ADDRESS_PACKET Packet = (PI386_DISK_ADDRESS_PACKET)(BIOSCALLBUFFER);
DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
TRACE("PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
ASSERT(((ULONG_PTR)Buffer) <= 0xFFFFF);
// BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ
@ -125,7 +127,7 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(UCHAR DriveNumber, ULONGLONG SectorNu
}
// If we get here then the read failed
DiskError("Disk Read Failed in LBA mode", RegsOut.b.ah);
ERR("Disk Read Failed in LBA mode", RegsOut.b.ah);
return FALSE;
}
@ -141,7 +143,7 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(UCHAR DriveNumber, ULONGLONG SectorNu
REGS RegsOut;
ULONG RetryCount;
DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsCHS()\n");
TRACE("PcDiskReadLogicalSectorsCHS()\n");
//
// Get the drive geometry
@ -249,7 +251,7 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(UCHAR DriveNumber, ULONGLONG SectorNu
// If we retried 3 times then fail
if (RetryCount >= 3)
{
DiskError("Disk Read Failed in CHS mode, after retrying 3 times", RegsOut.b.ah);
ERR("Disk Read Failed in CHS mode, after retrying 3 times", RegsOut.b.ah);
return FALSE;
}
@ -270,7 +272,7 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(UCHAR DriveNumber, ULONGLONG SectorNu
BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{
DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
TRACE("PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
//
// Check to see if it is a fixed disk drive
@ -279,7 +281,7 @@ BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULON
//
if ((DriveNumber >= 0x80) && DiskInt13ExtensionsSupported(DriveNumber))
{
DPRINTM(DPRINT_DISK, "Using Int 13 Extensions for read. DiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, DiskInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE");
TRACE("Using Int 13 Extensions for read. DiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, DiskInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE");
//
// LBA is easy, nothing to calculate
@ -303,7 +305,7 @@ PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
REGS RegsOut;
ULONG Cylinders;
DPRINTM(DPRINT_DISK, "DiskGetDriveGeometry()\n");
TRACE("DiskGetDriveGeometry()\n");
/* BIOS Int 13h, function 08h - Get drive parameters
* AH = 08h

View file

@ -25,6 +25,8 @@
#define NDEBUG
#include <debug.h>
DBG_DEFAULT_CHANNEL(MEMORY);
static ULONG
PcMemGetExtendedMemorySize(VOID)
{
@ -32,7 +34,7 @@ PcMemGetExtendedMemorySize(VOID)
REGS RegsOut;
ULONG MemorySize;
DPRINTM(DPRINT_MEMORY, "GetExtendedMemorySize()\n");
TRACE("GetExtendedMemorySize()\n");
/* Int 15h AX=E801h
* Phoenix BIOS v4.0 - GET MEMORY SIZE FOR >64M CONFIGURATIONS
@ -49,12 +51,12 @@ PcMemGetExtendedMemorySize(VOID)
RegsIn.w.ax = 0xE801;
Int386(0x15, &RegsIn, &RegsOut);
DPRINTM(DPRINT_MEMORY, "Int15h AX=E801h\n");
DPRINTM(DPRINT_MEMORY, "AX = 0x%x\n", RegsOut.w.ax);
DPRINTM(DPRINT_MEMORY, "BX = 0x%x\n", RegsOut.w.bx);
DPRINTM(DPRINT_MEMORY, "CX = 0x%x\n", RegsOut.w.cx);
DPRINTM(DPRINT_MEMORY, "DX = 0x%x\n", RegsOut.w.dx);
DPRINTM(DPRINT_MEMORY, "CF set = %s\n\n", (RegsOut.x.eflags & EFLAGS_CF) ? "TRUE" : "FALSE");
TRACE("Int15h AX=E801h\n");
TRACE("AX = 0x%x\n", RegsOut.w.ax);
TRACE("BX = 0x%x\n", RegsOut.w.bx);
TRACE("CX = 0x%x\n", RegsOut.w.cx);
TRACE("DX = 0x%x\n", RegsOut.w.dx);
TRACE("CF set = %s\n\n", (RegsOut.x.eflags & EFLAGS_CF) ? "TRUE" : "FALSE");
if (INT386_SUCCESS(RegsOut))
{
@ -93,9 +95,9 @@ PcMemGetExtendedMemorySize(VOID)
RegsIn.b.ah = 0x88;
Int386(0x15, &RegsIn, &RegsOut);
DPRINTM(DPRINT_MEMORY, "Int15h AH=88h\n");
DPRINTM(DPRINT_MEMORY, "AX = 0x%x\n", RegsOut.w.ax);
DPRINTM(DPRINT_MEMORY, "CF set = %s\n\n", (RegsOut.x.eflags & EFLAGS_CF) ? "TRUE" : "FALSE");
TRACE("Int15h AH=88h\n");
TRACE("AX = 0x%x\n", RegsOut.w.ax);
TRACE("CF set = %s\n\n", (RegsOut.x.eflags & EFLAGS_CF) ? "TRUE" : "FALSE");
if (INT386_SUCCESS(RegsOut) && RegsOut.w.ax != 0)
{
@ -110,8 +112,8 @@ PcMemGetExtendedMemorySize(VOID)
MemorySize = (MemorySize & 0xFFFF);
MemorySize = (MemorySize << 8);
DPRINTM(DPRINT_MEMORY, "Int15h Failed\n");
DPRINTM(DPRINT_MEMORY, "CMOS reports: 0x%x\n", MemorySize);
TRACE("Int15h Failed\n");
TRACE("CMOS reports: 0x%x\n", MemorySize);
return MemorySize;
}
@ -121,7 +123,7 @@ PcMemGetConventionalMemorySize(VOID)
{
REGS Regs;
DPRINTM(DPRINT_MEMORY, "GetConventionalMemorySize()\n");
TRACE("GetConventionalMemorySize()\n");
/* Int 12h
* BIOS - GET MEMORY SIZE
@ -135,8 +137,8 @@ PcMemGetConventionalMemorySize(VOID)
Regs.w.ax = 0;
Int386(0x12, &Regs, &Regs);
DPRINTM(DPRINT_MEMORY, "Int12h\n");
DPRINTM(DPRINT_MEMORY, "AX = 0x%x\n\n", Regs.w.ax);
TRACE("Int12h\n");
TRACE("AX = 0x%x\n\n", Regs.w.ax);
return (ULONG)Regs.w.ax;
}
@ -147,7 +149,7 @@ PcMemGetBiosMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
REGS Regs;
ULONG MapCount;
DPRINTM(DPRINT_MEMORY, "GetBiosMemoryMap()\n");
TRACE("GetBiosMemoryMap()\n");
/* Int 15h AX=E820h
* Newer BIOSes - GET SYSTEM MEMORY MAP
@ -177,12 +179,12 @@ PcMemGetBiosMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
{
Int386(0x15, &Regs, &Regs);
DPRINTM(DPRINT_MEMORY, "Memory Map Entry %d\n", MapCount);
DPRINTM(DPRINT_MEMORY, "Int15h AX=E820h\n");
DPRINTM(DPRINT_MEMORY, "EAX = 0x%x\n", Regs.x.eax);
DPRINTM(DPRINT_MEMORY, "EBX = 0x%x\n", Regs.x.ebx);
DPRINTM(DPRINT_MEMORY, "ECX = 0x%x\n", Regs.x.ecx);
DPRINTM(DPRINT_MEMORY, "CF set = %s\n", (Regs.x.eflags & EFLAGS_CF) ? "TRUE" : "FALSE");
TRACE("Memory Map Entry %d\n", MapCount);
TRACE("Int15h AX=E820h\n");
TRACE("EAX = 0x%x\n", Regs.x.eax);
TRACE("EBX = 0x%x\n", Regs.x.ebx);
TRACE("ECX = 0x%x\n", Regs.x.ecx);
TRACE("CF set = %s\n", (Regs.x.eflags & EFLAGS_CF) ? "TRUE" : "FALSE");
/* If the BIOS didn't return 'SMAP' in EAX then
* it doesn't support this call */
@ -194,11 +196,11 @@ PcMemGetBiosMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
/* Copy data to caller's buffer */
RtlCopyMemory(&BiosMemoryMap[MapCount], (PVOID)BIOSCALLBUFFER, Regs.x.ecx);
DPRINTM(DPRINT_MEMORY, "BaseAddress: 0x%p\n", (PVOID)(ULONG_PTR)BiosMemoryMap[MapCount].BaseAddress);
DPRINTM(DPRINT_MEMORY, "Length: 0x%p\n", (PVOID)(ULONG_PTR)BiosMemoryMap[MapCount].Length);
DPRINTM(DPRINT_MEMORY, "Type: 0x%x\n", BiosMemoryMap[MapCount].Type);
DPRINTM(DPRINT_MEMORY, "Reserved: 0x%x\n", BiosMemoryMap[MapCount].Reserved);
DPRINTM(DPRINT_MEMORY, "\n");
TRACE("BaseAddress: 0x%p\n", (PVOID)(ULONG_PTR)BiosMemoryMap[MapCount].BaseAddress);
TRACE("Length: 0x%p\n", (PVOID)(ULONG_PTR)BiosMemoryMap[MapCount].Length);
TRACE("Type: 0x%x\n", BiosMemoryMap[MapCount].Type);
TRACE("Reserved: 0x%x\n", BiosMemoryMap[MapCount].Reserved);
TRACE("\n");
/* If the continuation value is zero or the
* carry flag is set then this was
@ -206,7 +208,7 @@ PcMemGetBiosMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
if (Regs.x.ebx == 0x00000000 || !INT386_SUCCESS(Regs))
{
MapCount++;
DPRINTM(DPRINT_MEMORY, "End Of System Memory Map!\n\n");
TRACE("End Of System Memory Map!\n\n");
break;
}

View file

@ -51,6 +51,8 @@
#define VERTRES_350_SCANLINES 0x01
#define VERTRES_400_SCANLINES 0x02
DBG_DEFAULT_CHANNEL(UI);
#include <pshpack2.h>
typedef struct
{
@ -476,37 +478,37 @@ PcVideoVesaGetSVGAModeInformation(USHORT Mode, PSVGA_MODE_INFORMATION ModeInform
RtlCopyMemory(ModeInformation, (PVOID)BIOSCALLBUFFER, sizeof(SVGA_MODE_INFORMATION));
DPRINTM(DPRINT_UI, "\n");
DPRINTM(DPRINT_UI, "BiosVesaGetSVGAModeInformation() mode 0x%x\n", Mode);
DPRINTM(DPRINT_UI, "ModeAttributes = 0x%x\n", ModeInformation->ModeAttributes);
DPRINTM(DPRINT_UI, "WindowAttributesA = 0x%x\n", ModeInformation->WindowAttributesA);
DPRINTM(DPRINT_UI, "WindowAttributesB = 0x%x\n", ModeInformation->WindowsAttributesB);
DPRINTM(DPRINT_UI, "WindowGranularity = %dKB\n", ModeInformation->WindowGranularity);
DPRINTM(DPRINT_UI, "WindowSize = %dKB\n", ModeInformation->WindowSize);
DPRINTM(DPRINT_UI, "WindowAStartSegment = 0x%x\n", ModeInformation->WindowAStartSegment);
DPRINTM(DPRINT_UI, "WindowBStartSegment = 0x%x\n", ModeInformation->WindowBStartSegment);
DPRINTM(DPRINT_UI, "WindowPositioningFunction = 0x%x\n", ModeInformation->WindowPositioningFunction);
DPRINTM(DPRINT_UI, "BytesPerScanLine = %d\n", ModeInformation->BytesPerScanLine);
DPRINTM(DPRINT_UI, "WidthInPixels = %d\n", ModeInformation->WidthInPixels);
DPRINTM(DPRINT_UI, "HeightInPixels = %d\n", ModeInformation->HeightInPixels);
DPRINTM(DPRINT_UI, "CharacterWidthInPixels = %d\n", ModeInformation->CharacterWidthInPixels);
DPRINTM(DPRINT_UI, "CharacterHeightInPixels = %d\n", ModeInformation->CharacterHeightInPixels);
DPRINTM(DPRINT_UI, "NumberOfMemoryPlanes = %d\n", ModeInformation->NumberOfMemoryPlanes);
DPRINTM(DPRINT_UI, "BitsPerPixel = %d\n", ModeInformation->BitsPerPixel);
DPRINTM(DPRINT_UI, "NumberOfBanks = %d\n", ModeInformation->NumberOfBanks);
DPRINTM(DPRINT_UI, "MemoryModel = %d\n", ModeInformation->MemoryModel);
DPRINTM(DPRINT_UI, "BankSize = %d\n", ModeInformation->BankSize);
DPRINTM(DPRINT_UI, "NumberOfImagePlanes = %d\n", ModeInformation->NumberOfImagePanes);
DPRINTM(DPRINT_UI, "---VBE v1.2+ ---\n");
DPRINTM(DPRINT_UI, "RedMaskSize = %d\n", ModeInformation->RedMaskSize);
DPRINTM(DPRINT_UI, "RedMaskPosition = %d\n", ModeInformation->RedMaskPosition);
DPRINTM(DPRINT_UI, "GreenMaskSize = %d\n", ModeInformation->GreenMaskSize);
DPRINTM(DPRINT_UI, "GreenMaskPosition = %d\n", ModeInformation->GreenMaskPosition);
DPRINTM(DPRINT_UI, "BlueMaskSize = %d\n", ModeInformation->BlueMaskSize);
DPRINTM(DPRINT_UI, "BlueMaskPosition = %d\n", ModeInformation->BlueMaskPosition);
DPRINTM(DPRINT_UI, "ReservedMaskSize = %d\n", ModeInformation->ReservedMaskSize);
DPRINTM(DPRINT_UI, "ReservedMaskPosition = %d\n", ModeInformation->ReservedMaskPosition);
DPRINTM(DPRINT_UI, "\n");
TRACE("\n");
TRACE("BiosVesaGetSVGAModeInformation() mode 0x%x\n", Mode);
TRACE("ModeAttributes = 0x%x\n", ModeInformation->ModeAttributes);
TRACE("WindowAttributesA = 0x%x\n", ModeInformation->WindowAttributesA);
TRACE("WindowAttributesB = 0x%x\n", ModeInformation->WindowsAttributesB);
TRACE("WindowGranularity = %dKB\n", ModeInformation->WindowGranularity);
TRACE("WindowSize = %dKB\n", ModeInformation->WindowSize);
TRACE("WindowAStartSegment = 0x%x\n", ModeInformation->WindowAStartSegment);
TRACE("WindowBStartSegment = 0x%x\n", ModeInformation->WindowBStartSegment);
TRACE("WindowPositioningFunction = 0x%x\n", ModeInformation->WindowPositioningFunction);
TRACE("BytesPerScanLine = %d\n", ModeInformation->BytesPerScanLine);
TRACE("WidthInPixels = %d\n", ModeInformation->WidthInPixels);
TRACE("HeightInPixels = %d\n", ModeInformation->HeightInPixels);
TRACE("CharacterWidthInPixels = %d\n", ModeInformation->CharacterWidthInPixels);
TRACE("CharacterHeightInPixels = %d\n", ModeInformation->CharacterHeightInPixels);
TRACE("NumberOfMemoryPlanes = %d\n", ModeInformation->NumberOfMemoryPlanes);
TRACE("BitsPerPixel = %d\n", ModeInformation->BitsPerPixel);
TRACE("NumberOfBanks = %d\n", ModeInformation->NumberOfBanks);
TRACE("MemoryModel = %d\n", ModeInformation->MemoryModel);
TRACE("BankSize = %d\n", ModeInformation->BankSize);
TRACE("NumberOfImagePlanes = %d\n", ModeInformation->NumberOfImagePanes);
TRACE("---VBE v1.2+ ---\n");
TRACE("RedMaskSize = %d\n", ModeInformation->RedMaskSize);
TRACE("RedMaskPosition = %d\n", ModeInformation->RedMaskPosition);
TRACE("GreenMaskSize = %d\n", ModeInformation->GreenMaskSize);
TRACE("GreenMaskPosition = %d\n", ModeInformation->GreenMaskPosition);
TRACE("BlueMaskSize = %d\n", ModeInformation->BlueMaskSize);
TRACE("BlueMaskPosition = %d\n", ModeInformation->BlueMaskPosition);
TRACE("ReservedMaskSize = %d\n", ModeInformation->ReservedMaskSize);
TRACE("ReservedMaskPosition = %d\n", ModeInformation->ReservedMaskPosition);
TRACE("\n");
return TRUE;
}
@ -881,21 +883,21 @@ PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init)
if (VIDEOCARD_CGA_OR_OTHER == PcVideoDetectVideoCard())
{
DPRINTM(DPRINT_UI, "CGA or other display adapter detected.\n");
TRACE("CGA or other display adapter detected.\n");
printf("CGA or other display adapter detected.\n");
printf("Using 80x25 text mode.\n");
VideoMode = VIDEOMODE_NORMAL_TEXT;
}
else if (VIDEOCARD_EGA == PcVideoDetectVideoCard())
{
DPRINTM(DPRINT_UI, "EGA display adapter detected.\n");
TRACE("EGA display adapter detected.\n");
printf("EGA display adapter detected.\n");
printf("Using 80x25 text mode.\n");
VideoMode = VIDEOMODE_NORMAL_TEXT;
}
else /* if (VIDEOCARD_VGA == PcVideoDetectVideoCard()) */
{
DPRINTM(DPRINT_UI, "VGA display adapter detected.\n");
TRACE("VGA display adapter detected.\n");
if (0 == _stricmp(DisplayModeName, "NORMAL_VGA"))
{

View file

@ -28,6 +28,8 @@
} GDTIDT;
#pragma pack(4)
DBG_DEFAULT_CHANNEL(WINDOWS);
/* GLOBALS ***************************************************************/
PHARDWARE_PTE PDE;
@ -56,7 +58,7 @@ MempAllocatePageTables()
// and windows doesn't expect ALL memory mapped...
NumPageTables = TotalPagesInLookupTable >> 10;
DPRINTM(DPRINT_WINDOWS, "NumPageTables = %d\n", NumPageTables);
TRACE("NumPageTables = %d\n", NumPageTables);
// Allocate memory block for all these things:
// PDE, HAL mapping page table, physical mapping, kernel mapping
@ -75,7 +77,7 @@ MempAllocatePageTables()
if (Buffer + (TotalSize - NumPageTables*MM_PAGE_SIZE) !=
PhysicalPageTablesBuffer)
{
DPRINTM(DPRINT_WINDOWS, "There was a problem allocating two adjacent blocks of memory!");
TRACE("There was a problem allocating two adjacent blocks of memory!");
}
if (Buffer == NULL || PhysicalPageTablesBuffer == NULL)
@ -128,7 +130,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));
TRACE("WARNING! Entry: %X > 1023\n", Entry+(KSEG0_BASE >> 22));
}
// Kernel-mode mapping
@ -232,7 +234,7 @@ WinLdrpMapApic()
MsrValue.QuadPart = __readmsr(0x1B);
APICAddress = (MsrValue.LowPart & 0xFFFFF000);
DPRINTM(DPRINT_WINDOWS, "Local APIC detected at address 0x%x\n",
TRACE("Local APIC detected at address 0x%x\n",
APICAddress);
/* Map it */
@ -249,7 +251,7 @@ WinLdrMapSpecialPages(void)
{
//VideoDisplayString(L"Hello from VGA, going into the kernel\n");
DPRINTM(DPRINT_WINDOWS, "HalPageTable: 0x%X\n", HalPageTable);
TRACE("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)
@ -266,7 +268,7 @@ WinLdrMapSpecialPages(void)
// Map VGA memory
//VideoMemoryBase = MmMapIoSpace(0xb8000, 4000, MmNonCached);
//DPRINTM(DPRINT_WINDOWS, "VideoMemoryBase: 0x%X\n", VideoMemoryBase);
//TRACE("VideoMemoryBase: 0x%X\n", VideoMemoryBase);
return TRUE;
}
@ -318,7 +320,7 @@ void WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock)
// PDE and PTEs
if (MempAllocatePageTables() == FALSE)
{
// FIXME: bugcheck
BugCheck("MempAllocatePageTables failed!\n");
}
/* Map stuff like PCR, KI_USER_SHARED_DATA and Apic */
@ -340,7 +342,7 @@ WinLdrSetProcessorContext(void)
Pcr = KIP0PCRADDRESS;
Tss = KSEG0_BASE | (TssBasePage << MM_PAGE_SHIFT);
DPRINTM(DPRINT_WINDOWS, "GDtIdt %p, Pcr %p, Tss 0x%08X\n",
TRACE("GDtIdt %p, Pcr %p, Tss 0x%08X\n",
GdtIdt, Pcr, Tss);
// Enable paging
@ -595,18 +597,18 @@ MempDump()
ULONG *PDE_Addr=(ULONG *)PDE;//0xC0300000;
int i, j;
DPRINTM(DPRINT_WINDOWS, "\nPDE\n");
TRACE("\nPDE\n");
for (i=0; i<128; i++)
{
DPRINTM(DPRINT_WINDOWS, "0x%04X | ", i*8);
TRACE("0x%04X | ", i*8);
for (j=0; j<8; j++)
{
DPRINTM(DPRINT_WINDOWS, "0x%08X ", PDE_Addr[i*8+j]);
TRACE("0x%08X ", PDE_Addr[i*8+j]);
}
DPRINTM(DPRINT_WINDOWS, "\n");
TRACE("\n");
}
}
#endif

View file

@ -27,6 +27,8 @@
#define NDEBUG
#include <debug.h>
DBG_DEFAULT_CHANNEL(DISK);
#define XBOX_IDE_COMMAND_PORT 0x1f0
#define XBOX_IDE_CONTROL_PORT 0x170
@ -288,11 +290,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);
TRACE("status=0x%x\n", Status);
TRACE("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");
WARN("Drive is BUSY for too long\n");
return FALSE;
}
@ -307,22 +309,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",
DrvHead & IDE_DH_DRV1 ? 1 : 0,
((DrvHead & 0x0f) << 24) + (CylinderHigh << 16) + (CylinderLow << 8) + SectorNum,
SectorCnt,
Command);
TRACE("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);
}
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",
DrvHead & IDE_DH_DRV1 ? 1 : 0,
CylinderHigh,
CylinderLow,
DrvHead & 0x0f,
SectorNum,
SectorCnt,
Command);
TRACE("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);
}
/* Setup command parameters */
@ -411,7 +413,7 @@ XboxDiskPolledRead(ULONG CommandPort,
{
if (SectorCount >= SectorCnt)
{
DPRINTM(DPRINT_DISK, "Buffer size exceeded!\n");
TRACE("Buffer size exceeded!\n");
Junk = TRUE;
}
break;
@ -420,8 +422,8 @@ XboxDiskPolledRead(ULONG CommandPort,
{
if (SectorCount > SectorCnt)
{
DPRINTM(DPRINT_DISK, "Read %lu sectors of junk!\n",
SectorCount - SectorCnt);
TRACE("Read %lu sectors of junk!\n",
SectorCount - SectorCnt);
}
IDEWriteDriveControl(ControlPort, 0);
StallExecutionProcessor(50);
@ -443,13 +445,13 @@ XboxDiskReadLogicalSectors(UCHAR 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");
WARN("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");
FIXME("48bit LBA required but not implemented\n");
return FALSE;
}
@ -522,7 +524,7 @@ XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
(Atapi ? IDE_CMD_IDENT_ATAPI_DRV : IDE_CMD_IDENT_ATA_DRV),
(PUCHAR) &DrvParms))
{
DPRINTM(DPRINT_DISK, "XboxDiskPolledRead() failed\n");
ERR("XboxDiskPolledRead() failed\n");
return FALSE;
}
@ -537,7 +539,7 @@ XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
}
else
{
DPRINTM(DPRINT_DISK, "BytesPerSector %d\n", DrvParms.BytesPerSector);
TRACE("BytesPerSector %d\n", DrvParms.BytesPerSector);
if (DrvParms.BytesPerSector == 0)
{
Geometry->BytesPerSector = 512;
@ -554,10 +556,10 @@ XboxDiskGetDriveGeometry(UCHAR 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);
TRACE("Cylinders %d\n", Geometry->Cylinders);
TRACE("Heads %d\n", Geometry->Heads);
TRACE("Sectors %d\n", Geometry->Sectors);
TRACE("BytesPerSector %d\n", Geometry->BytesPerSector);
return TRUE;
}

View file

@ -22,6 +22,8 @@
#define NDEBUG
#include <debug.h>
DBG_DEFAULT_CHANNEL(HWDETECT);
static CHAR Hex[] = "0123456789ABCDEF";
//static unsigned int delay_count = 1;
@ -49,8 +51,7 @@ GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate a full resource descriptor\n");
ERR("Failed to allocate a full resource descriptor\n");
return NULL;
}
@ -80,17 +81,16 @@ GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
}
else
{
DPRINTM(DPRINT_HWDETECT, "Reading disk geometry failed\n");
ERR("Reading disk geometry failed\n");
MmHeapFree(PartialResourceList);
return NULL;
}
DPRINTM(DPRINT_HWDETECT,
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
DriveNumber,
DiskGeometry->NumberOfCylinders,
DiskGeometry->NumberOfHeads,
DiskGeometry->SectorsPerTrack,
DiskGeometry->BytesPerSector);
TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
DriveNumber,
DiskGeometry->NumberOfCylinders,
DiskGeometry->NumberOfHeads,
DiskGeometry->SectorsPerTrack,
DiskGeometry->BytesPerSector);
//
// Return configuration data
@ -247,7 +247,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
/* Read the MBR */
if (!MachDiskReadLogicalSectors(DriveNumber, 0ULL, 1, (PVOID)DISKREADBUFFER))
{
DPRINTM(DPRINT_HWDETECT, "Reading MBR failed\n");
ERR("Reading MBR failed\n");
return;
}
@ -255,7 +255,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
Mbr = (PMASTER_BOOT_RECORD)DISKREADBUFFER;
Signature = Mbr->Signature;
DPRINTM(DPRINT_HWDETECT, "Signature: %x\n", Signature);
TRACE("Signature: %x\n", Signature);
/* Calculate the MBR checksum */
Checksum = 0;
@ -264,7 +264,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
Checksum += Buffer[i];
}
Checksum = ~Checksum + 1;
DPRINTM(DPRINT_HWDETECT, "Checksum: %x\n", Checksum);
TRACE("Checksum: %x\n", Checksum);
/* Fill out the ARC disk block */
reactos_arc_disk_info[reactos_disk_count].Signature = Signature;
@ -313,7 +313,7 @@ GetHarddiskIdentifier(PCHAR Identifier,
Identifier[17] = '-';
Identifier[18] = 'A';
Identifier[19] = 0;
DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier);
TRACE("Identifier: %s\n", Identifier);
}
static VOID
@ -347,16 +347,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);
TRACE("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");
TRACE("BIOS reports %d harddisk%s\n",
(int)DiskCount, (DiskCount == 1) ? "": "s");
//DetectBiosFloppyController(BusKey);
@ -366,8 +366,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
"Failed to allocate resource descriptor\n");
ERR("Failed to allocate resource descriptor\n");
return;
}
@ -394,7 +393,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1;
Int13Drives[i].NumberDrives = DiskCount;
DPRINTM(DPRINT_HWDETECT,
TRACE(
"Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
0x80 + i,
Geometry.Cylinders - 1,
@ -414,7 +413,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey,
PartialResourceList,
Size,
&ControllerKey);
DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n");
TRACE("Created key: DiskController\\0\n");
MmHeapFree(PartialResourceList);
@ -459,7 +458,7 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
PartialResourceList = MmHeapAlloc(Size);
if (PartialResourceList == NULL)
{
DPRINTM(DPRINT_HWDETECT,
TRACE(
"Failed to allocate resource descriptor\n");
return;
}
@ -500,7 +499,7 @@ XboxHwDetect(VOID)
PCONFIGURATION_COMPONENT_DATA SystemKey;
ULONG BusNumber = 0;
DPRINTM(DPRINT_HWDETECT, "DetectHardware()\n");
TRACE("DetectHardware()\n");
/* Create the 'System' key */
FldrCreateSystemKey(&SystemKey);
@ -508,7 +507,7 @@ XboxHwDetect(VOID)
/* TODO: Build actual xbox's hardware configuration tree */
DetectIsaBios(SystemKey, &BusNumber);
DPRINTM(DPRINT_HWDETECT, "DetectHardware() Done\n");
TRACE("DetectHardware() Done\n");
return SystemKey;
}

View file

@ -20,6 +20,8 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(CACHE);
// Returns a pointer to a CACHE_BLOCK structure
// Adds the block to the cache manager block list
// in cache memory if it isn't already there
@ -27,18 +29,18 @@ PCACHE_BLOCK CacheInternalGetBlockPointer(PCACHE_DRIVE CacheDrive, ULONG BlockNu
{
PCACHE_BLOCK CacheBlock = NULL;
DPRINTM(DPRINT_CACHE, "CacheInternalGetBlockPointer() BlockNumber = %d\n", BlockNumber);
TRACE("CacheInternalGetBlockPointer() BlockNumber = %d\n", BlockNumber);
CacheBlock = CacheInternalFindBlock(CacheDrive, BlockNumber);
if (CacheBlock != NULL)
{
DPRINTM(DPRINT_CACHE, "Cache hit! BlockNumber: %d CacheBlock->BlockNumber: %d\n", BlockNumber, CacheBlock->BlockNumber);
TRACE("Cache hit! BlockNumber: %d CacheBlock->BlockNumber: %d\n", BlockNumber, CacheBlock->BlockNumber);
return CacheBlock;
}
DPRINTM(DPRINT_CACHE, "Cache miss! BlockNumber: %d\n", BlockNumber);
TRACE("Cache miss! BlockNumber: %d\n", BlockNumber);
CacheBlock = CacheInternalAddBlockToCache(CacheDrive, BlockNumber);
@ -52,7 +54,7 @@ PCACHE_BLOCK CacheInternalFindBlock(PCACHE_DRIVE CacheDrive, ULONG BlockNumber)
{
PCACHE_BLOCK CacheBlock = NULL;
DPRINTM(DPRINT_CACHE, "CacheInternalFindBlock() BlockNumber = %d\n", BlockNumber);
TRACE("CacheInternalFindBlock() BlockNumber = %d\n", BlockNumber);
//
// Make sure the block list has entries before I start searching it.
@ -90,7 +92,7 @@ PCACHE_BLOCK CacheInternalAddBlockToCache(PCACHE_DRIVE CacheDrive, ULONG BlockNu
{
PCACHE_BLOCK CacheBlock = NULL;
DPRINTM(DPRINT_CACHE, "CacheInternalAddBlockToCache() BlockNumber = %d\n", BlockNumber);
TRACE("CacheInternalAddBlockToCache() BlockNumber = %d\n", BlockNumber);
// Check the size of the cache so we don't exceed our limits
CacheInternalCheckCacheSizeLimits(CacheDrive);
@ -140,7 +142,7 @@ BOOLEAN CacheInternalFreeBlock(PCACHE_DRIVE CacheDrive)
{
PCACHE_BLOCK CacheBlockToFree;
DPRINTM(DPRINT_CACHE, "CacheInternalFreeBlock()\n");
TRACE("CacheInternalFreeBlock()\n");
// Get a pointer to the last item in the block list
// that isn't forced to be in the cache and remove
@ -175,7 +177,7 @@ VOID CacheInternalCheckCacheSizeLimits(PCACHE_DRIVE CacheDrive)
{
ULONG NewCacheSize;
DPRINTM(DPRINT_CACHE, "CacheInternalCheckCacheSizeLimits()\n");
TRACE("CacheInternalCheckCacheSizeLimits()\n");
// Calculate the size of the cache if we added a block
NewCacheSize = (CacheBlockCount + 1) * (CacheDrive->BlockSize * CacheDrive->BytesPerSector);
@ -192,25 +194,25 @@ VOID CacheInternalDumpBlockList(PCACHE_DRIVE CacheDrive)
{
PCACHE_BLOCK CacheBlock;
DPRINTM(DPRINT_CACHE, "Dumping block list for BIOS drive 0x%x.\n", CacheDrive->DriveNumber);
DPRINTM(DPRINT_CACHE, "BytesPerSector: %d.\n", CacheDrive->BytesPerSector);
DPRINTM(DPRINT_CACHE, "BlockSize: %d.\n", CacheDrive->BlockSize);
DPRINTM(DPRINT_CACHE, "CacheSizeLimit: %d.\n", CacheSizeLimit);
DPRINTM(DPRINT_CACHE, "CacheSizeCurrent: %d.\n", CacheSizeCurrent);
DPRINTM(DPRINT_CACHE, "CacheBlockCount: %d.\n", CacheBlockCount);
TRACE("Dumping block list for BIOS drive 0x%x.\n", CacheDrive->DriveNumber);
TRACE("BytesPerSector: %d.\n", CacheDrive->BytesPerSector);
TRACE("BlockSize: %d.\n", CacheDrive->BlockSize);
TRACE("CacheSizeLimit: %d.\n", CacheSizeLimit);
TRACE("CacheSizeCurrent: %d.\n", CacheSizeCurrent);
TRACE("CacheBlockCount: %d.\n", CacheBlockCount);
CacheBlock = CONTAINING_RECORD(CacheDrive->CacheBlockHead.Flink, CACHE_BLOCK, ListEntry);
while (&CacheBlock->ListEntry != &CacheDrive->CacheBlockHead)
{
DPRINTM(DPRINT_CACHE, "Cache Block: CacheBlock: 0x%x\n", CacheBlock);
DPRINTM(DPRINT_CACHE, "Cache Block: Block Number: %d\n", CacheBlock->BlockNumber);
DPRINTM(DPRINT_CACHE, "Cache Block: Access Count: %d\n", CacheBlock->AccessCount);
DPRINTM(DPRINT_CACHE, "Cache Block: Block Data: 0x%x\n", CacheBlock->BlockData);
DPRINTM(DPRINT_CACHE, "Cache Block: Locked In Cache: %d\n", CacheBlock->LockedInCache);
TRACE("Cache Block: CacheBlock: 0x%x\n", CacheBlock);
TRACE("Cache Block: Block Number: %d\n", CacheBlock->BlockNumber);
TRACE("Cache Block: Access Count: %d\n", CacheBlock->AccessCount);
TRACE("Cache Block: Block Data: 0x%x\n", CacheBlock->BlockData);
TRACE("Cache Block: Locked In Cache: %d\n", CacheBlock->LockedInCache);
if (CacheBlock->BlockData == NULL)
{
BugCheck((DPRINT_CACHE, "What the heck?!?\n"));
BugCheck("CacheBlock->BlockData == NULL\n");
}
CacheBlock = CONTAINING_RECORD(CacheBlock->ListEntry.Flink, CACHE_BLOCK, ListEntry);
@ -220,7 +222,7 @@ VOID CacheInternalDumpBlockList(PCACHE_DRIVE CacheDrive)
VOID CacheInternalOptimizeBlockList(PCACHE_DRIVE CacheDrive, PCACHE_BLOCK CacheBlock)
{
DPRINTM(DPRINT_CACHE, "CacheInternalOptimizeBlockList()\n");
TRACE("CacheInternalOptimizeBlockList()\n");
// Don't do this if this block is already at the head of the list
if (&CacheBlock->ListEntry != CacheDrive->CacheBlockHead.Flink)

View file

@ -20,6 +20,8 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(CACHE);
///////////////////////////////////////////////////////////////////////////////////////
//
// Internal data
@ -58,9 +60,9 @@ BOOLEAN CacheInitializeDrive(UCHAR DriveNumber)
{
CacheManagerInitialized = FALSE;
DPRINTM(DPRINT_CACHE, "CacheBlockCount: %d\n", CacheBlockCount);
DPRINTM(DPRINT_CACHE, "CacheSizeLimit: %d\n", CacheSizeLimit);
DPRINTM(DPRINT_CACHE, "CacheSizeCurrent: %d\n", CacheSizeCurrent);
TRACE("CacheBlockCount: %d\n", CacheBlockCount);
TRACE("CacheSizeLimit: %d\n", CacheSizeLimit);
TRACE("CacheSizeCurrent: %d\n", CacheSizeCurrent);
//
// Loop through and free the cache blocks
//
@ -98,10 +100,10 @@ BOOLEAN CacheInitializeDrive(UCHAR DriveNumber)
CacheManagerInitialized = TRUE;
DPRINTM(DPRINT_CACHE, "Initializing BIOS drive 0x%x.\n", DriveNumber);
DPRINTM(DPRINT_CACHE, "BytesPerSector: %d.\n", CacheManagerDrive.BytesPerSector);
DPRINTM(DPRINT_CACHE, "BlockSize: %d.\n", CacheManagerDrive.BlockSize);
DPRINTM(DPRINT_CACHE, "CacheSizeLimit: %d.\n", CacheSizeLimit);
TRACE("Initializing BIOS drive 0x%x.\n", DriveNumber);
TRACE("BytesPerSector: %d.\n", CacheManagerDrive.BytesPerSector);
TRACE("BlockSize: %d.\n", CacheManagerDrive.BlockSize);
TRACE("CacheSizeLimit: %d.\n", CacheSizeLimit);
return TRUE;
}
@ -122,7 +124,7 @@ BOOLEAN CacheReadDiskSectors(UCHAR DiskNumber, ULONGLONG StartSector, ULONG Sect
ULONG BlockCount;
ULONG Idx;
DPRINTM(DPRINT_CACHE, "CacheReadDiskSectors() DiskNumber: 0x%x StartSector: %I64d SectorCount: %d Buffer: 0x%x\n", DiskNumber, StartSector, SectorCount, Buffer);
TRACE("CacheReadDiskSectors() DiskNumber: 0x%x StartSector: %I64d SectorCount: %d Buffer: 0x%x\n", DiskNumber, StartSector, SectorCount, Buffer);
// If we aren't initialized yet then they can't do this
if (CacheManagerInitialized == FALSE)
@ -139,7 +141,7 @@ BOOLEAN CacheReadDiskSectors(UCHAR DiskNumber, ULONGLONG StartSector, ULONG Sect
EndBlock = (ULONG)((StartSector + (SectorCount - 1)) / CacheManagerDrive.BlockSize);
SectorOffsetInEndBlock = (ULONG)(1 + (StartSector + (SectorCount - 1)) % CacheManagerDrive.BlockSize);
BlockCount = (EndBlock - StartBlock) + 1;
DPRINTM(DPRINT_CACHE, "StartBlock: %d SectorOffsetInStartBlock: %d CopyLengthInStartBlock: %d EndBlock: %d SectorOffsetInEndBlock: %d BlockCount: %d\n", StartBlock, SectorOffsetInStartBlock, CopyLengthInStartBlock, EndBlock, SectorOffsetInEndBlock, BlockCount);
TRACE("StartBlock: %d SectorOffsetInStartBlock: %d CopyLengthInStartBlock: %d EndBlock: %d SectorOffsetInEndBlock: %d BlockCount: %d\n", StartBlock, SectorOffsetInStartBlock, CopyLengthInStartBlock, EndBlock, SectorOffsetInEndBlock, BlockCount);
//
// Read the first block into the buffer
@ -161,7 +163,7 @@ BOOLEAN CacheReadDiskSectors(UCHAR DiskNumber, ULONGLONG StartSector, ULONG Sect
RtlCopyMemory(Buffer,
(PVOID)((ULONG_PTR)CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)),
(CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector));
DPRINTM(DPRINT_CACHE, "1 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, ((ULONG_PTR)CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)), (CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector));
TRACE("1 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, ((ULONG_PTR)CacheBlock->BlockData + (SectorOffsetInStartBlock * CacheManagerDrive.BytesPerSector)), (CopyLengthInStartBlock * CacheManagerDrive.BytesPerSector));
//
// Update the buffer address
@ -194,7 +196,7 @@ BOOLEAN CacheReadDiskSectors(UCHAR DiskNumber, ULONGLONG StartSector, ULONG Sect
RtlCopyMemory(Buffer,
CacheBlock->BlockData,
CacheManagerDrive.BlockSize * CacheManagerDrive.BytesPerSector);
DPRINTM(DPRINT_CACHE, "2 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, CacheBlock->BlockData, CacheManagerDrive.BlockSize * CacheManagerDrive.BytesPerSector);
TRACE("2 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, CacheBlock->BlockData, CacheManagerDrive.BlockSize * CacheManagerDrive.BytesPerSector);
//
// Update the buffer address
@ -227,7 +229,7 @@ BOOLEAN CacheReadDiskSectors(UCHAR DiskNumber, ULONGLONG StartSector, ULONG Sect
RtlCopyMemory(Buffer,
CacheBlock->BlockData,
SectorOffsetInEndBlock * CacheManagerDrive.BytesPerSector);
DPRINTM(DPRINT_CACHE, "3 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, CacheBlock->BlockData, SectorOffsetInEndBlock * CacheManagerDrive.BytesPerSector);
TRACE("3 - RtlCopyMemory(0x%x, 0x%x, %d)\n", Buffer, CacheBlock->BlockData, SectorOffsetInEndBlock * CacheManagerDrive.BytesPerSector);
//
// Update the buffer address
@ -252,7 +254,7 @@ BOOLEAN CacheForceDiskSectorsIntoCache(UCHAR DiskNumber, ULONGLONG StartSector,
ULONG BlockCount;
ULONG Idx;
DPRINTM(DPRINT_CACHE, "CacheForceDiskSectorsIntoCache() DiskNumber: 0x%x StartSector: %d SectorCount: %d\n", DiskNumber, StartSector, SectorCount);
TRACE("CacheForceDiskSectorsIntoCache() DiskNumber: 0x%x StartSector: %d SectorCount: %d\n", DiskNumber, StartSector, SectorCount);
// If we aren't initialized yet then they can't do this
if (CacheManagerInitialized == FALSE)
@ -295,7 +297,7 @@ BOOLEAN CacheReleaseMemory(ULONG MinimumAmountToRelease)
{
ULONG AmountReleased;
DPRINTM(DPRINT_CACHE, "CacheReleaseMemory() MinimumAmountToRelease = %d\n", MinimumAmountToRelease);
TRACE("CacheReleaseMemory() MinimumAmountToRelease = %d\n", MinimumAmountToRelease);
// If we aren't initialized yet then they can't do this
if (CacheManagerInitialized == FALSE)

View file

@ -30,17 +30,17 @@
#define DEBUG_NONE
#if defined (DEBUG_ALL)
ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY | DPRINT_FILESYSTEM |
ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_MEMORY | DPRINT_FILESYSTEM |
DPRINT_UI | DPRINT_DISK | DPRINT_CACHE | DPRINT_REACTOS |
DPRINT_LINUX | DPRINT_HWDETECT | DPRINT_PELOADER | DPRINT_WINDOWS;
#elif defined (DEBUG_INIFILE)
ULONG DebugPrintMask = DPRINT_INIFILE;
ULONG DebugPrintMask = DPRINT_INIFILE;
#elif defined (DEBUG_REACTOS)
ULONG DebugPrintMask = DPRINT_REACTOS | DPRINT_REGISTRY;
ULONG DebugPrintMask = DPRINT_REACTOS | DPRINT_REGISTRY;
#elif defined (DEBUG_CUSTOM)
ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_WINDOWS;
ULONG DebugPrintMask = DPRINT_WARNING | DPRINT_WINDOWS;
#else //#elif defined (DEBUG_NONE)
ULONG DebugPrintMask = 0;
ULONG DebugPrintMask = 0;
#endif
#define SCREEN 1
@ -127,93 +127,45 @@ DbgPrint(const char *Format, ...)
return 0;
}
VOID DebugPrintHeader(ULONG Mask)
{
/* No header */
if (Mask == 0)
return;
switch (Mask)
{
case DPRINT_WARNING:
DbgPrint("WARNING: ");
break;
case DPRINT_MEMORY:
DbgPrint("MEMORY: ");
break;
case DPRINT_FILESYSTEM:
DbgPrint("FILESYS: ");
break;
case DPRINT_INIFILE:
DbgPrint("INIFILE: ");
break;
case DPRINT_UI:
DbgPrint("UI: ");
break;
case DPRINT_DISK:
DbgPrint("DISK: ");
break;
case DPRINT_CACHE:
DbgPrint("CACHE: ");
break;
case DPRINT_REGISTRY:
DbgPrint("REGISTRY: ");
break;
case DPRINT_REACTOS:
DbgPrint("REACTOS: ");
break;
case DPRINT_LINUX:
DbgPrint("LINUX: ");
break;
case DPRINT_WINDOWS:
DbgPrint("WINLDR: ");
break;
case DPRINT_HWDETECT:
DbgPrint("HWDETECT: ");
break;
case DPRINT_PELOADER:
DbgPrint("PELOADER: ");
break;
case DPRINT_SCSIPORT:
DbgPrint("SCSIPORT: ");
break;
default:
DbgPrint("UNKNOWN: ");
break;
}
}
char* g_file;
int g_line;
VOID DbgPrintMask(ULONG Mask, char *format, ...)
VOID
DbgPrint2(ULONG Mask, ULONG Level, const char *File, ULONG Line, char *Format, ...)
{
va_list ap;
char Buffer[2096];
char *ptr = Buffer;
// Mask out unwanted debug messages
if (!(Mask & DebugPrintMask))
if (Level >= WARN_LEVEL && !(Mask & DebugPrintMask))
{
return;
}
// Disable file/line for scsiport messages
if (Mask & DPRINT_SCSIPORT)
{
DebugStartOfLine = FALSE;
}
// Print the header if we have started a new line
if (DebugStartOfLine)
{
DbgPrint("(%s:%d) ", g_file, g_line);
DebugPrintHeader(Mask);
DbgPrint("(%s:%lu) ", File, Line);
switch (Level)
{
case ERR_LEVEL:
DbgPrint("err: ");
break;
case FIXME_LEVEL:
DbgPrint("fixme: ");
break;
case WARN_LEVEL:
DbgPrint("warn: ");
break;
case TRACE_LEVEL:
DbgPrint("trace: ");
break;
}
DebugStartOfLine = FALSE;
}
va_start(ap, format);
vsprintf(Buffer, format, ap);
va_start(ap, Format);
vsprintf(Buffer, Format, ap);
va_end(ap);
while (*ptr)
@ -222,7 +174,8 @@ VOID DbgPrintMask(ULONG Mask, char *format, ...)
}
}
VOID DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length)
VOID
DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length)
{
PUCHAR BufPtr = (PUCHAR)Buffer;
ULONG Idx;
@ -235,7 +188,7 @@ VOID DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length)
}
DebugStartOfLine = FALSE; // We don't want line headers
DbgPrintMask(Mask, "Dumping buffer at 0x%x with length of %d bytes:\n", Buffer, Length);
DbgPrint("Dumping buffer at 0x%x with length of %d bytes:\n", Buffer, Length);
for (Idx=0; Idx<Length; )
{
@ -243,65 +196,67 @@ VOID DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length)
if (Idx < 0x0010)
{
DbgPrintMask(Mask, "000%x:\t", Idx);
DbgPrint("000%x:\t", Idx);
}
else if (Idx < 0x0100)
{
DbgPrintMask(Mask, "00%x:\t", Idx);
DbgPrint("00%x:\t", Idx);
}
else if (Idx < 0x1000)
{
DbgPrintMask(Mask, "0%x:\t", Idx);
DbgPrint("0%x:\t", Idx);
}
else
{
DbgPrintMask(Mask, "%x:\t", Idx);
DbgPrint("%x:\t", Idx);
}
for (Idx2=0; Idx2<16; Idx2++,Idx++)
{
if (BufPtr[Idx] < 0x10)
{
DbgPrintMask(Mask, "0");
DbgPrint("0");
}
DbgPrintMask(Mask, "%x", BufPtr[Idx]);
DbgPrint("%x", BufPtr[Idx]);
if (Idx2 == 7)
{
DbgPrintMask(Mask, "-");
DbgPrint("-");
}
else
{
DbgPrintMask(Mask, " ");
DbgPrint(" ");
}
}
Idx -= 16;
DbgPrintMask(Mask, " ");
DbgPrint(" ");
for (Idx2=0; Idx2<16; Idx2++,Idx++)
{
if ((BufPtr[Idx] > 20) && (BufPtr[Idx] < 0x80))
{
DbgPrintMask(Mask, "%c", BufPtr[Idx]);
DbgPrint("%c", BufPtr[Idx]);
}
else
{
DbgPrintMask(Mask, ".");
DbgPrint(".");
}
}
DbgPrintMask(Mask, "\n");
DbgPrint("\n");
}
}
#else
VOID DbgPrintMask(ULONG Mask, char *format, ...)
VOID
DbgPrintMask(ULONG Mask, char *Format, ...)
{
}
ULONG DbgPrint(PCCH Format, ...)
ULONG
DbgPrint(PCCH Format, ...)
{
return 0;
}

View file

@ -21,8 +21,7 @@
#include <freeldr.h>
#include <debug.h>
#undef UNIMPLEMENTED
#define UNIMPLEMENTED BugCheck((DPRINT_WARNING, "Unimplemented\n"));
DBG_DEFAULT_CHANNEL(DISK);
static BOOLEAN bReportError = TRUE;
@ -44,7 +43,7 @@ VOID DiskError(PCSTR ErrorString, ULONG ErrorCode)
sprintf(ErrorCodeString, "%s\n\nError Code: 0x%lx\nError: %s", ErrorString, ErrorCode, DiskGetErrorCodeString(ErrorCode));
DPRINTM(DPRINT_DISK, "%s\n", ErrorCodeString);
TRACE("%s\n", ErrorCodeString);
UiMessageBox(ErrorCodeString);
}

View file

@ -21,6 +21,8 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(DISK);
BOOLEAN DiskGetActivePartitionEntry(UCHAR DriveNumber,
PPARTITION_TABLE_ENTRY PartitionTableEntry,
ULONG *ActivePartition)
@ -60,12 +62,12 @@ BOOLEAN DiskGetActivePartitionEntry(UCHAR DriveNumber,
// Make sure there was only one bootable partition
if (BootablePartitionCount == 0)
{
DPRINTM(DPRINT_DISK, "No bootable (active) partitions found.\n");
ERR("No bootable (active) partitions found.\n");
return FALSE;
}
else if (BootablePartitionCount != 1)
{
DPRINTM(DPRINT_DISK, "Too many bootable (active) partitions found.\n");
ERR("Too many bootable (active) partitions found.\n");
return FALSE;
}
@ -207,24 +209,24 @@ BOOLEAN DiskReadBootRecord(UCHAR DriveNumber, ULONGLONG LogicalSectorNumber, PMA
RtlCopyMemory(BootRecord, (PVOID)DISKREADBUFFER, sizeof(MASTER_BOOT_RECORD));
DPRINTM(DPRINT_DISK, "Dumping partition table for drive 0x%x:\n", DriveNumber);
DPRINTM(DPRINT_DISK, "Boot record logical start sector = %d\n", LogicalSectorNumber);
DPRINTM(DPRINT_DISK, "sizeof(MASTER_BOOT_RECORD) = 0x%x.\n", sizeof(MASTER_BOOT_RECORD));
TRACE("Dumping partition table for drive 0x%x:\n", DriveNumber);
TRACE("Boot record logical start sector = %d\n", LogicalSectorNumber);
TRACE("sizeof(MASTER_BOOT_RECORD) = 0x%x.\n", sizeof(MASTER_BOOT_RECORD));
for (Index=0; Index<4; Index++)
{
DPRINTM(DPRINT_DISK, "-------------------------------------------\n");
DPRINTM(DPRINT_DISK, "Partition %d\n", (Index + 1));
DPRINTM(DPRINT_DISK, "BootIndicator: 0x%x\n", BootRecord->PartitionTable[Index].BootIndicator);
DPRINTM(DPRINT_DISK, "StartHead: 0x%x\n", BootRecord->PartitionTable[Index].StartHead);
DPRINTM(DPRINT_DISK, "StartSector (Plus 2 cylinder bits): 0x%x\n", BootRecord->PartitionTable[Index].StartSector);
DPRINTM(DPRINT_DISK, "StartCylinder: 0x%x\n", BootRecord->PartitionTable[Index].StartCylinder);
DPRINTM(DPRINT_DISK, "SystemIndicator: 0x%x\n", BootRecord->PartitionTable[Index].SystemIndicator);
DPRINTM(DPRINT_DISK, "EndHead: 0x%x\n", BootRecord->PartitionTable[Index].EndHead);
DPRINTM(DPRINT_DISK, "EndSector (Plus 2 cylinder bits): 0x%x\n", BootRecord->PartitionTable[Index].EndSector);
DPRINTM(DPRINT_DISK, "EndCylinder: 0x%x\n", BootRecord->PartitionTable[Index].EndCylinder);
DPRINTM(DPRINT_DISK, "SectorCountBeforePartition: 0x%x\n", BootRecord->PartitionTable[Index].SectorCountBeforePartition);
DPRINTM(DPRINT_DISK, "PartitionSectorCount: 0x%x\n", BootRecord->PartitionTable[Index].PartitionSectorCount);
TRACE("-------------------------------------------\n");
TRACE("Partition %d\n", (Index + 1));
TRACE("BootIndicator: 0x%x\n", BootRecord->PartitionTable[Index].BootIndicator);
TRACE("StartHead: 0x%x\n", BootRecord->PartitionTable[Index].StartHead);
TRACE("StartSector (Plus 2 cylinder bits): 0x%x\n", BootRecord->PartitionTable[Index].StartSector);
TRACE("StartCylinder: 0x%x\n", BootRecord->PartitionTable[Index].StartCylinder);
TRACE("SystemIndicator: 0x%x\n", BootRecord->PartitionTable[Index].SystemIndicator);
TRACE("EndHead: 0x%x\n", BootRecord->PartitionTable[Index].EndHead);
TRACE("EndSector (Plus 2 cylinder bits): 0x%x\n", BootRecord->PartitionTable[Index].EndSector);
TRACE("EndCylinder: 0x%x\n", BootRecord->PartitionTable[Index].EndCylinder);
TRACE("SectorCountBeforePartition: 0x%x\n", BootRecord->PartitionTable[Index].SectorCountBeforePartition);
TRACE("PartitionSectorCount: 0x%x\n", BootRecord->PartitionTable[Index].PartitionSectorCount);
}
// Check the partition table magic value

View file

@ -41,13 +41,10 @@
#define NDEBUG
#include <debug.h>
#define DPRINTM2(fmt, ...) DPRINTM(DPRINT_SCSIPORT, "(%s:%d) SCSIPORT: " fmt, __FILE__, __LINE__, __VA_ARGS__)
#undef UNIMPLEMENTED
#define UNIMPLEMENTED DPRINTM2("%s UNIMPLEMENTED\n", __FUNCTION__)
#define SCSI_PORT_NEXT_REQUEST_READY 0x0008
DBG_DEFAULT_CHANNEL(SCSIPORT);
typedef struct
{
PVOID NonCachedExtension;
@ -442,7 +439,7 @@ ScsiDebugPrint(
}
/* Print the message */
DPRINTM(DPRINT_SCSIPORT, "%s", Buffer);
TRACE("%s", Buffer);
/* Cleanup */
va_end(ap);
@ -570,7 +567,7 @@ ScsiPortGetPhysicalAddress(
ULONG BufferLength = 0;
ULONG Offset;
DPRINTM2("ScsiPortGetPhysicalAddress(%p %p %p %p)\n",
TRACE("ScsiPortGetPhysicalAddress(%p %p %p %p)\n",
HwDeviceExtension, Srb, VirtualAddress, Length);
DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1;
@ -683,7 +680,7 @@ ScsiPortGetUncachedExtension(
ULONG MapRegistersCount;
NTSTATUS Status;
DPRINTM2("ScsiPortGetUncachedExtension(%p %p %lu)\n",
TRACE("ScsiPortGetUncachedExtension(%p %p %lu)\n",
HwDeviceExtension, ConfigInfo, NumberOfBytes);
DeviceExtension = ((PSCSI_PORT_DEVICE_EXTENSION)HwDeviceExtension) - 1;
@ -749,7 +746,7 @@ ScsiPortGetUncachedExtension(
if (!NT_SUCCESS(Status))
{
DPRINTM2("SpiAllocateCommonBuffer() failed with Status = 0x%08X!\n", Status);
TRACE("SpiAllocateCommonBuffer() failed with Status = 0x%08X!\n", Status);
return NULL;
}
@ -833,7 +830,7 @@ SpiScanAdapter(
Lun = 0;
do
{
DPRINTM2("Scanning SCSI device %d.%d.%d\n",
TRACE("Scanning SCSI device %d.%d.%d\n",
ScsiBus, TargetId, Lun);
Srb = ExAllocatePool(PagedPool, sizeof(SCSI_REQUEST_BLOCK));
@ -905,7 +902,7 @@ SpiResourceToConfig(
/* Copy access ranges */
if (RangeNumber < HwInitializationData->NumberOfAccessRanges)
{
DPRINTM2("Got port at 0x%I64x, len 0x%x\n",
TRACE("Got port at 0x%I64x, len 0x%x\n",
PartialData->u.Port.Start.QuadPart, PartialData->u.Port.Length);
AccessRange = &((*(PortConfig->AccessRanges))[RangeNumber]);
@ -921,7 +918,7 @@ SpiResourceToConfig(
/* Copy access ranges */
if (RangeNumber < HwInitializationData->NumberOfAccessRanges)
{
DPRINTM2("Got memory at 0x%I64x, len 0x%x\n",
TRACE("Got memory at 0x%I64x, len 0x%x\n",
PartialData->u.Memory.Start.QuadPart, PartialData->u.Memory.Length);
AccessRange = &((*(PortConfig->AccessRanges))[RangeNumber]);
@ -935,7 +932,7 @@ SpiResourceToConfig(
case CmResourceTypeInterrupt:
/* Copy interrupt data */
DPRINTM2("Got interrupt level %d, vector %d\n",
TRACE("Got interrupt level %d, vector %d\n",
PartialData->u.Interrupt.Level, PartialData->u.Interrupt.Vector);
PortConfig->BusInterruptLevel = PartialData->u.Interrupt.Level;
PortConfig->BusInterruptVector = PartialData->u.Interrupt.Vector;
@ -952,7 +949,7 @@ SpiResourceToConfig(
break;
case CmResourceTypeDma:
DPRINTM2("Got DMA channel %d, port %d\n",
TRACE("Got DMA channel %d, port %d\n",
PartialData->u.Dma.Channel, PartialData->u.Dma.Port);
PortConfig->DmaChannel = PartialData->u.Dma.Channel;
PortConfig->DmaPort = PartialData->u.Dma.Port;
@ -1018,7 +1015,7 @@ SpiGetPciConfigData(
continue;
}
DPRINTM2( "Found device 0x%04hx 0x%04hx at %1lu %2lu %1lu\n",
TRACE( "Found device 0x%04hx 0x%04hx at %1lu %2lu %1lu\n",
PciConfig.VendorID, PciConfig.DeviceID,
BusNumber,
SlotNumber.u.bits.DeviceNumber, SlotNumber.u.bits.FunctionNumber);
@ -1142,7 +1139,7 @@ ScsiPortInitialize(
PortConfig.BusInterruptLevel = 0;
/* Get PCI device data */
DPRINTM2("VendorId '%.*s' DeviceId '%.*s'\n",
TRACE("VendorId '%.*s' DeviceId '%.*s'\n",
HwInitializationData->VendorIdLength,
HwInitializationData->VendorId,
HwInitializationData->DeviceIdLength,
@ -1186,7 +1183,7 @@ ScsiPortInitialize(
DeviceExtension->BusNum = PortConfig.SystemIoBusNumber;
DPRINTM2("Adapter found: buses = %d, targets = %d\n",
TRACE("Adapter found: buses = %d, targets = %d\n",
PortConfig.NumberOfBuses, DeviceExtension->MaxTargedIds);
/* Initialize adapter */
@ -1321,8 +1318,7 @@ NTAPI
ScsiPortReadPortUchar(
IN PUCHAR Port)
{
DPRINTM2("ScsiPortReadPortUchar(%p)\n",
Port);
TRACE("ScsiPortReadPortUchar(%p)\n", Port);
return READ_PORT_UCHAR(Port);
}

View file

@ -20,6 +20,8 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(WARNING);
VOID NTAPI HalpInitializePciStubs(VOID);
VOID NTAPI HalpInitBusHandler(VOID);
@ -33,7 +35,7 @@ VOID BootMain(LPSTR CmdLine)
DebugInit();
DPRINTM(DPRINT_WARNING, "BootMain() called.\n");
TRACE("BootMain() called.\n");
if (!UiInitialize(FALSE))
{

View file

@ -21,6 +21,8 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(FILESYSTEM);
BOOLEAN Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PartitionSectorCount);
PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName);
BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer);
@ -73,7 +75,7 @@ BOOLEAN DiskGetBootVolume(PUCHAR DriveNumber, PULONGLONG StartSector, PULONGLONG
BOOLEAN Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PartitionSectorCount)
{
DPRINTM(DPRINT_FILESYSTEM, "Ext2OpenVolume() DriveNumber = 0x%x VolumeStartSector = %d\n", DriveNumber, VolumeStartSector);
TRACE("Ext2OpenVolume() DriveNumber = 0x%x VolumeStartSector = %d\n", DriveNumber, VolumeStartSector);
// Store the drive number and start sector
Ext2DriveNumber = DriveNumber;
@ -120,7 +122,7 @@ PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName)
CHAR FullPath[EXT2_NAME_LEN * 2];
ULONG_PTR Index;
DPRINTM(DPRINT_FILESYSTEM, "Ext2OpenFile() FileName = %s\n", FileName);
TRACE("Ext2OpenFile() FileName = %s\n", FileName);
RtlZeroMemory(SymLinkPath, sizeof(SymLinkPath));
@ -134,7 +136,7 @@ PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName)
// and re-call this function
if ((TempExt2FileInfo.Inode.mode & EXT2_S_IFMT) == EXT2_S_IFLNK)
{
DPRINTM(DPRINT_FILESYSTEM, "File is a symbolic link\n");
TRACE("File is a symbolic link\n");
// Now read in the symbolic link path
if (!Ext2ReadFileBig(&TempExt2FileInfo, TempExt2FileInfo.FileSize, NULL, SymLinkPath))
@ -147,7 +149,7 @@ PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName)
return NULL;
}
DPRINTM(DPRINT_FILESYSTEM, "Symbolic link path = %s\n", SymLinkPath);
TRACE("Symbolic link path = %s\n", SymLinkPath);
// Get the full path
if (SymLinkPath[0] == '/' || SymLinkPath[0] == '\\')
@ -179,7 +181,7 @@ PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName)
strcat(FullPath, SymLinkPath);
}
DPRINTM(DPRINT_FILESYSTEM, "Full file path = %s\n", FullPath);
TRACE("Full file path = %s\n", FullPath);
if (TempExt2FileInfo.FileBlockList != NULL)
{
@ -225,7 +227,7 @@ BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer)
EXT2_INODE InodeData;
EXT2_DIR_ENTRY DirectoryEntry;
DPRINTM(DPRINT_FILESYSTEM, "Ext2LookupFile() FileName = %s\n", FileName);
TRACE("Ext2LookupFile() FileName = %s\n", FileName);
RtlZeroMemory(Ext2FileInfoPointer, sizeof(EXT2_FILE_INFO));
@ -319,7 +321,7 @@ BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectoryS
ULONG CurrentOffset;
PEXT2_DIR_ENTRY CurrentDirectoryEntry;
DPRINTM(DPRINT_FILESYSTEM, "Ext2SearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectorySize = %d FileName = %s\n", DirectoryBuffer, DirectorySize, FileName);
TRACE("Ext2SearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectorySize = %d FileName = %s\n", DirectoryBuffer, DirectorySize, FileName);
for (CurrentOffset=0; CurrentOffset<DirectorySize; )
{
@ -336,7 +338,7 @@ BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectoryS
return FALSE;
}
DPRINTM(DPRINT_FILESYSTEM, "Dumping directory entry at offset %d:\n", CurrentOffset);
TRACE("Dumping directory entry at offset %d:\n", CurrentOffset);
DbgDumpBuffer(DPRINT_FILESYSTEM, CurrentDirectoryEntry, CurrentDirectoryEntry->direntlen);
if ((_strnicmp(FileName, CurrentDirectoryEntry->name, CurrentDirectoryEntry->namelen) == 0) &&
@ -344,17 +346,17 @@ BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectoryS
{
RtlCopyMemory(DirectoryEntry, CurrentDirectoryEntry, sizeof(EXT2_DIR_ENTRY));
DPRINTM(DPRINT_FILESYSTEM, "EXT2 Directory Entry:\n");
DPRINTM(DPRINT_FILESYSTEM, "inode = %d\n", DirectoryEntry->inode);
DPRINTM(DPRINT_FILESYSTEM, "direntlen = %d\n", DirectoryEntry->direntlen);
DPRINTM(DPRINT_FILESYSTEM, "namelen = %d\n", DirectoryEntry->namelen);
DPRINTM(DPRINT_FILESYSTEM, "filetype = %d\n", DirectoryEntry->filetype);
DPRINTM(DPRINT_FILESYSTEM, "name = ");
TRACE("EXT2 Directory Entry:\n");
TRACE("inode = %d\n", DirectoryEntry->inode);
TRACE("direntlen = %d\n", DirectoryEntry->direntlen);
TRACE("namelen = %d\n", DirectoryEntry->namelen);
TRACE("filetype = %d\n", DirectoryEntry->filetype);
TRACE("name = ");
for (CurrentOffset=0; CurrentOffset<DirectoryEntry->namelen; CurrentOffset++)
{
DPRINTM(DPRINT_FILESYSTEM, "%c", DirectoryEntry->name[CurrentOffset]);
TRACE("%c", DirectoryEntry->name[CurrentOffset]);
}
DPRINTM(DPRINT_FILESYSTEM, "\n");
TRACE("\n");
return TRUE;
}
@ -378,7 +380,7 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO
ULONG LengthInBlock;
ULONG NumberOfBlocks;
DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadFileBig() BytesToRead = %d Buffer = 0x%x\n", (ULONG)BytesToRead, Buffer);
TRACE("Ext2ReadFileBig() BytesToRead = %d Buffer = 0x%x\n", (ULONG)BytesToRead, Buffer);
if (BytesRead != NULL)
{
@ -422,7 +424,7 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO
if (((Ext2FileInfo->Inode.mode & EXT2_S_IFMT) == EXT2_S_IFLNK) &&
(Ext2FileInfo->FileSize <= FAST_SYMLINK_MAX_NAME_SIZE))
{
DPRINTM(DPRINT_FILESYSTEM, "Reading fast symbolic link data\n");
TRACE("Reading fast symbolic link data\n");
// Copy the data from the link
RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)Ext2FileInfo->FilePointer + Ext2FileInfo->Inode.symlink), (ULONG)BytesToRead);
@ -571,7 +573,7 @@ BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG S
BOOLEAN Ext2ReadSuperBlock(VOID)
{
DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadSuperBlock()\n");
TRACE("Ext2ReadSuperBlock()\n");
//
// Free any memory previously allocated
@ -605,43 +607,43 @@ BOOLEAN Ext2ReadSuperBlock(VOID)
}
RtlCopyMemory(Ext2SuperBlock, (PVOID)((ULONG_PTR)DISKREADBUFFER + 1024), 1024);
DPRINTM(DPRINT_FILESYSTEM, "Dumping super block:\n");
DPRINTM(DPRINT_FILESYSTEM, "total_inodes: %d\n", Ext2SuperBlock->total_inodes);
DPRINTM(DPRINT_FILESYSTEM, "total_blocks: %d\n", Ext2SuperBlock->total_blocks);
DPRINTM(DPRINT_FILESYSTEM, "reserved_blocks: %d\n", Ext2SuperBlock->reserved_blocks);
DPRINTM(DPRINT_FILESYSTEM, "free_blocks: %d\n", Ext2SuperBlock->free_blocks);
DPRINTM(DPRINT_FILESYSTEM, "free_inodes: %d\n", Ext2SuperBlock->free_inodes);
DPRINTM(DPRINT_FILESYSTEM, "first_data_block: %d\n", Ext2SuperBlock->first_data_block);
DPRINTM(DPRINT_FILESYSTEM, "log2_block_size: %d\n", Ext2SuperBlock->log2_block_size);
DPRINTM(DPRINT_FILESYSTEM, "log2_fragment_size: %d\n", Ext2SuperBlock->log2_fragment_size);
DPRINTM(DPRINT_FILESYSTEM, "blocks_per_group: %d\n", Ext2SuperBlock->blocks_per_group);
DPRINTM(DPRINT_FILESYSTEM, "fragments_per_group: %d\n", Ext2SuperBlock->fragments_per_group);
DPRINTM(DPRINT_FILESYSTEM, "inodes_per_group: %d\n", Ext2SuperBlock->inodes_per_group);
DPRINTM(DPRINT_FILESYSTEM, "mtime: %d\n", Ext2SuperBlock->mtime);
DPRINTM(DPRINT_FILESYSTEM, "utime: %d\n", Ext2SuperBlock->utime);
DPRINTM(DPRINT_FILESYSTEM, "mnt_count: %d\n", Ext2SuperBlock->mnt_count);
DPRINTM(DPRINT_FILESYSTEM, "max_mnt_count: %d\n", Ext2SuperBlock->max_mnt_count);
DPRINTM(DPRINT_FILESYSTEM, "magic: 0x%x\n", Ext2SuperBlock->magic);
DPRINTM(DPRINT_FILESYSTEM, "fs_state: %d\n", Ext2SuperBlock->fs_state);
DPRINTM(DPRINT_FILESYSTEM, "error_handling: %d\n", Ext2SuperBlock->error_handling);
DPRINTM(DPRINT_FILESYSTEM, "minor_revision_level: %d\n", Ext2SuperBlock->minor_revision_level);
DPRINTM(DPRINT_FILESYSTEM, "lastcheck: %d\n", Ext2SuperBlock->lastcheck);
DPRINTM(DPRINT_FILESYSTEM, "checkinterval: %d\n", Ext2SuperBlock->checkinterval);
DPRINTM(DPRINT_FILESYSTEM, "creator_os: %d\n", Ext2SuperBlock->creator_os);
DPRINTM(DPRINT_FILESYSTEM, "revision_level: %d\n", Ext2SuperBlock->revision_level);
DPRINTM(DPRINT_FILESYSTEM, "uid_reserved: %d\n", Ext2SuperBlock->uid_reserved);
DPRINTM(DPRINT_FILESYSTEM, "gid_reserved: %d\n", Ext2SuperBlock->gid_reserved);
DPRINTM(DPRINT_FILESYSTEM, "first_inode: %d\n", Ext2SuperBlock->first_inode);
DPRINTM(DPRINT_FILESYSTEM, "inode_size: %d\n", Ext2SuperBlock->inode_size);
DPRINTM(DPRINT_FILESYSTEM, "block_group_number: %d\n", Ext2SuperBlock->block_group_number);
DPRINTM(DPRINT_FILESYSTEM, "feature_compatibility: 0x%x\n", Ext2SuperBlock->feature_compatibility);
DPRINTM(DPRINT_FILESYSTEM, "feature_incompat: 0x%x\n", Ext2SuperBlock->feature_incompat);
DPRINTM(DPRINT_FILESYSTEM, "feature_ro_compat: 0x%x\n", Ext2SuperBlock->feature_ro_compat);
DPRINTM(DPRINT_FILESYSTEM, "unique_id = { 0x%x, 0x%x, 0x%x, 0x%x }\n",
TRACE("Dumping super block:\n");
TRACE("total_inodes: %d\n", Ext2SuperBlock->total_inodes);
TRACE("total_blocks: %d\n", Ext2SuperBlock->total_blocks);
TRACE("reserved_blocks: %d\n", Ext2SuperBlock->reserved_blocks);
TRACE("free_blocks: %d\n", Ext2SuperBlock->free_blocks);
TRACE("free_inodes: %d\n", Ext2SuperBlock->free_inodes);
TRACE("first_data_block: %d\n", Ext2SuperBlock->first_data_block);
TRACE("log2_block_size: %d\n", Ext2SuperBlock->log2_block_size);
TRACE("log2_fragment_size: %d\n", Ext2SuperBlock->log2_fragment_size);
TRACE("blocks_per_group: %d\n", Ext2SuperBlock->blocks_per_group);
TRACE("fragments_per_group: %d\n", Ext2SuperBlock->fragments_per_group);
TRACE("inodes_per_group: %d\n", Ext2SuperBlock->inodes_per_group);
TRACE("mtime: %d\n", Ext2SuperBlock->mtime);
TRACE("utime: %d\n", Ext2SuperBlock->utime);
TRACE("mnt_count: %d\n", Ext2SuperBlock->mnt_count);
TRACE("max_mnt_count: %d\n", Ext2SuperBlock->max_mnt_count);
TRACE("magic: 0x%x\n", Ext2SuperBlock->magic);
TRACE("fs_state: %d\n", Ext2SuperBlock->fs_state);
TRACE("error_handling: %d\n", Ext2SuperBlock->error_handling);
TRACE("minor_revision_level: %d\n", Ext2SuperBlock->minor_revision_level);
TRACE("lastcheck: %d\n", Ext2SuperBlock->lastcheck);
TRACE("checkinterval: %d\n", Ext2SuperBlock->checkinterval);
TRACE("creator_os: %d\n", Ext2SuperBlock->creator_os);
TRACE("revision_level: %d\n", Ext2SuperBlock->revision_level);
TRACE("uid_reserved: %d\n", Ext2SuperBlock->uid_reserved);
TRACE("gid_reserved: %d\n", Ext2SuperBlock->gid_reserved);
TRACE("first_inode: %d\n", Ext2SuperBlock->first_inode);
TRACE("inode_size: %d\n", Ext2SuperBlock->inode_size);
TRACE("block_group_number: %d\n", Ext2SuperBlock->block_group_number);
TRACE("feature_compatibility: 0x%x\n", Ext2SuperBlock->feature_compatibility);
TRACE("feature_incompat: 0x%x\n", Ext2SuperBlock->feature_incompat);
TRACE("feature_ro_compat: 0x%x\n", Ext2SuperBlock->feature_ro_compat);
TRACE("unique_id = { 0x%x, 0x%x, 0x%x, 0x%x }\n",
Ext2SuperBlock->unique_id[0], Ext2SuperBlock->unique_id[1], Ext2SuperBlock->unique_id[2], Ext2SuperBlock->unique_id[3]);
DPRINTM(DPRINT_FILESYSTEM, "volume_name = '%.16s'\n", Ext2SuperBlock->volume_name);
DPRINTM(DPRINT_FILESYSTEM, "last_mounted_on = '%.64s'\n", Ext2SuperBlock->last_mounted_on);
DPRINTM(DPRINT_FILESYSTEM, "compression_info = 0x%x\n", Ext2SuperBlock->compression_info);
TRACE("volume_name = '%.16s'\n", Ext2SuperBlock->volume_name);
TRACE("last_mounted_on = '%.64s'\n", Ext2SuperBlock->last_mounted_on);
TRACE("compression_info = 0x%x\n", Ext2SuperBlock->compression_info);
//
// Check the super block magic
@ -677,13 +679,13 @@ BOOLEAN Ext2ReadSuperBlock(VOID)
// Calculate the group count
Ext2GroupCount = (Ext2SuperBlock->total_blocks - Ext2SuperBlock->first_data_block + Ext2SuperBlock->blocks_per_group - 1) / Ext2SuperBlock->blocks_per_group;
DPRINTM(DPRINT_FILESYSTEM, "Ext2GroupCount: %d\n", Ext2GroupCount);
TRACE("Ext2GroupCount: %d\n", Ext2GroupCount);
// Calculate the block size
Ext2BlockSizeInBytes = 1024 << Ext2SuperBlock->log2_block_size;
Ext2BlockSizeInSectors = Ext2BlockSizeInBytes / Ext2DiskGeometry.BytesPerSector;
DPRINTM(DPRINT_FILESYSTEM, "Ext2BlockSizeInBytes: %d\n", Ext2BlockSizeInBytes);
DPRINTM(DPRINT_FILESYSTEM, "Ext2BlockSizeInSectors: %d\n", Ext2BlockSizeInSectors);
TRACE("Ext2BlockSizeInBytes: %d\n", Ext2BlockSizeInBytes);
TRACE("Ext2BlockSizeInSectors: %d\n", Ext2BlockSizeInSectors);
// Calculate the fragment size
if (Ext2SuperBlock->log2_fragment_size >= 0)
@ -695,8 +697,8 @@ BOOLEAN Ext2ReadSuperBlock(VOID)
Ext2FragmentSizeInBytes = 1024 >> -(Ext2SuperBlock->log2_fragment_size);
}
Ext2FragmentSizeInSectors = Ext2FragmentSizeInBytes / Ext2DiskGeometry.BytesPerSector;
DPRINTM(DPRINT_FILESYSTEM, "Ext2FragmentSizeInBytes: %d\n", Ext2FragmentSizeInBytes);
DPRINTM(DPRINT_FILESYSTEM, "Ext2FragmentSizeInSectors: %d\n", Ext2FragmentSizeInSectors);
TRACE("Ext2FragmentSizeInBytes: %d\n", Ext2FragmentSizeInBytes);
TRACE("Ext2FragmentSizeInSectors: %d\n", Ext2FragmentSizeInSectors);
// Verify that the fragment size and the block size are equal
if (Ext2BlockSizeInBytes != Ext2FragmentSizeInBytes)
@ -707,11 +709,11 @@ BOOLEAN Ext2ReadSuperBlock(VOID)
// Calculate the number of inodes in one block
Ext2InodesPerBlock = Ext2BlockSizeInBytes / EXT2_INODE_SIZE(Ext2SuperBlock);
DPRINTM(DPRINT_FILESYSTEM, "Ext2InodesPerBlock: %d\n", Ext2InodesPerBlock);
TRACE("Ext2InodesPerBlock: %d\n", Ext2InodesPerBlock);
// Calculate the number of group descriptors in one block
Ext2GroupDescPerBlock = EXT2_DESC_PER_BLOCK(Ext2SuperBlock);
DPRINTM(DPRINT_FILESYSTEM, "Ext2GroupDescPerBlock: %d\n", Ext2GroupDescPerBlock);
TRACE("Ext2GroupDescPerBlock: %d\n", Ext2GroupDescPerBlock);
return TRUE;
}
@ -721,7 +723,7 @@ BOOLEAN Ext2ReadGroupDescriptors(VOID)
ULONG GroupDescBlockCount;
ULONG CurrentGroupDescBlock;
DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadGroupDescriptors()\n");
TRACE("Ext2ReadGroupDescriptors()\n");
//
// Free any memory previously allocated
@ -766,7 +768,7 @@ BOOLEAN Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE Inode
{
EXT2_FILE_INFO DirectoryFileInfo;
DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadDirectory() Inode = %d\n", Inode);
TRACE("Ext2ReadDirectory() Inode = %d\n", Inode);
// Read the directory inode
if (!Ext2ReadInode(Inode, InodePointer))
@ -826,7 +828,7 @@ BOOLEAN Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer)
{
CHAR ErrorString[80];
DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadBlock() BlockNumber = %d Buffer = 0x%x\n", BlockNumber, Buffer);
TRACE("Ext2ReadBlock() BlockNumber = %d Buffer = 0x%x\n", BlockNumber, Buffer);
// Make sure its a valid block
if (BlockNumber > Ext2SuperBlock->total_blocks)
@ -839,7 +841,7 @@ BOOLEAN Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer)
// Check to see if this is a sparse block
if (BlockNumber == 0)
{
DPRINTM(DPRINT_FILESYSTEM, "Block is part of a sparse file. Zeroing input buffer.\n");
TRACE("Block is part of a sparse file. Zeroing input buffer.\n");
RtlZeroMemory(Buffer, Ext2BlockSizeInBytes);
@ -856,7 +858,7 @@ BOOLEAN Ext2ReadBlock(ULONG BlockNumber, PVOID Buffer)
BOOLEAN Ext2ReadPartialBlock(ULONG BlockNumber, ULONG StartingOffset, ULONG Length, PVOID Buffer)
{
DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadPartialBlock() BlockNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", BlockNumber, StartingOffset, Length, Buffer);
TRACE("Ext2ReadPartialBlock() BlockNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", BlockNumber, StartingOffset, Length, Buffer);
if (!Ext2ReadBlock(BlockNumber, (PVOID)FILESYSBUFFER))
{
@ -901,7 +903,7 @@ BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer)
CHAR ErrorString[80];
EXT2_GROUP_DESC GroupDescriptor;
DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadInode() Inode = %d\n", Inode);
TRACE("Ext2ReadInode() Inode = %d\n", Inode);
// Make sure its a valid inode
if ((Inode < 1) || (Inode > Ext2SuperBlock->total_inodes))
@ -915,9 +917,9 @@ BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer)
InodeGroupNumber = Ext2GetInodeGroupNumber(Inode);
InodeBlockNumber = Ext2GetInodeBlockNumber(Inode);
InodeOffsetInBlock = Ext2GetInodeOffsetInBlock(Inode);
DPRINTM(DPRINT_FILESYSTEM, "InodeGroupNumber = %d\n", InodeGroupNumber);
DPRINTM(DPRINT_FILESYSTEM, "InodeBlockNumber = %d\n", InodeBlockNumber);
DPRINTM(DPRINT_FILESYSTEM, "InodeOffsetInBlock = %d\n", InodeOffsetInBlock);
TRACE("InodeGroupNumber = %d\n", InodeGroupNumber);
TRACE("InodeBlockNumber = %d\n", InodeBlockNumber);
TRACE("InodeOffsetInBlock = %d\n", InodeOffsetInBlock);
// Read the group descriptor
if (!Ext2ReadGroupDescriptor(InodeGroupNumber, &GroupDescriptor))
@ -927,7 +929,7 @@ BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer)
// Add the start block of the inode table to the inode block number
InodeBlockNumber += GroupDescriptor.inode_table_id;
DPRINTM(DPRINT_FILESYSTEM, "InodeBlockNumber (after group desc correction) = %d\n", InodeBlockNumber);
TRACE("InodeBlockNumber (after group desc correction) = %d\n", InodeBlockNumber);
// Read the block
if (!Ext2ReadBlock(InodeBlockNumber, (PVOID)FILESYSBUFFER))
@ -938,31 +940,31 @@ BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer)
// Copy the data to their buffer
RtlCopyMemory(InodeBuffer, (PVOID)((ULONG_PTR)FILESYSBUFFER + (InodeOffsetInBlock * EXT2_INODE_SIZE(Ext2SuperBlock))), sizeof(EXT2_INODE));
DPRINTM(DPRINT_FILESYSTEM, "Dumping inode information:\n");
DPRINTM(DPRINT_FILESYSTEM, "mode = 0x%x\n", InodeBuffer->mode);
DPRINTM(DPRINT_FILESYSTEM, "uid = %d\n", InodeBuffer->uid);
DPRINTM(DPRINT_FILESYSTEM, "size = %d\n", InodeBuffer->size);
DPRINTM(DPRINT_FILESYSTEM, "atime = %d\n", InodeBuffer->atime);
DPRINTM(DPRINT_FILESYSTEM, "ctime = %d\n", InodeBuffer->ctime);
DPRINTM(DPRINT_FILESYSTEM, "mtime = %d\n", InodeBuffer->mtime);
DPRINTM(DPRINT_FILESYSTEM, "dtime = %d\n", InodeBuffer->dtime);
DPRINTM(DPRINT_FILESYSTEM, "gid = %d\n", InodeBuffer->gid);
DPRINTM(DPRINT_FILESYSTEM, "nlinks = %d\n", InodeBuffer->nlinks);
DPRINTM(DPRINT_FILESYSTEM, "blockcnt = %d\n", InodeBuffer->blockcnt);
DPRINTM(DPRINT_FILESYSTEM, "flags = 0x%x\n", InodeBuffer->flags);
DPRINTM(DPRINT_FILESYSTEM, "osd1 = 0x%x\n", InodeBuffer->osd1);
DPRINTM(DPRINT_FILESYSTEM, "dir_blocks = { %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u }\n",
TRACE("Dumping inode information:\n");
TRACE("mode = 0x%x\n", InodeBuffer->mode);
TRACE("uid = %d\n", InodeBuffer->uid);
TRACE("size = %d\n", InodeBuffer->size);
TRACE("atime = %d\n", InodeBuffer->atime);
TRACE("ctime = %d\n", InodeBuffer->ctime);
TRACE("mtime = %d\n", InodeBuffer->mtime);
TRACE("dtime = %d\n", InodeBuffer->dtime);
TRACE("gid = %d\n", InodeBuffer->gid);
TRACE("nlinks = %d\n", InodeBuffer->nlinks);
TRACE("blockcnt = %d\n", InodeBuffer->blockcnt);
TRACE("flags = 0x%x\n", InodeBuffer->flags);
TRACE("osd1 = 0x%x\n", InodeBuffer->osd1);
TRACE("dir_blocks = { %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u }\n",
InodeBuffer->blocks.dir_blocks[0], InodeBuffer->blocks.dir_blocks[1], InodeBuffer->blocks.dir_blocks[ 2], InodeBuffer->blocks.dir_blocks[ 3],
InodeBuffer->blocks.dir_blocks[4], InodeBuffer->blocks.dir_blocks[5], InodeBuffer->blocks.dir_blocks[ 6], InodeBuffer->blocks.dir_blocks[ 7],
InodeBuffer->blocks.dir_blocks[8], InodeBuffer->blocks.dir_blocks[9], InodeBuffer->blocks.dir_blocks[10], InodeBuffer->blocks.dir_blocks[11]);
DPRINTM(DPRINT_FILESYSTEM, "indir_block = %u\n", InodeBuffer->blocks.indir_block);
DPRINTM(DPRINT_FILESYSTEM, "double_indir_block = %u\n", InodeBuffer->blocks.double_indir_block);
DPRINTM(DPRINT_FILESYSTEM, "tripple_indir_block = %u\n", InodeBuffer->blocks.tripple_indir_block);
DPRINTM(DPRINT_FILESYSTEM, "version = %d\n", InodeBuffer->version);
DPRINTM(DPRINT_FILESYSTEM, "acl = %d\n", InodeBuffer->acl);
DPRINTM(DPRINT_FILESYSTEM, "dir_acl = %d\n", InodeBuffer->dir_acl);
DPRINTM(DPRINT_FILESYSTEM, "fragment_addr = %d\n", InodeBuffer->fragment_addr);
DPRINTM(DPRINT_FILESYSTEM, "osd2 = { %d, %d, %d }\n",
TRACE("indir_block = %u\n", InodeBuffer->blocks.indir_block);
TRACE("double_indir_block = %u\n", InodeBuffer->blocks.double_indir_block);
TRACE("tripple_indir_block = %u\n", InodeBuffer->blocks.tripple_indir_block);
TRACE("version = %d\n", InodeBuffer->version);
TRACE("acl = %d\n", InodeBuffer->acl);
TRACE("dir_acl = %d\n", InodeBuffer->dir_acl);
TRACE("fragment_addr = %d\n", InodeBuffer->fragment_addr);
TRACE("osd2 = { %d, %d, %d }\n",
InodeBuffer->osd2[0], InodeBuffer->osd2[1], InodeBuffer->osd2[2]);
return TRUE;
@ -970,7 +972,7 @@ BOOLEAN Ext2ReadInode(ULONG Inode, PEXT2_INODE InodeBuffer)
BOOLEAN Ext2ReadGroupDescriptor(ULONG Group, PEXT2_GROUP_DESC GroupBuffer)
{
DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadGroupDescriptor()\n");
TRACE("Ext2ReadGroupDescriptor()\n");
/*if (!Ext2ReadBlock(Ext2GetGroupDescBlockNumber(Group), (PVOID)FILESYSBUFFER))
{
@ -981,13 +983,13 @@ BOOLEAN Ext2ReadGroupDescriptor(ULONG Group, PEXT2_GROUP_DESC GroupBuffer)
RtlCopyMemory(GroupBuffer, &Ext2GroupDescriptors[Group], sizeof(EXT2_GROUP_DESC));
DPRINTM(DPRINT_FILESYSTEM, "Dumping group descriptor:\n");
DPRINTM(DPRINT_FILESYSTEM, "block_id = %d\n", GroupBuffer->block_id);
DPRINTM(DPRINT_FILESYSTEM, "inode_id = %d\n", GroupBuffer->inode_id);
DPRINTM(DPRINT_FILESYSTEM, "inode_table_id = %d\n", GroupBuffer->inode_table_id);
DPRINTM(DPRINT_FILESYSTEM, "free_blocks = %d\n", GroupBuffer->free_blocks);
DPRINTM(DPRINT_FILESYSTEM, "free_inodes = %d\n", GroupBuffer->free_inodes);
DPRINTM(DPRINT_FILESYSTEM, "used_dirs = %d\n", GroupBuffer->used_dirs);
TRACE("Dumping group descriptor:\n");
TRACE("block_id = %d\n", GroupBuffer->block_id);
TRACE("inode_id = %d\n", GroupBuffer->inode_id);
TRACE("inode_table_id = %d\n", GroupBuffer->inode_table_id);
TRACE("free_blocks = %d\n", GroupBuffer->free_blocks);
TRACE("free_inodes = %d\n", GroupBuffer->free_inodes);
TRACE("used_dirs = %d\n", GroupBuffer->used_dirs);
return TRUE;
}
@ -1000,7 +1002,7 @@ ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode)
ULONG CurrentBlockInList;
ULONG CurrentBlock;
DPRINTM(DPRINT_FILESYSTEM, "Ext2ReadBlockPointerList()\n");
TRACE("Ext2ReadBlockPointerList()\n");
// Get the number of blocks this file occupies
// I would just use Inode->i_blocks but it
@ -1080,7 +1082,7 @@ BOOLEAN Ext2CopyIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBlockInLis
ULONG CurrentBlock;
ULONG BlockPointersPerBlock;
DPRINTM(DPRINT_FILESYSTEM, "Ext2CopyIndirectBlockPointers() BlockCount = %d\n", BlockCount);
TRACE("Ext2CopyIndirectBlockPointers() BlockCount = %d\n", BlockCount);
BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
@ -1104,7 +1106,7 @@ BOOLEAN Ext2CopyDoubleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBloc
ULONG CurrentBlock;
ULONG BlockPointersPerBlock;
DPRINTM(DPRINT_FILESYSTEM, "Ext2CopyDoubleIndirectBlockPointers() BlockCount = %d\n", BlockCount);
TRACE("Ext2CopyDoubleIndirectBlockPointers() BlockCount = %d\n", BlockCount);
BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
@ -1139,7 +1141,7 @@ BOOLEAN Ext2CopyTripleIndirectBlockPointers(ULONG* BlockList, ULONG* CurrentBloc
ULONG CurrentBlock;
ULONG BlockPointersPerBlock;
DPRINTM(DPRINT_FILESYSTEM, "Ext2CopyTripleIndirectBlockPointers() BlockCount = %d\n", BlockCount);
TRACE("Ext2CopyTripleIndirectBlockPointers() BlockCount = %d\n", BlockCount);
BlockPointersPerBlock = Ext2BlockSizeInBytes / sizeof(ULONG);
@ -1185,9 +1187,9 @@ LONG Ext2GetFileInformation(ULONG FileId, FILEINFORMATION* Information)
Information->EndingAddress.QuadPart = FileHandle->FileSize;
Information->CurrentAddress.QuadPart = FileHandle->FilePointer;
DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileInformation() FileSize = %d\n",
TRACE("Ext2GetFileInformation() FileSize = %d\n",
Information->EndingAddress.LowPart);
DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileInformation() FilePointer = %d\n",
TRACE("Ext2GetFileInformation() FilePointer = %d\n",
Information->CurrentAddress.LowPart);
return ESUCCESS;
@ -1203,7 +1205,7 @@ LONG Ext2Open(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
//DeviceId = FsGetDeviceId(*FileId);
DPRINTM(DPRINT_FILESYSTEM, "Ext2Open() FileName = %s\n", Path);
TRACE("Ext2Open() FileName = %s\n", Path);
//
// Call old open method
@ -1248,7 +1250,7 @@ LONG Ext2Seek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
{
PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
DPRINTM(DPRINT_FILESYSTEM, "Ext2Seek() NewFilePointer = %lu\n", Position->LowPart);
TRACE("Ext2Seek() NewFilePointer = %lu\n", Position->LowPart);
if (SeekMode != SeekAbsolute)
return EINVAL;

View file

@ -23,6 +23,8 @@
#define NDEBUG
#include <debug.h>
DBG_DEFAULT_CHANNEL(FILESYSTEM);
ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONGLONG PartitionSectorCount);
PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOLEAN RootDirectory);
BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID DirectoryBuffer, ULONG EntryCount, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer);
@ -139,7 +141,7 @@ BOOLEAN FatOpenVolume(PFAT_VOLUME_INFO Volume, PFAT_BOOTSECTOR BootSector, ULONG
PFAT32_BOOTSECTOR Fat32VolumeBootSector;
PFATX_BOOTSECTOR FatXVolumeBootSector;
DPRINTM(DPRINT_FILESYSTEM, "FatOpenVolume() DeviceId = %d\n", Volume->DeviceId);
TRACE("FatOpenVolume() DeviceId = %d\n", Volume->DeviceId);
//
// Allocate the memory to hold the boot sector
@ -152,81 +154,81 @@ BOOLEAN FatOpenVolume(PFAT_VOLUME_INFO Volume, PFAT_BOOTSECTOR BootSector, ULONG
Volume->FatType = FatDetermineFatType(FatVolumeBootSector, PartitionSectorCount);
// Dump boot sector (and swap it for big endian systems)
DPRINTM(DPRINT_FILESYSTEM, "Dumping boot sector:\n");
TRACE("Dumping boot sector:\n");
if (ISFATX(Volume->FatType))
{
FatSwapFatXBootSector(FatXVolumeBootSector);
DPRINTM(DPRINT_FILESYSTEM, "sizeof(FATX_BOOTSECTOR) = 0x%x.\n", sizeof(FATX_BOOTSECTOR));
TRACE("sizeof(FATX_BOOTSECTOR) = 0x%x.\n", sizeof(FATX_BOOTSECTOR));
DPRINTM(DPRINT_FILESYSTEM, "FileSystemType: %c%c%c%c.\n", FatXVolumeBootSector->FileSystemType[0], FatXVolumeBootSector->FileSystemType[1], FatXVolumeBootSector->FileSystemType[2], FatXVolumeBootSector->FileSystemType[3]);
DPRINTM(DPRINT_FILESYSTEM, "VolumeSerialNumber: 0x%x\n", FatXVolumeBootSector->VolumeSerialNumber);
DPRINTM(DPRINT_FILESYSTEM, "SectorsPerCluster: %d\n", FatXVolumeBootSector->SectorsPerCluster);
DPRINTM(DPRINT_FILESYSTEM, "NumberOfFats: %d\n", FatXVolumeBootSector->NumberOfFats);
DPRINTM(DPRINT_FILESYSTEM, "Unknown: 0x%x\n", FatXVolumeBootSector->Unknown);
TRACE("FileSystemType: %c%c%c%c.\n", FatXVolumeBootSector->FileSystemType[0], FatXVolumeBootSector->FileSystemType[1], FatXVolumeBootSector->FileSystemType[2], FatXVolumeBootSector->FileSystemType[3]);
TRACE("VolumeSerialNumber: 0x%x\n", FatXVolumeBootSector->VolumeSerialNumber);
TRACE("SectorsPerCluster: %d\n", FatXVolumeBootSector->SectorsPerCluster);
TRACE("NumberOfFats: %d\n", FatXVolumeBootSector->NumberOfFats);
TRACE("Unknown: 0x%x\n", FatXVolumeBootSector->Unknown);
DPRINTM(DPRINT_FILESYSTEM, "FatType %s\n", Volume->FatType == FATX16 ? "FATX16" : "FATX32");
TRACE("FatType %s\n", Volume->FatType == FATX16 ? "FATX16" : "FATX32");
}
else if (Volume->FatType == FAT32)
{
FatSwapFat32BootSector(Fat32VolumeBootSector);
DPRINTM(DPRINT_FILESYSTEM, "sizeof(FAT32_BOOTSECTOR) = 0x%x.\n", sizeof(FAT32_BOOTSECTOR));
TRACE("sizeof(FAT32_BOOTSECTOR) = 0x%x.\n", sizeof(FAT32_BOOTSECTOR));
DPRINTM(DPRINT_FILESYSTEM, "JumpBoot: 0x%x 0x%x 0x%x\n", Fat32VolumeBootSector->JumpBoot[0], Fat32VolumeBootSector->JumpBoot[1], Fat32VolumeBootSector->JumpBoot[2]);
DPRINTM(DPRINT_FILESYSTEM, "OemName: %c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->OemName[0], Fat32VolumeBootSector->OemName[1], Fat32VolumeBootSector->OemName[2], Fat32VolumeBootSector->OemName[3], Fat32VolumeBootSector->OemName[4], Fat32VolumeBootSector->OemName[5], Fat32VolumeBootSector->OemName[6], Fat32VolumeBootSector->OemName[7]);
DPRINTM(DPRINT_FILESYSTEM, "BytesPerSector: %d\n", Fat32VolumeBootSector->BytesPerSector);
DPRINTM(DPRINT_FILESYSTEM, "SectorsPerCluster: %d\n", Fat32VolumeBootSector->SectorsPerCluster);
DPRINTM(DPRINT_FILESYSTEM, "ReservedSectors: %d\n", Fat32VolumeBootSector->ReservedSectors);
DPRINTM(DPRINT_FILESYSTEM, "NumberOfFats: %d\n", Fat32VolumeBootSector->NumberOfFats);
DPRINTM(DPRINT_FILESYSTEM, "RootDirEntries: %d\n", Fat32VolumeBootSector->RootDirEntries);
DPRINTM(DPRINT_FILESYSTEM, "TotalSectors: %d\n", Fat32VolumeBootSector->TotalSectors);
DPRINTM(DPRINT_FILESYSTEM, "MediaDescriptor: 0x%x\n", Fat32VolumeBootSector->MediaDescriptor);
DPRINTM(DPRINT_FILESYSTEM, "SectorsPerFat: %d\n", Fat32VolumeBootSector->SectorsPerFat);
DPRINTM(DPRINT_FILESYSTEM, "SectorsPerTrack: %d\n", Fat32VolumeBootSector->SectorsPerTrack);
DPRINTM(DPRINT_FILESYSTEM, "NumberOfHeads: %d\n", Fat32VolumeBootSector->NumberOfHeads);
DPRINTM(DPRINT_FILESYSTEM, "HiddenSectors: %d\n", Fat32VolumeBootSector->HiddenSectors);
DPRINTM(DPRINT_FILESYSTEM, "TotalSectorsBig: %d\n", Fat32VolumeBootSector->TotalSectorsBig);
DPRINTM(DPRINT_FILESYSTEM, "SectorsPerFatBig: %d\n", Fat32VolumeBootSector->SectorsPerFatBig);
DPRINTM(DPRINT_FILESYSTEM, "ExtendedFlags: 0x%x\n", Fat32VolumeBootSector->ExtendedFlags);
DPRINTM(DPRINT_FILESYSTEM, "FileSystemVersion: 0x%x\n", Fat32VolumeBootSector->FileSystemVersion);
DPRINTM(DPRINT_FILESYSTEM, "RootDirStartCluster: %d\n", Fat32VolumeBootSector->RootDirStartCluster);
DPRINTM(DPRINT_FILESYSTEM, "FsInfo: %d\n", Fat32VolumeBootSector->FsInfo);
DPRINTM(DPRINT_FILESYSTEM, "BackupBootSector: %d\n", Fat32VolumeBootSector->BackupBootSector);
DPRINTM(DPRINT_FILESYSTEM, "Reserved: 0x%x\n", Fat32VolumeBootSector->Reserved);
DPRINTM(DPRINT_FILESYSTEM, "DriveNumber: 0x%x\n", Fat32VolumeBootSector->DriveNumber);
DPRINTM(DPRINT_FILESYSTEM, "Reserved1: 0x%x\n", Fat32VolumeBootSector->Reserved1);
DPRINTM(DPRINT_FILESYSTEM, "BootSignature: 0x%x\n", Fat32VolumeBootSector->BootSignature);
DPRINTM(DPRINT_FILESYSTEM, "VolumeSerialNumber: 0x%x\n", Fat32VolumeBootSector->VolumeSerialNumber);
DPRINTM(DPRINT_FILESYSTEM, "VolumeLabel: %c%c%c%c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->VolumeLabel[0], Fat32VolumeBootSector->VolumeLabel[1], Fat32VolumeBootSector->VolumeLabel[2], Fat32VolumeBootSector->VolumeLabel[3], Fat32VolumeBootSector->VolumeLabel[4], Fat32VolumeBootSector->VolumeLabel[5], Fat32VolumeBootSector->VolumeLabel[6], Fat32VolumeBootSector->VolumeLabel[7], Fat32VolumeBootSector->VolumeLabel[8], Fat32VolumeBootSector->VolumeLabel[9], Fat32VolumeBootSector->VolumeLabel[10]);
DPRINTM(DPRINT_FILESYSTEM, "FileSystemType: %c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->FileSystemType[0], Fat32VolumeBootSector->FileSystemType[1], Fat32VolumeBootSector->FileSystemType[2], Fat32VolumeBootSector->FileSystemType[3], Fat32VolumeBootSector->FileSystemType[4], Fat32VolumeBootSector->FileSystemType[5], Fat32VolumeBootSector->FileSystemType[6], Fat32VolumeBootSector->FileSystemType[7]);
DPRINTM(DPRINT_FILESYSTEM, "BootSectorMagic: 0x%x\n", Fat32VolumeBootSector->BootSectorMagic);
TRACE("JumpBoot: 0x%x 0x%x 0x%x\n", Fat32VolumeBootSector->JumpBoot[0], Fat32VolumeBootSector->JumpBoot[1], Fat32VolumeBootSector->JumpBoot[2]);
TRACE("OemName: %c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->OemName[0], Fat32VolumeBootSector->OemName[1], Fat32VolumeBootSector->OemName[2], Fat32VolumeBootSector->OemName[3], Fat32VolumeBootSector->OemName[4], Fat32VolumeBootSector->OemName[5], Fat32VolumeBootSector->OemName[6], Fat32VolumeBootSector->OemName[7]);
TRACE("BytesPerSector: %d\n", Fat32VolumeBootSector->BytesPerSector);
TRACE("SectorsPerCluster: %d\n", Fat32VolumeBootSector->SectorsPerCluster);
TRACE("ReservedSectors: %d\n", Fat32VolumeBootSector->ReservedSectors);
TRACE("NumberOfFats: %d\n", Fat32VolumeBootSector->NumberOfFats);
TRACE("RootDirEntries: %d\n", Fat32VolumeBootSector->RootDirEntries);
TRACE("TotalSectors: %d\n", Fat32VolumeBootSector->TotalSectors);
TRACE("MediaDescriptor: 0x%x\n", Fat32VolumeBootSector->MediaDescriptor);
TRACE("SectorsPerFat: %d\n", Fat32VolumeBootSector->SectorsPerFat);
TRACE("SectorsPerTrack: %d\n", Fat32VolumeBootSector->SectorsPerTrack);
TRACE("NumberOfHeads: %d\n", Fat32VolumeBootSector->NumberOfHeads);
TRACE("HiddenSectors: %d\n", Fat32VolumeBootSector->HiddenSectors);
TRACE("TotalSectorsBig: %d\n", Fat32VolumeBootSector->TotalSectorsBig);
TRACE("SectorsPerFatBig: %d\n", Fat32VolumeBootSector->SectorsPerFatBig);
TRACE("ExtendedFlags: 0x%x\n", Fat32VolumeBootSector->ExtendedFlags);
TRACE("FileSystemVersion: 0x%x\n", Fat32VolumeBootSector->FileSystemVersion);
TRACE("RootDirStartCluster: %d\n", Fat32VolumeBootSector->RootDirStartCluster);
TRACE("FsInfo: %d\n", Fat32VolumeBootSector->FsInfo);
TRACE("BackupBootSector: %d\n", Fat32VolumeBootSector->BackupBootSector);
TRACE("Reserved: 0x%x\n", Fat32VolumeBootSector->Reserved);
TRACE("DriveNumber: 0x%x\n", Fat32VolumeBootSector->DriveNumber);
TRACE("Reserved1: 0x%x\n", Fat32VolumeBootSector->Reserved1);
TRACE("BootSignature: 0x%x\n", Fat32VolumeBootSector->BootSignature);
TRACE("VolumeSerialNumber: 0x%x\n", Fat32VolumeBootSector->VolumeSerialNumber);
TRACE("VolumeLabel: %c%c%c%c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->VolumeLabel[0], Fat32VolumeBootSector->VolumeLabel[1], Fat32VolumeBootSector->VolumeLabel[2], Fat32VolumeBootSector->VolumeLabel[3], Fat32VolumeBootSector->VolumeLabel[4], Fat32VolumeBootSector->VolumeLabel[5], Fat32VolumeBootSector->VolumeLabel[6], Fat32VolumeBootSector->VolumeLabel[7], Fat32VolumeBootSector->VolumeLabel[8], Fat32VolumeBootSector->VolumeLabel[9], Fat32VolumeBootSector->VolumeLabel[10]);
TRACE("FileSystemType: %c%c%c%c%c%c%c%c\n", Fat32VolumeBootSector->FileSystemType[0], Fat32VolumeBootSector->FileSystemType[1], Fat32VolumeBootSector->FileSystemType[2], Fat32VolumeBootSector->FileSystemType[3], Fat32VolumeBootSector->FileSystemType[4], Fat32VolumeBootSector->FileSystemType[5], Fat32VolumeBootSector->FileSystemType[6], Fat32VolumeBootSector->FileSystemType[7]);
TRACE("BootSectorMagic: 0x%x\n", Fat32VolumeBootSector->BootSectorMagic);
}
else
{
FatSwapFatBootSector(FatVolumeBootSector);
DPRINTM(DPRINT_FILESYSTEM, "sizeof(FAT_BOOTSECTOR) = 0x%x.\n", sizeof(FAT_BOOTSECTOR));
TRACE("sizeof(FAT_BOOTSECTOR) = 0x%x.\n", sizeof(FAT_BOOTSECTOR));
DPRINTM(DPRINT_FILESYSTEM, "JumpBoot: 0x%x 0x%x 0x%x\n", FatVolumeBootSector->JumpBoot[0], FatVolumeBootSector->JumpBoot[1], FatVolumeBootSector->JumpBoot[2]);
DPRINTM(DPRINT_FILESYSTEM, "OemName: %c%c%c%c%c%c%c%c\n", FatVolumeBootSector->OemName[0], FatVolumeBootSector->OemName[1], FatVolumeBootSector->OemName[2], FatVolumeBootSector->OemName[3], FatVolumeBootSector->OemName[4], FatVolumeBootSector->OemName[5], FatVolumeBootSector->OemName[6], FatVolumeBootSector->OemName[7]);
DPRINTM(DPRINT_FILESYSTEM, "BytesPerSector: %d\n", FatVolumeBootSector->BytesPerSector);
DPRINTM(DPRINT_FILESYSTEM, "SectorsPerCluster: %d\n", FatVolumeBootSector->SectorsPerCluster);
DPRINTM(DPRINT_FILESYSTEM, "ReservedSectors: %d\n", FatVolumeBootSector->ReservedSectors);
DPRINTM(DPRINT_FILESYSTEM, "NumberOfFats: %d\n", FatVolumeBootSector->NumberOfFats);
DPRINTM(DPRINT_FILESYSTEM, "RootDirEntries: %d\n", FatVolumeBootSector->RootDirEntries);
DPRINTM(DPRINT_FILESYSTEM, "TotalSectors: %d\n", FatVolumeBootSector->TotalSectors);
DPRINTM(DPRINT_FILESYSTEM, "MediaDescriptor: 0x%x\n", FatVolumeBootSector->MediaDescriptor);
DPRINTM(DPRINT_FILESYSTEM, "SectorsPerFat: %d\n", FatVolumeBootSector->SectorsPerFat);
DPRINTM(DPRINT_FILESYSTEM, "SectorsPerTrack: %d\n", FatVolumeBootSector->SectorsPerTrack);
DPRINTM(DPRINT_FILESYSTEM, "NumberOfHeads: %d\n", FatVolumeBootSector->NumberOfHeads);
DPRINTM(DPRINT_FILESYSTEM, "HiddenSectors: %d\n", FatVolumeBootSector->HiddenSectors);
DPRINTM(DPRINT_FILESYSTEM, "TotalSectorsBig: %d\n", FatVolumeBootSector->TotalSectorsBig);
DPRINTM(DPRINT_FILESYSTEM, "DriveNumber: 0x%x\n", FatVolumeBootSector->DriveNumber);
DPRINTM(DPRINT_FILESYSTEM, "Reserved1: 0x%x\n", FatVolumeBootSector->Reserved1);
DPRINTM(DPRINT_FILESYSTEM, "BootSignature: 0x%x\n", FatVolumeBootSector->BootSignature);
DPRINTM(DPRINT_FILESYSTEM, "VolumeSerialNumber: 0x%x\n", FatVolumeBootSector->VolumeSerialNumber);
DPRINTM(DPRINT_FILESYSTEM, "VolumeLabel: %c%c%c%c%c%c%c%c%c%c%c\n", FatVolumeBootSector->VolumeLabel[0], FatVolumeBootSector->VolumeLabel[1], FatVolumeBootSector->VolumeLabel[2], FatVolumeBootSector->VolumeLabel[3], FatVolumeBootSector->VolumeLabel[4], FatVolumeBootSector->VolumeLabel[5], FatVolumeBootSector->VolumeLabel[6], FatVolumeBootSector->VolumeLabel[7], FatVolumeBootSector->VolumeLabel[8], FatVolumeBootSector->VolumeLabel[9], FatVolumeBootSector->VolumeLabel[10]);
DPRINTM(DPRINT_FILESYSTEM, "FileSystemType: %c%c%c%c%c%c%c%c\n", FatVolumeBootSector->FileSystemType[0], FatVolumeBootSector->FileSystemType[1], FatVolumeBootSector->FileSystemType[2], FatVolumeBootSector->FileSystemType[3], FatVolumeBootSector->FileSystemType[4], FatVolumeBootSector->FileSystemType[5], FatVolumeBootSector->FileSystemType[6], FatVolumeBootSector->FileSystemType[7]);
DPRINTM(DPRINT_FILESYSTEM, "BootSectorMagic: 0x%x\n", FatVolumeBootSector->BootSectorMagic);
TRACE("JumpBoot: 0x%x 0x%x 0x%x\n", FatVolumeBootSector->JumpBoot[0], FatVolumeBootSector->JumpBoot[1], FatVolumeBootSector->JumpBoot[2]);
TRACE("OemName: %c%c%c%c%c%c%c%c\n", FatVolumeBootSector->OemName[0], FatVolumeBootSector->OemName[1], FatVolumeBootSector->OemName[2], FatVolumeBootSector->OemName[3], FatVolumeBootSector->OemName[4], FatVolumeBootSector->OemName[5], FatVolumeBootSector->OemName[6], FatVolumeBootSector->OemName[7]);
TRACE("BytesPerSector: %d\n", FatVolumeBootSector->BytesPerSector);
TRACE("SectorsPerCluster: %d\n", FatVolumeBootSector->SectorsPerCluster);
TRACE("ReservedSectors: %d\n", FatVolumeBootSector->ReservedSectors);
TRACE("NumberOfFats: %d\n", FatVolumeBootSector->NumberOfFats);
TRACE("RootDirEntries: %d\n", FatVolumeBootSector->RootDirEntries);
TRACE("TotalSectors: %d\n", FatVolumeBootSector->TotalSectors);
TRACE("MediaDescriptor: 0x%x\n", FatVolumeBootSector->MediaDescriptor);
TRACE("SectorsPerFat: %d\n", FatVolumeBootSector->SectorsPerFat);
TRACE("SectorsPerTrack: %d\n", FatVolumeBootSector->SectorsPerTrack);
TRACE("NumberOfHeads: %d\n", FatVolumeBootSector->NumberOfHeads);
TRACE("HiddenSectors: %d\n", FatVolumeBootSector->HiddenSectors);
TRACE("TotalSectorsBig: %d\n", FatVolumeBootSector->TotalSectorsBig);
TRACE("DriveNumber: 0x%x\n", FatVolumeBootSector->DriveNumber);
TRACE("Reserved1: 0x%x\n", FatVolumeBootSector->Reserved1);
TRACE("BootSignature: 0x%x\n", FatVolumeBootSector->BootSignature);
TRACE("VolumeSerialNumber: 0x%x\n", FatVolumeBootSector->VolumeSerialNumber);
TRACE("VolumeLabel: %c%c%c%c%c%c%c%c%c%c%c\n", FatVolumeBootSector->VolumeLabel[0], FatVolumeBootSector->VolumeLabel[1], FatVolumeBootSector->VolumeLabel[2], FatVolumeBootSector->VolumeLabel[3], FatVolumeBootSector->VolumeLabel[4], FatVolumeBootSector->VolumeLabel[5], FatVolumeBootSector->VolumeLabel[6], FatVolumeBootSector->VolumeLabel[7], FatVolumeBootSector->VolumeLabel[8], FatVolumeBootSector->VolumeLabel[9], FatVolumeBootSector->VolumeLabel[10]);
TRACE("FileSystemType: %c%c%c%c%c%c%c%c\n", FatVolumeBootSector->FileSystemType[0], FatVolumeBootSector->FileSystemType[1], FatVolumeBootSector->FileSystemType[2], FatVolumeBootSector->FileSystemType[3], FatVolumeBootSector->FileSystemType[4], FatVolumeBootSector->FileSystemType[5], FatVolumeBootSector->FileSystemType[6], FatVolumeBootSector->FileSystemType[7]);
TRACE("BootSectorMagic: 0x%x\n", FatVolumeBootSector->BootSectorMagic);
}
//
@ -372,7 +374,7 @@ PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, U
{
PVOID DirectoryBuffer;
DPRINTM(DPRINT_FILESYSTEM, "FatBufferDirectory() DirectoryStartCluster = %d RootDirectory = %s\n", DirectoryStartCluster, (RootDirectory ? "TRUE" : "FALSE"));
TRACE("FatBufferDirectory() DirectoryStartCluster = %d RootDirectory = %s\n", DirectoryStartCluster, (RootDirectory ? "TRUE" : "FALSE"));
/*
* For FAT32, the root directory is nothing special. We can treat it the same
@ -399,7 +401,7 @@ PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, U
//
// Attempt to allocate memory for directory buffer
//
DPRINTM(DPRINT_FILESYSTEM, "Trying to allocate (DirectorySize) %d bytes.\n", *DirectorySize);
TRACE("Trying to allocate (DirectorySize) %d bytes.\n", *DirectorySize);
DirectoryBuffer = MmAllocateMemory(*DirectorySize);
if (DirectoryBuffer == NULL)
@ -444,7 +446,7 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
EntryCount = DirectorySize / sizeof(DIRENTRY);
DPRINTM(DPRINT_FILESYSTEM, "FatSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName);
TRACE("FatSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName);
memset(ShortNameBuffer, 0, 13 * sizeof(CHAR));
memset(LfnNameBuffer, 0, 261 * sizeof(CHAR));
@ -456,7 +458,7 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
OurDirEntry = *((PDIRENTRY) DirectoryBuffer);
FatSwapDirEntry(DirEntry);
//DPRINTM(DPRINT_FILESYSTEM, "Dumping directory entry %d:\n", CurrentEntry);
//TRACE("Dumping directory entry %d:\n", CurrentEntry);
//DbgDumpBuffer(DPRINT_FILESYSTEM, DirEntry, sizeof(DIRENTRY));
//
@ -557,7 +559,7 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
LfnNameBuffer[12 + (LfnDirEntry->SequenceNumber * 13)] = (UCHAR)LfnDirEntry->Name11_12[1];
}
//DPRINTM(DPRINT_FILESYSTEM, "Dumping long name buffer:\n");
//TRACE("Dumping long name buffer:\n");
//DbgDumpBuffer(DPRINT_FILESYSTEM, LfnNameBuffer, 260);
continue;
@ -588,8 +590,8 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
//
FatParseShortFileName(ShortNameBuffer, DirEntry);
//DPRINTM(DPRINT_FILESYSTEM, "Entry: %d LFN = %s\n", CurrentEntry, LfnNameBuffer);
//DPRINTM(DPRINT_FILESYSTEM, "Entry: %d DOS name = %s\n", CurrentEntry, ShortNameBuffer);
//TRACE("Entry: %d LFN = %s\n", CurrentEntry, LfnNameBuffer);
//TRACE("Entry: %d DOS name = %s\n", CurrentEntry, ShortNameBuffer);
//
// See if the file name matches either the short or long name
@ -603,25 +605,25 @@ BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID Directory
FatFileInfoPointer->FileSize = DirEntry->Size;
FatFileInfoPointer->FilePointer = 0;
DPRINTM(DPRINT_FILESYSTEM, "MSDOS Directory Entry:\n");
DPRINTM(DPRINT_FILESYSTEM, "FileName[11] = %c%c%c%c%c%c%c%c%c%c%c\n", DirEntry->FileName[0], DirEntry->FileName[1], DirEntry->FileName[2], DirEntry->FileName[3], DirEntry->FileName[4], DirEntry->FileName[5], DirEntry->FileName[6], DirEntry->FileName[7], DirEntry->FileName[8], DirEntry->FileName[9], DirEntry->FileName[10]);
DPRINTM(DPRINT_FILESYSTEM, "Attr = 0x%x\n", DirEntry->Attr);
DPRINTM(DPRINT_FILESYSTEM, "ReservedNT = 0x%x\n", DirEntry->ReservedNT);
DPRINTM(DPRINT_FILESYSTEM, "TimeInTenths = %d\n", DirEntry->TimeInTenths);
DPRINTM(DPRINT_FILESYSTEM, "CreateTime = %d\n", DirEntry->CreateTime);
DPRINTM(DPRINT_FILESYSTEM, "CreateDate = %d\n", DirEntry->CreateDate);
DPRINTM(DPRINT_FILESYSTEM, "LastAccessDate = %d\n", DirEntry->LastAccessDate);
DPRINTM(DPRINT_FILESYSTEM, "ClusterHigh = 0x%x\n", DirEntry->ClusterHigh);
DPRINTM(DPRINT_FILESYSTEM, "Time = %d\n", DirEntry->Time);
DPRINTM(DPRINT_FILESYSTEM, "Date = %d\n", DirEntry->Date);
DPRINTM(DPRINT_FILESYSTEM, "ClusterLow = 0x%x\n", DirEntry->ClusterLow);
DPRINTM(DPRINT_FILESYSTEM, "Size = %d\n", DirEntry->Size);
TRACE("MSDOS Directory Entry:\n");
TRACE("FileName[11] = %c%c%c%c%c%c%c%c%c%c%c\n", DirEntry->FileName[0], DirEntry->FileName[1], DirEntry->FileName[2], DirEntry->FileName[3], DirEntry->FileName[4], DirEntry->FileName[5], DirEntry->FileName[6], DirEntry->FileName[7], DirEntry->FileName[8], DirEntry->FileName[9], DirEntry->FileName[10]);
TRACE("Attr = 0x%x\n", DirEntry->Attr);
TRACE("ReservedNT = 0x%x\n", DirEntry->ReservedNT);
TRACE("TimeInTenths = %d\n", DirEntry->TimeInTenths);
TRACE("CreateTime = %d\n", DirEntry->CreateTime);
TRACE("CreateDate = %d\n", DirEntry->CreateDate);
TRACE("LastAccessDate = %d\n", DirEntry->LastAccessDate);
TRACE("ClusterHigh = 0x%x\n", DirEntry->ClusterHigh);
TRACE("Time = %d\n", DirEntry->Time);
TRACE("Date = %d\n", DirEntry->Date);
TRACE("ClusterLow = 0x%x\n", DirEntry->ClusterLow);
TRACE("Size = %d\n", DirEntry->Size);
//
// Get the cluster chain
//
StartCluster = ((ULONG)DirEntry->ClusterHigh << 16) + DirEntry->ClusterLow;
DPRINTM(DPRINT_FILESYSTEM, "StartCluster = 0x%x\n", StartCluster);
TRACE("StartCluster = 0x%x\n", StartCluster);
FatFileInfoPointer->FileFatChain = FatGetClusterChainArray(Volume, StartCluster);
//
@ -656,7 +658,7 @@ static BOOLEAN FatXSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID D
EntryCount = DirectorySize / sizeof(FATX_DIRENTRY);
DPRINTM(DPRINT_FILESYSTEM, "FatXSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName);
TRACE("FatXSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x EntryCount = %d FileName = %s\n", DirectoryBuffer, EntryCount, FileName);
FileNameLen = strlen(FileName);
@ -681,17 +683,17 @@ static BOOLEAN FatXSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID D
FatFileInfoPointer->FileSize = DirEntry->Size;
FatFileInfoPointer->FilePointer = 0;
DPRINTM(DPRINT_FILESYSTEM, "FATX Directory Entry:\n");
DPRINTM(DPRINT_FILESYSTEM, "FileNameSize = %d\n", DirEntry->FileNameSize);
DPRINTM(DPRINT_FILESYSTEM, "Attr = 0x%x\n", DirEntry->Attr);
DPRINTM(DPRINT_FILESYSTEM, "StartCluster = 0x%x\n", DirEntry->StartCluster);
DPRINTM(DPRINT_FILESYSTEM, "Size = %d\n", DirEntry->Size);
DPRINTM(DPRINT_FILESYSTEM, "Time = %d\n", DirEntry->Time);
DPRINTM(DPRINT_FILESYSTEM, "Date = %d\n", DirEntry->Date);
DPRINTM(DPRINT_FILESYSTEM, "CreateTime = %d\n", DirEntry->CreateTime);
DPRINTM(DPRINT_FILESYSTEM, "CreateDate = %d\n", DirEntry->CreateDate);
DPRINTM(DPRINT_FILESYSTEM, "LastAccessTime = %d\n", DirEntry->LastAccessTime);
DPRINTM(DPRINT_FILESYSTEM, "LastAccessDate = %d\n", DirEntry->LastAccessDate);
TRACE("FATX Directory Entry:\n");
TRACE("FileNameSize = %d\n", DirEntry->FileNameSize);
TRACE("Attr = 0x%x\n", DirEntry->Attr);
TRACE("StartCluster = 0x%x\n", DirEntry->StartCluster);
TRACE("Size = %d\n", DirEntry->Size);
TRACE("Time = %d\n", DirEntry->Time);
TRACE("Date = %d\n", DirEntry->Date);
TRACE("CreateTime = %d\n", DirEntry->CreateTime);
TRACE("CreateDate = %d\n", DirEntry->CreateDate);
TRACE("LastAccessTime = %d\n", DirEntry->LastAccessTime);
TRACE("LastAccessDate = %d\n", DirEntry->LastAccessDate);
/*
* Get the cluster chain
@ -729,7 +731,7 @@ LONG FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT
ULONG DirectorySize;
FAT_FILE_INFO FatFileInfo;
DPRINTM(DPRINT_FILESYSTEM, "FatLookupFile() FileName = %s\n", FileName);
TRACE("FatLookupFile() FileName = %s\n", FileName);
memset(FatFileInfoPointer, 0, sizeof(FAT_FILE_INFO));
@ -857,7 +859,7 @@ void FatParseShortFileName(PCHAR Buffer, PDIRENTRY DirEntry)
Buffer[Idx++] = (DirEntry->FileName[10] == ' ') ? '\0' : DirEntry->FileName[10];
}
//DPRINTM(DPRINT_FILESYSTEM, "FatParseShortFileName() ShortName = %s\n", Buffer);
//TRACE("FatParseShortFileName() ShortName = %s\n", Buffer);
}
/*
@ -871,7 +873,7 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
UINT32 ThisFatSecNum;
UINT32 ThisFatEntOffset;
//DPRINTM(DPRINT_FILESYSTEM, "FatGetFatEntry() Retrieving FAT entry for cluster %d.\n", Cluster);
//TRACE("FatGetFatEntry() Retrieving FAT entry for cluster %d.\n", Cluster);
switch(Volume->FatType)
{
@ -881,9 +883,9 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
ThisFatSecNum = Volume->ActiveFatSectorStart + (FatOffset / Volume->BytesPerSector);
ThisFatEntOffset = (FatOffset % Volume->BytesPerSector);
DPRINTM(DPRINT_FILESYSTEM, "FatOffset: %d\n", FatOffset);
DPRINTM(DPRINT_FILESYSTEM, "ThisFatSecNum: %d\n", ThisFatSecNum);
DPRINTM(DPRINT_FILESYSTEM, "ThisFatEntOffset: %d\n", ThisFatEntOffset);
TRACE("FatOffset: %d\n", FatOffset);
TRACE("ThisFatSecNum: %d\n", ThisFatSecNum);
TRACE("ThisFatEntOffset: %d\n", ThisFatEntOffset);
if (ThisFatEntOffset == (Volume->BytesPerSector - 1))
{
@ -945,12 +947,12 @@ BOOLEAN FatGetFatEntry(PFAT_VOLUME_INFO Volume, ULONG Cluster, ULONG* ClusterPoi
break;
default:
DPRINTM(DPRINT_FILESYSTEM, "Unknown FAT type %d\n", Volume->FatType);
TRACE("Unknown FAT type %d\n", Volume->FatType);
return FALSE;
}
//DPRINTM(DPRINT_FILESYSTEM, "FAT entry is 0x%x.\n", fat);
//TRACE("FAT entry is 0x%x.\n", fat);
*ClusterPointer = fat;
@ -961,7 +963,7 @@ ULONG FatCountClustersInChain(PFAT_VOLUME_INFO Volume, ULONG StartCluster)
{
ULONG ClusterCount = 0;
DPRINTM(DPRINT_FILESYSTEM, "FatCountClustersInChain() StartCluster = %d\n", StartCluster);
TRACE("FatCountClustersInChain() StartCluster = %d\n", StartCluster);
while (1)
{
@ -989,7 +991,7 @@ ULONG FatCountClustersInChain(PFAT_VOLUME_INFO Volume, ULONG StartCluster)
}
}
DPRINTM(DPRINT_FILESYSTEM, "FatCountClustersInChain() ClusterCount = %d\n", ClusterCount);
TRACE("FatCountClustersInChain() ClusterCount = %d\n", ClusterCount);
return ClusterCount;
}
@ -1001,7 +1003,7 @@ ULONG* FatGetClusterChainArray(PFAT_VOLUME_INFO Volume, ULONG StartCluster)
ULONG* ArrayPointer;
ULONG Idx;
DPRINTM(DPRINT_FILESYSTEM, "FatGetClusterChainArray() StartCluster = %d\n", StartCluster);
TRACE("FatGetClusterChainArray() StartCluster = %d\n", StartCluster);
ClusterCount = FatCountClustersInChain(Volume, StartCluster) + 1; // Lets get the 0x0ffffff8 on the end of the array
ArraySize = ClusterCount * sizeof(ULONG);
@ -1058,12 +1060,12 @@ BOOLEAN FatReadClusterChain(PFAT_VOLUME_INFO Volume, ULONG StartClusterNumber, U
{
ULONG ClusterStartSector;
DPRINTM(DPRINT_FILESYSTEM, "FatReadClusterChain() StartClusterNumber = %d NumberOfClusters = %d Buffer = 0x%x\n", StartClusterNumber, NumberOfClusters, Buffer);
TRACE("FatReadClusterChain() StartClusterNumber = %d NumberOfClusters = %d Buffer = 0x%x\n", StartClusterNumber, NumberOfClusters, Buffer);
while (NumberOfClusters > 0)
{
//DPRINTM(DPRINT_FILESYSTEM, "FatReadClusterChain() StartClusterNumber = %d NumberOfClusters = %d Buffer = 0x%x\n", StartClusterNumber, NumberOfClusters, Buffer);
//TRACE("FatReadClusterChain() StartClusterNumber = %d NumberOfClusters = %d Buffer = 0x%x\n", StartClusterNumber, NumberOfClusters, Buffer);
//
// Calculate starting sector for cluster
//
@ -1119,7 +1121,7 @@ BOOLEAN FatReadPartialCluster(PFAT_VOLUME_INFO Volume, ULONG ClusterNumber, ULON
{
ULONG ClusterStartSector;
//DPRINTM(DPRINT_FILESYSTEM, "FatReadPartialCluster() ClusterNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", ClusterNumber, StartingOffset, Length, Buffer);
//TRACE("FatReadPartialCluster() ClusterNumber = %d StartingOffset = %d Length = %d Buffer = 0x%x\n", ClusterNumber, StartingOffset, Length, Buffer);
ClusterStartSector = ((ClusterNumber - 2) * Volume->SectorsPerCluster) + Volume->DataSectorStart;
@ -1147,7 +1149,7 @@ BOOLEAN FatReadFile(PFAT_FILE_INFO FatFileInfo, ULONG BytesToRead, ULONG* BytesR
ULONG NumberOfClusters;
ULONG BytesPerCluster;
DPRINTM(DPRINT_FILESYSTEM, "FatReadFile() BytesToRead = %d Buffer = 0x%x\n", BytesToRead, Buffer);
TRACE("FatReadFile() BytesToRead = %d Buffer = 0x%x\n", BytesToRead, Buffer);
if (BytesRead != NULL)
{
@ -1298,7 +1300,7 @@ BOOLEAN FatReadVolumeSectors(PFAT_VOLUME_INFO Volume, ULONG SectorNumber, ULONG
ULONG Count;
LONG ret;
//DPRINTM(DPRINT_FILESYSTEM, "FatReadVolumeSectors(): SectorNumber %d, SectorCount %d, Buffer %p\n",
//TRACE("FatReadVolumeSectors(): SectorNumber %d, SectorCount %d, Buffer %p\n",
// SectorNumber, SectorCount, Buffer);
//
@ -1308,7 +1310,7 @@ BOOLEAN FatReadVolumeSectors(PFAT_VOLUME_INFO Volume, ULONG SectorNumber, ULONG
ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
if (ret != ESUCCESS)
{
DPRINTM(DPRINT_FILESYSTEM, "FatReadVolumeSectors() Failed to seek\n");
TRACE("FatReadVolumeSectors() Failed to seek\n");
return FALSE;
}
@ -1318,7 +1320,7 @@ BOOLEAN FatReadVolumeSectors(PFAT_VOLUME_INFO Volume, ULONG SectorNumber, ULONG
ret = ArcRead(Volume->DeviceId, Buffer, SectorCount * 512, &Count);
if (ret != ESUCCESS || Count != SectorCount * 512)
{
DPRINTM(DPRINT_FILESYSTEM, "FatReadVolumeSectors() Failed to read\n");
TRACE("FatReadVolumeSectors() Failed to read\n");
return FALSE;
}
@ -1343,9 +1345,9 @@ LONG FatGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
Information->EndingAddress.LowPart = FileHandle->FileSize;
Information->CurrentAddress.LowPart = FileHandle->FilePointer;
DPRINTM(DPRINT_FILESYSTEM, "FatGetFileInformation() FileSize = %d\n",
TRACE("FatGetFileInformation() FileSize = %d\n",
Information->EndingAddress.LowPart);
DPRINTM(DPRINT_FILESYSTEM, "FatGetFileInformation() FilePointer = %d\n",
TRACE("FatGetFileInformation() FilePointer = %d\n",
Information->CurrentAddress.LowPart);
return ESUCCESS;
@ -1366,7 +1368,7 @@ LONG FatOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
DeviceId = FsGetDeviceId(*FileId);
FatVolume = FatVolumes[DeviceId];
DPRINTM(DPRINT_FILESYSTEM, "FatOpen() FileName = %s\n", Path);
TRACE("FatOpen() FileName = %s\n", Path);
RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo));
ret = FatLookupFile(FatVolume, Path, DeviceId, &TempFileInfo);
@ -1416,7 +1418,7 @@ LONG FatSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
{
PFAT_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
DPRINTM(DPRINT_FILESYSTEM, "FatSeek() NewFilePointer = %lu\n", Position->LowPart);
TRACE("FatSeek() NewFilePointer = %lu\n", Position->LowPart);
if (SeekMode != SeekAbsolute)
return EINVAL;

View file

@ -23,13 +23,15 @@
#define NDEBUG
#include <debug.h>
DBG_DEFAULT_CHANNEL(FILESYSTEM);
/////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
/////////////////////////////////////////////////////////////////////////////////////////////
VOID FileSystemError(PCSTR ErrorString)
{
DPRINTM(DPRINT_FILESYSTEM, "%s\n", ErrorString);
ERR("%s\n", ErrorString);
UiMessageBox(ErrorString);
}
@ -43,7 +45,7 @@ PFILE FsOpenFile(PCSTR FileName)
//
// Print status message
//
DPRINTM(DPRINT_FILESYSTEM, "Opening file '%s'...\n", FileName);
TRACE("Opening file '%s'...\n", FileName);
//
// Create full file name
@ -163,7 +165,7 @@ ULONG FsGetNumPathParts(PCSTR Path)
}
num++;
DPRINTM(DPRINT_FILESYSTEM, "FsGetNumPathParts() Path = %s NumPathParts = %d\n", Path, num);
TRACE("FsGetNumPathParts() Path = %s NumPathParts = %d\n", Path, num);
return num;
}
@ -195,7 +197,7 @@ VOID FsGetFirstNameFromPath(PCHAR Buffer, PCSTR Path)
Buffer[i] = 0;
DPRINTM(DPRINT_FILESYSTEM, "FsGetFirstNameFromPath() Path = %s FirstName = %s\n", Path, Buffer);
TRACE("FsGetFirstNameFromPath() Path = %s FirstName = %s\n", Path, Buffer);
}
typedef struct tagFILEDATA
@ -258,7 +260,7 @@ LONG ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
ULONG DeviceId;
/* Print status message */
DPRINTM(DPRINT_FILESYSTEM, "Opening file '%s'...\n", Path);
TRACE("Opening file '%s'...\n", Path);
*FileId = MAX_FDS;
@ -412,7 +414,7 @@ VOID FsRegisterDevice(CHAR* Prefix, const DEVVTBL* FuncTable)
DEVICE* pNewEntry;
ULONG dwLength;
DPRINTM(DPRINT_FILESYSTEM, "FsRegisterDevice() Prefix = %s\n", Prefix);
TRACE("FsRegisterDevice() Prefix = %s\n", Prefix);
dwLength = strlen(Prefix) + 1;
pNewEntry = MmHeapAlloc(sizeof(DEVICE) + dwLength);

View file

@ -24,6 +24,8 @@
#define SECTORSIZE 2048
DBG_DEFAULT_CHANNEL(FILESYSTEM);
static BOOLEAN IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectoryLength, PCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer)
{
PDIR_RECORD Record;
@ -31,7 +33,7 @@ static BOOLEAN IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG Dire
ULONG i;
CHAR Name[32];
DPRINTM(DPRINT_FILESYSTEM, "IsoSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectoryLength = %d FileName = %s\n", DirectoryBuffer, DirectoryLength, FileName);
TRACE("IsoSearchDirectoryBufferForFile() DirectoryBuffer = 0x%x DirectoryLength = %d FileName = %s\n", DirectoryBuffer, DirectoryLength, FileName);
RtlZeroMemory(Name, 32 * sizeof(UCHAR));
@ -53,18 +55,18 @@ static BOOLEAN IsoSearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG Dire
if (Record->FileIdLength == 1 && Record->FileId[0] == 0)
{
DPRINTM(DPRINT_FILESYSTEM, "Name '.'\n");
TRACE("Name '.'\n");
}
else if (Record->FileIdLength == 1 && Record->FileId[0] == 1)
{
DPRINTM(DPRINT_FILESYSTEM, "Name '..'\n");
TRACE("Name '..'\n");
}
else
{
for (i = 0; i < Record->FileIdLength && Record->FileId[i] != ';'; i++)
Name[i] = Record->FileId[i];
Name[i] = 0;
DPRINTM(DPRINT_FILESYSTEM, "Name '%s'\n", Name);
TRACE("Name '%s'\n", Name);
if (strlen(FileName) == strlen(Name) && _stricmp(FileName, Name) == 0)
{
@ -101,15 +103,15 @@ static LONG IsoBufferDirectory(ULONG DeviceId, ULONG DirectoryStartSector, ULONG
ULONG Count;
ULONG ret;
DPRINTM(DPRINT_FILESYSTEM, "IsoBufferDirectory() DirectoryStartSector = %d DirectoryLength = %d\n", DirectoryStartSector, DirectoryLength);
TRACE("IsoBufferDirectory() DirectoryStartSector = %d DirectoryLength = %d\n", DirectoryStartSector, DirectoryLength);
SectorCount = ROUND_UP(DirectoryLength, SECTORSIZE) / SECTORSIZE;
DPRINTM(DPRINT_FILESYSTEM, "Trying to read (DirectoryCount) %d sectors.\n", SectorCount);
TRACE("Trying to read (DirectoryCount) %d sectors.\n", SectorCount);
//
// Attempt to allocate memory for directory buffer
//
DPRINTM(DPRINT_FILESYSTEM, "Trying to allocate (DirectoryLength) %d bytes.\n", DirectoryLength);
TRACE("Trying to allocate (DirectoryLength) %d bytes.\n", DirectoryLength);
DirectoryBuffer = MmHeapAlloc(DirectoryLength);
if (!DirectoryBuffer)
return ENOMEM;
@ -158,7 +160,7 @@ static LONG IsoLookupFile(PCSTR FileName, ULONG DeviceId, PISO_FILE_INFO IsoFile
ULONG Count;
LONG ret;
DPRINTM(DPRINT_FILESYSTEM, "IsoLookupFile() FileName = %s\n", FileName);
TRACE("IsoLookupFile() FileName = %s\n", FileName);
RtlZeroMemory(IsoFileInfoPointer, sizeof(ISO_FILE_INFO));
RtlZeroMemory(&IsoFileInfo, sizeof(ISO_FILE_INFO));
@ -249,8 +251,8 @@ LONG IsoGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
{
PISO_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
DPRINTM(DPRINT_FILESYSTEM, "IsoGetFileInformation() FileSize = %d\n", FileHandle->FileSize);
DPRINTM(DPRINT_FILESYSTEM, "IsoGetFileInformation() FilePointer = %d\n", FileHandle->FilePointer);
TRACE("IsoGetFileInformation() FileSize = %d\n", FileHandle->FileSize);
TRACE("IsoGetFileInformation() FilePointer = %d\n", FileHandle->FilePointer);
RtlZeroMemory(Information, sizeof(FILEINFORMATION));
Information->EndingAddress.LowPart = FileHandle->FileSize;
@ -271,7 +273,7 @@ LONG IsoOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
DeviceId = FsGetDeviceId(*FileId);
DPRINTM(DPRINT_FILESYSTEM, "IsoOpen() FileName = %s\n", Path);
TRACE("IsoOpen() FileName = %s\n", Path);
RtlZeroMemory(&TempFileInfo, sizeof(TempFileInfo));
ret = IsoLookupFile(Path, DeviceId, &TempFileInfo);
@ -302,7 +304,7 @@ LONG IsoRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
ULONG BytesRead;
LONG ret;
DPRINTM(DPRINT_FILESYSTEM, "IsoRead() Buffer = %p, N = %lu\n", Buffer, N);
TRACE("IsoRead() Buffer = %p, N = %lu\n", Buffer, N);
DeviceId = FsGetDeviceId(FileId);
*Count = 0;
@ -452,7 +454,7 @@ LONG IsoRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
FilePointer += N;
}
DPRINTM(DPRINT_FILESYSTEM, "IsoRead() done\n");
TRACE("IsoRead() done\n");
return ESUCCESS;
}
@ -461,7 +463,7 @@ LONG IsoSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
{
PISO_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId);
DPRINTM(DPRINT_FILESYSTEM, "IsoSeek() NewFilePointer = %lu\n", Position->LowPart);
TRACE("IsoSeek() NewFilePointer = %lu\n", Position->LowPart);
if (SeekMode != SeekAbsolute)
return EINVAL;

View file

@ -28,6 +28,8 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(FILESYSTEM);
typedef struct _NTFS_VOLUME_INFO
{
NTFS_BOOTSECTOR BootSector;
@ -84,10 +86,10 @@ static PUCHAR NtfsDecodeRun(PUCHAR DataRun, LONGLONG *DataRunOffset, ULONGLONG *
*DataRunOffset = ((CHAR)(*(DataRun++)) << (i << 3)) + *DataRunOffset;
}
DPRINTM(DPRINT_FILESYSTEM, "DataRunOffsetSize: %x\n", DataRunOffsetSize);
DPRINTM(DPRINT_FILESYSTEM, "DataRunLengthSize: %x\n", DataRunLengthSize);
DPRINTM(DPRINT_FILESYSTEM, "DataRunOffset: %x\n", *DataRunOffset);
DPRINTM(DPRINT_FILESYSTEM, "DataRunLength: %x\n", *DataRunLength);
TRACE("DataRunOffsetSize: %x\n", DataRunOffsetSize);
TRACE("DataRunLengthSize: %x\n", DataRunLengthSize);
TRACE("DataRunOffset: %x\n", *DataRunOffset);
TRACE("DataRunLength: %x\n", *DataRunLength);
return DataRun;
}
@ -137,7 +139,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON
ULONG ReadLength;
LONG ret;
DPRINTM(DPRINT_FILESYSTEM, "NtfsDiskRead - Offset: %I64d Length: %I64d\n", Offset, Length);
TRACE("NtfsDiskRead - Offset: %I64d Length: %I64d\n", Offset, Length);
//
// I. Read partial first sector if needed
@ -388,7 +390,7 @@ static PNTFS_ATTR_CONTEXT NtfsFindAttributeHelper(PNTFS_VOLUME_INFO Volume, PNTF
if(!ListBuffer)
{
DPRINTM(DPRINT_FILESYSTEM, "Failed to allocate memory: %x\n", (ULONG)ListSize);
TRACE("Failed to allocate memory: %x\n", (ULONG)ListSize);
continue;
}
@ -496,7 +498,7 @@ VOID NtfsPrintFile(PNTFS_INDEX_ENTRY IndexEntry)
AnsiFileName[i] = (CHAR)FileName[i];
AnsiFileName[i] = 0;
DPRINTM(DPRINT_FILESYSTEM, "- %s (%x)\n", AnsiFileName, IndexEntry->Data.Directory.IndexedFile);
TRACE("- %s (%x)\n", AnsiFileName, IndexEntry->Data.Directory.IndexedFile);
}
#endif
@ -580,7 +582,7 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
IndexEntryEnd = (PNTFS_INDEX_ENTRY)(IndexRecord + IndexRootCtx->Record.Resident.ValueLength);
NtfsReleaseAttributeContext(IndexRootCtx);
DPRINTM(DPRINT_FILESYSTEM, "IndexRecordSize: %x IndexBlockSize: %x\n", Volume->IndexRecordSize, IndexRoot->IndexBlockSize);
TRACE("IndexRecordSize: %x IndexBlockSize: %x\n", Volume->IndexRecordSize, IndexRoot->IndexBlockSize);
while (IndexEntry < IndexEntryEnd &&
!(IndexEntry->Flags & NTFS_INDEX_ENTRY_END))
@ -597,19 +599,19 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
if (IndexRoot->IndexHeader.Flags & NTFS_LARGE_INDEX)
{
DPRINTM(DPRINT_FILESYSTEM, "Large Index!\n");
TRACE("Large Index!\n");
IndexBlockSize = IndexRoot->IndexBlockSize;
IndexBitmapCtx = NtfsFindAttribute(Volume, MftRecord, NTFS_ATTR_TYPE_BITMAP, L"$I30");
if (IndexBitmapCtx == NULL)
{
DPRINTM(DPRINT_FILESYSTEM, "Corrupted filesystem!\n");
TRACE("Corrupted filesystem!\n");
MmHeapFree(MftRecord);
return FALSE;
}
BitmapDataSize = NtfsGetAttributeSize(&IndexBitmapCtx->Record);
DPRINTM(DPRINT_FILESYSTEM, "BitmapDataSize: %x\n", (ULONG)BitmapDataSize);
TRACE("BitmapDataSize: %x\n", (ULONG)BitmapDataSize);
if(BitmapDataSize <= 0xFFFFFFFF)
BitmapData = MmHeapAlloc((ULONG)BitmapDataSize);
else
@ -627,7 +629,7 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
IndexAllocationCtx = NtfsFindAttribute(Volume, MftRecord, NTFS_ATTR_TYPE_INDEX_ALLOCATION, L"$I30");
if (IndexAllocationCtx == NULL)
{
DPRINTM(DPRINT_FILESYSTEM, "Corrupted filesystem!\n");
TRACE("Corrupted filesystem!\n");
MmHeapFree(BitmapData);
MmHeapFree(IndexRecord);
MmHeapFree(MftRecord);
@ -639,7 +641,7 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
for (;;)
{
DPRINTM(DPRINT_FILESYSTEM, "RecordOffset: %x IndexAllocationSize: %x\n", RecordOffset, IndexAllocationSize);
TRACE("RecordOffset: %x IndexAllocationSize: %x\n", RecordOffset, IndexAllocationSize);
for (; RecordOffset < IndexAllocationSize;)
{
UCHAR Bit = 1 << ((RecordOffset / IndexBlockSize) & 7);
@ -670,7 +672,7 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
{
if (NtfsCompareFileName(FileName, IndexEntry))
{
DPRINTM(DPRINT_FILESYSTEM, "File found\n");
TRACE("File found\n");
*OutMFTIndex = IndexEntry->Data.Directory.IndexedFile;
MmHeapFree(BitmapData);
MmHeapFree(IndexRecord);
@ -692,7 +694,7 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P
}
else
{
DPRINTM(DPRINT_FILESYSTEM, "Can't read MFT record\n");
TRACE("Can't read MFT record\n");
}
MmHeapFree(MftRecord);
@ -706,7 +708,7 @@ static BOOLEAN NtfsLookupFile(PNTFS_VOLUME_INFO Volume, PCSTR FileName, PNTFS_MF
ULONGLONG CurrentMFTIndex;
UCHAR i;
DPRINTM(DPRINT_FILESYSTEM, "NtfsLookupFile() FileName = %s\n", FileName);
TRACE("NtfsLookupFile() FileName = %s\n", FileName);
CurrentMFTIndex = NTFS_FILE_ROOT;
NumberOfPathParts = FsGetNumPathParts(FileName);
@ -718,25 +720,25 @@ static BOOLEAN NtfsLookupFile(PNTFS_VOLUME_INFO Volume, PCSTR FileName, PNTFS_MF
;
FileName++;
DPRINTM(DPRINT_FILESYSTEM, "- Lookup: %s\n", PathPart);
TRACE("- Lookup: %s\n", PathPart);
if (!NtfsFindMftRecord(Volume, CurrentMFTIndex, PathPart, &CurrentMFTIndex))
{
DPRINTM(DPRINT_FILESYSTEM, "- Failed\n");
TRACE("- Failed\n");
return FALSE;
}
DPRINTM(DPRINT_FILESYSTEM, "- Lookup: %x\n", CurrentMFTIndex);
TRACE("- Lookup: %x\n", CurrentMFTIndex);
}
if (!NtfsReadMftRecord(Volume, CurrentMFTIndex, MftRecord))
{
DPRINTM(DPRINT_FILESYSTEM, "NtfsLookupFile: Can't read MFT record\n");
TRACE("NtfsLookupFile: Can't read MFT record\n");
return FALSE;
}
*DataContext = NtfsFindAttribute(Volume, MftRecord, NTFS_ATTR_TYPE_DATA, L"");
if (*DataContext == NULL)
{
DPRINTM(DPRINT_FILESYSTEM, "NtfsLookupFile: Can't find data attribute\n");
TRACE("NtfsLookupFile: Can't find data attribute\n");
return FALSE;
}
@ -761,9 +763,9 @@ LONG NtfsGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
Information->EndingAddress.QuadPart = NtfsGetAttributeSize(&FileHandle->DataContext->Record);
Information->CurrentAddress.QuadPart = FileHandle->Offset;
DPRINTM(DPRINT_FILESYSTEM, "NtfsGetFileInformation() FileSize = %d\n",
TRACE("NtfsGetFileInformation() FileSize = %d\n",
Information->EndingAddress.LowPart);
DPRINTM(DPRINT_FILESYSTEM, "NtfsGetFileInformation() FilePointer = %d\n",
TRACE("NtfsGetFileInformation() FilePointer = %d\n",
Information->CurrentAddress.LowPart);
return ESUCCESS;
@ -788,7 +790,7 @@ LONG NtfsOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
DeviceId = FsGetDeviceId(*FileId);
Volume = NtfsVolumes[DeviceId];
DPRINTM(DPRINT_FILESYSTEM, "NtfsOpen() FileName = %s\n", Path);
TRACE("NtfsOpen() FileName = %s\n", Path);
//
// Allocate file structure
@ -839,7 +841,7 @@ LONG NtfsSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
{
PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId);
DPRINTM(DPRINT_FILESYSTEM, "NtfsSeek() NewFilePointer = %lu\n", Position->LowPart);
TRACE("NtfsSeek() NewFilePointer = %lu\n", Position->LowPart);
if (SeekMode != SeekAbsolute)
return EINVAL;
@ -917,16 +919,16 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
else
Volume->IndexRecordSize = 1 << (-Volume->BootSector.ClustersPerIndexRecord);
DPRINTM(DPRINT_FILESYSTEM, "ClusterSize: 0x%x\n", Volume->ClusterSize);
DPRINTM(DPRINT_FILESYSTEM, "ClustersPerMftRecord: %d\n", Volume->BootSector.ClustersPerMftRecord);
DPRINTM(DPRINT_FILESYSTEM, "ClustersPerIndexRecord: %d\n", Volume->BootSector.ClustersPerIndexRecord);
DPRINTM(DPRINT_FILESYSTEM, "MftRecordSize: 0x%x\n", Volume->MftRecordSize);
DPRINTM(DPRINT_FILESYSTEM, "IndexRecordSize: 0x%x\n", Volume->IndexRecordSize);
TRACE("ClusterSize: 0x%x\n", Volume->ClusterSize);
TRACE("ClustersPerMftRecord: %d\n", Volume->BootSector.ClustersPerMftRecord);
TRACE("ClustersPerIndexRecord: %d\n", Volume->BootSector.ClustersPerIndexRecord);
TRACE("MftRecordSize: 0x%x\n", Volume->MftRecordSize);
TRACE("IndexRecordSize: 0x%x\n", Volume->IndexRecordSize);
//
// Read MFT index
//
DPRINTM(DPRINT_FILESYSTEM, "Reading MFT index...\n");
TRACE("Reading MFT index...\n");
Volume->MasterFileTable = MmHeapAlloc(Volume->MftRecordSize);
if (!Volume->MasterFileTable)
{
@ -971,7 +973,7 @@ const DEVVTBL* NtfsMount(ULONG DeviceId)
//
// Search DATA attribute
//
DPRINTM(DPRINT_FILESYSTEM, "Searching for DATA attribute...\n");
TRACE("Searching for DATA attribute...\n");
Volume->MFTContext = NtfsFindAttribute(Volume, Volume->MasterFileTable, NTFS_ATTR_TYPE_DATA, L"");
if (!Volume->MFTContext)
{

View file

@ -24,6 +24,8 @@
#define NO_FILE ((ULONG)-1)
DBG_DEFAULT_CHANNEL(FILESYSTEM);
static IP4 _ServerIP = { 0, };
static ULONG _OpenFile = NO_FILE;
static ULONG _FileSize = 0;
@ -61,7 +63,7 @@ FindPxeStructure(VOID)
if (Checksum != 0)
continue;
DPRINTM(DPRINT_FILESYSTEM, "!PXE structure found at %p\n", Ptr);
TRACE("!PXE structure found at %p\n", Ptr);
return Ptr;
}
@ -94,19 +96,19 @@ BOOLEAN CallPxe(UINT16 Service, PVOID Parameter)
{
// HACK: this delay shouldn't be necessary
KeStallExecutionProcessor(100 * 1000); // 100 ms
DPRINTM(DPRINT_FILESYSTEM, "PxeCall(0x%x, %p)\n", Service, Parameter);
ERR("PxeCall(0x%x, %p)\n", Service, Parameter);
}
exit = PxeCallApi(pxe->EntryPointSP.segment, pxe->EntryPointSP.offset, Service, Parameter);
if (exit != PXENV_EXIT_SUCCESS)
{
DPRINTM(DPRINT_FILESYSTEM, "PxeCall(0x%x, %p) failed with exit=%d status=0x%x\n",
ERR("PxeCall(0x%x, %p) failed with exit=%d status=0x%x\n",
Service, Parameter, exit, *(PXENV_STATUS*)Parameter);
return FALSE;
}
if (*(PXENV_STATUS*)Parameter != PXENV_STATUS_SUCCESS)
{
DPRINTM(DPRINT_FILESYSTEM, "PxeCall(0x%x, %p) succeeded, but returned error status 0x%x\n",
ERR("PxeCall(0x%x, %p) succeeded, but returned error status 0x%x\n",
Service, Parameter, *(PXENV_STATUS*)Parameter);
return FALSE;
}
@ -291,7 +293,7 @@ static LONG PxeDiskClose(ULONG FileId)
static LONG PxeDiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information)
{
// Not implemented
UNIMPLEMENTED;
return EINVAL;
}
@ -303,13 +305,13 @@ static LONG PxeDiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
static LONG PxeDiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
{
// Not implemented
UNIMPLEMENTED;
return EINVAL;
}
static LONG PxeDiskSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
{
// Not implemented
UNIMPLEMENTED;
return EINVAL;
}

View file

@ -16,7 +16,6 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <reactos/debug.h>
#ifndef __DEBUG_H
#define __DEBUG_H
@ -37,20 +36,34 @@
#define DPRINT_PELOADER 0x00001000 // OR this with DebugPrintMask to enable messages from PE images loader
#define DPRINT_SCSIPORT 0x00002000 // OR this with DebugPrintMask to enable messages from SCSI miniport
extern char* g_file;
extern int g_line;
#define DBG_DEFAULT_CHANNEL(x) static int DbgDefaultChannel = DPRINT_##x;
#if DBG && !defined(_M_ARM)
VOID DbgPrintMask(ULONG Mask, char *format, ...);
VOID DebugInit(VOID);
ULONG DbgPrint(const char *Format, ...);
VOID DbgPrint2(ULONG Mask, ULONG Level, const char *File, ULONG Line, char *Format, ...);
VOID DebugDumpBuffer(ULONG Mask, PVOID Buffer, ULONG Length);
#define DPRINTM g_file=__FILE__, g_line=__LINE__, DbgPrintMask
#define BugCheck(_x_) { DbgPrintMask(DPRINT_WARNING, "Fatal Error: %s:%d(%s)\n", __FILE__, __LINE__, __FUNCTION__); DbgPrintMask _x_ ; for (;;); }
#define DbgDumpBuffer(_x_, _y_, _z_) DebugDumpBuffer(_x_, _y_, _z_)
#define ERR_LEVEL 0x1
#define FIXME_LEVEL 0x2
#define WARN_LEVEL 0x4
#define TRACE_LEVEL 0x8
#define ERR_CH(ch, fmt, ...) DbgPrint2(DPRINT_##ch, ERR_LEVEL, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define FIXME_CH(ch, fmt, ...) DbgPrint2(DPRINT_##ch, FIXME_LEVEL, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define WARN_CH(ch, fmt, ...) DbgPrint2(DPRINT_##ch, WARN_LEVEL, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define TRACE_CH(ch, fmt, ...) DbgPrint2(DPRINT_##ch, TRACE_LEVEL, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define ERR(fmt, ...) DbgPrint2(DbgDefaultChannel, ERR_LEVEL, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define FIXME(fmt, ...) DbgPrint2(DbgDefaultChannel, FIXME_LEVEL, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define WARN(fmt, ...) DbgPrint2(DbgDefaultChannel, WARN_LEVEL, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define TRACE(fmt, ...) DbgPrint2(DbgDefaultChannel, TRACE_LEVEL, __FILE__, __LINE__, fmt, ##__VA_ARGS__)
#define UNIMPLEMENTED DbgPrint("(%s:%d) WARNING: %s is UNIMPLEMENTED!\n", __FILE__, __LINE__, __FUNCTION__);
#define BugCheck(fmt, ...) do { DbgPrint("(%s:%d) Fatal Error in %s: " fmt, __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); for (;;); } while (0)
#define DbgDumpBuffer(mask, buf, len) DebugDumpBuffer(mask, buf, len)
#ifdef __i386__
@ -81,8 +94,17 @@ void MEMORY_WRITE_BREAKPOINT4(unsigned long addr);
#else
#define ERR_CH(ch, fmt, ...)
#define FIXME_CH(ch, fmt, ...)
#define WARN_CH(ch, fmt, ...)
#define TRACE_CH(ch, fmt, ...)
#define ERR(fmt, ...)
#define FIXME(fmt, ...)
#define WARN(fmt, ...)
#define TRACE(fmt, ...)
#define DebugInit(x)
#define DPRINTM(_x_, ...)
#define BugCheck(_x_)
#define DbgDumpBuffer(_x_, _y_, _z_)

View file

@ -20,11 +20,13 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(INIFILE);
BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR* SectionId)
{
PINI_SECTION Section;
DPRINTM(DPRINT_INIFILE, "IniOpenSection() SectionName = %s\n", SectionName);
TRACE("IniOpenSection() SectionName = %s\n", SectionName);
// Loop through each section and find the one they want
Section = CONTAINING_RECORD(IniFileSectionListHead.Flink, INI_SECTION, ListEntry);
@ -36,7 +38,7 @@ BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR* SectionId)
// We found it
if (SectionId)
*SectionId = (ULONG_PTR)Section;
DPRINTM(DPRINT_INIFILE, "IniOpenSection() Found it! SectionId = 0x%x\n", SectionId);
TRACE("IniOpenSection() Found it! SectionId = 0x%x\n", SectionId);
return TRUE;
}
@ -44,7 +46,7 @@ BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR* SectionId)
Section = CONTAINING_RECORD(Section->ListEntry.Flink, INI_SECTION, ListEntry);
}
DPRINTM(DPRINT_INIFILE, "IniOpenSection() Section not found.\n");
TRACE("IniOpenSection() Section not found.\n");
return FALSE;
}
@ -53,8 +55,8 @@ ULONG IniGetNumSectionItems(ULONG_PTR SectionId)
{
PINI_SECTION Section = (PINI_SECTION)SectionId;
DPRINTM(DPRINT_INIFILE, "IniGetNumSectionItems() SectionId = 0x%x\n", SectionId);
DPRINTM(DPRINT_INIFILE, "IniGetNumSectionItems() Item count = %d\n", Section->SectionItemCount);
TRACE("IniGetNumSectionItems() SectionId = 0x%x\n", SectionId);
TRACE("IniGetNumSectionItems() Item count = %d\n", Section->SectionItemCount);
return Section->SectionItemCount;
}
@ -112,30 +114,30 @@ ULONG IniGetSectionSettingValueSize(ULONG_PTR SectionId, ULONG SettingIndex)
BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR SettingName, ULONG NameSize, PCHAR SettingValue, ULONG ValueSize)
{
PINI_SECTION_ITEM SectionItem;
DPRINTM(DPRINT_INIFILE, ".001 NameSize = %d ValueSize = %d\n", NameSize, ValueSize);
TRACE(".001 NameSize = %d ValueSize = %d\n", NameSize, ValueSize);
DPRINTM(DPRINT_INIFILE, "IniReadSettingByNumber() SectionId = 0x%x\n", SectionId);
TRACE("IniReadSettingByNumber() SectionId = 0x%x\n", SectionId);
// Retrieve requested setting
SectionItem = IniGetSettingByNumber(SectionId, SettingNumber);
if (!SectionItem)
{
DPRINTM(DPRINT_INIFILE, "IniReadSettingByNumber() Setting number %d not found.\n", SettingNumber);
TRACE("IniReadSettingByNumber() Setting number %d not found.\n", SettingNumber);
return FALSE;
}
DPRINTM(DPRINT_INIFILE, "IniReadSettingByNumber() Setting number %d found.\n", SettingNumber);
DPRINTM(DPRINT_INIFILE, "IniReadSettingByNumber() Setting name = %s\n", SectionItem->ItemName);
DPRINTM(DPRINT_INIFILE, "IniReadSettingByNumber() Setting value = %s\n", SectionItem->ItemValue);
TRACE("IniReadSettingByNumber() Setting number %d found.\n", SettingNumber);
TRACE("IniReadSettingByNumber() Setting name = %s\n", SectionItem->ItemName);
TRACE("IniReadSettingByNumber() Setting value = %s\n", SectionItem->ItemValue);
DPRINTM(DPRINT_INIFILE, "1 NameSize = %d ValueSize = %d\n", NameSize, ValueSize);
DPRINTM(DPRINT_INIFILE, "2 NameSize = %d ValueSize = %d\n", NameSize, ValueSize);
TRACE("1 NameSize = %d ValueSize = %d\n", NameSize, ValueSize);
TRACE("2 NameSize = %d ValueSize = %d\n", NameSize, ValueSize);
strncpy(SettingName, SectionItem->ItemName, NameSize - 1);
SettingName[NameSize - 1] = '\0';
DPRINTM(DPRINT_INIFILE, "3 NameSize = %d ValueSize = %d\n", NameSize, ValueSize);
TRACE("3 NameSize = %d ValueSize = %d\n", NameSize, ValueSize);
strncpy(SettingValue, SectionItem->ItemValue, ValueSize - 1);
SettingValue[ValueSize - 1] = '\0';
DPRINTM(DPRINT_INIFILE, "4 NameSize = %d ValueSize = %d\n", NameSize, ValueSize);
TRACE("4 NameSize = %d ValueSize = %d\n", NameSize, ValueSize);
DbgDumpBuffer(DPRINT_INIFILE, SettingName, NameSize);
DbgDumpBuffer(DPRINT_INIFILE, SettingValue, ValueSize);
@ -147,7 +149,7 @@ BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffe
PINI_SECTION Section = (PINI_SECTION)SectionId;
PINI_SECTION_ITEM SectionItem;
DPRINTM(DPRINT_INIFILE, "IniReadSettingByName() SectionId = 0x%x\n", SectionId);
TRACE("IniReadSettingByName() SectionId = 0x%x\n", SectionId);
// Loop through each section item and find the one they want
SectionItem = CONTAINING_RECORD(Section->SectionItemList.Flink, INI_SECTION_ITEM, ListEntry);
@ -156,8 +158,8 @@ BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffe
// Check to see if this is the setting they want
if (_stricmp(SettingName, SectionItem->ItemName) == 0)
{
DPRINTM(DPRINT_INIFILE, "IniReadSettingByName() Setting \'%s\' found.\n", SettingName);
DPRINTM(DPRINT_INIFILE, "IniReadSettingByName() Setting value = %s\n", SectionItem->ItemValue);
TRACE("IniReadSettingByName() Setting \'%s\' found.\n", SettingName);
TRACE("IniReadSettingByName() Setting value = %s\n", SectionItem->ItemValue);
strncpy(Buffer, SectionItem->ItemValue, BufferSize - 1);
Buffer[BufferSize - 1] = '\0';
@ -169,7 +171,7 @@ BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffe
SectionItem = CONTAINING_RECORD(SectionItem->ListEntry.Flink, INI_SECTION_ITEM, ListEntry);
}
DPRINTM(DPRINT_INIFILE, "IniReadSettingByName() Setting \'%s\' not found.\n", SettingName);
WARN("IniReadSettingByName() Setting \'%s\' not found.\n", SettingName);
return FALSE;
}

View file

@ -20,6 +20,8 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(INIFILE);
LIST_ENTRY IniFileSectionListHead;
BOOLEAN IniFileSectionInitialized = FALSE;
ULONG IniFileSectionCount = 0;
@ -36,7 +38,7 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
PINI_SECTION CurrentSection = NULL;
PINI_SECTION_ITEM CurrentItem = NULL;
DPRINTM(DPRINT_INIFILE, "IniParseFile() IniFileSize: %d\n", IniFileSize);
TRACE("IniParseFile() IniFileSize: %d\n", IniFileSize);
if (!IniFileSectionInitialized)
{
@ -172,8 +174,8 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize)
CurrentLineNumber++;
}
DPRINTM(DPRINT_INIFILE, "Parsed %d sections and %d settings.\n", IniFileSectionCount, IniFileSettingCount);
DPRINTM(DPRINT_INIFILE, "IniParseFile() done.\n");
TRACE("Parsed %d sections and %d settings.\n", IniFileSectionCount, IniFileSettingCount);
TRACE("IniParseFile() done.\n");
return TRUE;
}

View file

@ -24,6 +24,7 @@
#ifdef __i386__
#define LINUX_READ_CHUNK_SIZE 0x20000 // Read 128k at a time
DBG_DEFAULT_CHANNEL(LINUX);
PLINUX_BOOTSECTOR LinuxBootSector = NULL;
PLINUX_SETUPSECTOR LinuxSetupSector = NULL;
@ -304,14 +305,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);
TRACE("SetupSectors: %d\n", LinuxBootSector->SetupSectors);
TRACE("RootFlags: 0x%x\n", LinuxBootSector->RootFlags);
TRACE("SystemSize: 0x%x\n", LinuxBootSector->SystemSize);
TRACE("SwapDevice: 0x%x\n", LinuxBootSector->SwapDevice);
TRACE("RamSize: 0x%x\n", LinuxBootSector->RamSize);
TRACE("VideoMode: 0x%x\n", LinuxBootSector->VideoMode);
TRACE("RootDevice: 0x%x\n", LinuxBootSector->RootDevice);
TRACE("BootFlag: 0x%x\n", LinuxBootSector->BootFlag);
return TRUE;
}
@ -363,21 +364,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);
TRACE("SetupHeaderSignature: 0x%x (HdrS)\n", LinuxSetupSector->SetupHeaderSignature);
TRACE("Version: 0x%x\n", LinuxSetupSector->Version);
TRACE("RealModeSwitch: 0x%x\n", LinuxSetupSector->RealModeSwitch);
TRACE("SetupSeg: 0x%x\n", LinuxSetupSector->SetupSeg);
TRACE("StartSystemSeg: 0x%x\n", LinuxSetupSector->StartSystemSeg);
TRACE("KernelVersion: 0x%x\n", LinuxSetupSector->KernelVersion);
TRACE("TypeOfLoader: 0x%x\n", LinuxSetupSector->TypeOfLoader);
TRACE("LoadFlags: 0x%x\n", LinuxSetupSector->LoadFlags);
TRACE("SetupMoveSize: 0x%x\n", LinuxSetupSector->SetupMoveSize);
TRACE("Code32Start: 0x%x\n", LinuxSetupSector->Code32Start);
TRACE("RamdiskAddress: 0x%x\n", LinuxSetupSector->RamdiskAddress);
TRACE("RamdiskSize: 0x%x\n", LinuxSetupSector->RamdiskSize);
TRACE("BootSectKludgeOffset: 0x%x\n", LinuxSetupSector->BootSectKludgeOffset);
TRACE("BootSectKludgeSegment: 0x%x\n", LinuxSetupSector->BootSectKludgeSegment);
TRACE("HeapEnd: 0x%x\n", LinuxSetupSector->HeapEnd);
return TRUE;
}
@ -484,12 +485,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);
TRACE("RamdiskAddress: 0x%x\n", LinuxSetupSector->RamdiskAddress);
TRACE("RamdiskSize: 0x%x\n", LinuxSetupSector->RamdiskSize);
if (LinuxSetupSector->Version >= 0x0203)
{
DPRINTM(DPRINT_LINUX, "InitrdAddressMax: 0x%x\n", LinuxSetupSector->InitrdAddressMax);
TRACE("InitrdAddressMax: 0x%x\n", LinuxSetupSector->InitrdAddressMax);
}
// Read in the ramdisk

View file

@ -21,6 +21,8 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(MEMORY);
#if DBG
typedef struct
{
@ -60,14 +62,14 @@ BOOLEAN MmInitializeMemoryManager(VOID)
const MEMORY_DESCRIPTOR* MemoryDescriptor = NULL;
#endif
DPRINTM(DPRINT_MEMORY, "Initializing Memory Manager.\n");
TRACE("Initializing Memory Manager.\n");
#if DBG
// Dump the system memory map
DPRINTM(DPRINT_MEMORY, "System Memory Map (Base Address, Length, Type):\n");
TRACE("System Memory Map (Base Address, Length, Type):\n");
while ((MemoryDescriptor = ArcGetMemoryDescriptor(MemoryDescriptor)) != NULL)
{
DPRINTM(DPRINT_MEMORY, "%x\t %x\t %s\n",
TRACE("%x\t %x\t %s\n",
MemoryDescriptor->BasePage * MM_PAGE_SIZE,
MemoryDescriptor->PageCount * MM_PAGE_SIZE,
MmGetSystemMemoryMapTypeString(MemoryDescriptor->MemoryType));
@ -96,7 +98,7 @@ BOOLEAN MmInitializeMemoryManager(VOID)
MmInitializeHeap(PageLookupTableAddress);
DPRINTM(DPRINT_MEMORY, "Memory Manager initialized. %d pages available.\n", FreePagesInLookupTable);
TRACE("Memory Manager initialized. %d pages available.\n", FreePagesInLookupTable);
return TRUE;
}
@ -131,7 +133,7 @@ VOID MmInitializeHeap(PVOID PageLookupTable)
// Mark those pages as used
MmMarkPagesInLookupTable(PageLookupTableAddress, HeapStart, PagesNeeded, LoaderOsloaderHeap);
DPRINTM(DPRINT_MEMORY, "Heap initialized, base 0x%08x, pages %d\n", (HeapStart << MM_PAGE_SHIFT), PagesNeeded);
TRACE("Heap initialized, base 0x%08x, pages %d\n", (HeapStart << MM_PAGE_SHIFT), PagesNeeded);
}
#if DBG
@ -189,9 +191,9 @@ ULONG MmGetAddressablePageCountIncludingHoles(VOID)
}
}
DPRINTM(DPRINT_MEMORY, "lo/hi %lx %lxn", MmLowestPhysicalPage, MmHighestPhysicalPage);
TRACE("lo/hi %lx %lxn", MmLowestPhysicalPage, MmHighestPhysicalPage);
PageCount = MmHighestPhysicalPage - MmLowestPhysicalPage;
DPRINTM(DPRINT_MEMORY, "MmGetAddressablePageCountIncludingHoles() returning 0x%x\n", PageCount);
TRACE("MmGetAddressablePageCountIncludingHoles() returning 0x%x\n", PageCount);
return PageCount;
}
@ -267,7 +269,7 @@ PVOID MmFindLocationForPageLookupTable(ULONG TotalPageCount)
- PageLookupTableSize);
}
DPRINTM(DPRINT_MEMORY, "MmFindLocationForPageLookupTable() returning 0x%x\n", PageLookupTableMemAddress);
TRACE("MmFindLocationForPageLookupTable() returning 0x%x\n", PageLookupTableMemAddress);
return PageLookupTableMemAddress;
}
@ -279,7 +281,7 @@ VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount)
ULONG PageLookupTableStartPage;
ULONG PageLookupTablePageCount;
DPRINTM(DPRINT_MEMORY, "MmInitPageLookupTable()\n");
TRACE("MmInitPageLookupTable()\n");
//
// Mark every page as allocated initially
@ -351,7 +353,7 @@ VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount)
//
// Mark used pages in the lookup table
//
DPRINTM(DPRINT_MEMORY, "Marking pages as type %d: StartPage: %d PageCount: %d\n", MemoryMapPageAllocated, MemoryDescriptor->BasePage, MemoryDescriptor->PageCount);
TRACE("Marking pages as type %d: StartPage: %d PageCount: %d\n", MemoryMapPageAllocated, MemoryDescriptor->BasePage, MemoryDescriptor->PageCount);
MmMarkPagesInLookupTable(PageLookupTable, MemoryDescriptor->BasePage, MemoryDescriptor->PageCount, MemoryMapPageAllocated);
}
@ -360,7 +362,7 @@ VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount)
//
PageLookupTableStartPage = MmGetPageNumberFromAddress(PageLookupTable);
PageLookupTablePageCount = MmGetPageNumberFromAddress((PVOID)((ULONG_PTR)PageLookupTable + ROUND_UP(TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM), MM_PAGE_SIZE))) - PageLookupTableStartPage;
DPRINTM(DPRINT_MEMORY, "Marking the page lookup table pages as reserved StartPage: %d PageCount: %d\n", PageLookupTableStartPage, PageLookupTablePageCount);
TRACE("Marking the page lookup table pages as reserved StartPage: %d PageCount: %d\n", PageLookupTableStartPage, PageLookupTablePageCount);
MmMarkPagesInLookupTable(PageLookupTable, PageLookupTableStartPage, PageLookupTablePageCount, LoaderFirmwareTemporary);
}
@ -375,13 +377,13 @@ VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG Page
#if 0
if ((Index <= (StartPage + 16)) || (Index >= (StartPage+PageCount-16)))
{
DPRINTM(DPRINT_MEMORY, "Index = %d StartPage = %d PageCount = %d\n", Index, StartPage, PageCount);
TRACE("Index = %d StartPage = %d PageCount = %d\n", Index, StartPage, PageCount);
}
#endif
RealPageLookupTable[Index].PageAllocated = PageAllocated;
RealPageLookupTable[Index].PageAllocationLength = (PageAllocated != LoaderFree) ? 1 : 0;
}
DPRINTM(DPRINT_MEMORY, "MmMarkPagesInLookupTable() Done\n");
TRACE("MmMarkPagesInLookupTable() Done\n");
}
VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PageCount, TYPE_OF_MEMORY MemoryType)
@ -450,7 +452,7 @@ ULONG MmFindAvailablePages(PVOID PageLookupTable, ULONG TotalPageCount, ULONG Pa
}
else
{
DPRINTM(DPRINT_MEMORY, "Alloc low memory, LastFreePageHint %d, TPC %d\n", LastFreePageHint, TotalPageCount);
TRACE("Alloc low memory, LastFreePageHint %d, TPC %d\n", LastFreePageHint, TotalPageCount);
/* Allocate "low" pages */
for (Index=1; Index < LastFreePageHint; Index++)
{

View file

@ -25,6 +25,8 @@ VOID DumpMemoryAllocMap(VOID);
VOID MemAllocTest(VOID);
#endif // DBG
DBG_DEFAULT_CHANNEL(MEMORY);
ULONG LoaderPagesSpanned = 0;
PVOID MmAllocateMemoryWithType(ULONG MemorySize, TYPE_OF_MEMORY MemoryType)
@ -35,7 +37,7 @@ PVOID MmAllocateMemoryWithType(ULONG MemorySize, TYPE_OF_MEMORY MemoryType)
if (MemorySize == 0)
{
DPRINTM(DPRINT_MEMORY, "MmAllocateMemory() called for 0 bytes. Returning NULL.\n");
WARN("MmAllocateMemory() called for 0 bytes. Returning NULL.\n");
UiMessageBoxCritical("Memory allocation failed: MmAllocateMemory() called for 0 bytes.");
return NULL;
}
@ -50,7 +52,7 @@ PVOID MmAllocateMemoryWithType(ULONG MemorySize, TYPE_OF_MEMORY MemoryType)
// then return NULL
if (FreePagesInLookupTable < PagesNeeded)
{
DPRINTM(DPRINT_MEMORY, "Memory allocation failed in MmAllocateMemory(). Not enough free memory to allocate %d bytes.\n", MemorySize);
ERR("Memory allocation failed in MmAllocateMemory(). Not enough free memory to allocate %d bytes.\n", MemorySize);
UiMessageBoxCritical("Memory allocation failed: out of memory.");
return NULL;
}
@ -59,7 +61,7 @@ PVOID MmAllocateMemoryWithType(ULONG MemorySize, TYPE_OF_MEMORY MemoryType)
if (FirstFreePageFromEnd == 0)
{
DPRINTM(DPRINT_MEMORY, "Memory allocation failed in MmAllocateMemory(). Not enough free memory to allocate %d bytes.\n", MemorySize);
ERR("Memory allocation failed in MmAllocateMemory(). Not enough free memory to allocate %d bytes.\n", MemorySize);
UiMessageBoxCritical("Memory allocation failed: out of memory.");
return NULL;
}
@ -69,10 +71,8 @@ PVOID MmAllocateMemoryWithType(ULONG MemorySize, TYPE_OF_MEMORY MemoryType)
FreePagesInLookupTable -= PagesNeeded;
MemPointer = (PVOID)((ULONG_PTR)FirstFreePageFromEnd * MM_PAGE_SIZE);
#if DBG
DPRINTM(DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page %d.\n", MemorySize, PagesNeeded, FirstFreePageFromEnd);
DPRINTM(DPRINT_MEMORY, "Memory allocation pointer: 0x%x\n", MemPointer);
#endif // DBG
TRACE("Allocated %d bytes (%d pages) of memory starting at page %d.\n", MemorySize, PagesNeeded, FirstFreePageFromEnd);
TRACE("Memory allocation pointer: 0x%x\n", MemPointer);
// Update LoaderPagesSpanned count
if ((((ULONG_PTR)MemPointer + MemorySize + PAGE_SIZE - 1) >> PAGE_SHIFT) > LoaderPagesSpanned)
@ -88,7 +88,7 @@ PVOID MmHeapAlloc(ULONG MemorySize)
if (MemorySize > MM_PAGE_SIZE)
{
DPRINTM(DPRINT_MEMORY, "Consider using other functions to allocate %d bytes of memory!\n", MemorySize);
WARN("Consider using other functions to allocate %d bytes of memory!\n", MemorySize);
}
// Get the buffer from BGET pool
@ -96,7 +96,7 @@ PVOID MmHeapAlloc(ULONG MemorySize)
if (Result == NULL)
{
DPRINTM(DPRINT_MEMORY, "Heap allocation for %d bytes failed\n", MemorySize);
ERR("Heap allocation for %d bytes failed\n", MemorySize);
}
#if MM_DBG
{
@ -105,7 +105,7 @@ PVOID MmHeapAlloc(ULONG MemorySize)
// Gather some stats
bstats(&CurAlloc, &TotalFree, &MaxFree, &NumberOfGets, &NumberOfRels);
DPRINTM(DPRINT_MEMORY, "Current alloced %d bytes, free %d bytes, allocs %d, frees %d\n",
TRACE("Current alloced %d bytes, free %d bytes, allocs %d, frees %d\n",
CurAlloc, TotalFree, NumberOfGets, NumberOfRels);
}
#endif
@ -132,7 +132,7 @@ PVOID MmAllocateMemoryAtAddress(ULONG MemorySize, PVOID DesiredAddress, TYPE_OF_
if (MemorySize == 0)
{
DPRINTM(DPRINT_MEMORY, "MmAllocateMemoryAtAddress() called for 0 bytes. Returning NULL.\n");
WARN("MmAllocateMemoryAtAddress() called for 0 bytes. Returning NULL.\n");
UiMessageBoxCritical("Memory allocation failed: MmAllocateMemoryAtAddress() called for 0 bytes.");
return NULL;
}
@ -148,7 +148,7 @@ PVOID MmAllocateMemoryAtAddress(ULONG MemorySize, PVOID DesiredAddress, TYPE_OF_
// then return NULL
if (FreePagesInLookupTable < PagesNeeded)
{
DPRINTM(DPRINT_MEMORY, "Memory allocation failed in MmAllocateMemoryAtAddress(). "
ERR("Memory allocation failed in MmAllocateMemoryAtAddress(). "
"Not enough free memory to allocate %d bytes (requesting %d pages but have only %d). "
"\n", MemorySize, PagesNeeded, FreePagesInLookupTable);
UiMessageBoxCritical("Memory allocation failed: out of memory.");
@ -157,9 +157,9 @@ PVOID MmAllocateMemoryAtAddress(ULONG MemorySize, PVOID DesiredAddress, TYPE_OF_
if (MmAreMemoryPagesAvailable(PageLookupTableAddress, TotalPagesInLookupTable, DesiredAddress, PagesNeeded) == FALSE)
{
DPRINTM(DPRINT_MEMORY, "Memory allocation failed in MmAllocateMemoryAtAddress(). "
"Not enough free memory to allocate %d bytes at address %p.\n",
MemorySize, DesiredAddress);
WARN("Memory allocation failed in MmAllocateMemoryAtAddress(). "
"Not enough free memory to allocate %d bytes at address %p.\n",
MemorySize, DesiredAddress);
// Don't tell this to user since caller should try to alloc this memory
// at a different address
@ -172,10 +172,8 @@ PVOID MmAllocateMemoryAtAddress(ULONG MemorySize, PVOID DesiredAddress, TYPE_OF_
FreePagesInLookupTable -= PagesNeeded;
MemPointer = (PVOID)((ULONG_PTR)StartPageNumber * MM_PAGE_SIZE);
#if DBG
DPRINTM(DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page %d.\n", MemorySize, PagesNeeded, StartPageNumber);
DPRINTM(DPRINT_MEMORY, "Memory allocation pointer: 0x%x\n", MemPointer);
#endif // DBG
TRACE("Allocated %d bytes (%d pages) of memory starting at page %d.\n", MemorySize, PagesNeeded, StartPageNumber);
TRACE("Memory allocation pointer: 0x%x\n", MemPointer);
// Update LoaderPagesSpanned count
if ((((ULONG_PTR)MemPointer + MemorySize + PAGE_SIZE - 1) >> PAGE_SHIFT) > LoaderPagesSpanned)
@ -210,7 +208,7 @@ PVOID MmAllocateHighestMemoryBelowAddress(ULONG MemorySize, PVOID DesiredAddress
if (MemorySize == 0)
{
DPRINTM(DPRINT_MEMORY, "MmAllocateHighestMemoryBelowAddress() called for 0 bytes. Returning NULL.\n");
WARN("MmAllocateHighestMemoryBelowAddress() called for 0 bytes. Returning NULL.\n");
UiMessageBoxCritical("Memory allocation failed: MmAllocateHighestMemoryBelowAddress() called for 0 bytes.");
return NULL;
}
@ -226,7 +224,7 @@ PVOID MmAllocateHighestMemoryBelowAddress(ULONG MemorySize, PVOID DesiredAddress
// then return NULL
if (FreePagesInLookupTable < PagesNeeded)
{
DPRINTM(DPRINT_MEMORY, "Memory allocation failed in MmAllocateHighestMemoryBelowAddress(). Not enough free memory to allocate %d bytes.\n", MemorySize);
ERR("Memory allocation failed in MmAllocateHighestMemoryBelowAddress(). Not enough free memory to allocate %d bytes.\n", MemorySize);
UiMessageBoxCritical("Memory allocation failed: out of memory.");
return NULL;
}
@ -235,7 +233,7 @@ PVOID MmAllocateHighestMemoryBelowAddress(ULONG MemorySize, PVOID DesiredAddress
if (FirstFreePageFromEnd == 0)
{
DPRINTM(DPRINT_MEMORY, "Memory allocation failed in MmAllocateHighestMemoryBelowAddress(). Not enough free memory to allocate %d bytes.\n", MemorySize);
ERR("Memory allocation failed in MmAllocateHighestMemoryBelowAddress(). Not enough free memory to allocate %d bytes.\n", MemorySize);
UiMessageBoxCritical("Memory allocation failed: out of memory.");
return NULL;
}
@ -245,10 +243,8 @@ PVOID MmAllocateHighestMemoryBelowAddress(ULONG MemorySize, PVOID DesiredAddress
FreePagesInLookupTable -= PagesNeeded;
MemPointer = (PVOID)((ULONG_PTR)FirstFreePageFromEnd * MM_PAGE_SIZE);
#if DBG
DPRINTM(DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page %d.\n", MemorySize, PagesNeeded, FirstFreePageFromEnd);
DPRINTM(DPRINT_MEMORY, "Memory allocation pointer: 0x%x\n", MemPointer);
#endif // DBG
TRACE("Allocated %d bytes (%d pages) of memory starting at page %d.\n", MemorySize, PagesNeeded, FirstFreePageFromEnd);
TRACE("Memory allocation pointer: 0x%x\n", MemPointer);
// Update LoaderPagesSpanned count
if ((((ULONG_PTR)MemPointer + MemorySize) >> PAGE_SHIFT) > LoaderPagesSpanned)
@ -269,74 +265,74 @@ VOID DumpMemoryAllocMap(VOID)
ULONG Idx;
PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTableAddress;
DPRINTM(DPRINT_MEMORY, "----------- Memory Allocation Bitmap -----------\n");
DbgPrint("----------- Memory Allocation Bitmap -----------\n");
for (Idx=0; Idx<TotalPagesInLookupTable; Idx++)
{
if ((Idx % 32) == 0)
{
DPRINTM(DPRINT_MEMORY, "\n");
DPRINTM(DPRINT_MEMORY, "%08x:\t", (Idx * MM_PAGE_SIZE));
DbgPrint("\n");
DbgPrint("%08x:\t", (Idx * MM_PAGE_SIZE));
}
else if ((Idx % 4) == 0)
{
DPRINTM(DPRINT_MEMORY, " ");
DbgPrint(" ");
}
switch (RealPageLookupTable[Idx].PageAllocated)
{
case LoaderFree:
DPRINTM(DPRINT_MEMORY, "*");
DbgPrint("*");
break;
case LoaderBad:
DPRINTM(DPRINT_MEMORY, "-");
DbgPrint( "-");
break;
case LoaderLoadedProgram:
DPRINTM(DPRINT_MEMORY, "O");
DbgPrint("O");
break;
case LoaderFirmwareTemporary:
DPRINTM(DPRINT_MEMORY, "T");
DbgPrint("T");
break;
case LoaderFirmwarePermanent:
DPRINTM(DPRINT_MEMORY, "P");
DbgPrint( "P");
break;
case LoaderOsloaderHeap:
DPRINTM(DPRINT_MEMORY, "H");
DbgPrint("H");
break;
case LoaderOsloaderStack:
DPRINTM(DPRINT_MEMORY, "S");
DbgPrint("S");
break;
case LoaderSystemCode:
DPRINTM(DPRINT_MEMORY, "K");
DbgPrint("K");
break;
case LoaderHalCode:
DPRINTM(DPRINT_MEMORY, "L");
DbgPrint("L");
break;
case LoaderBootDriver:
DPRINTM(DPRINT_MEMORY, "B");
DbgPrint("B");
break;
case LoaderStartupPcrPage:
DPRINTM(DPRINT_MEMORY, "G");
DbgPrint("G");
break;
case LoaderRegistryData:
DPRINTM(DPRINT_MEMORY, "R");
DbgPrint("R");
break;
case LoaderMemoryData:
DPRINTM(DPRINT_MEMORY, "M");
DbgPrint("M");
break;
case LoaderNlsData:
DPRINTM(DPRINT_MEMORY, "N");
DbgPrint("N");
break;
case LoaderSpecialMemory:
DPRINTM(DPRINT_MEMORY, "C");
DbgPrint("C");
break;
default:
DPRINTM(DPRINT_MEMORY, "?");
DbgPrint("?");
break;
}
}
DPRINTM(DPRINT_MEMORY, "\n");
DbgPrint("\n");
}
#endif // DBG

View file

@ -26,6 +26,8 @@
#define REG_DATA_SIZE_MASK 0x7FFFFFFF
#define REG_DATA_IN_OFFSET 0x80000000
DBG_DEFAULT_CHANNEL(REGISTRY);
/* FUNCTIONS ****************************************************************/
static PVOID
@ -56,7 +58,7 @@ RegImportValue (PHHIVE Hive,
if (ValueCell->Signature != CM_KEY_VALUE_SIGNATURE)
{
DPRINTM(DPRINT_REGISTRY, "Invalid key cell!\n");
ERR("Invalid key cell!\n");
return FALSE;
}
@ -80,8 +82,8 @@ RegImportValue (PHHIVE Hive,
DataLength = ValueCell->DataLength & REG_DATA_SIZE_MASK;
DPRINTM(DPRINT_REGISTRY, "ValueName: '%S'\n", wName);
DPRINTM(DPRINT_REGISTRY, "DataLength: %u\n", DataLength);
TRACE("ValueName: '%S'\n", wName);
TRACE("DataLength: %u\n", DataLength);
if (DataLength <= sizeof(HCELL_INDEX) && (ValueCell->DataLength & REG_DATA_IN_OFFSET))
{
@ -92,7 +94,7 @@ RegImportValue (PHHIVE Hive,
DataLength);
if (Error != ERROR_SUCCESS)
{
DPRINTM(DPRINT_REGISTRY, "RegSetValue() failed!\n");
ERR("RegSetValue() failed!\n");
MmHeapFree (wName);
return FALSE;
}
@ -100,7 +102,7 @@ RegImportValue (PHHIVE Hive,
else
{
DataCell = (PVOID)HvGetCell (Hive, ValueCell->Data);
DPRINTM(DPRINT_REGISTRY, "DataCell: %x\n", DataCell);
TRACE("DataCell: %x\n", DataCell);
Error = RegSetValue (Key,
wName,
@ -110,7 +112,7 @@ RegImportValue (PHHIVE Hive,
if (Error != ERROR_SUCCESS)
{
DPRINTM(DPRINT_REGISTRY, "RegSetValue() failed!\n");
ERR("RegSetValue() failed!\n");
MmHeapFree (wName);
return FALSE;
}
@ -133,7 +135,7 @@ RegImportIndexSubKey(PHHIVE Hive,
{
ULONG i;
DPRINTM(DPRINT_REGISTRY, "IndexCell: %x\n", IndexCell);
TRACE("IndexCell: %x\n", IndexCell);
/* Enumerate and add subkeys */
if (IndexCell->Signature == CM_KEY_INDEX_ROOT ||
@ -180,11 +182,11 @@ RegImportSubKey(PHHIVE Hive,
ULONG i;
DPRINTM(DPRINT_REGISTRY, "KeyCell: %x\n", KeyCell);
DPRINTM(DPRINT_REGISTRY, "KeyCell->Signature: %x\n", KeyCell->Signature);
TRACE("KeyCell: %x\n", KeyCell);
TRACE("KeyCell->Signature: %x\n", KeyCell->Signature);
if (KeyCell->Signature != CM_KEY_NODE_SIGNATURE)
{
DPRINTM(DPRINT_REGISTRY, "Invalid key cell Signature!\n");
ERR("Invalid key cell Signature!\n");
return FALSE;
}
@ -206,7 +208,7 @@ RegImportSubKey(PHHIVE Hive,
wName[KeyCell->NameLength/sizeof(WCHAR)] = 0;
}
DPRINTM(DPRINT_REGISTRY, "KeyName: '%S'\n", wName);
TRACE("KeyName: '%S'\n", wName);
/* Create new sub key */
Error = RegCreateKey (ParentKey,
@ -215,25 +217,25 @@ RegImportSubKey(PHHIVE Hive,
MmHeapFree (wName);
if (Error != ERROR_SUCCESS)
{
DPRINTM(DPRINT_REGISTRY, "RegCreateKey() failed!\n");
ERR("RegCreateKey() failed!\n");
return FALSE;
}
DPRINTM(DPRINT_REGISTRY, "Subkeys: %u\n", KeyCell->SubKeyCounts);
DPRINTM(DPRINT_REGISTRY, "Values: %u\n", KeyCell->ValueList.Count);
TRACE("Subkeys: %u\n", KeyCell->SubKeyCounts);
TRACE("Values: %u\n", KeyCell->ValueList.Count);
/* Enumerate and add values */
if (KeyCell->ValueList.Count > 0)
{
ValueListCell = (PVALUE_LIST_CELL) HvGetCell (Hive, KeyCell->ValueList.List);
DPRINTM(DPRINT_REGISTRY, "ValueListCell: %x\n", ValueListCell);
TRACE("ValueListCell: %x\n", ValueListCell);
for (i = 0; i < KeyCell->ValueList.Count; i++)
{
DPRINTM(DPRINT_REGISTRY, "ValueOffset[%d]: %x\n", i, ValueListCell->ValueOffset[i]);
TRACE("ValueOffset[%d]: %x\n", i, ValueListCell->ValueOffset[i]);
ValueCell = (PCM_KEY_VALUE) HvGetCell (Hive, ValueListCell->ValueOffset[i]);
DPRINTM(DPRINT_REGISTRY, "ValueCell[%d]: %x\n", i, ValueCell);
TRACE("ValueCell[%d]: %x\n", i, ValueCell);
if (!RegImportValue(Hive, ValueCell, SubKey))
return FALSE;
@ -267,7 +269,7 @@ RegImportBinaryHive(PCHAR ChunkBase,
PHHIVE Hive;
NTSTATUS Status;
DPRINTM(DPRINT_REGISTRY, "RegImportBinaryHive(%x, %u) called\n",ChunkBase,ChunkSize);
TRACE("RegImportBinaryHive(%x, %u) called\n",ChunkBase,ChunkSize);
CmHive = CmpAllocate(sizeof(CMHIVE), TRUE, 0);
Status = HvInitialize (&CmHive->Hive,
@ -286,22 +288,22 @@ RegImportBinaryHive(PCHAR ChunkBase,
if (!NT_SUCCESS(Status))
{
CmpFree(CmHive, 0);
DPRINTM(DPRINT_REGISTRY, "Invalid hive Signature!\n");
ERR("Invalid hive Signature!\n");
return FALSE;
}
Hive = &CmHive->Hive;
KeyCell = (PCM_KEY_NODE)HvGetCell (Hive, Hive->BaseBlock->RootCell);
DPRINTM(DPRINT_REGISTRY, "KeyCell: %x\n", KeyCell);
DPRINTM(DPRINT_REGISTRY, "KeyCell->Signature: %x\n", KeyCell->Signature);
TRACE("KeyCell: %x\n", KeyCell);
TRACE("KeyCell->Signature: %x\n", KeyCell->Signature);
if (KeyCell->Signature != CM_KEY_NODE_SIGNATURE)
{
DPRINTM(DPRINT_REGISTRY, "Invalid key cell Signature!\n");
ERR("Invalid key cell Signature!\n");
return FALSE;
}
DPRINTM(DPRINT_REGISTRY, "Subkeys: %u\n", KeyCell->SubKeyCounts);
DPRINTM(DPRINT_REGISTRY, "Values: %u\n", KeyCell->ValueList.Count);
TRACE("Subkeys: %u\n", KeyCell->SubKeyCounts);
TRACE("Values: %u\n", KeyCell->ValueList.Count);
/* Open 'System' key */
Error = RegOpenKey(NULL,
@ -309,7 +311,7 @@ RegImportBinaryHive(PCHAR ChunkBase,
&SystemKey);
if (Error != ERROR_SUCCESS)
{
DPRINTM(DPRINT_REGISTRY, "Failed to open 'system' key!\n");
ERR("Failed to open 'system' key!\n");
return FALSE;
}
@ -317,16 +319,16 @@ RegImportBinaryHive(PCHAR ChunkBase,
if (KeyCell->SubKeyCounts[Stable] > 0)
{
HashCell = (PCM_KEY_FAST_INDEX)HvGetCell (Hive, KeyCell->SubKeyLists[Stable]);
DPRINTM(DPRINT_REGISTRY, "HashCell: %x\n", HashCell);
DPRINTM(DPRINT_REGISTRY, "SubKeyCounts: %x\n", KeyCell->SubKeyCounts[Stable]);
TRACE("HashCell: %x\n", HashCell);
TRACE("SubKeyCounts: %x\n", KeyCell->SubKeyCounts[Stable]);
for (i = 0; i < KeyCell->SubKeyCounts[Stable]; i++)
{
DPRINTM(DPRINT_REGISTRY, "Cell[%d]: %x\n", i, HashCell->List[i].Cell);
TRACE("Cell[%d]: %x\n", i, HashCell->List[i].Cell);
SubKeyCell = (PCM_KEY_NODE)HvGetCell (Hive, HashCell->List[i].Cell);
DPRINTM(DPRINT_REGISTRY, "SubKeyCell[%d]: %x\n", i, SubKeyCell);
TRACE("SubKeyCell[%d]: %x\n", i, SubKeyCell);
if (!RegImportSubKey(Hive, SubKeyCell, SystemKey))
return FALSE;

View file

@ -21,8 +21,9 @@
#include <freeldr.h>
#include <debug.h>
static FRLDRHKEY RootKey;
DBG_DEFAULT_CHANNEL(REGISTRY);
static FRLDRHKEY RootKey;
VOID
RegInitializeRegistry (VOID)
@ -71,7 +72,7 @@ RegInitCurrentControlSet(BOOLEAN LastKnownGood)
&SelectKey);
if (Error != ERROR_SUCCESS)
{
DPRINTM(DPRINT_REGISTRY, "RegOpenKey() failed (Error %u)\n", (int)Error);
ERR("RegOpenKey() failed (Error %u)\n", (int)Error);
return Error;
}
@ -83,7 +84,7 @@ RegInitCurrentControlSet(BOOLEAN LastKnownGood)
&DataSize);
if (Error != ERROR_SUCCESS)
{
DPRINTM(DPRINT_REGISTRY, "RegQueryValue('Default') failed (Error %u)\n", (int)Error);
ERR("RegQueryValue('Default') failed (Error %u)\n", (int)Error);
return Error;
}
@ -95,7 +96,7 @@ RegInitCurrentControlSet(BOOLEAN LastKnownGood)
&DataSize);
if (Error != ERROR_SUCCESS)
{
DPRINTM(DPRINT_REGISTRY, "RegQueryValue('Default') failed (Error %u)\n", (int)Error);
ERR("RegQueryValue('Default') failed (Error %u)\n", (int)Error);
return Error;
}
@ -125,7 +126,7 @@ RegInitCurrentControlSet(BOOLEAN LastKnownGood)
&SystemKey);
if (Error != ERROR_SUCCESS)
{
DPRINTM(DPRINT_REGISTRY, "RegOpenKey(SystemKey) failed (Error %lu)\n", Error);
ERR("RegOpenKey(SystemKey) failed (Error %lu)\n", Error);
return Error;
}
@ -134,7 +135,7 @@ RegInitCurrentControlSet(BOOLEAN LastKnownGood)
&ControlSetKey);
if (Error != ERROR_SUCCESS)
{
DPRINTM(DPRINT_REGISTRY, "RegOpenKey(ControlSetKey) failed (Error %lu)\n", Error);
ERR("RegOpenKey(ControlSetKey) failed (Error %lu)\n", Error);
return Error;
}
@ -143,7 +144,7 @@ RegInitCurrentControlSet(BOOLEAN LastKnownGood)
&LinkKey);
if (Error != ERROR_SUCCESS)
{
DPRINTM(DPRINT_REGISTRY, "RegCreateKey(LinkKey) failed (Error %lu)\n", Error);
ERR("RegCreateKey(LinkKey) failed (Error %lu)\n", Error);
return Error;
}
@ -154,7 +155,7 @@ RegInitCurrentControlSet(BOOLEAN LastKnownGood)
sizeof(PVOID));
if (Error != ERROR_SUCCESS)
{
DPRINTM(DPRINT_REGISTRY, "RegSetValue(LinkKey) failed (Error %lu)\n", Error);
ERR("RegSetValue(LinkKey) failed (Error %lu)\n", Error);
return Error;
}
@ -178,7 +179,7 @@ RegCreateKey(FRLDRHKEY ParentKey,
ULONG NameSize;
int CmpResult;
DPRINTM(DPRINT_REGISTRY, "KeyName '%S'\n", KeyName);
TRACE("KeyName '%S'\n", KeyName);
if (*KeyName == L'\\')
{
@ -202,7 +203,7 @@ RegCreateKey(FRLDRHKEY ParentKey,
while (*KeyName != 0)
{
DPRINTM(DPRINT_REGISTRY, "KeyName '%S'\n", KeyName);
TRACE("KeyName '%S'\n", KeyName);
if (*KeyName == L'\\')
KeyName++;
@ -225,11 +226,11 @@ RegCreateKey(FRLDRHKEY ParentKey,
CmpResult = 1;
while (Ptr != &CurrentKey->SubKeyList)
{
DPRINTM(DPRINT_REGISTRY, "Ptr 0x%x\n", Ptr);
TRACE("Ptr 0x%x\n", Ptr);
SearchKey = CONTAINING_RECORD(Ptr, KEY, KeyList);
DPRINTM(DPRINT_REGISTRY, "SearchKey 0x%x\n", SearchKey);
DPRINTM(DPRINT_REGISTRY, "Searching '%S'\n", SearchKey->Name);
TRACE("SearchKey 0x%x\n", SearchKey);
TRACE("Searching '%S'\n", SearchKey->Name);
CmpResult = _wcsnicmp(SearchKey->Name, name, subkeyLength);
if (CmpResult == 0 && SearchKey->NameSize == NameSize) break;
@ -264,8 +265,8 @@ RegCreateKey(FRLDRHKEY ParentKey,
memcpy(NewKey->Name, name, NewKey->NameSize - sizeof(WCHAR));
NewKey->Name[subkeyLength] = 0;
DPRINTM(DPRINT_REGISTRY, "NewKey 0x%x\n", NewKey);
DPRINTM(DPRINT_REGISTRY, "NewKey '%S' Length %d\n", NewKey->Name, NewKey->NameSize);
TRACE("NewKey 0x%x\n", NewKey);
TRACE("NewKey '%S' Length %d\n", NewKey->Name, NewKey->NameSize);
CurrentKey = NewKey;
}
@ -324,7 +325,7 @@ RegEnumKey(FRLDRHKEY Key,
SearchKey = CONTAINING_RECORD(Ptr, KEY, KeyList);
DPRINTM(DPRINT_REGISTRY, "Name '%S' Length %d\n", SearchKey->Name, SearchKey->NameSize);
TRACE("Name '%S' Length %d\n", SearchKey->Name, SearchKey->NameSize);
Size = min(SearchKey->NameSize, *NameSize);
*NameSize = Size;
@ -348,7 +349,7 @@ RegOpenKey(FRLDRHKEY ParentKey,
int stringLength;
ULONG NameSize;
DPRINTM(DPRINT_REGISTRY, "KeyName '%S'\n", KeyName);
TRACE("KeyName '%S'\n", KeyName);
*Key = NULL;
@ -374,7 +375,7 @@ RegOpenKey(FRLDRHKEY ParentKey,
while (*KeyName != 0)
{
DPRINTM(DPRINT_REGISTRY, "KeyName '%S'\n", KeyName);
TRACE("KeyName '%S'\n", KeyName);
if (*KeyName == L'\\') KeyName++;
p = wcschr(KeyName, L'\\');
@ -395,12 +396,12 @@ RegOpenKey(FRLDRHKEY ParentKey,
Ptr = CurrentKey->SubKeyList.Flink;
while (Ptr != &CurrentKey->SubKeyList)
{
DPRINTM(DPRINT_REGISTRY, "Ptr 0x%x\n", Ptr);
TRACE("Ptr 0x%x\n", Ptr);
SearchKey = CONTAINING_RECORD(Ptr, KEY, KeyList);
DPRINTM(DPRINT_REGISTRY, "SearchKey 0x%x\n", SearchKey);
DPRINTM(DPRINT_REGISTRY, "Searching '%S'\n", SearchKey->Name);
TRACE("SearchKey 0x%x\n", SearchKey);
TRACE("Searching '%S'\n", SearchKey->Name);
if (SearchKey->NameSize == NameSize &&
_wcsnicmp(SearchKey->Name, name, subkeyLength) == 0) break;
@ -443,7 +444,7 @@ RegSetValue(FRLDRHKEY Key,
PLIST_ENTRY Ptr;
PVALUE Value = NULL;
DPRINTM(DPRINT_REGISTRY, "Key 0x%p, ValueName '%S', Type %ld, Data 0x%p, DataSize %ld\n",
TRACE("Key 0x%p, ValueName '%S', Type %ld, Data 0x%p, DataSize %ld\n",
Key, ValueName, Type, Data, DataSize);
if ((ValueName == NULL) || (*ValueName == 0))
@ -476,7 +477,7 @@ RegSetValue(FRLDRHKEY Key,
{
Value = CONTAINING_RECORD(Ptr, VALUE, ValueList);
DPRINTM(DPRINT_REGISTRY, "Value->Name '%S'\n", Value->Name);
TRACE("Value->Name '%S'\n", Value->Name);
if (_wcsicmp(Value->Name, ValueName) == 0) break;
@ -486,7 +487,7 @@ RegSetValue(FRLDRHKEY Key,
if (Ptr == &Key->ValueList)
{
/* add new value */
DPRINTM(DPRINT_REGISTRY, "No value found - adding new value\n");
TRACE("No value found - adding new value\n");
Value = (PVALUE)MmHeapAlloc(sizeof(VALUE));
if (Value == NULL) return ERROR_OUTOFMEMORY;
@ -574,7 +575,7 @@ RegQueryValue(FRLDRHKEY Key,
{
Value = CONTAINING_RECORD(Ptr, VALUE, ValueList);
DPRINTM(DPRINT_REGISTRY, "Searching for '%S'. Value name '%S'\n", ValueName, Value->Name);
TRACE("Searching for '%S'. Value name '%S'\n", ValueName, Value->Name);
if (_wcsicmp(Value->Name, ValueName) == 0) break;

View file

@ -20,6 +20,7 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(UI);
ULONG UiScreenWidth; // Screen Width
ULONG UiScreenHeight; // Screen Height
@ -94,8 +95,8 @@ BOOLEAN UiInitialize(BOOLEAN ShowGui)
return TRUE;
}
DPRINTM(DPRINT_UI, "Initializing User Interface.\n");
DPRINTM(DPRINT_UI, "Reading in UI settings from [Display] section.\n");
TRACE("Initializing User Interface.\n");
TRACE("Reading in UI settings from [Display] section.\n");
DisplayModeText[0] = '\0';
if (IniOpenSection("Display", &SectionId))
@ -219,7 +220,7 @@ BOOLEAN UiInitialize(BOOLEAN ShowGui)
// Draw the backdrop and fade it in if special effects are enabled
UiFadeInBackdrop();
DPRINTM(DPRINT_UI, "UiInitialize() returning TRUE.\n");
TRACE("UiInitialize() returning TRUE.\n");
return TRUE;
}
@ -255,7 +256,7 @@ BOOLEAN SetupUiInitialize(VOID)
UiVtbl.DrawText(4, 1, "ReactOS " KERNEL_VERSION_STR " Setup", ATTR(COLOR_GRAY, UiBackdropBgColor));
UiVtbl.DrawText(3, 2, DisplayModeText, ATTR(COLOR_GRAY, UiBackdropBgColor));
DPRINTM(DPRINT_UI, "UiInitialize() returning TRUE.\n");
TRACE("UiInitialize() returning TRUE.\n");
return TRUE;
}

View file

@ -13,6 +13,8 @@
//#include <ndk/ldrtypes.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(WINDOWS);
/* FUNCTIONS **************************************************************/
#ifndef _ZOOM2_
@ -84,7 +86,7 @@ ConvertConfigToVA(PCONFIGURATION_COMPONENT_DATA Start)
PCONFIGURATION_COMPONENT_DATA Child;
PCONFIGURATION_COMPONENT_DATA Sibling;
DPRINTM(DPRINT_WINDOWS, "ConvertConfigToVA(Start 0x%X)\n", Start);
TRACE("ConvertConfigToVA(Start 0x%X)\n", Start);
Child = Start;
while (Child != NULL)
@ -104,7 +106,7 @@ 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,
TRACE("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
@ -126,7 +128,7 @@ 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,
TRACE("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

View file

@ -17,6 +17,7 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(PELOADER);
BOOLEAN
WinLdrpCompareDllName(IN PCH DllName,
@ -56,7 +57,7 @@ WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
PLDR_DATA_TABLE_ENTRY DataTableEntry;
LIST_ENTRY *ModuleEntry;
DPRINTM(DPRINT_PELOADER, "WinLdrCheckForLoadedDll: DllName %s, LoadedEntry: %X\n",
TRACE("WinLdrCheckForLoadedDll: DllName %s, LoadedEntry: %X\n",
DllName, LoadedEntry);
/* Just go through each entry in the LoadOrderList and compare loaded module's
@ -69,7 +70,7 @@ WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
LDR_DATA_TABLE_ENTRY,
InLoadOrderLinks);
DPRINTM(DPRINT_PELOADER, "WinLdrCheckForLoadedDll: DTE %p, EP %p\n",
TRACE("WinLdrCheckForLoadedDll: DTE %p, EP %p\n",
DataTableEntry, DataTableEntry->EntryPoint);
/* Compare names */
@ -79,7 +80,7 @@ WinLdrCheckForLoadedDll(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
to the caller and increase load count for it */
*LoadedEntry = DataTableEntry;
DataTableEntry->LoadCount++;
DPRINTM(DPRINT_PELOADER, "WinLdrCheckForLoadedDll: LoadedEntry %X\n", DataTableEntry);
TRACE("WinLdrCheckForLoadedDll: LoadedEntry %X\n", DataTableEntry);
return TRUE;
}
@ -111,7 +112,7 @@ 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_PELOADER, "WinLdrScanImportDescriptorTable(): %wZ ImportTable = 0x%X\n",
TRACE("WinLdrScanImportDescriptorTable(): %wZ ImportTable = 0x%X\n",
&BaseName, ImportTable);
}
@ -124,7 +125,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
{
/* Get pointer to the name */
ImportName = (PCH)VaToPa(RVA(ScanDTE->DllBase, ImportTable->Name));
DPRINTM(DPRINT_PELOADER, "WinLdrScanImportDescriptorTable(): Looking at %s\n", ImportName);
TRACE("WinLdrScanImportDescriptorTable(): Looking at %s\n", ImportName);
/* In case we get a reference to ourselves - just skip it */
if (WinLdrpCompareDllName(ImportName, &ScanDTE->BaseDllName))
@ -140,7 +141,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (!Status)
{
DPRINTM(DPRINT_PELOADER, "WinLdrpLoadAndScanReferencedDll() failed\n");
ERR("WinLdrpLoadAndScanReferencedDll() failed\n");
return Status;
}
}
@ -154,7 +155,7 @@ WinLdrScanImportDescriptorTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (!Status)
{
DPRINTM(DPRINT_PELOADER, "WinLdrpScanImportAddressTable() failed\n");
ERR("WinLdrpScanImportAddressTable() failed\n");
return Status;
}
}
@ -329,7 +330,7 @@ WinLdrLoadImage(IN PCHAR FileName,
/* This is the real image base - in form of a virtual address */
VirtualBase = PaToVa(PhysicalBase);
DPRINTM(DPRINT_PELOADER, "Base PA: 0x%X, VA: 0x%X\n", PhysicalBase, VirtualBase);
TRACE("Base PA: 0x%X, VA: 0x%X\n", PhysicalBase, VirtualBase);
/* Set to 0 position and fully load the file image */
Position.HighPart = Position.LowPart = 0;
@ -390,14 +391,14 @@ WinLdrLoadImage(IN PCHAR FileName,
Position.LowPart = SectionHeader->PointerToRawData;
Status = ArcSeek(FileId, &Position, SeekAbsolute);
DPRINTM(DPRINT_PELOADER, "SH->VA: 0x%X\n", SectionHeader->VirtualAddress);
TRACE("SH->VA: 0x%X\n", SectionHeader->VirtualAddress);
/* Read this section from the file, size = SizeOfRawData */
Status = ArcRead(FileId, (PUCHAR)PhysicalBase + SectionHeader->VirtualAddress, SizeOfRawData, &BytesRead);
if (Status != ESUCCESS)
{
DPRINTM(DPRINT_PELOADER, "WinLdrLoadImage(): Error reading section from file!\n");
ERR("WinLdrLoadImage(): Error reading section from file!\n");
break;
}
}
@ -405,7 +406,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_PELOADER, "WinLdrLoadImage(): SORD %d < VS %d\n", SizeOfRawData, VirtualSize);
TRACE("WinLdrLoadImage(): SORD %d < VS %d\n", SizeOfRawData, VirtualSize);
RtlZeroMemory((PVOID)(SectionHeader->VirtualAddress + (ULONG_PTR)PhysicalBase + SizeOfRawData), VirtualSize - SizeOfRawData);
}
@ -423,8 +424,8 @@ WinLdrLoadImage(IN PCHAR FileName,
/* Relocate the image, if it needs it */
if (NtHeaders->OptionalHeader.ImageBase != (ULONG_PTR)VirtualBase)
{
DPRINTM(DPRINT_PELOADER, "Relocating %p -> %p\n",
NtHeaders->OptionalHeader.ImageBase, VirtualBase);
WARN("Relocating %p -> %p\n", NtHeaders->OptionalHeader.ImageBase,
VirtualBase);
return (BOOLEAN)LdrRelocateImageWithBias(PhysicalBase,
(ULONG_PTR)VirtualBase - (ULONG_PTR)PhysicalBase,
"FreeLdr",
@ -453,7 +454,7 @@ WinLdrpCompareDllName(IN PCH DllName,
UnicodeNamePA.Length = UnicodeName->Length;
UnicodeNamePA.MaximumLength = UnicodeName->MaximumLength;
UnicodeNamePA.Buffer = VaToPa(UnicodeName->Buffer);
DPRINTM(DPRINT_PELOADER, "WinLdrpCompareDllName: %s and %wZ, Length = %d "
TRACE("WinLdrpCompareDllName: %s and %wZ, Length = %d "
"UN->Length %d\n", DllName, &UnicodeNamePA, Length, UnicodeName->Length);
if ((Length * sizeof(WCHAR)) > UnicodeName->Length)
@ -500,13 +501,13 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
LONG High, Low, Middle, Result;
ULONG Hint;
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): DllBase 0x%X, ImageBase 0x%X, ThunkData 0x%X, ExportDirectory 0x%X, ExportSize %d, ProcessForwards 0x%X\n",
//TRACE("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_PELOADER, "WARNING: DllBase == NULL!\n");
WARN("DllBase == NULL!\n");
return FALSE;
}
@ -518,7 +519,7 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
{
/* Yes, calculate the ordinal */
Ordinal = (ULONG)(IMAGE_ORDINAL(ThunkData->u1.Ordinal) - (UINT32)ExportDirectory->Base);
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
//TRACE("WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
}
else
{
@ -526,22 +527,22 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (!ProcessForwards)
{
/* AddressOfData in thunk entry will become a virtual address (from relative) */
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): ThunkData->u1.AOD was %p\n", ThunkData->u1.AddressOfData);
//TRACE("WinLdrpBindImportName(): ThunkData->u1.AOD was %p\n", ThunkData->u1.AddressOfData);
ThunkData->u1.AddressOfData =
(ULONG_PTR)RVA(ImageBase, ThunkData->u1.AddressOfData);
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): ThunkData->u1.AOD became %p\n", ThunkData->u1.AddressOfData);
//TRACE("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_PELOADER, "NameTable 0x%X, OrdinalTable 0x%X, ED->AddressOfNames 0x%X, ED->AOFO 0x%X\n",
//TRACE("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_PELOADER, "HintIndex %d\n", Hint);
//TRACE("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 +555,14 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
)
{
Ordinal = OrdinalTable[Hint];
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): Ordinal %d\n", Ordinal);
//TRACE("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_PELOADER, "WinLdrpBindImportName() looking up the import name using binary search...\n");
//TRACE("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,11 +578,11 @@ 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_PELOADER, "Binary search: comparing Import '__', Export '%s'\n",*/
/*TRACE("Binary search: comparing Import '__', Export '%s'\n",*/
/*VaToPa(&((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name[0]),*/
/*(PCHAR)VaToPa(RVA(DllBase, NameTable[Middle])));*/
/*DPRINTM(DPRINT_PELOADER, "TE->u1.AOD %p, fulladdr %p\n",
/*TRACE("TE->u1.AOD %p, fulladdr %p\n",
ThunkData->u1.AddressOfData,
((PIMAGE_IMPORT_BY_NAME)VaToPa(ThunkData->u1.AddressOfData))->Name );*/
@ -608,21 +609,21 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (High < Low)
{
//Print(L"Error in binary search\n");
DPRINTM(DPRINT_PELOADER, "Error in binary search!\n");
ERR("Error in binary search!\n");
return FALSE;
}
/* Everything allright, get the ordinal */
Ordinal = OrdinalTable[Middle];
//DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName() found Ordinal %d\n", Ordinal);
//TRACE("WinLdrpBindImportName() found Ordinal %d\n", Ordinal);
}
}
/* Check ordinal number for validity! */
if (Ordinal >= ExportDirectory->NumberOfFunctions)
{
DPRINTM(DPRINT_PELOADER, "Ordinal number is invalid!\n");
ERR("Ordinal number is invalid!\n");
return FALSE;
}
@ -647,12 +648,12 @@ WinLdrpBindImportName(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
/* Strip out its extension */
*strchr(ForwardDllName,'.') = '\0';
DPRINTM(DPRINT_PELOADER, "WinLdrpBindImportName(): ForwardDllName %s\n", ForwardDllName);
TRACE("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_PELOADER, "Error loading DLL!\n");
ERR("Error loading DLL!\n");
return FALSE;
}
@ -728,7 +729,7 @@ WinLdrpLoadAndScanReferencedDll(PLOADER_PARAMETER_BLOCK WinLdrBlock,
strcpy(FullDllName, DirectoryPath);
strcat(FullDllName, ImportName);
DPRINTM(DPRINT_PELOADER, "Loading referenced DLL: %s\n", FullDllName);
TRACE("Loading referenced DLL: %s\n", FullDllName);
//Print(L"Loading referenced DLL: %s\n", FullDllName);
/* Load the image */
@ -736,7 +737,7 @@ WinLdrpLoadAndScanReferencedDll(PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (!Status)
{
DPRINTM(DPRINT_PELOADER, "WinLdrLoadImage() failed\n");
ERR("WinLdrLoadImage() failed\n");
return Status;
}
@ -749,21 +750,18 @@ WinLdrpLoadAndScanReferencedDll(PLOADER_PARAMETER_BLOCK WinLdrBlock,
if (!Status)
{
DPRINTM(DPRINT_PELOADER,
"WinLdrAllocateDataTableEntry() failed with Status=0x%X\n", Status);
ERR("WinLdrAllocateDataTableEntry() failed with Status=0x%X\n", Status);
return Status;
}
/* Scan its dependencies too */
DPRINTM(DPRINT_PELOADER,
"WinLdrScanImportDescriptorTable() calling ourselves for %S\n",
TRACE("WinLdrScanImportDescriptorTable() calling ourselves for %S\n",
VaToPa((*DataTableEntry)->BaseDllName.Buffer));
Status = WinLdrScanImportDescriptorTable(WinLdrBlock, DirectoryPath, *DataTableEntry);
if (!Status)
{
DPRINTM(DPRINT_PELOADER,
"WinLdrScanImportDescriptorTable() failed with Status=0x%X\n", Status);
ERR("WinLdrScanImportDescriptorTable() failed with Status=0x%X\n", Status);
return Status;
}
@ -780,7 +778,7 @@ WinLdrpScanImportAddressTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
BOOLEAN Status;
ULONG ExportSize;
DPRINTM(DPRINT_PELOADER, "WinLdrpScanImportAddressTable(): DllBase 0x%X, "
TRACE("WinLdrpScanImportAddressTable(): DllBase 0x%X, "
"ImageBase 0x%X, ThunkData 0x%X\n", DllBase, ImageBase, ThunkData);
/* Obtain the export table from the DLL's base */
@ -798,7 +796,7 @@ WinLdrpScanImportAddressTable(IN OUT PLOADER_PARAMETER_BLOCK WinLdrBlock,
&ExportSize);
}
DPRINTM(DPRINT_PELOADER, "WinLdrpScanImportAddressTable(): ExportDirectory 0x%X\n", ExportDirectory);
TRACE("WinLdrpScanImportAddressTable(): ExportDirectory 0x%X\n", ExportDirectory);
/* If pointer to Export Directory is */
if (ExportDirectory == NULL)

View file

@ -25,6 +25,8 @@
#include <debug.h>
DBG_DEFAULT_CHANNEL(WINDOWS);
void
WinLdrSetupMachineDependent(PLOADER_PARAMETER_BLOCK LoaderBlock);
@ -53,40 +55,40 @@ SetupLdrLoadNlsData(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPCSTR
/* Get ANSI codepage file */
if (!InfFindFirstLine(InfHandle, "NLS", "AnsiCodepage", &InfContext))
{
printf("Failed to find 'NLS/AnsiCodepage'\n");
ERR("Failed to find 'NLS/AnsiCodepage'\n");
return;
}
if (!InfGetDataField(&InfContext, 1, &AnsiName))
{
printf("Failed to get load options\n");
ERR("Failed to get load options\n");
return;
}
/* Get OEM codepage file */
if (!InfFindFirstLine(InfHandle, "NLS", "OemCodepage", &InfContext))
{
printf("Failed to find 'NLS/AnsiCodepage'\n");
ERR("Failed to find 'NLS/AnsiCodepage'\n");
return;
}
if (!InfGetDataField(&InfContext, 1, &OemName))
{
printf("Failed to get load options\n");
ERR("Failed to get load options\n");
return;
}
if (!InfFindFirstLine(InfHandle, "NLS", "UnicodeCasetable", &InfContext))
{
printf("Failed to find 'NLS/AnsiCodepage'\n");
ERR("Failed to find 'NLS/AnsiCodepage'\n");
return;
}
if (!InfGetDataField(&InfContext, 1, &LangName))
{
printf("Failed to get load options\n");
ERR("Failed to get load options\n");
return;
}
Status = WinLdrLoadNLSData(LoaderBlock, SearchPath, AnsiName, OemName, LangName);
DPRINTM(DPRINT_WINDOWS, "NLS data loaded with status %d\n", Status);
TRACE("NLS data loaded with status %d\n", Status);
}
VOID
@ -132,7 +134,7 @@ SetupLdrScanBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPC
if (!Status)
{
DPRINTM(DPRINT_WINDOWS, "could not add boot driver %s, %s\n", SearchPath, DriverName);
ERR("could not add boot driver %s, %s\n", SearchPath, DriverName);
return;
}
}
@ -178,7 +180,7 @@ VOID LoadReactOSSetup(VOID)
SystemPath = SourcePaths[i];
if (!SystemPath)
{
printf("Failed to open 'txtsetup.sif'\n");
ERR("Failed to open txtsetup.sif\n");
return;
}
sprintf(FileName, "%stxtsetup.sif", SystemPath);
@ -189,18 +191,18 @@ VOID LoadReactOSSetup(VOID)
}
}
DPRINTM(DPRINT_WINDOWS,"BootPath: '%s', SystemPath: '%s'\n", BootPath, SystemPath);
TRACE("BootPath: '%s', SystemPath: '%s'\n", BootPath, SystemPath);
/* Get Load options - debug and non-debug */
if (!InfFindFirstLine(InfHandle, "SetupData", "OsLoadOptions", &InfContext))
{
printf("Failed to find 'SetupData/OsLoadOptions'\n");
ERR("Failed to find 'SetupData/OsLoadOptions'\n");
return;
}
if (!InfGetDataField (&InfContext, 1, &LoadOptions))
{
printf("Failed to get load options\n");
ERR("Failed to get load options\n");
return;
}
@ -215,7 +217,7 @@ VOID LoadReactOSSetup(VOID)
}
#endif
DPRINTM(DPRINT_WINDOWS,"BootOptions: '%s'\n", BootOptions);
TRACE("BootOptions: '%s'\n", BootOptions);
//SetupUiInitialize();
UiDrawStatusText("");

View file

@ -24,6 +24,8 @@
#include <ndk/ldrtypes.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(WINDOWS);
//FIXME: Do a better way to retrieve Arc disk information
extern ULONG reactos_disk_count;
extern ARC_DISK_SIGNATURE reactos_arc_disk_info[];
@ -92,9 +94,9 @@ WinLdrInitializePhase1(PLOADER_PARAMETER_BLOCK LoaderBlock,
strncpy(ArcBoot, BootPath, PathSeparator);
ArcBoot[PathSeparator] = 0;
DPRINTM(DPRINT_WINDOWS, "ArcBoot: %s\n", ArcBoot);
DPRINTM(DPRINT_WINDOWS, "SystemRoot: %s\n", SystemRoot);
DPRINTM(DPRINT_WINDOWS, "Options: %s\n", Options);
TRACE("ArcBoot: %s\n", ArcBoot);
TRACE("SystemRoot: %s\n", SystemRoot);
TRACE("Options: %s\n", Options);
/* Fill Arc BootDevice */
LoaderBlock->ArcBootDeviceName = MmHeapAlloc(strlen(ArcBoot)+1);
@ -257,7 +259,7 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
DriverPath[0] = 0;
}
DPRINTM(DPRINT_WINDOWS, "DriverPath: %s, DllName: %s, LPB %p\n", DriverPath, DllName, LoaderBlock);
TRACE("DriverPath: %s, DllName: %s, LPB %p\n", DriverPath, DllName, LoaderBlock);
// Check if driver is already loaded
@ -278,7 +280,7 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
Status = WinLdrAllocateDataTableEntry(LoaderBlock, DllName, DllName, DriverBase, DriverDTE);
if (!Status)
{
DPRINTM(DPRINT_WINDOWS, "WinLdrAllocateDataTableEntry() failed\n");
ERR("WinLdrAllocateDataTableEntry() failed\n");
return FALSE;
}
@ -290,8 +292,7 @@ WinLdrLoadDeviceDriver(PLOADER_PARAMETER_BLOCK LoaderBlock,
Status = WinLdrScanImportDescriptorTable(LoaderBlock, FullPath, *DriverDTE);
if (!Status)
{
DPRINTM(DPRINT_WINDOWS, "WinLdrScanImportDescriptorTable() failed for %s\n",
FullPath);
ERR("WinLdrScanImportDescriptorTable() failed for %s\n", FullPath);
return FALSE;
}
@ -313,7 +314,7 @@ 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,
TRACE("BootDriver %wZ DTE %08X RegPath: %wZ\n", &BootDriver->FilePath,
BootDriver->LdrEntry, &BootDriver->RegistryPath);
// Paths are relative (FIXME: Are they always relative?)
@ -357,7 +358,7 @@ PVOID WinLdrLoadModule(PCSTR ModuleName, ULONG *Size,
//sprintf(ProgressString, "Loading %s...", FileName);
//UiDrawProgressBarCenter(1, 100, ProgressString);
DPRINTM(DPRINT_WINDOWS, "Loading module %s\n", ModuleName);
TRACE("Loading module %s\n", ModuleName);
*Size = 0;
/* Open the image file */
@ -394,7 +395,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);
TRACE("Loaded %s at 0x%x with size 0x%x\n", ModuleName, PhysicalBase, FileSize);
return PhysicalBase;
}
@ -442,7 +443,7 @@ LoadModule(
strcat(FullFileName, File);
Status = WinLdrLoadImage(FullFileName, LoaderSystemCode, &BaseAdress);
DPRINTM(DPRINT_WINDOWS, "%s loaded with status %d at %p\n",
TRACE("%s loaded with status %d at %p\n",
File, Status, BaseAdress);
strcpy(FullFileName, "WINDOWS\\SYSTEM32\\");
@ -503,7 +504,7 @@ LoadAndBootWindows(PCSTR OperatingSystemName,
while (*p != '\0' && *p != '"')
p++;
strcpy(BootOptions, p);
DPRINTM(DPRINT_WINDOWS,"BootOptions: '%s'\n", BootOptions);
TRACE("BootOptions: '%s'\n", BootOptions);
}
/* Append boot-time options */
@ -526,7 +527,7 @@ LoadAndBootWindows(PCSTR OperatingSystemName,
/* Let user know we started loading */
//UiDrawStatusText("Loading...");
DPRINTM(DPRINT_WINDOWS,"BootPath: '%s'\n", BootPath);
TRACE("BootPath: '%s'\n", BootPath);
/* Allocate and minimalistic-initialize LPB */
AllocateAndInitLPB(&LoaderBlock);
@ -540,11 +541,11 @@ LoadAndBootWindows(PCSTR OperatingSystemName,
UiDrawBackdrop();
UiDrawProgressBarCenter(15, 100, "Loading system hive...");
Status = WinLdrInitSystemHive(LoaderBlock, BootPath);
DPRINTM(DPRINT_WINDOWS, "SYSTEM hive loaded with status %d\n", Status);
TRACE("SYSTEM hive loaded with status %d\n", Status);
/* Load NLS data, OEM font, and prepare boot drivers list */
Status = WinLdrScanSystemHive(LoaderBlock, BootPath);
DPRINTM(DPRINT_WINDOWS, "SYSTEM hive scanned with status %d\n", Status);
TRACE("SYSTEM hive scanned with status %d\n", Status);
LoadAndBootWindowsCommon(OperatingSystemVersion,
@ -610,7 +611,7 @@ LoadAndBootWindowsCommon(
UiDrawBackdrop();
UiDrawProgressBarCenter(100, 100, "Loading boot drivers...");
Status = WinLdrLoadBootDrivers(LoaderBlock, (PCHAR)BootPath);
DPRINTM(DPRINT_WINDOWS, "Boot drivers loaded with status %d\n", Status);
TRACE("Boot drivers loaded with status %d\n", Status);
/* Initialize Phase 1 - no drivers loading anymore */
WinLdrInitializePhase1(LoaderBlock, BootOptions, SystemRoot, BootPath, OperatingSystemVersion);
@ -637,7 +638,7 @@ LoadAndBootWindowsCommon(
/* Set processor context */
WinLdrSetProcessorContext();
DPRINTM(DPRINT_WINDOWS, "Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
TRACE("Hello from paged mode, KiSystemStartup %p, LoaderBlockVA %p!\n",
KiSystemStartup, LoaderBlockVA);
// Zero KI_USER_SHARED_DATA page
@ -670,7 +671,7 @@ 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,
TRACE("BP %08X PC %04X MT %d\n", MemoryDescriptor->BasePage,
MemoryDescriptor->PageCount, MemoryDescriptor->MemoryType);
NextMd = MemoryDescriptor->ListEntry.Flink;
@ -689,7 +690,7 @@ 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,
TRACE("BootDriver %wZ DTE %08X RegPath: %wZ\n", &BootDriver->FilePath,
BootDriver->LdrEntry, &BootDriver->RegistryPath);
NextBd = BootDriver->Link.Flink;
@ -708,7 +709,7 @@ 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",
TRACE("ArcDisk %s checksum: 0x%X, signature: 0x%X\n",
ArcDisk->ArcName, ArcDisk->CheckSum, ArcDisk->Signature);
NextBd = ArcDisk->ListEntry.Flink;

View file

@ -13,6 +13,8 @@
#include <ndk/asm.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(WINDOWS);
extern ULONG LoaderPagesSpanned;
PCHAR MemTypeDesc[] = {
@ -148,7 +150,7 @@ 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",
TRACE("Setting page %x %x to Temporary from %d\n",
BasePage, PageCount, Mad[MadCount].MemoryType);
Mad[MadCount].MemoryType = LoaderFirmwareTemporary;
}
@ -174,7 +176,7 @@ MempAddMemoryBlock(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
Status = MempSetupPaging(BasePage, PageCount);
if (!Status)
{
DPRINTM(DPRINT_WINDOWS, "Error during MempSetupPaging\n");
ERR("Error during MempSetupPaging\n");
return;
}
}
@ -231,13 +233,13 @@ WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
MemoryMapStartPage = (ULONG_PTR)MemoryMap >> MM_PAGE_SHIFT;
MemoryMapSizeInPages = (NoEntries * sizeof(PAGE_LOOKUP_TABLE_ITEM) + MM_PAGE_SIZE - 1) / MM_PAGE_SIZE;
DPRINTM(DPRINT_WINDOWS, "Got memory map with %d entries\n", NoEntries);
TRACE("Got memory map with %d entries\n", NoEntries);
// Always contiguously map low 1Mb of memory
Status = MempSetupPaging(0, 0x100);
if (!Status)
{
DPRINTM(DPRINT_WINDOWS, "Error during MempSetupPaging of low 1Mb\n");
ERR("Error during MempSetupPaging of low 1Mb\n");
return FALSE;
}
@ -300,7 +302,7 @@ WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
}
#endif
DPRINTM(DPRINT_WINDOWS, "MadCount: %d\n", MadCount);
TRACE("MadCount: %d\n", MadCount);
WinLdrpDumpMemoryDescriptors(LoaderBlock); //FIXME: Delete!
@ -317,7 +319,7 @@ WinLdrSetupMemoryLayout(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock)
// Fill the memory descriptor list and
//PrepareMemoryDescriptorList();
DPRINTM(DPRINT_WINDOWS, "Memory Descriptor List prepared, printing PDE\n");
TRACE("Memory Descriptor List prepared, printing PDE\n");
List_PaToVa(&LoaderBlock->MemoryDescriptorListHead);
#if DBG
@ -337,7 +339,7 @@ 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,
TRACE("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 */

View file

@ -11,6 +11,8 @@
#include <freeldr.h>
#include <debug.h>
DBG_DEFAULT_CHANNEL(WINDOWS);
// The only global var here, used to mark mem pages as NLS in WinLdrSetupMemoryLayout()
ULONG TotalNLSSize = 0;
@ -107,17 +109,17 @@ WinLdrLoadSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
FsService = FsGetServiceName(FileId);
if (FsService)
{
DPRINTM(DPRINT_WINDOWS, " Adding filesystem service %S\n", FsService);
TRACE(" Adding filesystem service %S\n", FsService);
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
NULL,
(LPWSTR)FsService);
if (!Status)
DPRINTM(DPRINT_WINDOWS, " Failed to add filesystem service\n");
TRACE(" Failed to add filesystem service\n");
}
else
{
DPRINTM(DPRINT_WINDOWS, " No required filesystem service\n");
TRACE(" No required filesystem service\n");
}
ArcClose(FileId);
@ -181,13 +183,13 @@ BOOLEAN WinLdrScanSystemHive(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
return FALSE;
}
DPRINTM(DPRINT_WINDOWS, "NLS data %s %s %s\n", AnsiName, OemName, LangName);
TRACE("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);
TRACE("NLS data loaded with status %d\n", Status);
/* TODO: Load OEM HAL font */
@ -323,7 +325,7 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
if (Status != ESUCCESS)
goto Failure;
AnsiFileSize = FileInfo.EndingAddress.LowPart;
DPRINTM(DPRINT_WINDOWS, "AnsiFileSize: %d\n", AnsiFileSize);
TRACE("AnsiFileSize: %d\n", AnsiFileSize);
ArcClose(AnsiFileId);
/* Open OEM file and store its length */
@ -347,7 +349,7 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
OemFileSize = FileInfo.EndingAddress.LowPart;
ArcClose(OemFileId);
}
DPRINTM(DPRINT_WINDOWS, "OemFileSize: %d\n", OemFileSize);
TRACE("OemFileSize: %d\n", OemFileSize);
/* And finally open the language codepage file and store its length */
//Print(L"Loading %s...\n", Filename);
@ -363,7 +365,7 @@ WinLdrLoadNLSData(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
goto Failure;
LanguageFileSize = FileInfo.EndingAddress.LowPart;
ArcClose(LanguageFileId);
DPRINTM(DPRINT_WINDOWS, "LanguageFileSize: %d\n", LanguageFileSize);
TRACE("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 */
@ -489,7 +491,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);
TRACE_CH(REACTOS, "Failed to open the 'ServiceGroupOrder' key (rc %d)\n", (int)rc);
return;
}
@ -499,7 +501,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);
TRACE_CH(REACTOS, "Failed to open the 'GroupOrderList' key (rc %d)\n", (int)rc);
return;
}
@ -509,7 +511,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);
TRACE_CH(REACTOS, "Failed to open the 'Services' key (rc %d)\n", (int)rc);
return;
}
@ -517,17 +519,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);
TRACE_CH(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);
TRACE_CH(REACTOS, "BufferSize: %d \n", (int)BufferSize);
TRACE_CH(REACTOS, "GroupNameBuffer: '%S' \n", GroupNameBuffer);
/* Loop through each group */
GroupName = GroupNameBuffer;
while (*GroupName)
{
DPRINTM(DPRINT_WINDOWS, "Driver group: '%S'\n", GroupName);
TRACE("Driver group: '%S'\n", GroupName);
/* Query the Order */
BufferSize = sizeof(OrderList);
@ -544,7 +546,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);
//TRACE_CH(REACTOS, "RegEnumKey(): rc %d\n", (int)rc);
/* Makre sure it's valid, and check if we're done */
if (rc == ERROR_NO_MORE_ITEMS)
@ -554,7 +556,7 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
MmHeapFree(GroupNameBuffer);
return;
}
//DPRINTM(DPRINT_REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName);
//TRACE_CH(REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName);
/* open driver Key */
rc = RegOpenKey(hServiceKey, ServiceName, &hDriverKey);
@ -564,18 +566,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);
//TRACE_CH(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);
//TRACE_CH(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);
//TRACE_CH(REACTOS, " Group: '%S' \n", DriverGroup);
/* Make sure it should be started */
if ((StartValue == 0) &&
@ -588,17 +590,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");
TRACE_CH(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);
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
}
DPRINTM(DPRINT_WINDOWS, " Adding boot driver: '%s'\n", ImagePath);
TRACE("Adding boot driver: '%s'\n", ImagePath);
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
@ -606,10 +608,10 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ServiceName);
if (!Status)
DPRINTM(DPRINT_WINDOWS, " Failed to add boot driver\n");
ERR("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",
//TRACE(" 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);
}
}
@ -625,7 +627,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);
//TRACE_CH(REACTOS, "RegEnumKey(): rc %d\n", (int)rc);
if (rc == ERROR_NO_MORE_ITEMS)
break;
if (rc != ERROR_SUCCESS)
@ -633,7 +635,7 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
MmHeapFree(GroupNameBuffer);
return;
}
//DPRINTM(DPRINT_REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName);
//TRACE_CH(REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName);
/* open driver Key */
rc = RegOpenKey(hServiceKey, ServiceName, &hDriverKey);
@ -643,18 +645,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);
//TRACE_CH(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);
//TRACE_CH(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);
//TRACE_CH(REACTOS, " Group: '%S' \n", DriverGroup);
for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++) {
if (TagValue == OrderList[TagIndex]) break;
@ -667,16 +669,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");
TRACE_CH(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);
TRACE_CH(REACTOS, "ImagePath: '%s'\n", ImagePath);
}
DPRINTM(DPRINT_WINDOWS, " Adding boot driver: '%s'\n", ImagePath);
TRACE(" Adding boot driver: '%s'\n", ImagePath);
Status = WinLdrAddDriverToList(&LoaderBlock->BootDriverListHead,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\",
@ -684,10 +686,10 @@ WinLdrScanRegistry(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock,
ServiceName);
if (!Status)
DPRINTM(DPRINT_WINDOWS, " Failed to add boot driver\n");
ERR(" 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",
//TRACE(" Skipping driver '%S' with Start %d, Tag %d and Group '%S' (Current group '%S')\n",
// ServiceName, StartValue, TagValue, DriverGroup, GroupName);
}
}