+2  A: 

I'm going to presume that you are not trying to prevent the user from changing the file manually, you just want to prevent the extra step of specifically assigning rights to the file.

You are most likely writing to a file that is in a protected area (an area that became protected after UAC was introduced). To avoid this, write your file to one of the "approved" areas, such as %APPDATA%. Here is a list of a few more (assuming C is your boot drive):

C:\Users\username\Documents
C:\Users\username\AppData\Local
C:\Users\username\AppData\Roaming
C:\Users\Public\Documents
C:\ProgramData

This article has a whole bunch of info around that which you can cherry pick bits from.

slugster
In fact, I meant just the opposite: how I could prevent the user from changing the file manually? Sorry for my English. Thanks for info, it is useful, nevertheless.+1
rem
+4  A: 

Encrypt it, or digital sign it

Dennis Cheung
+ 1 - This is exactly what i would have said as well after the edit from the OP.
slugster
Yes, I thought about encryption. But just wanted to know, if there are maybe some other ways. +1 Thanks!
rem
+1  A: 

This might be an overkill, but you could create a service that run's on a different user account, which can edit the file. Then your application would use that service to access the file.

This way you can prevent unwanted changes and/or log every change to the file.

Michał Piaskowski
It's interesting suggestion, thanks, +1
rem