Reputation: 13495
I have written a Windows service that I would like to keep Administrators from casually tampering with by removing their right to start/stop it.
Granted, an Administrator can elevate to SYSTEM and do anything they want, or even an admin can still suspend the service's threads or delete the service, but this is meant to prevent casual tampering.
I can do this using Process Explorer quite easily (see below) but I am not sure where to begin with Delphi. I've browsed the SetAcl C++ source code (and I may use their OCX file), but I'd prefer to use a native Delphi solution if one already exists. If not, I'll work on cloning SetAcl functionality.
Does anyone have experience with this that they could share?
NOTE: I had advocated a screen capture tool written in Delphi in this post and I am removing it b/c it is unrelated. I'm leaving this note here so the comments will still make sense! Regards.
Upvotes: 2
Views: 1250
Reputation: 69114
Administrators have rights on their computers, to do whatever they want. Are you asking for a way to change how Administrator rights work on a computer?
Any software that prevents administrators from "tampering" with something under their control sounds suspiciously like either a rootkit, or some other malevolent software. If the administrator wants your service off, you should provide your own quick tools to get it off, and you shouldn't (and probably can't) block them from doing it, either from Windows GUI or from SC.EXE or NET STOP on the command line.
That being said, if it's a Windows API you want a Delphi wrapper for, I would find the name of the API and search the JEDI API library for it. It looks like JWSCL would work.
Upvotes: 8