how to protect files like this?
-
I have a file (d://*.txt) require : 1.My app(exe) can read ,write ,delete ,update this file; 2.user(you or me) can't write ,update ,delete this file,but he can read this file. can you give me advise please? thanks
-
Open the file in read-only mode, and keep it open. That way no one can write to, or delete the file. When you need to write to it, or update it or delete it, close the file handle, then do whatever you want with it. Have fun. this is this.
-
-
not a good method. there's no need to use memory and processor ressources... NTFS provides rights on the file system, which allow you to set who can and who cannot access the file/directory, and how wide is the authorization for one on that file...
TOXCCT >>> GEII power
[toxcct][VisualCalc] -
not a good method. there's no need to use memory and processor ressources... NTFS provides rights on the file system, which allow you to set who can and who cannot access the file/directory, and how wide is the authorization for one on that file...
TOXCCT >>> GEII power
[toxcct][VisualCalc] -
I have a file (d://*.txt) require : 1.My app(exe) can read ,write ,delete ,update this file; 2.user(you or me) can't write ,update ,delete this file,but he can read this file. can you give me advise please? thanks
To expand on toxcct's suggestion. Deny all access to the file except for one user (a user that is not used by any person). Then in your program, impersonate that user before trying to update the file. See
CreateProcessWithLogonW()
. Make sense?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown