Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
2.0 KiB

#include "precomp.h"
#include "ScriptKiller.h"
// the only one we'll ever need
CScriptKillerTimer g_scriptKillerTimer;
// last meal is the scheduled execution date
HRESULT CScriptKillerTimer::ScheduleAssassination(IActiveScript* pScript, FILETIME lastMeal, SCRIPTTHREADID threadID)
{
HRESULT hr = WBEM_E_FAILED;
CScriptKiller* pKiller;
if (pKiller = new CScriptKiller(pScript, lastMeal, threadID, m_pControl))
hr = CKillerTimer::ScheduleAssassination(pKiller);
else
// allocation failed
hr = WBEM_E_OUT_OF_MEMORY;
return hr;
}
// terminate script
void CScriptKiller::Die()
{
if (m_pScript)
{
EXCEPINFO info;
ZeroMemory(&info, sizeof(EXCEPINFO));
HRESULT hr;
// regardless of what the dox say, KB article Q182946 says to pass NULL for the second parm. Really.
// experimentation shows that zero-ing out the info struct works, too.
//hr = pScript->InterruptScriptThread(m_threadID, &info, 0);
hr = m_pScript->SetScriptState(SCRIPTSTATE_DISCONNECTED);
hr = m_pScript->InterruptScriptThread(SCRIPTTHREADID_ALL, &info, 0);
}
/***********************
stream method
if (m_pStream)
{
EXCEPINFO info;
ZeroMemory(&info, sizeof(EXCEPINFO));
IActiveScript* pScript;
HRESULT hr = CoGetInterfaceAndReleaseStream(m_pStream, IID_IActiveScript, (LPVOID *) &pScript);
m_pStream = NULL;
// regardless of what the dox say, KB article Q182946 says to pass NULL for the second parm. Really.
// experimentation shows that zero-ing out the info struct works, too.
//hr = pScript->InterruptScriptThread(m_threadID, &info, 0);
hr = pScript->InterruptScriptThread(SCRIPTTHREADID_ALL, &info, 0);
hr = pScript->SetScriptState(SCRIPTSTATE_DISCONNECTED);
pScript->Release();
}
*****************************/
}