ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Forum AtoutFox : Re: LookupAccountSid() - trouver le nom d'un utilisateur système à partir   

Sujet

rss Flux RSS des derniers messages

Vous devez vous identifier pour pouvoir poser une question ou répondre.

sam. 24 mars 2012, 14h47
Thierry N
atoutfox.public.association

Re: LookupAccountSid() - trouver le nom d'un utilisateur système à partir

Le code de Christophe semble fonctionner.

Pouvez-vous m'aider à encoder le SID pour le passer à LookupAccountSID() ?

Mon but est de connaître les noms des principaux comptes et groupes
(tout le monde, administrateurs, utilisateurs avec pouvoir, etc.)
quelque soit la version localisée de windows (e.g. 'Tout le monde' c'est
'Everyone' en Windows anglophone).

La liste des SID est ici
http://support.microsoft.com/kb/243330

La définition du format ici
http://msdn.microsoft.com/en-us/library/windows/desktop/aa379594%28v=vs.85%29.aspx

Si je pouvais avoir un exemple d'encodage sur 'Tout le monde' ce serait
super :

SID: S-1-1-0
Name: Everyone
Description: A group that includes all users, even anonymous users and
guests. Membership is controlled by the operating system.

Merci d'avance,
thn
FoxInCloud

Le 23/03/12 18:59, OlivierH a écrit :
> La réponse de fin de Christophe chenavier :
>
> http://fr.narkive.com/2004/8/13/2355732-openprocess.html
>
> Olivier,
>
>
> Le 23/03/2012 18:27, Thierry N a écrit :
>> Bonjour,
>>
>> Auriez-vous un exemple de code VFP utilisant la fonction Win API
>> LookupAccountSid()
>>
>> Merci,
>> thn
>> ---------------------------
>> LookupAccountSid
>>
>> The LookupAccountSid function accepts a security identifier (SID) as
>> input. It retrieves the name of the account for this SID and the name of
>> the first domain on which this SID is found.
>>
>> BOOL WINAPI LookupAccountSid(
>> __in_opt LPCTSTR lpSystemName,
>> __in PSID lpSid,
>> __out_opt LPTSTR lpName,
>> __inout LPDWORD cchName,
>> __out_opt LPTSTR lpReferencedDomainName,
>> __inout LPDWORD cchReferencedDomainName,
>> __out PSID_NAME_USE peUse
>> );
>>
>> lpSystemName [in, optional]
>> A pointer to a null-terminated character string that specifies the
>> target computer. This string can be the name of a remote computer. If
>> this parameter is NULL, the account name translation begins on the local
>> system. If the name cannot be resolved on the local system, this
>> function will try to resolve the name using domain controllers trusted
>> by the local system. Generally, specify a value for lpSystemName only
>> when the account is in an untrusted domain and the name of a computer in
>> that domain is known.
>>
>> lpSid [in]
>> A pointer to the SID to look up.
>>
>> lpName [out, optional]
>> A pointer to a buffer that receives a null-terminated string that
>> contains the account name that corresponds to the lpSid parameter.
>>
>> cchName [in, out]
>> On input, specifies the size, in TCHARs, of the lpName buffer. If the
>> function fails because the buffer is too small or if cchName is zero,
>> cchName receives the required buffer size, including the terminating
>> null character.
>>
>> lpReferencedDomainName [out, optional]
>> A pointer to a buffer that receives a null-terminated string that
>> contains the name of the domain where the account name was found.
>> On a server, the domain name returned for most accounts in the security
>> database of the local computer is the name of the domain for which the
>> server is a domain controller.
>> On a workstation, the domain name returned for most accounts in the
>> security database of the local computer is the name of the computer as
>> of the last start of the system (backslashes are excluded). If the name
>> of the computer changes, the old name continues to be returned as the
>> domain name until the system is restarted.
>> Some accounts are predefined by the system. The domain name returned for
>> these accounts is BUILTIN.
>>
>> cchReferencedDomainName [in, out]
>> On input, specifies the size, in TCHARs, of the lpReferencedDomainName
>> buffer. If the function fails because the buffer is too small or if
>> cchReferencedDomainName is zero, cchReferencedDomainName receives the
>> required buffer size, including the terminating null character.
>>
>> peUse [out]
>> A pointer to a variable that receives a SID_NAME_USE value that
>> indicates the type of the account.
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000008489
20 286 messages dans le forum • Liste complète des messages

www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2026.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3