Problem modifying .ini file in c:\programdata

Hi Everyone

I'm developing an MFC Application which runs on Vista OS. I'm creating a folder under
c:\programdata , transferring .ini files (which were part of my installation exe, created using
setup factory 7) and trying to modify them at runtime, but it does not work. I'm running as invoker.
Any idea what the problem could be?

Who is Participating?
UdiRazConnect With a Mentor Author Commented:
I'm using an option to keep original file attributes so the files are not read only,
however, I found an alternative solution which is to save to c:\users\public
This should be because Programdata folder has a 'hiddden' attribute by default, so Your software may not see it. Try to unset the hidden attribute!
UdiRazAuthor Commented:
Thanks. Is there a way to this using code ? ( since I can't modify my customers computers).
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Well, how are you trying to access/modify these files? And, if you are using 'WritePrivateProfileString()' or similar functions, what does 'GetLastError()' say when they fail (i.e. return FALSE)?
UdiRazAuthor Commented:
I'm using WritePrivateProfileString, but I did not check GetLastError.
I'll check and let you know
UdiRazAuthor Commented:
The error I got was 5L "Access is Denied!"
Are the accounts that you are using to install and to run your app the same? And: In case you are copying the .ini files from a CD or DVD, they'll retain the 'read-only' attribute. I'd check that also. You can then remove that attribute using 'SetFileAttributes()'
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.

All Courses

From novice to tech pro — start learning today.