Link to home
Start Free TrialLog in
Avatar of UdiRaz
UdiRaz

asked on

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?

Thanks
Avatar of Bigboj
Bigboj
Flag of Hungary image

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!
Avatar of UdiRaz
UdiRaz

ASKER

Thanks. Is there a way to this using code ? ( since I can't modify my customers computers).
Avatar of jkr
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)?
Avatar of UdiRaz

ASKER

I'm using WritePrivateProfileString, but I did not check GetLastError.
I'll check and let you know
Avatar of UdiRaz

ASKER

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()'
ASKER CERTIFIED SOLUTION
Avatar of UdiRaz
UdiRaz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial