From: Tor L. <tm...@ik...> - 2009-11-13 13:02:23
|
And let me add that if one would want to implement (not "port") a chown command for Windows (i.e. "native" Windows, not Cygwin or MSYS), it is not possible to write a POSIX-style funtion with uid_t and gid_t owner and group parameters to actually do it, as Windows doesn't have integer uids and gids. Instead one would need to look up the SIDs corresponding to the user (and perhaps group) names mentioned on the command line, get the security descriptor of the file, change the owner (and perhaps primary group) SIDs in that, and set the file's security descriptor. Something like that. Check MSDN for details, start browsing from SetFileSecurity or SetNamedSecurityInfo for instance. --tml |