Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1838
  • Last Modified:

My app can't write to its INI file in Windows 7 64-bit environment

Hi guys, me again pestering you right away with another question sort of related to my last one. In the last one, we solved how/where to write my 32-bit Windows\System32 files on a 64 bit machine. I've discovered another issue on my user's 64 bit system - a very innocent .ini file (just a notepad text file) that my installation writes to the user's application installation folder cannot be written to by my app. It gives a "File Access Denied" EInOutError Delphi exception error. Everything works fine here in my 32-bit Win XP development environment, but on my user's 64 bit system (Windows 7), my app can't even do a simple write to this INI text file on his system.
   
Thanks!
   Shawn
0
shawn857
Asked:
shawn857
  • 5
  • 4
1 Solution
 
shawn857Author Commented:
Further to this guys, I was signed in remotely to my user's machine and I opened this INI file manually in Notepad then tried to save it... it wouldn't even let me do that - said "File Access Denied".

Thanks
   Shawn
0
 
JurajUQUCommented:
By default Program files folder is locked for write by users in Windows 7 up environment. I believe for data there's a hidden folder called ProgramData on C: drive or use App Data in Users folder to save it. For all use Public or only current user if each user will have their own...
0
 
shawn857Author Commented:
Thanks for the reply Jura, but my app isn't installed in the User's "ProgramFiles" folder.. it gets installed to its own new folder "C:\MyApp".

Thanks!
   Shawn
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
JurajUQUCommented:
Not the best practice possibly but fair enough

You can use icacls command during the install to give the current user during the folder creation full access to it.

http://technet.microsoft.com/en-us/library/cc753525.aspx
0
 
shawn857Author Commented:
Thanks Jura, I've never used that before, can you give me a little guidance please? How can I set every file to my installation folder to "full permissions"?
   Jura, I'm using an installation software that is a little restrictive (not to mention discontinued two years ago) called "Install-Us". It will however allow me to "run a program" after my installation completes. To invoke icacls, is it enough to just specify "icacls", or is it \Windows\System32\icacls", or something like that? Also, if I issue this command during an installation on an XP system that doesn't use administrator permissions, will this command fail or generate an error? Or is there still an icacls on Windows XP?

Thanks!
    Shawn
0
 
JurajUQUCommented:
XP doesn't elevate rights for a local user but can do "Run As". As an application creator you should be able to set that only members of the Administrator group can install your app which solves your problem.

Not sure of XP has icacls but it might have cacls which had been depricated on new systems such as Windows 7.

All you need to do is probe during the install what system it is and then run a command accordingly. Or run calcs first and if returns failure, then run icacls.

Practical test would be the best but unfortunately I don't have XP at hand to test it out.
0
 
shawn857Author Commented:
"XP doesn't elevate rights for a local user but can do "Run As". As an application creator you should be able to set that only members of the Administrator group can install your app which solves your problem."

>> Well, I signed in remotely to one of my user's computer and was on as Administrator and installed my app on his system. Still, the INI files that my app installed were not writeable  :-(


"Not sure of XP has icacls but it might have cacls which had been depricated on new systems such as Windows 7."

>> I think maybe you misunderstood - I just wanted to know IF I run icacls on XP, will it give an error? I know there is no need to run icacls on an XP system... I'm just wondering what will happen if it's invoked.


"All you need to do is probe during the install what system it is and then run a command accordingly. Or run calcs first and if returns failure, then run icacls."

>> This is what I asked in my last message, can you advise me what icacls command I need to give every file in my application's install folder "full permissions"? The syntax of that icacls statement is pretty confusing and the webpage you suggested doesn't give very good example.
   Is it really necessary to probe what the target operating system is? On any windows system that uses "Administrator", I'm going to have to issue the icacls command, no? I'm getting a little confused here....

Thanks
   Shawn
0
 
shawn857Author Commented:
Hi Juraj, instead of struggling along with my old discontinued install software "Install-Us", I've decided to download and try to use the free Nullsoft NSIS installer. Are you familiar with how to use that software?

Thanks!
    Shawn
0
 
JurajUQUCommented:
Actually I haven't tried it myself but I'm sure there are tutorials on how to do it.

https://www.youtube.com/watch?v=Cxi2QfsnqM4

or if you need more details -> http://nsis.sourceforge.net/Docs/Chapter2.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now