Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UAC - A Required Privilege is not held by the Client

Status
Not open for further replies.

stanlyn

Programmer
Sep 3, 2003
945
US
Hi,

I need to change the local systems date and time from within my app. The article I'm using as a base is When I run it on Win10 I get "A required privilege is not held by the client" dialog. It does not ask to elevate. I have also need this functionality before, for writing to the registry's hkey\local machine and some other usages.

So, How do I elevate this so the process can run WITHOUT making security changes to the client's system. It is ok to ask the user for permission to elevate. Currently, I'm asking the user to change the date to current values. The purpose of this is to do it for them.

Thanks,
Stanley
 
I can see this useful in other more necessary situations, such as the need to install a driver or dependency.

Oh, you're way afield here. Drivers ABSOLUTELY should not be installed at runtime (and may not take effect until the user reboots anyway), and dependencies should be installed when your application is installed.

If you detect a deficiency, advise the user to reinstall which is a time when you may LEGITIMATELY fiddle with (and possibly mess up) their system.

You're looking for a magic ticket that flies in the face of sound software design.

 
Hi Dan and Olaf,

Dan said:
Drivers ABSOLUTELY should not be installed at runtime

Hey, didn't I say that already, that it should be done at install, and that was only suggested as a quick not-so-good example.

Why make this political? My question was not "do you think this is good or bad policy" as that is always subjective and depends on other factors. I was just trying to find out how to do it. Olaf and Mike did offer some suggestions and thanks for them.

Olaf said:
VFP embeds a standard manifest into EXEs you build, which states requested ExecutionLevel is "asInvoker", meaning no requirement, the process starts with whatever privileges the user has

Good place to start... Where can I find info that discusses this in detail?

Thanks,
Stanley
 
thread184-1694308

Again said: This manifest determines the behavior of your EXE at start. It will not tell the user why elevation is asked of him, and you can't do an elevation prompt just when needed in an already running process. So a strategy obviously will be telling the reasoning upfront and putting anything needing elevation in separate executables. The main point is not political, you let users learn things they should not do, because anyone can say "please confirm the elevation prompt coming up, because I want to fix something for you" and instead install a virus. Elevation should be exclusive to administrative tools and that many home users don't care to run on a non admin account was taken care of MS by moving the higher privileges to elevation, even whan running Windows as administrative user. That's why I never do such things and don't recommend them.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top