Windows Vista Forums

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

  1. #1


    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

  2. #2


    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

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

Similar Threads
Thread Forum
Read Only users prevent read write users from open file in edit modewithout alert
Here is the scenario: User “A” has Read Only access to Folder “Test” and all documents within it. User “B” has Read/Write access to Folder...
Server General
Tape Drives - Allow or Deny Read and Write Access
How to Deny or Allow Read and Write Access to Tape Drives in Vista and Windows 7 This will show you how to deny or allow read and write access to...
Tutorials
DVD and CD Drive - Allow or Deny Read and Write Access
How to Deny or Allow Read and Write Access to CD and DVD Drives in Vista and Windows 7 This will show you how to deny or allow read and write...
Tutorials
How to read and write a text file?
Hi Can someone give me an example to read and write a text file in this format using VBScript? Thanks. Jirong ...
VB Script
Directory where my software is installed must permit write access
I have been using Vista and like it. All my software loaded file except on program the error message appeared: "Please make sure the directory...
Vista General
Write files in directory tree
For a project I'd like to do the following: - Run a script from the top to the bottom of a directory tree - In each folder of that tree a...
PowerShell
File permissions in the Program Files directory
I am trying to modify a file in the Program Files directory (a properties file for Visual C++ 2005 Express). It appears that the directory is read...
Vista account administration