Another Win7 (and possibly Vista) related Request

Features wanted...
Creat
Posts: 234
Joined: 22 Sep 2005 18:27

Another Win7 (and possibly Vista) related Request

Post by Creat »

As you probably know, some folders enjoy special protection under Win7. This includes the Program Folders and the Windows folder (for example). If a process is running with normal user-rights (default) it can see most of the content just fine, but if it copies something there it isn't actually copied to that folder. If you copy executables there, they will be placed there though (after UAC is assured I meant to do that).
This is especially problematic if you don't know about it and keep wondering why the hell a program can't find a configuration file (or similar) that according to XYplorer is clearly in the same folder. It's even worse when you have to handle Services (which automatically run with elevated rights) and their files with no real output for what's the problem. Took me ages to figure this out the first time around :)

A small example (with nice pictures :) ) to make the problem clear: I've compiled a recent version of the open source game called OpenTTD and wanted to copy this to my Program Files folder. It consists of an executable and quite a few other files that surround it and are required to be in sub-folders beside the exe. Obviously I drag the folder containing the executable and the other folders over to my Program Files folder (right-drag, "copy here as", entering "OpenTTD Test"). Now I get asked by UAC for permission to copy to the folder "OpenTTD Test", I confirm. Seconds later I get the question that "OpenTTD Test" doesn't exist and if I want to create it, again I confirm. Everything seems fine now, XYplorer shows me this:
XYplorer folder view.jpg
Trying to start the game causes it to complain about missing language files though, which clearly seem to be there. Having a look in Explorer reveals the problem:
Explorer View.jpg
Things get even weirder when you delete that folder. First UAC asks for confirmation (which I give) and deletion seems to succeed, but now all files but the exe are still there (because they are somewhere else ;) ), deleting the folder again (obviously no confirmation this time) causes them to disappear.

EDIT: Forgot to mention, the actual location of the files is here:
C:\Users\[username]\AppData\Local\VirtualStore\Program Files\
To see the attached files, you need to log into the forum.

admin
Site Admin
Posts: 66351
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Another Win7 (and possibly Vista) related Request

Post by admin »

Creat wrote:If a process is running with normal user-rights (default) it can see most of the content just fine, but if it copies something there it isn't actually copied to that folder. If you copy executables there, they will be placed there though ...
Sounds perfectly crazy to me.

I'll care for these OS enhancements once I have Win7.

nas8e9
Posts: 2232
Joined: 21 Jun 2008 14:50

Re: Another Win7 (and possibly Vista) related Request

Post by nas8e9 »

Creat wrote:As you probably know, some folders enjoy special protection under Win7. This includes the Program Folders and the Windows folder (for example). If a process is running with normal user-rights (default) it can see most of the content just fine, but if it copies something there it isn't actually copied to that folder. If you copy executables there, they will be placed there though (after UAC is assured I meant to do that).
This is especially problematic if you don't know about it and keep wondering why the hell a program can't find a configuration file (or similar) that according to XYplorer is clearly in the same folder. It's even worse when you have to handle Services (which automatically run with elevated rights) and their files with no real output for what's the problem. Took me ages to figure this out the first time around :)

A small example (with nice pictures :) ) to make the problem clear: I've compiled a recent version of the open source game called OpenTTD and wanted to copy this to my Program Files folder. It consists of an executable and quite a few other files that surround it and are required to be in sub-folders beside the exe. Obviously I drag the folder containing the executable and the other folders over to my Program Files folder (right-drag, "copy here as", entering "OpenTTD Test"). Now I get asked by UAC for permission to copy to the folder "OpenTTD Test", I confirm. Seconds later I get the question that "OpenTTD Test" doesn't exist and if I want to create it, again I confirm. Everything seems fine now, XYplorer shows me this:
XYplorer folder view.jpg
Trying to start the game causes it to complain about missing language files though, which clearly seem to be there. Having a look in Explorer reveals the problem:
Explorer View.jpg
Things get even weirder when you delete that folder. First UAC asks for confirmation (which I give) and deletion seems to succeed, but now all files but the exe are still there (because they are somewhere else ;) ), deleting the folder again (obviously no confirmation this time) causes them to disappear.

EDIT: Forgot to mention, the actual location of the files is here:
C:\Users\[username]\AppData\Local\VirtualStore\Program Files\
I suspect that this has to do with Windows's Folder Virtualization, introduced in Vista. Basically, %ProgramFiles% can't be written to by standard users, breaking programs that store data in their program folder. In order to allow such programs to run, Windows redirects their writes to \Users\[UserName]\Appdata\Local\VirtualStore\Program Files\[FolderName]. In folders where such a redirection has happened, Windows Explorer shows an extra button labeled Compatibility Files which switches to the folder where the writes were redirected to.

By way of a workaround, quit XYplorer and restart by right-clicking its shortcut and selecting Run as administrator. XYplorer then works with full rights and can do wites to protected folders without triggering redirection.

When tricking XYplorer out for Windows 7 (and Vista), the above-mentioned Compatibility Files-button would be a boon... :)

Edit:

Based on what I'm seeing on my Windows 7 x64-computer, folder virtualization happens for 4 folders:
- \Program Files
- \Program Files (x86) (on 64-bit Windows)
- \ProgramData (on Windows XP this is \Documents and Settings\All Users\)
- \Windows.

Creat
Posts: 234
Joined: 22 Sep 2005 18:27

Re: Another Win7 (and possibly Vista) related Request

Post by Creat »

admin wrote:I'll care for these OS enhancements once I have Win7.
Yea I know, that's why I posted it here, so you have a nice list handy once you get around to it (hopefully soon, at the moment I need explorer for waaaay too many things for my taste), maybe zer0 will add it to his nice thread?
nas8e9 wrote:(...) In folders where such a redirection has happened, Windows Explorer shows an extra button labeled Compatibility Files which switches to the folder where the writes were redirected to.
Unfortunately there is no such button in explorer for the example folder above (XYplorer's folder does have it though). So for some reason this doesn't happen in all cases or needs specific circumstances.
nas8e9 wrote:By way of a workaround, quit XYplorer and restart by right-clicking its shortcut and selecting Run as administrator. XYplorer then works with full rights and can do wites to protected folders without triggering redirection.
Yes of course I'm aware of this, but it's kinda besides the point to have to run a file manager as administrator just to actually do it's job (also there is that annoying confirmation at every start).

nas8e9
Posts: 2232
Joined: 21 Jun 2008 14:50

Re: Another Win7 (and possibly Vista) related Request

Post by nas8e9 »

Creat wrote:
nas8e9 wrote:(...) In folders where such a redirection has happened, Windows Explorer shows an extra button labeled Compatibility Files which switches to the folder where the writes were redirected to.
Unfortunately there is no such button in explorer for the example folder above (XYplorer's folder does have it though). So for some reason this doesn't happen in all cases or needs specific circumstances.
You may be looking in the wrong folder: You created a folder "\Program Files\OpenTTD Test" with only one executable and no other files as well as several subfolders. These subfolders as well as their contents were virtualised, but not the lone file (the executable) in "\Program Files\OpenTTD Test". Windows Explorer will only show the Compatibility Files-button in the (virtualised) subfolders (which contain files) but not in "\Program Files\OpenTTD Test" (which only contains virtualised folders). I'm guessing this is by design.

XYplorer's folder on the other hand (\Program Files\XYplorer) contains virtualised *files* and thus the Compatibility Files-button is displayed in Windows Explorer.
Last edited by nas8e9 on 08 Nov 2009 21:57, edited 1 time in total.

nas8e9
Posts: 2232
Joined: 21 Jun 2008 14:50

Re: Another Win7 (and possibly Vista) related Request

Post by nas8e9 »

Creat wrote:
nas8e9 wrote:By way of a workaround, quit XYplorer and restart by right-clicking its shortcut and selecting Run as administrator. XYplorer then works with full rights and can do wites to protected folders without triggering redirection.
Yes of course I'm aware of this, but it's kinda besides the point to have to run a file manager as administrator just to actually do it's job (also there is that annoying confirmation at every start).
I'm afraid that, based on my limited understanding of UAC and folder virtualisation, all file managers have to play by Windows's rule book, including Windows Explorer. DIsabling UAC (and thus folder virtualisation) and permanently running Windows with full user rights is one (very insecure) option; in terms of a file manager that can do everything under UAC and yet not bother the user, I think even XYplorer's developer would have a hard time.

In practical terms, a file manager is not internet-facing and should be safe to run as administrator. For your usage (and assuming you reboot once a day at most) one prompt at the beginning of the session to get XYplorer to run with full rights seems the most pragmatic answer. I agree with you that at least the Compatibility Files-button would be very welcome under Vista and Windows 7, but that's not available at the moment. I've added a post to zer0's Windows 7 wish list to request this.

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Another Win7 (and possibly Vista) related Request

Post by PeterH »

I'm afraid nas8e9 is right: to handle security shouldn't be part of a file manager.
So if you have to copy files to a destination where you need administrative rights, it means to do it in an administrative state. Else you would have to ignore all security and always work administrative.

But it would be helpful, of course, if XY helps to find / to manage the user-specific libraries.

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: Another Win7 (and possibly Vista) related Request

Post by zer0 »

nas8e9 wrote:In practical terms, a file manager is not internet-facing and should be safe to run as administrator.
PeterH wrote:I'm afraid nas8e9 is right: to handle security shouldn't be part of a file manager.
If I may quickly jump in and out of this: both of those statements do not spell a sunny future for FTP support implementation within XYplorer, despite a very strong following.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

nas8e9
Posts: 2232
Joined: 21 Jun 2008 14:50

Re: Another Win7 (and possibly Vista) related Request

Post by nas8e9 »

zer0 wrote:
nas8e9 wrote:In practical terms, a file manager is not internet-facing and should be safe to run as administrator.
It's a description of the current functionality of XYplorer. FTP could mean at least two security challenges:
- So-called "active" FTP requires incoming traffic to be able to negotiate one's firewall and/or router to reach XYplorer. Basically, when an application has to deal with incoming connections directly, there's potential for problems.
- Rogue or compromised FTP servers would be another challenge.
zer0 wrote:
PeterH wrote:I'm afraid nas8e9 is right: to handle security shouldn't be part of a file manager.
If I may quickly jump in and out of this: both of those statements do not spell a sunny future for FTP support implementation within XYplorer, despite a very strong following.
FTP clients like FileZilla can do their work without once triggering UAC: they don't need to write to protected locations. File managers like XYplorer do need to be able to write there; Microsoft has (after disastrous security problems) made that more difficult. Again, for a (currently) non-internet facing app like XYplorer I can live with elevating XYplorer once per session and be done with it. I agree that mixing secure (file management) and exposed (FTP) functionality within one app would be less than ideal; I'm personally (as a very light FTP user, for which I use the excellent and free FileZilla) not that keen on XYplorer getting FTP functionality. It's not unheard of though: both Directory Opus as well as Total Commander have built-in FTP functionality.

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: Another Win7 (and possibly Vista) related Request

Post by zer0 »

nas8e9 wrote:It's not unheard of though: both Directory Opus as well as Total Commander have built-in FTP functionality.
...as has Windows Explorer (even on XP). Jumping out... :lol:
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Another Win7 (and possibly Vista) related Request

Post by PeterH »

Sorry - I don't understand?

A file manager, as each other program, underlies the rules of access restrictions. So for me it's ok, that if it's running as a restricted user it only has rights of that user. And if I want more I signon as admin, or start the program with runas admin-user. This is correct for EXCEL, for XY, or for an ftp-client, I think.
(And possibly sometimes I need this, and sometimes I need that. At least you could start two XY - you can distinguish them by displaying the user in the title of the XY-window.)

But: there is a but!
(The following is my experience from XP - it might have changed for newer windows.)
If I start a program (XY) with "runas ...", not only the rights change to the other user - the complete environment does! For example: "my documents", Desktop, or such will point to the "other" (runas ...) user. And I must say: this has some advantages - but also some disadvantages. So if you want to work with your "local user's" personal files on an XY that's "runas admin", you cannot address them implicite (as "Desktop"), but only explicite by complete path.

From my point of view this is the only restriction you have.

Creat
Posts: 234
Joined: 22 Sep 2005 18:27

Re: Another Win7 (and possibly Vista) related Request

Post by Creat »

PeterH wrote:Sorry - I don't understand?

A file manager, as each other program, underlies the rules of access restrictions. So for me it's ok, that if it's running as a restricted user it only has rights of that user. And if I want more I signon as admin, or start the program with runas admin-user. This is correct for EXCEL, for XY, or for an ftp-client, I think.
(And possibly sometimes I need this, and sometimes I need that. At least you could start two XY - you can distinguish them by displaying the user in the title of the XY-window.)

But: there is a but!
(The following is my experience from XP - it might have changed for newer windows.)
If I start a program (XY) with "runas ...", not only the rights change to the other user - the complete environment does! For example: "my documents", Desktop, or such will point to the "other" (runas ...) user. And I must say: this has some advantages - but also some disadvantages. So if you want to work with your "local user's" personal files on an XY that's "runas admin", you cannot address them implicite (as "Desktop"), but only explicite by complete path.
You misunderstand how the concept works in Win7 (and vista, for that matter). I am logged in as a user with admin privileges (meaning I am signed on as admin), but in order to execute restricted actions you need to confirm that you actually want to do this (via UAC; User account control), so that a program that is misbehaving or contains malware (etc...) can't change sensitive things without your knowledge. If I right-click on a program and select 'Run as administrator' it isn't actually executed in a different user context, this just removes all of these restrictions, effectively disabling UAC for it.
This also leads to other problems like integrated updaters not being able to update the program as desired as the non-elevated writes of non-executable files to the program folder is silently redirected as described above (or sometimes the update attempt yields a 'permission denied' message)

Explorer is no different here, it's just aware of the UAC-Layer (so there has to be some sort of API or similar) and knows when to request elevation (I guess...). I don't know if there is a possibility to see if a write/copy/move operation is going to be redirected to one of the virtual folders or to request the corresponding virtual folder, but somehow windows explorer has to get that information too. Simply: explorer running in a non-elevated state just like XYplorer CAN write to the program files folder, requesting permission via UAC to do so.

PeterH
Posts: 2827
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Another Win7 (and possibly Vista) related Request

Post by PeterH »

Oh sorry: I really don't understand parts of UAC. And as (for me) the idea itself is strange, I sometimes make errors about those things I understood... :oops:

OK - a question: does it make sense, if I normally am working with a non administrative user, to switch off UAC? (As I don't need it then?) So that an admin user maybe can do his work without a problem, while for normal work I'm restricted by normal user rights?
For me this would be the solution - and the same as I do it in XP. But I don't know if switching off UAC works like this...

To the context, as seen under XP: if I "run as" XY as another user, and then in XY I open Desktop, I see the desktop of that runas-user, not of the user my desktop is currently in. At least easy to verify by comparing by the desktop-folders of both users by using the complete path. Don't know if this may have changed with newer windows?

And let me say: often, when making filemanagement with user rights, I'm glad that (e.g.) system-files are protected, if I make any error. So I'm glad that I can diferentiate between levels of rights, also for filemanagement!

Creat
Posts: 234
Joined: 22 Sep 2005 18:27

Re: Another Win7 (and possibly Vista) related Request

Post by Creat »

PeterH wrote:OK - a question: does it make sense, if I normally am working with a non administrative user, to switch off UAC? (As I don't need it then?) So that an admin user maybe can do his work without a problem, while for normal work I'm restricted by normal user rights?
For me this would be the solution - and the same as I do it in XP. But I don't know if switching off UAC works like this...
It wouldn't be necessary as UAC is a per-user setting, not a system wide setting. Also I'm pretty sure (haven't checked though) that UAC doesn't do anything on non-admin accounts. After all a normal user actually can't write to program files, so asking him if he meant to do that wouldn't change anything :) . The purpose is exactly what you are doing with multiple accounts: effectively have only user-rights, but no need to enter a password if you do need admin rights (just click "yes" instead). Have you had at least a quick look at the Wikipedia article I've linked about UAC earlier? I think it explains all this quite nicely...
PeterH wrote:To the context, as seen under XP: if I "run as" XY as another user, and then in XY I open Desktop, I see the desktop of that runas-user, not of the user my desktop is currently in. At least easy to verify by comparing by the desktop-folders of both users by using the complete path. Don't know if this may have changed with newer windows?
Nope, no change there. But also much easier ways to get the current user. You can just check the environment-variable USERNAME for example. I'm sure there are also ways to query this directly form Windows.
PeterH wrote:And let me say: often, when making filemanagement with user rights, I'm glad that (e.g.) system-files are protected, if I make any error. So I'm glad that I can diferentiate between levels of rights, also for filemanagement!
The problem for me is just that I can't modify the program files folder (at least not in a way that is useful) without it being redirected without a warning or something, getting an error message would be much better. And I don't always remember to restart XY with admin rights, I'm just not used to that (and would prefer not having to get used to it :D ). Days Later I discover my writes were redirected to the virtual folder and I basically have to do everything again (meaning copy them - again - to their originally intended location in program files).

admin
Site Admin
Posts: 66351
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Another Win7 (and possibly Vista) related Request

Post by admin »

Creat wrote:The problem for me is just that I can't modify the program files folder (at least not in a way that is useful) without it being redirected without a warning or something, getting an error message would be much better. And I don't always remember to restart XY with admin rights, I'm just not used to that (and would prefer not having to get used to it :D ). Days Later I discover my writes were redirected to the virtual folder and I basically have to do everything again (meaning copy them - again - to their originally intended location in program files).
How does the redirecting work? Junctions?

Post Reply