Hier mein Stand, wie du siehst ist GetSecurityDescriptorControl noch ziemlich mit Fragezeichen behaftet. Der Weg müßte aber OK sein.
Delphi-Quellcode:
private
{ Private-Deklarationen }
FFiH : THandle;
...
procedure TForm1.Button1Click(Sender: TObject);
var FileName: String;
SecAtr: Security_Attributes;
SD: SECURITY_DESCRIPTOR;
PSD: PSecurity_Descriptor;
PSDSize, needed: dword;
begin
if OpenDialog1.Execute then begin
FileName := OpenDIalog1.FileName;
If Length(FileName) = 0 then Exit;
// Security_Attributes - Struktur füllen
Fillchar(SecAtr, Sizeof(Security_Attributes), 0);
secAtr.bInheritHandle := True;
secAtr.nLength := Sizeof(SecAtr);
// secAtr.lpSecurityDescriptor := nil;
if (GetFileSecurity(PChar(FileName),
OWNER_SECURITY_INFORMATION,
PSD,
PSDSize,
needed) = true) and (GetLastError = Error_Success)
then begin
if (GetSecurityDescriptorControl(PSD,
SE_OWNER_DEFAULTED,
?) = true) and (GetLastError = Error_Success)
then begin
end;
end;
end;
end;