How to port legacy UMDF HID driver to UWD - windows

I am working on making the legacy HID driver written using UMDF UWD compliant.
I have gone through the MSDN documentation on writing the universal windows drivers and did not see any article on porting the existing legacy drivers to UWD.
Can someone help with the documentation on this ? or the approach to be taken ?

Related

How do I go about writing a driver using IOKit/DriverKit for MT6320 on an Azure Sphere Kit from MSFT?

Where are the step-by-step instructions to write a generic driver to a USB-connected developer board for MacOS using IOKit/DriverKit (publicly shown in WWDC 2019) in Xcode?
The only documentation I'm aware of is:
DriverKit reference
WWDC 2019 Session 702
The DriverKit version of IOKit is intended to have a similar API to the in-kernel IOKit, so I guess they expect you to be familiar with that.
Note that in many cases when writing drivers for USB devices, you don't need to use either DriverKit or a kext, and instead can use the userspace IOUSB libraries directly. You only really need to use DriverKit or a kext if the kernel is the consumer of your driver. You haven't said what your driver will do, so I can't say which is best in your case. DriverKit is still extremely limited, so unless you want to write a HID or serial port driver, there are few reasons to choose it at the moment.

What is the difference between a WDM driver, a KMDF driver and a UMDF driver?

When creating a Windows Driver project in Visual Studio 2012, you have many different options to choose from.
There's a page on MSDN that helps you with choosing the correct driver model for your device. It however doesn't clearly explain the exact differences between the WDM, KMDF and UMDF driver types, and when to choose which model.
I'm looking for an explanation on the differences between the WDM, KMDF and UMDF driver models, so it's easy for beginning Windows driver developers to choose the correct model.
In a nutshell:
WDM stands for Windows Driver Model. Every Kernel driver is essentially a WDM driver.
KMDF stands for Kernel Mode Driver Framework. This is a framework that encapsulates and hides many of the OS programming aspects that driver developer must relate to even if it has nothing to do with the business logic of his driver. Some functionality doesn't exist in KMDF framework and will require native Kernel calls without using the framework (but in most situations it's not the case).
UMDF stands for User Mode Driver Framework. It's a complementary framework to KMDF and together they comprise WDF (Windows Driver Frameworks). UMDF allows to create a driver in user mode, having all the benefits of User mode programming vs Kernel mode. Naturally, UMDF driver have limitations compared to KMDF/WDM drivers and in most situations it will require a Kernel counterpart with at least some functionality.
The page you've referenced is pretty comprehensive. You should dwell into it for deeper understanding.
I like articel from MSDN : Differences Between WDM and KMDF
WDM is the driver model since pnp device drivers (>=Win2k). In this model you have to handle functions not relevant to your functionality. Walter Oney (Programming the Microsoft Windows Driver Model) outsourced such functions to external device driver libraries for reusing.
WDF/kmdf tries to simplify the development of device drivers. Functions can be overwritten or default handler is used. The administration of memory and queues has been greatly simplified and secured.
UMDF tried to use similar function calls in user mode as function calls in kernel mode.
Hopefully not too late. Question date first seen when I had finished writing!

How do I write an OSX device driver for a USB WiMax modem?

I am planing to spend few days a week writing a driver for a Greenpacket USB WiMax modem. Greenpacket only provides Windows driver with it and as I am fond of Linux and Mac I feel very bad not having driver for them.
I have experience writing C++ programs so I think it won't be hard for me. Even I like C++ programming very much. I have never written drivers but I know some concepts. I have PDF of the device specification from the company's website.
I would like to ask if I can write driver with that provided specifications? If yes what would be my starting point assuming I would like to write it for MAC first and then Linux. I am reading this article right now but your experiences would be of great help.
The product specifications sheet does not provide enough data to write a device driver. You are going to need low-level information about how to speak with the WiMax device via USB. You are probably also way out of your depth of you think a product sheet is enough information to write a device driver.

Simulating a MIDI device - Windows

I need some advice on windows programming, MIDI and WDM. I am trying to write a small application that will sit in the sys tray and be advertised to the system as a MIDI In/Out device so that MIDI programs can send to it and it will convert the messages into a different format. I have been reading Cant's WDM book and scouring for information about writing device drivers, but don't know if I'm going down the right path.
I don't see yet how to:-
a) register my driver as MIDI capable (do I stick a ref to it in the registery and let the OS direct MIDI calls to the functionality in a dll?)
b) direct MIDI data through the my driver to my app, which is probably going to be too large to be a driver itself.
Any advice on where to start would be much appreciated.
thanks,
Pete
Windows MIDI drivers do not need to be implemented in the kernel, they can be implemented entirely in userspace as DLLs.
MSDN has some information about the functions you need to implement -
Audio Device Messages for MIDI - unfortunately it is somewhat lacking.
There used to be sample code for this kind of driver, as part of the NT4 DDK, but more recent releases of the DDK / WDK unfortunately don't include it any more.
Some better (though older) documentation and sample code can still be found after some searching:
Introduction to Multimedia Drivers (From NT4 DDK)
Sample MIDI Wine Driver for Mac OS X
Devices are enumerated (or simulated) by device drivers, not applications. What you see in the sys tray is an application icon. Hence, you will need to have both a driver and an app - you can't have one bit of compiled code acting as both.
On the driver side, you probably want to have a peek at the MSDN docs. This will answer part (a) of yopur question.
Assuming that you still would like to continue, (b) is best don by letting your application pull the data from the driver. That's far easier than the other way around - an application can trivially find a driver, but a driver has big problems finding a specific app (process)
If you are looking for a bit easier way to get started, there is a MIDI loopback driver out there, and the folks that make it also offer (or used to offer) a version of it that allows your program to communicate directly with the driver. This gives you the behavior you are looking for, where a program appears as a MIDI device. The loopback driver is at http://nerds.de/en/loopbe1.html. I don't see the developer page anymore, but if you contact them, you might be able to purchase a license to a driver that you can access directly without the loopback.

Unit testing kernel drivers

I'm looking for a testing framework for the Windows kernel environment. So far, I've found cfix. Has any one tried it? Are there alternatives?
Being the author of cfix, I might be a little biased here -- but as a matter of fact, I am currently not aware of any other unit-testing framework for NT kernel mode.
If you should experience any problems with cfix, feel free to contact me.
Microsoft Static Driver Verifier is described as "a compile-time tool that explores code paths in a device driver by symbolically executing the source code. SDV is a unit-testing tool for Microsoft Windows device drivers based on the Windows Driver Model (WDM)."
Is that what you're looking for?

Resources