Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Multiple Programs Accessing a Driver

Bill_OlsonBill_Olson Member Posts: 77

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.

Comments

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 14,660

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

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • Bill_OlsonBill_Olson Member Posts: 77

    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

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 16-20 October 2023 Live, Online
Developing Minifilters 13-17 November 2023 Live, Online
Internals & Software Drivers 4-8 Dec 2023 Live, Online
Writing WDF Drivers 10-14 July 2023 Live, Online