Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adjusting Process Token Privileges
Message
De
08/11/2001 13:46:32
Patrice Henrion
Ratp Est-Ct-Rsat
Paris, France
 
 
À
Tous
Information générale
Forum:
Borland C++ Builder
Catégorie:
Langage C++ Builder
Titre:
Adjusting Process Token Privileges
Divers
Thread ID:
00579264
Message ID:
00579264
Vues:
118
Mistery ! Bizarre Bizarre !

Example for change the time when you have not the level of privilege
to execute.

... HANDLE hToken;
... TOKEN_PRIVILEGES newtp, oldtp;
... DWORD dwSize;
... LUID luid;

... if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES,
&hToken))
... Error -->

... if (!LookupPrivilegeValue(NULL, SE_SYSTEMTIME_NAME, &luid))
... Error -->

... newtp.PrivilegeCount = 1;
... newtp.Privileges[0].Luid = luid;
... newtp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;

... if (!AdjustTokenPrivileges(hToken, FALSE, &newtp,
sizeof(TOKEN_PRIVILEGES), &oldtp, &dwSize);
... Error -->

... if (!SetLocalTime(&ParisTime))
Error -->
========================================================
= Here all time with (1314) ERROR_PRIVILEGE_NOT_HELD =
========================================================

// For disable SE_SYSTEMTIME_NAME again
... AdjustTokenPrivileges(hToken, FALSE, &oldtp, dwSize, NULL, NULL);

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The same problem for Windows NT4 or 2K why ? SOS ...---...
Répondre
Fil
Voir

Click here to load this message in the networking platform