AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Permission/Zugriffsrechte Dateien und Verzeichnisse ändern ?
Thema durchsuchen
Ansicht
Themen-Optionen

Permission/Zugriffsrechte Dateien und Verzeichnisse ändern ?

Offene Frage von "QuickAndDirty"
Ein Thema von Orakel-von-Delphi · begonnen am 28. Sep 2004 · letzter Beitrag vom 1. Jun 2012
 
QuickAndDirty

Registriert seit: 13. Jan 2004
Ort: Hamm(Westf)
1.996 Beiträge
 
Delphi 12 Athens
 
#9

AW: Permission/Zugriffsrechte Dateien und Verzeichnisse ändern ?

  Alt 2. Apr 2012, 10:55
Ist folgende Änderung korrekt?
Delphi-Quellcode:
      //A.R. Jeder = S-1-1-0
      if Ansiuppercase(lpszAccountName)='JEDERthen
      Begin
        pUserSID := PAnsichar(''#1#1#0#0#0#0#0#1#0#0#0#0);
        cbUserSID := 12;
      end
      Else
      Begin
        //
        // STEP 1: Get SID of the account name specified.
        //
        fAPISuccess := LookupAccountName(nil, lpszAccountName,
              pUserSID, cbUserSID, szDomain, cbDomain, snuType);

        // API should have failed with insufficient buffer.
        if (Not fAPISuccess) AND (GetLastError() <> ERROR_INSUFFICIENT_BUFFER) then
           raise Exception.Create('LookupAccountName Error=' + IntToStr(GetLastError()));

        pUserSID := myheapalloc(cbUserSID);
        if pUserSID = nil then
           raise Exception.Create('myheapalloc Error=' + IntToStr(GetLastError()));

        szDomain := PChar(myheapalloc(cbDomain * sizeof(PChar)));
        if szDomain = nil then
           raise Exception.Create('myheapalloc Error=' + IntToStr(GetLastError()));

        fAPISuccess := LookupAccountName(nil, lpszAccountName,
              pUserSID, cbUserSID, szDomain, cbDomain, snuType);
        if Not fAPISuccess then
           raise Exception.Create('LookupAccountName Error=' + IntToStr(GetLastError()));
      end;
Delphi-Quellcode:
   if Ansiuppercase(lpszAccountName)<>'JEDERthen //A.R. nur freigeben wenn angelegt
   Begin
     if pUserSID <> nil then
        myheapfree(pUserSID);

     if szDomain <> nil then
        myheapfree(szDomain);
   end;
Andreas
Monads? Wtf are Monads?

Geändert von QuickAndDirty ( 2. Apr 2012 um 13:10 Uhr)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:31 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz