Switch GUID specifier to %v and %V, thus allowing to write string with both lower and uppercase

This commit is contained in:
Rafal Kupiec 2024-02-17 22:52:49 +01:00
parent 430557e08f
commit 2dd4048416
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 20 additions and 5 deletions

View File

@ -138,7 +138,7 @@ BlEnumerateBlockDevices()
/* Print debug message */
BlDebugPrint(L"Found Hard Disk partition (DiskNumber: %lu, PartNumber: %lu, "
L"MBRType: %u, GUID: {%U}, PartSize: %uB)\n",
L"MBRType: %u, GUID: {%V}, PartSize: %uB)\n",
DriveNumber, PartitionNumber, HDPath->MBRType,
PartitionGuid, HDPath->PartitionSize * Media->BlockSize);
}

View File

@ -884,10 +884,15 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
FormatProperties.VariableType = Integer;
FormatProperties.Radix = 10;
break;
case L'U':
/* XTOS extension: UUID/GUID argument */
case L'v':
/* XTOS extension: UUID/GUID argument (lowercase) */
FormatProperties.VariableType = Guid;
break;
case L'V':
/* XTOS extension: UUID/GUID argument (uppercase) */
FormatProperties.VariableType = Guid;
FormatProperties.PrintUpperCase = TRUE;
break;
case L'x':
/* Unsigned integer argument as hexadecimal number (lowercase) */
FormatProperties.VariableType = Integer;
@ -968,9 +973,19 @@ RtlpFormatWideStringArgumentSpecifier(IN PRTL_PRINT_CONTEXT Context,
/* Make sure a pointer to GUID is not NULL */
if(GuidArg != NULL)
{
/* Check if using uppercase format */
if(FormatProperties.PrintUpperCase)
{
/* Use uppercase GUID format string */
WideStrArg = L"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X";
}
else
{
/* Use lowercase GUID format string */
WideStrArg = L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x";
}
/* Write formatted GUID string */
Status = RtlpWriteWideStringCustomValue(Context, L"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
GuidArg->Data1, GuidArg->Data2, GuidArg->Data3,
Status = RtlpWriteWideStringCustomValue(Context, WideStrArg, GuidArg->Data1, GuidArg->Data2, GuidArg->Data3,
GuidArg->Data4[0], GuidArg->Data4[1], GuidArg->Data4[2],
GuidArg->Data4[3], GuidArg->Data4[4], GuidArg->Data4[5],
GuidArg->Data4[6], GuidArg->Data4[7]);