#include
#include
void main()
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if(!OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&hToken))
return;
//error C2065: 'LookupPrivilegevalue' : undeclared identifier
// Error executing cl.exe.
LookupPrivilegevalue(NULL,SE_SHUTDOWN_NAME,&tkp.Privileges[0].Luid);
tkp.PrivilegeCount=1;
tkp.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken,FALSE,&tkp,0,(PTOKEN_PRIVILEGES)NULL,0);
InitiateSystemShutdown(
NULL,
NULL,
0,
TRUE,
FALSE
);
}
}
错误已经在代码中注释了,请指教! |