Solved

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

Posted on 2014-04-08
9
1,373 Views
Last Modified: 2014-04-18
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
Comment
Question by:shawn857
  • 5
  • 4
9 Comments
 

Author Comment

by:shawn857
ID: 39987465
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
 
LVL 5

Accepted Solution

by:
JurajUQU earned 500 total points
ID: 39987473
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
 

Author Comment

by:shawn857
ID: 39987480
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 5

Expert Comment

by:JurajUQU
ID: 39987485
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
 

Author Comment

by:shawn857
ID: 39987535
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
 
LVL 5

Expert Comment

by:JurajUQU
ID: 39987632
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
 

Author Comment

by:shawn857
ID: 39987686
"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
 

Author Comment

by:shawn857
ID: 39990744
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
 
LVL 5

Expert Comment

by:JurajUQU
ID: 39992776
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

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question