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 


[VB .NET] Search Memory Methods...
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
atlantis
Advanced Cheater
Reputation: 0

Joined: 16 Jun 2007
Posts: 69

PostPosted: Mon Jan 07, 2008 1:30 pm    Post subject: Reply with quote

to read memory inte a bytearay it should look like this or something
(like Handle or such maybe need to be IntPtr or such..)

Code:

'usage: ReadByteArray(Handle,Address,ByteArray(),SizeInBytes)

Private Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Byte, ByVal nSize As Integer, ByVal lpNumberOfBytesWritten As Integer) As Integer

    Public Sub ReadByteArray(ByVal pHandle As Integer, ByVal pAddy As Integer, ByVal pMem() As Byte, ByVal pSize As Integer)
        ReDim pMem(0 To pSize - 1)
        ReadProcessMemory(pHandle, pAddy, pMem(0), pSize, 0)
    End Sub
 
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Mon Jan 07, 2008 1:39 pm    Post subject: Reply with quote

Or you could use

Array.FindAll<byte>(mybyte[], MyPredicate);

Defining MyPredicate as a bool method (note that this is C#)

Code:

public bool MyPredicate(byte b)
{
     return b == 0x40
}


Or if you want it generic:

Code:

public byte[] HexDump; //note that you have to initialize this before calling read

public byte[] ReadByteArray(byte _LookFor)
{
     LookFor = _LookFor;
     return Array.FindAll<byte>(HexDump, MyPredicate);
}

public byte LookFor = 0x00;

public bool MyPredicate (byte b)
{
     return (b == LookFor);
}


The only problem is getting the hex dump (which is what I'm currently searching on Google).

Edit:

Btw, you need to have the Handle be an IntPtr and the address to at least be an unsigned integer--an integer isn't large enough to hold FFFFFFFF.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
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
Goto page Previous  1, 2
Page 2 of 2

 
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