From fabf3a3a5e153a54761c41371b4ebaba9a6fed27 Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Tue, 16 Sep 2025 15:59:56 +0200 Subject: [PATCH] Replace all occurrences of NULL with NULLPTR for unified C and C++ null pointer handling --- sdk/xtdk/xtcompat.h | 10 ++++- sdk/xtdk/xtdefs.h | 4 -- xtldr/arch/amd64/memory.c | 2 +- xtldr/arch/i686/memory.c | 2 +- xtldr/bootutil.c | 2 +- xtldr/config.c | 30 +++++++------- xtldr/debug.c | 4 +- xtldr/efiutils.c | 20 ++++----- xtldr/globals.c | 4 +- xtldr/hardware.c | 6 +-- xtldr/library/modproto.c | 8 ++-- xtldr/memory.c | 18 ++++---- xtldr/modules/acpi/acpi.c | 18 ++++---- xtldr/modules/beep/beep.c | 4 +- xtldr/modules/chainldr/chainldr.c | 2 +- xtldr/modules/framebuf/framebuf.c | 8 ++-- xtldr/modules/pecoff/pecoff.c | 2 +- xtldr/modules/xtos_o/xtos.c | 14 +++---- xtldr/protocol.c | 48 +++++++++++----------- xtldr/textui.c | 48 +++++++++++----------- xtldr/volume.c | 54 ++++++++++++------------ xtldr/xtldr.c | 8 ++-- xtoskrnl/ar/amd64/cpufunc.cc | 2 +- xtoskrnl/ar/amd64/procsup.cc | 2 +- xtoskrnl/ar/i686/cpufunc.cc | 2 +- xtoskrnl/ar/i686/procsup.cc | 2 +- xtoskrnl/ex/rundown.cc | 2 +- xtoskrnl/hl/acpi.cc | 18 ++++---- xtoskrnl/kd/data.cc | 2 +- xtoskrnl/ke/amd64/krnlinit.cc | 3 +- xtoskrnl/ke/amd64/kthread.cc | 2 +- xtoskrnl/ke/apc.cc | 2 +- xtoskrnl/ke/bootinfo.cc | 4 +- xtoskrnl/ke/dpc.cc | 4 +- xtoskrnl/ke/i686/krnlinit.cc | 3 +- xtoskrnl/ke/krnlinit.cc | 2 +- xtoskrnl/ke/kthread.cc | 6 +-- xtoskrnl/ke/sysres.cc | 4 +- xtoskrnl/mm/amd64/pagemap.cc | 2 +- xtoskrnl/mm/hlpool.cc | 4 +- xtoskrnl/rtl/atomic.cc | 10 ++--- xtoskrnl/rtl/exports.cc | 42 +++++++++---------- xtoskrnl/rtl/llist.cc | 6 +-- xtoskrnl/rtl/math.cc | 16 ++++---- xtoskrnl/rtl/string.cc | 58 +++++++++++++------------- xtoskrnl/rtl/widestr.cc | 68 +++++++++++++++---------------- 46 files changed, 294 insertions(+), 288 deletions(-) diff --git a/sdk/xtdk/xtcompat.h b/sdk/xtdk/xtcompat.h index b2a1c0e..9d8c427 100644 --- a/sdk/xtdk/xtcompat.h +++ b/sdk/xtdk/xtcompat.h @@ -11,10 +11,18 @@ #ifdef __cplusplus - #define XTCLINK extern "C" + /* C++ definitions */ + #define XTCLINK extern "C" + #define NULLPTR nullptr + + /* C++ types */ typedef wchar_t wchar; #else + /* C definitions */ #define XTCLINK + #define NULLPTR ((void *)0) + + /* C types */ typedef unsigned short wchar; #endif diff --git a/sdk/xtdk/xtdefs.h b/sdk/xtdk/xtdefs.h index 1f1a57a..7faae86 100644 --- a/sdk/xtdk/xtdefs.h +++ b/sdk/xtdk/xtdefs.h @@ -29,10 +29,6 @@ #define UNION union #define VOLATILE volatile -/* NULL values */ -#define NULL ((PVOID) 0) -#define NULL64 ((VOID * PVOID) 0) - /* Type limits */ #define MINCHAR 0x80 #define MAXCHAR 0x7F diff --git a/xtldr/arch/amd64/memory.c b/xtldr/arch/amd64/memory.c index c94e735..c607e62 100644 --- a/xtldr/arch/amd64/memory.c +++ b/xtldr/arch/amd64/memory.c @@ -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 */ diff --git a/xtldr/arch/i686/memory.c b/xtldr/arch/i686/memory.c index f6aede9..f858e37 100644 --- a/xtldr/arch/i686/memory.c +++ b/xtldr/arch/i686/memory.c @@ -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 */ diff --git a/xtldr/bootutil.c b/xtldr/bootutil.c index 9ca1aa9..9a3acfd 100644 --- a/xtldr/bootutil.c +++ b/xtldr/bootutil.c @@ -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; diff --git a/xtldr/config.c b/xtldr/config.c index 8f3ae15..cb2697a 100644 --- a/xtldr/config.c +++ b/xtldr/config.c @@ -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); diff --git a/xtldr/debug.c b/xtldr/debug.c index 3844cf0..60c7520 100644 --- a/xtldr/debug.c +++ b/xtldr/debug.c @@ -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 */ diff --git a/xtldr/efiutils.c b/xtldr/efiutils.c index 5bda800..e033f0c 100644 --- a/xtldr/efiutils.c +++ b/xtldr/efiutils.c @@ -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); } /** diff --git a/xtldr/globals.c b/xtldr/globals.c index d88b201..af4fa52 100644 --- a/xtldr/globals.c +++ b/xtldr/globals.c @@ -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}; diff --git a/xtldr/hardware.c b/xtldr/hardware.c index 08b6a03..0f3df84 100644 --- a/xtldr/hardware.c +++ b/xtldr/hardware.c @@ -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 */ diff --git a/xtldr/library/modproto.c b/xtldr/library/modproto.c index 3a3b67f..db6bd08 100644 --- a/xtldr/library/modproto.c +++ b/xtldr/library/modproto.c @@ -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; diff --git a/xtldr/memory.c b/xtldr/memory.c index 1d6f25b..4977d5f 100644 --- a/xtldr/memory.c +++ b/xtldr/memory.c @@ -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); diff --git a/xtldr/modules/acpi/acpi.c b/xtldr/modules/acpi/acpi.c index aceb8ac..f6c5175 100644 --- a/xtldr/modules/acpi/acpi.c +++ b/xtldr/modules/acpi/acpi.c @@ -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; } diff --git a/xtldr/modules/beep/beep.c b/xtldr/modules/beep/beep.c index bd81568..b4efe65 100644 --- a/xtldr/modules/beep/beep.c +++ b/xtldr/modules/beep/beep.c @@ -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 */ diff --git a/xtldr/modules/chainldr/chainldr.c b/xtldr/modules/chainldr/chainldr.c index e902cda..3d28dbd 100644 --- a/xtldr/modules/chainldr/chainldr.c +++ b/xtldr/modules/chainldr/chainldr.c @@ -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"); diff --git a/xtldr/modules/framebuf/framebuf.c b/xtldr/modules/framebuf/framebuf.c index de5c1b2..71abaac 100644 --- a/xtldr/modules/framebuf/framebuf.c +++ b/xtldr/modules/framebuf/framebuf.c @@ -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 */ diff --git a/xtldr/modules/pecoff/pecoff.c b/xtldr/modules/pecoff/pecoff.c index aac0208..9c36eda 100644 --- a/xtldr/modules/pecoff/pecoff.c +++ b/xtldr/modules/pecoff/pecoff.c @@ -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); diff --git a/xtldr/modules/xtos_o/xtos.c b/xtldr/modules/xtos_o/xtos.c index 12e4353..85495d5 100644 --- a/xtldr/modules/xtos_o/xtos.c +++ b/xtldr/modules/xtos_o/xtos.c @@ -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 // { diff --git a/xtldr/protocol.c b/xtldr/protocol.c index 5988b9f..b931d41 100644 --- a/xtldr/protocol.c +++ b/xtldr/protocol.c @@ -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++; diff --git a/xtldr/textui.c b/xtldr/textui.c index eb77811..a65797c 100644 --- a/xtldr/textui.c +++ b/xtldr/textui.c @@ -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); diff --git a/xtldr/volume.c b/xtldr/volume.c index 74b6166..a5a4759 100644 --- a/xtldr/volume.c +++ b/xtldr/volume.c @@ -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; } diff --git a/xtldr/xtldr.c b/xtldr/xtldr.c index dadc0c3..37d2f74 100644 --- a/xtldr/xtldr.c +++ b/xtldr/xtldr.c @@ -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(); diff --git a/xtoskrnl/ar/amd64/cpufunc.cc b/xtoskrnl/ar/amd64/cpufunc.cc index 8bb9423..1013424 100644 --- a/xtoskrnl/ar/amd64/cpufunc.cc +++ b/xtoskrnl/ar/amd64/cpufunc.cc @@ -709,7 +709,7 @@ AR::CpuFunc::StoreSegment(IN USHORT Segment, : "=r" (*(PUINT)Destination)); break; default: - Destination = NULL; + Destination = NULLPTR; break; } } diff --git a/xtoskrnl/ar/amd64/procsup.cc b/xtoskrnl/ar/amd64/procsup.cc index adc4e09..5bc5f37 100644 --- a/xtoskrnl/ar/amd64/procsup.cc +++ b/xtoskrnl/ar/amd64/procsup.cc @@ -307,7 +307,7 @@ AR::ProcSup::InitializeProcessorBlock(OUT PKPROCESSOR_BLOCK ProcessorBlock, ProcessorBlock->Prcb.CurrentThread = &(KE::KThread::GetInitialThread())->ThreadControlBlock; ProcessorBlock->Prcb.CurrentThread->ApcState.Process = &(KE::KProcess::GetInitialProcess())->ProcessControlBlock; ProcessorBlock->Prcb.IdleThread = &(KE::KThread::GetInitialThread())->ThreadControlBlock; - ProcessorBlock->Prcb.NextThread = nullptr; + ProcessorBlock->Prcb.NextThread = NULLPTR; /* Set initial MXCSR register value */ ProcessorBlock->Prcb.MxCsr = INITIAL_MXCSR; diff --git a/xtoskrnl/ar/i686/cpufunc.cc b/xtoskrnl/ar/i686/cpufunc.cc index d76c470..bc81f5e 100644 --- a/xtoskrnl/ar/i686/cpufunc.cc +++ b/xtoskrnl/ar/i686/cpufunc.cc @@ -679,7 +679,7 @@ AR::CpuFunc::StoreSegment(IN USHORT Segment, : "=r" (*(PUINT)Destination)); break; default: - Destination = NULL; + Destination = NULLPTR; break; } } diff --git a/xtoskrnl/ar/i686/procsup.cc b/xtoskrnl/ar/i686/procsup.cc index 0485fa8..49d7b40 100644 --- a/xtoskrnl/ar/i686/procsup.cc +++ b/xtoskrnl/ar/i686/procsup.cc @@ -304,7 +304,7 @@ AR::ProcSup::InitializeProcessorBlock(OUT PKPROCESSOR_BLOCK ProcessorBlock, ProcessorBlock->Prcb.CurrentThread = &(KE::KThread::GetInitialThread())->ThreadControlBlock; ProcessorBlock->Prcb.CurrentThread->ApcState.Process = &(KE::KProcess::GetInitialProcess())->ProcessControlBlock; ProcessorBlock->Prcb.IdleThread = &(KE::KThread::GetInitialThread())->ThreadControlBlock; - ProcessorBlock->Prcb.NextThread = nullptr; + ProcessorBlock->Prcb.NextThread = NULLPTR; /* Set initial runlevel */ ProcessorBlock->RunLevel = PASSIVE_LEVEL; diff --git a/xtoskrnl/ex/rundown.cc b/xtoskrnl/ex/rundown.cc index 12d7517..f522925 100644 --- a/xtoskrnl/ex/rundown.cc +++ b/xtoskrnl/ex/rundown.cc @@ -106,7 +106,7 @@ XTFASTCALL VOID EX::Rundown::ReInitializeProtection(IN PEX_RUNDOWN_REFERENCE Descriptor) { - RTL::Atomic::ExchangePointer(&Descriptor->Ptr, NULL); + RTL::Atomic::ExchangePointer(&Descriptor->Ptr, NULLPTR); } /** diff --git a/xtoskrnl/hl/acpi.cc b/xtoskrnl/hl/acpi.cc index d5c4f72..2801f71 100644 --- a/xtoskrnl/hl/acpi.cc +++ b/xtoskrnl/hl/acpi.cc @@ -71,7 +71,7 @@ HL::Acpi::GetAcpiTable(IN ULONG Signature, XTSTATUS Status; /* Assume ACPI table not found */ - *AcpiTable = nullptr; + *AcpiTable = NULLPTR; /* Attempt to get ACPI table from the cache */ Status = QueryAcpiCache(Signature, &Table); @@ -182,7 +182,7 @@ HL::Acpi::InitializeAcpiSystemDescriptionTable(OUT PACPI_DESCRIPTION_HEADER *Acp XTSTATUS Status; /* Assume ACPI table not found */ - *AcpiTable = nullptr; + *AcpiTable = NULLPTR; /* Get ACPI system resource */ Status = KeGetSystemResource(SystemResourceAcpi, &ResourceHeader); @@ -512,7 +512,7 @@ HL::Acpi::QueryAcpiCache(IN ULONG Signature, PLIST_ENTRY ListEntry; /* Initialize variables */ - TableHeader = nullptr; + TableHeader = NULLPTR; /* Iterate through ACPI tables cache list */ ListEntry = CacheList.Flink; @@ -534,7 +534,7 @@ HL::Acpi::QueryAcpiCache(IN ULONG Signature, } /* Check if the requested ACPI table was found in the cache */ - if(TableHeader == NULL) + if(TableHeader == NULLPTR) { /* ACPI table not found in cache, return error */ return STATUS_NOT_FOUND; @@ -580,7 +580,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature, } /* Ensure that table header is not set before attempting to find ACPI table */ - TableHeader = nullptr; + TableHeader = NULLPTR; /* Check if DSDT or FACS table requested */ if(Signature == ACPI_DSDT_SIGNATURE || Signature == ACPI_FACS_SIGNATURE) @@ -634,7 +634,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature, } /* Get table count depending on root table type */ - if(Xsdt != NULL) + if(Xsdt != NULLPTR) { /* Get table count from XSDT */ TableCount = (Xsdt->Header.Length - sizeof(ACPI_DESCRIPTION_HEADER)) / 8; @@ -649,7 +649,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature, for(TableIndex = 0; TableIndex < TableCount; TableIndex++) { /* Check if XSDP or RSDT is used */ - if(Xsdt != NULL) + if(Xsdt != NULLPTR) { /* Get table header physical address from XSDT */ TableAddress.QuadPart = Xsdt->Tables[TableIndex]; @@ -662,7 +662,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature, } /* Check whether some table is already mapped */ - if(TableHeader != NULL) + if(TableHeader != NULLPTR) { /* Unmap previous table */ MM::HardwarePool::UnmapHardwareMemory(TableHeader, 2, TRUE); @@ -689,7 +689,7 @@ HL::Acpi::QueryAcpiTables(IN ULONG Signature, if(TableHeader->Signature != Signature) { /* ACPI table not found, check if cleanup is needed */ - if(TableHeader != NULL) + if(TableHeader != NULLPTR) { /* Unmap non-matching ACPI table */ MM::HardwarePool::UnmapHardwareMemory(TableHeader, 2, TRUE); diff --git a/xtoskrnl/kd/data.cc b/xtoskrnl/kd/data.cc index 3c2af70..acaaa9c 100644 --- a/xtoskrnl/kd/data.cc +++ b/xtoskrnl/kd/data.cc @@ -19,7 +19,7 @@ PKD_INIT_ROUTINE KD::DebugIo::IoProvidersInitRoutines[KDBG_PROVIDERS_COUNT] = { }; /* Pointer to DbgPrint() routine */ -PKD_PRINT_ROUTINE KD::DebugIo::KdPrint = nullptr; +PKD_PRINT_ROUTINE KD::DebugIo::KdPrint = NULLPTR; /* List of active I/O providers */ LIST_ENTRY KD::DebugIo::Providers; diff --git a/xtoskrnl/ke/amd64/krnlinit.cc b/xtoskrnl/ke/amd64/krnlinit.cc index 6c624c0..985d7d1 100644 --- a/xtoskrnl/ke/amd64/krnlinit.cc +++ b/xtoskrnl/ke/amd64/krnlinit.cc @@ -99,7 +99,8 @@ KE::KernelInit::StartKernel(VOID) CurrentProcess->Quantum = MAXCHAR; /* Initialize Idle thread */ - KThread::InitializeThread(CurrentProcess, CurrentThread, nullptr, nullptr, nullptr, nullptr, nullptr, AR::ProcSup::GetBootStack(), TRUE); + KThread::InitializeThread(CurrentProcess, CurrentThread, NULLPTR, NULLPTR, NULLPTR, + NULLPTR, NULLPTR, AR::ProcSup::GetBootStack(), TRUE); CurrentThread->NextProcessor = Prcb->CpuNumber; CurrentThread->Priority = THREAD_HIGH_PRIORITY; CurrentThread->State = Running; diff --git a/xtoskrnl/ke/amd64/kthread.cc b/xtoskrnl/ke/amd64/kthread.cc index ae75b96..83820e7 100644 --- a/xtoskrnl/ke/amd64/kthread.cc +++ b/xtoskrnl/ke/amd64/kthread.cc @@ -99,7 +99,7 @@ KE::KThread::InitializeThreadContext(IN PKTHREAD Thread, Thread->NpxState = NPX_STATE_UNUSED; /* Set thread start address */ - ThreadFrame->StartFrame.Return = (ULONG64)NULL; + ThreadFrame->StartFrame.Return = (ULONG64)NULLPTR; } /* Initialize thread startup information */ diff --git a/xtoskrnl/ke/apc.cc b/xtoskrnl/ke/apc.cc index 0714999..9147aa3 100644 --- a/xtoskrnl/ke/apc.cc +++ b/xtoskrnl/ke/apc.cc @@ -83,7 +83,7 @@ KE::Apc::InitializeApc(IN PKAPC Apc, { /* Set context and mode for special APC */ Apc->ApcMode = KernelMode; - Apc->NormalContext = NULL; + Apc->NormalContext = NULLPTR; } /* Mark APC as not inserted yet */ diff --git a/xtoskrnl/ke/bootinfo.cc b/xtoskrnl/ke/bootinfo.cc index fcdd342..241f91e 100644 --- a/xtoskrnl/ke/bootinfo.cc +++ b/xtoskrnl/ke/bootinfo.cc @@ -44,7 +44,7 @@ KE::BootInformation::GetFirmwareType(VOID) * Supplies a pointer to a null-terminated wide string specifying the name of the parameter to search for. * * @param Parameter - * Supplies a pointer to a variable that receives a pointer to the matching parameter, or NULL if not found. + * Supplies a pointer to a variable that receives a pointer to the matching parameter, or NULLPTR if not found. * * @return This routine returns a status code. * @@ -74,7 +74,7 @@ KE::BootInformation::GetKernelParameter(IN PCWSTR ParameterName, } /* Assume the requested parameter is not present in the kernel parameters */ - *Parameter = nullptr; + *Parameter = NULLPTR; /* Start searching from the beginning of the list */ SearchStart = InitializationBlock->KernelParameters; diff --git a/xtoskrnl/ke/dpc.cc b/xtoskrnl/ke/dpc.cc index 1e94764..f0f707d 100644 --- a/xtoskrnl/ke/dpc.cc +++ b/xtoskrnl/ke/dpc.cc @@ -39,7 +39,7 @@ KE::Dpc::InitializeDpc(IN PKDPC Dpc, /* Initialize DPC routine and context data */ Dpc->DeferredContext = DpcContext; Dpc->DeferredRoutine = DpcRoutine; - Dpc->DpcData = NULL; + Dpc->DpcData = NULLPTR; } /** @@ -72,7 +72,7 @@ KE::Dpc::InitializeThreadedDpc(IN PKDPC Dpc, /* Initialize DPC routine and context data */ Dpc->DeferredContext = DpcContext; Dpc->DeferredRoutine = DpcRoutine; - Dpc->DpcData = NULL; + Dpc->DpcData = NULLPTR; } /** diff --git a/xtoskrnl/ke/i686/krnlinit.cc b/xtoskrnl/ke/i686/krnlinit.cc index 461a034..c2a418a 100644 --- a/xtoskrnl/ke/i686/krnlinit.cc +++ b/xtoskrnl/ke/i686/krnlinit.cc @@ -99,7 +99,8 @@ KE::KernelInit::StartKernel(VOID) CurrentProcess->Quantum = MAXCHAR; /* Initialize Idle thread */ - KThread::InitializeThread(CurrentProcess, CurrentThread, nullptr, nullptr, nullptr, nullptr, nullptr, AR::ProcSup::GetBootStack(), TRUE); + KThread::InitializeThread(CurrentProcess, CurrentThread, NULLPTR, NULLPTR, NULLPTR, + NULLPTR, NULLPTR, AR::ProcSup::GetBootStack(), TRUE); CurrentThread->NextProcessor = Prcb->CpuNumber; CurrentThread->Priority = THREAD_HIGH_PRIORITY; CurrentThread->State = Running; diff --git a/xtoskrnl/ke/krnlinit.cc b/xtoskrnl/ke/krnlinit.cc index c6e3aeb..dbd8cdc 100644 --- a/xtoskrnl/ke/krnlinit.cc +++ b/xtoskrnl/ke/krnlinit.cc @@ -47,7 +47,7 @@ KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters) } /* Initialize boot CPU */ - AR::ProcSup::InitializeProcessor(NULL); + AR::ProcSup::InitializeProcessor(NULLPTR); /* Initialize system resources */ SystemResources::InitializeResources(); diff --git a/xtoskrnl/ke/kthread.cc b/xtoskrnl/ke/kthread.cc index 5da2a7b..1e531f4 100644 --- a/xtoskrnl/ke/kthread.cc +++ b/xtoskrnl/ke/kthread.cc @@ -131,7 +131,7 @@ KE::KThread::InitializeThread(IN PKPROCESS Process, /* Initialize kernel-mode suspend APC */ Apc::InitializeApc(&Thread->SuspendApc, Thread, OriginalApcEnvironment, SuspendNop, - SuspendRundown, SuspendThread, KernelMode, NULL); + SuspendRundown, SuspendThread, KernelMode, NULLPTR); /* Initialize suspend semaphore */ Semaphore::InitializeSemaphore(&Thread->SuspendSemaphore, 0, 2); @@ -179,8 +179,8 @@ KE::KThread::InitializeThread(IN PKPROCESS Process, { /* Deallocate stack */ MM::KernelPool::FreeKernelStack(Stack, FALSE); - Thread->InitialStack = NULL; - Thread->StackBase = NULL; + Thread->InitialStack = NULLPTR; + Thread->StackBase = NULLPTR; } /* Thread initialization failed */ diff --git a/xtoskrnl/ke/sysres.cc b/xtoskrnl/ke/sysres.cc index 24aa5fd..1879c4e 100644 --- a/xtoskrnl/ke/sysres.cc +++ b/xtoskrnl/ke/sysres.cc @@ -104,8 +104,8 @@ KE::SystemResources::GetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType, /* Check if resource was found */ if(ListEntry == &ResourcesListHead) { - /* Resource not found, return NULL */ - Resource = nullptr; + /* Resource not found, return NULLPTR */ + Resource = NULLPTR; Status = STATUS_NOT_FOUND; } diff --git a/xtoskrnl/mm/amd64/pagemap.cc b/xtoskrnl/mm/amd64/pagemap.cc index ea7343b..62fa00b 100644 --- a/xtoskrnl/mm/amd64/pagemap.cc +++ b/xtoskrnl/mm/amd64/pagemap.cc @@ -36,7 +36,7 @@ MM::PageMap::ClearPte(PHARDWARE_PTE PtePointer) * @param Address * Specifies the virtual address for which to retrieve the corresponding P5E. * - * @return This routine returns the address of the P5E, or NULL if LA57 is not enabled. + * @return This routine returns the address of the P5E, or NULLPTR if LA57 is not enabled. * * @since XT 1.0 */ diff --git a/xtoskrnl/mm/hlpool.cc b/xtoskrnl/mm/hlpool.cc index 85137bc..8728b8f 100644 --- a/xtoskrnl/mm/hlpool.cc +++ b/xtoskrnl/mm/hlpool.cc @@ -176,13 +176,13 @@ MM::HardwarePool::MapHardwareMemory(IN PHYSICAL_ADDRESS PhysicalAddress, BaseAddress = HardwareHeapStart; MappedPages = 0; ReturnAddress = BaseAddress; - *VirtualAddress = NULL; + *VirtualAddress = NULLPTR; /* Iterate through all pages */ while(MappedPages < PageCount) { /* Check if address overflows */ - if(BaseAddress == NULL) + if(BaseAddress == NULLPTR) { /* Not enough free pages, return error */ return STATUS_INSUFFICIENT_RESOURCES; diff --git a/xtoskrnl/rtl/atomic.cc b/xtoskrnl/rtl/atomic.cc index b1d576c..86b16d8 100644 --- a/xtoskrnl/rtl/atomic.cc +++ b/xtoskrnl/rtl/atomic.cc @@ -524,7 +524,7 @@ RTL::Atomic::ExchangePointer(IN PVOID *Address, * @param Header * Supplies a pointer to the header of linked list. * - * @return This routine returns a pointer to the original list, or NULL if the list was already empty. + * @return This routine returns a pointer to the original list, or NULLPTR if the list was already empty. * * @since XT 1.0 */ @@ -532,7 +532,7 @@ XTFASTCALL PSINGLE_LIST_ENTRY RTL::Atomic::FlushSingleList(IN PSINGLE_LIST_HEADER Header) { - return (PSINGLE_LIST_ENTRY)Exchange64((PLONG_PTR)&Header->Alignment, (LONGLONG)NULL); + return (PSINGLE_LIST_ENTRY)Exchange64((PLONG_PTR)&Header->Alignment, (LONGLONG)NULLPTR); } /** @@ -693,7 +693,7 @@ RTL::Atomic::Or64(IN PLONG_PTR Address, * @param Header * Supplies a pointer to the header of a single linked list. * - * @return This routine returns a pointer to the removed element, or NULL if the list was empty. + * @return This routine returns a pointer to the removed element, or NULLPTR if the list was empty. * * @since XT 1.0 */ @@ -712,7 +712,7 @@ RTL::Atomic::PopEntrySingleList(IN PSINGLE_LIST_HEADER Header) if(!FirstEntry) { /* Empty list */ - return nullptr; + return NULLPTR; } /* Update link */ @@ -737,7 +737,7 @@ RTL::Atomic::PopEntrySingleList(IN PSINGLE_LIST_HEADER Header) * @param Entry * Supplies a pointer to entry, that will be inserted into linked list. * - * @return This routine returns a pointer to original heading, or NULL if the list was originally empty. + * @return This routine returns a pointer to original heading, or NULLPTR if the list was originally empty. * * @since XT 1.0 */ diff --git a/xtoskrnl/rtl/exports.cc b/xtoskrnl/rtl/exports.cc index 34c3f71..f5158fd 100644 --- a/xtoskrnl/rtl/exports.cc +++ b/xtoskrnl/rtl/exports.cc @@ -256,10 +256,10 @@ RtlCompareWideStringInsensitive(IN PCWSTR String1, * Appends a copy of the source string to the end of the destination string. * * @param Destination - * Supplies a pointer to the null-terminated string to append to. + * Supplies a pointer to the NULL-terminated string to append to. * * @param Source - * Supplies a pointer to the null-terminated string to copy from. + * Supplies a pointer to the NULL-terminated string to copy from. * * @param Count * Sets a maximum number of characters to copy. If no limit set, appends whole string. @@ -282,10 +282,10 @@ RtlConcatenateString(OUT PCHAR Destination, * Appends a copy of the source wide string to the end of the destination wide string. * * @param Destination - * Supplies a pointer to the null-terminated wide string to append to. + * Supplies a pointer to the NULL-terminated wide string to append to. * * @param Source - * Supplies a pointer to the null-terminated wide string to copy from. + * Supplies a pointer to the NULL-terminated wide string to copy from. * * @param Count * Sets a maximum number of wide characters to copy. If no limit set, appends whole wide string. @@ -967,12 +967,12 @@ RtlSetMemory(OUT PVOID Destination, * Calculates the length of a given string. * * @param String - * Pointer to the null-terminated string to be examined. + * Pointer to the NULL-terminated string to be examined. * * @param MaxLength * Maximum number of characters to examine. If no limit set, it examines whole string. * - * @return The length of the null-terminated string. + * @return The length of the NULL-terminated string. * * @since: XT 1.0 */ @@ -1034,13 +1034,13 @@ RtlTestBit(IN PRTL_BITMAP BitMap, } /** - * Finds the next token in a null-terminated string. + * Finds the next token in a NULL-terminated string. * * @param String - * Pointer to the null-terminated string to tokenize. + * Pointer to the NULL-terminated string to tokenize. * * @param Delimiter - * Pointer to the null-terminated string identifying delimiters. + * Pointer to the NULL-terminated string identifying delimiters. * * @param SavePtr * Pointer to an object used to store routine internal state. @@ -1060,18 +1060,18 @@ RtlTokenizeString(IN PCHAR String, } /** - * Finds the next token in a null-terminated wide string. + * Finds the next token in a NULL-terminated wide string. * * @param String - * Pointer to the null-terminated wide string to tokenize. + * Pointer to the NULL-terminated wide string to tokenize. * * @param Delimiter - * Pointer to the null-terminated wide string identifying delimiters. + * Pointer to the NULL-terminated wide string identifying delimiters. * * @param SavePtr * Pointer to an object used to store routine internal state. * - * @return Pointer to the beginning of the next token or NULL if there are no more tokens. + * @return Pointer to the beginning of the next token or NULLPTR if there are no more tokens. * * @since: XT 1.0 */ @@ -1161,7 +1161,7 @@ RtlToUpperWideCharacter(IN WCHAR Character) * Removes certain characters from a beginning of the string. * * @param String - * Pointer to the null-terminated string to be trimmed. + * Pointer to the NULL-terminated string to be trimmed. * * @return This routine returns a pointer to the left-trimmed string. * @@ -1179,7 +1179,7 @@ RtlTrimLeftString(IN PCHAR String) * Removes certain characters from a beginning of the wide string. * * @param String - * Pointer to the null-terminated wide string to be trimmed. + * Pointer to the NULL-terminated wide string to be trimmed. * * @return This routine returns a pointer to the left-trimmed wide string. * @@ -1197,7 +1197,7 @@ RtlTrimLeftWideString(IN PWCHAR String) * Removes certain characters from the end of the string. * * @param String - * Pointer to the null-terminated string to be trimmed. + * Pointer to the NULL-terminated string to be trimmed. * * @return This routine returns a pointer to the right-trimmed string. * @@ -1215,7 +1215,7 @@ RtlTrimRightString(IN PCHAR String) * Removes certain characters from the end of the wide string. * * @param String - * Pointer to the null-terminated wide string to be trimmed. + * Pointer to the NULL-terminated wide string to be trimmed. * * @return This routine returns a pointer to the right-trimmed wide string. * @@ -1233,7 +1233,7 @@ RtlTrimRightWideString(IN PWCHAR String) * Removes certain characters from the beginning and the end of the string. * * @param String - * Pointer to the null-terminated string to be trimmed. + * Pointer to the NULL-terminated string to be trimmed. * * @return This routine returns a pointer to the trimmed string. * @@ -1251,7 +1251,7 @@ RtlTrimString(IN PCHAR String) * Removes certain characters from the beginning and the end of the wide string. * * @param String - * Pointer to the null-terminated wide string to be trimmed. + * Pointer to the NULL-terminated wide string to be trimmed. * * @return This routine returns a pointer to the trimmed wide string. * @@ -1269,12 +1269,12 @@ RtlTrimWideString(IN PWCHAR String) * Calculates the length of a given wide string. * * @param String - * Pointer to the null-terminated wide string to be examined. + * Pointer to the NULL-terminated wide string to be examined. * * @param MaxLength * Maximum number of wide characters to examine. If no limit set, it examines whole string. * - * @return The length of the null-terminated wide string. + * @return The length of the NULL-terminated wide string. * * @since: XT 1.0 */ diff --git a/xtoskrnl/rtl/llist.cc b/xtoskrnl/rtl/llist.cc index 99fa8a6..2994cf6 100644 --- a/xtoskrnl/rtl/llist.cc +++ b/xtoskrnl/rtl/llist.cc @@ -107,7 +107,7 @@ XTCDECL BOOLEAN RTL::LinkedList::ListEmpty(IN PLIST_ENTRY ListHead) { - return (BOOLEAN)(((ListHead->Flink == NULL) && (ListHead->Blink == NULL)) || (ListHead->Flink == ListHead)); + return (BOOLEAN)(((ListHead->Flink == NULLPTR) && (ListHead->Blink == NULLPTR)) || (ListHead->Flink == ListHead)); } /** @@ -127,7 +127,7 @@ RTL::LinkedList::ListLoop(IN PLIST_ENTRY ListHead) PLIST_ENTRY SlowEntry, FastEntry; /* Check if list exists */ - if(ListHead == NULL) + if(ListHead == NULLPTR) { /* No loop in non-existen list */ return FALSE; @@ -138,7 +138,7 @@ RTL::LinkedList::ListLoop(IN PLIST_ENTRY ListHead) SlowEntry = ListHead; /* Iterate through the linked list to find a loop */ - while(SlowEntry != NULL && FastEntry != NULL && FastEntry->Flink != NULL) + while(SlowEntry != NULLPTR && FastEntry != NULLPTR && FastEntry->Flink != NULLPTR) { /* Move slow and fast pointers by one and two positions accordingly */ SlowEntry = SlowEntry->Flink; diff --git a/xtoskrnl/rtl/math.cc b/xtoskrnl/rtl/math.cc index 5b2258d..f1fc35a 100644 --- a/xtoskrnl/rtl/math.cc +++ b/xtoskrnl/rtl/math.cc @@ -193,7 +193,7 @@ RTL::Math::Divide64(IN LONGLONG Dividend, /* Calculate the quotient */ DividendSign ^= DivisorSign; - Quotient = (DivideUnsigned64(UDividend, UDivisor, nullptr) ^ DividendSign) - DividendSign; + Quotient = (DivideUnsigned64(UDividend, UDivisor, NULLPTR) ^ DividendSign) - DividendSign; /* Make sure a pointer to remainder provided */ if(Remainder) @@ -284,7 +284,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend, if(DivisorParts.u.HighPart == 0) { /* 32-bit divide operation, check if remainder provided */ - if(Remainder != NULL) + if(Remainder != NULLPTR) { /* Calculate remainder */ *Remainder = DividendParts.u.LowPart % DivisorParts.u.LowPart; @@ -295,7 +295,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend, } /* 32-bit value divided by a 64-bit value, check if remainder provided */ - if(Remainder != NULL) + if(Remainder != NULLPTR) { /* Calculate remainder */ *Remainder = DividendParts.u.LowPart; @@ -318,7 +318,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend, if(Shift > ((sizeof(ULONG) * BITS_PER_BYTE) - 1)) { /* Check if remainder provided */ - if(Remainder != NULL) + if(Remainder != NULLPTR) { /* Calculate remainder */ *Remainder = DividendParts.QuadPart; @@ -388,7 +388,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend, if(DividendParts.u.LowPart == 0) { /* Check if remainder provided */ - if(Remainder != NULL) + if(Remainder != NULLPTR) { /* Calculate the remainder */ RemainderParts.u.HighPart = DividendParts.u.HighPart % DivisorParts.u.HighPart; @@ -407,7 +407,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend, if(Shift > ((sizeof(ULONG) * BITS_PER_BYTE) - 2)) { /* Check if remainder provided */ - if(Remainder != NULL) + if(Remainder != NULLPTR) { /* Calculate the remainder */ *Remainder = DividendParts.QuadPart; @@ -457,7 +457,7 @@ RTL::Math::DivideUnsigned64(IN ULONGLONG Dividend, QuotientParts.QuadPart = (QuotientParts.QuadPart << 1) | Carry; /* Check if remainder provided */ - if(Remainder != NULL) + if(Remainder != NULLPTR) { /* Calculate the remainder */ *Remainder = RemainderParts.QuadPart; @@ -497,7 +497,7 @@ RTL::Math::DivideLargeInteger(IN LARGE_INTEGER Dividend, UDividend = (Dividend.QuadPart ^ DividendSign) - DividendSign; /* Calculate the quotient */ - LargeInt.QuadPart = (DivideUnsigned64(UDividend, Divisor, nullptr) ^ DividendSign) - DividendSign; + LargeInt.QuadPart = (DivideUnsigned64(UDividend, Divisor, NULLPTR) ^ DividendSign) - DividendSign; /* Make sure a pointer to remainder provided */ if(Remainder) diff --git a/xtoskrnl/rtl/string.cc b/xtoskrnl/rtl/string.cc index 45ad2ed..df0812a 100644 --- a/xtoskrnl/rtl/string.cc +++ b/xtoskrnl/rtl/string.cc @@ -132,10 +132,10 @@ RTL::String::CompareStringInsensitive(IN PCSTR String1, * Appends a copy of the source string to the end of the destination string. * * @param Destination - * Supplies a pointer to the null-terminated string to append to. + * Supplies a pointer to the NULL-terminated string to append to. * * @param Source - * Supplies a pointer to the null-terminated string to copy from. + * Supplies a pointer to the NULL-terminated string to copy from. * * @param Count * Sets a maximum number of characters to copy. If no limit set, appends whole string. @@ -164,7 +164,7 @@ RTL::String::ConcatenateString(OUT PCHAR Destination, /* Copy character-by-character */ do { - /* Check if NULL terminated character found */ + /* Check if NULL-terminated character found */ if((*Destination = *Source++) == '\0') { /* Break on '\0' character */ @@ -174,7 +174,7 @@ RTL::String::ConcatenateString(OUT PCHAR Destination, } while(--Count != 0); - /* Add NULL termination character to the end of destination string */ + /* Add NULL-termination character to the end of destination string */ *Destination = '\0'; } else @@ -217,7 +217,7 @@ RTL::String::CopyString(IN PCHAR Destination, /* Copy source character */ Destination[Index] = Source[Index]; - /* Check if NULL terminated character found */ + /* Check if NULL-terminated character found */ if(Source[Index] == '\0') { /* End of source string reached */ @@ -253,8 +253,8 @@ RTL::String::FindString(IN PCSTR Source, /* Validate input parameters */ if(!Source || !Search) { - /* Invalid input parameters, return NULL */ - return nullptr; + /* Invalid input parameters, return NULLPTR */ + return NULLPTR; } /* Check if search string is empty */ @@ -287,8 +287,8 @@ RTL::String::FindString(IN PCSTR Source, } } - /* No match found, return NULL */ - return nullptr; + /* No match found, return NULLPTR */ + return NULLPTR; } /** @@ -315,8 +315,8 @@ RTL::String::FindStringInsensitive(IN PCSTR Source, /* Validate input parameters */ if(!Source || !Search) { - /* Invalid input parameters, return NULL */ - return nullptr; + /* Invalid input parameters, return NULLPTR */ + return NULLPTR; } /* Check if search string is empty */ @@ -350,8 +350,8 @@ RTL::String::FindStringInsensitive(IN PCSTR Source, } } - /* No match found, return NULL */ - return nullptr; + /* No match found, return NULLPTR */ + return NULLPTR; } /** @@ -389,12 +389,12 @@ RTL::String::ReverseString(IN OUT PCHAR String, * Calculates the length of a given string. * * @param String - * Pointer to the null-terminated string to be examined. + * Pointer to the NULL-terminated string to be examined. * * @param MaxLength * Maximum number of characters to examine. If no limit set, it examines whole string. * - * @return The length of the null-terminated string. + * @return The length of the NULL-terminated string. * * @since: XT 1.0 */ @@ -406,7 +406,7 @@ RTL::String::StringLength(IN PCSTR String, SIZE_T Length; /* Check if NULL pointer passed */ - if(String == NULL) + if(String == NULLPTR) { return 0; } @@ -453,7 +453,7 @@ RTL::String::StringToWideString(OUT PWCHAR Destination, SIZE_T Count = Length; /* Check if NULL pointer passed */ - if(Destination == NULL) + if(Destination == NULLPTR) { /* No wide characters written */ return 0; @@ -466,7 +466,7 @@ RTL::String::StringToWideString(OUT PWCHAR Destination, if((*Destination = *LocalSource) == 0) { /* End of string reached */ - LocalSource = nullptr; + LocalSource = NULLPTR; break; } @@ -488,13 +488,13 @@ RTL::String::StringToWideString(OUT PWCHAR Destination, } /** - * Finds the next token in a null-terminated string. + * Finds the next token in a NULL-terminated string. * * @param String - * Pointer to the null-terminated string to tokenize. + * Pointer to the NULL-terminated string to tokenize. * * @param Delimiter - * Pointer to the null-terminated string identifying delimiters. + * Pointer to the NULL-terminated string identifying delimiters. * * @param SavePtr * Pointer to an object used to store routine internal state. @@ -513,18 +513,18 @@ RTL::String::TokenizeString(IN PCHAR String, CHAR Char, SpanChar; /* Check if there is anything to tokenize */ - if(String == NULL && (String = *SavePtr) == NULL) + if(String == NULLPTR && (String = *SavePtr) == NULLPTR) { /* Empty string given */ - return nullptr; + return NULLPTR; } /* Check non-delimiter characters */ Char = *String++; if(Char == '\0') { - *SavePtr = nullptr; - return nullptr; + *SavePtr = NULLPTR; + return NULLPTR; } Token = String - 1; @@ -542,7 +542,7 @@ RTL::String::TokenizeString(IN PCHAR String, if(Char == '\0') { /* End of string reached, no more tokens */ - String = nullptr; + String = NULLPTR; } else { @@ -615,7 +615,7 @@ RTL::String::ToUpperCharacter(IN CHAR Character) * Removes certain characters from a beginning of the string. * * @param String - * Pointer to the null-terminated string to be trimmed. + * Pointer to the NULL-terminated string to be trimmed. * * @return This routine returns a pointer to the left-trimmed string. * @@ -645,7 +645,7 @@ RTL::String::TrimLeftString(IN PCHAR String) * Removes certain characters from the end of the string. * * @param String - * Pointer to the null-terminated string to be trimmed. + * Pointer to the NULL-terminated string to be trimmed. * * @return This routine returns a pointer to the right-trimmed string. * @@ -678,7 +678,7 @@ RTL::String::TrimRightString(IN PCHAR String) * Removes certain characters from the beginning and the end of the string. * * @param String - * Pointer to the null-terminated string to be trimmed. + * Pointer to the NULL-terminated string to be trimmed. * * @return This routine returns a pointer to the trimmed string. * diff --git a/xtoskrnl/rtl/widestr.cc b/xtoskrnl/rtl/widestr.cc index a78e502..72fad65 100644 --- a/xtoskrnl/rtl/widestr.cc +++ b/xtoskrnl/rtl/widestr.cc @@ -132,10 +132,10 @@ RTL::WideString::CompareWideStringInsensitive(IN PCWSTR String1, * Appends a copy of the source wide string to the end of the destination wide string. * * @param Destination - * Supplies a pointer to the null-terminated wide string to append to. + * Supplies a pointer to the NULL-terminated wide string to append to. * * @param Source - * Supplies a pointer to the null-terminated wide string to copy from. + * Supplies a pointer to the NULL-terminated wide string to copy from. * * @param Count * Sets a maximum number of wide characters to copy. If no limit set, appends whole wide string. @@ -253,8 +253,8 @@ RTL::WideString::FindWideString(IN PCWSTR Source, /* Validate input parameters */ if(!Source || !Search) { - /* Invalid input parameters, return NULL */ - return nullptr; + /* Invalid input parameters, return NULLPTR */ + return NULLPTR; } /* Check if search string is empty */ @@ -287,8 +287,8 @@ RTL::WideString::FindWideString(IN PCWSTR Source, } } - /* No match found, return NULL */ - return nullptr; + /* No match found, return NULLPTR */ + return NULLPTR; } /** @@ -315,8 +315,8 @@ RTL::WideString::FindWideStringInsensitive(IN PCWSTR Source, /* Validate input parameters */ if(!Source || !Search) { - /* Invalid input parameters, return NULL */ - return nullptr; + /* Invalid input parameters, return NULLPTR */ + return NULLPTR; } /* Check if search string is empty */ @@ -350,8 +350,8 @@ RTL::WideString::FindWideStringInsensitive(IN PCWSTR Source, } } - /* No match found, return NULL */ - return nullptr; + /* No match found, return NULLPTR */ + return NULLPTR; } /** @@ -835,8 +835,8 @@ RTL::WideString::FormatArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context, GuidArg = VA_ARG(*ArgumentList, PGUID); } - /* Make sure a pointer to GUID is not NULL */ - if(GuidArg != NULL) + /* Make sure a pointer to GUID is not NULL pointer */ + if(GuidArg != NULLPTR) { /* Check if using uppercase format */ if(FormatProperties.Flags & PFL_UPPERCASE) @@ -967,7 +967,7 @@ RTL::WideString::FormatArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context, if(Specifier == L'n') { /* Make sure, that integer pointer parameter is not NULL */ - if(IntArg != (UINT_PTR)NULL) + if(IntArg != (UINT_PTR)NULLPTR) { /* Store number of characters written in integer pointer parameter */ *((PINT)(UINT_PTR)IntArg) = Context->CharactersWritten; @@ -1031,7 +1031,7 @@ RTL::WideString::FormatArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context, } /* Make sure a pointer to ANSI_STRING is not NULL */ - if(AnsiStrArg != NULL) + if(AnsiStrArg != NULLPTR) { /* Write formatted ANSI string value */ Status = WriteStringValue(Context, &FormatProperties, AnsiStrArg->Buffer, AnsiStrArg->Length); @@ -1053,7 +1053,7 @@ RTL::WideString::FormatArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context, } /* Make sure a pointer to UNICODE_STRING is not NULL */ - if(UnicodeStrArg != NULL) + if(UnicodeStrArg != NULLPTR) { /* Write formatted UNICODE string value */ Status = WriteValue(Context, &FormatProperties, UnicodeStrArg->Buffer, UnicodeStrArg->Length); @@ -1097,14 +1097,14 @@ RTL::WideString::FormatWideString(IN PRTL_PRINT_CONTEXT Context, ULONG Index; /* Make sure, that we have valid context and write routine */ - if(Context == NULL || Context->WriteWideCharacter == NULL) + if(Context == NULLPTR || Context->WriteWideCharacter == NULLPTR) { /* Invalid context or write routine not set */ return FALSE; } /* Check format string pointer */ - if(Format == NULL) + if(Format == NULLPTR) { /* Write null string */ Format = L"(null)"; @@ -1278,18 +1278,18 @@ RTL::WideString::ReverseWideString(IN OUT PWCHAR String, } /** - * Finds the next token in a null-terminated wide string. + * Finds the next token in a NULL-terminated wide string. * * @param String - * Pointer to the null-terminated wide string to tokenize. + * Pointer to the NULL-terminated wide string to tokenize. * * @param Delimiter - * Pointer to the null-terminated wide string identifying delimiters. + * Pointer to the NULL-terminated wide string identifying delimiters. * * @param SavePtr * Pointer to an object used to store routine internal state. * - * @return Pointer to the beginning of the next token or NULL if there are no more tokens. + * @return Pointer to the beginning of the next token or NULLPTR if there are no more tokens. * * @since: XT 1.0 */ @@ -1303,18 +1303,18 @@ RTL::WideString::TokenizeWideString(IN PWCHAR String, WCHAR Char, SpanChar; /* Check if there is anything to tokenize */ - if(String == NULL && (String = *SavePtr) == NULL) + if(String == NULLPTR && (String = *SavePtr) == NULLPTR) { /* Empty string given */ - return nullptr; + return NULLPTR; } /* Check non-delimiter characters */ Char = *String++; if(Char == L'\0') { - *SavePtr = nullptr; - return nullptr; + *SavePtr = NULLPTR; + return NULLPTR; } Token = String - 1; @@ -1332,7 +1332,7 @@ RTL::WideString::TokenizeWideString(IN PWCHAR String, if(Char == L'\0') { /* End of string reached, no more tokens */ - String = nullptr; + String = NULLPTR; } else { @@ -1405,7 +1405,7 @@ RTL::WideString::ToUpperWideCharacter(IN WCHAR Character) * Removes certain characters from a beginning of the wide string. * * @param String - * Pointer to the null-terminated wide string to be trimmed. + * Pointer to the NULL-terminated wide string to be trimmed. * * @return This routine returns a pointer to the left-trimmed wide string. * @@ -1435,7 +1435,7 @@ RTL::WideString::TrimLeftWideString(IN PWCHAR String) * Removes certain characters from the end of the wide string. * * @param String - * Pointer to the null-terminated wide string to be trimmed. + * Pointer to the NULL-terminated wide string to be trimmed. * * @return This routine returns a pointer to the right-trimmed wide string. * @@ -1469,7 +1469,7 @@ RTL::WideString::TrimRightWideString(IN PWCHAR String) * Removes certain characters from the beginning and the end of the wide string. * * @param String - * Pointer to the null-terminated wide string to be trimmed. + * Pointer to the NULL-terminated wide string to be trimmed. * * @return This routine returns a pointer to the trimmed wide string. * @@ -1486,12 +1486,12 @@ RTL::WideString::TrimWideString(IN PWCHAR String) * Calculates the length of a given wide string. * * @param String - * Pointer to the null-terminated wide string to be examined. + * Pointer to the NULL-terminated wide string to be examined. * * @param MaxLength * Maximum number of wide characters to examine. If no limit set, it examines whole string. * - * @return The length of the null-terminated wide string. + * @return The length of the NULL-terminated wide string. * * @since: XT 1.0 */ @@ -1503,7 +1503,7 @@ RTL::WideString::WideStringLength(IN PCWSTR String, SIZE_T Length; /* Check if NULL pointer passed */ - if(String == NULL) + if(String == NULLPTR) { return 0; } @@ -2876,7 +2876,7 @@ RTL::WideString::WriteStringValue(PRTL_PRINT_CONTEXT Context, XTSTATUS Status; /* Check for NULL string */ - if(String == NULL) + if(String == NULLPTR) { /* Print '(null)' instead */ String = "(null)"; @@ -2985,7 +2985,7 @@ RTL::WideString::WriteValue(PRTL_PRINT_CONTEXT Context, XTSTATUS Status; /* Check for NULL string */ - if(String == NULL) + if(String == NULLPTR) { /* Print '(null)' instead */ String = L"(null)";