IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage Delphi Discussion :

Permission dossier et fichier Windows


Sujet :

Langage Delphi

  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    203
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : Canada

    Informations forums :
    Inscription : Juillet 2007
    Messages : 203
    Points : 146
    Points
    146
    Par défaut Permission dossier et fichier Windows
    Bonjour,

    Quelqu'un pourrait me dire comment faire pour obtenir le plus d'information possible sur un fichier ou un dossier à propos des permissions ...

    Je désire avoir le plus d'info possible : Propriétaire, Lecture/Écriture

    La function FileGetAttr ne me suffit pas...

    Une alternative ????

    Merci beaucoup

  2. #2
    Membre expérimenté

    Homme Profil pro
    Inscrit en
    Mars 2004
    Messages
    897
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2004
    Messages : 897
    Points : 1 561
    Points
    1 561
    Par défaut
    Un lien vers le site de Mathias Rauren. Tu peux y télécharger sa MadCollection où tu trouveras ses outils MadSecutity qui te permettrons d'obtenir toutes les informations sur les fichiers et dossiers.
    Pensez à utiliser les tags dans le titre.
    Avant de poser une question reportez-vous à la FAQ Delphi
    Respectez les règles du forum.

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    203
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : Canada

    Informations forums :
    Inscription : Juillet 2007
    Messages : 203
    Points : 146
    Points
    146
    Par défaut
    Après un coup d'oeil rapide sur les sources, ça me semble efficace mais je ne veux pas installer ces packages dans delphi.

    Je fouillerai les unités afin de parvenir à mes fins.

    Merci beaucoup.

    Si quelqu'un a une autre alternative, je suis preneur ...

  4. #4
    Membre expérimenté

    Homme Profil pro
    Inscrit en
    Mars 2004
    Messages
    897
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2004
    Messages : 897
    Points : 1 561
    Points
    1 561
    Par défaut
    Puisque tu ne veux pas installer les composants de Mathias pourtant si bien faits. En buttinant sur le net on peut concocter un truc de ce genre.

    Ajoute ces deux unités à ton projet:
    aclAPI, accCtrl

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    const 
      SID_REVISION  = 1; 
      FILENAME_ADVAPI32     = 'ADVAPI32.DLL'; 
      PROC_CONVERTSIDTOSTRINGSIDA   = 'ConvertSidToStringSidA';
     
    type 
      TConvertSidToStringSidA = function (Sid: PSID; 
        var StringSid: LPSTR): BOOL; stdcall;
     
    function WinGetSidStr(Sid : PSid) : string;
    var 
      SidToStr      : TConvertSidToStringSidA;
      h             : LongWord; 
      Buf           : array [0..MAX_PATH - 1] of char; 
      p             : PAnsiChar; 
    begin
      h := LoadLibrary (FILENAME_ADVAPI32); 
      if h <> 0 then 
      try 
        @SidToStr := GetProcAddress (h, PROC_CONVERTSIDTOSTRINGSIDA); 
        if @SidToStr <> nil then 
        begin 
          FillChar (Buf, SizeOf(Buf), 0); 
          if SidToStr (Sid, p) then 
            Result := '[' + string(p) + ']'; 
          LocalFree (LongWord(p)); 
        end; 
      finally 
        FreeLibrary (h); 
      end; 
    end;
     
    function SIdToStr(Sid : PSid): string;
    var 
      Psia          : PSIDIdentifierAuthority; 
      SubAuthCount  : LongWord; 
      i             : LongWord; 
    begin 
      if IsValidSid (Sid) then 
      begin
        if (Win32Platform = VER_PLATFORM_WIN32_NT) and 
          (Win32MajorVersion >= 5) then 
          Result := WinGetSidStr(Sid)
        else 
        begin 
          Psia := GetSidIdentifierAuthority (Sid);
          SubAuthCount := GetSidSubAuthorityCount (Sid)^; 
          Result := Format('[S-%u-', [SID_REVISION]); 
          if ((Psia.Value[0] <> 0) or (Psia.Value[1] <> 0)) then 
            Result := Result + Format ('%.2x%.2x%.2x%.2x%.2x%.2x', [Psia.Value[0], 
              Psia.Value[1], Psia.Value[2], Psia.Value[3], Psia.Value[4], 
              Psia.Value[5]]) 
          else 
            Result := Result + Format ('%u', [LongWord(Psia.Value[5]) + 
              LongWord(Psia.Value[4] shl 8) + LongWord(Psia.Value[3] shl 16) + 
              LongWord(Psia.Value[2] shl 24)]); 
          for i := 0 to SubAuthCount - 1 do 
            Result := Result + Format ('-%u', [GetSidSubAuthority(Sid, i)^]); 
          Result := Result + ']'; 
        end; 
    end; 
    end;
     
    function GetName(OwnerSID: PSID):String;
    var
      OwnerName, DomainName: Array[0..100] of Char;
      cbSize: DWORD;
      OwnerType: SID_NAME_USE;
    begin
      cbSize := SizeOf(OwnerName);
      if not LookupAccountSID(nil, OwnerSID, OwnerName,
              cbSize, DomainName, cbSize, OwnerType)
      then result:= SIDToStr(OwnerSID)
      else result:= Format('%s\%s',[DomainName,OwnerName]);
    end;
     
    function GetLocalUserSidStr (const UserName : string) : string;
    var
      RefDomain     : array [0..MAX_PATH - 1] of char;      // enough
      RefDomainSize : LongWord;
      Snu           : SID_NAME_USE;
      Sid           : PSid;
      SidSize       : LongWord;
    begin
      SidSize := 0;
      RefDomainSize := SizeOf(RefDomain);
      Sid := nil;
      FillChar (RefDomain, SizeOf(RefDomain), 0);
      LookupAccountName (nil, PChar(UserName), Sid, SidSize, RefDomain,
      RefDomainSize, Snu);
      Sid := AllocMem (SidSize);
      try
        RefDomainSize := SizeOf(RefDomain);
        if LookupAccountName (nil, PChar(UserName), Sid, SidSize, RefDomain,
          RefDomainSize, Snu) then 
          Result := SidToStr(Sid);
      finally
        FreeMem (Sid, SidSize);
      end;
    end;
     
    procedure GetEAList(filename: string; Alist: TStrings);
    type
      TEAArray = Array [0..0] of EXPLICIT_ACCESS;
      PEAArray = ^TEAArray;
    var
      pSD: PSECURITY_DESCRIPTOR;
      countofexplicitentries: Cardinal;
      ListOfExplicitEntries: PEXPLICIT_ACCESS_A;
      EAList: PEAArray;
      pExplicitAccess: EXPLICIT_ACCESS;
      pDACL: PACL;
      i: integer;
    begin
      AList.Clear;
      if not (GetNamedSecurityInfo(PChar(filename),SE_FILE_OBJECT,
               DACL_SECURITY_INFORMATION, Nil, Nil, @pDACL, Nil,
              pSD)=0)
        then Exit;
      GetMem(ListOfExplicitEntries,SizeOf(ListOfExplicitEntries));
      if GetExplicitEntriesFromAcl(pDACL^,countofexplicitentries,@EAList) <>
        ERROR_SUCCESS
        then begin
               FreeMem(ListOfExplicitEntries);
               Exit;
             end;
      if (countofexplicitentries > 0) then
      for i:= 0 to countofexplicitentries - 1 do
      begin
        pExplicitAccess:= EAList[i];
        AList.Add(GetName(pExplicitAccess.Trustee.ptstrName));
        case pExplicitAccess.Trustee.trusteetype of
          TRUSTEE_IS_USER: Alist.Add('TRUSTEE_IS_USER');
          TRUSTEE_IS_GROUP: Alist.Add('TRUSTEE_IS_GROUP');
          TRUSTEE_IS_DOMAIN: Alist.Add('TRUSTEE_IS_DOMAIN');
          TRUSTEE_IS_ALIAS: Alist.Add('TRUSTEE_IS_ALIAS');
          TRUSTEE_IS_DELETED: Alist.Add('TRUSTEE_IS_DELETED');
          TRUSTEE_IS_INVALID: Alist.Add('TRUSTEE_IS_INVALID');
          TRUSTEE_IS_WELL_KNOWN_GROUP: Alist.Add('TRUSTEE_IS_WELL_KNOWN_GROUP');
          TRUSTEE_IS_UNKNOWN: Alist.Add('TRUSTEE_IS_UNKNOWN');
        end;
        case pExplicitAccess.grfAccessMode of
          NOT_USED_ACCESS: Alist.Add('NOT_USED_ACCESS');
          GRANT_ACCESS: Alist.Add('GRANT_ACCESS');
          SET_ACCESS: Alist.Add('SET_ACCESS');
          DENY_ACCESS: Alist.Add('DENY_ACCESS');
          REVOKE_ACCESS: Alist.Add('REVOKE_ACCESS');
          SET_AUDIT_FAILURE: Alist.Add('SET_AUDIT_FAILURE');
        end;
      end
      else AList.Add('---');
      FreeMem(ListOfExplicitEntries);
    end;
    Tu ajoutes sur un nouveau projet un TListBox et un TButton et le code suivant :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    procedure TForm1.Button1Click(Sender: TObject);
    begin
     GetEAList('c:\export.xls',listBox1.Items);
    end;
    Cela te convient-il ?
    Pensez à utiliser les tags dans le titre.
    Avant de poser une question reportez-vous à la FAQ Delphi
    Respectez les règles du forum.

  5. #5
    Membre expérimenté

    Homme Profil pro
    Inscrit en
    Mars 2004
    Messages
    897
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2004
    Messages : 897
    Points : 1 561
    Points
    1 561
    Par défaut
    Au fait j'allais oublier les permissions

    ajoute : AList.Add(intToStr(pExplicitAccess.grfAccessPermissions))

    Les permissions sont décrites dans l'unité windows.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
      KEY_QUERY_VALUE    = $0001;
      {$EXTERNALSYM KEY_QUERY_VALUE}
      KEY_SET_VALUE      = $0002;
      {$EXTERNALSYM KEY_SET_VALUE}
      KEY_CREATE_SUB_KEY = $0004;
      {$EXTERNALSYM KEY_CREATE_SUB_KEY}
      KEY_ENUMERATE_SUB_KEYS = $0008;
      {$EXTERNALSYM KEY_ENUMERATE_SUB_KEYS}
      KEY_NOTIFY         = $0010;
      {$EXTERNALSYM KEY_NOTIFY}
      KEY_CREATE_LINK    = $0020;
      {$EXTERNALSYM KEY_CREATE_LINK}
     
      KEY_READ           = (STANDARD_RIGHTS_READ or
                            KEY_QUERY_VALUE or
                            KEY_ENUMERATE_SUB_KEYS or
                            KEY_NOTIFY) and not
                            SYNCHRONIZE;
      {$EXTERNALSYM KEY_READ}
     
      KEY_WRITE          = (STANDARD_RIGHTS_WRITE or
                            KEY_SET_VALUE or
                            KEY_CREATE_SUB_KEY) and not
                            SYNCHRONIZE;
      {$EXTERNALSYM KEY_WRITE}
      KEY_EXECUTE        =  KEY_READ and not SYNCHRONIZE;
      {$EXTERNALSYM KEY_EXECUTE}
     
      KEY_ALL_ACCESS     = (STANDARD_RIGHTS_ALL or
                            KEY_QUERY_VALUE or
                            KEY_SET_VALUE or
                            KEY_CREATE_SUB_KEY or
                            KEY_ENUMERATE_SUB_KEYS or
                            KEY_NOTIFY or
                            KEY_CREATE_LINK) and not
                            SYNCHRONIZE;
    Pensez à utiliser les tags dans le titre.
    Avant de poser une question reportez-vous à la FAQ Delphi
    Respectez les règles du forum.

  6. #6
    Membre expérimenté

    Profil pro
    Inscrit en
    Octobre 2002
    Messages
    685
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2002
    Messages : 685
    Points : 1 608
    Points
    1 608
    Par défaut
    En passant, une autre solution est d'utiliser CreateFile avec le flag BACKUP_SEMANTIC et ensuite de faire du BackupRead pour accéder aux flux NTFS stockant les ACLs. La JCL encapsule ca, de mémoire...
    "It's more fun to compute !"

  7. #7
    Membre habitué
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    203
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : Canada

    Informations forums :
    Inscription : Juillet 2007
    Messages : 203
    Points : 146
    Points
    146
    Par défaut
    Très jolie ...

    Cela me convient parfaitement.

    Merci beaucoup à tous pour votre aide.

  8. #8
    Membre éprouvé Avatar de BuzzLeclaire
    Homme Profil pro
    Dev/For/Vte/Ass
    Inscrit en
    Août 2008
    Messages
    1 606
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Dev/For/Vte/Ass

    Informations forums :
    Inscription : Août 2008
    Messages : 1 606
    Points : 1 113
    Points
    1 113
    Par défaut
    Bonjour,
    j'essai d'utiliser ta proposition PAscal,
    mais j'ai systèmatiquement --- quelquesoit le fichier que je choisi.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
     
    unit Unit1;
     
    interface
     
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, aclAPI, accCtrl, StdCtrls;
     
    type
      TForm1 = class(TForm)
        Button1: TButton;
        ListBox1: TListBox;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
     
    var
      Form1: TForm1;
     
    implementation
     
    {$R *.dfm}
    const 
      SID_REVISION  = 1; 
      FILENAME_ADVAPI32     = 'ADVAPI32.DLL'; 
      PROC_CONVERTSIDTOSTRINGSIDA   = 'ConvertSidToStringSidA';
     
    type 
      TConvertSidToStringSidA = function (Sid: PSID; 
        var StringSid: LPSTR): BOOL; stdcall;
     
    function WinGetSidStr(Sid : PSid) : string;
    var 
      SidToStr      : TConvertSidToStringSidA;
      h             : LongWord; 
      Buf           : array [0..MAX_PATH - 1] of char; 
      p             : PAnsiChar; 
    begin
      h := LoadLibrary (FILENAME_ADVAPI32); 
      if h <> 0 then 
      try 
        @SidToStr := GetProcAddress (h, PROC_CONVERTSIDTOSTRINGSIDA); 
        if @SidToStr <> nil then 
        begin 
          FillChar (Buf, SizeOf(Buf), 0); 
          if SidToStr (Sid, p) then 
            Result := '[' + string(p) + ']'; 
          LocalFree (LongWord(p)); 
        end; 
      finally 
        FreeLibrary (h); 
      end; 
    end;
     
    function SIdToStr(Sid : PSid): string;
    var 
      Psia          : PSIDIdentifierAuthority; 
      SubAuthCount  : LongWord; 
      i             : LongWord; 
    begin 
      if IsValidSid (Sid) then 
      begin
        if (Win32Platform = VER_PLATFORM_WIN32_NT) and 
          (Win32MajorVersion >= 5) then 
          Result := WinGetSidStr(Sid)
        else 
        begin 
          Psia := GetSidIdentifierAuthority (Sid);
          SubAuthCount := GetSidSubAuthorityCount (Sid)^; 
          Result := Format('[S-%u-', [SID_REVISION]); 
          if ((Psia.Value[0] <> 0) or (Psia.Value[1] <> 0)) then 
            Result := Result + Format ('%.2x%.2x%.2x%.2x%.2x%.2x', [Psia.Value[0], 
              Psia.Value[1], Psia.Value[2], Psia.Value[3], Psia.Value[4], 
              Psia.Value[5]]) 
          else 
            Result := Result + Format ('%u', [LongWord(Psia.Value[5]) + 
              LongWord(Psia.Value[4] shl 8) + LongWord(Psia.Value[3] shl 16) + 
              LongWord(Psia.Value[2] shl 24)]); 
          for i := 0 to SubAuthCount - 1 do 
            Result := Result + Format ('-%u', [GetSidSubAuthority(Sid, i)^]); 
          Result := Result + ']'; 
        end; 
    end; 
    end;
     
    function GetName(OwnerSID: PSID):String;
    var
      OwnerName, DomainName: Array[0..100] of Char;
      cbSize: DWORD;
      OwnerType: SID_NAME_USE;
    begin
      cbSize := SizeOf(OwnerName);
      if not LookupAccountSID(nil, OwnerSID, OwnerName,
              cbSize, DomainName, cbSize, OwnerType)
      then result:= SIDToStr(OwnerSID)
      else result:= Format('%s\%s',[DomainName,OwnerName]);
    end;
     
    function GetLocalUserSidStr (const UserName : string) : string;
    var
      RefDomain     : array [0..MAX_PATH - 1] of char;      // enough
      RefDomainSize : LongWord;
      Snu           : SID_NAME_USE;
      Sid           : PSid;
      SidSize       : LongWord;
    begin
      SidSize := 0;
      RefDomainSize := SizeOf(RefDomain);
      Sid := nil;
      FillChar (RefDomain, SizeOf(RefDomain), 0);
      LookupAccountName (nil, PChar(UserName), Sid, SidSize, RefDomain,
      RefDomainSize, Snu);
      Sid := AllocMem (SidSize);
      try
        RefDomainSize := SizeOf(RefDomain);
        if LookupAccountName (nil, PChar(UserName), Sid, SidSize, RefDomain,
          RefDomainSize, Snu) then 
          Result := SidToStr(Sid);
      finally
        FreeMem (Sid, SidSize);
      end;
    end;
     
    procedure GetEAList(filename: string; Alist: TStrings);
    type
      TEAArray = Array [0..0] of EXPLICIT_ACCESS;
      PEAArray = ^TEAArray;
    var
      pSD: PSECURITY_DESCRIPTOR;
      countofexplicitentries: Cardinal;
      ListOfExplicitEntries: PEXPLICIT_ACCESS_A;
      EAList: PEAArray;
      pExplicitAccess: EXPLICIT_ACCESS;
      pDACL: PACL;
      i: integer;
    begin
      AList.Clear;
      if not (GetNamedSecurityInfo(PChar(filename),SE_FILE_OBJECT,
               DACL_SECURITY_INFORMATION, Nil, Nil, @pDACL, Nil,
              pSD)=0)
        then Exit;
      GetMem(ListOfExplicitEntries,SizeOf(ListOfExplicitEntries));
      if GetExplicitEntriesFromAcl(pDACL^,countofexplicitentries,@EAList) <>
        ERROR_SUCCESS
        then begin
               FreeMem(ListOfExplicitEntries);
               Exit;
             end;
      if (countofexplicitentries > 0) then
      for i:= 0 to countofexplicitentries - 1 do
      begin
     
        AList.Add(intToStr(pExplicitAccess.grfAccessPermissions));
     
        pExplicitAccess:= EAList[i];
        AList.Add(GetName(pExplicitAccess.Trustee.ptstrName));
        case pExplicitAccess.Trustee.trusteetype of
          TRUSTEE_IS_USER: Alist.Add('TRUSTEE_IS_USER');
          TRUSTEE_IS_GROUP: Alist.Add('TRUSTEE_IS_GROUP');
          TRUSTEE_IS_DOMAIN: Alist.Add('TRUSTEE_IS_DOMAIN');
          TRUSTEE_IS_ALIAS: Alist.Add('TRUSTEE_IS_ALIAS');
          TRUSTEE_IS_DELETED: Alist.Add('TRUSTEE_IS_DELETED');
          TRUSTEE_IS_INVALID: Alist.Add('TRUSTEE_IS_INVALID');
          TRUSTEE_IS_WELL_KNOWN_GROUP: Alist.Add('TRUSTEE_IS_WELL_KNOWN_GROUP');
          TRUSTEE_IS_UNKNOWN: Alist.Add('TRUSTEE_IS_UNKNOWN');
        end;
        case pExplicitAccess.grfAccessMode of
          NOT_USED_ACCESS: Alist.Add('NOT_USED_ACCESS');
          GRANT_ACCESS: Alist.Add('GRANT_ACCESS');
          SET_ACCESS: Alist.Add('SET_ACCESS');
          DENY_ACCESS: Alist.Add('DENY_ACCESS');
          REVOKE_ACCESS: Alist.Add('REVOKE_ACCESS');
          SET_AUDIT_FAILURE: Alist.Add('SET_AUDIT_FAILURE');
        end;
      end
      else AList.Add('---');
      FreeMem(ListOfExplicitEntries);
    end;
     
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      GetEAList('c:\AnalyseApprofondieV5.Fep',listBox1.Items);
    end;
     
    end.


    Tu peux me dire où j'ai fais l'erreur ?

  9. #9
    Membre expérimenté

    Homme Profil pro
    Inscrit en
    Mars 2004
    Messages
    897
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Marne (Champagne Ardenne)

    Informations professionnelles :
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mars 2004
    Messages : 897
    Points : 1 561
    Points
    1 561
    Par défaut
    Soit tu travailles encore sous Windows 98 ou tu n'as pas modifié les droits d'accés de ton fichier sous XP.

    Dans l'explorer, un petit clic droit sur ton fichier, tu vas ensuite dans la partie sécurité tu modifies tout ce que tu veux puis tu regardes ce que tu obtiens ensuite
    Pensez à utiliser les tags dans le titre.
    Avant de poser une question reportez-vous à la FAQ Delphi
    Respectez les règles du forum.

  10. #10
    JYH
    JYH est déconnecté
    Membre à l'essai
    Inscrit en
    Décembre 2005
    Messages
    24
    Détails du profil
    Informations forums :
    Inscription : Décembre 2005
    Messages : 24
    Points : 22
    Points
    22
    Par défaut
    Bonjour,

    désolé de déterrer cet ancien sujet mais je ne trouve rien d'aussi proche de ce que je cherche à faire ...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
     for i:= 0 to countofexplicitentries - 1 do
      begin
     
        AList.Add(intToStr(pExplicitAccess.grfAccessPermissions));  // ici je récupère un nombre qui n'a pas de signification (que pour moi ?)
     
        pExplicitAccess:= EAList[i];                               // je dirais qu'ici je parcours bien les différents accès 
        AList.Add(GetName(pExplicitAccess.Trustee.ptstrName));      // parce qu'ici j'ai bien le nom des utilisateurs ou groupes
     
        case pExplicitAccess.Trustee.trusteetype of                       // la ça se complique j'ai tout le temps "TRUSTEE_IS_UNKNOWN" alors que j'ai des users et des groupes
          TRUSTEE_IS_USER: Alist.Add('TRUSTEE_IS_USER');
          TRUSTEE_IS_GROUP: Alist.Add('TRUSTEE_IS_GROUP');
          TRUSTEE_IS_DOMAIN: Alist.Add('TRUSTEE_IS_DOMAIN');
          TRUSTEE_IS_ALIAS: Alist.Add('TRUSTEE_IS_ALIAS');
          TRUSTEE_IS_DELETED: Alist.Add('TRUSTEE_IS_DELETED');
          TRUSTEE_IS_INVALID: Alist.Add('TRUSTEE_IS_INVALID');
          TRUSTEE_IS_WELL_KNOWN_GROUP: Alist.Add('TRUSTEE_IS_WELL_KNOWN_GROUP');
          TRUSTEE_IS_UNKNOWN: Alist.Add('TRUSTEE_IS_UNKNOWN');
        end;
        case pExplicitAccess.grfAccessMode of                             // pas mieux ici j'ai tout le temps "GRANT_ACCESS" alors que j'ai des droit en lecture, lecture-écriture et contrôle total
          NOT_USED_ACCESS: Alist.Add('NOT_USED_ACCESS');
          GRANT_ACCESS: Alist.Add('GRANT_ACCESS');
          SET_ACCESS: Alist.Add('SET_ACCESS');
          DENY_ACCESS: Alist.Add('DENY_ACCESS');
          REVOKE_ACCESS: Alist.Add('REVOKE_ACCESS');
          SET_AUDIT_FAILURE: Alist.Add('SET_AUDIT_FAILURE');
        end;
    je ne pige pas ou ça coince, quelqu'un aurait il creusé le sujet avec plus de succès ?
    note: le partage est sur un serveur 2012 (ça a peut être sont importance)

    merci d'avance de votre aide

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 1
    Dernier message: 17/01/2010, 14h40
  2. Comment modifier dossiers et fichiers dans Windows ?
    Par totoAussi dans le forum Windows
    Réponses: 2
    Dernier message: 10/11/2009, 15h12
  3. dossier et fichier entre ubuntu et windows
    Par jokers009 dans le forum Linux
    Réponses: 7
    Dernier message: 10/06/2009, 19h07
  4. Copier coller Fichier windows
    Par KPitN dans le forum Windows
    Réponses: 8
    Dernier message: 20/04/2004, 17h32
  5. Dossier ou Fichier avec ShellListView
    Par MoussDiouf dans le forum Langage
    Réponses: 6
    Dernier message: 14/06/2003, 12h33

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo