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 Thread Starter Forum Replies Last Post
Read Only users prevent read write users from open file in edit modewithout alert RickyV Server General 3 18 Feb 2010
DVD and CD Drive - Allow or Deny Read and Write Access Brink Tutorials 0 11 Sep 2008
Directory where my software is installed must permit write access Trish Vista General 1 14 Dec 2007
Write files in directory tree ArjanS PowerShell 3 19 Aug 2007
File permissions in the Program Files directory kevincc Vista account administration 3 02 May 2007