Jump to content

Recommended Posts

Posted

I don't think that's normal.

Even though you're too vague, my guess is that your buffer isn't created correctly to begin with. I've noticed that unexperienced users have troubles reading and interpreting the APIs documentation correctly. Your $Buffer should be correctly sized "byte" array in case that API advertises null-separated character arrays (strings). Only then you can get all the strings out of the buffer.

♡♡♡

.

eMyvnE

Posted

I have:

typedef struct _FbwfCacheDetail{
   ULONG cacheSize;
   ULONG openHandleCount;
   ULONG fileNameLength;
   WCHAR fileName[1];
} FbwfCacheDetail, *PFbwfCacheDetail;

And convert to:

$size=4192;

$FbwfCacheDetail=DllStructCreate("ULONG cacheSize; ULONG openHandleCount; ULONG fileNameLength; WCHAR fileName[" & $size & "];")

Do it is right?

Posted (edited)

"size [in, out] On input, contains the size of cacheDetail. If the function returns ERROR_MORE_DATA, size contains the size of the required buffer."

i trigger ERROR_MORE_DATA and get $size.

Edited by Ontosy
Posted

I think buffer talks about  whole structure. (I'M  not over my machine to try out) 

So maybe you need to subtract other fields(ulong * 3)  or just allocate memory then used the pointer with your structure. 

 

Saludos

Posted (edited)

trancexx. it's right (I forgot  to divide). So my second solution is wrong. I forgot Autoit structures are fixed size.

 

Saludos

Edited by Danyfirex
Posted

 

So maybe you need to subtract other fields(ulong * 3)  or just allocate memory then used the pointer with your structure.

What is the size of fields(ulong * 3)?

Posted

 

What is the size of fields(ulong * 3)?

I meant same as trancexx's answer.

Saludos

Posted

f.e. if $size is 69 WCHAR fileName size is (69-3)/2 =33 ?
i'm not able to see size of fields(ulong * 3) in the trancexx's answer.

Posted

Look:

$size = 4192;
$size -= (3 * 4);3=your first 3  fields   4=size of Ulong in bytes
$size /= 2 ;divide by size of wchar(2 bytes)
$FbwfCacheDetail = DllStructCreate("ULONG cacheSize; ULONG openHandleCount; ULONG fileNameLength; WCHAR fileName[" & $size & "];")

Saludos

Posted

Ty, the calcule now is precise.
But i have every to use iteration to obtain the string.
If i use simple
DllStructGetData($FbwfCacheDetail, "fileName")
i obtain "2".

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...