
Ryoni
Members-
Posts
15 -
Joined
-
Last visited
Everything posted by Ryoni
-
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
Case solved. Cheat Engine calls VirtualProtectEx to make the value writeable and then writes. I need to search if Autoit can do that too, but not till tomorrow.. No wonder all kind of writing ways worked but nothing happened. But I'd like to thank you both for trying to help me! I don't know if I would have come to this solution without you two -
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
Well I don't know what I'm chasing 'cause I have never tried memoryWriting before. But I know it's possible. I can change the value manually in cheat engine and it works. I could of course make a macro to change the value always through cheat engine but I'm searching for a way to do it fully in autoit. And no it's not a flash game. -
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
Oh, so the 1 I looked was for the @error. Hmm, back to starting point. I'm not sure if I even need offsets with this writing but I included them in hope of help. I needed the offset values to read the base address because it was 'hidden' by 2 pointers. The value is stored in different places every time I start the application but I can always find it with these offsets from the base address. -
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
Ah! Why didn't I notice that the returned '1' was actually an error message from the function. "1 = Invalid $ah_Handle." So in my case it should be the $memory but there's no reason why it would be wrong. I use the same method getting the ID in my other macros too with the same application, even in the memory reading one I demonstrated and it works just fine. ? -
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
I don't know so much about memory reading either so that's why I came here to ask because I don't really know how I'm supposed to play with the offsets when writing. The base address and the offset values I have, are static, gotten with cheat engine. So I can read the value everytime even if I restart the application. -
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
#include <NomadMemory.au3> $id = WinGetProcess("[CLASS:Application]", "") $baseAddress = 0x053969E8 $off1 = 0x3c4 $off2 = 0x0c $memory = _MemoryOpen($id) $1 = _MemoryRead($baseAddress, $memory) $2 = _MemoryRead($1 + $off1, $memory) $3 = _MemoryRead($2 + $off2, $memory) MsgBox("","",$3) I'm not sure what it helps but that's how I read it. I also tried your code cageman but nothing happens. -
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
Well as I said in the begining I know how to read from the base address with the offset values I mentioned and I do get value which is excatly the one I know is 100% correct. I just don't need to read it anymore in this macro. Checking return value was actually a good idea, didn't think of it. It returns '1' so it's still not correct I tried your method cageman like this: $1 = _MemoryRead($baseAddress,$id) $2 = _MemoryRead($1 + Dec($off1), $id) $3 = _MemoryRead($2 + Dec($off2), $id) _MemoryWrite($3, $memory, $newValue, "float") ; Changes the value to 20 Yet again it says no errors, does nothing and return that '1'. -
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
If you scroll up for my code examples you can see I do have parameters. For example _MemoryWrite($3, $memory, $newValue, "float") has at first $3 which is supposed to be the address I'm trying to write one. Then comes $memory which has the value of opening my application's id. $newValue contains number 20 which is going to be written as float, like it says in the end. -
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
I'm using Nomad's quite common NomadMemory.au3 _MemoryRead(): ;================================================================================== ; Function: _MemoryRead($iv_Address, $ah_Handle[, $sv_Type]) ; Description: Reads the value located in the memory address specified. ; Parameter(s): $iv_Address - The memory address you want to read from. It must ; be in hex format (0x00000000). ; $ah_Handle - An array containing the Dll handle and the handle ; of the open process as returned by _MemoryOpen(). ; $sv_Type - (optional) The "Type" of value you intend to read. ; This is set to 'dword'(32bit(4byte) signed integer) ; by default. See the help file for DllStructCreate ; for all types. An example: If you want to read a ; word that is 15 characters in length, you would use ; 'char[16]' since a 'char' is 8 bits (1 byte) in size. ; Return Value(s): On Success - Returns the value located at the specified address. ; On Failure - Returns 0 ; @Error - 0 = No error. ; 1 = Invalid $ah_Handle. ; 2 = $sv_Type was not a string. ; 3 = $sv_Type is an unknown data type. ; 4 = Failed to allocate the memory needed for the DllStructure. ; 5 = Error allocating memory for $sv_Type. ; 6 = Failed to read from the specified process. ; Author(s): Nomad ; Note(s): Values returned are in Decimal format, unless specified as a ; 'char' type, then they are returned in ASCII format. Also note ; that size ('char[size]') for all 'char' types should be 1 ; greater than the actual size. ;================================================================================== Func _MemoryRead($iv_Address, $ah_Handle, $sv_Type = 'dword') If Not IsArray($ah_Handle) Then SetError(1) Return 0 EndIf Local $v_Buffer = DllStructCreate($sv_Type) If @Error Then SetError(@Error + 1) Return 0 EndIf DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '') If Not @Error Then Local $v_Value = DllStructGetData($v_Buffer, 1) Return $v_Value Else SetError(6) Return 0 EndIf EndFunc _MemoryWrite(): ;================================================================================== ; Function: _MemoryWrite($iv_Address, $ah_Handle, $v_Data[, $sv_Type]) ; Description: Writes data to the specified memory address. ; Parameter(s): $iv_Address - The memory address which you want to write to. ; It must be in hex format (0x00000000). ; $ah_Handle - An array containing the Dll handle and the handle ; of the open process as returned by _MemoryOpen(). ; $v_Data - The data to be written. ; $sv_Type - (optional) The "Type" of value you intend to write. ; This is set to 'dword'(32bit(4byte) signed integer) ; by default. See the help file for DllStructCreate ; for all types. An example: If you want to write a ; word that is 15 characters in length, you would use ; 'char[16]' since a 'char' is 8 bits (1 byte) in size. ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 ; @Error - 0 = No error. ; 1 = Invalid $ah_Handle. ; 2 = $sv_Type was not a string. ; 3 = $sv_Type is an unknown data type. ; 4 = Failed to allocate the memory needed for the DllStructure. ; 5 = Error allocating memory for $sv_Type. ; 6 = $v_Data is not in the proper format to be used with the ; "Type" selected for $sv_Type, or it is out of range. ; 7 = Failed to write to the specified process. ; Author(s): Nomad ; Note(s): Values sent must be in Decimal format, unless specified as a ; 'char' type, then they must be in ASCII format. Also note ; that size ('char[size]') for all 'char' types should be 1 ; greater than the actual size. ;================================================================================== Func _MemoryWrite($iv_Address, $ah_Handle, $v_Data, $sv_Type = 'dword') If Not IsArray($ah_Handle) Then SetError(1) Return 0 EndIf Local $v_Buffer = DllStructCreate($sv_Type) If @Error Then SetError(@Error + 1) Return 0 Else DllStructSetData($v_Buffer, 1, $v_Data) If @Error Then SetError(6) Return 0 EndIf EndIf DllCall($ah_Handle[0], 'int', 'WriteProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '') If Not @Error Then Return 1 Else SetError(7) Return 0 EndIf EndFunc -
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
I tried the base address + offset thing like this: _MemoryWrite($baseAddress + $off1 + $off2, $memory, $newValue, "float") ; Changes the value to 20 ...with and without "0x &" before Hex. Doesn't give me errors but still does nothing. I also double checked that the base address and offsets are correct. Anyone out there who has played with _MemoryWrite'ing? -
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
I figured in some cases people added the offset but I didn't see anyone adding two. I came with up something like this: $id = WinGetProcess("[CLASS:Application]", "") $baseAddress = 0x053969E8 $off1 = 0x3c4 $off2 = 0x0c $newValue = 20 $memory = _MemoryOpen($id) $1 = _MemoryRead($baseAddress,$id) $2 = Hex($1+$off1) $3 = Hex($2+$off2) _MemoryWrite($3, $memory, $newValue, "float") ; Changes the value to 20 _MemoryClose($memory) I can run it without errors but it doesn't change the wanted address. Any ideas if this is even close? -
_MemoryWrite with multiple offset values
Ryoni replied to Ryoni's topic in AutoIt General Help and Support
Thanks for tyring to help but I'm trying to figure how to write memory, not read. I already know how to read base address with offset values. -
At first I'd like to mention that I did search for this and I couldn't find clear answers how to do this with multiple pointers so here I go. The case is that that I need to change a float value and I have only succeed doing it with temporarily address. This is how I got it working but could somebody explain how do I make this work with the base address and offset values I have commented in. #include <NomadMemory.au3> $id = WinGetProcess("[CLASS:Application]", "") ;~ $baseAddress = 0x053969E8 ;~ $off1 = 0x3c4 ;~ $off2 = 0x0c $address = 0x053ABC34 $newValue = 20 $memory = _MemoryOpen($id) _MemoryWrite($address, $memory, $newValue, "float") ; Changes the value to 20 _MemoryClose($memory) I have tried writing directly to the $baseAddress but it just crashes my application so I think I need to include the offsets somehow. Any kind of help or tips appreciated.
-
Nevermind.. I got it working but just only with pure black as transparency. I wonder why other colors don't seem to work for me.
-
Sven (From the first page) hasn't been on for ages so I'd like to hear have any of you gotten the code he wrote working? ImageSearch made with transparency detection. As the code says: "$transparency = TRANSBLACK, TRANSWHITE or hex value (e.g. 0xffffff) of the color to be used as transparency can be omitted if not needed". But so far after numerous of tries it either doesn't find anything or sometimes when the $transparency is set to 'TRANSWHITE', all searches are seen as correct match even if a single pixel isn't correct. Any kind of tips or even example code is welcome of how the $transparency -paramenter should be used to work correctly.