October 19, 2018, 11:09:33 AM

Author Topic: C:/ProgramData/{App_Blah}/{sub_dir} only accessible by Admin log on accounts in  (Read 186 times)

Offline 3DzForMe

  • Full Member
  • ***
  • Posts: 219
Windows 10? Help, anyone familiar with the restrictions placed on a 'normal' user (i.e. not an admin account) for their appplications to have admin priveleges, thus allowing a normal users executables to write and read from C:\ProgramData\Application\Subdir\file1.CFG?

I'm using InnosSetup as my installation script thing, on Windows10, my little project can access the C:\ProgramData\Apllication\SubDir\file.CFG for reading / writing. Theres a few executables, a Visual Basic front end, Blitz3D executables.

During install, the first time it runs, it works... as admin permission has been granted during the install. Next time log on... MAV's occur due to a failure for the programs to write/read to the ProgramData directory.

Thanks in advance for any light that can be shed. One option I was considering was trying not to use the Generic ProgramData directory and just using a users local ProgramData directory, resolving this in different executables is a little more head achey than just using the globally semi accessible ProgramData directory.

Is there something within Innosetup I need to set to allow the files to access ProgramData\ ?
happy coding ;)

Offline col

  • Sr. Member
  • ****
  • Posts: 397
Quote
MAV's occur due to a failure for the programs to write/read to the ProgramData directory.
Tut tut, you should be checking those return values to prevent this! :P

As you know your installation exe created by Inno needs admins rights to install, so when it creates the \SubDir\ and because the admin account is used to create that \SubDir\ then only that user can access it - this is the general rule for file/folder security, and also explains why it works how you say.

However, you can leverage these initial admin rights to create the \SubDir\ with the rights for all users to access.

Quote
Is there something within Innosetup I need to set to allow the files to access ProgramData\ ?
Within the Inno docs the [DIRS] - permissions section looks to be the first place to have a play.
Any bugs in my code are proof of its hand-coded nature.
https://github.com/davecamp

Offline 3DzForMe

  • Full Member
  • ***
  • Posts: 219
@col, thank you verily for the prompt feedback, will dig into this tomorrow. I've an ole fashioned pen and paper log for my project thats been on and off .... one of the logs is from 2013.

Yep, there's been some significant gaps in development over the years - and yep, I should be checking those return values  :P

Each time I 'go back' to it... it takes a little while to (nearly) re-orient myself. Orientation gets tougher the closer you get to the sixth decade  :D

I was just well chuffed that B3D is cutting the old mustard on my son's W10 box (I develop on a mixture of a W7 ultimate machine which I bought for 560pence from a rainy auction - that'll be the front end, and a creaky W7 Desktop for my B3D shenangins).

Oh yes, this looks the bizness, thankyou:

http://www.jrsoftware.org/ishelp/index.php?topic=dirssection

Cheers ;)
happy coding ;)

Offline 3DzForMe

  • Full Member
  • ***
  • Posts: 219
@Col, thank you very much for your feedback.

Transpires directory [dir] permissions was the root of some issues I started to experience on one of my development machines ( the one I bought from a rainy auction in Sleaford in deepest darkest lincolnshire, for just over a fiver )

And there was me thinking B3D was letting me down, I should've known better ;)



happy coding ;)