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

C Discussion :

Changer le nom du propriétaire d'un fichier


Sujet :

C

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2002
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2002
    Messages : 11
    Points : 9
    Points
    9
    Par défaut Changer le nom du propriétaire d'un fichier
    Je suis sur windows NT4, j'aimerais savoir qu'elle est l'instruction pour pouvoir changer le nom du propriétaire d'un fichier.
    @+
    KURT

  2. #2
    fd
    fd est déconnecté
    Membre habitué
    Profil pro
    Inscrit en
    Mai 2002
    Messages
    131
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2002
    Messages : 131
    Points : 162
    Points
    162
    Par défaut acl
    Je te copie un bout du msdn (si c'est pas exactement ca c'est ds cette direction qu'il faut charcher (les ACL)

    Modifying an Object's ACLs
    [This is preliminary documentation and subject to change.]

    This example adds an ACE to an object's DACL. The sample code uses the GetSecurityInfo function to get the existing DACL. Then it fills an EXPLICIT_ACCESS structure with information about an ACE and uses the SetEntriesInAcl function to merge the new ACE with any existing ACEs in the DACL. Finally, the example calls the SetSecurityInfo function to attach the new DACL to the object's security descriptor.

    The ACCESS_MODE parameter determines the type of new ACE and also how the new ACE is combined with any existing ACEs for the specified trustee.

    GRANT_ACCESS allows access, combining the specified access rights with any existing access-allowed or access-denied ACEs for the trustee.
    SET_ACCESS adds an access-allowed ACE that replaces any existing access-allowed or access-denied ACEs for the trustee.
    DENY_ACCESS denies the specified access rights, combining them with any existing access-allowed or access-denied ACEs for the trustee.
    REVOKE_ACCESS does not create a new ACE. It removes any existing access-allowed or access-denied ACEs for the trustee.
    You can use similar code to work with a SACL. Specify SACL_SECURITY_INFORMATION in the GetSecurityInfo and SetSecurityInfo functions to get and set the object's SACL. Use the SET_AUDIT_SUCCESS, SET_AUDIT_FAILURE, and REVOKE_ACCESS flags in the AccessMode parameter.

    Windows 2000: You can use this code to add an object-specific ACE to the DACL of a directory service object. To specify the GUIDs in an object-specific ACE, set the TrusteeForm parameter to TRUSTEE_IS_OBJECTS_AND_NAME or TRUSTEE_IS_OBJECTS_AND_SID and set the pszTrustee parameter to be a pointer to an OBJECTS_AND_NAME or OBJECTS_AND_SID structure.

    DWORD AddAceToObjectsSecurityDescriptor (
    HANDLE hObject, // handle to object
    SE_OBJECT_TYPE ObjectType, // type of object
    LPTSTR pszTrustee, // trustee for new ACE
    TRUSTEE_FORM TrusteeForm, // format of TRUSTEE structure
    DWORD dwAccessRights, // access mask for new ACE
    ACCESS_MODE AccessMode, // type of ACE
    DWORD dwInheritance // inheritance flags for new ACE
    )
    {
    DWORD dwRes;
    PACL pOldDACL = NULL, pNewDACL = NULL;
    PSECURITY_DESCRIPTOR pSD = NULL;
    EXPLICIT_ACCESS ea;

    if (NULL == hObject)
    return ERROR_INVALID_PARAMETER;

    // Get a pointer to the existing DACL.

    dwRes = GetSecurityInfo(hObject, ObjectType,
    DACL_SECURITY_INFORMATION,
    NULL, NULL, &pOldDACL, NULL, &pSD);
    if (ERROR_SUCCESS != dwRes) {
    printf( "GetSecurityInfo Error %u\n", dwRes );
    goto Cleanup;
    }

    // Initialize an EXPLICIT_ACCESS structure for the new ACE.

    ZeroMemory(&ea, sizeof(EXPLICIT_ACCESS));
    ea.grfAccessPermissions = dwAccessRights;
    ea.grfAccessMode = AccessMode;
    ea.grfInheritance= dwInheritance;
    ea.Trustee.TrusteeForm = TrusteeForm;
    ea.Trustee.ptstrName = pszTrustee;

    // Create a new ACL that merges the new ACE
    // into the existing DACL.

    dwRes = SetEntriesInAcl(1, &ea, pOldDACL, &pNewDACL);
    if (ERROR_SUCCESS != dwRes) {
    printf( "SetEntriesInAcl Error %u\n", dwRes );
    goto Cleanup;
    }

    // Attach the new ACL as the object's DACL.

    dwRes = SetSecurityInfo(hObject, ObjectType,
    DACL_SECURITY_INFORMATION,
    NULL, NULL, pNewDACL, NULL);
    if (ERROR_SUCCESS != dwRes) {
    printf( "SetSecurityInfo Error %u\n", dwRes );
    goto Cleanup;
    }

    Cleanup:

    if(pSD != NULL)
    LocalFree((HLOCAL) pSD);
    if(pNewDACL != NULL)
    LocalFree((HLOCAL) pNewDACL);

    return dwRes;
    }

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mai 2002
    Messages
    11
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2002
    Messages : 11
    Points : 9
    Points
    9
    Par défaut
    Merci pour l'info
    KURT

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

Discussions similaires

  1. Réponses: 3
    Dernier message: 14/02/2007, 10h37
  2. Connaitre le nom du propriétaire d'un fichier
    Par zygoto dans le forum Access
    Réponses: 8
    Dernier message: 12/07/2006, 22h07
  3. Changer le nom par défaut du fichier excel crée
    Par pilou0013 dans le forum Access
    Réponses: 2
    Dernier message: 18/06/2006, 18h30
  4. [Fichier] changer le nom d'un fichier
    Par karibouxe dans le forum Langage
    Réponses: 2
    Dernier message: 26/03/2006, 21h10
  5. Changer le nom d'une section de fichier ini
    Par muquet dans le forum Langage
    Réponses: 4
    Dernier message: 27/01/2006, 13h10

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