how to Disable special keyboard keys? - windows

I'm looking for a script or a program that runs in background and blocks special keys on my keyboard (calculator, mute, etc) I have searched a lot on this on the internet but didn't found anything useful or working for me, I tried sharpkeys but didn't detected those keys on my keyboard, key id is 173 for mute on my keyboard and I can get others IDs if I find anything to block them with IDs.
P.S. I don't know much about programming and most likely don't know what I am doing, I'm looking for basic help from anyone. thank you!

TL;DR  To disable all "special keys" you could change the Human Interface Device Access Windows service startup type from Automatic to Manual (or Disabled in case there is some other software installed that causes it to still start when set to Manual). Caution: this may break other input devices if present, such as IR remote controls, or Airplane mode radio management.
For background, those "special keys" are technically called "consumer control buttons (CCB)" (see for example Keyboard Enhancements in Windows 8 and the linked .docx - nevermind that CCBs long predate Windows 8).
The CCBs are handled by the Human Interface Device Access Windows service, as described at Human Interface Device Access:
This service provides generic access to specific functions contained within controls collections on HID (Human Interface Devices). It enables the use of predefined hot buttons on keyboards, remote controls and other multimedia devices.
If the service is stopped or disable, the buttons on USB keyboards will not function (i.e., back, forward, volume up, down, previous track, next track), nor will the volume buttons on USB speakers.
To change the Human Interface Device Access (HidServ) startup mode, navigate to My Computer / Manage / Services and Applications / Services, double-click the Human Interface Device Access in the list, and change the Startup type to Manual or Disabled.

To disable special keyboard keys via registry on Windows 10 go to HKLM:\SYSTEM\CurrentControlSet\Services\hidserv and change "Start" DWORD value to 4. Once you restart the system, special function keys should be disabled.

Related

Writing a Linux driver for a weird keyboard

I own a keyboard that has an anti-ghosting mode.
It is toggled on/off using Fn+ScrollLock. When on, the codes sent are a bit different. The keyboard is still legitimate HID, but, for example, all modifier keys are seen by Linux as Shift and the actual modifier key is in another field of the event.
What I am looking for is either a ready driver (should someone happen to know about one) or some introduction to writing such input drivers. I do not know much about the ecosystem (evdev, libinput, etc.) and I do not even know where to start. If possible, the same driver should work both under X11 and under Wayland.
Just for the record, the keyboard's “shop” name is Modecom Volcano Gaming. The USB ID is258a:1006 and it is apparently not annotated in usb.ids. The keyboard works perfectly fine in both modes under Windows.

How to replace Windows 8 volume indicator overlay?

New to Windows 8 and 8.1 is a volume overlay that sits above all other windows, and displays for 3-5 seconds every time you press one of the special volume buttons present on many keyboards.
Please note that I am not talking about this:
But rather this:
Which appears in the top left corner of the monitor.
I would like an API or something that will disable the display of this indicator when volume buttons are pressed on the keyboard.
Does something like this exist? Programming language doesn't matter, as I can convert from whatever to whatever, but for reference I will be implementing this in C++
There is not a documented method for disabling the UI, and I'd expect that any technique for doing so would rely on potentially risky/unsupported APIs/techniques.
The UI is now provided by Microsoft to enable a standardized experience for volume control across all devices. Some applications like the Microsoft Music application expect the volume control to be present so that they appear together.
In Win 8.1, all Media handling support was moved to the SystemMediaTransportControls. An app has only a tiny bit of control over display: IsEnabled.
If possible, you might consider relying on the built in support -- as they're not likely to go away, and it's unlikely that you'll be able to control them in the manner you want.

How to disable the appearence of the taskbar when a USB is plugged?

I'm developing a software that should be able to "lock" the computer in it, so there will be no chance for any user to return to Windows and use other softwares except if he closes the software using a key (I guess this is what people call to operate in kiosk mode).
After much research I managed to disable Ctrl, Windows Key and Alt using hooks and registry files, so with this I could eliminate (I think) all ways of the user getting away from the software from the keyboard.
But now I found that if somebody plugs an USB device (e.g. a pendrive/data traveler), considering W7, the taskbar immediately apears alongside that traditional dialog where you can choose what you're going to do with the USB device you plugged (open its contents with Explorer, etc.), so somebody can go away from the software apart from the keyboard.
I would like to know how could I stop this, by code or registry (code would be much better!), so if somebody plugs a pendrive the taskbar don't appear and neither that dialog. If I can block USB input from thoose already used (by mouse and keyboard), that could also help.
Btw, if somebody knows of any other tricky way of going away from a kiosk-mode app, tell me!
Thanks,
Momergil
If you replace explorer.exe with your own application in the Shell value of the Winlogon registry key, your application will be started instead of Explorer. Then all you need to do is disable Task Manager, which can be done via a group policy setting.
The full path to the Winlogon key is
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Why don't you just stop explorer.exe, disable Ctrl+Alt+Delete and Ctrl+Shift+Esc to enter kiosk mode?

Low level keyboard hook

I just bought a new keyboard, and I'm interested in tracking exactly how many keypresses/strokes I make during the entire life of the keyboard. (I would want to just record keyUp, as I don't care about repeats)
I've been googling around for the best way to do this, but I don't even know what approach to take, so I'm having trouble searching intelligently.
Also, the only language I've really worked with is C#. Haven't done anything with C/C++ or WinAPI
Is it difficult to modify the Win 7 drivers directly?
I do want to be able to record keystrokes from the moment the computer boots, but this may not be easily done.
I would prefer to use an existing driver or hook, as I really don't care to get into learning device drivers right now.
I've looked briefly at Ctrl2Cap, but I don't know how to modify something like that to suit my case.
Other questions I looked at,
Writing a keyboard device driver
Low level keyboard Hook not at UI thread
This one indicates writing a USB Filter driver may work, but I have no clue where to start on that.
Disabling the keyboard in windows c++?
It is not necessary to go the driver route, which is not for the faint of heart. You can use use a low level keyboard hook which will work fine from .NET.
I did a quick bing and found the following on codeplex
http://globalmousekeyhook.codeplex.com/
It should get you going
If you want to do that you need to use Kernel Level Keylogger. It's grabs the keystrokes before the operating system takes effects and this one 99% invisible for detection techniques. Then you can grab the Windows Log On screen typed things like password/username etc.
#ChrisTaylor's key logger not work for WinLog-on Screen I reckon. If you can install the keyboard driver filter before the system keyboard device driver take a action you can handle windows user login screen also. But In order to install this driver level key hook you need to have administrator privileges.
I found Unix and Windows Keyloggers from Github. Free to play with this https://www.adlice.com/kernelmode-rootkits-part-3-kernel-filters/ and have fun!
That, what you want is dangerous!
With the same code everyone can create keylogger*
But if you not a virus creator then I recommend you to search "hotkeying in C/C++" or something like that and hook keyboard with hotkeys!
I have written HotKey Maker in VB6 which can make hotkey from every button of keyboard.
But I really not interested in viruses :)
Good Luck !
*Virus which hooks your keyboard and send all what you wrote in keyboard to Virus owner

Get Physical Keyboard Layout Programmatically

Is there a way to programmatically find out what kind of keyboard a computer has (i.e. where keys are located, and what extra keys are present in which locations)?
A little error is acceptable, if the keyboard is very non-standard, but in general, the point is to construct an on-screen keyboard-like application that can dynamically draw the keyboard layout on the screen, with high accuracy.
when connected to a computer, keyboards sends "scan codes" to the operating system. on windows, scan codes are then converted into virtual keys (a hardware independent mapping of the keyboard) then to real characters.
the MapVirtualKeyEx() function of the windows API allows you to translate between scan codes, virtual keys and characters. it should also be able to tell you if a key is non-existing.
together with GetKeyboardLayout() which tells you which keybaord is active at any point in time (keyboard layout can be different for different running applications), it should allow you to build a pretty accurate map of the keyboard.
anyway, have a look at the keyboard input section of the MSDN
i will add that all keyboards have almost the same layout. although there is no way to know where a key is physically located, you can probably guess from the scan code and basic knowledge of your own keyboards.
There is no mechanism by which a keyboard can tell Windows what its physical layout looks like. Easy to see with the Windows version of an on-screen keyboard, osk.exe. It seems to be able to guess the form-factor of the machine (laptop vs desktop) but on my laptop it doesn't match the layout of the keyboard.
Use the osk.exe layout as a template so nobody can complain that yours doesn't match well.

Resources