if you're trying to write data to a sub-directory of your program's directory then I suggest that when you install your program have your installer set the data directory or any directory that needs to be written to as writable by all users. if you use inno setup it's a piece of cake to do this.