Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Get The Memory Addres By Value :(:(:( help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ETneedHelp
How do I cheat?
Reputation: 0

Joined: 17 May 2012
Posts: 9

PostPosted: Fri May 18, 2012 9:00 am    Post subject: Get The Memory Addres By Value :(:(:( help Reply with quote

Embarassed Sad Sad Sad Sad Sad
i have this code:
Code:


        [DllImport("user32.dll", EntryPoint = "GetWindowThreadProcessId")]
        public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int lpdwProcessId);

        [DllImport("kernel32.dll", EntryPoint = "ReadProcessMemory")]
        public static extern Int32 ReadProcessMemory(IntPtr hProcess, int lpBaseAddress, out string buffer, int size, out int lpNumberOfBytesRead);

        public List<int> Search(string ProcessName, int _Length, int Value)
        {
            Process[] P = Process.GetProcessesByName(ProcessName);
            List<int> tmp = new List<int>();
            if (P.Length < 0) return tmp;
            try
            {
                if (P[0].HasExited)
                    return tmp;
            }
            catch { return tmp; }
            byte[] buff = new byte[4];
            int Address = P[0].MainModule.BaseAddress.ToInt32();
            for (int i = 0; i < _Length; i++)
            {
               ReadProcessMemory(P[0].Handle, Address + i, buff, 4, 0);
                if (BitConverter.ToInt32(buff, 0) == Value)
                {
                    tmp.Add(Address + i);
                }
            }
            return tmp;
        }


        private void button1_Click(object sender, EventArgs e)
        {
            listBox1.DataSource = Search("plugin-container", 0x100, 15035990);
        }



All I need is a small correction code
ReadProcessMemory(P[0].Handle, Address + i, buff, 4, 0);


the function:

[DllImport("kernel32.dll", EntryPoint = "ReadProcessMemory")]
public static extern Int32 ReadProcessMemory(IntPtr hProcess, int lpBaseAddress, out string buffer, int size, out int lpNumberOfBytesRead);

errors:

cannot convert from 'byte[]' to 'out string'

Argument 5 must be passed with the 'out' keyword

The best overloaded method match for 'WindowsFormsApplication1.Form1.ReadProcessMemory(System.IntPtr, int, out string, int, out int)' has some invalid arguments


What software should do:
Get The Memory Addres By Value(4 byte value)
and get it in listbox
Evil or Very Mad Mad Mad Mad Embarassed Embarassed Embarassed Embarassed Embarassed Sad Sad Sad
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Fri May 18, 2012 4:10 pm    Post subject: Reply with quote

First off dont double post. I dont even know why im replying but wth.

change
Code:

[DllImport("kernel32.dll", EntryPoint = "ReadProcessMemory")]
public static extern Int32 ReadProcessMemory(IntPtr hProcess, int lpBaseAddress, out string buffer, int size, out int lpNumberOfBytesRead);

to
Code:
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(IntPtr hProcess, int lpBaseAddress, byte[] buffer, int size, int lpNumberOfBytesRead);


Look at the error code and the code you're using.
cannot convert from 'byte[]' to 'out string'

This is because you're using a byte array, not string.
byte[] buff = new byte[4];
Its a simple fix if you look

Also remove these line
Code:
            try
            {
                if (P[0].HasExited)
                    return tmp;
            }
            catch { return tmp; }

Sorry but that part isnt needed

_________________
Back to top
View user's profile Send private message
ETneedHelp
How do I cheat?
Reputation: 0

Joined: 17 May 2012
Posts: 9

PostPosted: Sat May 19, 2012 12:22 pm    Post subject: Reply with quote

Pingo wrote:
First off dont double post. I dont even know why im replying but wth.

change
Code:

[DllImport("kernel32.dll", EntryPoint = "ReadProcessMemory")]
public static extern Int32 ReadProcessMemory(IntPtr hProcess, int lpBaseAddress, out string buffer, int size, out int lpNumberOfBytesRead);

to
Code:
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(IntPtr hProcess, int lpBaseAddress, byte[] buffer, int size, int lpNumberOfBytesRead);


Look at the error code and the code you're using.
cannot convert from 'byte[]' to 'out string'

This is because you're using a byte array, not string.
byte[] buff = new byte[4];
Its a simple fix if you look

Also remove these line
Code:
            try
            {
                if (P[0].HasExited)
                    return tmp;
            }
            catch { return tmp; }

Sorry but that part isnt needed

ok i change evreything
(tnx bro! Cool )

this is the code:

dll:

Code:

        [DllImport("kernel32.dll")]
        public static extern bool ReadProcessMemory(IntPtr hProcess, int lpBaseAddress, byte[] buffer, int size, int lpNumberOfBytesRead);


code:

Code:

public List<int> Search(string ProcessName, int _Length, int Value)
        {
            Process[] P = Process.GetProcessesByName(ProcessName);
            List<int> tmp = new List<int>();
            if (P.Length < 0) return tmp;
            byte[] buff = new byte[4];
            int Address = P[0].MainModule.BaseAddress.ToInt32();
            for (int i = 0; i < _Length; i++)
            {
                ReadProcessMemory(P[0].Handle, Address + i, buff, 4, 0);
                if (BitConverter.ToInt32(buff, 0) == Value)
                {
                    tmp.Add(Address + i);
                }
            }
            return tmp;
        }


        private void button1_Click(object sender, EventArgs e)
        {
            listBox1.DataSource = Search("plugin-container", 0x100, 15035990);
        }


if i remove the if condition:
Code:

                if (BitConverter.ToInt32(buff, 0) == Value)

the list box looks like:
Code:

18284544
18284545
18284546
18284547
...
...
...
18284599

from 44 to 99


the BaseAddress + i

with the " if (BitConverter.ToInt32(buff, 0) == Value)"
the list box is null
(not found)
one more problem:
the addres of the byte that i look for is alwayes with strings and numbers:
example : 02FD6320
and it return :
18284547
18284548
18284549
if it impossible Tell me now Sad
And if someone managed to build software such as CE And he can send me RAR file or something...

Sad
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Sun May 20, 2012 3:09 am    Post subject: Reply with quote

From looking at your other thread, i think your problem is the scan range. You set it to 100, so you telling me the address is located within 100 bytes of the base address?

If thats the case, why scan? It would be a static address anyway.

_________________
Back to top
View user's profile Send private message
ETneedHelp
How do I cheat?
Reputation: 0

Joined: 17 May 2012
Posts: 9

PostPosted: Sun May 20, 2012 8:06 am    Post subject: Reply with quote

Pingo wrote:
From looking at your other thread, i think your problem is the scan range. You set it to 100, so you telling me the address is located within 100 bytes of the base address?

If thats the case, why scan? It would be a static address anyway.

my address is always changed when i open my browser (firefox)
the name of the process is:plugin-container
i want to search: 15035990(#e56e56 = red color)
and i want to replace it with :15831 (#003dd7 = blue color)
the adderss in always changed
lets say that the address is:
082DBA74
and after i refresh the page the address is:
09882AC0
if i can find the address evrey time this problem fixed
i think that i need to use pointer but I have no experience.
bro, if you can give me youre skype or something else it can help
I'm sure that you can easily find a solution to the problem Smile
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Sun May 20, 2012 10:24 am    Post subject: Reply with quote

No, just keep working at it. You have all the info you need, you just need to piece it together.
_________________
Back to top
View user's profile Send private message
ETneedHelp
How do I cheat?
Reputation: 0

Joined: 17 May 2012
Posts: 9

PostPosted: Sun May 20, 2012 1:47 pm    Post subject: Reply with quote

Pingo wrote:
No, just keep working at it. You have all the info you need, you just need to piece it together.

ok, i tryied and it Still not work Sad
if you can make zip file with oproject that work it can help
I tried everything and still there is no solution to this problem Sad
So far, everything worked for me, but this thing not want to work Evil or Very Mad
Back to top
View user's profile Send private message
vnlagrla
Cheater
Reputation: 0

Joined: 10 Apr 2011
Posts: 33

PostPosted: Sun May 20, 2012 7:53 pm    Post subject: Reply with quote

well like Pingo said above try increasing the scan length.
whats the baseadress? try something like 0x3500000.
learn the basics everything you need has been posted nobody will do it for you.
Back to top
View user's profile Send private message
ETneedHelp
How do I cheat?
Reputation: 0

Joined: 17 May 2012
Posts: 9

PostPosted: Mon May 21, 2012 12:52 am    Post subject: Reply with quote

vnlagrla wrote:
well like Pingo said above try increasing the scan length.
whats the baseadress? try something like 0x3500000.
learn the basics everything you need has been posted nobody will do it for you.

baseaddress:
2359296
i try 0x3500000 and the program stop working
and i try to learn Confused and i can find a Solution
now im in the Worse situation because i promes to ather forum that i make this thing Sad
If I had a solution i would not come to ask for help
Especially that i talk about small tool ,
i do it for another People, not for myself.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites