Error when using Run as Admininistrator from buttonbar

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
petermad
Power Member
Power Member
Posts: 16032
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Error when using Run as Admininistrator from buttonbar

Post by *petermad »

See: http://ghisler.ch/board/viewtopic.php?p=237888

I think it must be considered a bug, that a button with:
Command: notepad.exe
Parameters: hosts
Start path: %systemroot%\system32\drivers\etc

does not work when run as administrator.

Notepad opbviously think is has to open a file named hosts.txt and not just named hosts - but for some reason only when run as admin.

It does not happen when TC is started in elevated mode, so the txt extension must be somthing the UAC adds to the parameter? - but why doesn't it happen when the path and filename is stated in the command line? (see: http://ghisler.ch/board/viewtopic.php?p=237889 )
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

UAC will never modify command line, it doesn't know what it starts.

Notepad may try to open hosts.txt file when just hosts passed as parameter, that's why TC appends a dot to filename w/o extension on Shift+F4.

Also, Notepad may not append a dot if full path is passed, or a file with exact name exists. So it seems that problem is in working path which Notepad just can't find.
If you look, Notepad has working path C:\Windows\System32 instead of C:\Windows\System32\drivers\etc when it is started as administrator. It seems that problem is that path C:\Windows\System32\drivers\etc is invalid for 32-bit application... But maybe Notepad is able to handle non-redirected path correctly when it is passed as parameter.
User avatar
petermad
Power Member
Power Member
Posts: 16032
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Well, it might not be UAC that does it, but it might not be notepad.exe itself either:

If I copy notepad.exe from for example %systemroot% to for example %COMMANDER_PATH%\tools and use this button:

Command: %COMMANDER_PATH%\tools\notepad.exe
Parameters: hosts
Start path: %systemroot%\system32\drivers\etc

It works - also when run as administrator!

But if I use:
%systemroot%\notepad.exe (64bit)
%systemroot%\system32\notepad.exe (64bit)
%systemroot%\syswow64\notepad.exe (32bit)

as Command it doesn't work, like previously described.


There is a difference in the UAC dialog that pops up:

1. If I use %COMMANDER_PATH%\tools\notepad.exe the UAC dialog has a yellow background in the top part, and it says that the Publisher of notepad.exe is unknown.
2. If I use one of the 3 orginal notepad.exe's (fx. %systemroot%\notepad.exe), then there is a blue background in the top part of the UAC dialog, and is says that Microsoft Windows is the Approved Publisher of Notepad (not notepad.exe).
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50532
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This is unfortunately a bug in Windows - I can pass any path to the function, it's always ignored by windows and set to system32.
Author of Total Commander
https://www.ghisler.com
Post Reply