The problem is related to executing the program (coded in AutoIt) with admin rights on Standard User Account (SUA). The program is initially started from the SUA as standard user, but after elevation, the program is actually running on Administrator type of account. Only the program GUI windows are displayed on the initial SUA. Administrator account, where the program is actually running, is determined by credentials written in the UAC prompt.
How can such a program check from what account (SID of that account is required) it was started if several users are actually logged in the computer?
It is rather easy to find out the SID of the current Administrator account where the elevated program is running, but it is harder to see backwards, because the program could be started initially from any actually logged SUA account.
I am thinking about finding the handle of the displayed window on SUA and using this information to find out the SID of SUA that hosts that handle.
Thanks, for any suggestions.