How to put message on screen during Win2k text mode boot

Hello all:

This list provides a really useful service, and entertainment value as
well (as per the wide char print discussion :slight_smile:

I have a SCSI miniport driver for a RAID card. I want to put up a message
on the screen during the initialization of the driver when it has to
download new firmware to the card, which can take 30-60 seconds. Something
like what Soft-Ice does, which allows the user to press Esc to cancel
loading itself. How is this done (Alberto? any help?).

I remember reading somewhere about native Windows calls in some book like
Nebbett’s, but cannot find the code snippet how to do this.

Thanks, Greg

ZwDisplayString()

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Greg de Valois
Sent: Friday, April 18, 2003 12:05 PM
To: NT Developers Interest List
Subject: [ntdev] How to put message on screen during Win2k text mode
boot

Hello all:

This list provides a really useful service, and entertainment value as
well (as per the wide char print discussion :slight_smile:

I have a SCSI miniport driver for a RAID card. I want to put up a
message
on the screen during the initialization of the driver when it has to
download new firmware to the card, which can take 30-60 seconds.
Something
like what Soft-Ice does, which allows the user to press Esc to cancel
loading itself. How is this done (Alberto? any help?).

I remember reading somewhere about native Windows calls in some book
like
Nebbett’s, but cannot find the code snippet how to do this.

Thanks, Greg


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

I’ve got Nebbett’s book, found the reference to ZwDisplayString, but
cannot resolve symbol after declaring it as per the book (within extern
“C”), and linking to either ntdll.lib or ntoskrnl.lib.

Thanks for the lead though.

ZwDisplayString()

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Greg de Valois
Sent: Friday, April 18, 2003 12:05 PM
To: NT Developers Interest List
Subject: [ntdev] How to put message on screen during Win2k text mode
boot

Hello all:

This list provides a really useful service, and entertainment value as
well (as per the wide char print discussion :slight_smile:

I have a SCSI miniport driver for a RAID card. I want to put up a
message
on the screen during the initialization of the driver when it has to
download new firmware to the card, which can take 30-60 seconds.
Something
like what Soft-Ice does, which allows the user to press Esc to cancel
loading itself. How is this done (Alberto? any help?).

I remember reading somewhere about native Windows calls in some book
like
Nebbett’s, but cannot find the code snippet how to do this.

Thanks, Greg


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Try,

NTSYSAPI NTSTATUS NTAPI ZwDisplayString( PUNICODE_STRING Text );

Don Burn
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Greg de Valois”
To: “NT Developers Interest List”
Sent: Friday, April 18, 2003 6:39 PM
Subject: [ntdev] RE: How to put message on screen during Win2k text mode
boot

> I’ve got Nebbett’s book, found the reference to ZwDisplayString, but
> cannot resolve symbol after declaring it as per the book (within extern
> “C”), and linking to either ntdll.lib or ntoskrnl.lib.
>
> Thanks for the lead though.
>
> > ZwDisplayString()
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Greg de Valois
> > Sent: Friday, April 18, 2003 12:05 PM
> > To: NT Developers Interest List
> > Subject: [ntdev] How to put message on screen during Win2k text mode
> > boot
> >
> > Hello all:
> >
> > This list provides a really useful service, and entertainment value as
> > well (as per the wide char print discussion :slight_smile:
> >
> > I have a SCSI miniport driver for a RAID card. I want to put up a
> > message
> > on the screen during the initialization of the driver when it has to
> > download new firmware to the card, which can take 30-60 seconds.
> > Something
> > like what Soft-Ice does, which allows the user to press Esc to cancel
> > loading itself. How is this done (Alberto? any help?).
> >
> > I remember reading somewhere about native Windows calls in some book
> > like
> > Nebbett’s, but cannot find the code snippet how to do this.
> >
> > Thanks, Greg
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> You are currently subscribed to ntdev as: xxxxx@acm.org
> To unsubscribe send a blank email to xxxxx@lists.osr.com

Got it to link finally (operator error). But no ouput is produced at the
time of my driver load (SCSI miniport). Oh well, I guess I’ll have to do
what Soft-Ice does - map the memory directly.

Thanks for help all.

Try,

NTSYSAPI NTSTATUS NTAPI ZwDisplayString( PUNICODE_STRING Text );

Don Burn
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Greg de Valois”
> To: “NT Developers Interest List”
> Sent: Friday, April 18, 2003 6:39 PM
> Subject: [ntdev] RE: How to put message on screen during Win2k text mode
> boot
>
>
> > I’ve got Nebbett’s book, found the reference to ZwDisplayString, but
> > cannot resolve symbol after declaring it as per the book (within extern
> > “C”), and linking to either ntdll.lib or ntoskrnl.lib.
> >
> > Thanks for the lead though.
> >
> > > ZwDisplayString()
> > >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Greg de Valois
> > > Sent: Friday, April 18, 2003 12:05 PM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] How to put message on screen during Win2k text mode
> > > boot
> > >
> > > Hello all:
> > >
> > > This list provides a really useful service, and entertainment value as
> > > well (as per the wide char print discussion :slight_smile:
> > >
> > > I have a SCSI miniport driver for a RAID card. I want to put up a
> > > message
> > > on the screen during the initialization of the driver when it has to
> > > download new firmware to the card, which can take 30-60 seconds.
> > > Something
> > > like what Soft-Ice does, which allows the user to press Esc to cancel
> > > loading itself. How is this done (Alberto? any help?).
> > >
> > > I remember reading somewhere about native Windows calls in some book
> > > like
> > > Nebbett’s, but cannot find the code snippet how to do this.
> > >
> > > Thanks, Greg
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@acm.org
> > To unsubscribe send a blank email to xxxxx@lists.osr.com

You need to get a pointer to the function required to enable the display
string function (Max wrote these functions):

// Pointer to InbvEnableDisplayString function
typedef VOID (*INBV_ENABLE_DISPLAY_STRING)(BOOLEAN);

// Points to the real InbvEnableDisplayString function for this OS
version
// NULL if no such function
static INBV_ENABLE_DISPLAY_STRING InbvEnableDisplayStringProc;

DriverEntry(…)
{

RtlInitUnicodeString(&Str, L"InbvEnableDisplayString");
InbvEnableDisplayStringProc = MmGetSystemRoutineAddress(&Str);

}

// Acquires a boot-stage display for ZwDisplayString
VOID AcquireDisplay(VOID)
{
if( InbvEnableDisplayStringProc != NULL )
(InbvEnableDisplayStringProc)(TRUE);
// Do nothing
return;
}

// Release a boot-stage display for ZwDisplayString
VOID ReleaseDisplay(VOID)
{
if( InbvEnableDisplayStringProc != NULL )
(InbvEnableDisplayStringProc)(FALSE);
// Do nothing
return;
}

sample(PUNICODE_STRING MyString)
{

AcquireDisplay();
ZwDisplayString(MyString);
// Do as much display work as you like using ZwDisplayString()
// and release the display when you are done.
ReleaseDisplay();

}

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Greg de Valois
Sent: Friday, April 18, 2003 6:15 PM
To: NT Developers Interest List
Subject: [ntdev] RE: How to put message on screen during Win2k text mode
boot

Got it to link finally (operator error). But no ouput is produced at the
time of my driver load (SCSI miniport). Oh well, I guess I’ll have to do
what Soft-Ice does - map the memory directly.

Thanks for help all.

Try,

NTSYSAPI NTSTATUS NTAPI ZwDisplayString( PUNICODE_STRING Text );

Don Burn
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Greg de Valois”
> To: “NT Developers Interest List”
> Sent: Friday, April 18, 2003 6:39 PM
> Subject: [ntdev] RE: How to put message on screen during Win2k text
mode
> boot
>
>
> > I’ve got Nebbett’s book, found the reference to ZwDisplayString, but
> > cannot resolve symbol after declaring it as per the book (within
extern
> > “C”), and linking to either ntdll.lib or ntoskrnl.lib.
> >
> > Thanks for the lead though.
> >
> > > ZwDisplayString()
> > >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Greg de
Valois
> > > Sent: Friday, April 18, 2003 12:05 PM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] How to put message on screen during Win2k text
mode
> > > boot
> > >
> > > Hello all:
> > >
> > > This list provides a really useful service, and entertainment
value as
> > > well (as per the wide char print discussion :slight_smile:
> > >
> > > I have a SCSI miniport driver for a RAID card. I want to put up a
> > > message
> > > on the screen during the initialization of the driver when it has
to
> > > download new firmware to the card, which can take 30-60 seconds.
> > > Something
> > > like what Soft-Ice does, which allows the user to press Esc to
cancel
> > > loading itself. How is this done (Alberto? any help?).
> > >
> > > I remember reading somewhere about native Windows calls in some
book
> > > like
> > > Nebbett’s, but cannot find the code snippet how to do this.
> > >
> > > Thanks, Greg
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to
xxxxx@lists.osr.com
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@acm.org
> > To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

“HalDisplayString” works for me , no additional work to do. Just don’t forget a “\n” at the end of the string.

NTSYSAPI
VOID
NTAPI
HalDisplayString( PCHAR String );

Example : HalDisplayString ( “Hey folks, I am here \n” ) ;

Any objections ?

----- Original Message -----
From: “Jamey Kirby”
To: “NT Developers Interest List”
Sent: Saturday, April 19, 2003 3:35 AM
Subject: [ntdev] RE: How to put message on screen during Win2k text mode boot

> You need to get a pointer to the function required to enable the display
> string function (Max wrote these functions):
>
> // Pointer to InbvEnableDisplayString function
> typedef VOID (*INBV_ENABLE_DISPLAY_STRING)(BOOLEAN);
>
> // Points to the real InbvEnableDisplayString function for this OS
> version
> // NULL if no such function
> static INBV_ENABLE_DISPLAY_STRING InbvEnableDisplayStringProc;
>
> DriverEntry(…)
> {
> …
> RtlInitUnicodeString(&Str, L"InbvEnableDisplayString");
> InbvEnableDisplayStringProc = MmGetSystemRoutineAddress(&Str);
> …
> }
>
> // Acquires a boot-stage display for ZwDisplayString
> VOID AcquireDisplay(VOID)
> {
> if( InbvEnableDisplayStringProc != NULL )
> (InbvEnableDisplayStringProc)(TRUE);
> // Do nothing
> return;
> }
>
> // Release a boot-stage display for ZwDisplayString
> VOID ReleaseDisplay(VOID)
> {
> if( InbvEnableDisplayStringProc != NULL )
> (InbvEnableDisplayStringProc)(FALSE);
> // Do nothing
> return;
> }
>
> sample(PUNICODE_STRING MyString)
> {
> …
> AcquireDisplay();
> ZwDisplayString(MyString);
> // Do as much display work as you like using ZwDisplayString()
> // and release the display when you are done.
> ReleaseDisplay();
> …
> }
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Greg de Valois
> Sent: Friday, April 18, 2003 6:15 PM
> To: NT Developers Interest List
> Subject: [ntdev] RE: How to put message on screen during Win2k text mode
> boot
>
> Got it to link finally (operator error). But no ouput is produced at the
> time of my driver load (SCSI miniport). Oh well, I guess I’ll have to do
> what Soft-Ice does - map the memory directly.
>
> Thanks for help all.
>
> > Try,
> >
> > NTSYSAPI NTSTATUS NTAPI ZwDisplayString( PUNICODE_STRING Text );
> >
> >
> > Don Burn
> > Windows 2k/XP/2k3 Filesystem and Driver Consulting
> >
> > ----- Original Message -----
> > From: “Greg de Valois”
> > To: “NT Developers Interest List”
> > Sent: Friday, April 18, 2003 6:39 PM
> > Subject: [ntdev] RE: How to put message on screen during Win2k text
> mode
> > boot
> >
> >
> > > I’ve got Nebbett’s book, found the reference to ZwDisplayString, but
> > > cannot resolve symbol after declaring it as per the book (within
> extern
> > > “C”), and linking to either ntdll.lib or ntoskrnl.lib.
> > >
> > > Thanks for the lead though.
> > >
> > > > ZwDisplayString()
> > > >
> > > > -----Original Message-----
> > > > From: xxxxx@lists.osr.com
> > > > [mailto:xxxxx@lists.osr.com] On Behalf Of Greg de
> Valois
> > > > Sent: Friday, April 18, 2003 12:05 PM
> > > > To: NT Developers Interest List
> > > > Subject: [ntdev] How to put message on screen during Win2k text
> mode
> > > > boot
> > > >
> > > > Hello all:
> > > >
> > > > This list provides a really useful service, and entertainment
> value as
> > > > well (as per the wide char print discussion :slight_smile:
> > > >
> > > > I have a SCSI miniport driver for a RAID card. I want to put up a
> > > > message
> > > > on the screen during the initialization of the driver when it has
> to
> > > > download new firmware to the card, which can take 30-60 seconds.
> > > > Something
> > > > like what Soft-Ice does, which allows the user to press Esc to
> cancel
> > > > loading itself. How is this done (Alberto? any help?).
> > > >
> > > > I remember reading somewhere about native Windows calls in some
> book
> > > > like
> > > > Nebbett’s, but cannot find the code snippet how to do this.
> > > >
> > > > Thanks, Greg
> > > >
> > > > —
> > > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > > To unsubscribe send a blank email to
> xxxxx@lists.osr.com
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@acm.org
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@compaqnet.be
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

This list i found the internet:
NTSTATUS NTAPI BootPrint(IN PWSTR szMessage)
{
UNICODE_STRING us;
RtlInitUnicodeString(&us,szMessage);
return ZwDisplayString(&us);
}

ULONG Counter;
LARGE_INTEGER WaitTimeout;

HANDLE hFile;
UNICODE_STRING us;
IO_STATUS_BLOCK iosb;
BOOLEAN bAborted = FALSE;

RtlInitUnicodeString(&us, L"\Device\KeyboardClass0");
OBJECT_ATTRIBUTES oa = {sizeof(OBJECT_ATTRIBUTES), NULL, &us,
OBJ_CASE_INSENSITIVE};

BootPrint(L"Press any key to abort\n");

NTSTATUS ns = ZwCreateFile(&hFile, GENERIC_READ | SYNCHRONIZE |
FILE_READ_ATTRIBUTES, &oa, &iosb, 0, 0x80, 0, 1, 1, 0, 0);
if (ns >= 0)
{
UCHAR buf[12];
LARGE_INTEGER f;

while ((Counter–) && (!bAborted))
{
ns = ZwReadFile(hFile, 0, 0, 0, &iosb, buf, 12, &f, 0);

if (ns != STATUS_PENDING)
bAborted = TRUE;
else
{
BootPrint(L".");

ns = ZwWaitForSingleObject(hFile, FALSE, &WaitTimeout);

if (ns != STATUS_TIMEOUT)
bAborted = TRUE;
}
}

ZwClose(hFile);
}

if (bAborted)
BootPrint(L"Aborted\n");

Note that \device\keyboardclass0 is not necessarily the only keyboard on
the machine, nor is it guaranteed to even be a keyboard connected to the
machine. On many machines on, especially XP and beyond,
\device\keyboardclass0 is the RDP keyboard). This means the user won’t
be able to hit a key or have only one keyboard (either ps2 or usb) work.

You could enumerate all of the keyboard device interface instances
through IoGetDeviceInterfaces and read simultaneously from all the
enumerated keyboards instead of using a fixed device name.

D

This posting is provided “AS IS” with no warranties, and confers no
rights.

-----Original Message-----
From: Tiszai Istvan [mailto:xxxxx@axelero.hu]
Sent: Friday, April 18, 2003 11:15 PM
To: NT Developers Interest List

This list i found the internet:
NTSTATUS NTAPI BootPrint(IN PWSTR szMessage)
{
UNICODE_STRING us;
RtlInitUnicodeString(&us,szMessage);
return ZwDisplayString(&us);
}

ULONG Counter;
LARGE_INTEGER WaitTimeout;

HANDLE hFile;
UNICODE_STRING us;
IO_STATUS_BLOCK iosb;
BOOLEAN bAborted = FALSE;

RtlInitUnicodeString(&us, L"\Device\KeyboardClass0");
OBJECT_ATTRIBUTES oa = {sizeof(OBJECT_ATTRIBUTES), NULL, &us,
OBJ_CASE_INSENSITIVE};

BootPrint(L"Press any key to abort\n");

NTSTATUS ns = ZwCreateFile(&hFile, GENERIC_READ | SYNCHRONIZE |
FILE_READ_ATTRIBUTES, &oa, &iosb, 0, 0x80, 0, 1, 1, 0, 0);
if (ns >= 0)
{
UCHAR buf[12];
LARGE_INTEGER f;

while ((Counter–) && (!bAborted))
{
ns = ZwReadFile(hFile, 0, 0, 0, &iosb, buf, 12, &f, 0);

if (ns != STATUS_PENDING)
bAborted = TRUE;
else
{
BootPrint(L".");

ns = ZwWaitForSingleObject(hFile, FALSE, &WaitTimeout);

if (ns != STATUS_TIMEOUT)
bAborted = TRUE;
}
}

ZwClose(hFile);
}

if (bAborted)
BootPrint(L"Aborted\n");


You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi,

please note, you will need the TCB privilege and it is necessary to init
the text videomode before!
If not the system will crash! (Usually smss.exe will do that - I am still in
search for a soltuion on how to init the videomode itself.)

Happy Easter,

Oliver

Try,

NTSYSAPI NTSTATUS NTAPI ZwDisplayString( PUNICODE_STRING Text );

Don Burn
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Greg de Valois”
> To: “NT Developers Interest List”
> Sent: Friday, April 18, 2003 6:39 PM
> Subject: [ntdev] RE: How to put message on screen during Win2k text mode
> boot
>
>
> > I’ve got Nebbett’s book, found the reference to ZwDisplayString, but
> > cannot resolve symbol after declaring it as per the book (within extern
> > “C”), and linking to either ntdll.lib or ntoskrnl.lib.
> >
> > Thanks for the lead though.
> >
> > > ZwDisplayString()
> > >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Greg de Valois
> > > Sent: Friday, April 18, 2003 12:05 PM
> > > To: NT Developers Interest List
> > > Subject: [ntdev] How to put message on screen during Win2k text mode
> > > boot
> > >
> > > Hello all:
> > >
> > > This list provides a really useful service, and entertainment value as
> > > well (as per the wide char print discussion :slight_smile:
> > >
> > > I have a SCSI miniport driver for a RAID card. I want to put up a
> > > message
> > > on the screen during the initialization of the driver when it has to
> > > download new firmware to the card, which can take 30-60 seconds.
> > > Something
> > > like what Soft-Ice does, which allows the user to press Esc to cancel
> > > loading itself. How is this done (Alberto? any help?).
> > >
> > > I remember reading somewhere about native Windows calls in some book
> > > like
> > > Nebbett’s, but cannot find the code snippet how to do this.
> > >
> > > Thanks, Greg
> > >
> > > —
> > > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@acm.org
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@gmx.info
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


---------------------------------------------------
May the source be with you, stranger :wink:

Contacts / Kontakte
eMail: xxxxx@gmx.net|info|de|com
ICQ UIN #281645
AIM: “nixahnungnicht” & “nixlosheute”
Y! aka YIM: “sherlock_holmes_and_dr_watson”
MSNM (Passport): “xxxxx@ePost.de
http://assarbad.org & http://assarbad.net