Hi every one
the following c++ code shut down pc ,can any one convert those lines to c#
TOKEN_PRIVILEGES tkp;HANDLE hToken;OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken);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);ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE,0);
c# require those lines(some thing wrong in the following line)and should be above the above previous c++ code when it converted 2 c#
[DllImport("user32.dll")]
public static extern int ExitWindowsEx(int operationFlag, int operationReason);
[DllImport("windowsx.dll")]
public static extern int AdjustTokenPrivileges(int hToken,bool FALSE,(PTOKEN_PRIVILEGES) tkp,DWORD ii,
PTOKEN_PRIVILEGES NULL, PDWORD jj);