/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL - See COPYING in the top level directory
- * FILE: ntoskrnl/config/i386/cmhardwr.c
+ * FILE: ntoskrnl/config/powerpc/cmhardwr.c
* PURPOSE: Configuration Manager - Hardware-Specific Code
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
*/
}
}
- /* Add slashes were we previously had NULLs */
+ /* Add slashes where we previously had NULLs */
CurrentDate[4] = CurrentDate[7] = '/';
/* Check which date is newer */
PCHAR PartialString = NULL, BiosVersion;
CHAR CpuString[48];
PVOID BaseAddress = NULL;
- LARGE_INTEGER ViewBase = {{0}};
+ LARGE_INTEGER ViewBase = {{0, 0}};
ULONG_PTR VideoRomBase;
PCHAR CurrentVersion;
extern UNICODE_STRING KeRosProcessorName, KeRosBiosDate, KeRosBiosVersion;
NULL,
NULL);
Status = NtOpenKey(&SystemHandle, KEY_READ | KEY_WRITE, &ObjectAttributes);
- if (!NT_SUCCESS(Status)) return Status;
+ if (!NT_SUCCESS(Status))
+ return Status;
/* Create the BIOS Information key */
RtlInitUnicodeString(&KeyName,
NULL,
REG_OPTION_NON_VOLATILE,
&Disposition);
- if (ExpInTextModeSetup)
+ if (!NT_SUCCESS(Status))
{
- if (!NT_SUCCESS(Status))
- BiosHandle = NULL;
- }
- else if (!NT_SUCCESS(Status))
+ NtClose(SystemHandle);
return Status;
+ }
/* Create the CPU Key, and check if it already existed */
RtlInitUnicodeString(&KeyName, L"CentralProcessor");
CmpConfigurationData = ExAllocatePoolWithTag(PagedPool,
CmpConfigurationAreaSize,
TAG_CM);
- if (!CmpConfigurationData) return STATUS_INSUFFICIENT_RESOURCES;
+ if (!CmpConfigurationData)
+ {
+ // FIXME: Cleanup stuff!!
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
/* Loop all CPUs */
for (i = 0; i < KeNumberProcessors; i++)
Prcb = KiProcessorBlock[i];
/* Setup the Configuration Entry for the Processor */
- RtlZeroMemory(&ConfigData, sizeof (ConfigData));
+ RtlZeroMemory(&ConfigData, sizeof(ConfigData));
ConfigData.ComponentEntry.Class = ProcessorClass;
ConfigData.ComponentEntry.Type = CentralProcessor;
ConfigData.ComponentEntry.Key = i;
InterfaceTypeUndefined,
0xFFFFFFFF,
IndexTable);
- if (!NT_SUCCESS(Status)) return(Status);
+ if (!NT_SUCCESS(Status))
+ {
+ NtClose(BiosHandle);
+ NtClose(SystemHandle);
+ return Status;
+ }
{
/* Setup the Configuration Entry for the FPU */
IndexTable);
if (!NT_SUCCESS(Status))
{
- /* Failed, close the CPU handle and return */
+ /* We failed, close all the opened handles and return */
NtClose(KeyHandle);
+ NtClose(BiosHandle);
+ NtClose(SystemHandle);
return Status;
}
//Ki386Cpuid(0x80000000, &ExtendedId, &Dummy, &Dummy, &Dummy);
if (ExtendedId >= 0x80000004)
{
- /* Do all the CPUIDs requred to get the full name */
+ /* Do all the CPUIDs required to get the full name */
PartialString = CpuString;
for (ExtendedId = 2; ExtendedId <= 4; ExtendedId++)
{
Status = ZwOpenSection(&SectionHandle,
SECTION_ALL_ACCESS,
&ObjectAttributes);
- if (!NT_SUCCESS(Status)) goto Quickie;
+ if (!NT_SUCCESS(Status))
+ {
+ /* We failed, close all the opened handles and return */
+ // NtClose(KeyHandle);
+ NtClose(BiosHandle);
+ NtClose(SystemHandle);
+ /* 'Quickie' closes KeyHandle */
+ goto Quickie;
+ }
/* Map the first 1KB of memory to get the IVT */
ViewSize = PAGE_SIZE;
if (BiosVersion) ExFreePoolWithTag(BiosVersion, TAG_CM);
Quickie:
- /* Close the procesor handle */
+ /* Close the processor handle */
NtClose(KeyHandle);
return STATUS_SUCCESS;
}