Setting File Permissions with wntAccessAdd
Keywords: wntAccessAdd
Question:
How exactly do I set file permissions with the generic (w95) network extender? Examples greatly appreciated.Well, there are times when people running my compiled WIL code get errors, and I've narrowed them down to file permission issues. During the execution of my code, a user will often delete, rewrite, and set attributes for what should ultimately become a publicly readable and writeable file, but sometimes the files' ownerships and R/W flags get changed (if someone messes with a file outside my program, for example). I don't have a coded example, I'd just like to know if there is some way for me to manipulate the user/group/other read/write/execute settings of a file.
Answer:
Well for a FAT file system, FileAttrSet will set the various bits.For NTFS filesystems from a NT machine you need the NT extender, and from a 95/98 machine the 9x Extender would be used.
An important consideration is whether the file in question is a local file or one that resides on a network server.
Be aware that the real, actual NTFS permission setting is done by the CPU in direct control of the physical hard drive - This means that the filename provided must be from that CPU's point of view, not the necessarily the workstation if the file is no a network server.....while as the FileAttrSet works off the access file name...
So for a file on my own NT workstation in an NTFS Partition that I want anyone to do anything with....
wntAccessAdd("", "C:\temp\abd.txt", "Everyone", 300, "File:Full")
Article ID: W13554Filename: Setting File Permissions with wntAccessSet.txt