Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adjusting Process Token Privileges
Message
From
08/11/2001 13:46:32
Patrice Henrion
Ratp Est-Ct-Rsat
Paris, France
 
 
To
All
General information
Forum:
Borland C++ Builder
Category:
C++ Builder Language
Title:
Adjusting Process Token Privileges
Miscellaneous
Thread ID:
00579264
Message ID:
00579264
Views:
117
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 ...---...
Reply
Map
View

Click here to load this message in the networking platform