How to take console input in Native Application

Hi all,

I want to know how to take console input in Windows NTt Native Application. For Displaying string on the console I am using NTDisplayString function.

Prithvi.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

You have to enumerate *all* the keyboards on the system using the keboard device interface guid (in ntddkbd.h), open *each* keyboard using the GUID (and not \Device\KbdclassX), and poll each one by continuously sending IRP_MJ_READ to each keyboard. The buffer for each IRP_MJ_READ must be a multiple of sizeof(KEYBOARD_INPUT_DATA). You will get scan codes back. Scan codes are not the actual letters typed, you must have a mapping from scan codes -> keys in your driver. This means you must now also deal with multiple keyboard layouts if you care at all about internationalization.

Once you are done, you will have to close each device so that the raw input thread (the RIT) can open each keyboard later so that windows can process the keystrokes on its own.

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pruthviraj Kajale
Sent: Wednesday, December 21, 2005 12:45 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to take console input in Native Application

Hi all,
?
I want to know how to take console input in Windows NTt Native Application. For Displaying string on the console I am using NTDisplayString function.
?
?
?
Prithvi.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@microsoft.com To unsubscribe send a blank email to xxxxx@lists.osr.com

Also, Doron forgot to mention you have to handle headless operation where
there is no keyboard, and data is comming in from a serial port with a
special driver, see headless under
http://www.microsoft.com/whdc/system/platform/server/default.mspx


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

“Doron Holan” wrote in message
news:xxxxx@ntdev…
You have to enumerate all the keyboards on the system using the keboard
device interface guid (in ntddkbd.h), open each keyboard using the GUID
(and not \Device\KbdclassX), and poll each one by continuously sending
IRP_MJ_READ to each keyboard. The buffer for each IRP_MJ_READ must be a
multiple of sizeof(KEYBOARD_INPUT_DATA). You will get scan codes back.
Scan codes are not the actual letters typed, you must have a mapping from
scan codes -> keys in your driver. This means you must now also deal with
multiple keyboard layouts if you care at all about internationalization.

Once you are done, you will have to close each device so that the raw input
thread (the RIT) can open each keyboard later so that windows can process
the keystrokes on its own.

d

________________________________________
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pruthviraj Kajale
Sent: Wednesday, December 21, 2005 12:45 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to take console input in Native Application

Hi all,

I want to know how to take console input in Windows NTt Native Application.
For Displaying string on the console I am using NTDisplayString function.

Prithvi.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com — Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed to
ntdev as: xxxxx@microsoft.com To unsubscribe send a blank email to
xxxxx@lists.osr.com

I think this is an indirect way of saying “don’t write native NT apps”, or
at least ones that use keyboard input.

OP, what is your design? What makes you think you need to do this?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Wednesday, December 21, 2005 5:36 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to take console input in Native Application

You have to enumerate *all* the keyboards on the system using the keboard
device interface guid (in ntddkbd.h), open *each* keyboard using the GUID
(and not \Device\KbdclassX), and poll each one by continuously sending
IRP_MJ_READ to each keyboard. The buffer for each IRP_MJ_READ must be a
multiple of sizeof(KEYBOARD_INPUT_DATA). You will get scan codes back.
Scan codes are not the actual letters typed, you must have a mapping from
scan codes -> keys in your driver. This means you must now also deal with
multiple keyboard layouts if you care at all about internationalization.

Once you are done, you will have to close each device so that the raw input
thread (the RIT) can open each keyboard later so that windows can process
the keystrokes on its own.

d


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pruthviraj Kajale
Sent: Wednesday, December 21, 2005 12:45 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to take console input in Native Application

Hi all,
?
I want to know how to take console input in Windows NTt Native Application.
For Displaying string on the console I am using NTDisplayString function.
?
?
?
Prithvi.


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com — Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed to
ntdev as: xxxxx@microsoft.com To unsubscribe send a blank email to
xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Native NT apps are really rarely necessary. Sometimes this functionality is
embedded to the init paths of the Boot or System driver instead.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Arlie Davis”
To: “Windows System Software Devs Interest List”
Sent: Wednesday, December 21, 2005 8:03 PM
Subject: RE: [ntdev] How to take console input in Native Application

I think this is an indirect way of saying “don’t write native NT apps”, or
at least ones that use keyboard input.

OP, what is your design? What makes you think you need to do this?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Wednesday, December 21, 2005 5:36 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to take console input in Native Application

You have to enumerate all the keyboards on the system using the keboard
device interface guid (in ntddkbd.h), open each keyboard using the GUID
(and not \Device\KbdclassX), and poll each one by continuously sending
IRP_MJ_READ to each keyboard. The buffer for each IRP_MJ_READ must be a
multiple of sizeof(KEYBOARD_INPUT_DATA). You will get scan codes back.
Scan codes are not the actual letters typed, you must have a mapping from
scan codes -> keys in your driver. This means you must now also deal with
multiple keyboard layouts if you care at all about internationalization.

Once you are done, you will have to close each device so that the raw input
thread (the RIT) can open each keyboard later so that windows can process
the keystrokes on its own.

d

________________________________________
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pruthviraj Kajale
Sent: Wednesday, December 21, 2005 12:45 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to take console input in Native Application

Hi all,

I want to know how to take console input in Windows NTt Native Application.
For Displaying string on the console I am using NTDisplayString function.

Prithvi.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com — Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed to
ntdev as: xxxxx@microsoft.com To unsubscribe send a blank email to
xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com