Where are Windows 10 audio input device settings stored? - windows

I am developing an application that needs to programmatically DISABLE exclusive mode for a microphone so that it can always record. Apparently that setting is not stored in the registry, since I exported the registry before and after changing the setting, and the files were identical. Does anyone know where that setting is stored?
Specifically, I am speaking of the setting found thus:
right click the speaker icon in the task notification area
click Recording devices
click the device of interest
click Properties
click Advanced
uncheck Allow applications to take exclusive control ...
click Apply
click OK

Disclaimer: This is from Windows 7, not 10. But I imagine these settings did not change.
In the Local Machine hive, you'll need to go to this subkey: Software\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Capture
This will provide you with a list of subkeys that are GUIDs, one for each capture device on the machine. Each of those subkeys has a Properties subkey. That exposes the various settings for each microphone. The allow exclusive audio mode key is {b3f8fa53-0004-438e-9003-51a46e139bfc},3. It will need to be set to 0.
The problem you will run into is that these Capture device are owned by the SYSTEM user in the registry, and thus are difficult to modify as an executable/script run the by the user.
The proper way to do this is to use the MMDevice API (https://msdn.microsoft.com/en-us/library/windows/desktop/dd316556(v=vs.85).aspx). You can ask the API for all audio devices of a specific type, then iterate through them and find the one you want. You can then get properties for that device and simply change the value using the SetValue method. This automatically updates the registry.

Related

Where does "Bluetooth and other devices" get its information from?

I am writing C++ code for listing USB HID devices that uses HidD_GetProductString(). One particular device, despite the function's success, returns an empty string.
The classic Device Manager and gwmi in PowerShell both list the device using a generic name. However, Windows 10 Immersive Control Panel's Bluetooth and other devices window lists this device with its actual full name, which does not seem to appear anywhere. I did not find it in the registry either. I want to get access to this information.
Does anyone know where this app gets its information from?
My suspicion is that it gets it directly from the System process, which is also a holder of an open file handle to a device file, and perhaps it is the reason why the function returns an empty output. If so, how could I do it? Any suggestion is appreciated...

How to determine display - touch device associations for windows 10?

I am currently writing an application that receives touch input through the windows WM_INPUT messages and the HID API. Every touch point received has a handle to the device associated from which it came. This is the same device that the family of WM_POINTER messages would report for the same touch point. My application needs to know which monitor corresponds to a particular touch device. Is there a programmatic way to determine this? If I was using the WM_POINTER API I could use MonitorFromPoint or something similar.
In the control panel under "hardware and sound" there is a category "Tablet PC Settings". If you click this category, a dialog box launches which has a button "Setup". This button launches a calibration tool which allows you to pair a USB HID touch device with a monitor.
Does anyone know where these settings might be saved to?
relevant links:
structure received in WM_INPUT messages:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms645562(v=vs.85).aspx
Structure received in WM_POINTER messages:
https://msdn.microsoft.com/en-us/library/windows/desktop/hh454907(v=vs.85).aspx
Thanks.
A generic way to determine where things are stored in the registry, is to watch registry changes. Process Monitor from the Windows Sysinternals Suite by Mark Russinovich, can be used to watch and log changes to the windows registry. So you can start it logging, and then perform your calibration, and then stop and examine the log for the desired registry activity.
Here is a link to a similar question I asked
Associate HID Touch Device with Pnp Monitor.
In short, you can use the details from the HIDApi calls with queries of registry keys to link HID Touch Devices to monitors.

Setting driver group / icon

I'm writing a Windows driver. So far everything looks OK and the driver installs / works as desired. I can't figure out how to set driver group to one of the existing groups and icon-sets.
By driver group I mean the group that you see in Device Manager (Monitors, Network Adapters, Processors, Ports (COM & LPT), etc.)
Even if I write the same name, Device manager will create a new group:
[Strings]
ClassName="Keyboards"
Also, I found no way of setting the icon for my device. I tried setting Class to Keyboard, HIDClass, System, whatever, but the icon shown is always that of Network adapters.
[Version]
Class=SCSIAdapter ;System
How can I properly set the desired group and icon?
I know this post is a year old, but figured I would drop my thoughts for the benefit of future needs.
To achieve what you are trying to do, you need to specify both a Class and a ClassGuid for an inbox class within the Version section.
[Version]
Class=System
ClassGuid={4D36E97D-E325-11CE-BFC1-08002BE10318}
Note that you can not change name or the icon for inbox classes.
For the device icon you can easily set it using AddProperty directive within a DDInstall section. MSDN AddProperty Directive
The following is a quote from a post over on osronline.com from Doron Holan from Microsoft:
download.microsoft.com/download/a/f/7/af7777e5-7dcd-4800-8a0a-b18336565f5b/CustomIcon.doc
Abstract
{ This paper summarizes the steps device vendors take to customize device icons in My Computer, Autoplay, Device Manager, and New Hardware dialogs in the Microsoft Windows family of operating systems.
Specifying a per driver package icon
technet.microsoft.com/en-us/evalcenter/ff543520(v3Dvs.100).aspx
The DEVPKEY_DrvPkg_Icon device property represents a list of device icons that Windows uses to visually represent a device instance.

Setting mailto: protocol handler programmatically in Windows 8

Before Windows 8, the method of adding a mailto: protocol handler was straightforward (as outlined here Register Windows program with the mailto protocol programmatically)
As of Windows 8, the old method no longer works. It would seem that Win8 enforces the following key: HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\URLAssociations\‌​MAILTO\UserChoice.
It also appears the ProgID of the selected app is hashed and can't be forged, at least not that I can tell.
Does anyone have a working method for this, or can point me at a utility class/code that'll outline how to accomplish this programmatically?
For code, any language will do.
Edit
I've been asked from other discussions to specify a use-case, so I think it'd be helpful in the context of this question. Please consider this screenshot https://github.com/shellscape/Gmail-Notifier-Plus/raw/master/Promotional/prefs-account.png and the checkbox allowing the user to specify mailto handling. In this use-case, no one is forcing the user, the user is in control and makes the decision. While windows 8 store apps (metro/modern) have an available app manifest entry that automates the missing process described above, nothing seems to readily exist for desktop apps.
You can set your application to be activated by a custom protocol (like mailto:). When the user installs your app, if there is no other app supporting that protocol, they are not prompted and you are automatically assigned to that protocol.
If, however, the user already has an app that handles that protocol, then they will be prompted with a list of apps who support that protocol with the option to select the default. You cannot force the user to make a specific selection.
Also, if the user clicks on a protocol (like myprotocol:) and they have no app installed that handles that protocol then they will be sent to the store (app) which automatically searches for all apps that support that protocol. The user then installs whatever they want. You cannot force the user to make a specific selection (if any at all).
I wrote an article on protocol activation. It might be interesting to you: http://blog.jerrynixon.com/2012/10/walkthrough-using-windows-8-custom.html
So, I made Desktop Firefox my default mailto handler today in Windows 8 by adding the string value "mailto" to the HKCU\Software\Clients\StartMenuInternet\FIREFOX.EXE\Capabilities\URLAssociations and setting the value of "mailto" equal to the ProgID or "FirefoxURL". I then deleted the keys at HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\URLAssociations\‌​MAILTO\UserChoice to allow me to choose the default client again and this time Firefox was available for me to choose.
The essence of this question seems to be that one cannot take over the default client for any protocol anymore (post Windows 8). The user must choose. However, if you wanted to break the OS convention you could hook the call to create the choose default dialog, which would take research, effort, and be only a temporary kludge and would require "breaking" the OS, or you could send a double click to the dialog to choose for the user, assuming your program has elevated rights so that it can send clicks to Admin windows. That would probably be the easiest way, the user would never know what happened, just a quick flash. Really though, after registering itself as a protocol handler, I don't think any program should go beyond deleting the default protocol handler registry entry, thereby forcing the user to re-choose.
This is how to set mailto protocol manually and simply in Windows 8, 8.1, 2012, 2012R2
Add a new registry branch HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\mailto\UserChoice
Then click any mailto: link in your web browser, say IE
and finally there in a program list for you to choose which was not available before.
Also MAILTO appears in Control Panel\All Control Panel Items\Default Programs now. There is no other option to add/remove a protocol from there.
You can't have your app directly take over file associations anymore in Windows 8. There are guidelines for how to handle this for both Windows Store and desktop applications here: http://msdn.microsoft.com/en-us/library/windows/apps/hh700321.aspx

Installing Filter Drivers To An Existing Device

I am learning how to write a filter driver and is trying to install one on top an existing HID driver (mouse or keyboard) for practising. From what I understand, I should at least add an UpperFilters key to the hardware registry key. Is there anything else I should do?
When I use regedit to manually add an UpperFilters key to my target USB mouse device, regedit says It cannot create the key. I am suspecting regedit disallows modification to Windows provided device driver stack registry. Is there any other methods to install my filter driver to an existing device stack?
Windows 7 by default disallows modifications under the HKLM\SYSTEM\CurrentControlSet\Enum hierarchy for anyone but the SYSTEM account (i.e. not even the Administrators), so adding an UpperFilters key to a particular device manually isn't easy. However, from within an INF it should be easy.
However, if you want to filter all mice, you should add the UpperFilters key to the Mouse device class -- i.e. to HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E96F-E325-11CE-BFC1-08002BE10318}. This should be unhindered even on Windows 7, but normally you do this through an INF as well.
When writing the INF, you can add the FLG_ADDREG_APPEND (0x00000008) flag in the AddReg section so that your filter will be added to any other filters on the Mouse device class.
This driver filters input for a particular keyboard on the system. If you want to filter keyboard inputs from all the keyboards plugged into the system, you can install this driver as a class filter below the KbdClass filter driver by adding the service name of this filter driver before the KbdClass filter in the registry at:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96B-E325-11CE-BFC1-08002BE10318}\UpperFilters
See this page:
https://github.com/microsoft/Windows-driver-samples/blob/1fe4cc42bedfccb97a5b2cc169f9e5306d41d0de/input/kbfiltr/README.md

Resources