Basic Memory Scanning - Like Cheat Engine

Share your advanced PureBasic knowledge/code with the community.
epidemicz
User
User
Posts: 86
Joined: Thu Jan 22, 2009 8:05 am
Location: USA
Contact:

Re: Basic Memory Scanning - Like Cheat Engine

Post by epidemicz »

Classic, issues with x64 :D. Glad to hear you were able to fix it though.
Image
User avatar
ultralazor
Enthusiast
Enthusiast
Posts: 186
Joined: Sun Jun 27, 2010 9:00 am

Re: Basic Memory Scanning - Like Cheat Engine

Post by ultralazor »

I use to write these all the time. Problem is the values wanted are almost always in heap, so it means different address each load.

Also be careful what you use them on. Those API calls are hooked by a lot of protectors. The most reliable way right now is thread injection(not dll injection), which is still detected by most protectors, at least mmorpg ones where you have to kill drivers and patch software.

Cheatengine is as good as a scanner can get, you won't do much better, a lot of scanners have been written over the years..

Here is a multi-threaded trainer template in PB for when you get the address and want to keep it one value:

Code: Select all

Global.b stackout ;state to allow clean thread exit

Enumeration
  #Window_0
  #Button_0
EndEnumeration

Procedure.b patchmem(*valx)
  address=$05E4798C
  window$="uplink"
  value$="100000"
  Repeat
    Delay(1000)
    hwnd=FindWindow_(0,win$)
    If hwnd
      GetWindowThreadProcessId_(hwnd,@pid.l)
      hprocess=OpenProcess_(#PROCESS_ALL_ACCESS,0,pid)
      If hProcess
        result=WriteProcessMemory_(hProcess,address,@value$, Len(value$)*2,0)
        CloseHandle_(hprocess)
      EndIf
    EndIf
  Until hwnd=0 Or stackout=1
EndProcedure

If OpenWindow(#Window_0,0,0,221,73,"Uplink millionaire",#PB_Window_MinimizeGadget | #PB_Window_ScreenCentered)
  ButtonGadget(#Button_0,6,8,210,60,"Start")
  Repeat
    Event = WaitWindowEvent()
    GadgetID = EventGadget()
    If Event = #PB_Event_Gadget
      If GadgetID = #Button_0
        If IsThread(thread)=0
          stackout=0
          SetGadgetText(#Button_0,"Stop")
          thread=CreateThread(@patchmem(),*value)
        Else
          stackout=1
          SetGadgetText(#Button_0,"Start")
        EndIf
      EndIf
    EndIf
  Until Event = #PB_Event_CloseWindow
EndIf
If IsThread(thread) : KillThread(thread) : EndIf
End
so many ideas so little time..
Post Reply