I am digging through the WDF serial driver distributed with the WDK and have set some breakpoints to allow me to step through some PrepareHardware section.
In this section it supposedly checks a bunch of registry values (RxFIFO, TxFIFO, etc) and uses them if they exist in the registry, otherwise using some already determined defaults.
While stepping through I have noticed that none of the registry values are found, and all the defaults are used. Below is the approach used to query the registry for these values:
WdfDeviceOpenRegistryKey(WdfDevice, PLUGPLAY_REGKEY_DEVICE, STANDARD_RIGHTS_ALL, WDF_NO_OBJECT_ATTRIBUTES, &hKey);
WdfRegistryQueryULong( hKey, &valueName, Value);
Is there any way I can tell what the registry key being opened is given the WdfDevice object? When I ‘watch’ this object using WinDbg I don’t see any useful information.
I’m a little new to driver development for Windows still, so please forgive me if this is overwhelmingly simple.
The registry path is a parameter of DriverEntry. Put a KdPrint((“%wZ\n”,
RegistryPath)); in the beginning of the driver entry code and it will be
displayed.
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
wrote in message news:xxxxx@ntdev…
>I am digging through the WDF serial driver distributed with the WDK and
>have set some breakpoints to allow me to step through some PrepareHardware
>section.
>
> In this section it supposedly checks a bunch of registry values (RxFIFO,
> TxFIFO, etc) and uses them if they exist in the registry, otherwise using
> some already determined defaults.
>
> While stepping through I have noticed that none of the registry values are
> found, and all the defaults are used. Below is the approach used to query
> the registry for these values:
>
> WdfDeviceOpenRegistryKey(WdfDevice, PLUGPLAY_REGKEY_DEVICE,
> STANDARD_RIGHTS_ALL, WDF_NO_OBJECT_ATTRIBUTES, &hKey);
>
> WdfRegistryQueryULong( hKey, &valueName, Value);
>
> Is there any way I can tell what the registry key being opened is given
> the WdfDevice object? When I ‘watch’ this object using WinDbg I don’t see
> any useful information.
>
> I’m a little new to driver development for Windows still, so please
> forgive me if this is overwhelmingly simple.
>
xxxxx@hotmail.com wrote:
I am digging through the WDF serial driver distributed with the WDK and have set some breakpoints to allow me to step through some PrepareHardware section.
In this section it supposedly checks a bunch of registry values (RxFIFO, TxFIFO, etc) and uses them if they exist in the registry, otherwise using some already determined defaults.
While stepping through I have noticed that none of the registry values are found, and all the defaults are used. Below is the approach used to query the registry for these values:
WdfDeviceOpenRegistryKey(WdfDevice, PLUGPLAY_REGKEY_DEVICE, STANDARD_RIGHTS_ALL, WDF_NO_OBJECT_ATTRIBUTES, &hKey);
WdfRegistryQueryULong( hKey, &valueName, Value);
Is there any way I can tell what the registry key being opened is given the WdfDevice object? When I ‘watch’ this object using WinDbg I don’t see any useful information.
PLUGPLAY_REGKEY_DEVICE is the “hardware key” for this device, which will
be somewhere in CurrentControlSet\Enum. Each unique device instance has
its own key in this tree. If you go to Device Manager, find the device,
pick Properties, pick Details, and look at the Device Instance Id, that
should be the path of the key inside Enum.
The other common key is PLUGPLAY_REGKEY_DRIVER, which is the “software
key”. This is the driver’s associated key in the
CurrentControloSet\Services tree, and is shared among all devices that
use this driver.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
Thanks Tim!!
As for the ‘hardware key’ for the device can I add keys at installation time using my INF?
I am currently adding keys as follows:
HKR, Parameters\Wdf, DbgBreakOnError, 0x00010001, 1
However, it appears these are added as ‘software keys’ to:
CurrentControlSet\Services\Serial\Parameters\Wdf
If not, when/where do the keys in CurrentControlSet\Enum<device instance id> get created?
I have implemented an FPGA with a PCI core containing several UARTs and I would like to be able to maintain different FIFO trigger levels on a device specific basis. This looks like the appropriate way to do what I am looking to do, but need to be able to assign these keys appropriately prior to my driver querying these keys obviously.
Thanks again!
Yup. Just do so from within an ADDREG section referenced from your INF’s DDINSTALL.HW section.
Peter
OSR
> The other common key is PLUGPLAY_REGKEY_DRIVER, which is the "software
key". This is the driver’s associated key in the
CurrentControloSet\Services tree, and is shared among all devices that
use this driver.
No. PLUGPLAY_REGKEY_DRIVER is under CurrentControloSet\Control\Class, is
per-device, but destroyed on driver removal/reinstall.
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com