N
nine_day
Unregistered / Unconfirmed
GUEST, unregistred user!
typedef struct _RemotePara//参数结构
{
char pLoadLibrary[256];
char pGetProcAddress[60];
DWORD dwGetProcAddress;
DWORD dwLoadLibrary;
}RemotePara;
DWORD WINAPI ThreadProc (RemotePara *lpPara)
{
typedef HMODULE (WINAPI *LOADLIBRARY)(LPCTSTR );
typedef DWORD (WINAPI *GETPROCADDRESS)(HMODULE,LPCSTR);
typedef BOOL (__cdecl *MYFUNC)(int,HWND);
LOADLIBRARY myLoadLibrary = (LOADLIBRARY)lpPara->dwLoadLibrary;
GETPROCADDRESS myGetProcAddress = (GETPROCADDRESS)lpPara->dwGetProcAddress;
HMODULE hDll = myLoadLibrary((LPCSTR)lpPara->pLoadLibrary);
MYFUNC init = (MYFUNC)myGetProcAddress(hDll,(LPCSTR)lpPara->pGetProcAddress);
init(0,(HWND)0x0070011E);
return 0;
}
void InsertThread()
{
const DWORD THREADSIZE = 1024 * 8;
HANDLE hWnd = hProcess;
DWORD byte_write;
char localpath[1000];
LoadLibrary("apicap.dll");
HMODULE hdl = GetModuleHandle("apicap.dll");
if (hdl==NULL)
MessageBox(0,"wrong2",0,0);
int len = GetModuleFileName(hdl,localpath,sizeof(localpath));
CloseHandle(hdl);
void *pRemoteThread = ::VirtualAllocEx(hWnd,0,THREADSIZE,MEM_COMMIT| MEM_RESERVE,PAGE_EXECUTE_READWRITE);
if(!pRemoteThread)
{
MessageBox(0,"virtual alloc error",0,0);
return;
}
if(!::WriteProcessMemory(hWnd,pRemoteThread,ThreadProc,THREADSIZE,0))
{
MessageBox(0,"write process memory error",0,0);
return;
}
RemotePara myRemotePara;
::ZeroMemory(&myRemotePara,sizeof(RemotePara));
HINSTANCE hKernel32 = LoadLibrary("kernel32.dll");
myRemotePara.dwLoadLibrary =(DWORD)GetProcAddress(hKernel32,"LoadLibraryA");
myRemotePara.dwGetProcAddress =(DWORD)GetProcAddress (hKernel32,"GetProcAddress");
strcpy(myRemotePara.pLoadLibrary,localpath);
strcpy(myRemotePara.pGetProcAddress,"init");
//写进目标进程
RemotePara *pRemotePara =(RemotePara *)::VirtualAllocEx(hWnd ,0,sizeof(RemotePara),MEM_COMMIT,PAGE_READWRITE);//注意申请空间时的页面属性
if(!pRemotePara)
return;
if(!::WriteProcessMemory (hWnd,pRemotePara,&myRemotePara,sizeof(myRemotePara),0))
return;
//启动线程
//::CreateRemoteThread(hWnd,0,0,(DWORD (WINAPI *)(void *))pRemoteThread ,pRemotePara,0,&byte_write);
}
{
char pLoadLibrary[256];
char pGetProcAddress[60];
DWORD dwGetProcAddress;
DWORD dwLoadLibrary;
}RemotePara;
DWORD WINAPI ThreadProc (RemotePara *lpPara)
{
typedef HMODULE (WINAPI *LOADLIBRARY)(LPCTSTR );
typedef DWORD (WINAPI *GETPROCADDRESS)(HMODULE,LPCSTR);
typedef BOOL (__cdecl *MYFUNC)(int,HWND);
LOADLIBRARY myLoadLibrary = (LOADLIBRARY)lpPara->dwLoadLibrary;
GETPROCADDRESS myGetProcAddress = (GETPROCADDRESS)lpPara->dwGetProcAddress;
HMODULE hDll = myLoadLibrary((LPCSTR)lpPara->pLoadLibrary);
MYFUNC init = (MYFUNC)myGetProcAddress(hDll,(LPCSTR)lpPara->pGetProcAddress);
init(0,(HWND)0x0070011E);
return 0;
}
void InsertThread()
{
const DWORD THREADSIZE = 1024 * 8;
HANDLE hWnd = hProcess;
DWORD byte_write;
char localpath[1000];
LoadLibrary("apicap.dll");
HMODULE hdl = GetModuleHandle("apicap.dll");
if (hdl==NULL)
MessageBox(0,"wrong2",0,0);
int len = GetModuleFileName(hdl,localpath,sizeof(localpath));
CloseHandle(hdl);
void *pRemoteThread = ::VirtualAllocEx(hWnd,0,THREADSIZE,MEM_COMMIT| MEM_RESERVE,PAGE_EXECUTE_READWRITE);
if(!pRemoteThread)
{
MessageBox(0,"virtual alloc error",0,0);
return;
}
if(!::WriteProcessMemory(hWnd,pRemoteThread,ThreadProc,THREADSIZE,0))
{
MessageBox(0,"write process memory error",0,0);
return;
}
RemotePara myRemotePara;
::ZeroMemory(&myRemotePara,sizeof(RemotePara));
HINSTANCE hKernel32 = LoadLibrary("kernel32.dll");
myRemotePara.dwLoadLibrary =(DWORD)GetProcAddress(hKernel32,"LoadLibraryA");
myRemotePara.dwGetProcAddress =(DWORD)GetProcAddress (hKernel32,"GetProcAddress");
strcpy(myRemotePara.pLoadLibrary,localpath);
strcpy(myRemotePara.pGetProcAddress,"init");
//写进目标进程
RemotePara *pRemotePara =(RemotePara *)::VirtualAllocEx(hWnd ,0,sizeof(RemotePara),MEM_COMMIT,PAGE_READWRITE);//注意申请空间时的页面属性
if(!pRemotePara)
return;
if(!::WriteProcessMemory (hWnd,pRemotePara,&myRemotePara,sizeof(myRemotePara),0))
return;
//启动线程
//::CreateRemoteThread(hWnd,0,0,(DWORD (WINAPI *)(void *))pRemoteThread ,pRemotePara,0,&byte_write);
}