Jump to content
Sign in to follow this  
monoceres

Retrieving string from DllStruct

Recommended Posts

monoceres

A sample says more than a thousand words:

$s=DllStructCreate("char[255]")

$str=""
For $i=0 To 253
    $str&=Chr(Random(1,255,1))
Next
; Set the string to some random data
DllStructSetData($s,1,$str)

; Retrieve the string the usual way
$fromstruct=DllStructGetData($s,1)

; Get the string, char by char
$fromstruct2=""
For $i=1 To 254
    $fromstruct2&=DllStructGetData($s,1,$i)
Next

; They're not equal :/
MsgBox(0,($fromstruct==$fromstruct2),$fromstruct&@CRLF&@CRLF&$fromstruct2)

I just cannot see the difference, I thought the only difference would be that AutoIt would stop reading at Chr(0) in the first method.

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
trancexx

char is for ASCII char and you are filling it with over 127.

use wchar to get the same results if you are going over 127


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
monoceres

char is for ASCII char and you are filling it with over 127.

use wchar to get the same results if you are going over 127

Aaaw, I forgot that char is unsigned :)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
trancexx

I once forgot how old I am. This girl, lady actually, asked me and I just couldnt't remember. Nooo way. It was so embarrassing. While she waited there for my answer I tried to calculate it from my birth year (somehow did remember that) but just couldn't. Mainly because I couldn't remember what year it was.

So this is nothing. Don't worry.

edit:

btw, don't tell anyone this. I don't want it spread. It's a secret.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
monoceres

I once forgot how old I am. This girl, lady actually, asked me and I just couldnt't remember. Nooo way. It was so embarrassing. While she waited there for my answer I tried to calculate it from my birth year (somehow did remember that) but just couldn't. Mainly because I couldn't remember what year it was.

So this is nothing. Don't worry.

edit:

btw, don't tell anyone this. I don't want it spread. It's a secret.

Hahaha how drunk were you? :)


Broken link? PM me and I'll send you the file!

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  

×