# scan for ints in a process

5 replies to this topic

### #1Anddos

Valued Member

• Members
• 177 posts

Posted 16 June 2012 - 04:14 PM

basically what i want todo is scan this process for all the ints with the value 5, i am close to getting it working but i think something is missing , can anyone take alook at my code , thanks

the code formatting messed up scroll down to see the code on pastebin.

### #2Reedbeta

DevMaster Staff

• 5308 posts
• LocationSanta Clara, CA

Posted 16 June 2012 - 04:46 PM

Please use the [ code ]...[ /code ] tags and post your code with proper formatting so we can read it.
reedbeta.com - developer blog, OpenGL demos, and other projects

### #3}:+()___ (Smile)

Member

• Members
• 169 posts

Posted 16 June 2012 - 06:29 PM

That is certainly incorrect:
if (memcmp(offset, findme, 7) == 0)

Instead of 7 must be sizeof(int) or sizeof(five) or sizeof(findme).
Sorry my broken english!

### #4Anddos

Valued Member

• Members
• 177 posts

Posted 17 June 2012 - 04:19 AM

code has been changed , i really dont know whats happened to the first post formating..

i am going to have to use pastebin

http://pastebin.com/Airxe5bW

what i want todo , when its found the int with the value 5 i want to output the ints address's and the found address so i know its really found it, thanks

if i make a test app like this, it dosent find this :/ so something is wrong somewhere...

#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int five = 5;
while(1)
{
cout << &five << endl;
}
return 0;
}

### #5}:+()___ (Smile)

Member

• Members
• 169 posts

Posted 17 June 2012 - 02:33 PM

You have uninitialized dwStart variable.

Also line
if(&five > mbi.BaseAddress && &five <= ((int*)mbi.BaseAddress)+mbi.RegionSize)

is confusing. Do you want to find variable five in the same process, not another? If so, then the line is wrong, must be
if(&five >= mbi.BaseAddress && &five <= (char*)mbi.BaseAddress+mbi.RegionSize-sizeof(five))


Sorry my broken english!

### #6Anddos

Valued Member

• Members
• 177 posts

Posted 17 June 2012 - 05:34 PM

that code is actually to test if its close to finding it, yes this is the process i am scanning

#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int five = 5;
while(1)
{
cout << &five << endl;
}
return 0;
}

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users