Einzelnen Beitrag anzeigen

UliBru

Registriert seit: 10. Mai 2010
155 Beiträge
 
Delphi 11 Alexandria
 
#3

AW: CreateFileMapping und Admin-Mode

  Alt 19. Jun 2017, 10:30
Ich verwende bisher u.a. den Aufruf

  hmmfApplicationName := CreateFileMapping(INVALID_HANDLE_VALUE, nil, PAGE_READWRITE, 0, SizeOf(TmmfApplicationName), PChar('AppNameXYZ'));

Vermutlich liegt das Problem daran, dass der zweite Parameter nil ist.
Dass also anstelle von nil ein passender Pointer auf SecurityAttributes übergeben werden muss, so dass jedes andere Programm auf das memory mapped file bekommt, auch wenn eben das CreateFileMapping im Admin-Mode ausgeführt wird.

Soweit ich mittlerweile herausgefunden habe scheint wohl die Lösung darin zu liegen
Zitat:
Ah the infamous NULL security issue. This applies to all security attributes in Win32. The problem is that a NULL security attribute means you want to use the default security of the process/thread. This means it is specific to a user. If you want anybody to have access to the object in question then you need to instead use a NULL descriptor (which is different). A NULL descriptor is a DACL that is set to NULL. This means anybody has access.
Jetzt müsste ich bloss wissen, wie man das in Delphi korrekt anstellt. NULL und nil scheinen dabei auch nicht dasselbe zu sein.

Grüsse
Uli
Er wollte so richtig in Delphi einsteigen. Nun steckt er ganz tief drin ...
  Mit Zitat antworten Zitat