 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
atlantis Advanced Cheater
Reputation: 0
Joined: 16 Jun 2007 Posts: 69
|
Posted: Mon Jan 07, 2008 1:30 pm Post subject: |
|
|
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 |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Mon Jan 07, 2008 1:39 pm Post subject: |
|
|
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.
_________________
|
|
| Back to top |
|
 |
|
|
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
|
|