1. Welcome Guest! In order to create a new topic or reply to an existing one, you must register first. It is easy and free. Click here to sign up now!.
    Dismiss Notice

Program Files Read Only

Discussion in 'Windows Security' started by Dweezil38, Jul 13, 2009.

  1. Dweezil38

    Dweezil38 Guest

    Hi There

    I have a serious problem to fix. I've written a WIndows Application
    using visual studio 2008 that uses an Access database to hold data. I've
    placed the database in the same folder as the executible "C:\Program
    Files\MyApp\MyData.mdb". The program installs and work fine under XP and
    but when installed and run under Vista, I'm getting file permission
    errors. All user installation and running of the application is done as
    the ADMINISTATOR, the only user profile created.

    My eariler version of the application, written with VS 2005 installs
    (DOT NET Framework 2.0) and works fine under Vista.

    I can't change the database location, as eariler versions of this same
    program have been running and working fine under XP. It would mean
    changing the data file location for over 200 customers. It would cause a
    great deal of head aches to modify the application to use a different
    folder for the database.

    SO here's my questions. What permissions do I need to get read/write
    access to my data file? What steps can be taken to remove the security
    attributes on my data file? Can I change these permissions from within
    my application? The application exe file does have its compatibilities
    property set to "Run as an administrator". Do I have to run the
    application under compatibility mode of "Windows XP (Service pack 2)"?


    --
    Dweezil38
     
  2. DL

    DL Guest

    Not an answer, but its not a terribly good idea to hard code any data
    location, or anything else, when writting an app, create a routine to locate
    the data file, consign that to a variable, then use that variable for the
    location

    "Dweezil38" <guest@unknown-email.com> wrote in message
    news:9e83b17afa4c3a5b4383a02dff067831@nntp-gateway.com...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    >
    > Hi There
    >
    > I have a serious problem to fix. I've written a WIndows Application
    > using visual studio 2008 that uses an Access database to hold data. I've
    > placed the database in the same folder as the executible "C:program
    > FilesMyAppMyData.mdb". The program installs and work fine under XP and
    > but when installed and run under Vista, I'm getting file permission
    > errors. All user installation and running of the application is done as
    > the ADMINISTATOR, the only user profile created.
    >
    > My eariler version of the application, written with VS 2005 installs
    > (DOT NET Framework 2.0) and works fine under Vista.
    >
    > I can't change the database location, as eariler versions of this same
    > program have been running and working fine under XP. It would mean
    > changing the data file location for over 200 customers. It would cause a
    > great deal of head aches to modify the application to use a different
    > folder for the database.
    >
    > SO here's my questions. What permissions do I need to get read/write
    > access to my data file? What steps can be taken to remove the security
    > attributes on my data file? Can I change these permissions from within
    > my application? The application exe file does have its compatibilities
    > property set to "Run as an administrator". Do I have to run the
    > application under compatibility mode of "Windows XP (Service pack 2)"?
    >
    >
    > --
    > Dweezil38 <!--colorc--><!--/colorc-->
     
  3. Dweezil38 wrote:<!--coloro:blue--><span style="color:blue <!--/coloro-->
    > Hi There
    >
    > I have a serious problem to fix. I've written a WIndows Application
    > using visual studio 2008 that uses an Access database to hold data. I've
    > placed the database in the same folder as the executible "C:program
    > FilesMyAppMyData.mdb". The program installs and work fine under XP and
    > but when installed and run under Vista, I'm getting file permission
    > errors. All user installation and running of the application is done as
    > the ADMINISTATOR, the only user profile created.
    >
    > My eariler version of the application, written with VS 2005 installs
    > (DOT NET Framework 2.0) and works fine under Vista.
    >
    > I can't change the database location, as eariler versions of this same
    > program have been running and working fine under XP. It would mean
    > changing the data file location for over 200 customers. It would cause a
    > great deal of head aches to modify the application to use a different
    > folder for the database.
    >
    > SO here's my questions. What permissions do I need to get read/write
    > access to my data file? What steps can be taken to remove the security
    > attributes on my data file? Can I change these permissions from within
    > my application? The application exe file does have its compatibilities
    > property set to "Run as an administrator". Do I have to run the
    > application under compatibility mode of "Windows XP (Service pack 2)"?
    >
    > <!--colorc--><!--/colorc-->


    Data should never be saved in the C:\Programs Files area. That's very
    poor practice. I'd suggest you fix the application. As it is, you
    cannot even honestly claim that the application is WinXP-compatible,
    much less Vista-compatible.


    --

    Bruce Chambers

    Help us help you:




    They that can give up essential liberty to obtain a little temporary
    safety deserve neither liberty nor safety. ~Benjamin Franklin

    Many people would rather die than think; in fact, most do. ~Bertrand Russell

    The philosopher has never killed any priests, whereas the priest has
    killed a great many philosophers.
    ~ Denis Diderot
     
  4. Eric Nay

    Eric Nay Guest

    Dweezil38 wrote:<!--coloro:blue--><span style="color:blue <!--/coloro-->
    > ...
    > SO here's my questions. What permissions do I need to get read/write
    > access to my data file? What steps can be taken to remove the security
    > attributes on my data file? Can I change these permissions from within
    > my application? The application exe file does have its compatibilities
    > property set to "Run as an administrator". Do I have to run the
    > application under compatibility mode of "Windows XP (Service pack 2)"?
    > <!--colorc--><!--/colorc-->

    I agree with the others so far. The specific thing you have run into is
    that Vista SP1 (I think) blocks R/W access to "C:\Program Files". Fix
    your program now before all your customers start using Win7 and complain
    to you.

    While you're at it, get rid of the need for them to run as
    administrator. That's so 1990s...
     
  5. Dweezil38

    Dweezil38 Guest

    Thanks DL

    I did that. I figured out a solution. My app just needed a property set
    to indicate that it should run as an administrator.

    Thanks


    --
    Dweezil38
     
  6. "Dweezil38" <guest@unknown-email.com> wrote in message
    news:44c2dec57097e90e2c5f7aaaee6c7a95@nntp-gateway.com...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    >
    > Thanks DL
    >
    > I did that. I figured out a solution. My app just needed a property
    > set
    > to indicate that it should run as an administrator.<!--colorc--><!--/colorc-->

    So, now it runs as administrator only because of the need for you to
    take the easy way out?

    ....so what's the name of your software company?
     
  7. Gordon

    Gordon Guest

    "FromTheRafters" <erratic @nomail.afraid.org> wrote in message
    news:#iyu07HBKHA.3732@TK2MSFTNGP02.phx.gbl...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    >
    > ...so what's the name of your software company?
    ><!--colorc--><!--/colorc-->

    So we can avoid its products? ;-)
     
  8. "Dweezil38" <guest@unknown-email.com> wrote in message
    news:44c2dec57097e90e2c5f7aaaee6c7a95@nntp-gateway.com...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    >
    > Thanks DL
    >
    > I did that. I figured out a solution. My app just needed a property
    > set
    > to indicate that it should run as an administrator.<!--colorc--><!--/colorc-->

    So, now it runs as administrator only because of the need for you to
    take the easy way out?

    ....so what's the name of your software company?

    Be advised that XP was lenient by allowing you to stray from best
    practice. Vista begins to enforce stricter adherance, and I've read that
    future versions will be even less forgiving. With any luck, you will be
    facing thousands of more customers in the future...what then?
     
  9. Dweezil38

    Dweezil38 Guest

    Ok folks, message received and understood. I quess I'll have to revamp
    my app and place the Data file in the user profile folder.

    In the mean time is there a solution for not running the app as the
    administrator?


    --
    Dweezil38
     
  10. "Eric Nay" <EricNay@anyolddomain.invalid> wrote in message
    news:ud4XRkBBKHA.5040@TK2MSFTNGP04.phx.gbl...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    > Dweezil38 wrote:<!--coloro:green--><span style="color:green <!--/coloro-->
    >> ...
    >> SO here's my questions. What permissions do I need to get read/write
    >> access to my data file? What steps can be taken to remove the
    >> security
    >> attributes on my data file? Can I change these permissions from
    >> within
    >> my application? The application exe file does have its
    >> compatibilities
    >> property set to "Run as an administrator". Do I have to run the
    >> application under compatibility mode of "Windows XP (Service pack
    >> 2)"?
    >><!--colorc--><!--/colorc-->
    >
    > I agree with the others so far. The specific thing you have run into
    > is that Vista SP1 (I think) blocks R/W access to "C:program Files".
    > Fix your program now before all your customers start using Win7 and
    > complain to you.
    >
    > While you're at it, get rid of the need for them to run as
    > administrator. That's so 1990s...<!--colorc--><!--/colorc-->

    ....and default Vista doesn 't easily allow it.

    What seems to be "the only user profile created" is actually not the
    Administrator account but the "Protected Administrator".
     
  11. Dweezil38

    Dweezil38 Guest

    Hi Folks,

    One more question. If instead of a folder under the user profile, if I
    create a folder right off the C: root will I run into the same problems?
    Things is I may have multiple users on one system.

    Thanks again


    --
    Dweezil38
     
  12. "Dweezil38" <guest@unknown-email.com> wrote in message
    news:ec2b10a4b5e0d3280dbbeeaecd7d90af@nntp-gateway.com...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    >
    > Ok folks, message received and understood. I quess I'll have to revamp
    > my app and place the Data file in the user profile folder.
    >
    > In the mean time is there a solution for not running the app as the
    > administrator?<!--colorc--><!--/colorc-->

    Perhaps...

     
  13. Chris Jolly

    Chris Jolly Guest

    A bit of a hack (although NOT recommended) would be to adjust the security
    privileges of the folder (right click folder -> select properties and then
    the security tab) and give read/write privileges to that user (or the Users
    group).

    But please forward proof the app to use the user profile folder instead

    Chris

    "Dweezil38" <guest@unknown-email.com> wrote in message
    news:ec2b10a4b5e0d3280dbbeeaecd7d90af@nntp-gateway.com...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    >
    > Ok folks, message received and understood. I quess I'll have to revamp
    > my app and place the Data file in the user profile folder.
    >
    > In the mean time is there a solution for not running the app as the
    > administrator?
    >
    >
    > --
    > Dweezil38 <!--colorc--><!--/colorc-->
     
  14. Chris Jolly

    Chris Jolly Guest

    As long as the folder has read/write privs for that user it should be fine.
    Also there is a appdata folder outside of the user profile directory (it is
    C:\ProgramData). If multiple users work on the same data that folder would
    be the better option.
    And please don't hardcode that into the app. Rather ask Windows for the path
    (on other language installations the folder names will be different I think)

    Chris

    "Dweezil38" <guest@unknown-email.com> wrote in message
    news:5890a3a4bf197266ad573b3d71c5ea7d@nntp-gateway.com...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    >
    > Hi Folks,
    >
    > One more question. If instead of a folder under the user profile, if I
    > create a folder right off the C: root will I run into the same problems?
    > Things is I may have multiple users on one system.
    >
    > Thanks again
    >
    >
    > --
    > Dweezil38 <!--colorc--><!--/colorc-->
     
  15. No program needs to run as administrator. You have taken the easy way out
    and I would never buy software from your company. Your program should save
    it's program data to the user folder, not Program Files where the program is
    located.

    Microsoft has been saying this for over 10 years. Now they are trying to
    enforce it.

    Suggest you get competent programmers.

    --

    Richard Urban
    Microsoft MVP
    Windows Desktop Experience


    "Dweezil38" <guest@unknown-email.com> wrote in message
    news:44c2dec57097e90e2c5f7aaaee6c7a95@nntp-gateway.com...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    >
    > Thanks DL
    >
    > I did that. I figured out a solution. My app just needed a property set
    > to indicate that it should run as an administrator.
    >
    > Thanks
    >
    >
    > --
    > Dweezil38 <!--colorc--><!--/colorc-->
     
  16. Pete Delgado

    Pete Delgado Guest

    "Richard Urban" <richardurbanREMOVETHIS@hotmail.com> wrote in message
    news:e00GHChBKHA.1492@TK2MSFTNGP03.phx.gbl...<!--coloro:blue--><span style="color:blue <!--/coloro-->
    > No program needs to run as administrator.<!--colorc--><!--/colorc-->

    That is incorrect. There are a variety of programs that need to run with
    elevated permissions, the vast majority of them are supplied with the
    operating system or are intended to be used by system administrators.
    <!--coloro:blue--><span style="color:blue <!--/coloro-->
    >You have taken the easy way out<!--colorc--><!--/colorc-->

    I agree. Since the OP has not provided a compelling reason for requiring
    elevation, it would seem that it is pure laziness and sloppiness that this
    route has been chosen.

    -Pete
     

Share This Page