I\'m not sure why but my code bellow does not set permissions for a file. Not sure what could be wrong with the code.
SYSTEM: Windows XP Pro SP2. Running in Admin ac
As it was written QT doesn't support changing access rights for groups on windows. For full control over file permissions try using Access Control List which is located in security descriptor.
MSDN suggests this:
To retrieve the security descriptor of a file or directory object, call the GetNamedSecurityInfo or GetSecurityInfo function. To change the security descriptor of a file or directory object, call the SetNamedSecurityInfo or SetSecurityInfo function.
I think in your case you could try GetNamedSecurityInfo from the first file and pass it to SetNamedSecurityInfo for the second one.
Also you can assign NULL ACL and it will reset all group permissions and grant full access for everyone:
SetNamedSecurityInfoA("C:\file.txt", SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, NULL, NULL);