Replace all occurrences of NULL with NULLPTR for unified C and C++ null pointer handling
Some checks failed
Builds / ExectOS (amd64, release) (push) Failing after 24s
Builds / ExectOS (amd64, debug) (push) Successful in 27s
Builds / ExectOS (i686, debug) (push) Successful in 27s
Builds / ExectOS (i686, release) (push) Failing after 25s

This commit is contained in:
2025-09-16 15:59:56 +02:00
parent ba9e5b1b88
commit fabf3a3a5e
46 changed files with 294 additions and 288 deletions

View File

@@ -296,7 +296,7 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
}
/* Add new memory mapping */
Status = BlMapVirtualMemory(PageMap, NULL, (PVOID)(UINT_PTR)Address, 1, LoaderMemoryData);
Status = BlMapVirtualMemory(PageMap, NULLPTR, (PVOID)(UINT_PTR)Address, 1, LoaderMemoryData);
if(Status != STATUS_EFI_SUCCESS)
{
/* Memory mapping failure */

View File

@@ -357,7 +357,7 @@ BlpGetNextPageTable(IN PXTBL_PAGE_MAPPING PageMap,
}
/* Add new memory mapping */
Status = BlMapVirtualMemory(PageMap, NULL, (PVOID)(UINT_PTR)Address, 1, LoaderMemoryData);
Status = BlMapVirtualMemory(PageMap, NULLPTR, (PVOID)(UINT_PTR)Address, 1, LoaderMemoryData);
if(Status != STATUS_EFI_SUCCESS)
{
/* Memory mapping failure */

View File

@@ -31,7 +31,7 @@ BlGetBooleanParameter(IN CONST PWCHAR Parameters,
SIZE_T NeedleLength, TokenLength;
/* Validate input data and ensure the option is not an empty string */
if(Parameters == NULL || Needle == NULL || *Needle == L'\0')
if(Parameters == NULLPTR || Needle == NULLPTR || *Needle == L'\0')
{
/* One of the parameters was invalid */
return FALSE;

View File

@@ -38,7 +38,7 @@ BlGetBootOptionValue(IN PLIST_ENTRY Options,
EFI_STATUS Status;
/* Assume the option will not be found */
*OptionValue = NULL;
*OptionValue = NULLPTR;
/* Get the length of the option name we are looking for */
KeyLength = RtlWideStringLength(OptionName, 0);
@@ -62,7 +62,7 @@ BlGetBootOptionValue(IN PLIST_ENTRY Options,
{
/* Memory allocation failure, print debug message and return status code */
BlDebugPrint(L"ERROR: Memory allocation failure (Status Code: 0x%zX)\n", Status);
*OptionValue = NULL;
*OptionValue = NULLPTR;
return Status;
}
@@ -121,7 +121,7 @@ BlGetConfigBooleanValue(IN CONST PWCHAR ConfigName)
* @param ConfigName
* Specifies the configuration key to return its value.
*
* @return This routine returns a pointer to the configuration value, or NULL if key was not found.
* @return This routine returns a pointer to the configuration value, or NULLPTR if key was not found.
*
* @since XT 1.0
*/
@@ -137,7 +137,7 @@ BlGetConfigValue(IN CONST PWCHAR ConfigName,
PWCHAR Value;
/* Assume the option will not be found */
*ConfigValue = NULL;
*ConfigValue = NULLPTR;
/* Get config entry name length */
KeyLength = RtlWideStringLength(ConfigName, 0);
@@ -159,7 +159,7 @@ BlGetConfigValue(IN CONST PWCHAR ConfigName,
Status = BlAllocateMemoryPool((ValueLength + 1) * sizeof(WCHAR), (PVOID *)&Value);
if(Status != STATUS_EFI_SUCCESS)
{
/* Memory allocation failure, return NULL */
/* Memory allocation failure, return NULLPTR */
BlDebugPrint(L"ERROR: Memory allocation failure (Status Code: 0x%zX)\n", Status);
return Status;
}
@@ -175,7 +175,7 @@ BlGetConfigValue(IN CONST PWCHAR ConfigName,
ConfigListEntry = ConfigListEntry->Flink;
}
/* Config entry not found, return NULL */
/* Config entry not found, return NULLPTR */
return STATUS_EFI_NOT_FOUND;
}
@@ -504,7 +504,7 @@ BlpParseCommandLine(VOID)
Argument = RtlTokenizeWideString(LoadedImage->LoadOptions, L" ", &LastArg);
/* Iterate over all arguments passed to boot loader */
while(Argument != NULL)
while(Argument != NULLPTR)
{
/* Store key name */
Key = Argument;
@@ -573,7 +573,7 @@ BlpParseCommandLine(VOID)
RtlInsertTailList(&Config, &Option->Flink);
/* Take next argument */
Argument = RtlTokenizeWideString(NULL, L" ", &LastArg);
Argument = RtlTokenizeWideString(NULLPTR, L" ", &LastArg);
}
/* Update global configuration */
@@ -611,11 +611,11 @@ BlpParseConfigFile(IN CONST PCHAR RawConfig,
/* Initialize pointers */
InputData = RawConfig;
Section = NULL;
Option = NULL;
SectionName = NULL;
Key = NULL;
Value = NULL;
Section = NULLPTR;
Option = NULLPTR;
SectionName = NULLPTR;
Key = NULLPTR;
Value = NULLPTR;
/* Analyze configuration data until end of file is reached */
while(*InputData != '\0')
@@ -812,7 +812,7 @@ BlpReadConfigFile(IN CONST PWCHAR ConfigDirectory,
SIZE_T FileSize;
/* Open EFI volume */
Status = BlOpenVolume(NULL, &DiskHandle, &FsHandle);
Status = BlOpenVolume(NULLPTR, &DiskHandle, &FsHandle);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to open a volume */
@@ -872,7 +872,7 @@ BlpUpdateConfiguration(IN PLIST_ENTRY NewConfig)
/* Make sure config entry does not exist yet */
BlGetConfigValue(ConfigEntry->Name, &ConfigValue);
if(ConfigValue == NULL)
if(ConfigValue == NULLPTR)
{
/* Remove new config entry from input list and put it into global config list */
RtlRemoveEntryList(&ConfigEntry->Flink);

View File

@@ -111,7 +111,7 @@ BlpInitializeDebugConsole()
DebugPort = RtlTokenizeWideString(DebugConfiguration, L";", &LastPort);
/* Iterate over all debug ports */
while(DebugPort != NULL)
while(DebugPort != NULLPTR)
{
/* Check what port is set for debugging */
if(RtlCompareWideStringInsensitive(DebugPort, L"COM", 3) == 0)
@@ -183,7 +183,7 @@ BlpInitializeDebugConsole()
}
/* Take next debug port */
DebugPort = RtlTokenizeWideString(NULL, L";", &LastPort);
DebugPort = RtlTokenizeWideString(NULLPTR, L";", &LastPort);
}
/* Check if serial debug port is enabled */

View File

@@ -144,7 +144,7 @@ BlGetConfigurationTable(IN PEFI_GUID TableGuid,
}
/* Table not found */
*Table = NULL;
*Table = NULLPTR;
return STATUS_EFI_NOT_FOUND;
}
@@ -184,7 +184,7 @@ BlGetEfiVariable(IN PEFI_GUID Vendor,
}
/* Attempt to get variable value */
Status = EfiSystemTable->RuntimeServices->GetVariable(VariableName, Vendor, NULL, &Size, Buffer);
Status = EfiSystemTable->RuntimeServices->GetVariable(VariableName, Vendor, NULLPTR, &Size, Buffer);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to get variable, probably not found such one */
@@ -239,12 +239,12 @@ BlGetSecureBootStatus()
Size = sizeof(VarValue);
if(EfiSystemTable->RuntimeServices->GetVariable(L"SecureBoot", &VarGuid,
NULL, &Size, &VarValue) == STATUS_EFI_SUCCESS)
NULLPTR, &Size, &VarValue) == STATUS_EFI_SUCCESS)
{
SecureBootStatus = (INT_PTR)VarValue;
if((EfiSystemTable->RuntimeServices->GetVariable(L"SetupMode", &VarGuid,
NULL, &Size, &VarValue) == STATUS_EFI_SUCCESS) && VarValue != 0)
NULLPTR, &Size, &VarValue) == STATUS_EFI_SUCCESS) && VarValue != 0)
{
SecureBootStatus = -1;
}
@@ -274,11 +274,11 @@ BlInitializeEntropy(PULONGLONG RNGBuffer)
ULONGLONG Seed;
/* Initialize variables */
Rng = NULL;
Rng = NULLPTR;
Seed = 0;
/* Locate RNG protocol */
Status = EfiSystemTable->BootServices->LocateProtocol(&RngGuid, NULL, (PVOID *)&Rng);
Status = EfiSystemTable->BootServices->LocateProtocol(&RngGuid, NULLPTR, (PVOID *)&Rng);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to locate RNG protocol, return status code */
@@ -286,7 +286,7 @@ BlInitializeEntropy(PULONGLONG RNGBuffer)
}
/* Get RNG value using the default algorithm */
Status = Rng->GetRNG(Rng, NULL, 8, (PUCHAR)&Seed);
Status = Rng->GetRNG(Rng, NULLPTR, 8, (PUCHAR)&Seed);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to get RNG value, return status code */
@@ -340,7 +340,7 @@ EFI_STATUS
BlRebootSystem()
{
/* Reboot machine */
return EfiSystemTable->RuntimeServices->ResetSystem(EfiResetCold, STATUS_EFI_SUCCESS, 0, NULL);
return EfiSystemTable->RuntimeServices->ResetSystem(EfiResetCold, STATUS_EFI_SUCCESS, 0, NULLPTR);
}
/**
@@ -388,7 +388,7 @@ EFI_STATUS
BlShutdownSystem()
{
/* Shutdown machine */
return EfiSystemTable->RuntimeServices->ResetSystem(EfiResetShutdown, STATUS_EFI_SUCCESS, 0, NULL);
return EfiSystemTable->RuntimeServices->ResetSystem(EfiResetShutdown, STATUS_EFI_SUCCESS, 0, NULLPTR);
}
/**
@@ -422,7 +422,7 @@ XTCDECL
EFI_STATUS
BlStartEfiImage(IN EFI_HANDLE ImageHandle)
{
return EfiSystemTable->BootServices->StartImage(ImageHandle, NULL, NULL);
return EfiSystemTable->BootServices->StartImage(ImageHandle, NULLPTR, NULLPTR);
}
/**

View File

@@ -25,7 +25,7 @@ LIST_ENTRY BlpConfigSections;
PWCHAR BlpEditableConfigOptions[] = {
L"BootModules", L"SystemType", L"SystemPath",
L"KernelFile", L"InitrdFile", L"HalFile",
L"Parameters", NULL
L"Parameters", NULLPTR
};
/* XT Boot Loader protocol */
@@ -35,7 +35,7 @@ XTBL_LOADER_PROTOCOL BlpLdrProtocol;
LIST_ENTRY BlpLoadedModules;
/* XT Boot Loader menu list */
PLIST_ENTRY BlpMenuList = NULL;
PLIST_ENTRY BlpMenuList = NULLPTR;
/* XT Boot Loader status data */
XTBL_STATUS BlpStatus = {0};

View File

@@ -24,7 +24,7 @@ BlpActivateSerialIOController()
PEFI_PCI_ROOT_BRIDGE_IO_PROTOCOL PciDev;
USHORT Bus, Device, Function, Command;
UINT_PTR Index, PciHandleSize;
PEFI_HANDLE PciHandle = NULL;
PEFI_HANDLE PciHandle = NULLPTR;
PCI_COMMON_HEADER PciHeader;
EFI_STATUS Status;
ULONGLONG Address;
@@ -39,7 +39,7 @@ BlpActivateSerialIOController()
}
/* Get all instances of PciRootBridgeIo */
Status = EfiSystemTable->BootServices->LocateHandle(ByProtocol, &PciGuid, NULL, &PciHandleSize, PciHandle);
Status = EfiSystemTable->BootServices->LocateHandle(ByProtocol, &PciGuid, NULLPTR, &PciHandleSize, PciHandle);
if(Status == STATUS_EFI_BUFFER_TOO_SMALL)
{
/* Reallocate more memory as requested by UEFI */
@@ -52,7 +52,7 @@ BlpActivateSerialIOController()
}
/* Second attempt to get instances of PciRootBridgeIo */
Status = EfiSystemTable->BootServices->LocateHandle(ByProtocol, &PciGuid, NULL, &PciHandleSize, PciHandle);
Status = EfiSystemTable->BootServices->LocateHandle(ByProtocol, &PciGuid, NULLPTR, &PciHandleSize, PciHandle);
}
/* Make sure successfully obtained PciRootBridgeIo instances */

View File

@@ -32,13 +32,13 @@ BlGetXtLdrProtocol(IN PEFI_SYSTEM_TABLE SystemTable,
OUT PXTBL_LOADER_PROTOCOL *ProtocolHandler)
{
EFI_GUID ProtocolGuid = XT_BOOT_LOADER_PROTOCOL_GUID;
PEFI_HANDLE Handles = NULL;
PEFI_HANDLE Handles = NULLPTR;
EFI_STATUS Status;
UINT_PTR Count;
UINT Index;
/* Try to locate the handles */
Status = SystemTable->BootServices->LocateHandleBuffer(ByProtocol, &ProtocolGuid, NULL, &Count, &Handles);
Status = SystemTable->BootServices->LocateHandleBuffer(ByProtocol, &ProtocolGuid, NULLPTR, &Count, &Handles);
if(Status != STATUS_EFI_SUCCESS)
{
/* Unable to get handles */
@@ -53,7 +53,7 @@ BlGetXtLdrProtocol(IN PEFI_SYSTEM_TABLE SystemTable,
{
/* Try to open protocol */
Status = SystemTable->BootServices->OpenProtocol(Handles[Index], &ProtocolGuid,
(PVOID*)ProtocolHandler, ImageHandle, NULL,
(PVOID*)ProtocolHandler, ImageHandle, NULLPTR,
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
/* Check if successfully opened the loader protocol */
@@ -69,7 +69,7 @@ BlGetXtLdrProtocol(IN PEFI_SYSTEM_TABLE SystemTable,
SystemTable->BootServices->FreePool(Handles);
/* Make sure the loaded protocol has been found */
if(*ProtocolHandler == NULL)
if(*ProtocolHandler == NULLPTR)
{
/* Protocol not found */
return STATUS_EFI_NOT_FOUND;

View File

@@ -130,12 +130,12 @@ BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap)
{
EFI_STATUS Status;
if(MemoryMap == NULL)
if(MemoryMap == NULLPTR)
{
return STATUS_EFI_INVALID_PARAMETER;
}
MemoryMap->Map = NULL;
MemoryMap->Map = NULLPTR;
MemoryMap->MapSize = 0;
/* Get memory map */
@@ -167,7 +167,7 @@ BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap)
while(Status == STATUS_EFI_BUFFER_TOO_SMALL);
/* Make sure memory map is set */
if(MemoryMap->Map == NULL)
if(MemoryMap->Map == NULLPTR)
{
/* Something went wrong */
return STATUS_EFI_NO_MAPPING;
@@ -290,7 +290,7 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
VirtualAddress = *MemoryMapAddress;
/* Check if custom memory type routine is specified */
if(GetMemoryTypeRoutine == NULL)
if(GetMemoryTypeRoutine == NULLPTR)
{
/* Use default memory type routine */
GetMemoryTypeRoutine = BlpGetLoaderMemoryType;
@@ -367,7 +367,7 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
else
{
/* Map all other memory as loader free */
Status = BlMapVirtualMemory(PageMap, NULL, (PVOID)Descriptor->PhysicalStart,
Status = BlMapVirtualMemory(PageMap, NULLPTR, (PVOID)Descriptor->PhysicalStart,
Descriptor->NumberOfPages, LoaderFree);
}
@@ -384,7 +384,7 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
}
/* Always map first page */
Status = BlMapVirtualMemory(PageMap, NULL, (PVOID)0, 1, LoaderFirmwarePermanent);
Status = BlMapVirtualMemory(PageMap, NULLPTR, (PVOID)0, 1, LoaderFirmwarePermanent);
if(Status != STATUS_EFI_SUCCESS)
{
/* Mapping failed */
@@ -392,7 +392,7 @@ BlMapEfiMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
}
/* Map BIOS ROM and VRAM */
Status = BlMapVirtualMemory(PageMap, NULL, (PVOID)0xA0000, 0x60, LoaderFirmwarePermanent);
Status = BlMapVirtualMemory(PageMap, NULLPTR, (PVOID)0xA0000, 0x60, LoaderFirmwarePermanent);
if(Status != STATUS_EFI_SUCCESS)
{
/* Mapping failed */
@@ -500,7 +500,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
/* Set mapping fields and insert it on the top */
Mapping3->PhysicalAddress = (PUCHAR)PhysicalAddressEnd + 1;
Mapping3->VirtualAddress = NULL;
Mapping3->VirtualAddress = NULLPTR;
Mapping3->NumberOfPages = NumberOfMappedPages;
Mapping3->MemoryType = Mapping2->MemoryType;
RtlInsertHeadList(&Mapping2->ListEntry, &Mapping3->ListEntry);
@@ -536,7 +536,7 @@ BlMapVirtualMemory(IN OUT PXTBL_PAGE_MAPPING PageMap,
/* Set mapping fields and insert it on the top */
Mapping3->PhysicalAddress = Mapping1->PhysicalAddress;
Mapping3->VirtualAddress = NULL;
Mapping3->VirtualAddress = NULLPTR;
Mapping3->NumberOfPages = NumberOfMappedPages;
Mapping3->MemoryType = Mapping2->MemoryType;
RtlInsertHeadList(&Mapping2->ListEntry, &Mapping3->ListEntry);

View File

@@ -61,7 +61,7 @@ AcGetAcpiDescriptionPointer(OUT PVOID *AcpiTable)
* Supplies a pointer to the table to start searching from.
*
* @param AcpiTable
* Supplies a pointer to memory area where ACPI table address will be stored, or NULL if not found.
* Supplies a pointer to memory area where ACPI table address will be stored, or NULLPTR if not found.
*
* @return This routine returns a status code.
*
@@ -81,8 +81,8 @@ AcGetAcpiTable(IN CONST UINT Signature,
PACPI_RSDT Rsdt;
BOOLEAN Xsdp;
/* Return NULL address by default if requested table not found */
*AcpiTable = NULL;
/* Return NULLPTR by default if requested table not found */
*AcpiTable = NULLPTR;
/* Get Root System Description Table Pointer */
Status = AcGetAcpiDescriptionPointer((PVOID)&Rsdp);
@@ -127,13 +127,13 @@ AcGetAcpiTable(IN CONST UINT Signature,
}
/* Check if previous table provided */
if(PreviousTable != NULL)
if(PreviousTable != NULLPTR)
{
/* Check if this is a table previously found */
if(TableHeader == (PVOID)PreviousTable)
{
/* Unset previous table */
PreviousTable = NULL;
PreviousTable = NULLPTR;
}
/* Skip to next ACPI table */
@@ -231,7 +231,7 @@ AcGetRsdpTable(OUT PVOID *AcpiTable)
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(RsdpTable, 20))
{
/* RSDP not found or checksum mismatch */
*AcpiTable = NULL;
*AcpiTable = NULLPTR;
return STATUS_EFI_NOT_FOUND;
}
@@ -263,7 +263,7 @@ AcGetSMBiosTable(OUT PVOID *SmBiosTable)
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(SmBios, SmBios->Length))
{
/* SMBIOS not found or checksum mismatch */
*SmBiosTable = NULL;
*SmBiosTable = NULLPTR;
return STATUS_EFI_NOT_FOUND;
}
@@ -295,7 +295,7 @@ AcGetSMBios3Table(OUT PVOID *SmBiosTable)
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(SmBios, SmBios->Length))
{
/* SMBIOS3 not found or checksum mismatch */
*SmBiosTable = NULL;
*SmBiosTable = NULLPTR;
return STATUS_EFI_NOT_FOUND;
}
@@ -327,7 +327,7 @@ AcGetXsdpTable(OUT PVOID *AcpiTable)
if(Status != STATUS_EFI_SUCCESS || !AcpValidateAcpiTable(XsdpTable, 36))
{
/* XSDP not found or checksum mismatch */
*AcpiTable = NULL;
*AcpiTable = NULLPTR;
return STATUS_EFI_NOT_FOUND;
}

View File

@@ -98,7 +98,7 @@ BpPlayTune(IN PWCHAR Arguments)
Argument = RtlTokenizeWideString(Arguments, L" ", &LastArgument);
/* Iterate over all arguments */
while(Argument != NULL)
while(Argument != NULLPTR)
{
/* Check if tempo, pitch and duration are set */
if(Tempo < 0)
@@ -137,7 +137,7 @@ BpPlayTune(IN PWCHAR Arguments)
}
/* Get next argument */
Argument = RtlTokenizeWideString(NULL, L" ", &LastArgument);
Argument = RtlTokenizeWideString(NULLPTR, L" ", &LastArgument);
}
/* Stop emitting beep tone */

View File

@@ -39,7 +39,7 @@ ChBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
PVOID LoaderData;
/* Check if image file is provided */
if(Parameters->KernelFile == NULL)
if(Parameters->KernelFile == NULLPTR)
{
/* No image filename provided, return error code */
XtLdrProtocol->Debug.Print(L"ERROR: No EFI image filename provided\n");

View File

@@ -185,7 +185,7 @@ FbInitializeDisplay()
}
/* Query current graphics mode */
QueryMode = FbpDisplayInfo.Driver.Gop->Mode == NULL ? 0 : FbpDisplayInfo.Driver.Gop->Mode->Mode;
QueryMode = FbpDisplayInfo.Driver.Gop->Mode == NULLPTR ? 0 : FbpDisplayInfo.Driver.Gop->Mode->Mode;
Status = FbpDisplayInfo.Driver.Gop->QueryMode(FbpDisplayInfo.Driver.Gop, QueryMode, &InfoSize, &GopModeInfo);
if(Status == STATUS_EFI_NOT_STARTED)
{
@@ -357,7 +357,7 @@ FbSetScreenResolution(IN UINT Width,
{
/* Get mode information */
Status = FbpDisplayInfo.Driver.Gop->QueryMode(FbpDisplayInfo.Driver.Gop, Mode, &Size, &ModeInfo);
if(Status == STATUS_EFI_SUCCESS && Size >= sizeof(*ModeInfo) && ModeInfo != NULL)
if(Status == STATUS_EFI_SUCCESS && Size >= sizeof(*ModeInfo) && ModeInfo != NULLPTR)
{
/* Check if match found */
if(ModeInfo->HorizontalResolution == Width && ModeInfo->VerticalResolution == Height)
@@ -441,7 +441,7 @@ FbpFindFramebufferAddress(OUT PEFI_PHYSICAL_ADDRESS Address)
/* Initialize variables */
FramebufAddressLength = 0;
Handles = NULL;
Handles = NULLPTR;
/* Locate EFI_PCI_IO_PROTOCOL handles */
Status = XtLdrProtocol->Protocol.LocateHandles(&Handles, &HandlesCount, &PciIoGuid);
@@ -488,7 +488,7 @@ FbpFindFramebufferAddress(OUT PEFI_PHYSICAL_ADDRESS Address)
for(UINT Bars = 0; Bars < 6; Bars++)
{
/* Get BAR attributes */
Status = IoProtocol->GetBarAttributes(IoProtocol, Bars, NULL, (VOID **)&BarInfo);
Status = IoProtocol->GetBarAttributes(IoProtocol, Bars, NULLPTR, (VOID **)&BarInfo);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to get BAR attributes, continue with next BAR */

View File

@@ -400,7 +400,7 @@ PeLoadImage(IN PEFI_FILE_HANDLE FileHandle,
}
/* Store file size and memory type, nullify data and free up memory */
ImageData->Data = NULL;
ImageData->Data = NULLPTR;
ImageData->FileSize = FileInfo->FileSize;
ImageData->MemoryType = MemoryType;
XtLdrProtocol->Memory.FreePool(FileInfo);

View File

@@ -260,7 +260,7 @@ XtBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
}
/* Check device path */
if(Parameters->DevicePath == NULL)
if(Parameters->DevicePath == NULLPTR)
{
/* No device path set */
XtLdrProtocol->Debug.Print(L"ERROR: No device path provided, unable to boot system\n");
@@ -268,7 +268,7 @@ XtBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
}
/* Check if system path is set */
if(Parameters->SystemPath != NULL)
if(Parameters->SystemPath != NULLPTR)
{
/* Make sure system path begins with backslash, the only separator supported by EFI */
if(Parameters->SystemPath[0] == '/')
@@ -300,7 +300,7 @@ XtBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
}
/* Check if kernel file is set */
if(Parameters->KernelFile == NULL)
if(Parameters->KernelFile == NULLPTR)
{
/* No kernel filename set, fallback to default */
XtLdrProtocol->Debug.Print(L"WARNING: No kernel file specified, falling back to defaults\n");
@@ -308,7 +308,7 @@ XtBootSystem(IN PXTBL_BOOT_PARAMETERS Parameters)
}
/* Check if provided any kernel boot arguments */
if(Parameters->Parameters == NULL)
if(Parameters->Parameters == NULLPTR)
{
/* No argument supplied */
Parameters->Parameters = L"";
@@ -382,7 +382,7 @@ XtpBootSequence(IN PEFI_FILE_HANDLE BootDir,
EFI_GUID FrameBufGuid = XT_FRAMEBUFFER_PROTOCOL_GUID;
PKERNEL_INITIALIZATION_BLOCK KernelParameters;
PXTBL_FRAMEBUFFER_PROTOCOL FrameBufProtocol;
PPECOFF_IMAGE_CONTEXT ImageContext = NULL;
PPECOFF_IMAGE_CONTEXT ImageContext = NULLPTR;
PEFI_LOADED_IMAGE_PROTOCOL ImageProtocol;
PVOID VirtualAddress, VirtualMemoryArea;
PXT_ENTRY_POINT KernelEntryPoint;
@@ -412,7 +412,7 @@ XtpBootSequence(IN PEFI_FILE_HANDLE BootDir,
/* Initialize virtual memory mappings */
XtLdrProtocol->Memory.InitializePageMap(&PageMap, XtpDeterminePagingLevel(Parameters->Parameters), Size4K);
Status = XtLdrProtocol->Memory.MapEfiMemory(&PageMap, &VirtualMemoryArea, NULL);
Status = XtLdrProtocol->Memory.MapEfiMemory(&PageMap, &VirtualMemoryArea, NULLPTR);
if(Status != STATUS_EFI_SUCCESS)
{
return Status;
@@ -582,7 +582,7 @@ XtpInitializeLoaderBlock(IN PXTBL_PAGE_MAPPING PageMap,
/* Set FirmwareInformation block properties */
LoaderBlock->FirmwareInformation.FirmwareType = SystemFirmwareEfi;
LoaderBlock->FirmwareInformation.EfiFirmware.EfiVersion = 0; //EfiSystemTable->Hdr.Revision;
LoaderBlock->FirmwareInformation.EfiFirmware.EfiRuntimeServices = NULL;
LoaderBlock->FirmwareInformation.EfiFirmware.EfiRuntimeServices = NULLPTR;
// }
// else
// {

View File

@@ -27,7 +27,7 @@ EFI_STATUS
BlCloseProtocol(IN PEFI_HANDLE Handle,
IN PEFI_GUID ProtocolGuid)
{
return EfiSystemTable->BootServices->CloseProtocol(Handle, ProtocolGuid, EfiImageHandle, NULL);
return EfiSystemTable->BootServices->CloseProtocol(Handle, ProtocolGuid, EfiImageHandle, NULLPTR);
}
/**
@@ -97,7 +97,7 @@ BlGetModulesList()
* Specifies a unique protocol GUID.
*
* @param Interface
* Supplies a pointer to the protocol interface, or NULL if there is no structure associated.
* Supplies a pointer to the protocol interface, or NULLPTR if there is no structure associated.
*
* @return This routine returns a status code.
*
@@ -108,7 +108,7 @@ EFI_STATUS
BlInstallProtocol(IN PVOID Interface,
IN PEFI_GUID Guid)
{
EFI_HANDLE Handle = NULL;
EFI_HANDLE Handle = NULLPTR;
/* Install protocol interface */
return EfiSystemTable->BootServices->InstallProtocolInterface(&Handle, Guid, EFI_NATIVE_INTERFACE, Interface);
@@ -171,7 +171,7 @@ BlLoadModule(IN PWCHAR ModuleName)
RtlConcatenateWideString(ModuleFileName, L".EFI", 0);
/* Open EFI volume */
Status = BlOpenVolume(NULL, &DiskHandle, &FsHandle);
Status = BlOpenVolume(NULLPTR, &DiskHandle, &FsHandle);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to open a volume */
@@ -264,7 +264,7 @@ BlLoadModule(IN PWCHAR ModuleName)
ModuleDependency = CONTAIN_RECORD(DepsListEntry, XTBL_MODULE_DEPS, Flink);
/* Make sure dependency list contains a valid module name */
if(ModuleDependency->ModuleName == NULL || ModuleDependency->ModuleName[0] == L'\0')
if(ModuleDependency->ModuleName == NULLPTR || ModuleDependency->ModuleName[0] == L'\0')
{
/* Invalid module name found, just skip this step */
break;
@@ -320,7 +320,7 @@ BlLoadModule(IN PWCHAR ModuleName)
/* Access module interface for further module type check */
Status = EfiSystemTable->BootServices->OpenProtocol(ModuleHandle, &LIPGuid, (PVOID *)&LoadedImage,
EfiImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
EfiImageHandle, NULLPTR, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to open LoadedImage protocol */
@@ -335,7 +335,7 @@ BlLoadModule(IN PWCHAR ModuleName)
BlDebugPrint(L"ERROR: Loaded module is not a boot system driver\n");
/* Close protocol and skip module */
EfiSystemTable->BootServices->CloseProtocol(LoadedImage, &LIPGuid, LoadedImage, NULL);
EfiSystemTable->BootServices->CloseProtocol(LoadedImage, &LIPGuid, LoadedImage, NULLPTR);
}
/* Save additional module information, not found in '.modinfo' section */
@@ -346,7 +346,7 @@ BlLoadModule(IN PWCHAR ModuleName)
ModuleInfo->UnloadModule = LoadedImage->Unload;
/* Close loaded image protocol */
EfiSystemTable->BootServices->CloseProtocol(LoadedImage, &LIPGuid, LoadedImage, NULL);
EfiSystemTable->BootServices->CloseProtocol(LoadedImage, &LIPGuid, LoadedImage, NULLPTR);
/* Start EFI image */
Status = BlStartEfiImage(ModuleHandle);
@@ -384,13 +384,13 @@ BlLoadModules(IN PWCHAR ModulesList)
/* Set default return value */
ReturnStatus = STATUS_EFI_SUCCESS;
if(ModulesList != NULL)
if(ModulesList != NULLPTR)
{
/* Tokenize provided list of modules */
Module = RtlTokenizeWideString(ModulesList, L" ", &LastModule);
/* Iterate over all arguments passed to boot loader */
while(Module != NULL)
while(Module != NULLPTR)
{
Status = BlLoadModule(Module);
if(Status != STATUS_EFI_SUCCESS)
@@ -401,7 +401,7 @@ BlLoadModules(IN PWCHAR ModulesList)
}
/* Take next module from the list */
Module = RtlTokenizeWideString(NULL, L" ", &LastModule);
Module = RtlTokenizeWideString(NULLPTR, L" ", &LastModule);
}
}
@@ -431,7 +431,7 @@ BlLocateProtocolHandles(OUT PEFI_HANDLE *Handles,
OUT PUINT_PTR Count,
IN PEFI_GUID ProtocolGuid)
{
return EfiSystemTable->BootServices->LocateHandleBuffer(ByProtocol, ProtocolGuid, NULL, Count, Handles);
return EfiSystemTable->BootServices->LocateHandleBuffer(ByProtocol, ProtocolGuid, NULLPTR, Count, Handles);
}
/**
@@ -456,7 +456,7 @@ BlOpenProtocol(OUT PEFI_HANDLE Handle,
OUT PVOID *ProtocolHandler,
IN PEFI_GUID ProtocolGuid)
{
PEFI_HANDLE Handles = NULL;
PEFI_HANDLE Handles = NULLPTR;
EFI_STATUS Status;
UINT_PTR Count;
UINT Index;
@@ -492,7 +492,7 @@ BlOpenProtocol(OUT PEFI_HANDLE Handle,
EfiSystemTable->BootServices->FreePool(Handles);
/* Make sure the loaded protocol has been found */
if(*ProtocolHandler == NULL)
if(*ProtocolHandler == NULLPTR)
{
/* Protocol not found */
return STATUS_EFI_NOT_FOUND;
@@ -525,7 +525,7 @@ BlOpenProtocolHandle(IN EFI_HANDLE Handle,
IN PEFI_GUID ProtocolGuid)
{
return EfiSystemTable->BootServices->OpenProtocol(Handle, ProtocolGuid, ProtocolHandler, EfiImageHandle,
NULL, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
NULLPTR, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
}
/**
@@ -689,7 +689,7 @@ BlpGetModuleInformation(IN PWCHAR SectionData,
{
/* Tokenize value to get module's single dependency */
Dependency = RtlTokenizeWideString(Strings[Index], L" ", &LastStr);
while(Dependency != NULL)
while(Dependency != NULLPTR)
{
/* Allocate memory for module dependency */
Status = BlAllocateMemoryPool(sizeof(XTBL_MODULE_DEPS), (PVOID*)&ModuleDependencies);
@@ -704,7 +704,7 @@ BlpGetModuleInformation(IN PWCHAR SectionData,
RtlInsertTailList(&ModuleInfo->Dependencies, &ModuleDependencies->Flink);
/* Get next dependency from single value if available */
Dependency = RtlTokenizeWideString(NULL, L" ", &LastStr);
Dependency = RtlTokenizeWideString(NULLPTR, L" ", &LastStr);
}
}
else if(RtlCompareWideString(Key, L"version", 7) == 0)
@@ -756,7 +756,7 @@ BlpGetModuleInfoStrings(IN PWCHAR SectionData,
if(!InfoStrings || !SectionSize)
{
/* Invalid input parameters */
*ModInfo = NULL;
*ModInfo = NULLPTR;
*InfoCount = 0;
return STATUS_EFI_INVALID_PARAMETER;
}
@@ -775,7 +775,7 @@ BlpGetModuleInfoStrings(IN PWCHAR SectionData,
if(DataSize < 1)
{
/* No strings found */
*ModInfo = NULL;
*ModInfo = NULLPTR;
*InfoCount = 0;
return STATUS_EFI_END_OF_FILE;
}
@@ -793,7 +793,7 @@ BlpGetModuleInfoStrings(IN PWCHAR SectionData,
{
Index++;
}
/* Skip all null terminators */
/* Skip all NULL terminators */
while(Index < DataSize && InfoStrings[Index] == L'\0')
{
Index++;
@@ -814,11 +814,11 @@ BlpGetModuleInfoStrings(IN PWCHAR SectionData,
/* Copy the raw string data */
RtlCopyMemory(String, InfoStrings, DataSize * sizeof(WCHAR));
/* Ensure the entire buffer is null-terminated for safety */
/* Ensure the entire buffer is NULL-terminated for safety */
String[DataSize] = L'\0';
/* Set the last element of the pointer array to NULL */
Array[Count] = NULL;
/* Set the last element of the pointer array to NULLPTR */
Array[Count] = NULLPTR;
/* Populate the array with pointers to the strings within the buffer */
Index = 0;
@@ -834,7 +834,7 @@ BlpGetModuleInfoStrings(IN PWCHAR SectionData,
Index++;
}
/* Skip all null terminators to find the beginning of the next string */
/* Skip all NULL terminators to find the beginning of the next string */
while(Index < DataSize && String[Index] == L'\0')
{
Index++;

View File

@@ -22,7 +22,7 @@ VOID
BlDisplayBootMenu()
{
XTBL_DIALOG_HANDLE Handle;
PXTBL_BOOTMENU_ITEM MenuEntries = NULL;
PXTBL_BOOTMENU_ITEM MenuEntries = NULLPTR;
ULONG Index;
ULONG HighligtedEntryId, OldHighligtedEntryId, NumberOfEntries, TopVisibleEntry, VisibleEntries;
BOOLEAN RedrawBootMenu, RedrawEntries;
@@ -61,7 +61,7 @@ BlDisplayBootMenu()
TimeOut = -1;
/* Check if timeout is specified */
if(TimeOutString != NULL)
if(TimeOutString != NULLPTR)
{
/* Convert timeout string to number */
TimeOut = 0;
@@ -122,7 +122,7 @@ BlDisplayBootMenu()
}
/* Create a timer event for controlling the timeout of the boot menu */
Status = EfiSystemTable->BootServices->CreateEvent(EFI_EVENT_TIMER, EFI_TPL_CALLBACK, NULL, NULL, &TimerEvent);
Status = EfiSystemTable->BootServices->CreateEvent(EFI_EVENT_TIMER, EFI_TPL_CALLBACK, NULLPTR, NULLPTR, &TimerEvent);
if(Status == STATUS_EFI_SUCCESS)
{
/* Setup new EFI timer */
@@ -444,7 +444,7 @@ BlDisplayEditMenu(IN PXTBL_BOOTMENU_ITEM MenuEntry)
(TopVisibleEntry + Index) == HighligtedOptionId);
/* Free allocated value string if needed */
if(Value != NULL)
if(Value != NULLPTR)
{
BlFreeMemoryPool(Value);
}
@@ -465,8 +465,8 @@ BlDisplayEditMenu(IN PXTBL_BOOTMENU_ITEM MenuEntry)
OptionName = EditableOptions[HighligtedOptionId];
BlGetBootOptionValue(MenuEntry->Options, OptionName, &OriginalValue);
/* If the original value is NULL, use an empty string for editing */
if(OriginalValue == NULL)
/* If the original value is NULLPTR, use an empty string for editing */
if(OriginalValue == NULLPTR)
{
ValueToEdit = L"";
}
@@ -488,7 +488,7 @@ BlDisplayEditMenu(IN PXTBL_BOOTMENU_ITEM MenuEntry)
}
/* Free the original value if it was allocated */
if(OriginalValue != NULL)
if(OriginalValue != NULLPTR)
{
BlFreeMemoryPool(OriginalValue);
}
@@ -519,7 +519,7 @@ BlDisplayEditMenu(IN PXTBL_BOOTMENU_ITEM MenuEntry)
BlpDrawEditMenuEntry(&Handle, EditableOptions[OldHighligtedOptionId], Value, OldHighligtedOptionId - TopVisibleEntry, FALSE);
/* Free allocated value string if needed */
if(Value != NULL)
if(Value != NULLPTR)
{
BlFreeMemoryPool(Value);
}
@@ -529,7 +529,7 @@ BlDisplayEditMenu(IN PXTBL_BOOTMENU_ITEM MenuEntry)
BlpDrawEditMenuEntry(&Handle, EditableOptions[HighligtedOptionId], Value, HighligtedOptionId - TopVisibleEntry, TRUE);
/* Free allocated value string if needed */
if(Value != NULL)
if(Value != NULLPTR)
{
BlFreeMemoryPool(Value);
}
@@ -558,7 +558,7 @@ BlDisplayEditMenu(IN PXTBL_BOOTMENU_ITEM MenuEntry)
BlpDrawEditMenuEntry(&Handle, EditableOptions[OldHighligtedOptionId], Value, OldHighligtedOptionId - TopVisibleEntry, FALSE);
/* Free allocated value string if needed */
if(Value != NULL)
if(Value != NULLPTR)
{
BlFreeMemoryPool(Value);
}
@@ -568,7 +568,7 @@ BlDisplayEditMenu(IN PXTBL_BOOTMENU_ITEM MenuEntry)
BlpDrawEditMenuEntry(&Handle, EditableOptions[HighligtedOptionId], Value, HighligtedOptionId - TopVisibleEntry, TRUE);
/* Free allocated value string if needed */
if(Value != NULL)
if(Value != NULLPTR)
{
BlFreeMemoryPool(Value);
}
@@ -864,7 +864,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
RtlMoveMemory(InputFieldBuffer + TextPosition, InputFieldBuffer + TextPosition + 1,
(InputFieldLength - TextPosition) * sizeof(WCHAR));
/* Decrement length and null terminate string */
/* Decrement length and NULL terminate string */
InputFieldLength--;
InputFieldBuffer[InputFieldLength] = L'\0';
}
@@ -882,7 +882,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
RtlMoveMemory(InputFieldBuffer + TextPosition - 1, InputFieldBuffer + TextPosition,
(InputFieldLength - TextPosition + 1) * sizeof(WCHAR));
/* Decrement length, position and null terminate string */
/* Decrement length, position and NULL terminate string */
TextPosition--;
InputFieldLength--;
InputFieldBuffer[InputFieldLength] = L'\0';
@@ -908,7 +908,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
(InputFieldLength - TextPosition) * sizeof(WCHAR));
InputFieldBuffer[TextPosition] = Key.UnicodeChar;
/* Increment length, position and null terminate string */
/* Increment length, position and NULL terminate string */
TextPosition++;
InputFieldLength++;
InputFieldBuffer[InputFieldLength] = L'\0';
@@ -1008,7 +1008,7 @@ BlUpdateProgressBar(IN PXTBL_DIALOG_HANDLE Handle,
IN UCHAR Percentage)
{
/* Check if message needs an update */
if(Message != NULL)
if(Message != NULLPTR)
{
/* Update a message on the dialog box */
BlpDrawDialogMessage(Handle, Message);
@@ -1185,7 +1185,7 @@ BlpDrawBootMenu(OUT PXTBL_DIALOG_HANDLE Handle)
}
/* Draw empty dialog box for boot menu */
BlpDrawDialogBox(Handle, NULL, NULL);
BlpDrawDialogBox(Handle, NULLPTR, NULLPTR);
/* Print help message below the boot menu */
BlSetCursorPosition(0, Handle->PosY + Handle->Height);
@@ -1305,7 +1305,7 @@ BlpDrawDialogBox(IN OUT PXTBL_DIALOG_HANDLE Handle,
BoxLine[0] = EFI_TEXT_BOX_DOWN_RIGHT;
/* Check if there is a caption for this dialog */
if(Caption != NULL)
if(Caption != NULLPTR)
{
/* Get caption length */
CaptionLength = RtlWideStringLength(Caption, 0);
@@ -1366,7 +1366,7 @@ BlpDrawDialogBox(IN OUT PXTBL_DIALOG_HANDLE Handle,
BoxLine[Handle->Width - 1] = EFI_TEXT_BOX_VERTICAL;
}
/* Add null terminator to the end of the line */
/* Add NULL terminator to the end of the line */
BoxLine[Handle->Width] = 0;
/* Write the line to the console */
@@ -1374,7 +1374,7 @@ BlpDrawDialogBox(IN OUT PXTBL_DIALOG_HANDLE Handle,
}
/* Make sure there is a caption to print */
if(Caption != NULL)
if(Caption != NULLPTR)
{
/* Write dialog box caption */
BlSetCursorPosition(Handle->PosX + 3, Handle->PosY);
@@ -1382,7 +1382,7 @@ BlpDrawDialogBox(IN OUT PXTBL_DIALOG_HANDLE Handle,
}
/* Make sure there is a message to print */
if(Message != NULL)
if(Message != NULLPTR)
{
/* Write a message on the dialog box */
BlpDrawDialogMessage(Handle, Message);
@@ -1514,7 +1514,7 @@ BlpDrawDialogInputField(IN PXTBL_DIALOG_HANDLE Handle,
InputField[Index] = InputFieldText[Index];
}
/* Add null terminator to the end of the line */
/* Add NULL terminator to the end of the line */
InputField[Handle->Width] = 0;
/* Write input field text */
@@ -1592,7 +1592,7 @@ BlpDrawDialogMessage(IN PXTBL_DIALOG_HANDLE Handle,
}
/* Get next line */
MsgLine = RtlTokenizeWideString(NULL, L"\n", &LastMsgLine);
MsgLine = RtlTokenizeWideString(NULLPTR, L"\n", &LastMsgLine);
Line++;
}
}
@@ -1699,7 +1699,7 @@ BlpDrawEditMenu(OUT PXTBL_DIALOG_HANDLE Handle)
}
/* Draw empty dialog box for boot menu */
BlpDrawDialogBox(Handle, L"Edit Options", NULL);
BlpDrawDialogBox(Handle, L"Edit Options", NULLPTR);
/* Print help message below the edit menu */
BlSetCursorPosition(0, Handle->PosY + Handle->Height);
@@ -1748,7 +1748,7 @@ BlpDrawEditMenuEntry(IN PXTBL_DIALOG_HANDLE Handle,
Allocation = FALSE;
/* Set display value depending on input */
DisplayValue = (OptionValue != NULL) ? OptionValue : L"";
DisplayValue = (OptionValue != NULLPTR) ? OptionValue : L"";
/* Determine lengths */
OptionNameLength = RtlWideStringLength(OptionName, 0);

View File

@@ -27,10 +27,10 @@ BlCloseVolume(IN PEFI_HANDLE VolumeHandle)
EFI_GUID LIPGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
/* Make sure a handle specified */
if(VolumeHandle != NULL)
if(VolumeHandle != NULLPTR)
{
/* Close a handle */
return EfiSystemTable->BootServices->CloseProtocol(VolumeHandle, &LIPGuid, EfiImageHandle, NULL);
return EfiSystemTable->BootServices->CloseProtocol(VolumeHandle, &LIPGuid, EfiImageHandle, NULLPTR);
}
/* Return success */
@@ -50,10 +50,10 @@ BlEnumerateBlockDevices()
{
EFI_GUID LoadedImageProtocolGuid = EFI_LOADED_IMAGE_PROTOCOL_GUID;
EFI_GUID BlockIoGuid = EFI_BLOCK_IO_PROTOCOL_GUID;
EFI_HANDLE BootDeviceHandle = NULL, DeviceHandle = NULL;
EFI_HANDLE BootDeviceHandle = NULLPTR, DeviceHandle = NULLPTR;
EFI_LOADED_IMAGE_PROTOCOL* LoadedImage;
PEFI_DEVICE_PATH_PROTOCOL DevicePath = NULL, LastNode = NULL;
PEFI_BLOCK_DEVICE_DATA ParentNode = NULL;
PEFI_DEVICE_PATH_PROTOCOL DevicePath = NULLPTR, LastNode = NULLPTR;
PEFI_BLOCK_DEVICE_DATA ParentNode = NULLPTR;
PEFI_BLOCK_DEVICE_DATA BlockDeviceData;
PEFI_BLOCK_DEVICE BlockDevice;
LIST_ENTRY BlockDevices;
@@ -97,7 +97,7 @@ BlEnumerateBlockDevices()
{
/* Get data for the next discovered device. */
BlockDeviceData = CONTAIN_RECORD(ListEntry, EFI_BLOCK_DEVICE_DATA, ListEntry);
PartitionGuid = NULL;
PartitionGuid = NULLPTR;
/* Find last node */
Status = BlpFindLastBlockDeviceNode(BlockDeviceData->DevicePath, &LastNode);
@@ -172,11 +172,11 @@ BlEnumerateBlockDevices()
PartitionGuid = (PEFI_GUID)HDPath->Signature;
/* Check if this is the EFI System Partition (ESP) */
if(BootDeviceHandle != NULL)
if(BootDeviceHandle != NULLPTR)
{
/* Allocate memory for device path */
DevicePath = BlpDuplicateDevicePath(BlockDeviceData->DevicePath);
if(DevicePath != NULL)
if(DevicePath != NULLPTR)
{
/* Check if this is the boot device */
Status = EfiSystemTable->BootServices->LocateDevicePath(&BlockIoGuid, &DevicePath,
@@ -262,7 +262,7 @@ BlFindVolumeDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL FsHandle,
{
EFI_STATUS Status;
SIZE_T FsPathLength, DevicePathLength = 0;
PEFI_FILEPATH_DEVICE_PATH FilePath = NULL;
PEFI_FILEPATH_DEVICE_PATH FilePath = NULLPTR;
PEFI_DEVICE_PATH_PROTOCOL EndDevicePath;
PEFI_DEVICE_PATH_PROTOCOL DevicePathHandle;
@@ -405,7 +405,7 @@ BlGetVolumeDevicePath(IN PWCHAR SystemPath,
EFI_STATUS Status;
/* Make sure this is not set */
*DevicePath = NULL;
*DevicePath = NULLPTR;
/* Find volume path and its length */
Volume = SystemPath;
@@ -489,7 +489,7 @@ BlGetVolumeDevicePath(IN PWCHAR SystemPath,
}
/* Check if volume was found */
if(*DevicePath == NULL)
if(*DevicePath == NULLPTR)
{
/* Volume not found */
BlDebugPrint(L"ERROR: Volume (DriveType: %u, DriveNumber: %lu, PartNumber: %lu) not found\n",
@@ -530,7 +530,7 @@ BlOpenVolume(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
EFI_STATUS Status;
/* Check if device path has been passed or not */
if(DevicePath != NULL)
if(DevicePath != NULLPTR)
{
/* Locate the device path */
Status = EfiSystemTable->BootServices->LocateDevicePath(&SFSGuid, &DevicePath, DiskHandle);
@@ -544,7 +544,7 @@ BlOpenVolume(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
{
/* Open the image protocol if no device path specified */
Status = EfiSystemTable->BootServices->OpenProtocol(EfiImageHandle, &LIPGuid, (PVOID *)&ImageProtocol,
EfiImageHandle, NULL, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
EfiImageHandle, NULLPTR, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to open image protocol */
@@ -557,7 +557,7 @@ BlOpenVolume(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
/* Open the filesystem protocol */
Status = EfiSystemTable->BootServices->OpenProtocol(*DiskHandle, &SFSGuid, (PVOID *)&FileSystemProtocol,
EfiImageHandle, NULL, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
EfiImageHandle, NULLPTR, EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);
/* Check if filesystem protocol opened successfully */
if(Status != STATUS_EFI_SUCCESS)
@@ -718,7 +718,7 @@ BlpDiscoverEfiBlockDevices(OUT PLIST_ENTRY BlockDevices)
PEFI_DEVICE_PATH_PROTOCOL DevicePath;
PEFI_BLOCK_DEVICE_DATA BlockDevice;
UINT_PTR HandlesCount, Index;
PEFI_HANDLE Handles = NULL;
PEFI_HANDLE Handles = NULLPTR;
PEFI_BLOCK_IO_PROTOCOL Io;
EFI_STATUS Status;
@@ -738,9 +738,9 @@ BlpDiscoverEfiBlockDevices(OUT PLIST_ENTRY BlockDevices)
BlDebugPrint(L"Opening %lu block device from %lu discovered\n", Index + 1, HandlesCount);
/* Open I/O protocol for given handle */
Io = NULL;
Io = NULLPTR;
Status = BlOpenProtocolHandle(Handles[Index], (PVOID *)&Io, &IoGuid);
if(Status != STATUS_EFI_SUCCESS || Io == NULL)
if(Status != STATUS_EFI_SUCCESS || Io == NULLPTR)
{
/* Failed to open I/O protocol, skip it */
BlDebugPrint(L"WARNING: Failed to open EFI Block I/O protocol (Status Code: 0x%zX)\n", Status);
@@ -756,13 +756,13 @@ BlpDiscoverEfiBlockDevices(OUT PLIST_ENTRY BlockDevices)
}
/* Check if DevicePath protocol is supported by this handle */
DevicePath = NULL;
DevicePath = NULLPTR;
Status = EfiSystemTable->BootServices->HandleProtocol(Handles[Index], &DevicePathGuid, (PVOID *)&DevicePath);
if(Status != STATUS_EFI_SUCCESS || DevicePath == NULL)
if(Status != STATUS_EFI_SUCCESS || DevicePath == NULLPTR)
{
/* Device failed to handle DP protocol */
BlDebugPrint(L"WARNING: Unable to open DevicePath protocol (Status Code: 0x%zX)\n", Status);
EfiSystemTable->BootServices->CloseProtocol(Handles[Index], &IoGuid, EfiImageHandle, NULL);
EfiSystemTable->BootServices->CloseProtocol(Handles[Index], &IoGuid, EfiImageHandle, NULLPTR);
continue;
}
@@ -772,8 +772,8 @@ BlpDiscoverEfiBlockDevices(OUT PLIST_ENTRY BlockDevices)
{
/* Memory allocation failure */
BlDebugPrint(L"ERROR: Failed to allocate memory pool for block device (Status Code: 0x%zX)\n", Status);
EfiSystemTable->BootServices->CloseProtocol(Handles[Index], &DevicePathGuid, EfiImageHandle, NULL);
EfiSystemTable->BootServices->CloseProtocol(Handles[Index], &IoGuid, EfiImageHandle, NULL);
EfiSystemTable->BootServices->CloseProtocol(Handles[Index], &DevicePathGuid, EfiImageHandle, NULLPTR);
EfiSystemTable->BootServices->CloseProtocol(Handles[Index], &IoGuid, EfiImageHandle, NULLPTR);
return Status;
}
@@ -983,11 +983,11 @@ BlpDuplicateDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath)
EFI_STATUS Status;
UINT Length = 0;
/* Check if the input device path is NULL */
/* Check if the input device path is NULL pointer */
if(!DevicePath)
{
/* Nothing to duplicate */
return NULL;
return NULLPTR;
}
/* Start iterating from the beginning of the device path */
@@ -1008,7 +1008,7 @@ BlpDuplicateDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath)
if(Length == 0)
{
/* Nothing to duplicate */
return NULL;
return NULLPTR;
}
/* Allocate memory for the new device path */
@@ -1017,7 +1017,7 @@ BlpDuplicateDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath)
{
/* Failed to allocate memory */
BlDebugPrint(L"ERROR: Failed to allocate memory pool for device path duplicate (Status Code: 0x%zX)\n", Status);
return NULL;
return NULLPTR;
}
/* Copy the device path */
@@ -1051,7 +1051,7 @@ BlpFindLastBlockDeviceNode(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
if(DevicePath->Type == EFI_END_DEVICE_PATH)
{
/* End reached, nothing to do */
LastNode = NULL;
LastNode = NULLPTR;
return STATUS_EFI_INVALID_PARAMETER;
}

View File

@@ -146,7 +146,7 @@ BlInitializeBootMenuList(IN ULONG MaxNameLength,
while(MenuEntrySectionList != BlpMenuList)
{
/* NULLify menu entry name */
MenuEntryName = NULL;
MenuEntryName = NULLPTR;
/* Get menu section */
MenuEntrySection = CONTAIN_RECORD(MenuEntrySectionList, XTBL_CONFIG_SECTION, Flink);
@@ -253,7 +253,7 @@ BlInvokeBootProtocol(IN PWCHAR ShortName,
/* Initialize boot parameters and a list of modules */
RtlZeroMemory(&BootParameters, sizeof(XTBL_BOOT_PARAMETERS));
ModulesList = NULL;
ModulesList = NULLPTR;
/* Iterate through all options provided by boot menu entry and propagate boot parameters */
OptionsListEntry = OptionsList->Flink;
@@ -440,7 +440,7 @@ BlStartXtLoader(IN EFI_HANDLE ImageHandle,
}
/* Disable watchdog timer */
Status = EfiSystemTable->BootServices->SetWatchdogTimer(0, 0x10000, 0, NULL);
Status = EfiSystemTable->BootServices->SetWatchdogTimer(0, 0x10000, 0, NULLPTR);
if(Status != STATUS_EFI_SUCCESS)
{
/* Failed to disable the timer, print message */
@@ -479,7 +479,7 @@ BlStartXtLoader(IN EFI_HANDLE ImageHandle,
while(TRUE)
{
/* Check if custom boot menu registered */
if(BlpStatus.BootMenu != NULL)
if(BlpStatus.BootMenu != NULLPTR)
{
/* Display alternative boot menu */
BlpStatus.BootMenu();