Click here to Skip to main content
15,882,209 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I've put together a simple multiuser program that runs great out of a PC-user A's directory. But the problems occur when user B' thru user D', on the same PC, runs the program and attempts access' to these date files. The results is usually quite bad. I've attempted to set permissions for each user; under each of the files properties - prior to each run. But after running the program from either user'B thru user'D, the permissions that were set before seems to have disappeared, as if I hadn't done them at all. This has been going on for a while, and I can't make any heads or tails of it. How can I make the permissions credible and good and right, so as to have no problems in running the program anywhere on this PC. In otherwords, make sure everything goes as planned, have no problems. Any corrective ideas and helps sure would be helpful. What am I doing wrong though? Thanks,

What I have tried:

I have used _fsopen(), fopen(), fsopen_s(). constantly changing it, bang on it.
Dave Kreskowiak 6-Feb-24 0:22am    
There is not enough information to answer this.

What path is the app installed to? What path are the files being stored in? How are the files being written?

To get the pathes windows has some special API named Known folder interfacesa or the more recente SHGetFolderPath. The parameters are useda as an identifier which path returns.

But first you need some concept for your data. Best is when every user has its own data, or some common data. This resolves the access problem. Using elevation is a bad idea.
Share this answer
I'd suggest that you move the data files to a "all users" data folder: Windows has a data folder which is available to all users: ProgramData.
This is a hidden folder, normally in the root of the C: drive (but can be moved - open File Explorer and type %PROGRAMDATA% in the address bar to find it). Create a folder in there for your app, and the data files within that folder are fully accessible to all users without any elevation.
Share this answer
samthelab 6-Feb-24 13:31pm    
And Again Thanks OriginalGriff.
OriginalGriff 6-Feb-24 16:03pm    
You're welcome!
samthelab 14-Feb-24 14:48pm    
Hey OriginalGriff:

I have a followup question to my initial question and to your answer. I need your help again.
After making these changes and doing the testing process to get access into
ProgramData directory, success was achieved or so I thought; and success was short lived. Are there permissions surrounding the ProgramData directory, even though it
resides in the root directory that I need to program around? Is the use of the ProgramData directory a 'free all use' for all users on that PC? If so, where did I go wrong? As
mentioned, my original goal was to place some data files into the ProgramData directory, that I could read & write from them; but that has now become nearly impossible.
I'm using MSVC 2019 as my programming platform. Or is my PC all messed up? Do I need to reinstall windows 10?

I'm continually getting the error of "Permission(is) Denied" and on rare occasions; "Invalid Argument" if I push the programming issue on my PC project.

I put together a simple programming example ( using "fopen" and "_fsopen"), not related to the project, trying to figure out the error, and I'm still getting these same errors.

Again Thanks,


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900