I would like to make a file that only my program has permissions to write in/read/visualize the file, in windows 7 we have those permissions but I don’t know how to make from a user that I create, the user will be only my executable, only it can see, read and write in the file.
I saw a program doing that, but I have no idea how to do it.
Thanks in advance, I’m sorry for not posting code, because it wouldn’t be helpful since I don’t know how to deal with permissions in windows via C++.
You can’t restrict file access to only your app. You can only restrict access to specific user accounts and/or groups. Look at the
SetFileSecurity()andSetNamedSecurityInfo()functions for that. If a suitable user account with adequate permissions runs your app (or any app for that matter), or your app (or another app) impersonates such an account, it will be able to access the file.