Jump to content
Sign in to follow this  


Recommended Posts

#Include <WinAPI.au3>

_WinAPI_WriteProcessMemory($hProcess, $pBaseAddress, $pBuffer, $iSize, ByRef $iWritten[, $sBuffer = "ptr"])

That is what the help file says about this function, im just slightly confused what "ByRef $iWritten", and "$sBuffer = 'ptr' " mean.

I am using a Script Written by FreeFry as a basis of my script, Im just trying to learn the uses of the functions so that I can make bigger things later on.

This is what I have so far

#Include <WinAPI.au3>

If Not ProcessExists("age2_x1.icd") Then Exit; exit if calculator is not running

Dim $procHwnd = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, ProcessExists("age2_x1.icd")); get access to read/write/anything the process memory
If Not $procHwnd Then _Exit("Error while getting process handle!"); if we didn't get a valid 'access' handle then exit

Dim $pBuffer = DllStructCreate("float[32]"), $iRead = 0; create our structure(I assume we won't need to read more than 32 bytes), and iRead which specifies how many bytes where really read.

_WinAPI_ReadProcessMemory($procHwnd, 0x0D05DCE4, DllStructGetPtr($pBuffer), 32, $iRead); here we read the memory
If Not $iRead Then _Exit("Error while reading data!"); exit if no data was read

MsgBox(0, "Data Read:", DllStructGetData($pBuffer, 1))
$input = InputBox("TEST","New Value")

_WinAPI_WriteProcessMemory($procHwnd, 0x0D05DCE4, $input, 32, ByRef $iWritten[, $sBuffer = "ptr"])

Func _Exit($s_Msg)
    MsgBox(0, "Error", $s_Msg)

The Read functions works fine, I just need alittle help with the Write.

Please don't flame me because that wont help, I just need a little clarification and constructive criticism.


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...