tags:

views:

118

answers:

3

Hi,

I am having some trouble updating UMDF drivers using "devcon" during a standard code-deploy-debug cycle. The problem is that "devcon update" isn't really updating anything unless the version number or the date of the DLL file and the INF file has changed from what is stored in the system's driver cache folder. After a maddening series of experiments I've discovered that one way to force the thing to use the latest files is by doing the following:

  1. Change the parameters passed to "stampinf.exe" in "makefile.inc" by explicitly setting a version with the "-v" option.
  2. Modify the resource script file ("DRIVER_NAME.rc") to first define VER_USE_OTHER_MAJOR_MINOR_VER before including "ntverp.h" and then explicitly define VER_PRODUCTMAJORVERSION and VER_PRODUCTMINORVERSION. You'll note that this system does not allow us to change the build and the revision numbers. On Win7 this seems to be fixed at 7600 and 16385 in "ntverp.h". Is this by design?

So, I first modify "makefile.inc" and set the "-v" option to something like "1.1.7600.16385" manually incrementing the minor version for every single build and then modify the RC file and update VER_PRODUCTMINORVERSION with the same number.

Alternatively, if I run a command prompt under the SYSTEM account and go and delete the driver cache folder in "C:\windows\system32\DriverStore\FileRepository\DRIVER FOLDER" before running "devcon" then that works too.

Now, I am thinking I am missing something fairly basic here as this seems to be a rather painful way of doing it. Please help! Thanks!

+1  A: 

Why can't you just unplug the device and replace the unloaded DLL? You shouldn't need to reinstall the driver, just replace the module. Note that you shouldn't do this during production or anything that has to do with customers, but if you're writing a driver, just slam in the new module with the same version number.

On Win7 this seems to be fixed at 7600 and 16385 in "ntverp.h". Is this by design?

Yep, at least until the next service pack

Paul Betts
Well, the trouble is the system caches the driver files on the system (in "C:\windows\system32\DriverStore\FileRepository\" on Win7) and will not bother using the files from the source media unless the version of the DLL has changed. Removing the device (using "devcon remove") and adding it back has no effect as it still keeps the cached files. Looks like "removing" here simply means deleting the device node from the system device tree. So at this point, seems to me I really am stuck with one of the options I gave above. Sigh! If I figure something out, I'll post here.Thanks!
Ranju V
Don't bother with the one in the driver store, that's just a cached copy - just replace the one that's currently in-use. Disable the device in Device Manager, replace the DLL, then enable it again.
Paul Betts
Hmm. Why didn't I think of that? Probably because MSDN says the "right" way to do it is using a "devcon update" command and that kept picking the cached copy. What you're suggesting is waaay easier. I'll go home and give this a shot. Thanks! You de man!
Ranju V
So, the "Right" way is right - you shouldn't ever try to trick the driver store in production code or do anything I recommend here to your customers / users. But for your own dev box, it's fine. If your driver is in kernel mode, kd's .kdfiles command will let you do this on-the-fly
Paul Betts
No, this is for my dev box as I had mentioned in the question - for my normal build-deploy-debug cycle. And being a UMDF driver its in user mode.
Ranju V
A: 

As Paul Betts has suggested above, the way to go seems to be to simply replace the UMDF DLL directly in the driver folder (for e.g. c:\windows\system32\drivers\umdf\) after disabling the device either in the device manager or using "devcon". I'd asked this question on Microsoft's device drivers newsgroup before posting here but hadn't got a satisfactory response - but some folks ended up responding there after I posted here! So I'll put up a link to that post as well:

http://bit.ly/6PDxKT

Ranju V
A: 

hey guys ,

i'm a new developper of umdf driver! I need help! I take a sample of wdf! I compiled and install him! but i don't now how can i diplay the events! can you help me???

thanks you

maanifiik
This would be a separate question, it is not an answer to this question here. So better post it as a new, separate question, but be sure to make your problem clear and include all the details that could help to solve it, else you won't get good answers.
sth