View Full Version : TextFile.Write* on Vista
Desolator
04-26-2007, 01:38 PM
I want to know if the TextFile.Write* require administrator privileges to write to the source folder and that happens to be in the Program Files folder (it's Programs in Vista, I think)?
Dermot
04-26-2007, 01:43 PM
You have to have full administrator privileges to write to the Program Files folder on Vista. It's best just not to bother. You can create a folder on the C:\ drive and write all you want to it.
Desolator
04-26-2007, 02:07 PM
Or in the _TempFolder. I guess I'll use the temporary folder instead.
Dermot
04-26-2007, 02:51 PM
Yep! _TempFolder is the best place if the files are not permanent.
Desolator
04-26-2007, 03:47 PM
It is somewhat permanent, though. Hmm, does the registry actions support /r/n? If they do, then I can use the registry to store the data, which should be available for normal users. Or does it ask the user if he wishes to allow the application to write a file? If not, then Microsoft has gone a bit too far with security :(
RizlaUK
04-26-2007, 03:57 PM
the securty in vista only reflects the holes in securty in xp, you can never have to much securty
write the file to a folder in the users my docs folder, that should be ok (but i dont have vista yet so i might be wrong)
but as far as i am aware, the registry and program folder are protected areas, but my docs isent (plz, vista users correct me if i am wrong)
When installing your application, run this:
xcacls "path to the installation folder" /G Users:F /Y
Dermot
04-26-2007, 04:29 PM
Yes you can write to the users My Docs folder so that is fine as long as the files are only for that user. If they are to be written to by anyone that logs on then it won't work. Each user will have seperate files.
I spent 3 days trying all different methods and the only one that was reliable and easy was to have my installer create a folder on the C: drive and use that for any files I needed to write to etc. Each user needed to access the same files so I had to have one central place. I tested it as an admin with UAC on and off and as a limited user and it works fine.
As for the registry, I have given up on that now because of Vista. Just as easy to save settings etc. in a text or ini file.
RizlaUK
04-26-2007, 04:43 PM
handy to know, thanks Dermot, i'll bear that in mind when making my apps from now on to avoid the vista issue :yes
Intrigued
04-26-2007, 09:39 PM
Yes you can write to the users My Docs folder so that is fine as long as the files are only for that user. If they are to be written to by anyone that logs on then it won't work. Each user will have seperate files.
I spent 3 days trying all different methods and the only one that was reliable and easy was to have my installer create a folder on the C: drive and use that for any files I needed to write to etc. Each user needed to access the same files so I had to have one central place. I tested it as an admin with UAC on and off and as a limited user and it works fine.
As for the registry, I have given up on that now because of Vista. Just as easy to save settings etc. in a text or ini file.
That's the reason I made this statement a ways back and some poo-pooed my comment:
http://www.indigorose.com/forums/showpost.php?p=90174&postcount=9
;)
Desolator
04-27-2007, 12:44 AM
That's the reason I made this statement a ways back and some poo-pooed my comment:
http://www.indigorose.com/forums/showpost.php?p=90174&postcount=9
;)
Thank you Intrigued, in that topic I found post (By Eagle) which said that the current Application Data isn't locked. I wonder if the Application Data for all users isn't locked, too?
Dermot
04-27-2007, 01:22 AM
Thank you Intrigued, in that topic I found post (By Eagle) which said that the current Application Data isn't locked. I wonder if the Application Data for all users isn't locked, too?
I thought that was the perfect solution but when I tried logged in as a limited user, it did not work. It is stored in a folder named ProgramData. When you login as a limited user, you can't even see this folder. You can only see it when logged in as an administrator.
CyberRBT
04-27-2007, 02:25 AM
Many of you may know of this tool which can be of assistance with Vista UAC issues, but others may not.
Microsoft Application Compatibility Toolkit 5.0 (http://technet.microsoft.com/en-us/windowsvista/aa905102.aspx) is a free tool from M$. It includes a utility named Standard User Analyzer. With SUA you choose an app to run, then launch it. SUA will monitor all activity from that app and reports tons of privilege info (if you choose detailed info from the view menu) after you exit the app. Its accompanying RTF file explains usage and the generated reports.
Also, the first time you run it, you'll be prompted to DL another free M$ product that's required: Application Verifier.
You actually get far more info than just acceptable directories that you can work in; but, it can help you pinpoint every issue that you'd have with a Standard User on Vista.
When installing your application, run this:
xcacls "path to the installation folder" /G Users:F /Y
Forget that... it will replace the permissions, not add them;
Instead, use this approach and you will have a write permissions
for normal users withing your folder wherever it would be:
xcacls "path to the installation folder" /G SYSTEM:F Users:RCW Administrators:F "Power Users":F Everyone:RX /Y
Simply run this command when you are installing your software.
http://www.ss64.com/nt/xcalcs.html
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.