General information
Forum:
Borland C++ Builder
Category:
C++ Builder Language
Title:
Adjusting Process Token Privileges
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only