Multiple Programs Accessing a Driver

I have posted before about the non-PnP ISA driver that I’ve been working on off and on for the last few months. I have gotten the 32 bit version mostly working at this point. I can run the individual diagnostic apps that access the driver, but actual normal use of the driver is with a suite of programs.

The hardware is an 8 bit ISA card because that’s what the common bus was when the project was started. The applications were first released for Windows 2.0. Driving devices was more wild west then than it is now. But the applications live on because that is the way things happen with industrial systems.

I am currently working to replace all the old programs with one new program that does the bulk of the work with updated utilities. But it isn’t quite ready yet. To collect data you need to run a suite of programs at the same time, each of which can access the hardware. With the old ISA driver this worked fine.

With the new driver I can run any single app, but when I try to run a second app that accesses the driver, I get errors that the driver is denying permission to access.

All of the suite programs access the driver through a DLL which is used by all the apps. When an instance of the DLL is started, in DllMain->DLL_PROCESS_ATTACH a function is called that calls the CreateFile for the driver. CreateFile has FILE_SHARE_READ|FILE_SHARE_WRITE share permissions, but the second app can’t get access.

I’m guessing that there is something with the WDM structure that denies more than one app from accessing a driver at a time for security reasons? I’m checking to see if my guess is correct.

If so I guess the new driver isn’t going to work until I rewrite the code so it opens and closes the driver for each access rather than at app start.

Are you calling WdfDeviceInitSetExclusive? That’s how you trigger this behavior.

That was it! It works perfectly now!

It was a long haul to get the 32 bit driver working, but the 64 bit driver worked the first time without a hitch (once I got it installed). Now I have to figure out signing. I see there are some discussions here, I’ll look them over.

Thank you