TC beta installer and UAC

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

TC beta installer and UAC

Post by *DrShark »

There are some issues with Total Commander's new beta installer I reported by email, but their possible solution is on hold now because of undefined situation with UAC, at least as it is on my system.

* First, the description of the install process how it goes here on Vista 32-bit:
1. I start offline install using a beta 2 of installer (released at Oct. 23, 2019) which is placed near tcmain_950b4.inf and totalcmd950b4x32_64.cab using a command:
totalcmdbetainst_(beta_2).exe tcmain_950b4.inf

2. Because of Zone.Identifier stream in totalcmdbetainst_(beta_2).exe I get a Windows warning that the installer is downloaded from internet, there I agree to start the installer.

3. With chosen "Update installed version" option, progress goes to 100 %.

4. While the dialog with 100% progress is still open, I get the same dialog to start the installer as in step 2.
Christian Ghisler explained: in this case the installer is restarted with higher user rights to write TC uninstall information.

5. If I cancel the installer restart in that Windows dialog about program downloaded from internet,
I get the following Error dialog:

Code: Select all

---------------------------
Error!
---------------------------
Error running program:
<path_to_installer>\totalcmdbetainst_(beta_2).exe
---------------------------
ОК   
---------------------------
while progress window with 100% of install is still opened in background.

6. After I press OK in above Error dialog, I get a message about successful install:

Code: Select all

---------------------------
Installation Total Commander 9.50 beta 4  32+64bit
---------------------------
<localized with Windows UI language message about finished successful install>!
---------------------------
ОК   
---------------------------
Issues I see here:
1) before a dialog in step 4 appears, progress is already 100%. It should be 99% and switch to 100 if user either finished the process restarted with higher rights or cancel such restart;
2) the install error (which has critical error icon in msg box) in step 5 and following message about successful install in step 6 are confusing because they're telling opposite things to user. I think either TC shouldn't show that error in step 5 at all, or show it with warning icon instead of critical one, and the message in step 6 should write that install is successful but the installer couldn't write uninstall information.

* Now comes up the UAC problem I mentioned.
On my system, if I confirm the installer install in step 5 (Downloaded from Internet warning), I don't get elevation request which should ask whether to start the installer with higher user rights (UAC / elevation request). Installer just silently restarts (invisible window), does the job writing mentioned info to registry, and then I get a message telling install finished successfully.

Christian Ghisler wrote that to make any fixes to the installer behavior, installer needs to know whether UAC is enabled on a system.
So on my Vista 32-bit, Security Center from Control Panel shows that UAC is disabled.
However, the registry key EnableLUA, which should indicate UAC state, is set to 1, and it looks like it means the UAC is enabled: source

So the question is: what is a correct and reliable way to check the UAC state on Vista and newer Windows?
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48113
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC beta installer and UAC

Post by *ghisler(Author) »

1. It's odd that you get the UAC request, because the installer tries all operations as normal user before asking for admin rights. For example, to write the uninstall info to the registry, it calls RegCreateKeyEx. Only if that fails it launches the installer as administrator and tries again via that way.
So do you really have full admin rights?

2. I'm already checking the registry via EnableLUA:

Code: Select all

BOOL is_vista_UAC_enabled() {
  HKEY key;
  DWORD regType,regSize,LUA;
  BOOL result=is_Vista;
  if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
	  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_READ ,&key) == ERROR_SUCCESS) {
    regType=REG_DWORD;
    regSize=sizeof(DWORD);
    LUA=0;
    if (RegQueryValueEx(key, "EnableLUA", NULL, &regType, (LPBYTE)(&LUA), &regSize)== ERROR_SUCCESS)
      result=LUA!=0;
    RegCloseKey(key);
  }
  return result;
}
So I have the same question how to detect this.
Author of Total Commander
https://www.ghisler.com
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Re: TC beta installer and UAC

Post by *DrShark »

ghisler(Author) wrote: 2019-11-12, 21:03 UTC 1. It's odd that you get the UAC request, because the installer tries all operations as normal user before asking for admin rights.
I don't get an UAC request (a request for admin rightrs), here it's a Zone.Identifier=downloaded from internet request. After I agree to run installer in that dialog, installer restarts and silently does its job, quote from my above post:
DrShark wrote: 2019-11-12, 17:21 UTCOn my system, if I confirm the installer install in step 5 (Downloaded from Internet warning), I don't get an elevation request which should ask whether to start the installer with higher user rights (UAC / elevation request). Installer just silently restarts (invisible window), does the job writing mentioned info to registry, and then I get a message telling install finished successfully.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48113
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC beta installer and UAC

Post by *ghisler(Author) »

Yes, but you should never get that second launch at all when the installer has sufficient rights to do its work...
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9409
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: TC beta installer and UAC

Post by *Dalai »

There is no reliable way for programs to detect whether or not UAC is enabled. According to MS this is how it's designed, i.e. programs should work the same way regardless of UAC, or in other words programs should not behave differently when UAC is disabled.

IMO this only partially makes sense because there always are exceptions. Example: UAC is disabled, some function in a program requires administrator privileges and the program intends to start itself elevated, but since UAC is disabled, it fails to do so, and the cycle begins again, resulting in an infinite loop of the program launching itself (non-elevated)... Good call, MS! :evil: And, yes, I'm speaking from experience.

Even if UAC is enabled, there are several other reasons why writing to some directory or registry key might fail, mainly due to permissions.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Re: TC beta installer and UAC

Post by *DrShark »

ghisler(Author) wrote: 2019-11-12, 21:21 UTC Yes, but you should never get that second launch at all when the installer has sufficient rights to do its work...
Than it means there is some bug in installer: it thinks I have UAC enabled, and that's what is stated by EnableLUA key in my registry, while as I wrote the System Center shows UAC status as disabled, which seems to be true. So, there should be some way other than checking a state of EnableLUA key to know for sure whether UAC is actually enabled or disabled... Or, considering infomation Dalai wrote in above post, if it is true, the installer should handle that in some other way.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48113
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC beta installer and UAC

Post by *ghisler(Author) »

That's not the point here - the question is why it tries that at all! Are you able to write with regedit to
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Totalcmd
or do you get an error too?
Author of Total Commander
https://www.ghisler.com
User avatar
Dalai
Power Member
Power Member
Posts: 9409
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: TC beta installer and UAC

Post by *Dalai »

I suggest to remove the NTFS ADS by clicking "Allow" in the TC setup file's properties and run the setup again to see if that changes anything about the behavior.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Re: TC beta installer and UAC

Post by *DrShark »

ghisler(Author) wrote: 2019-11-13, 17:53 UTCAre you able to write with regedit to
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Totalcmd
or do you get an error too?
Yes, I tried to modify existing keys, and also to create and delete new keys there - no problem.

Some moments that may or may not be helpful:
1) if I start the installer using command line:
"totalcmdbetainst_(beta_2).exe" tcmain_950b5.inf
from cmd.exe, the initial Downloaded from Internet warning doesn't appear (what I described in step 2 in start post - there I started the installer this way from already launched TC). However, the window with that warning as request to re-launch the installer still appears during install process.
2) according to AceHelper, when that re-launch warning request appears, the other background TC windows has the strings:

Code: Select all

00040D46: Static "Установка файла:"
00060D44: Static "C:\<path_to_totalcmd>\TOTALCMD64.EXE.MANIFEST"
- it seems to mean that the Downloaded from Internet Warning with a request to relaunch the installer appeared after the file TOTALCMD64.EXE.MANIFEST has been copied by the installer to TC folder.
3) AceHelper and InqSoft WinScanner both tell that Downloaded from Internet warning request to relaunch the installer is not a window of separate process, but a child window of installer process.
4) I just tried again the stable installer for TC 9.22a: for it I get only 1 Downloaded from Internet warning, just when I launch it. It doesn't ask to re-launch itself during install process. So it seems it doesn't have this problem.
Dalai wrote: 2019-11-13, 20:12 UTC I suggest to remove the NTFS ADS by clicking "Allow" in the TC setup file's properties and run the setup again to see if that changes anything about the behavior.
If I'll remove that ADS, I won't get that warnings, but it won't help to solve the problem in the code of beta installer.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Re: TC beta installer and UAC

Post by *DrShark »

I tried 3rd beta of new installer (one with new certificate). Now at the moment when installer self re-launch happens, progress bar shows 99%, with text in progress window:

Code: Select all

007A0564: Static "Установка файла:"
00970C30: Static "HKEY_LOCAL_MACHINE:
Software\Microsoft\Windows\CurrentVersion\Uninstall\Totalcmd"
After user confirmed or canceled installer re-launch in Downloaded from Internet warning dialog, progress moves to 100%.

So here installer behavior is correct and expected now.

However, if to cancel the installer re-launch, the message box:

Code: Select all

---------------------------
Error!
---------------------------
Error running program:
<path_to_installer>\totalcmdbetainst_beta3.exe
---------------------------
ОК   
---------------------------
still has Error icon. Maybe it's better to use Warning icon here instead (see message icons guidelines and pictures at microsoft.com)? If Error icon is reasonable and intentional in this case, topic may be moved to Fixed bugs subforum.
Last edited by DrShark on 2019-11-27, 11:33 UTC, edited 1 time in total.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48113
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC beta installer and UAC

Post by *ghisler(Author) »

Well, it shows an error because it couldn't write the updated uninstall data to the registry.
Author of Total Commander
https://www.ghisler.com
Post Reply