Can u give me tips on how to debug/ build/ release projects correctly ?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
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:pre 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:pre
if(inject(proc)){break;}<br/>
<span style="white-space:pre <br/>
<span style="white-space:pre }<br/>
<span style="white-space:pre <br/>
<span style="white-space:pre }<br/>
<br/>
<span style="white-space:pre }<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:pre HKEY hKey;<br/>
<span style="white-space:pre char buf[255] = {0};<br/>
<span style="white-space:pre DWORD dwType = 0;<br/>
DWORD dwBufSize = sizeof(buf);<br/>
if( RegOpenKey(HKEY_CURRENT_USER,"Software\foo",&hKey ) == ERROR_SUCCESS )<br/>
<span style="white-space:pre {<br/>
<span style="white-space:pre <span style="white-space:pre dwType = REG_SZ;<br/>
<span style="white-space:pre if( RegQueryValueEx(hKey,"DWORD",0, &dwType, (BYTE*)buf, &dwBufSize) == ERROR_SUCCESS)<br/>
{<span style="white-space:pre <br/>
<span style="white-space:pre //do stuff<br/>
}<br/>
<br/>
<span style="white-space:pre }<br/>
<span style="white-space:pre <br/>
RegCloseKey(hKey);<br/>
<span style="white-space:pre 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
 
Back
Top