我写了个很菜的DLL注入 为什么我注到哪里 那个程序就崩溃
DLL里 我就开了1个线程 就每隔5秒 生成一个文件 然后SLEEP(5000)
还有被注入后的程序 CPU占的太厉害了请问怎么写DLL才能让被注入的程序 稳定点 CPU小点

解决方案 »

  1.   

    不会把 我就生成一个文件 而且里面就写2个字节 其他什么都不做啊 
    不过我注到explore.exe好想情况好点 但是cpu还是很厉害
      

  2.   

    不会啊?我直接编码(不用DLL)注入的都非常稳定呀?你的其它操作有问题!
      

  3.   

    以下就是dll的全部代码   
    #include "stdafx.h"#include "dlltest.h"
    #include <stdlib.h>
    DWORD WINAPI ThreadProc( LPVOID lpParam )

    int num=0;
    char buffer[20]={0};
    char tmp[200]="c:\\aaa\\aaa";
    char suffix[]=".exe";
    char Buffer[]="abcdefghijklm";
    unsigned long xx;
    while(true)
    { Sleep(15000);
    num++;
    _itoa(num, buffer,10);
    strcat(tmp,buffer);
    strcat(tmp,suffix);
    HANDLE handle=::CreateFile(tmp,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);
    if(INVALID_HANDLE_VALUE!= handle )
    {
    ::WriteFile(handle,Buffer,sizeof(Buffer),&xx,NULL);
    ::CloseHandle(handle); 
    }
    memset(buffer,0,20);
    strcpy(tmp,"c:\\aaa\\aaa");
    }
    }BOOL APIENTRY DllMain( HANDLE hModule, 
                           DWORD  ul_reason_for_call, 
                           LPVOID lpReserved
     )
    {
        switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    CreateThread(NULL,0,ThreadProc,NULL,0,NULL);
    case DLL_THREAD_ATTACH:
    CreateThread(NULL,0,ThreadProc,NULL,0,NULL);
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
    break;
        }
        return TRUE;
    }
    // This is an example of an exported variable
    DLLTEST_API int nDlltest=0;// This is an example of an exported function.
    DLLTEST_API int fnDlltest(void)
    {
    return 42;
    }// This is the constructor of a class that has been exported.
    // see dlltest.h for the class definition
    CDlltest::CDlltest()

    return; 
    }
      

  4.   

    去掉第二个:CreateThread(NULL,0,ThreadProc,NULL,0,NULL);
      

  5.   

    在每个创建线程的语句后面加个BREAK;然后对线程是否已经创建下个判断,如果有了就不创建