Unable to set clock using SetSystemTime on Windows 8

My application uses SetSystemTime()to set the PC clock from a GPS source. This works fine in Windows 7 with disabled user account control, but in Windows 8, even with disabled UAC, it fails. The error I am returning is ERROR_PRIVILEGE_NOT_HELD. The user logging in is in the Administrators group. I can make it work if I run the application as “Run as administrator” in the context menu of the file in Explorer, but the logged in user is an administrator.

So ... what do I need to do differently in Windows 8 to get it SetSysytemTime()to work? Do I need even higher privileges than the administrator rights of the current user? If so, what has higher privileges than the Administrator? Or do I need to configure my user account differently so that these calls work in Windows 8?

EDIT: As noted in the comments, a manual attempt to enable privilege SE_SYSTEMTIME_NAMEdoes not work. Also does not try to add privilege using the proposed MSDN method LsaAddAccountRights.

+5
source share
2 answers

, , UAC Windows 8 ( ) , (. ).

, requireAdministrator

+3

UAC " ", , UAC - , - . - , ( " " "requireAdministrator" ) .

" : " "EnableLUA" ​​ 0 , Metro .

, , .

, ( ) (-) , "highAvailable" .

+4

All Articles