Windows Vista Forums
Vista Forums Home Join Vista Forums Tech Publications Windows 7 Forum Vista Tutorials Webcasts Tags

Welcome to Vista Forums we are your forum for Windows Vista help and discussion. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Vista Newsgroups > Vista security

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

Update your Vista Drivers
Reply
 
Thread Tools Display Modes
Old 02-26-2007   #1 (permalink)
Michael Harvey
Guest


 

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

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?



My System SpecsSystem Spec
Old 02-28-2007   #2 (permalink)
Michael Harvey
Guest


 

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

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

"Michael Harvey" <michaelharvey@nospam.sympatico.ca> wrote in message
news:%23fnb50cWHHA.1200@TK2MSFTNGP02.phx.gbl...
> 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?
>
>



My System SpecsSystem Spec
Reply
Update your Vista Drivers

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read and write a text file? Jirong Hu VB Script 1 06-14-2008 04:31 PM
Use both read and write operation to the same file Curious .NET General 4 05-19-2008 06:30 PM
Directory where my software is installed must permit write access Trish Vista General 1 12-14-2007 11:53 AM
Write files in directory tree ArjanS PowerShell 3 08-19-2007 05:40 PM
File permissions in the Program Files directory kevincc Vista account administration 3 05-02-2007 01:36 PM


Complimentary Industry Resources

Vista Forums has joined forces with TradePub.com to offer you a new, exciting, and entirely free professional resource. Visit http://vistax64.tradepub.com today to browse our selection of complimentary Industry magazines, white papers, webinars, podcasts, and more across 34 industry sectors. No credit cards, coupons, or promo codes required. Try it today!




Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

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