| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 606 人关注过本帖
标题:在本进程中删除别的进程的.DLL
只看楼主 加入收藏
xishui777
Rank: 2
等 级:论坛游民
帖 子:53
专家分:94
注 册:2010-8-17
结帖率:100%
收藏
 问题点数:0 回复次数:0 
在本进程中删除别的进程的.DLL
void CCEQQDlg::OnButton1()
{
    // TODO: Add your control notification handler code here
    DWORD pid;
    HANDLE handle;
    PROCESSENTRY32 p32;
    p32.dwSize=sizeof(PROCESSENTRY32);
    handle=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
    bool bol=Process32First(handle,&p32);
    while(bol)
    {
        if(strcmp(p32.szExeFile,"QQGame.exe")==0)
        {
             pid=p32.th32ProcessID;
             HANDLE ph=::OpenProcess(PROCESS_ALL_ACCESS,false,pid);
             HANDLE hmodule;
             MODULEENTRY32 m32;
             m32.dwSize=sizeof(MODULEENTRY32);
             hmodule=CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,pid);
             bool bolm=Module32First(hmodule,&m32);
             while(bolm)
             {
                 if(strcmp(m32.szModule,"TenSLX.dll")==0)
                 {
                      //找到要删除的"TenSLX.dll"了。如何编程删除它
                         HANDLE lipai;
                        LUID luid;
                        TOKEN_PRIVILEGES tkp;
                        BOOL bol=::OpenProcessToken(ph,TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,&lipai);
                        if(bol==false)
                        {
                            MessageBox("获得令牌失败");
                            return;
                        }
                         bol=::LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&luid);
                            if(bol==false)
                        {
                            MessageBox("获得令牌失败1");
                            return;
                        }
                        tkp.PrivilegeCount=1;
                        tkp.Privileges[0].Attributes=SE_PRIVILEGE_ENABLED;
                        tkp.Privileges[0].Luid=luid;
                        bol=AdjustTokenPrivileges(lipai,false,&tkp,sizeof(tkp),NULL,NULL);
                        if(bol==false)
                        {
                            MessageBox("获得令牌失败2");
                            return;
                        }
                        MessageBox("提升权限成功");
                        
                        HMODULE hmodule=::LoadLibrary("kernel32.dll");
                        LPVOID free1;
                        free1=GetProcAddress(hmodule,"FreeLibrary");
                        DWORD id;
                        HANDLE hThread=CreateRemoteThread(ph,NULL,0,
                        (LPTHREAD_START_ROUTINE)free1,(HMODULE)m32.modBaseAddr,0,&id);
                        WaitForSingleObject(hThread,   INFINITE);
                        MessageBox("删除DLL成功");
                        //SetHook(m32.szModule);
                     
                 }
                 bolm=Module32Next(hmodule,&m32);
             }     
        }
        bol=Process32Next(handle,&p32);
    }
    CloseHandle(handle);

}
程序执行没有报错,就是删除不了TenSLX.dll不知道错在哪里了
搜索更多相关主题的帖子: false control void 
2012-06-22 16:04
快速回复:在本进程中删除别的进程的.DLL
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015433 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved