I didn't see my message or any replies so I'll try again with some
additional ideas.

I'm using a free Delphi component called SmallPort
(http://www.torry.net/quicksearchd.php?String=smallport) for direct access
to the LPT port under all versions of Windows from 95 to XP.

It is an optional feature in my app to switch pins on the LPT port high &
low which triggers external switch units.

Unfortunately it is not working under Vista unless I force administrator
privileges for my app.  It returns "Access is Denied".

For 95/98/ME it uses a supplied VXD driver. For NT/2000/XP it uses a
supplied .sys file which is loaded as a service.  It's using OpenSCManager,
CreateService (with the .sys file) and StartService.  Then it's using
CreateFile(PChar('\\.\'+ DriverName.sys)...

I know how to raise the privileges for the entire app using a manifest, but
only about 5% of my users will be using this facility so mandatory elevation
is not a solution.

I've never used services before so this is a bit beyond me.  I have a couple
of ideas in mind but I don't know if either will work.

1. Install this .sys file permanently as a service which starts when Windows
starts.  It's a tiny thing so it's hardly going to use any resources.  I
have no idea how to do this.

Then modify the component to only open the service rather than create it.
I'm still not sure if administrator access is required.  It could well be so
this may not work. ???

2. Move the service code into a separate executable which has an
administrator manifest and return the service handle back to the component
in my app to use as required.  I would use shared memory for this
communication.

The question is, would the handle be valid in another app running in a
different memory space?

Option 2 is not ideal as it would prompt to "Continue", or ask for an
administrators password every time the app starts if the user is using this
facility.  This prevents automatic starting at power up which many users
need as my app usually runs 24/7.

I would prefer a solution which does not require administrator rights if
possible.  I hope someone can help.

Thanks,
Ross.

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to