From 5674e5d32b520ba8cca69843c736b69747406e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 2 Jan 2026 18:10:54 +0100 Subject: [PATCH] [BOOTVID][HAL][NTOS:INBV][NDK] *DisplayString(): Use a more suitable string pointer parameter type Use `PCSTR` for the type of the (Hal,Inbv,Vid)DisplayString() routines' `String` parameter, instead of `PCHAR` or `PUCHAR`, since it points to a NUL-terminated string. (The buffer isn't a counted string.) And improve SAL annotations along the way. --- drivers/base/bootvid/console.c | 4 +-- hal/halarm/generic/display.c | 22 ++++++------ hal/halx86/generic/display.c | 22 ++++++------ ntoskrnl/ex/init.c | 4 +-- ntoskrnl/inbv/bootanim.c | 2 +- ntoskrnl/inbv/inbv.c | 13 ++++--- sdk/include/ndk/halfuncs.h | 2 +- sdk/include/ndk/inbvfuncs.h | 2 +- sdk/include/ndk/inbvtypes.h | 2 +- sdk/include/reactos/drivers/bootvid/bootvid.h | 34 +++++++++---------- 10 files changed, 57 insertions(+), 50 deletions(-) diff --git a/drivers/base/bootvid/console.c b/drivers/base/bootvid/console.c index dcf77e6c73c..ac1425aa8ac 100644 --- a/drivers/base/bootvid/console.c +++ b/drivers/base/bootvid/console.c @@ -72,7 +72,7 @@ VidSetScrollRegion( VOID NTAPI VidDisplayStringXY( - _In_z_ PUCHAR String, + _In_ PCSTR String, _In_ ULONG Left, _In_ ULONG Top, _In_ BOOLEAN Transparent) @@ -96,7 +96,7 @@ VidDisplayStringXY( VOID NTAPI VidDisplayString( - _In_z_ PUCHAR String) + _In_ PCSTR String) { /* Start looping the string */ for (; *String; ++String) diff --git a/hal/halarm/generic/display.c b/hal/halarm/generic/display.c index 872f20c851a..66cb38c00ac 100644 --- a/hal/halarm/generic/display.c +++ b/hal/halarm/generic/display.c @@ -7,8 +7,6 @@ */ #include -#define NDEBUG -#include #include /* PUBLIC FUNCTIONS ***********************************************************/ @@ -18,7 +16,8 @@ */ VOID NTAPI -HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters) +HalAcquireDisplayOwnership( + _In_ PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters) { /* Stub since Windows XP implemented Inbv */ return; @@ -29,7 +28,8 @@ HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParamete */ VOID NTAPI -HalDisplayString(IN PCH String) +HalDisplayString( + _In_ PCSTR String) { /* Call the Inbv driver */ InbvDisplayString(String); @@ -40,10 +40,11 @@ HalDisplayString(IN PCH String) */ VOID NTAPI -HalQueryDisplayParameters(OUT PULONG DispSizeX, - OUT PULONG DispSizeY, - OUT PULONG CursorPosX, - OUT PULONG CursorPosY) +HalQueryDisplayParameters( + _Out_ PULONG DispSizeX, + _Out_ PULONG DispSizeY, + _Out_ PULONG CursorPosX, + _Out_ PULONG CursorPosY) { /* Stub since Windows XP implemented Inbv */ return; @@ -54,8 +55,9 @@ HalQueryDisplayParameters(OUT PULONG DispSizeX, */ VOID NTAPI -HalSetDisplayParameters(IN ULONG CursorPosX, - IN ULONG CursorPosY) +HalSetDisplayParameters( + _In_ ULONG CursorPosX, + _In_ ULONG CursorPosY) { /* Stub since Windows XP implemented Inbv */ return; diff --git a/hal/halx86/generic/display.c b/hal/halx86/generic/display.c index 449ddc2986d..9d398ea2d9b 100644 --- a/hal/halx86/generic/display.c +++ b/hal/halx86/generic/display.c @@ -7,8 +7,6 @@ */ #include -#define NDEBUG -#include #include /* PUBLIC FUNCTIONS **********************************************************/ @@ -18,7 +16,8 @@ */ VOID NTAPI -HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters) +HalAcquireDisplayOwnership( + _In_ PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters) { /* Stub since Windows XP implemented Inbv */ return; @@ -29,7 +28,8 @@ HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParamete */ VOID NTAPI -HalDisplayString(IN PCH String) +HalDisplayString( + _In_ PCSTR String) { /* Call the Inbv driver */ InbvDisplayString(String); @@ -40,10 +40,11 @@ HalDisplayString(IN PCH String) */ VOID NTAPI -HalQueryDisplayParameters(OUT PULONG DispSizeX, - OUT PULONG DispSizeY, - OUT PULONG CursorPosX, - OUT PULONG CursorPosY) +HalQueryDisplayParameters( + _Out_ PULONG DispSizeX, + _Out_ PULONG DispSizeY, + _Out_ PULONG CursorPosX, + _Out_ PULONG CursorPosY) { /* Stub since Windows XP implemented Inbv */ return; @@ -54,8 +55,9 @@ HalQueryDisplayParameters(OUT PULONG DispSizeX, */ VOID NTAPI -HalSetDisplayParameters(IN ULONG CursorPosX, - IN ULONG CursorPosY) +HalSetDisplayParameters( + _In_ ULONG CursorPosX, + _In_ ULONG CursorPosY) { /* Stub since Windows XP implemented Inbv */ return; diff --git a/ntoskrnl/ex/init.c b/ntoskrnl/ex/init.c index 16c0eb8d4a2..8c519df6493 100644 --- a/ntoskrnl/ex/init.c +++ b/ntoskrnl/ex/init.c @@ -1804,7 +1804,7 @@ Phase1InitializationDiscard(IN PVOID Context) if (NT_SUCCESS(Status)) { /* Display it */ - InbvDisplayString((PCHAR)MsgEntry->Text); + InbvDisplayString((PCSTR)MsgEntry->Text); } } } @@ -1824,7 +1824,7 @@ Phase1InitializationDiscard(IN PVOID Context) if (NT_SUCCESS(Status)) { /* Display it */ - InbvDisplayString((PCHAR)MsgEntry->Text); + InbvDisplayString((PCSTR)MsgEntry->Text); } /* Setup boot logging */ diff --git a/ntoskrnl/inbv/bootanim.c b/ntoskrnl/inbv/bootanim.c index e9fa08c51c8..2ea13d7ef71 100644 --- a/ntoskrnl/inbv/bootanim.c +++ b/ntoskrnl/inbv/bootanim.c @@ -452,7 +452,7 @@ static VOID NTAPI DisplayFilter( - _Inout_ PCHAR* String) + _Inout_ PCSTR* String) { /* Windows hack to skip first dots displayed by AUTOCHK */ static BOOLEAN DotHack = TRUE; diff --git a/ntoskrnl/inbv/inbv.c b/ntoskrnl/inbv/inbv.c index 31902337e15..1cfd5efefaa 100644 --- a/ntoskrnl/inbv/inbv.c +++ b/ntoskrnl/inbv/inbv.c @@ -333,26 +333,29 @@ InbvGetDisplayState(VOID) BOOLEAN NTAPI InbvDisplayString( - _In_ PCHAR String) + _In_ PCSTR String) { /* Make sure we own the display */ if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED) { /* If we're not allowed, return success anyway */ - if (!InbvDisplayDebugStrings) return TRUE; + if (!InbvDisplayDebugStrings) + return TRUE; /* Check if a filter is installed */ - if (InbvDisplayFilter) InbvDisplayFilter(&String); + if (InbvDisplayFilter) + InbvDisplayFilter(&String); /* Acquire the lock */ InbvAcquireLock(); /* Make sure we're installed and display the string */ - if (InbvBootDriverInstalled) VidDisplayString((PUCHAR)String); + if (InbvBootDriverInstalled) + VidDisplayString(String); /* Print the string on the EMS port */ HeadlessDispatch(HeadlessCmdPutString, - String, + (PVOID)String, strlen(String) + sizeof(ANSI_NULL), NULL, NULL); diff --git a/sdk/include/ndk/halfuncs.h b/sdk/include/ndk/halfuncs.h index 9ceb69de571..72232329a1b 100644 --- a/sdk/include/ndk/halfuncs.h +++ b/sdk/include/ndk/halfuncs.h @@ -59,7 +59,7 @@ NTHALAPI VOID NTAPI HalDisplayString( - _In_ PCHAR String + _In_ PCSTR String ); // diff --git a/sdk/include/ndk/inbvfuncs.h b/sdk/include/ndk/inbvfuncs.h index f09f99abdce..f918142248b 100644 --- a/sdk/include/ndk/inbvfuncs.h +++ b/sdk/include/ndk/inbvfuncs.h @@ -75,7 +75,7 @@ InbvIsBootDriverInstalled( BOOLEAN NTAPI InbvDisplayString( - _In_ PCHAR String + _In_ PCSTR String ); BOOLEAN diff --git a/sdk/include/ndk/inbvtypes.h b/sdk/include/ndk/inbvtypes.h index 20b0cf7f476..fa2365c06a6 100644 --- a/sdk/include/ndk/inbvtypes.h +++ b/sdk/include/ndk/inbvtypes.h @@ -48,7 +48,7 @@ BOOLEAN typedef VOID (NTAPI *INBV_DISPLAY_STRING_FILTER)( - _Inout_ PCHAR* String + _Inout_ PCSTR* String ); #endif diff --git a/sdk/include/reactos/drivers/bootvid/bootvid.h b/sdk/include/reactos/drivers/bootvid/bootvid.h index 4f2afde7aa0..8a51b3cf76c 100644 --- a/sdk/include/reactos/drivers/bootvid/bootvid.h +++ b/sdk/include/reactos/drivers/bootvid/bootvid.h @@ -22,15 +22,19 @@ NTAPI VidResetDisplay( _In_ BOOLEAN SetMode); -ULONG +VOID NTAPI -VidSetTextColor( - _In_ ULONG Color); +VidCleanUp(VOID); + +VOID +NTAPI +VidDisplayString( + _In_ PCSTR String); VOID NTAPI VidDisplayStringXY( - _In_z_ PUCHAR String, + _In_ PCSTR String, _In_ ULONG Left, _In_ ULONG Top, _In_ BOOLEAN Transparent); @@ -43,9 +47,17 @@ VidSetScrollRegion( _In_ ULONG Right, _In_ ULONG Bottom); +ULONG +NTAPI +VidSetTextColor( + _In_ ULONG Color); + VOID NTAPI -VidCleanUp(VOID); +VidBitBlt( + _In_ PUCHAR Buffer, + _In_ ULONG Left, + _In_ ULONG Top); VOID NTAPI @@ -57,18 +69,6 @@ VidBufferToScreenBlt( _In_ ULONG Height, _In_ ULONG Delta); -VOID -NTAPI -VidDisplayString( - _In_z_ PUCHAR String); - -VOID -NTAPI -VidBitBlt( - _In_ PUCHAR Buffer, - _In_ ULONG Left, - _In_ ULONG Top); - VOID NTAPI VidScreenToBufferBlt(