Sign in to follow this  
Followers 0
neosporin

DllCallAddress

3 posts in this topic

#1 ·  Posted (edited)

I'm messing around with the Hoard memory allocator but I can't seem to get DLLCallAddress working correctly. I can use DllCall to allocate memory, but it doesn't allocate within the applications memory space.

I figured maybe if it is compiled with my exe, I will be able to operate it directly through the script, allowing consistent memory mapping. I was able to find the same function in memory if I load the dll attached to a compiled exe, but whenever I attempt to call the function, autoit will freeze. I'm mainly just messing around with stuff to get the feel for this allocator, so if its too much of an effort to get to the bottom of the issue, don't worry about it.

I am trying to use the address the first line of the function starts at, the same function that works when calling the dll directly (verified using IDA). Am I misunderstanding DllCallAddress's use as a function pointer? I'll continue messing around with DllCall in the meantime.

Thanks for the help.

Edit: forgot to post the function. This is the latest copy I have on my skydrive, the address isn't correct in this version. I've tried using intel's TBB allocator, and it also crashes autoit. I'm more wondering if I'm using DllCallAddress correctly.

Global $hMod, $pPrc
...
Func malloc($bytes, $mthd = 0)
    If $hMod = "" Then $hMod = _WinAPI_GetModuleHandle("libhoard.dll")
    If $pPrc = "" Then $pPrc = _WinAPI_GetProcAddress($hMod, 1)
    If $pPrc > 0 Then
        ConsoleWrite($pPrc & @CRLF)
        Switch $mthd
            Case 0 ;;;;WORKING
                ;$alloc = DllCall($mHndl, "ptr", 2, "int", $bytes)
            Case 1 ;;;;NOT WORKING
                $alloc = DllCallAddress("ptr", $pPrc + 0x20A4, "int", $bytes) 
        EndSwitch
        ConsoleWrite($alloc & @CRLF)
    EndIf
EndFunc   ;==>malloc
Edited by neosporin

Share this post


Link to post
Share on other sites



What would be the benefit of Hoard for a (non-threaded) AutoIt program? Wouldn't the required invokation machinery from (slow) DllCalls more than offset any gain Hoard could bring, if any?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

What would be the benefit of Hoard for a (non-threaded) AutoIt program? Wouldn't the required invokation machinery from (slow) DllCalls more than offset any gain Hoard could bring, if any?

Could very well be the case. I'm not an expert on any of it, I just wanted to see how much it would affect script I made that builds a mosaic from a folder of images.

If there isn't much gain, I can just go back to using VirtualAllocEx.

Thanks anyways for the help though

Edited by neosporin

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  
Followers 0