procedure CreateMemFile;
var
aSA : TSecurityAttributes;
aSD : TSecurityDescriptor;
begin
aSA.nLength := SizeOf(TSecurityAttributes);
aSA.bInheritHandle := true;
aSa.lpSecurityDescriptor := @aSd;
InitializeSecurityDescriptor(aSa.lpSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION);
// Das ist die massgebliche Zeile, und hier der Parameter nil:
// If this parameter is NULL, a NULL discretionary ACL is assigned to the security descriptor, allowing all access to
// the object. The discretionary ACL is referenced by, not copied into, the security descriptor.
SetSecurityDescriptorDacl(aSa.lpSecurityDescriptor, True,
nil, False);
MemFile := CreateFileMapping($ffffffff, @aSa, PAGE_READWRITE, 0, SizeOf(TSharedData), '
FlexiCom');
if MemFile = 0
then
begin
raise Exception.Create(GetErrTxt(GetLastError));
end;
SharedData := MapViewOfFile(MemFile, FILE_MAP_ALL_ACCESS, 0, 0, SizeOf(TSharedData));
if SharedData=nil
then
begin
CloseHandle(MemFile);
raise Exception.Create(GetErrTxt(GetLastError));
end;
SharedData^ := '
';
end;