Author Topic: Quirky Administrator Mode  (Read 25145 times)

GrantSP

  • Active Member
  • ***
  • Posts: 92
    • View Profile
Quirky Administrator Mode
« on: March 29, 2012, 08:09:10 »
If I have 2 panels open, one showing a directory with only user rights (Folder1) and the other a directory under UAC e.g.(c:\Program Files(x86)\Some folder\) called (Folder2) strange options are provided.

1) If I try to move a file from Folder2 to Folder1 I am asked to enter Admin mode but it fails to provide it.
2) If I try to delete a file the same thing happens.
3) If I copy a file to the opposite panel and then edit it and try to copy it back I am asked for Admin mode and this time it is granted.
4) If I try to Move the file from Folder1 to Folder2 I am asked for Admin mode but again it is not granted.
5) If I right-click the file in Folder2 and select "Cut" and then right-click in Folder1 and select  "Paste" Admin mode is asked for but this time it is granted.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4484
    • View Profile
    • Multi Commander
Re: Quirky Administrator Mode
« Reply #1 on: March 29, 2012, 10:39:08 »
Strange.

If you start MultiCommander as administrator. Can you copy /delete the folder (without it asking for admin mode )
(The admin helper program get the same permissions as MultiCommander run as admin. and if MultiCommander can copy/delete the file then the admin helper should be able to. )

Folder 1 that only have user rights.. is it a normal user or system account ?

I wondering if it can be that the folder has permission for a user, that not even admin has access to until it has taken ownership of the folder.

I have to try to recreate that scenario later.


GrantSP

  • Active Member
  • ***
  • Posts: 92
    • View Profile
Re: Quirky Administrator Mode
« Reply #2 on: March 30, 2012, 01:26:00 »
Hey Matthias.

I just tried the suggestion you offered and yes all file operations act as they should.

Curiously I had selected in the "Core Settings" the three options under "Run As Administrator Mode". I assumed that meant whenever I started MultiCommander it would be in Admin mode. Apparently not.

I right-clicked on the Start menu selection for the program and selected "Run as Administrator" and I can see now on the title bar [Admin] before the program name, something which is not there when I start it normally.

I previously saw the small red background label with yellow text "Administrator Mode Active" at the bottom of the button bar and assumed that was the only indicator of Admin mode. This label only showed after your MCAdmin utility ran because of the dialog option "Retry as Administrator".

Now I'm wondering since MCAdmin is still active (it shows up as a process and the label is still active) why admin rights are not provided for further file operations?

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4484
    • View Profile
    • Multi Commander
Re: Quirky Administrator Mode
« Reply #3 on: March 30, 2012, 08:00:54 »
"Run As Administration Mode" mean that, even if you run as standard users you can do some admin tasks. Then a admin helper process will start and do that.

Kind of Windows Explorer. but with less UAC dialogs for every tasks. Because the MCAdmin (that is the Admin helper process) will stay alive for a while. It will automatically close when MC closes or it has been idle for a bit or if the user right click on the "admin mode active" banner in the status bar and selects to turn it off.

The MCAdmin process that get started get the same permission as if MultiCommander would have if you right clicked on it and selected "Run as administrator".
So if you select "retry as admin" to delete a file, and it fails. Then the question is, Can MultiCommander when started as Administrator delete it. If it can. Then there might be a error in MCAdmin.

When running MultiCommander in standard mode and you retry a operation as administrator and the MCAdmin process get started. It will not automatically retry all other failed operations as administrator unless the options for that in settings has been selected.  ("Automatically retry as administrator if administrator mode is already active")

GrantSP

  • Active Member
  • ***
  • Posts: 92
    • View Profile
Re: Quirky Administrator Mode
« Reply #4 on: March 31, 2012, 02:37:46 »
Mathias it looks the problem is in the MCAdmin utility then. All functionality is working properly if I start MultiCommander as Admin.

Only when I start as 'User' and then 'Retry as Administrator' when prompted does the quirky behaviour happen.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4484
    • View Profile
    • Multi Commander
Re: Quirky Administrator Mode
« Reply #5 on: March 31, 2012, 16:09:03 »
I was not able to recreate the delete issue (2) But I found a bug with MoveFile and that has now been fixed.

GrantSP

  • Active Member
  • ***
  • Posts: 92
    • View Profile
Re: Quirky Administrator Mode
« Reply #6 on: April 01, 2012, 03:50:22 »
Mathias thanks for the quick turn-around. I just upgraded to the Beta you updated v2.1.0 (build 1022).

I can narrow down the behaviour I described to only not working when using the internal operations provided by MultiCommander.
By that I mean if I hit the "F8", "Delete" or click the "Delete button" the operation asks for privileges but fails to provide them.
However if I invoke the right-click menu and select any command that requires Admin privileges the commands proceed as normal. Also I can 'Drag' files in and out of the folder as you would expect them to work.

The update you provided has fixed ALL problems with "Cut/Copy" or "Move" operations. Whether I use 'buttons', 'hotkeys', menu commands or right-click menus the operations work as they should.

Thank you.
Excellent work

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4484
    • View Profile
    • Multi Commander
Re: Quirky Administrator Mode
« Reply #7 on: April 01, 2012, 13:32:54 »
But you still have problem with the "delete" operation ?

I have not been able to recreate the problem you have with 'delete', Can you try to describe how I could recreate the delete problem.. if possible.


GrantSP

  • Active Member
  • ***
  • Posts: 92
    • View Profile
Re: Quirky Administrator Mode
« Reply #8 on: April 02, 2012, 03:48:35 »
Okay I'll see if I can explain this.

For the sake of this example I am using the Notepad++ default installation directory, but the same behaviour occurs with all folders under UAC.
On my machine it is [C:\Program Files (x86)\Notepad++\].

The folder has the following security applied to it, as listed on the 'Security' tab of the 'Properties' dialog:

CREATOR OWNER - Special Permissions - Allow
SYSTEM - Full Control, Modify, Read & Execute, List folder contents, Read, Write - Allow
Administrators - Full Control, Modify, Read & Execute, List folder contents, Read, Write - Allow
Users - Read & Execute, List folder contents, Read - Allow
TrustedInstaller - List folder contents, Special permissions - Allow

All files found under this directory have the following security applied to them:

SYSTEM
Administrators
Users

All with the same permissions as listed above (except 'List folder contents' of course as that doesn't apply to files).

Now if I start MultiCommander from the 'StartMenu' with 'Run as administrator' no problems occur. All file operations happen as they should.
If I start MultiCommander from the shortcut without admin privileges the following happens:

Using the 'Notepad++' directory as the example if I highlight the 'readme.txt' and hit "F8", "Del" or the "Delete (F8)" button I get your confirmation dialog box asking whether "Are you sure you want to remove the file to the Recycle Bin ?" The check box for 'Delete to Recycle Bin' is selected and the radio button option 'Remove link, not link target.' is also selected.
Now I press "Yes" and the 'Error' dialog box appears which says:

"Access denied while trying to delete the file 'readme.txt'.
It might be open by another program or you do not have permission to delete it."
It has the options "Retry as Administrator", "Retry", "Skip", "Skip All", "Cancel".

I then press "Retry as Administrator" and I am continually presented with the same dialog box and options as described above. All the while the bottom right hand corner shows a progress bar with 0% and another dialog box hidden behind the 'Error' dialog box which is labelled "Multi Commander" and it has the text "Preparing ...." and a progress bar, a label saying "0 of 1 items done" and 2 buttons 'Pause' and 'Abort'.

As I mentioned this results only when operating on a file with the coded commands. If I right-click and select "Cut" or "Delete" or if I drag the file out of the folder I am presented with Windows access control dialog and then the operations continue as expected.

Whatever you changed in your code that worked on the "Move" operation that now makes it work for me isn't being applied to your code that handles deletions. Though I don't see why that would be the case?

I hope it helps.
I'm not a coder but I do understand some principles about it. If you need any further information I'm only too happy to help.

And again, excellent work! Bravo.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4484
    • View Profile
    • Multi Commander
Re: Quirky Administrator Mode
« Reply #9 on: April 02, 2012, 08:04:22 »
Thanks.

I found what the problem is.. It is when doing delete using "Delete to Recycle Bin".
Permanently deleting the file works, But delete to recycle bin should also work.. I will try to fix that



GrantSP

  • Active Member
  • ***
  • Posts: 92
    • View Profile
Re: Quirky Administrator Mode
« Reply #10 on: April 06, 2012, 03:36:47 »
!!Splat!!

One bug officially crushed.
Thanks Mathias the new beta fixed it.

Excellent work.