Setting driver group / icon - windows

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.

Related

How to identify correct Windows driver for generic wifi dongle

My intuition tells me someone, somewhere, must have answered this question before. Searching around I have not found it.
I have a freshly installed Windows 7 box (upgraded to Windows 10 to get the machine made eligible, now reinstalling). I have a cheap wifi dongle. I do not know the manufacturer, nor where the driver dvd is. Plugged into the machine running Linux, it just works. It is small, black, and has 802.11n printed on it in white writing, and there are no other identifying markers. (For reference, it looks a bit like one of these: http://www.dhgate.com/product/1pcs-mini-usb-wifi-adapter-802-11-b-g-n-wi/250459680.html)
How, in general, in Windows 7, do I identify the correct driver, and how to I obtain the correct driver?
Found it, ironically shortly after posting this question in frustration.
Go to Windows Device Manager (right click on Computer in start menu, select Properties, then select Device Manager on left pane).
Find the device in Other Devices, then select Properties
Go to details pane, select Hardware Ids from the property dropdown.
You will see, e.g. USB\VID_148F&PID_5370&REV_0101 -- take this string and put it into google, or another search engine.
That gives you a good chance of finding something. I found a .cab file via devid.info, copied it to the machine, extracted all the files to a folder, then in the Device Manager right click on the unknown device, click Update Driver Software, select the option to browse your machine, and point it to the folder you unpacked the drivers to.

Where are Windows 10 audio input device settings stored?

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.

Can I run my winRT application as a screensaver?

Is there a way to make my winRT application as a screen saver in xaml?
As Jerry says, there's no straightforward way to make a Windows Store app screensaver. However, there's a roundabout solution that might work for you on Windows 8, but not Windows RT. I have it nearly working. I'll share what I have so far.
A screensaver is just an executable with a .scr extension that's kept in C:\Windows\System32. For example, look at C:\Windows\System32\Bubbles.scr. The solution I have in mind is to create a .scr screensaver whose only purpose is to launch your Windows Store application, which you say will use XAML.
You can't launch a Windows Store app from the command line directly, so you'll create a launcher app. Take a look at a blog post called Automating the testing of Windows 8 apps by Ashwin Needamangala. Partway down the article, look for the section called Automating the activation of your app. It contains a sample C++ application which can launch Windows Store apps in the following way:
C:>Win8AppLaunch.exe Microsoft.BingNews_8wekyb3d8bbwe!AppexNews
The sample launcher on that page needs to be modified, but before you do that just copy the code into a C++ console app:
You're almost ready to test it out from the command line, but you need to specify the name of the app as an AppUserModelId. The details are in Ashwin's post, but to paraphrase you first want to allow the execution of PowerShell scripts on your system with:
PS C:> Set-ExecutionPolicy AllSigned
Then run this PowerShell script:
$installedapps = get-AppxPackage
foreach ($app in $installedapps)
{
foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
{
$app.packagefamilyname + "!" + $id
}
}
You might like running it in the Windows PowerShell ISE. It's pretty slick. Find the AppUserModelId of your app and then test Win8AppLaunch.exe from the command line, as shown above. This should launch your Windows Store app from command line.
Next, modify the C++ launcher to hard-code the AppUserModelId of your application instead of parsing it from a command line argument. I created a Gist of this. The important part is the line where I declare myApp.
Build the new executable, rename it MyScreenSaver.scr and put it in C:\Windows\System32. It will then appear in the Screen Saver Settings Control Panel. You can preview the screensaver there, and it works. However, if you wait for the screensaver to launch, it will briefly bring up a console window and never fully launch. I'm not sure why. I tried disabling the creation of the console window by switching the project to a Windows app, but that didn't help. You can try that yourself by changing Properties | Configuration | Linker | System | SubSystem to WINDOWS. It's a little more involved, as you'll also need to change the entry point from _tMain to _tWinMain. Contact me through my blog if you want the details. My StackOverflow profile lists it.
At this point it's almost fully working. You might try starting with a blank C++ screensaver that you know works, and then copy in the above code. If I get more time, maybe I'll try this myself.
Cool idea. But, no.
If you want your application to really do something for Windows other than run as a simple app, then you write an extension app. Here's the official word:
Extensions An extension is like an agreement between an app and Windows. Extensions lets app developers extend or customize standard Windows features primarily for use in their apps and potentially for use in other apps.
There are these types of extension apps right now:
Account picture provider (extension)
When users decide to change their account picture, they can either select an existing picture or use an app to take a new one. If your app can take pictures, you can use this extension to have Windows list your app in the Account Picture Settings control panel. From there, users can select it to create a new account picture. For more info about this extension, see the UserInformation reference topic. You can also check out our Account picture name sample.
AutoPlay (extension)
When the user connects a device to a computer, Windows fires an AutoPlay event. This extension enables your app to be listed as an AutoPlay choice for the one or more AutoPlay events.
Background tasks (extension)
Apps can use background tasks to run app code even when the app is suspended. Background tasks are intended for small work items that require no interaction with the user.
Camera settings (extension)
Your app can provide a custom user interface for selecting camera options and choosing effects when a camera is used to capture photos or video. For more info about this extension, see Developing Windows Store device apps for cameras.
Contact picker (extension)
This extension enables your app to register to provide contact data. Your app is included in the list of apps that Windows displays whenever the user needs access to their contacts.
For more info about this extension, see the Windows.ApplicationModel.Contacts.Provider reference topic. You can also check out Managing user contacts.
File activation (extension)
Files that have the same file name extension are of the same file type. Your app can use existing, well known file types, such as .txt, or create a new file type. The file activation extension enables you to define a new file type or register to handle a file type.
Game Explorer (extension)
Your app can register with Windows as a game. To do this, you must create a Game Definition File (GDF), build it as a binary resource in your app, and declare that resource in the package manifest.
Print task settings (extension)
You can design an app that displays a custom print-related user interface and communicates directly with a print device. When you highlight the features that are specific to a particular make and model of print device, you can provide a richer, more enhanced user experience.
Protocol activation (extension)
Your app can use existing protocols for communication, such as mailto, or create a custom protocol. The protocol activation extension enables you to define a custom protocol or register to handle an existing protocol.
SSL/certificates (extension)
Digital certificates are used to authenticate one entity to another. For example, certificates are often used to authenticate a user to web services over SSL. This extension enables you to install a digital certificate with your app.
cite: http://msdn.microsoft.com/en-us/library/windows/apps/hh464906.aspx
Unfortunately, nothing has to do with screen savers. The technical reason, at this time, you cannot write a Windows 8 app that functions as a screensaver is because Windows 8 apps are fundamentally tied to run inside the WinRT execution environment. That shell does not extend out past the Start menu in this current version of Windows. So, there's no way to execute outside - like as a screen saver. Screen savers are still built the "old fashion way".

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