Skip to content

Commit 5674e5d

Browse files
committed
[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.
1 parent 3b33b10 commit 5674e5d

10 files changed

Lines changed: 57 additions & 50 deletions

File tree

‎drivers/base/bootvid/console.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ VidSetScrollRegion(
7272
VOID
7373
NTAPI
7474
VidDisplayStringXY(
75-
_In_z_ PUCHAR String,
75+
_In_ PCSTR String,
7676
_In_ ULONG Left,
7777
_In_ ULONG Top,
7878
_In_ BOOLEAN Transparent)
@@ -96,7 +96,7 @@ VidDisplayStringXY(
9696
VOID
9797
NTAPI
9898
VidDisplayString(
99-
_In_z_ PUCHAR String)
99+
_In_ PCSTR String)
100100
{
101101
/* Start looping the string */
102102
for (; *String; ++String)

‎hal/halarm/generic/display.c‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
*/
88

99
#include <hal.h>
10-
#define NDEBUG
11-
#include <debug.h>
1210
#include <ndk/inbvfuncs.h>
1311

1412
/* PUBLIC FUNCTIONS ***********************************************************/
@@ -18,7 +16,8 @@
1816
*/
1917
VOID
2018
NTAPI
21-
HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters)
19+
HalAcquireDisplayOwnership(
20+
_In_ PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters)
2221
{
2322
/* Stub since Windows XP implemented Inbv */
2423
return;
@@ -29,7 +28,8 @@ HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParamete
2928
*/
3029
VOID
3130
NTAPI
32-
HalDisplayString(IN PCH String)
31+
HalDisplayString(
32+
_In_ PCSTR String)
3333
{
3434
/* Call the Inbv driver */
3535
InbvDisplayString(String);
@@ -40,10 +40,11 @@ HalDisplayString(IN PCH String)
4040
*/
4141
VOID
4242
NTAPI
43-
HalQueryDisplayParameters(OUT PULONG DispSizeX,
44-
OUT PULONG DispSizeY,
45-
OUT PULONG CursorPosX,
46-
OUT PULONG CursorPosY)
43+
HalQueryDisplayParameters(
44+
_Out_ PULONG DispSizeX,
45+
_Out_ PULONG DispSizeY,
46+
_Out_ PULONG CursorPosX,
47+
_Out_ PULONG CursorPosY)
4748
{
4849
/* Stub since Windows XP implemented Inbv */
4950
return;
@@ -54,8 +55,9 @@ HalQueryDisplayParameters(OUT PULONG DispSizeX,
5455
*/
5556
VOID
5657
NTAPI
57-
HalSetDisplayParameters(IN ULONG CursorPosX,
58-
IN ULONG CursorPosY)
58+
HalSetDisplayParameters(
59+
_In_ ULONG CursorPosX,
60+
_In_ ULONG CursorPosY)
5961
{
6062
/* Stub since Windows XP implemented Inbv */
6163
return;

‎hal/halx86/generic/display.c‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
*/
88

99
#include <hal.h>
10-
#define NDEBUG
11-
#include <debug.h>
1210
#include <ndk/inbvfuncs.h>
1311

1412
/* PUBLIC FUNCTIONS **********************************************************/
@@ -18,7 +16,8 @@
1816
*/
1917
VOID
2018
NTAPI
21-
HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters)
19+
HalAcquireDisplayOwnership(
20+
_In_ PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters)
2221
{
2322
/* Stub since Windows XP implemented Inbv */
2423
return;
@@ -29,7 +28,8 @@ HalAcquireDisplayOwnership(IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParamete
2928
*/
3029
VOID
3130
NTAPI
32-
HalDisplayString(IN PCH String)
31+
HalDisplayString(
32+
_In_ PCSTR String)
3333
{
3434
/* Call the Inbv driver */
3535
InbvDisplayString(String);
@@ -40,10 +40,11 @@ HalDisplayString(IN PCH String)
4040
*/
4141
VOID
4242
NTAPI
43-
HalQueryDisplayParameters(OUT PULONG DispSizeX,
44-
OUT PULONG DispSizeY,
45-
OUT PULONG CursorPosX,
46-
OUT PULONG CursorPosY)
43+
HalQueryDisplayParameters(
44+
_Out_ PULONG DispSizeX,
45+
_Out_ PULONG DispSizeY,
46+
_Out_ PULONG CursorPosX,
47+
_Out_ PULONG CursorPosY)
4748
{
4849
/* Stub since Windows XP implemented Inbv */
4950
return;
@@ -54,8 +55,9 @@ HalQueryDisplayParameters(OUT PULONG DispSizeX,
5455
*/
5556
VOID
5657
NTAPI
57-
HalSetDisplayParameters(IN ULONG CursorPosX,
58-
IN ULONG CursorPosY)
58+
HalSetDisplayParameters(
59+
_In_ ULONG CursorPosX,
60+
_In_ ULONG CursorPosY)
5961
{
6062
/* Stub since Windows XP implemented Inbv */
6163
return;

‎ntoskrnl/ex/init.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,7 @@ Phase1InitializationDiscard(IN PVOID Context)
18041804
if (NT_SUCCESS(Status))
18051805
{
18061806
/* Display it */
1807-
InbvDisplayString((PCHAR)MsgEntry->Text);
1807+
InbvDisplayString((PCSTR)MsgEntry->Text);
18081808
}
18091809
}
18101810
}
@@ -1824,7 +1824,7 @@ Phase1InitializationDiscard(IN PVOID Context)
18241824
if (NT_SUCCESS(Status))
18251825
{
18261826
/* Display it */
1827-
InbvDisplayString((PCHAR)MsgEntry->Text);
1827+
InbvDisplayString((PCSTR)MsgEntry->Text);
18281828
}
18291829

18301830
/* Setup boot logging */

‎ntoskrnl/inbv/bootanim.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ static
452452
VOID
453453
NTAPI
454454
DisplayFilter(
455-
_Inout_ PCHAR* String)
455+
_Inout_ PCSTR* String)
456456
{
457457
/* Windows hack to skip first dots displayed by AUTOCHK */
458458
static BOOLEAN DotHack = TRUE;

‎ntoskrnl/inbv/inbv.c‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,26 +333,29 @@ InbvGetDisplayState(VOID)
333333
BOOLEAN
334334
NTAPI
335335
InbvDisplayString(
336-
_In_ PCHAR String)
336+
_In_ PCSTR String)
337337
{
338338
/* Make sure we own the display */
339339
if (InbvDisplayState == INBV_DISPLAY_STATE_OWNED)
340340
{
341341
/* If we're not allowed, return success anyway */
342-
if (!InbvDisplayDebugStrings) return TRUE;
342+
if (!InbvDisplayDebugStrings)
343+
return TRUE;
343344

344345
/* Check if a filter is installed */
345-
if (InbvDisplayFilter) InbvDisplayFilter(&String);
346+
if (InbvDisplayFilter)
347+
InbvDisplayFilter(&String);
346348

347349
/* Acquire the lock */
348350
InbvAcquireLock();
349351

350352
/* Make sure we're installed and display the string */
351-
if (InbvBootDriverInstalled) VidDisplayString((PUCHAR)String);
353+
if (InbvBootDriverInstalled)
354+
VidDisplayString(String);
352355

353356
/* Print the string on the EMS port */
354357
HeadlessDispatch(HeadlessCmdPutString,
355-
String,
358+
(PVOID)String,
356359
strlen(String) + sizeof(ANSI_NULL),
357360
NULL,
358361
NULL);

‎sdk/include/ndk/halfuncs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ NTHALAPI
5959
VOID
6060
NTAPI
6161
HalDisplayString(
62-
_In_ PCHAR String
62+
_In_ PCSTR String
6363
);
6464

6565
//

‎sdk/include/ndk/inbvfuncs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ InbvIsBootDriverInstalled(
7575
BOOLEAN
7676
NTAPI
7777
InbvDisplayString(
78-
_In_ PCHAR String
78+
_In_ PCSTR String
7979
);
8080

8181
BOOLEAN

‎sdk/include/ndk/inbvtypes.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ BOOLEAN
4848
typedef
4949
VOID
5050
(NTAPI *INBV_DISPLAY_STRING_FILTER)(
51-
_Inout_ PCHAR* String
51+
_Inout_ PCSTR* String
5252
);
5353

5454
#endif

‎sdk/include/reactos/drivers/bootvid/bootvid.h‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@ NTAPI
2222
VidResetDisplay(
2323
_In_ BOOLEAN SetMode);
2424

25-
ULONG
25+
VOID
2626
NTAPI
27-
VidSetTextColor(
28-
_In_ ULONG Color);
27+
VidCleanUp(VOID);
28+
29+
VOID
30+
NTAPI
31+
VidDisplayString(
32+
_In_ PCSTR String);
2933

3034
VOID
3135
NTAPI
3236
VidDisplayStringXY(
33-
_In_z_ PUCHAR String,
37+
_In_ PCSTR String,
3438
_In_ ULONG Left,
3539
_In_ ULONG Top,
3640
_In_ BOOLEAN Transparent);
@@ -43,9 +47,17 @@ VidSetScrollRegion(
4347
_In_ ULONG Right,
4448
_In_ ULONG Bottom);
4549

50+
ULONG
51+
NTAPI
52+
VidSetTextColor(
53+
_In_ ULONG Color);
54+
4655
VOID
4756
NTAPI
48-
VidCleanUp(VOID);
57+
VidBitBlt(
58+
_In_ PUCHAR Buffer,
59+
_In_ ULONG Left,
60+
_In_ ULONG Top);
4961

5062
VOID
5163
NTAPI
@@ -57,18 +69,6 @@ VidBufferToScreenBlt(
5769
_In_ ULONG Height,
5870
_In_ ULONG Delta);
5971

60-
VOID
61-
NTAPI
62-
VidDisplayString(
63-
_In_z_ PUCHAR String);
64-
65-
VOID
66-
NTAPI
67-
VidBitBlt(
68-
_In_ PUCHAR Buffer,
69-
_In_ ULONG Left,
70-
_In_ ULONG Top);
71-
7272
VOID
7373
NTAPI
7474
VidScreenToBufferBlt(

0 commit comments

Comments
 (0)