How to detect UAC prompt appearance programmatically?

Herlin Drew 1 Reputation point
2020-08-10T02:39:10.337+00:00

Hello everyone,

This makes me stuck for a while. How do I detect UAC prompt appearing by Win32 C++ application on Windows 10(Home, Pro...19H2 and later)?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,697 questions
Windows 10 Security
Windows 10 Security
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
2,767 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Carl Fan 6,836 Reputation points
    2020-08-10T09:52:38.243+00:00

    Hi,
    Based on my search, Windows automatically elevates applications based on various criteria.
    Before a 32 bit process is created, the following attributes are checked to determine whether it is an installer:
    Filename includes keywords like "install," "setup," "update," etc.
    Keywords in the following Versioning Resource fields: Vendor, Company Name, Product Name, File Description, Original Filename, Internal Name, and Export Name.
    Keywords in the side-by-side manifest embedded in the executable.
    Keywords in specific StringTable entries linked in the executable.
    Key attributes in the RC data linked in the executable.
    Targeted sequences of bytes within the executable.
    So it seems related to application Manifest.
    For this issue, I suggest that you may post it to MSDN dev forum.

    The reason I we recommend posting appropriately is you will get the most qualified pool of respondents for Win32C++ issue.

    Best Regards,
    Carl


  2. Castorix31 81,831 Reputation points
    2020-08-12T03:57:33.867+00:00

    You can use SetWinEventHook with EVENT_SYSTEM_DESKTOPSWITCH (UAC, by default, uses the Secure Desktop)
    and test if the process consent.exe is running
    (tested on Windows 10, as Admin (Manifest with requireAdministrator) to detect consent.exe)

    0 comments No comments