How to open a file for read/write access in Program Files directory


Michael Harvey


How should I open a file in the Program Files directory for read/write

In Vista Business 32-bit as administrator with UAC turned on, the OpenFile
API call fails when trying to open a file for read/write in the Program
Files directory. The call is

OpenFile(FileName, &OpenBuff, OF_READWRITE);

returning HFILE_ERROR.

When accessing the file with Explorer, I can do anything I want with the

Should I be using CreateFile with certain parameters instead of OpenFile?

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question