|
Borland C ++ Builder FAQ
|
||
| The content | The last update: 12/12/2008 | |
|
Why, when I use function KillProcByPid from a question How"to kill" process, knowing it pid? ", некотрые processes"do not die"? The author: OlegGG All dares performance of this function before call KillProcByPid: bool SetDebugStatusForCurentProc ()
{
HANDLE hToken;
LUID DebugValue;
TOKEN_PRIVILEGES tkp;
if (! OpenProcessToken (GetCurrentProcess (), TOKEN_ADJUST_PRIVILEGES |
TOKEN_QUERY,&hToken))
{
return false;
}
if (! LookupPrivilegeValue ((LPSTR) NULL,SE_DEBUG_NAME,&DebugValue))
{
return false;
}
tkp. PrivilegeCount = 1;
tkp. Privileges [0].Luid = DebugValue;
tkp. Privileges [0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges (hToken,FALSE,&tkp,sizeof (TOKEN_PRIVILEGES), (PTOKEN_PRIVILEGES)
NULL, (PDWORD) NULL);
if (GetLastError ()! = ERROR_SUCCESS)
{
return false;
}
return true;
}
PS before killing винлогон save your filesPPS if to kill винлогон, will be ребут:D PPPS for consequences I do not carry responsibility!!!!!!!!:P |