kalamity / classmemory Goto Github PK
View Code? Open in Web Editor NEWAn AHK memory reading/writing class with pattern scans.
An AHK memory reading/writing class with pattern scans.
I can't seem to be able to loop stringToPattern() searches while the targeted program does not exist yet. I can do that easily with read() so that my memory tool will pick up the right memory addresses as soon as the targeted program is detected. This way I'm not forcing the user to run the target program BEFORE the memory tool, thus making it easier to use.
Here's an example. If I first launch Notepad, type Thisisatest and launch the script, the AOB is correctly found:
#Include classMemory.ahk
#SingleInstance Force
TargetProcess := new _ClassMemory("ahk_exe notepad.exe", "", hProcessCopy)
myAOBstringpattern := "Thisisatest"
ConvertBase(InputBase, OutputBase, number)
{
static u := A_IsUnicode ? "_wcstoui64" : "_strtoui64"
static v := A_IsUnicode ? "_i64tow" : "_i64toa"
VarSetCapacity(s, 65, 0)
value := DllCall("msvcrt.dll\" u, "Str", number, "UInt", 0, "UInt", InputBase, "CDECL Int64")
DllCall("msvcrt.dll\" v, "Int64", value, "Str", s, "UInt", OutputBase, "CDECL")
return s
}
Loop
{
myAOBscan := TargetProcess.stringToPattern(myAOBstringpattern, "UTF-16")
myAOBaddressdec := TargetProcess.processPatternScan(,, myAOBscan*)
if (myAOBaddressdec > 0) ;AOB found, stop scanning and convert it from decimal to hexadecimal
{
myAOBaddresshex := "0x" ConvertBase(10, 16, myAOBaddressdec)
MsgBox, found AOB at: %myAOBaddresshex%
ExitApp
}
else ;AOB not found, continue scanning
{
Sleep,500
}
}
Launching Notepad, launching the script and finally typing Thisisatest also works.
But if I first launch the script, then Notepad and type Thisisatest, the AOB will never be found even though the search is looped. Is there any workaround for this? I want to make my scripts as easy as possible for users.
Also, just an unrelated suggestion, I think classMemory should convert the found AOB address from decimal to hexadecimal AUTOMATICALLY. I mean the rest of the stuff I worked with in classMemory outputted addresses in hex, so why does this one in particular have to be dec?
could you please put here an example of how to get the base addrees adn find by those offsets ?, i could make this to return the current value.
0x74
0x1c
"League of Legends.exe"+169C294 095F1480
thanks in advance.
For some reason its reading values from certain addresses as 4bytes long... even when the type is Int64
block_id := mem.read(xy, "Int64")
For this address 1ea5b56ffc3 the value is 0x1622ff even though it should be 0x00000000001622FF
And for this address it works fine and is 8bytes long 1ea5b570053 and the value is 0x010000000E125AFF
Is there an examples file with calls?
I'm trying to perform an AOB scan on the entire process memory of Brawlhalla. Every time I run the scan, it returns -1. I've tried running this in 32 and 64 bit, running it as administrator and not. I've even tried it on different programs, but it still just returns -1. I've skimmed the comments in the classMemory script but can't figure this out. Am I doing something wrong?
Here's my code:
brawlhalla := new _ClassMemory("ahk_exe Brawlhalla.exe", "", hProcessCopy)
if !isObject(brawlhalla)
{
msgbox failed to open a handle
if (hProcessCopy = 0)
msgbox The program isn't running (not found) or you passed an incorrect program identifier parameter. In some cases _ClassMemory.setSeDebugPrivilege() may be required.
else if (hProcessCopy = "")
msgbox OpenProcess failed. If the target process has admin rights, then the script also needs to be ran as admin. _ClassMemory.setSeDebugPrivilege() may also be required. Consult A_LastError for more information.
ExitApp
}
msgbox % brawlhalla.BaseAddress
pattern := ["?", 0x00, 0x00, 0x00, "?", "?", "?", 0x5C, 0x13, 0x52, 0x1A, 0x5A, 0x01, 0x00, 0x00, 0x00]
address := brawlhalla.processPatternScan(,,pattern*)
msgbox % address
Hey I really like the work you've done with this class! I looked through the documentation and can't find this... Does your class have the ability to check the serial buffer/queue for available bytes?
I'm looking to make a callback function that gets fired when there are bytes to read from the input buffer. Rather than checking the queue every N seconds and timing out, it would be more efficient to be notified when there is data to read.
I'm thinking about working on this to modify it for other apps, how easy do you think that would be? Do you think you could give me some pointers on what would need to be changed for it to work on other apps.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.