Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using LogonUser()
Message
De
25/04/2000 07:21:51
 
 
À
24/04/2000 15:33:31
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00362854
Message ID:
00363051
Vues:
17
Hmmm ... Your citing this reminds me of reading something about this in the MSDN docs during my roamings to try to understand it. Thanks for pointing this out. I'll have to see what I need to do to convert the C code to VFP. Thanks again Ed.

>>
>
>It's overwhelmingly likely that while the account may be granted the privilege, you need to set the process token set using AdjustTokenPrivilege() API call. The following is cut from the MSDN docs
Enabling and Disabling Privileges
>The following example shows how to enable or disable a privilege in an access token. The example calls the LookupPrivilegeValue function to get the LUID that the local system uses to identify the privilege. Then the example calls the AdjustTokenPrivileges function, which either enables or disables the privilege that depends on the value of the bEnablePrivilege parameter.
>
>
BOOL SetPrivilege(
>    HANDLE hToken,          // access token handle
>    LPCTSTR lpszPrivilege,  // name of privilege to enable/disable
>    BOOL bEnablePrivilege   // to enable or disable privilege
>    )
>{
>TOKEN_PRIVILEGES tp;
>LUID luid;
>
>if ( !LookupPrivilegeValue(
>        NULL,            // lookup privilege on local system
>        lpszPrivilege,   // privilege to lookup
>        &luid ) ) {      // receives LUID of privilege
>    printf("LookupPrivilegeValue error: %u\n", GetLastError() );
>    return FALSE;
>}
>
>tp.PrivilegeCount = 1;
>tp.Privileges[0].Luid = luid;
>if (bEnablePrivilege)
>    tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
>else
>    tp.Privileges[0].Attributes = 0;
>
>// Enable the privilege or disable all privileges.
>
>AdjustTokenPrivileges(
>       hToken,
>       FALSE,
>       &tp,
>       sizeof(TOKEN_PRIVILEGES),
>       (PTOKEN_PRIVILEGES) NULL,
>       (PDWORD) NULL);
>
>// Call GetLastError to determine whether the function succeeded.
>
>if (GetLastError() != ERROR_SUCCESS) {
>      printf("AdjustTokenPrivileges failed: %u\n", GetLastError() );
>      return FALSE;
>}
>
>return TRUE;
>}
>
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform