EDN Admin
Well-known member
bool inject(DWORD pid);
.....
on BUTTON 1 :
DWORD proc;<br/>
PROCESSENTRY32 pe32 = {sizeof(PROCESSENTRY32)};<br/>
HANDLE hPsnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);<br/>
<span style="white-space
re if(Process32First(hPsnap, &pe32)){<br/>
while(Process32Next(hPsnap, &pe32)){<br/>
if(!strcmp(pe32.szExeFile, "target.exe")){<br/>
proc
= pe32.th32ProcessID;<br/>
<br/>
<span style="white-space
re
if(inject(proc)){break;}<br/>
<span style="white-space
re <br/>
<span style="white-space
re }<br/>
<span style="white-space
re <br/>
<span style="white-space
re }<br/>
<br/>
<span style="white-space
re }<br/>
CloseHandle(hPsnap);
i made an injector in winform..this one works well in my PC but it doesnt inject the DLL when running in other pc....basically the code doesnt work in other PC !!!!
and one dll i made with code that will read registry when it attached to a process..
int main()<br/>
{<br/>
<span style="white-space
re HKEY hKey;<br/>
<span style="white-space
re char buf[255] = {0};<br/>
<span style="white-space
re DWORD dwType = 0;<br/>
DWORD dwBufSize = sizeof(buf);<br/>
if( RegOpenKey(HKEY_CURRENT_USER,"Software\foo",&hKey ) == ERROR_SUCCESS )<br/>
<span style="white-space
re {<br/>
<span style="white-space
re <span style="white-space
re dwType = REG_SZ;<br/>
<span style="white-space
re if( RegQueryValueEx(hKey,"DWORD",0, &dwType, (BYTE*)buf, &dwBufSize) == ERROR_SUCCESS)<br/>
{<span style="white-space
re <br/>
<span style="white-space
re //do stuff<br/>
}<br/>
<br/>
<span style="white-space
re }<br/>
<span style="white-space
re <br/>
RegCloseKey(hKey);<br/>
<span style="white-space
re return 0;<br/>
}<br/>
works well again in my PC but when i injected this dll in other PC, it crashes the process
what a waste of f#$%^ time and effort and energy for working on projects that not gonna run in other machine..only in c++ i guess !!
Can u give me tips on how to debug/ build/ release projects correctly ?!!!im using VS2008 prof
and if u can pls correct my code above
Many thanks in advance
<br/>
<br/>
<br/>
View the full article
.....
on BUTTON 1 :
DWORD proc;<br/>
PROCESSENTRY32 pe32 = {sizeof(PROCESSENTRY32)};<br/>
HANDLE hPsnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);<br/>
<span style="white-space

while(Process32Next(hPsnap, &pe32)){<br/>
if(!strcmp(pe32.szExeFile, "target.exe")){<br/>
proc
= pe32.th32ProcessID;<br/>
<br/>
<span style="white-space

if(inject(proc)){break;}<br/>
<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

<br/>
<span style="white-space

CloseHandle(hPsnap);
i made an injector in winform..this one works well in my PC but it doesnt inject the DLL when running in other pc....basically the code doesnt work in other PC !!!!
and one dll i made with code that will read registry when it attached to a process..
int main()<br/>
{<br/>
<span style="white-space

<span style="white-space

<span style="white-space

DWORD dwBufSize = sizeof(buf);<br/>
if( RegOpenKey(HKEY_CURRENT_USER,"Software\foo",&hKey ) == ERROR_SUCCESS )<br/>
<span style="white-space

<span style="white-space


<span style="white-space

{<span style="white-space

<span style="white-space

}<br/>
<br/>
<span style="white-space

<span style="white-space

RegCloseKey(hKey);<br/>
<span style="white-space

}<br/>
works well again in my PC but when i injected this dll in other PC, it crashes the process
what a waste of f#$%^ time and effort and energy for working on projects that not gonna run in other machine..only in c++ i guess !!
Can u give me tips on how to debug/ build/ release projects correctly ?!!!im using VS2008 prof
and if u can pls correct my code above
Many thanks in advance
<br/>
<br/>
<br/>
View the full article