Jump to content
Sign in to follow this  
Skrip

Poking

Recommended Posts

Skrip

Hiding first post.

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites
Siao

Where the hell did you get this "poke" you keep repeating from? What does poke have to do with writing to process memory (if that's what you want to do).


"be smart, drink your wine"

Share this post


Link to post
Share on other sites
Skrip

Poke makes the memory "nop" or No Operation. Makes the code do nothing. Or if you poke the code a different way, it will make it work again.

Look up some ASM.

Back to my question. I'm sick of using TMK. Anybody know how to poke?


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites
Siao

Look up some ASM.

I believe you're in no position to be telling me to look up anything. Especially ASM.

Do tell where replacing some instructions was called "poking"... Such unusual term to me is about the only remotely interesting thing in this topic.

As for your question, you didn't provide us with the exact example of how you are trying to do it, or was it just that, 1 line?

I figure _MemoryWrite is a WriteProcessMemory wrapper, just like _WinAPI_WriteProcessMemory. Do you realise that before using such function, you have to open process with sufficient access rights for the task? Which in this case would be PROCESS_VM_OPERATION+PROCESS_VM_WRITE

Then as for the actual writing, as I understand you want to write 5 bytes, so it's rather weird that you tried to write only 1.

Using standard UDFs, all this would be

#Include <WinAPI.au3>

$iPID = ProcessExists("programme test.exe")
If $iPID Then
    $iAddress = 0x401384
    $iBytesWritten = 0
    $tBuffer = DllStructCreate("byte[5]")
    DllStructSetData($tBuffer, 1, "0x9090909090")
    $iSize = 5
    $hProc = _WinAPI_OpenProcess(BitOR($PROCESS_VM_OPERATION,$PROCESS_VM_WRITE), 0, $iPID)
    If $hProc Then
        _WinAPI_WriteProcessMemory($hProc, $iAddress, DllStructGetPtr($tBuffer), $iSize, $iBytesWritten)
        _WinAPI_CloseHandle($hProc)
        MsgBox(0, "", $iBytesWritten & " bytes written at " & $iAddress)
    EndIf
EndIf

Exit

And I'm pretty sure there are plenty examples like this in the forum. With all the MMO cheaters hacker-wannabes around, this topic is pretty much beaten to death.

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites
Skrip

I'll try your code. But this isn't for any multiplayer games. I'm making a trainer for Sim City: Societies. It's fully offline.

Sorry, But I don't really know your ability. I've never seen your scripts before. I don't know if you know anything about anything at all. Didn't mean to be offensive.

And I was using:

#include <GUIConstants.au3>
#include <NomadMemory.au3>
GUICreate("Form1")
$Button_1 = GUICtrlCreateButton ("Check Memory Address",  10, 30, 150)
$Button_2 = GUICtrlCreateButton ("Write Memory Address",  10, 110, 150)
$Label_1 = GUICtrlCreateLabel("blah..",20, 60)
GUISetState ()

$Mem_Address = 0x41D090
$Process1 = WinGetProcess("prog test")
$Mem_Open = _MemoryOpen($Process1)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_1
;~          $Mem_Open = _MemoryOpen($Process1);must open before you can read address
            $Mem_Read = _MemoryRead($Mem_Address, $Mem_Open);reads value at memory address
            
            GUICtrlSetData($Label_1,$Mem_Read); sets label to value of read memory
        Case $msg = $Button_2
            _MemoryWrite(0x41D090, $Mem_Address, 0x90, "byte")
    EndSelect
Wend

EDIT: Also, your code worked. Thank you very much. I appreciate it.

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites
mikeyr

WOW, I guess I am the only old person here... in the beginning in programs long lost to the general population, we regularly PEEK'ed and POKE'd into memory to make the most use of 16KB of memory.

And to answer the request for official information wiki says : Definition of peek and poke : Instructions that view and alter a byte of memory by referencing a specific memory address. Peek displays the contents; poke changes it. You can google "peek poke computer" its a real term from the very old days (when I was just starting with computers)

Of course I have not heard about peeking or poking relating to computer in well over 20 years now, glad to see someone still doing things the hard way, old school style.

Edited by mikeyr

Share this post


Link to post
Share on other sites
Skrip

WOW, I guess I am the only old person here... in the beginning in programs long lost to the general population, we regularly PEEK'ed and POKE'd into memory to make the most use of 16KB of memory.

Of course I have not heard about peeking or poking relating to computer in well over 20 years now, glad to see someone still doing things the hard way, old school style.

Poking is the only way I know how to nop code. If you have a better way, please share. I'd appreciate it.

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites
mikeyr

Poking is the only way I know how to nop code. If you have a better way, please share. I'd appreciate it.

I don't necessarily have a better way, I just was saying I have not heard the term for close to 20 years or so and I was telling the second poster its a real term, nowdays with the power of the machines its just as easy to ignore a message or null out a routine or disable functions or other ways. In the old days poke had to be done because of the limitations of the hardware, nothing to stop you from poking today just that there are usually easier although more CPU intensive ways of avoiding routines/code. If I was writing for a severely memory limited machine or just trying for absolute max speed, I might look into poking, luckily I don't need to, I set a boolean flag and check it when starting the routine, if true I exit, if false I continue, burns some memory and works just fine.

I have been coding long enough that I know there are 1,001 ways to do everything and everyones way is better than everyone elses.

Edited by mikeyr

Share this post


Link to post
Share on other sites
Siao

Ok, thanks for the clarification, using your hints I googled some and found that these are old BASIC functions. Knowing that AutoIt is the farthest I've ever come into BASIC territory, and that my oldschool probably may be your newschool, now I know why I wasn't familiar with such terms.


"be smart, drink your wine"

Share this post


Link to post
Share on other sites
Siao

But this isn't for any multiplayer games. I'm making a trainer for Sim City: Societies. It's fully offline.

That's ok, I've done a bit of code modding for some singleplayer games too, and wasn't aiming that comment at you anyway...

Nomad's memory UDF is fine too, it even saves some fingerwork by creating the dllstruct and other things for you,

write example would look like this

#include <NomadMemory.au3>

$hProc = _MemoryOpen(WinGetProcess("prog test"), 0x0028, 0)
_MemoryWrite(0x401384, $hProc, "0x9090909090", "byte[5]")
_MemoryClose($hProc)

Peace.


"be smart, drink your wine"

Share this post


Link to post
Share on other sites
Skrip

Thanks for the help Siao. Appreciate it.


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×