Vista weirdness...

BlitzMax Forums/BlitzMax Programming/Vista weirdness...

marksibly(Posted 2009) [#1]
Hi,

I'm just trying to clean things up a little on Vista, but have discovered something very odd.

On my machine, if I run this app from a console as non-admin, the directories appear to get created - but they don't show up in explorer or even dos!
Strict

CreateDir "c:\program files\bbhtml"
CreateDir "c:\program files\bbhtml\dir1"
CreateDir "c:\program files\bbhtml\dir2"

For Local t$=EachIn LoadDir( "c:\program files\bbhtml" )
	Print t
Next

On the other hand, running this as admin also creates the directories, only you *can* see them in explorer/dos.

I was under the impression that you *couldn't* create anything in program files unless you were admin, but from the above it appears you can, they're just not visible!

Anyone have any idea what might be going on here, or how I might be able to 'see' such hidden files?

I'm not good with Vista's admin/UAC stuff - and the deeper into it I go, the weirder it all gets.


Robert Cummings(Posted 2009) [#2]
Try a unique name then doing a search as admin to see what shows up.


skidracer(Posted 2009) [#3]
i think you'be been virtualised!


Attempting to create or write a file or directory under a folder which does not grant write permission to the process will fail under Windows Vista if the application does not have administrative privileges. If your 32-bit game executable is running in legacy mode, because it did not declare a requested execution level, its write operations will succeed, but they will be subjected to virtualization as described in the section "UAC Compatibility with Older Games" later in this article.



http://msdn.microsoft.com/en-us/library/bb206295.aspx


GaryV(Posted 2009) [#4]
They are being created, but are being put in your virtual store.


Grey Alien(Posted 2009) [#5]
Been there been pissed off by that too. Skid's link reveals all the stinky details. If you turn off UAC it'll work otherwise you have to write to "approved" shared data locations AND if you want different users on the same PC to be able to access that data (read+write) then you need to set the correct security permissions to the files and folders which is a whole other painful situation. My framework sorts all that stuff out and I think I posted the code on here somewhere before...


GaryV(Posted 2009) [#6]
I'm not good with Vista's admin/UAC stuff - and the deeper into it I go, the weirder it all gets.
Keep in mind that with Vista, even when you're running as administrator you don't really have full administrator rights. Only Vista itself has full administrator rights.


GaryV(Posted 2009) [#7]
As long as you follow Microsoft's development guidelines for the proper places to store data, then you will have no problem.

Like Grey suggests you can do hacks to write data to the program files directory, but Microsoft has made it clear this may not be supported in future versions of Windows. They really want you to put the data where you are supposed to, not where you want to.


Dreamora(Posted 2009) [#8]
GaryV: thats not fully correct.
If you kick out UAC you have near full Admin rights. There is only a very very small amount of stuff that is missing in comparision to XP Pro admin rights for example


GfK(Posted 2009) [#9]
GaryV: thats not fully correct.
If you kick out UAC you have near full Admin rights.
Isn't that exactly what he said??


Dreamora(Posted 2009) [#10]
No
He said that you never have full admin rights.

If UAC is disabled & you are on an admin account, you are, by XP standards, full admin on Vista


Grey Alien(Posted 2009) [#11]
But if you are distributing anything commercially you can't assume they've turned off UAC.


markcw(Posted 2009) [#12]
Relevant question:
If you install a program to:
'C:\Users\username\Documents' or 'C:\Users\username\AppData\Local'
is that the quick way round UAC?


Tricky(Posted 2009) [#13]
As far as I know... Yes...
I personally use a portable harddrive to host both BlitzMax and the projects I write in it. This is the easiest way to get around UAC.


Snixx(Posted 2009) [#14]
*facepalm*


GaryV(Posted 2009) [#15]
If you kick out UAC you have near full Admin rights.

"near" doesn't mean full ;) We are discussing Vista (as suggested in the initial post). Comparing to XP's admin privileges is futile since they are vastly different.

If you install a program to:
'C:\Users\username\Documents' or 'C:\Users\username\AppData\Local'
is that the quick way round UAC?

For now. This may not be supported in the future. MS has made hints that executable files may only be allowed in certain directories in the future.

I am not sure what the aversion is to installing your game or app where it normally should be and then writing/saving data only to the directories you are supposed to. It doesn't hurt to be courteous to your EU.

This is nothing new, it has been the "proper" and "suggested" way to do it for a long time. Unfortunately, MS had to start enforcing it because developers would not "play by the rules".

This thread should be a reminder to all of us to read MS's development guidelines for Vista and follow them. It will save you a lot of trouble in the long run. If stuff like this can grab Mark, it can grab all of us ;)

http://msdn.microsoft.com/en-us/windows/default.aspx


xlsior(Posted 2009) [#16]
While I understand the reasons MS is enforcing this, it really is unfortunate that the 'proper' way of doing things is such a mess with files spread over multiple directory hierarchys...

Personally I installed all of my programming-related tools under c:\code


TomToad(Posted 2009) [#17]
The files are being created in virtual storage. This behavior is so that legacy programs that insist on writing to the Program Files directory will still work. All the files are redirected to User/UserName/AppData/Local/VirtualStore/Program Files. You can either navigate directly to that directory or reach it by opening the parent directory in the Program Files folder and clicking on Compatibility Files on the menu bar.
Strange thing though, if the parent directory is Program Files like in your example, then the Compatibility Files option doesn't appear in the menu bar, so you will need to navigate to it through the actual path.