Sign in to follow this  
Followers 0
SandelPerieanu

I DON'T UNDERSTAND!

14 posts in this topic

if $file is *.txt then $BUFFER_1=$BUFFER_2,

but if $file is *.exe then $BUFFER_1 <> $BUFFER_2

why?

$file = "TEST.EXE"

$open = FileOpen($file, 0)

$buffer_1 = FileRead($open, FileGetSize($file))

FileClose($file)

$buffer_2 = String($buffer_1)

Select

Case $buffer_1 = $buffer_2

MsgBox(0, "", "$BUFFER_1=$BUFFER_2")

Case Else

MsgBox(0, "", "$BUFFER_1<>$BUFFER_2")

EndSelect

Share this post


Link to post
Share on other sites



Excutables can be read differently each time. They are not always the exact same because they are not plain text and may be interpreted by AutoIt differently each time.

[OffTopic]Still working on that send file method eh?[/OffTopic]

AutoIt Smith

Share this post


Link to post
Share on other sites

I move this topic to "support forum" as it is not a scripts and scraps topic :P

Share this post


Link to post
Share on other sites

Excutables can be read differently each time. They are not always the exact same because they are not plain text and may be interpreted by AutoIt differently each time.

[OffTopic]Still working on that send file method eh?[/OffTopic]

AutoIt Smith

Nope!

for me,

send file working....i tried many times...and the same...working!

i tried to send exe and avi from bucharest to brasov(another city) and working....

explain me this!

Share this post


Link to post
Share on other sites

That is impossible unless you implement WSock or another library. AutoIt does not support that functionality because of how the strings get broken down during transfer.

Share this post


Link to post
Share on other sites

That is impossible unless you implement WSock or another library. AutoIt does not support that functionality because of how the strings get broken down during transfer.

Give me a break!

I explained to you!

i tried .....

it work every time.....

What it's problem?!!!?!?!?

Share this post


Link to post
Share on other sites

The problem is that it does not work on any system I have tried using it on and none of my friends can use it. It's been tested on atleast 50 systems and worked on none. It doesn't work on a global scale so I am not accepting it as a correct method. It may work for others and that is true but it cannot run on most so It isn't correct.

Share this post


Link to post
Share on other sites

Excutables can be read differently each time. They are not always the exact same because they are not plain text and may be interpreted by AutoIt differently each time.

:P Almost right!

AutoIt is guaranteed to read the EXE file identically each time. The issue is that you are reading the executable into a binary string and then converting it into a string (why?). I believe that the string will be terminated at the first null. Compare the sizes of both variables using StringLen() -- there will be a difference.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

with $buffer_2 = BinaryString ($buffer_1)

allways $BUFFER_1=$BUFFER_2

but with $buffer_2 = String ($buffer_2) --->>> $BUFFER_1<>$BUFFER_2

$result=DllCall($dll,"str","Function","str",$input)

only for String($input) ---> StringLen($result)>0

$file = "TEST.EXE"

$open = FileOpen($file, 0)

$buffer_1 = FileRead($open, FileGetSize($file))

FileClose($file)

$buffer_2 = BinaryString ($buffer_1)

Select

Case $buffer_1 = $buffer_2

MsgBox(0, "", "$BUFFER_1=$BUFFER_2")

Case Else

MsgBox(0, "", "$BUFFER_1<>$BUFFER_2")

EndSelect

Edited by psandu.ro

Share this post


Link to post
Share on other sites

with $buffer_2 = BinaryString ($buffer_1)

allways $BUFFER_1=$BUFFER_2

Correct.

but with $buffer_2 = String ($buffer_2) --->>> $BUFFER_1<>$BUFFER_2

Yes, also correct. $Buffer_2 is initially a BinaryString and you are then converting it to a String. They are different data types -- a String cannot hold the same data as a BinaryString.

Share this post


Link to post
Share on other sites

$result=DllCall($dll,"str","Function","str",$input)

only for String($input) ---> StringLen($result)>0

DLLCall() returns an array if successful -- not a string. The return value of the function can be found in $Result[0].

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

i know this and i tried.

Only if $input=String($input) then DllCall return correctly

Edited by psandu.ro

Share this post


Link to post
Share on other sites

What DLLCall() are you trying to use? It's very likely that if the function that you are calling expects strings containing nulls, there will be another way to do what you want (e.g. using DLLStructCreate() and then passing a structure pointer to DLLCall()).

Share this post


Link to post
Share on other sites

My understanding is that you want to pass a string containing nulls to/from a DLLCall(). If this is correct then you may want to watch this thread -- one of the AutoIt developers seems also to be seeking this functionality.

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