I have a situation in which I have a driver, a DLL and one application which loads the DLL, all programmed by me. A second application also opens the DLL but its 3rd party software so I have no control over their code.
Both applications have to share the handles to the same object of the driver. So I have to instantiate the driver in the DLL, and duplicate the handles so that when the apps open the DLL they share handles to the same driver object.
The problem comes on starting and stopping the driver, because I need administrator rights to do that and my handle duplication then fails. I have tried changing the security to PROCESS_DUP_HANDLE and it failed anyway. It seems that a process with normal user rights cant duplicate handles from a process with administrator rights. Can it?
I can require adm rights on my app, but the client would need to open the 3rd party app by right clicking and selecting to open it with adm rights, which is no elegant solution.
So I am thinking about different ways to deal with this situation. Is it possible to start the driver without adm rights?
I heard that with named shared memory I wouldnt need to duplicate the handles, however I tried it and it did not work.
What other ways could I deal with this?
Thanks guys!
The problem revolves around your handle duplication scheme… so I have to ask the obvious question: Why go through this game of duplicating the handle? Why not simply let the third-party app open your device directly?
Peter
OSR
@OSRDrivers
See INF AddService directive, description of Security string, which sets permissions on the service, including who can start and stop it.
@PeterViscarola: I dont have acess to the 3rd party code to start the driver through it.
@AlexGrig: Thanks a lot, that should resolve my problems!
> The problem comes on starting and stopping the driver
Set it to Auto start on install and forget the idea of stopping/starting on demand.
–
Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com