Jump to content
Sign in to follow this  

Reading buffer fill on dll

Recommended Posts



I need to read a buffer that is fill when I call a dll. This is the code:

$buff = DllStructCreate("char[260]")

$Data = DllStructCreate("ptr pchar;uint bufsize")

$handle = DllCall("buffer.dll","int","FillBuffer","ptr",DllStructGetPtr($Data))

The question is that I don't known how read the buffer.

I tried with:

$Buff1 = DllStructGetData($Data,1)

But when I see it on a msgbox I see only an hexadecimal number (a memory position I guess).

Anyone can help me?

Edited by gczobel

Share this post

Link to post
Share on other sites

What is mean to in there? As far as I can tell $Data is a struct full of pointers. Do you want to use "$buff" anywhere?

What is "FillBuffer" mean to do?

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post

Link to post
Share on other sites

You get pointer to some string.

Try this:

$tData = DllStructCreate("ptr pchar;uint bufsize")

DllCall("buffer.dll", "int", "FillBuffer", "ptr", DllStructGetPtr($Data))

$tBuff = DllStructGetData($Data, "pchar")
$tSize = DllStructGetData($tData, "bufsize")

$tString = DllStructCreate("char[" & DllStructGetData($tSize) & "]", DllStructGetPtr($tBuff))
$sString = DllStructGetData($tString, 1)

If bufsize member doesn't include null terminator you can add +1 when sizing string buffer to make the string null-terminated (that's important sometimes)




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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.