Hi,
Is there a way to get the virtual key code from the scan code in a kb filter driver? I see there is a kbd.h and of course the scan codes are available in the KEYBOARD_INPUT_DATA. I don’t see any macros that would do the conversion (assuming I can get layout information from the registry).
Another question I have is the scan code mappings change from layout to layout, but do they change from device to device (at the level of a kbd class upper filter driver) or does any kind of normalization happen at a lower level to PS/2 scan codes or anything like that - is there any MSDN link on the subject?
Thanks,
Sonia.
VKs translation is handled much farther up the input stack based on the current session and app’s language. Why do you need VKs? What problem are you solving? No normalization happens in keyboard stacks, the scan codes are always the same regardless of mapping.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@symantec.com
Sent: Friday, October 18, 2013 1:58 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Virtual Key Codes
Hi,
Is there a way to get the virtual key code from the scan code in a kb filter driver? I see there is a kbd.h and of course the scan codes are available in the KEYBOARD_INPUT_DATA. I don’t see any macros that would do the conversion (assuming I can get layout information from the registry).
Another question I have is the scan code mappings change from layout to layout, but do they change from device to device (at the level of a kbd class upper filter driver) or does any kind of normalization happen at a lower level to PS/2 scan codes or anything like that - is there any MSDN link on the subject?
Thanks,
Sonia.
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Thanks very much for clarifying. I was playing with the kbfitler driver and wanted to see if there was a way to achieve the functionality of the MapVirtualKeyEx function at the level of the kb filter driver.
With regards to the scan codes, even if physical keyboard device changes or a new device is added (for example a PS/2 and a USB) -will the scan code values remain the same for both e.g a translates to 0x1234 for usb and ps/2 or could they be different?
The translation from scancode to VK happens at the virtualized keyboard, the virtualized keyboard is a merged stream of all physical keyboards. There is only one (per session) scan code->VK mapping active on keyboard . that mapping may change with focus changes, but there is one active at a time
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@symantec.com
Sent: Friday, October 18, 2013 2:19 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Virtual Key Codes
Thanks very much for clarifying. I was playing with the kbfitler driver and wanted to see if there was a way to achieve the functionality of the MapVirtualKeyEx function at the level of the kb filter driver.
With regards to the scan codes, even if physical keyboard device changes or a new device is added (for example a PS/2 and a USB) -will the scan code values remain the same for both e.g a translates to 0x1234 for usb and ps/2 or could they be different?
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Thanks - so I take it that the following is true:
- Each keyboard can have different scan codes.
- The VK-scan code mapping is specified in the dll specific to the hardware and is active when the keyboard is in focus.
- The VK-Scan code mapping also changes when the language/locale of the OS or keyboard layout changes
- The querying can happen only in user mode for the keyboard in focus
In kernel mode I can perhaps detect a new keyboard has been attached, but if I want to aquire the scan code for say the letter ‘a’ in the keyboard filter driver would I need for that keyboard to come in focus and have the Map function issued in user mode ? It perhaps looks like the only way.
Each time a new keyboard is plugged in I want to be able to get the scan code for the letter ‘a’ in kernel mode.
Why do you need to consume input in kernel mode?
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@symantec.com
Sent: Friday, October 18, 2013 2:55 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Virtual Key Codes
Thanks - so I take it that the following is true:
- Each keyboard can have different scan codes.
- The VK-scan code mapping is specified in the dll specific to the hardware and is active when the keyboard is in focus.
- The VK-Scan code mapping also changes when the language/locale of the OS or keyboard layout changes 4. The querying can happen only in user mode for the keyboard in focus
In kernel mode I can perhaps detect a new keyboard has been attached, but if I want to aquire the scan code for say the letter ‘a’ in the keyboard filter driver would I need for that keyboard to come in focus and have the Map function issued in user mode ? It perhaps looks like the only way.
Each time a new keyboard is plugged in I want to be able to get the scan code for the letter ‘a’ in kernel mode.
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Hi Dolan,
I am trying to see if I can detect a key stroke for example ‘a’ generically (using corresponding scan codes) accross keyboards and if any mapping is accessible in kernel mode.
Thanks,
Sonia
Why? What bigger problem are you trying to solve? Are you prompting the user for input during boot for instance?
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@symantec.com
Sent: Friday, October 18, 2013 4:00 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Virtual Key Codes
Hi Dolan,
I am trying to see if I can detect a key stroke for example ‘a’ generically (using corresponding scan codes) accross keyboards and if any mapping is accessible in kernel mode.
Thanks,
Sonia
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
There is no particular problem - this is to enhance my understanding in this space. It is an exercise I am inventing :).
It is kinda pointless, but OK. Typically “a” will almost always be the same scancode no matter the language, serendipity
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@symantec.com
Sent: Friday, October 18, 2013 4:21 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Virtual Key Codes
There is no particular problem - this is to enhance my understanding in this space. It is an exercise I am inventing :).
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Doron Holan wrote:
Why? What bigger problem are you trying to solve? Are you prompting the user for input during boot for instance?
Interesting side note. While looking into his problem, I happened to
come across a document from March 2000 entitled “Keyboard Scan Code
Specification”. Partway through, there is a section that says “Ten (10)
Windows Logo key combinations have been reserved for OEM use. These
keys can be used by OEMs to provide keyboard hotkey controls…”, and
the combinations are Win+0, Win+1, Win+2, etc through Win+9. I guess
that shows how fleeting these promises are, because that promise was
broken in Windows 7, and those ten key combinations are now usurped by
Windows. I know that, because I was using those as the shortcuts to
switch desktops in my virtual desktop app, and they all stopped working
when I recently upgraded to Win 7. There doesn’t seem to be any way to
wrestle control of these sequences away from Explorer.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
From that perspective, win8.1 is even worse. win+ combo is now taken up by the OS as far as I can tell.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Friday, October 18, 2013 4:41 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Virtual Key Codes
Doron Holan wrote:
> Why? What bigger problem are you trying to solve? Are you prompting the user for input during boot for instance?
Interesting side note. While looking into his problem, I happened to come across a document from March 2000 entitled “Keyboard Scan Code Specification”. Partway through, there is a section that says “Ten (10) Windows Logo key combinations have been reserved for OEM use. These keys can be used by OEMs to provide keyboard hotkey controls…”, and the combinations are Win+0, Win+1, Win+2, etc through Win+9. I guess that shows how fleeting these promises are, because that promise was broken in Windows 7, and those ten key combinations are now usurped by Windows. I know that, because I was using those as the shortcuts to switch desktops in my virtual desktop app, and they all stopped working when I recently upgraded to Win 7. There doesn’t seem to be any way to wrestle control of these sequences away from Explorer.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
—
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer