MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / ExtractACL

Function ExtractACL

Libraries/unrar/win32acl.cpp:67–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65
66
67void 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
101void SetACLPrivileges()

Callers 1

SetExtraInfoFunction · 0.85

Calls 7

SetACLPrivilegesFunction · 0.85
GetWinLongPathFunction · 0.85
uiMsgFunction · 0.85
IsUserAdminFunction · 0.85
ReadSubDataMethod · 0.80
SysErrMsgMethod · 0.80
SetErrorCodeMethod · 0.80

Tested by

no test coverage detected