Einzelnen Beitrag anzeigen

QuickAndDirty

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

AW: Permission/Zugriffsrechte Dateien und Verzeichnisse ändern ?

  Alt 2. Apr 2012, 11: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 14:10 Uhr)
  Mit Zitat antworten Zitat