From the MSDN
Quote:The AdjustTokenPrivileges function cannot add new privileges to the access token. It can only enable or disable the token's existing privileges. To determine the token's privileges, call the GetTokenInformation function.
As first step you may check the privileges as suggested by the MSDN.
The code must be executed with sufficient privileges. Users are usually allowed to shutdown and restart. But you are trying to do this remotely using SNMP. The MS SNMP agent is a service which is probably not allowed to shutdown the system (I don't know for sure, but it makes sense that a service is not allowed to shutdown without any user interaction).