gczobel Posted March 19, 2010 Share Posted March 19, 2010 (edited) Hi, 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") DllStructSetData($Data,1,DllStructGetPtr($Data)) DllStructSetData($Data,2,260) $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 March 19, 2010 by gczobel Link to comment Share on other sites More sharing options...
bo8ster Posted March 19, 2010 Share Posted March 19, 2010 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] Link to comment Share on other sites More sharing options...
trancexx Posted March 19, 2010 Share Posted March 19, 2010 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) ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now