Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Security > How to open a file for read/write access in Program Files directory

Reply
Thread Tools Display Modes

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

 
 
Michael Harvey
Guest
Posts: n/a

 
      02-26-2007
Hi,

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

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
file.

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


 
Reply With Quote
 
 
 
 
Michael Harvey
Guest
Posts: n/a

 
      02-28-2007
I've got an answer for this. It has to do with running as an Administrator.

"Michael Harvey" <> wrote in message
news:%...
> Hi,
>
> How should I open a file in the Program Files directory for read/write
> access?
>
> 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
> file.
>
> Should I be using CreateFile with certain parameters instead of OpenFile?
>
>



 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup - unable to read file or directory ThosRTanner Windows Vista General Discussion 2 01-13-2008 05:20 AM
Directory where my software is installed must permit write access Trish Windows Vista General Discussion 1 12-14-2007 03:53 PM
Copying files to Program Files directory Parrot Windows Vista File Management 13 08-23-2007 06:14 AM
File permissions in the Program Files directory kevincc Windows Vista Administration 3 05-02-2007 05:36 PM
Re: Write file is access denied. Reed [MVP] Windows Vista File Management 0 07-04-2006 02:14 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59