Cайт Алексея и Александра Друцы — программирование, ИТ, математика
tkill.cpp
#include "stdio.h"
#include <windows.h>

DWORD WINAPI tt(LPDWORD arg)
{
   Sleep(INFINITE);
   return 0;
}

void TT()
{
   ExitThread(0);
}


int KillThread(HANDLE xx)
{
   CONTEXT yy;
   if(xx == INVALID_HANDLE_VALUE ) return 0;
   yy.ContextFlags = CONTEXT_CONTROL;
   if( SuspendThread(xx)==0xFFFFFFFF ) return 0;
   if(!GetThreadContext(xx,&yy)) return 0;
   yy.Eip = (DWORD)&TT;
   yy.ContextFlags = CONTEXT_CONTROL;
   SetThreadContext(xx,&yy);
   ResumeThread(xx);

   CloseHandle(xx);
   return 1;
}

int main()
{
   DWORD tid;
   HANDLE th;
   while(1)
   {
      th = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)&tt,NULL,NULL,&tid);
      //TerminateThread(th,0);
      KillThread(th);
      WaitForSingleObject(th,INFINITE);
      Sleep(500);
   }
   return 0;
}
Скачать файл
Информация о файле
Название:tkill.cpp
Размер:759 B
Тип:Исходный код С++
Скачивали:57 раз
Цитаты

"К-мерная музыка - это слишком плоско"
- Жители k+1-ого измерения

At least now I'm sure you're not Pinochio, because if you were, your nose would've crashed into your monitor by now.
- TPB

The problem here seems to be that the material is unreleased? If that is the case, you can easily fix the problem by releasing it. We'll be more than glad to help you distribute it - free of charge! - to our users.
- TPB

 
© Alexey & Alexander Drutsa, 2009–2011