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