Hi Guys,
For the last few hours I've been messing around with a Win32 function called "OpenProcessToken" (or the Nt version)
in order to be able to gain shutdown privileges.
This is the code I'm currently using, and my machine is running Windows 8.1 x64.
There is also no difference between launching it as an administrator or not (UAC is currently enabled).
I also searched the web, but couldn't come up with a viable solution to this problem.
I read though that a special privilege (SeCreateTokenPrivilege) is needed, but removed from the entire system after service start up.
So even as an administrator there is no way to debug programs (SeDebugPrivilege is needed) or to load a driver (SeLoadDriverPrivilege) if these privileges are not being enabled by default??
WTF?
So what might I'm doing wrong?
Or does there really no solution exist addressing this issue?
Best regards - Microwave89
For the last few hours I've been messing around with a Win32 function called "OpenProcessToken" (or the Nt version)
in order to be able to gain shutdown privileges.
This is the code I'm currently using, and my machine is running Windows 8.1 x64.
Code: Select all
Unfortunately, the code fails always with an "access denied" error!HANDLE hCurrProcess = GetCurrentProcess();
if (!OpenProcessToken(hCurrProcess, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, phTokenHandle)){
MessageBoxW(NULL, L"fail", L"fail", 0);
return -1;
}
There is also no difference between launching it as an administrator or not (UAC is currently enabled).
I also searched the web, but couldn't come up with a viable solution to this problem.
I read though that a special privilege (SeCreateTokenPrivilege) is needed, but removed from the entire system after service start up.
So even as an administrator there is no way to debug programs (SeDebugPrivilege is needed) or to load a driver (SeLoadDriverPrivilege) if these privileges are not being enabled by default??
WTF?
So what might I'm doing wrong?
Or does there really no solution exist addressing this issue?
Best regards - Microwave89