QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Richard on December 19, 2020, 10:27:37 am

Title: User Account Control using QB64
Post by: Richard on December 19, 2020, 10:27:37 am
Anyone have any code or suggestions for Windows 10 x 64 (latest builds) for disabling User Account Control for a specific application (eg by defining a trusted shortcut).

Apparently it WAS possible using standard Windows security APIs and custom made algorithms to run single processes with direct access to Administrator Token without UAC prompt.

Apparently Windows 7 allowed this feature without software and also early versions of Windows 10.

Google searches resulted in software that does not work with recent windows 10 builds, and some people claiming "..." works but others say methods do not necessarily work with all apps. Windows Task Manager says "not allowed" for UAC change for a particular app I want to use. I am reluctant to download a 1 Gbyte Windows Assessment and Deployment Kit  application package from Microsoft (usually such large files do not work with my current version of windows) and indication from some people warn that it may not work.

Currently, in Windows 10 I have COMPLETELY disabled UAC for EVERYTHING - I would prefer to do so only for selected apps I have used many times and trusted.
Title: Re: User Account Control using QB64
Post by: zaadstra on January 02, 2021, 12:14:15 pm
It doesn't seem to be possible to allow selected programs to run elevated.

There are some tricks however.  Here is a page describing the thing:
https://answers.microsoft.com/en-us/windows/forum/windows_10-security-winpc/disabling-uac-approval-for-specific-programs-in/745a3740-679a-42f9-9c51-59475c9cd2ff?auth=1 (https://answers.microsoft.com/en-us/windows/forum/windows_10-security-winpc/disabling-uac-approval-for-specific-programs-in/745a3740-679a-42f9-9c51-59475c9cd2ff?auth=1)

The TaskSheduler trick might be an option:  https://www.winhelponline.com/blog/run-programs-elevated-without-getting-the-uac-prompt/ (https://www.winhelponline.com/blog/run-programs-elevated-without-getting-the-uac-prompt/)

Here is another trick, which I use to run a batch file auto elevated. This batch could start your program:
https://www.winhelponline.com/blog/automatically-elevate-batch-file-run-administrator/ (https://www.winhelponline.com/blog/automatically-elevate-batch-file-run-administrator/)

Hope this helps!
Title: Re: User Account Control using QB64
Post by: SMcNeill on January 02, 2021, 12:24:49 pm
https://www.qb64.org/forum/index.php?topic=1281.msg104858#msg104858

Look at the code at the link above.  It shows how to self-elevate a program.
Title: Re: User Account Control using QB64
Post by: SpriggsySpriggs on January 02, 2021, 08:15:54 pm
@Richard Just make sure you read the bit about the correct error level return code for that self elevating code that Steve is referencing. You will need to check what the return values are. Mine had 2 and 5. When I ran the code that was originally posted it made the program open up dozens of times before I could stop it.