I have a NDIS driver, which gets listed both in connection properties's installed items list and in device manager; the question is, how do I write an extension which will be used for managing driver's properties, and how to install it?
Of course, a plain GUI program may communicate with the driver, set properties, get version numbers and other statistical info etc, that's what DeviceIoControl exists for; but, does this means that no dedicated interface exists to inform the driver about configuration changes?
It would be pleasant if someone can forward this question to eggheadcafe/osr's ntdev lists.
If you want your network driver to have some UI in the LAN Properties dialog, then you need to do these things:
Create a NotifyObject (if you don't have one already)
A NotifyObject is essentially a COM object associated with your driver. To make one,
DllGetClassObject
, a C++ class that inherits fromCComObjectRoot
andCComCoClass
, a call toOBJECT_ENTRY_AUTO
, and aBEGIN_COM_MAP
if you're new to COM.)ClsId={guid}
andComponentDll=filename
into your INF.Implement INetCfgComponentPropertyUi on your COM object
The key method is
MergePropPages
. In this method, you allocate propertysheet pages and merge them into the adapter properties. This operation looks something like this pseudocode:The API is meant to be transactional. Make sure to apply any changes in the
ApplyProperties
method, and (if applicable) undo them inCancelProperties
.QueryPropertyUi
orSetContext
, although you might want to save the context if you need to get the registry key location.Test your changes
If all goes well, then your new Notify Object will be loaded up every time there are any network configuration changes. If the GUI is being displayed, then Windows will query your class for the INetCfgComponentPropertyUi interface and call
MergePropPages
.I find it helpful to put hardcoded breakpoints in my DLL at key locations, and then attach a kernel debugger so that I can always find the DLL, no matter which process is loading it. (On Windows 7, you'll be loaded in drvinst.exe, which can be hard to find with a usermode debugger.)