diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hardware.c b/reactos/boot/freeldr/freeldr/arch/i386/hardware.c index eea27ab301a..97109e04853 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hardware.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hardware.c @@ -234,12 +234,12 @@ HalpCalibrateStallExecution(VOID) } static VOID -DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber) +DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_PNP_BIOS_DEVICE_NODE DeviceNode; PCM_PNP_BIOS_INSTALLATION_CHECK InstData; - FRLDRHKEY BusKey; + PCONFIGURATION_COMPONENT_DATA BusKey; ULONG x; ULONG NodeSize = 0; ULONG NodeCount = 0; @@ -367,7 +367,7 @@ DetectPnpBios(FRLDRHKEY SystemKey, ULONG *BusNumber) static VOID -SetHarddiskConfigurationData(FRLDRHKEY DiskKey, +SetHarddiskConfigurationData(PCONFIGURATION_COMPONENT_DATA DiskKey, ULONG DriveNumber) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; @@ -439,7 +439,7 @@ SetHarddiskConfigurationData(FRLDRHKEY DiskKey, static VOID -SetHarddiskIdentifier(FRLDRHKEY DiskKey, +SetHarddiskIdentifier(PCONFIGURATION_COMPONENT_DATA DiskKey, ULONG DriveNumber) { PMASTER_BOOT_RECORD Mbr; @@ -510,13 +510,13 @@ SetHarddiskIdentifier(FRLDRHKEY DiskKey, static VOID -DetectBiosDisks(FRLDRHKEY SystemKey, - FRLDRHKEY BusKey) +DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, + PCONFIGURATION_COMPONENT_DATA BusKey) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_INT13_DRIVE_PARAMETER Int13Drives; GEOMETRY Geometry; - FRLDRHKEY DiskKey; + PCONFIGURATION_COMPONENT_DATA DiskKey; ULONG DiskCount; ULONG Size; ULONG i; @@ -661,13 +661,13 @@ GetInt1eTable(VOID) static VOID -DetectBiosFloppyPeripheral(FRLDRHKEY ControllerKey) +DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor; PCM_FLOPPY_DEVICE_DATA FloppyData; WCHAR Identifier[20]; - FRLDRHKEY PeripheralKey; + PCONFIGURATION_COMPONENT_DATA PeripheralKey; ULONG Size; ULONG FloppyNumber; UCHAR FloppyType; @@ -743,12 +743,12 @@ DetectBiosFloppyPeripheral(FRLDRHKEY ControllerKey) static VOID -DetectBiosFloppyController(FRLDRHKEY SystemKey, - FRLDRHKEY BusKey) +DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA SystemKey, + PCONFIGURATION_COMPONENT_DATA BusKey) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor; - FRLDRHKEY ControllerKey; + PCONFIGURATION_COMPONENT_DATA ControllerKey; ULONG Size; ULONG FloppyCount; @@ -999,13 +999,13 @@ GetSerialMousePnpId(ULONG Port, char *Buffer) static VOID -DetectSerialPointerPeripheral(FRLDRHKEY ControllerKey, +DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey, ULONG Base) { CM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; char Buffer[256]; WCHAR Identifier[256]; - FRLDRHKEY PeripheralKey; + PCONFIGURATION_COMPONENT_DATA PeripheralKey; ULONG MouseType; ULONG Length; ULONG i; @@ -1173,7 +1173,7 @@ DetectSerialPointerPeripheral(FRLDRHKEY ControllerKey, static VOID -DetectSerialPorts(FRLDRHKEY BusKey) +DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor; @@ -1183,7 +1183,7 @@ DetectSerialPorts(FRLDRHKEY BusKey) WCHAR Buffer[80]; PUSHORT BasePtr; ULONG ControllerNumber = 0; - FRLDRHKEY ControllerKey; + PCONFIGURATION_COMPONENT_DATA ControllerKey; ULONG i; ULONG Size; @@ -1288,13 +1288,13 @@ DetectSerialPorts(FRLDRHKEY BusKey) static VOID -DetectParallelPorts(FRLDRHKEY BusKey) +DetectParallelPorts(PCONFIGURATION_COMPONENT_DATA BusKey) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor; ULONG Irq[3] = {7, 5, (ULONG)-1}; WCHAR Buffer[80]; - FRLDRHKEY ControllerKey; + PCONFIGURATION_COMPONENT_DATA ControllerKey; PUSHORT BasePtr; ULONG Base; ULONG ControllerNumber; @@ -1462,12 +1462,12 @@ DetectKeyboardDevice(VOID) static VOID -DetectKeyboardPeripheral(FRLDRHKEY ControllerKey) +DetectKeyboardPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor; PCM_KEYBOARD_DEVICE_DATA KeyboardData; - FRLDRHKEY PeripheralKey; + PCONFIGURATION_COMPONENT_DATA PeripheralKey; ULONG Size; /* HACK: don't call DetectKeyboardDevice() as it fails in Qemu 0.8.2 */ @@ -1530,11 +1530,11 @@ DetectKeyboardPeripheral(FRLDRHKEY ControllerKey) static VOID -DetectKeyboardController(FRLDRHKEY BusKey) +DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor; - FRLDRHKEY ControllerKey; + PCONFIGURATION_COMPONENT_DATA ControllerKey; ULONG Size; /* Create controller key */ @@ -1716,11 +1716,11 @@ DetectPS2AuxDevice(VOID) static VOID -DetectPS2Mouse(FRLDRHKEY BusKey) +DetectPS2Mouse(PCONFIGURATION_COMPONENT_DATA BusKey) { CM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; - FRLDRHKEY ControllerKey; - FRLDRHKEY PeripheralKey; + PCONFIGURATION_COMPONENT_DATA ControllerKey; + PCONFIGURATION_COMPONENT_DATA PeripheralKey; if (DetectPS2AuxPort()) { @@ -1804,10 +1804,10 @@ DetectPS2Mouse(FRLDRHKEY BusKey) static VOID -DetectDisplayController(FRLDRHKEY BusKey) +DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey) { WCHAR Buffer[80]; - FRLDRHKEY ControllerKey; + PCONFIGURATION_COMPONENT_DATA ControllerKey; USHORT VesaVersion; FldrCreateComponentKey(BusKey, @@ -1859,10 +1859,10 @@ DetectDisplayController(FRLDRHKEY BusKey) static VOID -DetectIsaBios(FRLDRHKEY SystemKey, ULONG *BusNumber) +DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; - FRLDRHKEY BusKey; + PCONFIGURATION_COMPONENT_DATA BusKey; ULONG Size; /* Create new bus key */ @@ -1930,7 +1930,7 @@ DetectIsaBios(FRLDRHKEY SystemKey, ULONG *BusNumber) VOID PcHwDetect(VOID) { - FRLDRHKEY SystemKey; + PCONFIGURATION_COMPONENT_DATA SystemKey; ULONG BusNumber = 0; DbgPrint((DPRINT_HWDETECT, "DetectHardware()\n")); diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c b/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c index ff99e461ede..0fa26bd79b4 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hwacpi.c @@ -49,9 +49,9 @@ FindAcpiBios(VOID) VOID -DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber) +DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) { - FRLDRHKEY BiosKey; + PCONFIGURATION_COMPONENT_DATA BiosKey; if (FindAcpiBios()) { diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c b/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c index 208ec3144b4..c85884465a1 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hwapm.c @@ -54,9 +54,9 @@ FindApmBios(VOID) VOID -DetectApmBios(FRLDRHKEY SystemKey, ULONG *BusNumber) +DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) { - FRLDRHKEY BiosKey; + PCONFIGURATION_COMPONENT_DATA BiosKey; if (FindApmBios()) { diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c b/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c index c4e4add0e79..2cccfe51df1 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c @@ -140,12 +140,12 @@ FindPciBios(PCM_PCI_BUS_DATA BusData) static VOID -DetectPciIrqRoutingTable(FRLDRHKEY BusKey) +DetectPciIrqRoutingTable(PCONFIGURATION_COMPONENT_DATA BusKey) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor; PPCI_IRQ_ROUTING_TABLE Table; - FRLDRHKEY TableKey; + PCONFIGURATION_COMPONENT_DATA TableKey; ULONG Size; Table = GetPciIrqRoutingTable(); @@ -211,14 +211,14 @@ DetectPciIrqRoutingTable(FRLDRHKEY BusKey) VOID -DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber) +DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) { PCM_FULL_RESOURCE_DESCRIPTOR FullResourceDescriptor; CM_PCI_BUS_DATA BusData; - FRLDRHKEY BiosKey; + PCONFIGURATION_COMPONENT_DATA BiosKey; ULONG Size; #if 0 - FRLDRHKEY BusKey; + PCONFIGURATION_COMPONENT_DATA BusKey; ULONG i; WCHAR szPci[] = L"PCI"; #endif diff --git a/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h b/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h index 802954bb852..68d98bb3c4d 100644 --- a/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h +++ b/reactos/boot/freeldr/freeldr/include/arch/i386/hardware.h @@ -34,7 +34,7 @@ VOID NTAPI FldrSetComponentInformation( - IN FRLDRHKEY ComponentKey, + IN PCONFIGURATION_COMPONENT_DATA ComponentKey, IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity @@ -43,31 +43,31 @@ FldrSetComponentInformation( VOID NTAPI FldrSetIdentifier( - IN FRLDRHKEY ComponentKey, + IN PCONFIGURATION_COMPONENT_DATA ComponentKey, IN PWCHAR Identifier ); VOID NTAPI FldrCreateSystemKey( - OUT FRLDRHKEY *SystemKey + OUT PCONFIGURATION_COMPONENT_DATA *SystemKey ); VOID NTAPI FldrCreateComponentKey( - IN FRLDRHKEY SystemKey, + IN PCONFIGURATION_COMPONENT_DATA SystemKey, IN PWCHAR BusName, IN ULONG BusNumber, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, - OUT FRLDRHKEY *ComponentKey + OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey ); VOID NTAPI FldrSetConfigurationData( - IN FRLDRHKEY ComponentKey, + IN PCONFIGURATION_COMPONENT_DATA ComponentKey, IN PVOID ConfigurationData, IN ULONG Size ); @@ -82,16 +82,13 @@ VOID StallExecutionProcessor(ULONG Microseconds); VOID HalpCalibrateStallExecution(VOID); /* hwacpi.c */ -VOID DetectAcpiBios(FRLDRHKEY SystemKey, ULONG *BusNumber); +VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber); /* hwapm.c */ -VOID DetectApmBios(FRLDRHKEY SystemKey, ULONG *BusNumber); - -/* hwcpu.c */ -VOID DetectCPUs(FRLDRHKEY SystemKey); +VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber); /* hwpci.c */ -VOID DetectPciBios(FRLDRHKEY SystemKey, ULONG *BusNumber); +VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber); /* i386cpu.S */ ULONG CpuidSupported(VOID); diff --git a/reactos/boot/freeldr/freeldr/reactos/archwsup.c b/reactos/boot/freeldr/freeldr/reactos/archwsup.c index b27af225767..385880d1207 100644 --- a/reactos/boot/freeldr/freeldr/reactos/archwsup.c +++ b/reactos/boot/freeldr/freeldr/reactos/archwsup.c @@ -15,87 +15,28 @@ /* GLOBALS ********************************************************************/ PCONFIGURATION_COMPONENT_DATA FldrArcHwTreeRoot; -ULONG FldrBusTypeCount[MaximumType + 1] = {0}; -const PWCHAR FldrBusTypeString[MaximumType + 1] = -{ - L"System", - L"CentralProcessor", - L"FloatingPointProcessor", - L"PrimaryICache", - L"PrimaryDCache", - L"SecondaryICache", - L"SecondaryDCache", - L"SecondaryCache", - L"EisaAdapter", - L"TcAdapter", - L"ScsiAdapter", - L"DtiAdapter", - L"MultifunctionAdapter", - L"DiskController", - L"TapeController", - L"CdRomController", - L"WormController", - L"SerialController", - L"NetworkController", - L"DisplayController", - L"ParallelController", - L"PointerController", - L"KeyboardController", - L"AudioController", - L"OtherController", - L"DiskPeripheral", - L"FloppyDiskPeripheral", - L"TapePeripheral", - L"ModemPeripheral", - L"MonitorPeripheral", - L"PrinterPeripheral", - L"PointerPeripheral", - L"KeyboardPeripheral", - L"TerminalPeripheral", - L"OtherPeripheral", - L"LinePeripheral", - L"NetworkPeripheral", - L"SystemMemory", - L"DockingInformation", - L"RealModeIrqRoutingTable", - L"RealModePCIEnumeration", - L"Undefined" -}; -const PWCHAR FldrClassString[MaximumClass + 1] = -{ - L"System", - L"Processor", - L"Cache", - L"Adapter", - L"Controller", - L"Peripheral", - L"MemoryClass", - L"Undefined" -}; /* FUNCTIONS ******************************************************************/ VOID NTAPI -FldrSetComponentInformation(IN FRLDRHKEY ComponentKey, +FldrSetComponentInformation(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN IDENTIFIER_FLAG Flags, IN ULONG Key, IN ULONG Affinity) { LONG Error; - CONFIGURATION_COMPONENT_DATA Data = {0}; // This would be "ComponentKey" - PCONFIGURATION_COMPONENT_DATA ComponentData = &Data; PCONFIGURATION_COMPONENT Component = &ComponentData->ComponentEntry; - + /* Set component information */ Component->Flags = Flags; Component->Version = 0; Component->Revision = 0; - Component->Key = Key; + //Component->Key = Key; // HACK: We store the registry key here Component->AffinityMask = Affinity; /* Set the value */ - Error = RegSetValue(ComponentKey, + Error = RegSetValue((FRLDRHKEY)Component->Key, L"Component Information", REG_BINARY, (PVOID)&Component->Flags, @@ -109,13 +50,11 @@ FldrSetComponentInformation(IN FRLDRHKEY ComponentKey, VOID NTAPI -FldrSetIdentifier(IN FRLDRHKEY ComponentKey, +FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN PWCHAR Identifier) { LONG Error; ULONG IdentifierLength = (wcslen(Identifier) + 1) * sizeof(WCHAR); - CONFIGURATION_COMPONENT_DATA Data = {0}; // This would be "ComponentKey" - PCONFIGURATION_COMPONENT_DATA ComponentData = &Data; PCONFIGURATION_COMPONENT Component = &ComponentData->ComponentEntry; /* Set component information */ @@ -123,7 +62,7 @@ FldrSetIdentifier(IN FRLDRHKEY ComponentKey, Component->Identifier = (PCHAR)Identifier; // We need to use ASCII instead /* Set the key */ - Error = RegSetValue(ComponentKey, + Error = RegSetValue((FRLDRHKEY)Component->Key, L"Identifier", REG_SZ, (PCHAR)Identifier, @@ -137,7 +76,7 @@ FldrSetIdentifier(IN FRLDRHKEY ComponentKey, VOID NTAPI -FldrCreateSystemKey(OUT FRLDRHKEY *SystemKey) +FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode) { LONG Error; PCONFIGURATION_COMPONENT Component; @@ -157,10 +96,13 @@ FldrCreateSystemKey(OUT FRLDRHKEY *SystemKey) Component->Identifier = 0; Component->IdentifierLength = 0; + /* Return the node */ + *SystemNode = FldrArcHwTreeRoot; + /* Create the key */ Error = RegCreateKey(NULL, L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System", - SystemKey); + (FRLDRHKEY*)&Component->Key); if (Error != ERROR_SUCCESS) { DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n", Error)); @@ -170,20 +112,18 @@ FldrCreateSystemKey(OUT FRLDRHKEY *SystemKey) VOID NTAPI -FldrCreateComponentKey(IN FRLDRHKEY SystemKey, +FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, IN PWCHAR BusName, IN ULONG BusNumber, IN CONFIGURATION_CLASS Class, IN CONFIGURATION_TYPE Type, - OUT FRLDRHKEY *ComponentKey) + OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey) { LONG Error; WCHAR Buffer[80]; - CONFIGURATION_COMPONENT_DATA Root = {0}; // This would be "SystemKey" - PCONFIGURATION_COMPONENT_DATA SystemNode = &Root; PCONFIGURATION_COMPONENT_DATA ComponentData; PCONFIGURATION_COMPONENT Component; - + /* Allocate the node for this component */ ComponentData = MmAllocateMemory(sizeof(CONFIGURATION_COMPONENT_DATA)); if (!ComponentData) return; @@ -203,18 +143,21 @@ FldrCreateComponentKey(IN FRLDRHKEY SystemKey, SystemNode->Child = ComponentData; } - /* Set us up (need to use class/type instead of name/number) */ - Component = &FldrArcHwTreeRoot->ComponentEntry; + /* Set us up */ + Component = &ComponentData->ComponentEntry; Component->Class = Class; Component->Type = Type; - /* FIXME: Use Class/Type to build key name */ - + /* Return the child */ + *ComponentKey = ComponentData; + /* Build the key name */ swprintf(Buffer, L"%s\\%u", BusName, BusNumber); /* Create the key */ - Error = RegCreateKey(SystemKey, Buffer, ComponentKey); + Error = RegCreateKey((FRLDRHKEY)SystemNode->ComponentEntry.Key, + Buffer, + (FRLDRHKEY*)&Component->Key); if (Error != ERROR_SUCCESS) { DbgPrint((DPRINT_HWDETECT, "RegCreateKey() failed (Error %u)\n", Error)); @@ -224,13 +167,11 @@ FldrCreateComponentKey(IN FRLDRHKEY SystemKey, VOID NTAPI -FldrSetConfigurationData(IN FRLDRHKEY ComponentKey, +FldrSetConfigurationData(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN PVOID ConfigurationData, IN ULONG Size) { LONG Error; - CONFIGURATION_COMPONENT_DATA Data = {0}; // This would be "ComponentKey" - PCONFIGURATION_COMPONENT_DATA ComponentData = &Data; PCONFIGURATION_COMPONENT Component = &ComponentData->ComponentEntry; /* Set component information */ @@ -238,7 +179,7 @@ FldrSetConfigurationData(IN FRLDRHKEY ComponentKey, Component->ConfigurationDataLength = Size; /* Set 'Configuration Data' value */ - Error = RegSetValue(ComponentKey, + Error = RegSetValue((FRLDRHKEY)Component->Key, L"Configuration Data", REG_FULL_RESOURCE_DESCRIPTOR, ConfigurationData,