[DUG] SmallPort under Vista
Ross Levis
ross at stationplaylist.com
Fri May 11 16:43:54 NZST 2007
I'm not sure how I'm going to resolve this Vista issue.
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, etc.
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? I think it would be the address of the service in
memory which would be static for all apps, so this may work.
Option 2 is also 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.
I know some of you on this list create and use services so I'm interested to
hear your suggestions.
Thanks,
Ross.
More information about the Delphi
mailing list