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 HELP] Problem with reading a pointer integer.
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Studio80
Advanced Cheater
Reputation: 2

Joined: 12 Sep 2012
Posts: 83

PostPosted: Tue Dec 15, 2015 10:28 pm    Post subject: Reply with quote

Zanzer wrote:
Probably because you're running Windows 64-bit and your code is treating everything as 32-bit integers.
Use ToInt64 and Long instead. Or better yet, IntPtr.

Thanks man! That worked for me. I have installed Win 7 32bit on an another partition just to check if it works and it does work. I really should stick to 32bit instead of 64bit.

But I have an another question about this script. The AOB scan allows me to nop the instructions. I have figured that out. But the problem is how to do code injection with this function?

For an example:

Code:
002210B0 - FF 40 08                   - inc [eax+08]
002210B3 - E8 37DFFFFF                - call 0021EFEF
002210B8 - 8B 46 2C                   - mov eax,[esi+2C]


Code:
Mem.Patch(Mem.AobScan("solitaire.exe+0", &HF00000, "FF 40 08 E8 ?? ?? ?? ?? 8B 46 2C"), "90 90 90", "FF 40 08")


This just nops the 3 bytes. If I want to do a code injection I should just use JMP TO_CAVE but how can I use this AOB function to jump back to the correct adress? I know that this script uses a memory allocation function which is:

Code:
#Region "Allocate"
    Private Function Allocate() As Integer
        If ProcActive Then
            Dim iCave As IntPtr = VirtualAllocEx(Proc(0).Handle, IntPtr.Zero, &H200, &H1000, &H40)
            If (iCave <> IntPtr.Zero) Then
                CodeCave.Add(iCave)
                Return iCave.ToInt32
            End If
        End If
        Return -1
    End Function
#End Region

#Region "Deallocate"
    Public Function DeAllocate(ByVal Addy As Integer, ByVal DefaultBytes As String, ByVal MA As Boolean) As Boolean
        If (ProcActive And Addy <> -1 And DefaultBytes <> String.Empty AndAlso Addy <> -1) Then
            Dim Index As Integer = -1
            For i As Integer = 0 To CodeCave.Count - 1
                If (Convert.ToBase64String(rBytes(Addy + 1, 4)) = Convert.ToBase64String(BitConverter.GetBytes((CodeCave.Item(i).ToInt32 + IIf(MA, 8, 0)) - Addy - 5))) Then
                    Index = i
                End If
            Next
            If (Index <> -1) Then
                Dim tmp As IntPtr = CodeCave.Item(Index)
                If (tmp <> IntPtr.Zero AndAlso wBytes(Addy, HX2Bts(DefaultBytes))) Then
                    VirtualFreeEx(Proc(0).Handle, tmp, 0, &H8000)
                    CodeCave.RemoveAt(Index)
                    Return True
                End If
            End If
        End If
        Return False
    End Function
#End Region


But I have no idea on how to use it.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Tue Dec 15, 2015 10:44 pm    Post subject: Reply with quote

http://forum.cheatengine.org/viewtopic.php?t=551046
Back to top
View user's profile Send private message
Studio80
Advanced Cheater
Reputation: 2

Joined: 12 Sep 2012
Posts: 83

PostPosted: Wed Dec 16, 2015 12:08 am    Post subject: Reply with quote

Thank you for your reply. Sorry for my bad English it isn't my first language. I just read that entire topic and I'm very confused now because the topic starter doesn't use an AoBscan. For a normal code injection I just would use the Poke.Mem <ADRESS> BYTES

This adres always changes when I restart the game but the AoB works because it scans for the array and patches it. But what I want is to make it jump to the cave and jump back. I just don't know how to combine the Allocate function together with the Aobscan function so it executes my code in the empty space memory and gets back.
Back to top
View user's profile Send private message
Studio80
Advanced Cheater
Reputation: 2

Joined: 12 Sep 2012
Posts: 83

PostPosted: Fri Dec 18, 2015 5:49 pm    Post subject: Reply with quote

Anyone?????
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 Gamehacking 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