| 65 | |
| 66 | |
| 67 | void ExtractACL(Archive &Arc,const wchar *FileName) |
| 68 | { |
| 69 | Array<byte> SubData; |
| 70 | if (!Arc.ReadSubData(&SubData,NULL,false)) |
| 71 | return; |
| 72 | |
| 73 | SetACLPrivileges(); |
| 74 | |
| 75 | SECURITY_INFORMATION si=OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION| |
| 76 | DACL_SECURITY_INFORMATION; |
| 77 | if (ReadSacl) |
| 78 | si|=SACL_SECURITY_INFORMATION; |
| 79 | SECURITY_DESCRIPTOR *sd=(SECURITY_DESCRIPTOR *)&SubData[0]; |
| 80 | |
| 81 | int SetCode=SetFileSecurity(FileName,si,sd); |
| 82 | if (!SetCode) |
| 83 | { |
| 84 | wchar LongName[NM]; |
| 85 | if (GetWinLongPath(FileName,LongName,ASIZE(LongName))) |
| 86 | SetCode=SetFileSecurity(LongName,si,sd); |
| 87 | } |
| 88 | |
| 89 | if (!SetCode) |
| 90 | { |
| 91 | uiMsg(UIERROR_ACLSET,Arc.FileName,FileName); |
| 92 | DWORD LastError=GetLastError(); |
| 93 | ErrHandler.SysErrMsg(); |
| 94 | if (LastError==ERROR_ACCESS_DENIED && !IsUserAdmin()) |
| 95 | uiMsg(UIERROR_NEEDADMIN); |
| 96 | ErrHandler.SetErrorCode(RARX_WARNING); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | |
| 101 | void SetACLPrivileges() |
no test coverage detected